@dovetail-v2/refine 0.0.20 → 0.0.21-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,9 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
+ import i18n from "i18next";
7
8
  import * as React from "react";
8
- import React__default, { useCallback, useContext, createContext, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle, Suspense, useLayoutEffect, memo, PureComponent, createElement } from "react";
9
+ import React__default, { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, Suspense, useLayoutEffect, memo, PureComponent, createElement } from "react";
9
10
  import { ResourceContext, matchResourceFromRoute, useResource, useForm as useForm$1, pickNotDeprecated, useWarnAboutChange, useDelete, useNavigation, useBreadcrumb, useList, useParsed, useGo, useDeleteMany, useUpdate, useShow, useMenu, useDataProvider, useTable, Refine } from "@refinedev/core";
10
11
  import { parse, stringify } from "qs";
11
12
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
@@ -13,7 +14,6 @@ import { useUIKit, kitContext, Typo, Icon as Icon$1, popModal, pushModal, ModalS
13
14
  import yaml from "js-yaml";
14
15
  import { isObject, first, get, omit as omit$1, flatten, merge, keyBy } from "lodash-es";
15
16
  import { useForm } from "sunflower-antd";
16
- import i18n from "i18next";
17
17
  import { HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, EditPen16PrimaryIcon, TrashBinDelete16Icon, Download16GradientBlueIcon, MoreEllipsis316BoldBlueIcon, CheckmarkDoneSuccessCorrect16BoldGreenIcon, XmarkFailed16BoldRedIcon, DynamicResourceSchedule16BlueIcon, VmResume16Icon, SuspendedPause16GradientGrayIcon, Resume24Icon, SuspendedPause24GradientOrangeIcon } from "@cloudtower/icons-react";
18
18
  import * as monaco from "monaco-editor";
19
19
  import { setDiagnosticsOptions } from "monaco-yaml";
@@ -24,245 +24,754 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
24
24
  function getDefaultExportFromCjs(x) {
25
25
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
26
26
  }
27
- var jsxRuntime = { exports: {} };
28
- var reactJsxRuntime_production_min = {};
29
- /** @license React v16.14.0
30
- * react-jsx-runtime.production.min.js
31
- *
32
- * Copyright (c) Facebook, Inc. and its affiliates.
33
- *
34
- * This source code is licensed under the MIT license found in the
35
- * LICENSE file in the root directory of this source tree.
36
- */
37
- var hasRequiredReactJsxRuntime_production_min;
38
- function requireReactJsxRuntime_production_min() {
39
- if (hasRequiredReactJsxRuntime_production_min)
40
- return reactJsxRuntime_production_min;
41
- hasRequiredReactJsxRuntime_production_min = 1;
42
- var f = React__default, g = 60103;
43
- reactJsxRuntime_production_min.Fragment = 60107;
44
- if ("function" === typeof Symbol && Symbol.for) {
45
- var h = Symbol.for;
46
- g = h("react.element");
47
- reactJsxRuntime_production_min.Fragment = h("react.fragment");
27
+ function warn() {
28
+ if (console && console.warn) {
29
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
+ args[_key] = arguments[_key];
31
+ }
32
+ if (typeof args[0] === "string")
33
+ args[0] = `react-i18next:: ${args[0]}`;
34
+ console.warn(...args);
48
35
  }
49
- var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
50
- function q(c, a, k) {
51
- var b, d = {}, e = null, l = null;
52
- void 0 !== k && (e = "" + k);
53
- void 0 !== a.key && (e = "" + a.key);
54
- void 0 !== a.ref && (l = a.ref);
55
- for (b in a)
56
- n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
57
- if (c && c.defaultProps)
58
- for (b in a = c.defaultProps, a)
59
- void 0 === d[b] && (d[b] = a[b]);
60
- return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
36
+ }
37
+ const alreadyWarned = {};
38
+ function warnOnce() {
39
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
40
+ args[_key2] = arguments[_key2];
61
41
  }
62
- reactJsxRuntime_production_min.jsx = q;
63
- reactJsxRuntime_production_min.jsxs = q;
64
- return reactJsxRuntime_production_min;
42
+ if (typeof args[0] === "string" && alreadyWarned[args[0]])
43
+ return;
44
+ if (typeof args[0] === "string")
45
+ alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
46
+ warn(...args);
65
47
  }
66
- var reactJsxRuntime_development = {};
67
- /** @license React v16.14.0
68
- * react-jsx-runtime.development.js
69
- *
70
- * Copyright (c) Facebook, Inc. and its affiliates.
71
- *
72
- * This source code is licensed under the MIT license found in the
73
- * LICENSE file in the root directory of this source tree.
74
- */
75
- var hasRequiredReactJsxRuntime_development;
76
- function requireReactJsxRuntime_development() {
77
- if (hasRequiredReactJsxRuntime_development)
78
- return reactJsxRuntime_development;
79
- hasRequiredReactJsxRuntime_development = 1;
80
- (function(exports) {
81
- if (process.env.NODE_ENV !== "production") {
82
- (function() {
83
- var React2 = React__default;
84
- var REACT_ELEMENT_TYPE = 60103;
85
- var REACT_PORTAL_TYPE = 60106;
86
- exports.Fragment = 60107;
87
- var REACT_STRICT_MODE_TYPE = 60108;
88
- var REACT_PROFILER_TYPE = 60114;
89
- var REACT_PROVIDER_TYPE = 60109;
90
- var REACT_CONTEXT_TYPE = 60110;
91
- var REACT_FORWARD_REF_TYPE = 60112;
92
- var REACT_SUSPENSE_TYPE = 60113;
93
- var REACT_SUSPENSE_LIST_TYPE = 60120;
94
- var REACT_MEMO_TYPE = 60115;
95
- var REACT_LAZY_TYPE = 60116;
96
- var REACT_BLOCK_TYPE = 60121;
97
- var REACT_SERVER_BLOCK_TYPE = 60122;
98
- var REACT_FUNDAMENTAL_TYPE = 60117;
99
- var REACT_DEBUG_TRACING_MODE_TYPE = 60129;
100
- var REACT_LEGACY_HIDDEN_TYPE = 60131;
101
- if (typeof Symbol === "function" && Symbol.for) {
102
- var symbolFor = Symbol.for;
103
- REACT_ELEMENT_TYPE = symbolFor("react.element");
104
- REACT_PORTAL_TYPE = symbolFor("react.portal");
105
- exports.Fragment = symbolFor("react.fragment");
106
- REACT_STRICT_MODE_TYPE = symbolFor("react.strict_mode");
107
- REACT_PROFILER_TYPE = symbolFor("react.profiler");
108
- REACT_PROVIDER_TYPE = symbolFor("react.provider");
109
- REACT_CONTEXT_TYPE = symbolFor("react.context");
110
- REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref");
111
- REACT_SUSPENSE_TYPE = symbolFor("react.suspense");
112
- REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list");
113
- REACT_MEMO_TYPE = symbolFor("react.memo");
114
- REACT_LAZY_TYPE = symbolFor("react.lazy");
115
- REACT_BLOCK_TYPE = symbolFor("react.block");
116
- REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block");
117
- REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental");
118
- symbolFor("react.scope");
119
- symbolFor("react.opaque.id");
120
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode");
121
- symbolFor("react.offscreen");
122
- REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden");
123
- }
124
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
125
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
126
- function getIteratorFn(maybeIterable) {
127
- if (maybeIterable === null || typeof maybeIterable !== "object") {
128
- return null;
129
- }
130
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
131
- if (typeof maybeIterator === "function") {
132
- return maybeIterator;
133
- }
134
- return null;
135
- }
136
- var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
137
- function error(format) {
138
- {
139
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
140
- args[_key2 - 1] = arguments[_key2];
141
- }
142
- printWarning("error", format, args);
143
- }
144
- }
145
- function printWarning(level, format, args) {
146
- {
147
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
148
- var stack = "";
149
- if (currentlyValidatingElement) {
150
- var name2 = getComponentName(currentlyValidatingElement.type);
151
- var owner = currentlyValidatingElement._owner;
152
- stack += describeComponentFrame(name2, currentlyValidatingElement._source, owner && getComponentName(owner.type));
153
- }
154
- stack += ReactDebugCurrentFrame.getStackAddendum();
155
- if (stack !== "") {
156
- format += "%s";
157
- args = args.concat([stack]);
158
- }
159
- var argsWithFormat = args.map(function(item) {
160
- return "" + item;
161
- });
162
- argsWithFormat.unshift("Warning: " + format);
163
- Function.prototype.apply.call(console[level], console, argsWithFormat);
164
- }
165
- }
166
- var enableScopeAPI = false;
167
- function isValidElementType(type2) {
168
- if (typeof type2 === "string" || typeof type2 === "function") {
169
- return true;
170
- }
171
- if (type2 === exports.Fragment || type2 === REACT_PROFILER_TYPE || type2 === REACT_DEBUG_TRACING_MODE_TYPE || type2 === REACT_STRICT_MODE_TYPE || type2 === REACT_SUSPENSE_TYPE || type2 === REACT_SUSPENSE_LIST_TYPE || type2 === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
172
- return true;
173
- }
174
- if (typeof type2 === "object" && type2 !== null) {
175
- if (type2.$$typeof === REACT_LAZY_TYPE || type2.$$typeof === REACT_MEMO_TYPE || type2.$$typeof === REACT_PROVIDER_TYPE || type2.$$typeof === REACT_CONTEXT_TYPE || type2.$$typeof === REACT_FORWARD_REF_TYPE || type2.$$typeof === REACT_FUNDAMENTAL_TYPE || type2.$$typeof === REACT_BLOCK_TYPE || type2[0] === REACT_SERVER_BLOCK_TYPE) {
176
- return true;
177
- }
178
- }
179
- return false;
180
- }
181
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
182
- function describeComponentFrame(name2, source, ownerName) {
183
- var sourceInfo = "";
184
- if (source) {
185
- var path = source.fileName;
186
- var fileName = path.replace(BEFORE_SLASH_RE, "");
187
- {
188
- if (/^index\./.test(fileName)) {
189
- var match = path.match(BEFORE_SLASH_RE);
190
- if (match) {
191
- var pathBeforeSlash = match[1];
192
- if (pathBeforeSlash) {
193
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, "");
194
- fileName = folderName + "/" + fileName;
195
- }
196
- }
197
- }
198
- }
199
- sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")";
200
- } else if (ownerName) {
201
- sourceInfo = " (created by " + ownerName + ")";
202
- }
203
- return "\n in " + (name2 || "Unknown") + sourceInfo;
204
- }
205
- var Resolved = 1;
206
- function refineResolvedLazyComponent(lazyComponent) {
207
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
208
- }
209
- function getWrappedName(outerType, innerType, wrapperName) {
210
- var functionName = innerType.displayName || innerType.name || "";
211
- return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
212
- }
213
- function getComponentName(type2) {
214
- if (type2 == null) {
215
- return null;
216
- }
217
- {
218
- if (typeof type2.tag === "number") {
219
- error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue.");
220
- }
221
- }
222
- if (typeof type2 === "function") {
223
- return type2.displayName || type2.name || null;
224
- }
225
- if (typeof type2 === "string") {
226
- return type2;
227
- }
228
- switch (type2) {
229
- case exports.Fragment:
230
- return "Fragment";
231
- case REACT_PORTAL_TYPE:
232
- return "Portal";
233
- case REACT_PROFILER_TYPE:
234
- return "Profiler";
235
- case REACT_STRICT_MODE_TYPE:
236
- return "StrictMode";
237
- case REACT_SUSPENSE_TYPE:
238
- return "Suspense";
239
- case REACT_SUSPENSE_LIST_TYPE:
240
- return "SuspenseList";
241
- }
242
- if (typeof type2 === "object") {
243
- switch (type2.$$typeof) {
244
- case REACT_CONTEXT_TYPE:
245
- return "Context.Consumer";
246
- case REACT_PROVIDER_TYPE:
247
- return "Context.Provider";
248
- case REACT_FORWARD_REF_TYPE:
249
- return getWrappedName(type2, type2.render, "ForwardRef");
250
- case REACT_MEMO_TYPE:
251
- return getComponentName(type2.type);
252
- case REACT_BLOCK_TYPE:
253
- return getComponentName(type2.render);
254
- case REACT_LAZY_TYPE: {
255
- var thenable = type2;
256
- var resolvedThenable = refineResolvedLazyComponent(thenable);
257
- if (resolvedThenable) {
258
- return getComponentName(resolvedThenable);
259
- }
260
- break;
261
- }
262
- }
263
- }
264
- return null;
265
- }
48
+ const loadedClb = (i18n2, cb) => () => {
49
+ if (i18n2.isInitialized) {
50
+ cb();
51
+ } else {
52
+ const initialized = () => {
53
+ setTimeout(() => {
54
+ i18n2.off("initialized", initialized);
55
+ }, 0);
56
+ cb();
57
+ };
58
+ i18n2.on("initialized", initialized);
59
+ }
60
+ };
61
+ function loadNamespaces(i18n2, ns, cb) {
62
+ i18n2.loadNamespaces(ns, loadedClb(i18n2, cb));
63
+ }
64
+ function loadLanguages(i18n2, lng, ns, cb) {
65
+ if (typeof ns === "string")
66
+ ns = [ns];
67
+ ns.forEach((n) => {
68
+ if (i18n2.options.ns.indexOf(n) < 0)
69
+ i18n2.options.ns.push(n);
70
+ });
71
+ i18n2.loadLanguages(lng, loadedClb(i18n2, cb));
72
+ }
73
+ function oldI18nextHasLoadedNamespace(ns, i18n2) {
74
+ let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
75
+ const lng = i18n2.languages[0];
76
+ const fallbackLng = i18n2.options ? i18n2.options.fallbackLng : false;
77
+ const lastLng = i18n2.languages[i18n2.languages.length - 1];
78
+ if (lng.toLowerCase() === "cimode")
79
+ return true;
80
+ const loadNotPending = (l, n) => {
81
+ const loadState = i18n2.services.backendConnector.state[`${l}|${n}`];
82
+ return loadState === -1 || loadState === 2;
83
+ };
84
+ if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n2.services.backendConnector.backend && i18n2.isLanguageChangingTo && !loadNotPending(i18n2.isLanguageChangingTo, ns))
85
+ return false;
86
+ if (i18n2.hasResourceBundle(lng, ns))
87
+ return true;
88
+ if (!i18n2.services.backendConnector.backend || i18n2.options.resources && !i18n2.options.partialBundledLanguages)
89
+ return true;
90
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
91
+ return true;
92
+ return false;
93
+ }
94
+ function hasLoadedNamespace(ns, i18n2) {
95
+ let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
96
+ if (!i18n2.languages || !i18n2.languages.length) {
97
+ warnOnce("i18n.languages were undefined or empty", i18n2.languages);
98
+ return true;
99
+ }
100
+ const isNewerI18next = i18n2.options.ignoreJSONStructure !== void 0;
101
+ if (!isNewerI18next) {
102
+ return oldI18nextHasLoadedNamespace(ns, i18n2, options);
103
+ }
104
+ return i18n2.hasLoadedNamespace(ns, {
105
+ lng: options.lng,
106
+ precheck: (i18nInstance2, loadNotPending) => {
107
+ if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns))
108
+ return false;
109
+ }
110
+ });
111
+ }
112
+ const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
113
+ const htmlEntities = {
114
+ "&amp;": "&",
115
+ "&#38;": "&",
116
+ "&lt;": "<",
117
+ "&#60;": "<",
118
+ "&gt;": ">",
119
+ "&#62;": ">",
120
+ "&apos;": "'",
121
+ "&#39;": "'",
122
+ "&quot;": '"',
123
+ "&#34;": '"',
124
+ "&nbsp;": " ",
125
+ "&#160;": " ",
126
+ "&copy;": "©",
127
+ "&#169;": "©",
128
+ "&reg;": "®",
129
+ "&#174;": "®",
130
+ "&hellip;": "",
131
+ "&#8230;": "…",
132
+ "&#x2F;": "/",
133
+ "&#47;": "/"
134
+ };
135
+ const unescapeHtmlEntity = (m) => htmlEntities[m];
136
+ const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
137
+ let defaultOptions = {
138
+ bindI18n: "languageChanged",
139
+ bindI18nStore: "",
140
+ transEmptyNodeValue: "",
141
+ transSupportBasicHtmlNodes: true,
142
+ transWrapTextNodes: "",
143
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
144
+ useSuspense: true,
145
+ unescape
146
+ };
147
+ function setDefaults() {
148
+ let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
149
+ defaultOptions = {
150
+ ...defaultOptions,
151
+ ...options
152
+ };
153
+ }
154
+ function getDefaults() {
155
+ return defaultOptions;
156
+ }
157
+ let i18nInstance;
158
+ function setI18n(instance) {
159
+ i18nInstance = instance;
160
+ }
161
+ function getI18n() {
162
+ return i18nInstance;
163
+ }
164
+ const initReactI18next = {
165
+ type: "3rdParty",
166
+ init(instance) {
167
+ setDefaults(instance.options.react);
168
+ setI18n(instance);
169
+ }
170
+ };
171
+ const I18nContext = createContext();
172
+ class ReportNamespaces {
173
+ constructor() {
174
+ this.usedNamespaces = {};
175
+ }
176
+ addUsedNamespaces(namespaces) {
177
+ namespaces.forEach((ns) => {
178
+ if (!this.usedNamespaces[ns])
179
+ this.usedNamespaces[ns] = true;
180
+ });
181
+ }
182
+ getUsedNamespaces() {
183
+ return Object.keys(this.usedNamespaces);
184
+ }
185
+ }
186
+ const usePrevious = (value, ignore) => {
187
+ const ref = useRef();
188
+ useEffect(() => {
189
+ ref.current = ignore ? ref.current : value;
190
+ }, [value, ignore]);
191
+ return ref.current;
192
+ };
193
+ function useTranslation(ns) {
194
+ let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
195
+ const {
196
+ i18n: i18nFromProps
197
+ } = props;
198
+ const {
199
+ i18n: i18nFromContext,
200
+ defaultNS: defaultNSFromContext
201
+ } = useContext(I18nContext) || {};
202
+ const i18n2 = i18nFromProps || i18nFromContext || getI18n();
203
+ if (i18n2 && !i18n2.reportNamespaces)
204
+ i18n2.reportNamespaces = new ReportNamespaces();
205
+ if (!i18n2) {
206
+ warnOnce("You will need to pass in an i18next instance by using initReactI18next");
207
+ const notReadyT = (k, optsOrDefaultValue) => {
208
+ if (typeof optsOrDefaultValue === "string")
209
+ return optsOrDefaultValue;
210
+ if (optsOrDefaultValue && typeof optsOrDefaultValue === "object" && typeof optsOrDefaultValue.defaultValue === "string")
211
+ return optsOrDefaultValue.defaultValue;
212
+ return Array.isArray(k) ? k[k.length - 1] : k;
213
+ };
214
+ const retNotReady = [notReadyT, {}, false];
215
+ retNotReady.t = notReadyT;
216
+ retNotReady.i18n = {};
217
+ retNotReady.ready = false;
218
+ return retNotReady;
219
+ }
220
+ if (i18n2.options.react && i18n2.options.react.wait !== void 0)
221
+ warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
222
+ const i18nOptions = {
223
+ ...getDefaults(),
224
+ ...i18n2.options.react,
225
+ ...props
226
+ };
227
+ const {
228
+ useSuspense,
229
+ keyPrefix
230
+ } = i18nOptions;
231
+ let namespaces = ns || defaultNSFromContext || i18n2.options && i18n2.options.defaultNS;
232
+ namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
233
+ if (i18n2.reportNamespaces.addUsedNamespaces)
234
+ i18n2.reportNamespaces.addUsedNamespaces(namespaces);
235
+ const ready2 = (i18n2.isInitialized || i18n2.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n2, i18nOptions));
236
+ function getT() {
237
+ return i18n2.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
238
+ }
239
+ const [t, setT] = useState(getT);
240
+ let joinedNS = namespaces.join();
241
+ if (props.lng)
242
+ joinedNS = `${props.lng}${joinedNS}`;
243
+ const previousJoinedNS = usePrevious(joinedNS);
244
+ const isMounted = useRef(true);
245
+ useEffect(() => {
246
+ const {
247
+ bindI18n,
248
+ bindI18nStore
249
+ } = i18nOptions;
250
+ isMounted.current = true;
251
+ if (!ready2 && !useSuspense) {
252
+ if (props.lng) {
253
+ loadLanguages(i18n2, props.lng, namespaces, () => {
254
+ if (isMounted.current)
255
+ setT(getT);
256
+ });
257
+ } else {
258
+ loadNamespaces(i18n2, namespaces, () => {
259
+ if (isMounted.current)
260
+ setT(getT);
261
+ });
262
+ }
263
+ }
264
+ if (ready2 && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
265
+ setT(getT);
266
+ }
267
+ function boundReset() {
268
+ if (isMounted.current)
269
+ setT(getT);
270
+ }
271
+ if (bindI18n && i18n2)
272
+ i18n2.on(bindI18n, boundReset);
273
+ if (bindI18nStore && i18n2)
274
+ i18n2.store.on(bindI18nStore, boundReset);
275
+ return () => {
276
+ isMounted.current = false;
277
+ if (bindI18n && i18n2)
278
+ bindI18n.split(" ").forEach((e) => i18n2.off(e, boundReset));
279
+ if (bindI18nStore && i18n2)
280
+ bindI18nStore.split(" ").forEach((e) => i18n2.store.off(e, boundReset));
281
+ };
282
+ }, [i18n2, joinedNS]);
283
+ const isInitial = useRef(true);
284
+ useEffect(() => {
285
+ if (isMounted.current && !isInitial.current) {
286
+ setT(getT);
287
+ }
288
+ isInitial.current = false;
289
+ }, [i18n2, keyPrefix]);
290
+ const ret = [t, i18n2, ready2];
291
+ ret.t = t;
292
+ ret.i18n = i18n2;
293
+ ret.ready = ready2;
294
+ if (ready2)
295
+ return ret;
296
+ if (!ready2 && !useSuspense)
297
+ return ret;
298
+ throw new Promise((resolve) => {
299
+ if (props.lng) {
300
+ loadLanguages(i18n2, props.lng, namespaces, () => resolve());
301
+ } else {
302
+ loadNamespaces(i18n2, namespaces, () => resolve());
303
+ }
304
+ });
305
+ }
306
+ const copy$1 = "Copy";
307
+ const reset_arguments$1 = "Reset";
308
+ const view_changes$1 = "Show Diff";
309
+ const back_to_edit$1 = "Edit";
310
+ const configure_file$1 = "Configuration";
311
+ const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
312
+ const yaml_value_wrong$1 = "Configuration has invalid values.";
313
+ const edit_yaml$1 = "Edit YAML";
314
+ const copied$1 = "Copied";
315
+ const already_reset$1 = "Already reset";
316
+ const fetch_schema_fail$1 = "Failed to fetch schema.";
317
+ const obtain_data_error$1 = "Having trouble getting data.";
318
+ const retry$1 = "Retry";
319
+ const create_resource$1 = "Create {{resource}}";
320
+ const edit_resource$1 = "Edit {{resource}}";
321
+ const dovetail$1 = {
322
+ copy: copy$1,
323
+ reset_arguments: reset_arguments$1,
324
+ view_changes: view_changes$1,
325
+ back_to_edit: back_to_edit$1,
326
+ configure_file: configure_file$1,
327
+ yaml_format_wrong: yaml_format_wrong$1,
328
+ yaml_value_wrong: yaml_value_wrong$1,
329
+ edit_yaml: edit_yaml$1,
330
+ copied: copied$1,
331
+ already_reset: already_reset$1,
332
+ fetch_schema_fail: fetch_schema_fail$1,
333
+ obtain_data_error: obtain_data_error$1,
334
+ retry: retry$1,
335
+ create_resource: create_resource$1,
336
+ edit_resource: edit_resource$1
337
+ };
338
+ const EN = {
339
+ dovetail: dovetail$1
340
+ };
341
+ const copy = "复制";
342
+ const reset_arguments = "重置";
343
+ const view_changes = "查看改动";
344
+ const back_to_edit = "编辑";
345
+ const configure_file = "配置内容";
346
+ const yaml_format_wrong = "配置内容不是有效的 yaml 格式。";
347
+ const yaml_value_wrong = "配置内容中存在不合法的值。";
348
+ const edit_yaml = "编辑 YAML";
349
+ const copied = "已复制";
350
+ const already_reset = "已重置";
351
+ const cancel = "取消";
352
+ const create = "创建";
353
+ const confirm_delete_text = "确定要删除 {{target}} 吗?";
354
+ const edit = "编辑";
355
+ const namespace = "名字空间";
356
+ const name = "名称";
357
+ const state = "状态";
358
+ const status = "状态";
359
+ const phase = "状态";
360
+ const image = "容器镜像";
361
+ const replicas = "副本数";
362
+ const created_time = "创建时间";
363
+ const label = "标签";
364
+ const annotation = "注释";
365
+ const type = "类型";
366
+ const event = "事件";
367
+ const reason = "原因";
368
+ const object = "对象";
369
+ const note$1 = "事件信息";
370
+ const condition = "Condition";
371
+ const download_yaml = "下载 YAML";
372
+ const detail = "详情";
373
+ const node_name = "主机名称";
374
+ const restarts = "重启次数";
375
+ const updated_time = "更新时间";
376
+ const message = "消息";
377
+ const save = "保存";
378
+ const more = "更多";
379
+ const workload = "工作负载";
380
+ const all_namespaces = "所有名字空间";
381
+ const empty = "无可显示的数据";
382
+ const schedule = "调度时间表";
383
+ const lastScheduleTime = "上次调度时间";
384
+ const duration = "持续时间";
385
+ const completions = "完成 Job 历史数";
386
+ const started = "开始时间";
387
+ const init_container = "初始化容器";
388
+ const container = "容器";
389
+ const redeploy = "重新部署";
390
+ const data = "数据";
391
+ const suspend = "暂停";
392
+ const resume = "重新开始";
393
+ const cluster = "集群";
394
+ const storage = "存储";
395
+ const network = "网络";
396
+ const clusterIp = "集群 IP";
397
+ const sessionAffinity = "会话保持";
398
+ const log = "日志";
399
+ const select_container = "选择容器";
400
+ const wrap = "折叠";
401
+ const resume_log = "继续";
402
+ const log_new_lines = ",并展示 {{ count }} 行新日志";
403
+ const fetch_schema_fail = "获取 schema 失败。";
404
+ const obtain_data_error = "获取数据时遇到问题。";
405
+ const retry = "重试";
406
+ const ready = "就绪";
407
+ const updating = "更新中";
408
+ const completed = "完成";
409
+ const failed = "异常";
410
+ const suspended = "挂起";
411
+ const running = "运行中";
412
+ const terminating = "终止";
413
+ const succeeded = "成功终止";
414
+ const unknown = "未知";
415
+ const pending = "待处理";
416
+ const waiting = "等待中";
417
+ const create_resource = "创建 {{resource}}";
418
+ const edit_resource = "编辑 {{resource}}";
419
+ const sec = "秒";
420
+ const min = "分";
421
+ const hr = "小时";
422
+ const day = "天";
423
+ const expand = "展开";
424
+ const fold = "收起";
425
+ const rule = "规则";
426
+ const default_backend = "默认后端";
427
+ const ingress_rule_type = "规则类型";
428
+ const port = "端口";
429
+ const dovetail = {
430
+ copy,
431
+ reset_arguments,
432
+ view_changes,
433
+ back_to_edit,
434
+ configure_file,
435
+ yaml_format_wrong,
436
+ yaml_value_wrong,
437
+ edit_yaml,
438
+ copied,
439
+ already_reset,
440
+ cancel,
441
+ "delete": "删除",
442
+ create,
443
+ confirm_delete_text,
444
+ edit,
445
+ namespace,
446
+ name,
447
+ state,
448
+ status,
449
+ phase,
450
+ image,
451
+ replicas,
452
+ created_time,
453
+ label,
454
+ annotation,
455
+ type,
456
+ event,
457
+ reason,
458
+ object,
459
+ note: note$1,
460
+ condition,
461
+ download_yaml,
462
+ detail,
463
+ node_name,
464
+ restarts,
465
+ updated_time,
466
+ message,
467
+ save,
468
+ more,
469
+ workload,
470
+ all_namespaces,
471
+ empty,
472
+ schedule,
473
+ lastScheduleTime,
474
+ duration,
475
+ completions,
476
+ started,
477
+ init_container,
478
+ container,
479
+ redeploy,
480
+ data,
481
+ suspend,
482
+ resume,
483
+ cluster,
484
+ storage,
485
+ network,
486
+ clusterIp,
487
+ sessionAffinity,
488
+ log,
489
+ select_container,
490
+ wrap,
491
+ resume_log,
492
+ log_new_lines,
493
+ fetch_schema_fail,
494
+ obtain_data_error,
495
+ retry,
496
+ ready,
497
+ updating,
498
+ completed,
499
+ failed,
500
+ suspended,
501
+ running,
502
+ terminating,
503
+ succeeded,
504
+ unknown,
505
+ pending,
506
+ waiting,
507
+ create_resource,
508
+ edit_resource,
509
+ sec,
510
+ min,
511
+ hr,
512
+ day,
513
+ expand,
514
+ fold,
515
+ rule,
516
+ default_backend,
517
+ ingress_rule_type,
518
+ port
519
+ };
520
+ const ZH = {
521
+ dovetail
522
+ };
523
+ const resources = {
524
+ "en-US": EN,
525
+ "zh-CN": ZH
526
+ };
527
+ i18n.use(initReactI18next).init({
528
+ supportedLngs: ["en-US", "zh-CN"],
529
+ resources,
530
+ ns: Object.keys(resources["zh-CN"]),
531
+ defaultNS: "dovetail",
532
+ fallbackLng: ["en-US", "zh-CN"],
533
+ lng: "zh-CN",
534
+ nsSeparator: "."
535
+ });
536
+ var jsxRuntime = { exports: {} };
537
+ var reactJsxRuntime_production_min = {};
538
+ /** @license React v16.14.0
539
+ * react-jsx-runtime.production.min.js
540
+ *
541
+ * Copyright (c) Facebook, Inc. and its affiliates.
542
+ *
543
+ * This source code is licensed under the MIT license found in the
544
+ * LICENSE file in the root directory of this source tree.
545
+ */
546
+ var hasRequiredReactJsxRuntime_production_min;
547
+ function requireReactJsxRuntime_production_min() {
548
+ if (hasRequiredReactJsxRuntime_production_min)
549
+ return reactJsxRuntime_production_min;
550
+ hasRequiredReactJsxRuntime_production_min = 1;
551
+ var f = React__default, g = 60103;
552
+ reactJsxRuntime_production_min.Fragment = 60107;
553
+ if ("function" === typeof Symbol && Symbol.for) {
554
+ var h = Symbol.for;
555
+ g = h("react.element");
556
+ reactJsxRuntime_production_min.Fragment = h("react.fragment");
557
+ }
558
+ var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
559
+ function q(c, a, k) {
560
+ var b, d = {}, e = null, l = null;
561
+ void 0 !== k && (e = "" + k);
562
+ void 0 !== a.key && (e = "" + a.key);
563
+ void 0 !== a.ref && (l = a.ref);
564
+ for (b in a)
565
+ n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
566
+ if (c && c.defaultProps)
567
+ for (b in a = c.defaultProps, a)
568
+ void 0 === d[b] && (d[b] = a[b]);
569
+ return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
570
+ }
571
+ reactJsxRuntime_production_min.jsx = q;
572
+ reactJsxRuntime_production_min.jsxs = q;
573
+ return reactJsxRuntime_production_min;
574
+ }
575
+ var reactJsxRuntime_development = {};
576
+ /** @license React v16.14.0
577
+ * react-jsx-runtime.development.js
578
+ *
579
+ * Copyright (c) Facebook, Inc. and its affiliates.
580
+ *
581
+ * This source code is licensed under the MIT license found in the
582
+ * LICENSE file in the root directory of this source tree.
583
+ */
584
+ var hasRequiredReactJsxRuntime_development;
585
+ function requireReactJsxRuntime_development() {
586
+ if (hasRequiredReactJsxRuntime_development)
587
+ return reactJsxRuntime_development;
588
+ hasRequiredReactJsxRuntime_development = 1;
589
+ (function(exports) {
590
+ if (process.env.NODE_ENV !== "production") {
591
+ (function() {
592
+ var React2 = React__default;
593
+ var REACT_ELEMENT_TYPE = 60103;
594
+ var REACT_PORTAL_TYPE = 60106;
595
+ exports.Fragment = 60107;
596
+ var REACT_STRICT_MODE_TYPE = 60108;
597
+ var REACT_PROFILER_TYPE = 60114;
598
+ var REACT_PROVIDER_TYPE = 60109;
599
+ var REACT_CONTEXT_TYPE = 60110;
600
+ var REACT_FORWARD_REF_TYPE = 60112;
601
+ var REACT_SUSPENSE_TYPE = 60113;
602
+ var REACT_SUSPENSE_LIST_TYPE = 60120;
603
+ var REACT_MEMO_TYPE = 60115;
604
+ var REACT_LAZY_TYPE = 60116;
605
+ var REACT_BLOCK_TYPE = 60121;
606
+ var REACT_SERVER_BLOCK_TYPE = 60122;
607
+ var REACT_FUNDAMENTAL_TYPE = 60117;
608
+ var REACT_DEBUG_TRACING_MODE_TYPE = 60129;
609
+ var REACT_LEGACY_HIDDEN_TYPE = 60131;
610
+ if (typeof Symbol === "function" && Symbol.for) {
611
+ var symbolFor = Symbol.for;
612
+ REACT_ELEMENT_TYPE = symbolFor("react.element");
613
+ REACT_PORTAL_TYPE = symbolFor("react.portal");
614
+ exports.Fragment = symbolFor("react.fragment");
615
+ REACT_STRICT_MODE_TYPE = symbolFor("react.strict_mode");
616
+ REACT_PROFILER_TYPE = symbolFor("react.profiler");
617
+ REACT_PROVIDER_TYPE = symbolFor("react.provider");
618
+ REACT_CONTEXT_TYPE = symbolFor("react.context");
619
+ REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref");
620
+ REACT_SUSPENSE_TYPE = symbolFor("react.suspense");
621
+ REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list");
622
+ REACT_MEMO_TYPE = symbolFor("react.memo");
623
+ REACT_LAZY_TYPE = symbolFor("react.lazy");
624
+ REACT_BLOCK_TYPE = symbolFor("react.block");
625
+ REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block");
626
+ REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental");
627
+ symbolFor("react.scope");
628
+ symbolFor("react.opaque.id");
629
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode");
630
+ symbolFor("react.offscreen");
631
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden");
632
+ }
633
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
634
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
635
+ function getIteratorFn(maybeIterable) {
636
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
637
+ return null;
638
+ }
639
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
640
+ if (typeof maybeIterator === "function") {
641
+ return maybeIterator;
642
+ }
643
+ return null;
644
+ }
645
+ var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
646
+ function error(format) {
647
+ {
648
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
649
+ args[_key2 - 1] = arguments[_key2];
650
+ }
651
+ printWarning("error", format, args);
652
+ }
653
+ }
654
+ function printWarning(level, format, args) {
655
+ {
656
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
657
+ var stack = "";
658
+ if (currentlyValidatingElement) {
659
+ var name2 = getComponentName(currentlyValidatingElement.type);
660
+ var owner = currentlyValidatingElement._owner;
661
+ stack += describeComponentFrame(name2, currentlyValidatingElement._source, owner && getComponentName(owner.type));
662
+ }
663
+ stack += ReactDebugCurrentFrame.getStackAddendum();
664
+ if (stack !== "") {
665
+ format += "%s";
666
+ args = args.concat([stack]);
667
+ }
668
+ var argsWithFormat = args.map(function(item) {
669
+ return "" + item;
670
+ });
671
+ argsWithFormat.unshift("Warning: " + format);
672
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
673
+ }
674
+ }
675
+ var enableScopeAPI = false;
676
+ function isValidElementType(type2) {
677
+ if (typeof type2 === "string" || typeof type2 === "function") {
678
+ return true;
679
+ }
680
+ if (type2 === exports.Fragment || type2 === REACT_PROFILER_TYPE || type2 === REACT_DEBUG_TRACING_MODE_TYPE || type2 === REACT_STRICT_MODE_TYPE || type2 === REACT_SUSPENSE_TYPE || type2 === REACT_SUSPENSE_LIST_TYPE || type2 === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
681
+ return true;
682
+ }
683
+ if (typeof type2 === "object" && type2 !== null) {
684
+ if (type2.$$typeof === REACT_LAZY_TYPE || type2.$$typeof === REACT_MEMO_TYPE || type2.$$typeof === REACT_PROVIDER_TYPE || type2.$$typeof === REACT_CONTEXT_TYPE || type2.$$typeof === REACT_FORWARD_REF_TYPE || type2.$$typeof === REACT_FUNDAMENTAL_TYPE || type2.$$typeof === REACT_BLOCK_TYPE || type2[0] === REACT_SERVER_BLOCK_TYPE) {
685
+ return true;
686
+ }
687
+ }
688
+ return false;
689
+ }
690
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
691
+ function describeComponentFrame(name2, source, ownerName) {
692
+ var sourceInfo = "";
693
+ if (source) {
694
+ var path = source.fileName;
695
+ var fileName = path.replace(BEFORE_SLASH_RE, "");
696
+ {
697
+ if (/^index\./.test(fileName)) {
698
+ var match = path.match(BEFORE_SLASH_RE);
699
+ if (match) {
700
+ var pathBeforeSlash = match[1];
701
+ if (pathBeforeSlash) {
702
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, "");
703
+ fileName = folderName + "/" + fileName;
704
+ }
705
+ }
706
+ }
707
+ }
708
+ sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")";
709
+ } else if (ownerName) {
710
+ sourceInfo = " (created by " + ownerName + ")";
711
+ }
712
+ return "\n in " + (name2 || "Unknown") + sourceInfo;
713
+ }
714
+ var Resolved = 1;
715
+ function refineResolvedLazyComponent(lazyComponent) {
716
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
717
+ }
718
+ function getWrappedName(outerType, innerType, wrapperName) {
719
+ var functionName = innerType.displayName || innerType.name || "";
720
+ return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
721
+ }
722
+ function getComponentName(type2) {
723
+ if (type2 == null) {
724
+ return null;
725
+ }
726
+ {
727
+ if (typeof type2.tag === "number") {
728
+ error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue.");
729
+ }
730
+ }
731
+ if (typeof type2 === "function") {
732
+ return type2.displayName || type2.name || null;
733
+ }
734
+ if (typeof type2 === "string") {
735
+ return type2;
736
+ }
737
+ switch (type2) {
738
+ case exports.Fragment:
739
+ return "Fragment";
740
+ case REACT_PORTAL_TYPE:
741
+ return "Portal";
742
+ case REACT_PROFILER_TYPE:
743
+ return "Profiler";
744
+ case REACT_STRICT_MODE_TYPE:
745
+ return "StrictMode";
746
+ case REACT_SUSPENSE_TYPE:
747
+ return "Suspense";
748
+ case REACT_SUSPENSE_LIST_TYPE:
749
+ return "SuspenseList";
750
+ }
751
+ if (typeof type2 === "object") {
752
+ switch (type2.$$typeof) {
753
+ case REACT_CONTEXT_TYPE:
754
+ return "Context.Consumer";
755
+ case REACT_PROVIDER_TYPE:
756
+ return "Context.Provider";
757
+ case REACT_FORWARD_REF_TYPE:
758
+ return getWrappedName(type2, type2.render, "ForwardRef");
759
+ case REACT_MEMO_TYPE:
760
+ return getComponentName(type2.type);
761
+ case REACT_BLOCK_TYPE:
762
+ return getComponentName(type2.render);
763
+ case REACT_LAZY_TYPE: {
764
+ var thenable = type2;
765
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
766
+ if (resolvedThenable) {
767
+ return getComponentName(resolvedThenable);
768
+ }
769
+ break;
770
+ }
771
+ }
772
+ }
773
+ return null;
774
+ }
266
775
  var loggedTypeFailures = {};
267
776
  ReactSharedInternals.ReactDebugCurrentFrame;
268
777
  var currentlyValidatingElement = null;
@@ -557,510 +1066,231 @@ function requireReactJsxRuntime_development() {
557
1066
  }
558
1067
  }
559
1068
  }
560
- }
561
- }
562
- function validatePropTypes(element) {
563
- {
564
- var type2 = element.type;
565
- if (type2 === null || type2 === void 0 || typeof type2 === "string") {
566
- return;
567
- }
568
- var propTypes;
569
- if (typeof type2 === "function") {
570
- propTypes = type2.propTypes;
571
- } else if (typeof type2 === "object" && (type2.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
572
- // Inner props are checked in the reconciler.
573
- type2.$$typeof === REACT_MEMO_TYPE)) {
574
- propTypes = type2.propTypes;
575
- } else {
576
- return;
577
- }
578
- if (propTypes) {
579
- var name2 = getComponentName(type2);
580
- checkPropTypes(propTypes, element.props, "prop", name2, element);
581
- } else if (type2.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
582
- propTypesMisspellWarningShown = true;
583
- var _name = getComponentName(type2);
584
- error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
585
- }
586
- if (typeof type2.getDefaultProps === "function" && !type2.getDefaultProps.isReactClassApproved) {
587
- error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
588
- }
589
- }
590
- }
591
- function validateFragmentProps(fragment) {
592
- {
593
- var keys = Object.keys(fragment.props);
594
- for (var i = 0; i < keys.length; i++) {
595
- var key = keys[i];
596
- if (key !== "children" && key !== "key") {
597
- setCurrentlyValidatingElement$1(fragment);
598
- error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
599
- setCurrentlyValidatingElement$1(null);
600
- break;
601
- }
602
- }
603
- if (fragment.ref !== null) {
604
- setCurrentlyValidatingElement$1(fragment);
605
- error("Invalid attribute `ref` supplied to `React.Fragment`.");
606
- setCurrentlyValidatingElement$1(null);
607
- }
608
- }
609
- }
610
- function jsxWithValidation(type2, props, key, isStaticChildren, source, self2) {
611
- {
612
- var validType = isValidElementType(type2);
613
- if (!validType) {
614
- var info = "";
615
- if (type2 === void 0 || typeof type2 === "object" && type2 !== null && Object.keys(type2).length === 0) {
616
- info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
617
- }
618
- var sourceInfo = getSourceInfoErrorAddendum(source);
619
- if (sourceInfo) {
620
- info += sourceInfo;
621
- } else {
622
- info += getDeclarationErrorAddendum();
623
- }
624
- var typeString;
625
- if (type2 === null) {
626
- typeString = "null";
627
- } else if (Array.isArray(type2)) {
628
- typeString = "array";
629
- } else if (type2 !== void 0 && type2.$$typeof === REACT_ELEMENT_TYPE) {
630
- typeString = "<" + (getComponentName(type2.type) || "Unknown") + " />";
631
- info = " Did you accidentally export a JSX literal instead of a component?";
632
- } else {
633
- typeString = typeof type2;
634
- }
635
- error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
636
- }
637
- var element = jsxDEV(type2, props, key, source, self2);
638
- if (element == null) {
639
- return element;
640
- }
641
- if (validType) {
642
- var children = props.children;
643
- if (children !== void 0) {
644
- if (isStaticChildren) {
645
- if (Array.isArray(children)) {
646
- for (var i = 0; i < children.length; i++) {
647
- validateChildKeys(children[i], type2);
648
- }
649
- if (Object.freeze) {
650
- Object.freeze(children);
651
- }
652
- } else {
653
- error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
654
- }
655
- } else {
656
- validateChildKeys(children, type2);
657
- }
658
- }
659
- }
660
- if (type2 === exports.Fragment) {
661
- validateFragmentProps(element);
662
- } else {
663
- validatePropTypes(element);
664
- }
665
- return element;
666
- }
667
- }
668
- function jsxWithValidationStatic(type2, props, key) {
669
- {
670
- return jsxWithValidation(type2, props, key, true);
671
- }
672
- }
673
- function jsxWithValidationDynamic(type2, props, key) {
674
- {
675
- return jsxWithValidation(type2, props, key, false);
676
- }
677
- }
678
- var jsx = jsxWithValidationDynamic;
679
- var jsxs = jsxWithValidationStatic;
680
- exports.jsx = jsx;
681
- exports.jsxs = jsxs;
682
- })();
683
- }
684
- })(reactJsxRuntime_development);
685
- return reactJsxRuntime_development;
686
- }
687
- if (process.env.NODE_ENV === "production") {
688
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
689
- } else {
690
- jsxRuntime.exports = requireReactJsxRuntime_development();
691
- }
692
- var jsxRuntimeExports = jsxRuntime.exports;
693
- const stringifyConfig = {
694
- addQueryPrefix: true,
695
- skipNulls: true,
696
- arrayFormat: "indices",
697
- encode: false,
698
- encodeValuesOnly: true
699
- };
700
- const convertToNumberIfPossible = (value) => {
701
- if (typeof value === "undefined") {
702
- return value;
703
- }
704
- const num = Number(value);
705
- if (`${num}` === value) {
706
- return num;
707
- }
708
- return value;
709
- };
710
- const routerProvider = {
711
- go: () => {
712
- const { search: existingSearch, hash: existingHash } = useLocation();
713
- const history = useHistory();
714
- const fn = useCallback(
715
- ({ to, type: type2, query, hash, options: { keepQuery, keepHash } = {} }) => {
716
- const urlQuery = {
717
- ...keepQuery && existingSearch && parse(existingSearch, { ignoreQueryPrefix: true }),
718
- ...query
719
- };
720
- if (urlQuery.to) {
721
- urlQuery.to = encodeURIComponent(`${urlQuery.to}`);
722
- }
723
- const hasUrlQuery = Object.keys(urlQuery).length > 0;
724
- const urlHash = `#${(hash || keepHash && existingHash || "").replace(
725
- /^#/,
726
- ""
727
- )}`;
728
- const hasUrlHash = urlHash.length > 1;
729
- const urlTo = to || "";
730
- const fullPath = `${urlTo}${hasUrlQuery ? stringify(urlQuery, stringifyConfig) : ""}${hasUrlHash ? urlHash : ""}`;
731
- if (type2 === "path") {
732
- return fullPath;
1069
+ }
733
1070
  }
734
- return history[type2 || "push"](fullPath);
735
- },
736
- [existingHash, existingSearch, history]
737
- );
738
- return fn;
739
- },
740
- back: () => {
741
- const history = useHistory();
742
- const fn = useCallback(() => {
743
- history.go(-1);
744
- }, [history]);
745
- return fn;
746
- },
747
- parse: () => {
748
- var _a;
749
- let params = useParams();
750
- const { pathname, search } = useLocation();
751
- const { resources: resources2 } = useContext(ResourceContext);
752
- const { resource, action, matchedRoute } = React__default.useMemo(() => {
753
- return matchResourceFromRoute(pathname, resources2);
754
- }, [resources2, pathname]);
755
- if (Object.entries(params).length === 0 && matchedRoute) {
756
- params = ((_a = matchPath(matchedRoute, pathname)) == null ? void 0 : _a.params) || {};
757
- }
758
- const fn = useCallback(() => {
759
- const parsedSearch = parse(search, { ignoreQueryPrefix: true });
760
- const combinedParams = {
761
- ...params,
762
- ...parsedSearch
763
- };
764
- const response = {
765
- ...resource && { resource },
766
- ...action && { action },
767
- ...(parsedSearch == null ? void 0 : parsedSearch.id) && { id: decodeURIComponent(parsedSearch.id) },
768
- // ...(params?.action && { action: params.action }), // lets see if there is a need for this
769
- pathname,
770
- params: {
771
- ...combinedParams,
772
- current: convertToNumberIfPossible(combinedParams.current),
773
- pageSize: convertToNumberIfPossible(combinedParams.pageSize),
774
- to: combinedParams.to ? decodeURIComponent(combinedParams.to) : void 0
1071
+ function validatePropTypes(element) {
1072
+ {
1073
+ var type2 = element.type;
1074
+ if (type2 === null || type2 === void 0 || typeof type2 === "string") {
1075
+ return;
1076
+ }
1077
+ var propTypes;
1078
+ if (typeof type2 === "function") {
1079
+ propTypes = type2.propTypes;
1080
+ } else if (typeof type2 === "object" && (type2.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1081
+ // Inner props are checked in the reconciler.
1082
+ type2.$$typeof === REACT_MEMO_TYPE)) {
1083
+ propTypes = type2.propTypes;
1084
+ } else {
1085
+ return;
1086
+ }
1087
+ if (propTypes) {
1088
+ var name2 = getComponentName(type2);
1089
+ checkPropTypes(propTypes, element.props, "prop", name2, element);
1090
+ } else if (type2.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
1091
+ propTypesMisspellWarningShown = true;
1092
+ var _name = getComponentName(type2);
1093
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
1094
+ }
1095
+ if (typeof type2.getDefaultProps === "function" && !type2.getDefaultProps.isReactClassApproved) {
1096
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1097
+ }
1098
+ }
775
1099
  }
776
- };
777
- return response;
778
- }, [pathname, search, params, resource, action]);
779
- return fn;
780
- },
781
- Link: React__default.forwardRef(function RefineLink(props, ref) {
782
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ...props, ref });
783
- })
784
- };
785
- function warn() {
786
- if (console && console.warn) {
787
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
788
- args[_key] = arguments[_key];
789
- }
790
- if (typeof args[0] === "string")
791
- args[0] = `react-i18next:: ${args[0]}`;
792
- console.warn(...args);
793
- }
794
- }
795
- const alreadyWarned = {};
796
- function warnOnce() {
797
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
798
- args[_key2] = arguments[_key2];
799
- }
800
- if (typeof args[0] === "string" && alreadyWarned[args[0]])
801
- return;
802
- if (typeof args[0] === "string")
803
- alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
804
- warn(...args);
805
- }
806
- const loadedClb = (i18n2, cb) => () => {
807
- if (i18n2.isInitialized) {
808
- cb();
809
- } else {
810
- const initialized = () => {
811
- setTimeout(() => {
812
- i18n2.off("initialized", initialized);
813
- }, 0);
814
- cb();
815
- };
816
- i18n2.on("initialized", initialized);
817
- }
818
- };
819
- function loadNamespaces(i18n2, ns, cb) {
820
- i18n2.loadNamespaces(ns, loadedClb(i18n2, cb));
821
- }
822
- function loadLanguages(i18n2, lng, ns, cb) {
823
- if (typeof ns === "string")
824
- ns = [ns];
825
- ns.forEach((n) => {
826
- if (i18n2.options.ns.indexOf(n) < 0)
827
- i18n2.options.ns.push(n);
828
- });
829
- i18n2.loadLanguages(lng, loadedClb(i18n2, cb));
830
- }
831
- function oldI18nextHasLoadedNamespace(ns, i18n2) {
832
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
833
- const lng = i18n2.languages[0];
834
- const fallbackLng = i18n2.options ? i18n2.options.fallbackLng : false;
835
- const lastLng = i18n2.languages[i18n2.languages.length - 1];
836
- if (lng.toLowerCase() === "cimode")
837
- return true;
838
- const loadNotPending = (l, n) => {
839
- const loadState = i18n2.services.backendConnector.state[`${l}|${n}`];
840
- return loadState === -1 || loadState === 2;
841
- };
842
- if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n2.services.backendConnector.backend && i18n2.isLanguageChangingTo && !loadNotPending(i18n2.isLanguageChangingTo, ns))
843
- return false;
844
- if (i18n2.hasResourceBundle(lng, ns))
845
- return true;
846
- if (!i18n2.services.backendConnector.backend || i18n2.options.resources && !i18n2.options.partialBundledLanguages)
847
- return true;
848
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
849
- return true;
850
- return false;
851
- }
852
- function hasLoadedNamespace(ns, i18n2) {
853
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
854
- if (!i18n2.languages || !i18n2.languages.length) {
855
- warnOnce("i18n.languages were undefined or empty", i18n2.languages);
856
- return true;
857
- }
858
- const isNewerI18next = i18n2.options.ignoreJSONStructure !== void 0;
859
- if (!isNewerI18next) {
860
- return oldI18nextHasLoadedNamespace(ns, i18n2, options);
861
- }
862
- return i18n2.hasLoadedNamespace(ns, {
863
- lng: options.lng,
864
- precheck: (i18nInstance2, loadNotPending) => {
865
- if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns))
866
- return false;
867
- }
868
- });
869
- }
870
- const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
871
- const htmlEntities = {
872
- "&amp;": "&",
873
- "&#38;": "&",
874
- "&lt;": "<",
875
- "&#60;": "<",
876
- "&gt;": ">",
877
- "&#62;": ">",
878
- "&apos;": "'",
879
- "&#39;": "'",
880
- "&quot;": '"',
881
- "&#34;": '"',
882
- "&nbsp;": " ",
883
- "&#160;": " ",
884
- "&copy;": "©",
885
- "&#169;": "©",
886
- "&reg;": "®",
887
- "&#174;": "®",
888
- "&hellip;": "…",
889
- "&#8230;": "…",
890
- "&#x2F;": "/",
891
- "&#47;": "/"
892
- };
893
- const unescapeHtmlEntity = (m) => htmlEntities[m];
894
- const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
895
- let defaultOptions = {
896
- bindI18n: "languageChanged",
897
- bindI18nStore: "",
898
- transEmptyNodeValue: "",
899
- transSupportBasicHtmlNodes: true,
900
- transWrapTextNodes: "",
901
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
902
- useSuspense: true,
903
- unescape
904
- };
905
- function setDefaults() {
906
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
907
- defaultOptions = {
908
- ...defaultOptions,
909
- ...options
910
- };
911
- }
912
- function getDefaults() {
913
- return defaultOptions;
914
- }
915
- let i18nInstance;
916
- function setI18n(instance) {
917
- i18nInstance = instance;
1100
+ function validateFragmentProps(fragment) {
1101
+ {
1102
+ var keys = Object.keys(fragment.props);
1103
+ for (var i = 0; i < keys.length; i++) {
1104
+ var key = keys[i];
1105
+ if (key !== "children" && key !== "key") {
1106
+ setCurrentlyValidatingElement$1(fragment);
1107
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
1108
+ setCurrentlyValidatingElement$1(null);
1109
+ break;
1110
+ }
1111
+ }
1112
+ if (fragment.ref !== null) {
1113
+ setCurrentlyValidatingElement$1(fragment);
1114
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
1115
+ setCurrentlyValidatingElement$1(null);
1116
+ }
1117
+ }
1118
+ }
1119
+ function jsxWithValidation(type2, props, key, isStaticChildren, source, self2) {
1120
+ {
1121
+ var validType = isValidElementType(type2);
1122
+ if (!validType) {
1123
+ var info = "";
1124
+ if (type2 === void 0 || typeof type2 === "object" && type2 !== null && Object.keys(type2).length === 0) {
1125
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
1126
+ }
1127
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1128
+ if (sourceInfo) {
1129
+ info += sourceInfo;
1130
+ } else {
1131
+ info += getDeclarationErrorAddendum();
1132
+ }
1133
+ var typeString;
1134
+ if (type2 === null) {
1135
+ typeString = "null";
1136
+ } else if (Array.isArray(type2)) {
1137
+ typeString = "array";
1138
+ } else if (type2 !== void 0 && type2.$$typeof === REACT_ELEMENT_TYPE) {
1139
+ typeString = "<" + (getComponentName(type2.type) || "Unknown") + " />";
1140
+ info = " Did you accidentally export a JSX literal instead of a component?";
1141
+ } else {
1142
+ typeString = typeof type2;
1143
+ }
1144
+ error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
1145
+ }
1146
+ var element = jsxDEV(type2, props, key, source, self2);
1147
+ if (element == null) {
1148
+ return element;
1149
+ }
1150
+ if (validType) {
1151
+ var children = props.children;
1152
+ if (children !== void 0) {
1153
+ if (isStaticChildren) {
1154
+ if (Array.isArray(children)) {
1155
+ for (var i = 0; i < children.length; i++) {
1156
+ validateChildKeys(children[i], type2);
1157
+ }
1158
+ if (Object.freeze) {
1159
+ Object.freeze(children);
1160
+ }
1161
+ } else {
1162
+ error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
1163
+ }
1164
+ } else {
1165
+ validateChildKeys(children, type2);
1166
+ }
1167
+ }
1168
+ }
1169
+ if (type2 === exports.Fragment) {
1170
+ validateFragmentProps(element);
1171
+ } else {
1172
+ validatePropTypes(element);
1173
+ }
1174
+ return element;
1175
+ }
1176
+ }
1177
+ function jsxWithValidationStatic(type2, props, key) {
1178
+ {
1179
+ return jsxWithValidation(type2, props, key, true);
1180
+ }
1181
+ }
1182
+ function jsxWithValidationDynamic(type2, props, key) {
1183
+ {
1184
+ return jsxWithValidation(type2, props, key, false);
1185
+ }
1186
+ }
1187
+ var jsx = jsxWithValidationDynamic;
1188
+ var jsxs = jsxWithValidationStatic;
1189
+ exports.jsx = jsx;
1190
+ exports.jsxs = jsxs;
1191
+ })();
1192
+ }
1193
+ })(reactJsxRuntime_development);
1194
+ return reactJsxRuntime_development;
918
1195
  }
919
- function getI18n() {
920
- return i18nInstance;
1196
+ if (process.env.NODE_ENV === "production") {
1197
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1198
+ } else {
1199
+ jsxRuntime.exports = requireReactJsxRuntime_development();
921
1200
  }
922
- const initReactI18next = {
923
- type: "3rdParty",
924
- init(instance) {
925
- setDefaults(instance.options.react);
926
- setI18n(instance);
927
- }
1201
+ var jsxRuntimeExports = jsxRuntime.exports;
1202
+ const stringifyConfig = {
1203
+ addQueryPrefix: true,
1204
+ skipNulls: true,
1205
+ arrayFormat: "indices",
1206
+ encode: false,
1207
+ encodeValuesOnly: true
928
1208
  };
929
- const I18nContext = createContext();
930
- class ReportNamespaces {
931
- constructor() {
932
- this.usedNamespaces = {};
933
- }
934
- addUsedNamespaces(namespaces) {
935
- namespaces.forEach((ns) => {
936
- if (!this.usedNamespaces[ns])
937
- this.usedNamespaces[ns] = true;
938
- });
1209
+ const convertToNumberIfPossible = (value) => {
1210
+ if (typeof value === "undefined") {
1211
+ return value;
939
1212
  }
940
- getUsedNamespaces() {
941
- return Object.keys(this.usedNamespaces);
1213
+ const num = Number(value);
1214
+ if (`${num}` === value) {
1215
+ return num;
942
1216
  }
943
- }
944
- const usePrevious = (value, ignore) => {
945
- const ref = useRef();
946
- useEffect(() => {
947
- ref.current = ignore ? ref.current : value;
948
- }, [value, ignore]);
949
- return ref.current;
1217
+ return value;
950
1218
  };
951
- function useTranslation(ns) {
952
- let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
953
- const {
954
- i18n: i18nFromProps
955
- } = props;
956
- const {
957
- i18n: i18nFromContext,
958
- defaultNS: defaultNSFromContext
959
- } = useContext(I18nContext) || {};
960
- const i18n2 = i18nFromProps || i18nFromContext || getI18n();
961
- if (i18n2 && !i18n2.reportNamespaces)
962
- i18n2.reportNamespaces = new ReportNamespaces();
963
- if (!i18n2) {
964
- warnOnce("You will need to pass in an i18next instance by using initReactI18next");
965
- const notReadyT = (k, optsOrDefaultValue) => {
966
- if (typeof optsOrDefaultValue === "string")
967
- return optsOrDefaultValue;
968
- if (optsOrDefaultValue && typeof optsOrDefaultValue === "object" && typeof optsOrDefaultValue.defaultValue === "string")
969
- return optsOrDefaultValue.defaultValue;
970
- return Array.isArray(k) ? k[k.length - 1] : k;
971
- };
972
- const retNotReady = [notReadyT, {}, false];
973
- retNotReady.t = notReadyT;
974
- retNotReady.i18n = {};
975
- retNotReady.ready = false;
976
- return retNotReady;
977
- }
978
- if (i18n2.options.react && i18n2.options.react.wait !== void 0)
979
- warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
980
- const i18nOptions = {
981
- ...getDefaults(),
982
- ...i18n2.options.react,
983
- ...props
984
- };
985
- const {
986
- useSuspense,
987
- keyPrefix
988
- } = i18nOptions;
989
- let namespaces = ns || defaultNSFromContext || i18n2.options && i18n2.options.defaultNS;
990
- namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
991
- if (i18n2.reportNamespaces.addUsedNamespaces)
992
- i18n2.reportNamespaces.addUsedNamespaces(namespaces);
993
- const ready2 = (i18n2.isInitialized || i18n2.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n2, i18nOptions));
994
- function getT() {
995
- return i18n2.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
996
- }
997
- const [t, setT] = useState(getT);
998
- let joinedNS = namespaces.join();
999
- if (props.lng)
1000
- joinedNS = `${props.lng}${joinedNS}`;
1001
- const previousJoinedNS = usePrevious(joinedNS);
1002
- const isMounted = useRef(true);
1003
- useEffect(() => {
1004
- const {
1005
- bindI18n,
1006
- bindI18nStore
1007
- } = i18nOptions;
1008
- isMounted.current = true;
1009
- if (!ready2 && !useSuspense) {
1010
- if (props.lng) {
1011
- loadLanguages(i18n2, props.lng, namespaces, () => {
1012
- if (isMounted.current)
1013
- setT(getT);
1014
- });
1015
- } else {
1016
- loadNamespaces(i18n2, namespaces, () => {
1017
- if (isMounted.current)
1018
- setT(getT);
1019
- });
1020
- }
1021
- }
1022
- if (ready2 && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
1023
- setT(getT);
1024
- }
1025
- function boundReset() {
1026
- if (isMounted.current)
1027
- setT(getT);
1028
- }
1029
- if (bindI18n && i18n2)
1030
- i18n2.on(bindI18n, boundReset);
1031
- if (bindI18nStore && i18n2)
1032
- i18n2.store.on(bindI18nStore, boundReset);
1033
- return () => {
1034
- isMounted.current = false;
1035
- if (bindI18n && i18n2)
1036
- bindI18n.split(" ").forEach((e) => i18n2.off(e, boundReset));
1037
- if (bindI18nStore && i18n2)
1038
- bindI18nStore.split(" ").forEach((e) => i18n2.store.off(e, boundReset));
1039
- };
1040
- }, [i18n2, joinedNS]);
1041
- const isInitial = useRef(true);
1042
- useEffect(() => {
1043
- if (isMounted.current && !isInitial.current) {
1044
- setT(getT);
1045
- }
1046
- isInitial.current = false;
1047
- }, [i18n2, keyPrefix]);
1048
- const ret = [t, i18n2, ready2];
1049
- ret.t = t;
1050
- ret.i18n = i18n2;
1051
- ret.ready = ready2;
1052
- if (ready2)
1053
- return ret;
1054
- if (!ready2 && !useSuspense)
1055
- return ret;
1056
- throw new Promise((resolve) => {
1057
- if (props.lng) {
1058
- loadLanguages(i18n2, props.lng, namespaces, () => resolve());
1059
- } else {
1060
- loadNamespaces(i18n2, namespaces, () => resolve());
1219
+ const routerProvider = {
1220
+ go: () => {
1221
+ const { search: existingSearch, hash: existingHash } = useLocation();
1222
+ const history = useHistory();
1223
+ const fn = useCallback(
1224
+ ({ to, type: type2, query, hash, options: { keepQuery, keepHash } = {} }) => {
1225
+ const urlQuery = {
1226
+ ...keepQuery && existingSearch && parse(existingSearch, { ignoreQueryPrefix: true }),
1227
+ ...query
1228
+ };
1229
+ if (urlQuery.to) {
1230
+ urlQuery.to = encodeURIComponent(`${urlQuery.to}`);
1231
+ }
1232
+ const hasUrlQuery = Object.keys(urlQuery).length > 0;
1233
+ const urlHash = `#${(hash || keepHash && existingHash || "").replace(
1234
+ /^#/,
1235
+ ""
1236
+ )}`;
1237
+ const hasUrlHash = urlHash.length > 1;
1238
+ const urlTo = to || "";
1239
+ const fullPath = `${urlTo}${hasUrlQuery ? stringify(urlQuery, stringifyConfig) : ""}${hasUrlHash ? urlHash : ""}`;
1240
+ if (type2 === "path") {
1241
+ return fullPath;
1242
+ }
1243
+ return history[type2 || "push"](fullPath);
1244
+ },
1245
+ [existingHash, existingSearch, history]
1246
+ );
1247
+ return fn;
1248
+ },
1249
+ back: () => {
1250
+ const history = useHistory();
1251
+ const fn = useCallback(() => {
1252
+ history.go(-1);
1253
+ }, [history]);
1254
+ return fn;
1255
+ },
1256
+ parse: () => {
1257
+ var _a;
1258
+ let params = useParams();
1259
+ const { pathname, search } = useLocation();
1260
+ const { resources: resources2 } = useContext(ResourceContext);
1261
+ const { resource, action, matchedRoute } = React__default.useMemo(() => {
1262
+ return matchResourceFromRoute(pathname, resources2);
1263
+ }, [resources2, pathname]);
1264
+ if (Object.entries(params).length === 0 && matchedRoute) {
1265
+ params = ((_a = matchPath(matchedRoute, pathname)) == null ? void 0 : _a.params) || {};
1061
1266
  }
1062
- });
1063
- }
1267
+ const fn = useCallback(() => {
1268
+ const parsedSearch = parse(search, { ignoreQueryPrefix: true });
1269
+ const combinedParams = {
1270
+ ...params,
1271
+ ...parsedSearch
1272
+ };
1273
+ const response = {
1274
+ ...resource && { resource },
1275
+ ...action && { action },
1276
+ ...(parsedSearch == null ? void 0 : parsedSearch.id) && { id: decodeURIComponent(parsedSearch.id) },
1277
+ // ...(params?.action && { action: params.action }), // lets see if there is a need for this
1278
+ pathname,
1279
+ params: {
1280
+ ...combinedParams,
1281
+ current: convertToNumberIfPossible(combinedParams.current),
1282
+ pageSize: convertToNumberIfPossible(combinedParams.pageSize),
1283
+ to: combinedParams.to ? decodeURIComponent(combinedParams.to) : void 0
1284
+ }
1285
+ };
1286
+ return response;
1287
+ }, [pathname, search, params, resource, action]);
1288
+ return fn;
1289
+ },
1290
+ Link: React__default.forwardRef(function RefineLink(props, ref) {
1291
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ...props, ref });
1292
+ })
1293
+ };
1064
1294
  function useK8sYamlEditor() {
1065
1295
  const foldSymbol = useCallback(function(editor, symbol) {
1066
1296
  const model = editor.getModel();
@@ -7276,236 +7506,6 @@ function MetadataForm() {
7276
7506
  /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueListWidget, {}) })
7277
7507
  ] });
7278
7508
  }
7279
- const copy$1 = "Copy";
7280
- const reset_arguments$1 = "Reset";
7281
- const view_changes$1 = "Show Diff";
7282
- const back_to_edit$1 = "Edit";
7283
- const configure_file$1 = "Configuration";
7284
- const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
7285
- const yaml_value_wrong$1 = "Configuration has invalid values.";
7286
- const edit_yaml$1 = "Edit YAML";
7287
- const copied$1 = "Copied";
7288
- const already_reset$1 = "Already reset";
7289
- const fetch_schema_fail$1 = "Failed to fetch schema.";
7290
- const obtain_data_error$1 = "Having trouble getting data.";
7291
- const retry$1 = "Retry";
7292
- const create_resource$1 = "Create {{resource}}";
7293
- const edit_resource$1 = "Edit {{resource}}";
7294
- const dovetail$1 = {
7295
- copy: copy$1,
7296
- reset_arguments: reset_arguments$1,
7297
- view_changes: view_changes$1,
7298
- back_to_edit: back_to_edit$1,
7299
- configure_file: configure_file$1,
7300
- yaml_format_wrong: yaml_format_wrong$1,
7301
- yaml_value_wrong: yaml_value_wrong$1,
7302
- edit_yaml: edit_yaml$1,
7303
- copied: copied$1,
7304
- already_reset: already_reset$1,
7305
- fetch_schema_fail: fetch_schema_fail$1,
7306
- obtain_data_error: obtain_data_error$1,
7307
- retry: retry$1,
7308
- create_resource: create_resource$1,
7309
- edit_resource: edit_resource$1
7310
- };
7311
- const EN = {
7312
- dovetail: dovetail$1
7313
- };
7314
- const copy = "复制";
7315
- const reset_arguments = "重置";
7316
- const view_changes = "查看改动";
7317
- const back_to_edit = "编辑";
7318
- const configure_file = "配置内容";
7319
- const yaml_format_wrong = "配置内容不是有效的 yaml 格式。";
7320
- const yaml_value_wrong = "配置内容中存在不合法的值。";
7321
- const edit_yaml = "编辑 YAML";
7322
- const copied = "已复制";
7323
- const already_reset = "已重置";
7324
- const cancel = "取消";
7325
- const create = "创建";
7326
- const confirm_delete_text = "确定要删除 {{target}} 吗?";
7327
- const edit = "编辑";
7328
- const namespace = "名字空间";
7329
- const name = "名称";
7330
- const state = "状态";
7331
- const status = "状态";
7332
- const phase = "状态";
7333
- const image = "容器镜像";
7334
- const replicas = "副本数";
7335
- const created_time = "创建时间";
7336
- const label = "标签";
7337
- const annotation = "注释";
7338
- const type = "类型";
7339
- const event = "事件";
7340
- const reason = "原因";
7341
- const object = "对象";
7342
- const note$1 = "事件信息";
7343
- const condition = "Condition";
7344
- const download_yaml = "下载 YAML";
7345
- const detail = "详情";
7346
- const node_name = "主机名称";
7347
- const restarts = "重启次数";
7348
- const updated_time = "更新时间";
7349
- const message = "消息";
7350
- const save = "保存";
7351
- const more = "更多";
7352
- const workload = "工作负载";
7353
- const all_namespaces = "所有名字空间";
7354
- const empty = "无可显示的数据";
7355
- const schedule = "调度时间表";
7356
- const lastScheduleTime = "上次调度时间";
7357
- const duration = "持续时间";
7358
- const completions = "完成 Job 历史数";
7359
- const started = "开始时间";
7360
- const init_container = "初始化容器";
7361
- const container = "容器";
7362
- const redeploy = "重新部署";
7363
- const data = "数据";
7364
- const suspend = "暂停";
7365
- const resume = "重新开始";
7366
- const cluster = "集群";
7367
- const storage = "存储";
7368
- const network = "网络";
7369
- const clusterIp = "集群 IP";
7370
- const sessionAffinity = "会话保持";
7371
- const log = "日志";
7372
- const select_container = "选择容器";
7373
- const wrap = "折叠";
7374
- const resume_log = "继续";
7375
- const log_new_lines = ",并展示 {{ count }} 行新日志";
7376
- const fetch_schema_fail = "获取 schema 失败。";
7377
- const obtain_data_error = "获取数据时遇到问题。";
7378
- const retry = "重试";
7379
- const ready = "就绪";
7380
- const updating = "更新中";
7381
- const completed = "完成";
7382
- const failed = "异常";
7383
- const suspended = "挂起";
7384
- const running = "运行中";
7385
- const terminating = "终止";
7386
- const succeeded = "成功终止";
7387
- const unknown = "未知";
7388
- const pending = "待处理";
7389
- const waiting = "等待中";
7390
- const create_resource = "创建 {{resource}}";
7391
- const edit_resource = "编辑 {{resource}}";
7392
- const sec = "秒";
7393
- const min = "分";
7394
- const hr = "小时";
7395
- const day = "天";
7396
- const expand = "展开";
7397
- const fold = "收起";
7398
- const rule = "规则";
7399
- const default_backend = "默认后端";
7400
- const ingress_rule_type = "规则类型";
7401
- const port = "端口";
7402
- const dovetail = {
7403
- copy,
7404
- reset_arguments,
7405
- view_changes,
7406
- back_to_edit,
7407
- configure_file,
7408
- yaml_format_wrong,
7409
- yaml_value_wrong,
7410
- edit_yaml,
7411
- copied,
7412
- already_reset,
7413
- cancel,
7414
- "delete": "删除",
7415
- create,
7416
- confirm_delete_text,
7417
- edit,
7418
- namespace,
7419
- name,
7420
- state,
7421
- status,
7422
- phase,
7423
- image,
7424
- replicas,
7425
- created_time,
7426
- label,
7427
- annotation,
7428
- type,
7429
- event,
7430
- reason,
7431
- object,
7432
- note: note$1,
7433
- condition,
7434
- download_yaml,
7435
- detail,
7436
- node_name,
7437
- restarts,
7438
- updated_time,
7439
- message,
7440
- save,
7441
- more,
7442
- workload,
7443
- all_namespaces,
7444
- empty,
7445
- schedule,
7446
- lastScheduleTime,
7447
- duration,
7448
- completions,
7449
- started,
7450
- init_container,
7451
- container,
7452
- redeploy,
7453
- data,
7454
- suspend,
7455
- resume,
7456
- cluster,
7457
- storage,
7458
- network,
7459
- clusterIp,
7460
- sessionAffinity,
7461
- log,
7462
- select_container,
7463
- wrap,
7464
- resume_log,
7465
- log_new_lines,
7466
- fetch_schema_fail,
7467
- obtain_data_error,
7468
- retry,
7469
- ready,
7470
- updating,
7471
- completed,
7472
- failed,
7473
- suspended,
7474
- running,
7475
- terminating,
7476
- succeeded,
7477
- unknown,
7478
- pending,
7479
- waiting,
7480
- create_resource,
7481
- edit_resource,
7482
- sec,
7483
- min,
7484
- hr,
7485
- day,
7486
- expand,
7487
- fold,
7488
- rule,
7489
- default_backend,
7490
- ingress_rule_type,
7491
- port
7492
- };
7493
- const ZH = {
7494
- dovetail
7495
- };
7496
- const resources = {
7497
- "en-US": EN,
7498
- "zh-CN": ZH
7499
- };
7500
- i18n.use(initReactI18next).init({
7501
- supportedLngs: ["en-US", "zh-CN"],
7502
- resources,
7503
- ns: Object.keys(resources["zh-CN"]),
7504
- defaultNS: "dovetail",
7505
- fallbackLng: ["en-US", "zh-CN"],
7506
- lng: "zh-CN",
7507
- nsSeparator: "."
7508
- });
7509
7509
  function addId(arr, idKey) {
7510
7510
  return arr.map((e) => {
7511
7511
  return {
@@ -9856,7 +9856,7 @@ const ErrorMsgStyle = "eh2qjnl";
9856
9856
  const ErrorWrapperStyle = "e19q2bnp";
9857
9857
  const YamlEditorStyle = "y16u5v3w";
9858
9858
  const MonacoYamlEditor$2 = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$1));
9859
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-caec6da3.js"));
9859
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-fd7edf86.js"));
9860
9860
  const YamlEditorComponent = forwardRef(
9861
9861
  function YamlEditorComponent2(props, ref) {
9862
9862
  const {
@@ -19319,123 +19319,125 @@ class RelationPlugin {
19319
19319
  }
19320
19320
  const relationPlugin = new RelationPlugin();
19321
19321
  const ProviderPlugins = [relationPlugin, modelPlugin];
19322
+ const DovetailRefineI18n = i18n;
19322
19323
  export {
19323
- Layout as $,
19324
+ DeleteButton as $,
19324
19325
  AgeColumnRenderer as A,
19325
19326
  Breadcrumb as B,
19326
19327
  CommonSorter as C,
19327
- DurationColumnRenderer as D,
19328
- CreateButton as E,
19329
- ImageNames as F,
19330
- ResourceList as G,
19331
- ResourceShow as H,
19328
+ DovetailRefineI18n as D,
19329
+ WorkloadDropdown as E,
19330
+ CreateButton as F,
19331
+ ImageNames as G,
19332
+ ResourceList as H,
19332
19333
  IngressRulesColumnRenderer as I,
19333
- ResourceForm as J,
19334
+ ResourceShow as J,
19334
19335
  KeyValueListWidget as K,
19335
- ResourceCRUD as L,
19336
+ ResourceForm as L,
19336
19337
  MetadataForm as M,
19337
19338
  NameColumnRenderer as N,
19338
- WorkloadPodsTable as O,
19339
+ ResourceCRUD as O,
19339
19340
  PodWorkloadColumnRenderer as P,
19340
- CronJobDropdown as Q,
19341
+ WorkloadPodsTable as Q,
19341
19342
  ReplicasColumnRenderer as R,
19342
19343
  StateDisplayColumnRenderer as S,
19343
- ResourceUsageBar as T,
19344
- WorkloadReplicas as U,
19345
- CronjobJobsTable as V,
19344
+ CronJobDropdown as T,
19345
+ ResourceUsageBar as U,
19346
+ WorkloadReplicas as V,
19346
19347
  WorkloadImageColumnRenderer as W,
19347
- KeyValue as X,
19348
- Separator as Y,
19349
- YamlEditorComponent as Z,
19350
- DeleteButton as _,
19348
+ CronjobJobsTable as X,
19349
+ KeyValue as Y,
19350
+ Separator as Z,
19351
+ YamlEditorComponent as _,
19351
19352
  useDeleteModal as a,
19352
- ProviderPlugins as a$,
19353
- ImageField as a0,
19354
- ReplicaField as a1,
19355
- ConditionsField as a2,
19356
- PodsField as a3,
19357
- JobsField as a4,
19358
- DataField as a5,
19359
- SecretDataField as a6,
19360
- StartTimeField as a7,
19361
- ServiceTypeField as a8,
19362
- ClusterIpField as a9,
19363
- JOB_INIT_VALUE as aA,
19364
- STATEFULSET_INIT_VALUE as aB,
19365
- POD_INIT_VALUE as aC,
19366
- SERVICE_INIT_VALUE as aD,
19367
- INGRESS_INIT_VALUE as aE,
19368
- NETWORK_POLICY_INIT_VALUE as aF,
19369
- TIMESTAMP_LABEL as aG,
19370
- WorkloadState as aH,
19371
- Dovetail as aI,
19372
- RESOURCE_GROUP as aJ,
19373
- FormType as aK,
19374
- ComponentContext as aL,
19375
- GlobalStoreContext as aM,
19376
- ConfigsContext as aN,
19377
- IngressModel as aO,
19378
- NetworkPolicyModel as aP,
19379
- JobModel as aQ,
19380
- WorkloadModel as aR,
19381
- WorkloadBaseModel as aS,
19382
- PodModel as aT,
19383
- PodMetricsModel as aU,
19384
- ResourceModel as aV,
19385
- CronJobModel as aW,
19386
- EventModel as aX,
19387
- DeploymentModel as aY,
19388
- DaemonSetModel as aZ,
19389
- StatefulSetModel as a_,
19390
- SessionAffinityField as aa,
19391
- ServicePodsField as ab,
19392
- IngressRulesTableTabField as ac,
19393
- EventsTableTabField as ad,
19394
- ShowContent as ae,
19395
- SchemaStrategy as af,
19396
- DeleteManyButton as ag,
19397
- ListPage as ah,
19398
- StateTag as ai,
19399
- DrawerShow as aj,
19400
- Menu as ak,
19401
- EditButton as al,
19402
- ReferenceLink as am,
19403
- ResourceLink as an,
19404
- NS_STORE_KEY as ao,
19405
- ALL_NS as ap,
19406
- useNamespacesFilter as aq,
19407
- NamespacesFilter as ar,
19408
- Tags as as,
19409
- PodLog as at,
19410
- FormModal as au,
19411
- NetworkPolicyRulesTable as av,
19412
- BASE_INIT_VALUE as aw,
19413
- DEPLOYMENT_INIT_VALUE as ax,
19414
- CRONJOB_INIT_VALUE as ay,
19415
- DAEMONSET_INIT_VALUE as az,
19353
+ StatefulSetModel as a$,
19354
+ Layout as a0,
19355
+ ImageField as a1,
19356
+ ReplicaField as a2,
19357
+ ConditionsField as a3,
19358
+ PodsField as a4,
19359
+ JobsField as a5,
19360
+ DataField as a6,
19361
+ SecretDataField as a7,
19362
+ StartTimeField as a8,
19363
+ ServiceTypeField as a9,
19364
+ DAEMONSET_INIT_VALUE as aA,
19365
+ JOB_INIT_VALUE as aB,
19366
+ STATEFULSET_INIT_VALUE as aC,
19367
+ POD_INIT_VALUE as aD,
19368
+ SERVICE_INIT_VALUE as aE,
19369
+ INGRESS_INIT_VALUE as aF,
19370
+ NETWORK_POLICY_INIT_VALUE as aG,
19371
+ TIMESTAMP_LABEL as aH,
19372
+ WorkloadState as aI,
19373
+ Dovetail as aJ,
19374
+ RESOURCE_GROUP as aK,
19375
+ FormType as aL,
19376
+ ComponentContext as aM,
19377
+ GlobalStoreContext as aN,
19378
+ ConfigsContext as aO,
19379
+ IngressModel as aP,
19380
+ NetworkPolicyModel as aQ,
19381
+ JobModel as aR,
19382
+ WorkloadModel as aS,
19383
+ WorkloadBaseModel as aT,
19384
+ PodModel as aU,
19385
+ PodMetricsModel as aV,
19386
+ ResourceModel as aW,
19387
+ CronJobModel as aX,
19388
+ EventModel as aY,
19389
+ DeploymentModel as aZ,
19390
+ DaemonSetModel as a_,
19391
+ ClusterIpField as aa,
19392
+ SessionAffinityField as ab,
19393
+ ServicePodsField as ac,
19394
+ IngressRulesTableTabField as ad,
19395
+ EventsTableTabField as ae,
19396
+ ShowContent as af,
19397
+ SchemaStrategy as ag,
19398
+ DeleteManyButton as ah,
19399
+ ListPage as ai,
19400
+ StateTag as aj,
19401
+ DrawerShow as ak,
19402
+ Menu as al,
19403
+ EditButton as am,
19404
+ ReferenceLink as an,
19405
+ ResourceLink as ao,
19406
+ NS_STORE_KEY as ap,
19407
+ ALL_NS as aq,
19408
+ useNamespacesFilter as ar,
19409
+ NamespacesFilter as as,
19410
+ Tags as at,
19411
+ PodLog as au,
19412
+ FormModal as av,
19413
+ NetworkPolicyRulesTable as aw,
19414
+ BASE_INIT_VALUE as ax,
19415
+ DEPLOYMENT_INIT_VALUE as ay,
19416
+ CRONJOB_INIT_VALUE as az,
19416
19417
  NameSpaceColumnRenderer as b,
19418
+ ProviderPlugins as b0,
19417
19419
  WorkloadRestartsColumnRenderer as c,
19418
19420
  NodeNameColumnRenderer as d,
19419
19421
  RestartCountColumnRenderer as e,
19420
19422
  CompletionsCountColumnRenderer as f,
19421
- ServiceTypeColumnRenderer as g,
19422
- IngressDefaultBackendColumnRenderer as h,
19423
- ColumnKeys as i,
19423
+ DurationColumnRenderer as g,
19424
+ ServiceTypeColumnRenderer as h,
19425
+ IngressDefaultBackendColumnRenderer as i,
19424
19426
  jsxRuntimeExports as j,
19425
- useEagleTable as k,
19426
- useDownloadYAML as l,
19427
- useEdit as m,
19428
- useGlobalStore as n,
19429
- NameInputWidget as o,
19430
- dnsSubDomainRules as p,
19431
- rfc1123LabelRules as q,
19427
+ ColumnKeys as k,
19428
+ useEagleTable as l,
19429
+ useDownloadYAML as m,
19430
+ useEdit as n,
19431
+ useGlobalStore as o,
19432
+ NameInputWidget as p,
19433
+ dnsSubDomainRules as q,
19432
19434
  routerProvider as r,
19433
- rfc1035LabelRules as s,
19434
- NamespaceSelectWidget as t,
19435
+ rfc1123LabelRules as s,
19436
+ rfc1035LabelRules as t,
19435
19437
  useSchema as u,
19436
- namespaceRules as v,
19437
- PageShow as w,
19438
- ConditionsTable as x,
19439
- PodContainersTable as y,
19440
- WorkloadDropdown as z
19438
+ NamespaceSelectWidget as v,
19439
+ namespaceRules as w,
19440
+ PageShow as x,
19441
+ ConditionsTable as y,
19442
+ PodContainersTable as z
19441
19443
  };