@grasp-labs/ds-microfrontends-integration 0.6.2
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/LICENSE +201 -0
- package/README.md +255 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/schemaFields/ArrayField.d.ts +8 -0
- package/dist/components/schemaFields/BooleanField.d.ts +8 -0
- package/dist/components/schemaFields/EnumField.d.ts +8 -0
- package/dist/components/schemaFields/FieldError.d.ts +9 -0
- package/dist/components/schemaFields/JsonField.d.ts +8 -0
- package/dist/components/schemaFields/NumberField.d.ts +8 -0
- package/dist/components/schemaFields/SchemaFields.d.ts +10 -0
- package/dist/components/schemaFields/TextField.d.ts +8 -0
- package/dist/components/schemaFields/index.d.ts +8 -0
- package/dist/components/toast/ToastProvider.d.ts +15 -0
- package/dist/components/toast/ToastProvider.stories.d.ts +13 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/types.d.ts +4 -0
- package/dist/components/translation/TranslationProvider/TranslationProvider.d.ts +30 -0
- package/dist/components/translation/TranslationProvider/index.d.ts +2 -0
- package/dist/components/translation/index.d.ts +1 -0
- package/dist/components/vault/VaultInput/VaultInput.d.ts +19 -0
- package/dist/components/vault/VaultInput/VaultInput.stories.d.ts +58 -0
- package/dist/components/vault/VaultInput/VaultInputField.d.ts +9 -0
- package/dist/components/vault/VaultInput/index.d.ts +4 -0
- package/dist/components/vault/VaultProvider/VaultProvider.d.ts +8 -0
- package/dist/components/vault/VaultProvider/index.d.ts +2 -0
- package/dist/components/vault/VaultSecretDialog/VaultSecretDialog.d.ts +10 -0
- package/dist/components/vault/VaultSecretDialog/VaultSecretDialog.stories.d.ts +36 -0
- package/dist/components/vault/VaultSecretDialog/index.d.ts +2 -0
- package/dist/components/vault/index.d.ts +3 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index-8yHLPV2n.js +11530 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.esm-DgyjJxy1-CnakrFTI.js +781 -0
- package/dist/index.js +33 -0
- package/dist/lib/schema/defaults.d.ts +3 -0
- package/dist/lib/schema/descriptor.d.ts +10 -0
- package/dist/lib/schema/index.d.ts +5 -0
- package/dist/lib/schema/inspector.d.ts +10 -0
- package/dist/lib/schema/resolver.d.ts +2 -0
- package/dist/lib/schema/testUtils.d.ts +2 -0
- package/dist/lib/schema/types.d.ts +23 -0
- package/dist/mf-common.d.ts +44 -0
- package/dist/mf-common.js +45 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/translations/en/common.json.d.ts +24 -0
- package/dist/translations/no/common.json.d.ts +24 -0
- package/dist/types/Schema.d.ts +6 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/translation.d.ts +7 -0
- package/dist/types/typeGuards.d.ts +13 -0
- package/dist/types/vault.d.ts +28 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +95 -0
- package/src/index.css +2 -0
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
import { c as o } from "./index-8yHLPV2n.js";
|
|
2
|
+
import { useState as J, useEffect as De, createContext as Zt, useRef as ce, useContext as Gt, useMemo as le, useCallback as Re } from "react";
|
|
3
|
+
const $e = (e, t, n, r, a) => {
|
|
4
|
+
if (!r) throw new Error(a ?? `Invalid property path: ${t}
|
|
5
|
+
Couldn't access "${n}" in ${JSON.stringify(e)}`);
|
|
6
|
+
}, Bt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), gt = (e) => Array.isArray(e), Qt = (e, t) => e.filter(((n, r) => r !== t)), wn = (e, t, n, r = {}) => {
|
|
7
|
+
const { remove: a = !1, createNew: i = !0, noError: s = !1 } = r, p = e, d = typeof (l = t) == "string" ? l : typeof l == "number" ? String(l) : l.reduce(((h, f) => typeof f == "number" ? `${h}[${f}]` : h === "" ? f : `${h}.${f}`), "");
|
|
8
|
+
var l;
|
|
9
|
+
const u = Object.assign(Object.assign({}, r), { remove: a, createNew: i, noError: s, fullData: p, fullPath: d }), c = Array.isArray(t) ? t : ((h) => Array.isArray(h) ? h : h.split(/(\.|\[\d+\])/).filter(((f) => f !== "." && f !== "")).map(((f) => {
|
|
10
|
+
const m = /\[(\d+)\]/.exec(f);
|
|
11
|
+
return m ? Number(m[1]) : f;
|
|
12
|
+
})).flat())(t).filter(((h) => h !== ""));
|
|
13
|
+
return gt(e) && a && c.length === 1 ? Qt(e, c[0]) : lt(e, c, n, u);
|
|
14
|
+
}, lt = (e, t, n, r) => {
|
|
15
|
+
const a = Bt(e) ? Object.assign({}, e) : null, i = gt(e) ? [...e] : null;
|
|
16
|
+
if (t.length === 0) return e;
|
|
17
|
+
if (!a && !i) throw new Error("Can't assign property -- invalid input object");
|
|
18
|
+
const { createNew: s, remove: p, noError: d, fullData: l, fullPath: u } = r, c = t[0];
|
|
19
|
+
if (i && typeof c == "string") return i.map(((b) => lt(b, t, n, r)));
|
|
20
|
+
if (t.length === 1)
|
|
21
|
+
return a && typeof c == "string" ? Dn(a, c, n, r) ?? a : i && typeof c == "number" ? (On(i, c, n, r), i) : ($e(l, u, c, d), e);
|
|
22
|
+
const h = a || i || [];
|
|
23
|
+
if (p && t.length === 2 && typeof t[1] == "number") {
|
|
24
|
+
const b = h[c], D = t[1];
|
|
25
|
+
return gt(b) ? h[c] = Qt(b, D) : $e(l, u, c, d, "Trying to remove an indexed item from an object that is not an array"), h;
|
|
26
|
+
}
|
|
27
|
+
const f = t.slice(1);
|
|
28
|
+
if (c in e) {
|
|
29
|
+
if (m = h[c], !gt(m) && !Bt(m)) {
|
|
30
|
+
if (!s) return $e(l, u, c, d), h;
|
|
31
|
+
h[c] = {};
|
|
32
|
+
}
|
|
33
|
+
return h[c] = lt(h[c], f, n, r), h;
|
|
34
|
+
}
|
|
35
|
+
var m;
|
|
36
|
+
if (s) {
|
|
37
|
+
const b = typeof f[0] == "number" ? [] : {};
|
|
38
|
+
if (a) return h[c] = b, h[c] = lt(h[c], f, n, r), h;
|
|
39
|
+
if (i && Array.isArray(h)) {
|
|
40
|
+
h.push(b);
|
|
41
|
+
const D = h.length - 1;
|
|
42
|
+
return h[D] = lt(h[D], f, n, r), h;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return $e(l, u, c, d), h;
|
|
46
|
+
}, Dn = (e, t, n, r) => {
|
|
47
|
+
const { remove: a, createNew: i, noError: s, insertAfter: p, insertBefore: d, fullData: l, fullPath: u } = r;
|
|
48
|
+
if (d !== void 0 || p !== void 0) {
|
|
49
|
+
const h = Object.entries(e);
|
|
50
|
+
let f = 1 / 0;
|
|
51
|
+
return f = typeof d == "number" ? d : typeof p == "number" ? p : h.findIndex((([m, b]) => m === (d ?? p))), p && f++, h.splice(f, 0, [t, n]), Object.fromEntries(h);
|
|
52
|
+
}
|
|
53
|
+
const c = t in e;
|
|
54
|
+
a ? c ? delete e[t] : $e(l, u, t, s) : i || c ? e[t] = n : $e(l, u, t, s);
|
|
55
|
+
}, On = (e, t, n, r) => {
|
|
56
|
+
const { noError: a, fullData: i, fullPath: s, createNew: p, insert: d } = r;
|
|
57
|
+
d && e.splice(t, 0, n), t in e ? e[t] = n : p ? e.push(n) : $e(i, s, t, a);
|
|
58
|
+
}, qe = (e, t, n) => {
|
|
59
|
+
const r = Array.isArray(t) ? t : Cn(t);
|
|
60
|
+
if (r.length === 0) return e;
|
|
61
|
+
const a = r[0];
|
|
62
|
+
if (Array.isArray(e) && typeof a != "number") return e.map(((s) => qe(s, r)));
|
|
63
|
+
if (typeof e != "object" || e === null || !(a in e)) return kn(e, a);
|
|
64
|
+
const i = e[a];
|
|
65
|
+
return r.length === 1 ? i : qe(i, r.slice(1));
|
|
66
|
+
}, Cn = (e) => e.split(/(\.|\[\d+\])/).filter(((t) => t !== "." && t !== "")).map(((t) => {
|
|
67
|
+
const n = /\[(\d+)\]/.exec(t);
|
|
68
|
+
return n ? Number(n[1]) : t;
|
|
69
|
+
})).flat(), kn = (e, t, n) => {
|
|
70
|
+
throw new Error(`Unable to extract object property
|
|
71
|
+
Looking for property: ${t}
|
|
72
|
+
In object: ${JSON.stringify(e)}`);
|
|
73
|
+
};
|
|
74
|
+
function qt(e, t) {
|
|
75
|
+
var n = {};
|
|
76
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
77
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") {
|
|
78
|
+
var a = 0;
|
|
79
|
+
for (r = Object.getOwnPropertySymbols(e); a < r.length; a++) t.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (n[r[a]] = e[r[a]]);
|
|
80
|
+
}
|
|
81
|
+
return n;
|
|
82
|
+
}
|
|
83
|
+
function Qe(e, t, n, r) {
|
|
84
|
+
return new (n || (n = Promise))((function(a, i) {
|
|
85
|
+
function s(l) {
|
|
86
|
+
try {
|
|
87
|
+
d(r.next(l));
|
|
88
|
+
} catch (u) {
|
|
89
|
+
i(u);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function p(l) {
|
|
93
|
+
try {
|
|
94
|
+
d(r.throw(l));
|
|
95
|
+
} catch (u) {
|
|
96
|
+
i(u);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function d(l) {
|
|
100
|
+
var u;
|
|
101
|
+
l.done ? a(l.value) : (u = l.value, u instanceof n ? u : new n((function(c) {
|
|
102
|
+
c(u);
|
|
103
|
+
}))).then(s, p);
|
|
104
|
+
}
|
|
105
|
+
d((r = r.apply(e, [])).next());
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
const en = ({ className: e, name: t, value: n, setValue: r, handleKeyPress: a, styles: i, textAreaRef: s }) => {
|
|
109
|
+
if (typeof n != "string") return null;
|
|
110
|
+
const p = n.slice(-1) === `
|
|
111
|
+
` ? n + "." : n;
|
|
112
|
+
return o.jsxs("div", { style: { display: "grid" }, children: [o.jsx("textarea", { id: `${t}_textarea`, ref: s, style: Object.assign({ height: "auto", gridArea: "1 / 1 / 2 / 2", overflowY: "auto", whiteSpace: "pre-wrap" }, i), rows: 1, className: e, name: `${t}_textarea`, value: n, onChange: (d) => r(d.target.value), autoFocus: !0, onFocus: (d) => {
|
|
113
|
+
n.length < 40 && d.target.select();
|
|
114
|
+
}, onKeyDown: a }), o.jsx("span", { className: e, style: Object.assign({ visibility: "hidden", height: "auto", gridArea: "1 / 1 / 2 / 2", color: "red", opacity: 0.9, whiteSpace: "pre-wrap", overflowY: "auto", border: "1px solid transparent" }, i), children: p })] });
|
|
115
|
+
}, et = (e) => e !== null && typeof e == "object", tn = (e, t, n, r = "") => {
|
|
116
|
+
if (!n && !r) return !0;
|
|
117
|
+
switch (e) {
|
|
118
|
+
case "collection":
|
|
119
|
+
if (n) {
|
|
120
|
+
if (n(t, r)) return !0;
|
|
121
|
+
if (!Ct(r, t, n)) return !1;
|
|
122
|
+
}
|
|
123
|
+
if (!n && r && !Ct(r, t)) return !1;
|
|
124
|
+
break;
|
|
125
|
+
case "value":
|
|
126
|
+
if (n && !n(t, r) || !n && r && !tt(t, r)) return !1;
|
|
127
|
+
}
|
|
128
|
+
return !0;
|
|
129
|
+
}, Ct = (e = "", t, n = tt) => {
|
|
130
|
+
const r = t.value;
|
|
131
|
+
return Object.entries(r).some((([a, i]) => {
|
|
132
|
+
const s = [...t.path, a], p = Object.assign(Object.assign({}, t), { key: a, path: s, level: t.level + 1, value: i, size: s.length, parentData: r });
|
|
133
|
+
return et(i) ? Ct(e, p, n) : n(p, e);
|
|
134
|
+
}));
|
|
135
|
+
}, tt = (e, t = "") => {
|
|
136
|
+
const { value: n } = e;
|
|
137
|
+
if (n === null && "null".includes(t.toLowerCase())) return !0;
|
|
138
|
+
switch (typeof n) {
|
|
139
|
+
case "string":
|
|
140
|
+
return n.toLowerCase().includes(t.toLowerCase());
|
|
141
|
+
case "number":
|
|
142
|
+
return !!String(n).includes(t);
|
|
143
|
+
case "boolean":
|
|
144
|
+
return n ? "true".includes(t.toLowerCase()) || t === "1" : "false".includes(t.toLowerCase()) || t === "0";
|
|
145
|
+
default:
|
|
146
|
+
return !1;
|
|
147
|
+
}
|
|
148
|
+
}, Wt = ({ key: e, path: t }, n = "") => !!tt({ value: e }, n) || !!t.some(((r) => tt({ value: r }, n))), Ue = (e, t) => (t ?? "") + e.map(((n) => n === "" ? "\0" : n)).join("."), Tt = (e) => e.shiftKey ? "Shift" : e.metaKey ? "Meta" : e.ctrlKey ? "Control" : e.altKey ? "Alt" : void 0, Sn = (e, t, n) => {
|
|
149
|
+
const r = e.key, a = Tt(e);
|
|
150
|
+
if (Array.isArray(t)) return !!a && t.includes(a);
|
|
151
|
+
const { key: i, modifier: s } = t;
|
|
152
|
+
return (n !== "stringLineBreak" || r !== "Enter" || a !== "Shift" || i !== "Enter" || !s?.includes("Shift")) && r === i && (s === a || Array.isArray(s) && s.includes(a));
|
|
153
|
+
}, Fe = { key: "Enter" }, Ht = { confirm: Fe, cancel: { key: "Escape" }, objectConfirm: Object.assign(Object.assign({}, Fe), { modifier: ["Meta", "Shift", "Control"] }), objectLineBreak: Fe, stringConfirm: Fe, stringLineBreak: Object.assign(Object.assign({}, Fe), { modifier: ["Shift"] }), numberConfirm: Fe, numberUp: { key: "ArrowUp" }, numberDown: { key: "ArrowDown" }, tabForward: { key: "Tab" }, tabBack: { key: "Tab", modifier: "Shift" }, booleanConfirm: Fe, booleanToggle: { key: " " }, clipboardModifier: ["Meta", "Control"], collapseModifier: ["Alt"] }, Be = (e, t, n = "next", r) => {
|
|
154
|
+
const a = t.slice(0, t.length - 1), i = t.slice(-1)[0];
|
|
155
|
+
if (i === void 0) return null;
|
|
156
|
+
const s = qe(e, a), p = Nn(s);
|
|
157
|
+
Array.isArray(s) || r(p, (({ key: u, value: c }) => [u, c]));
|
|
158
|
+
const d = p.findIndex(((u) => u.key === i)), l = p[d + (n === "next" ? 1 : -1)];
|
|
159
|
+
return l ? et(l.value) ? Object.keys(l.value).length === 0 ? Be(e, [...a, l.key], n, r) : nn(e, [...a, l.key], n, r) : [...a, l.key] : a.length === 0 ? null : Be(e, a, n, r);
|
|
160
|
+
}, nn = (e, t, n = "next", r) => {
|
|
161
|
+
const a = qe(e, t);
|
|
162
|
+
if (!et(a)) return t;
|
|
163
|
+
const i = Array.isArray(a) ? a.map(((p, d) => d)) : Object.keys(a);
|
|
164
|
+
r(i, ((p) => [p, a]));
|
|
165
|
+
const s = n === "next" ? i[0] : i[i.length - 1];
|
|
166
|
+
return nn(e, [...t, s], n, r);
|
|
167
|
+
}, Nn = (e) => Array.isArray(e) ? e.map(((t, n) => ({ index: n, value: t, key: n }))) : Object.entries(e).map((([t, n], r) => ({ key: t, value: n, index: r }))), rn = (e, t) => {
|
|
168
|
+
var n, r, a, i;
|
|
169
|
+
const s = e.current, p = (n = s?.selectionStart) !== null && n !== void 0 ? n : 1 / 0, d = (r = s?.selectionEnd) !== null && r !== void 0 ? r : 1 / 0, l = ((a = s?.textContent) === null || a === void 0 ? void 0 : a.slice(0, p)) + t + ((i = s?.textContent) === null || i === void 0 ? void 0 : i.slice(d));
|
|
170
|
+
return s.value = l, s?.setSelectionRange(p + 1, p + 1), l;
|
|
171
|
+
}, kt = (e) => {
|
|
172
|
+
if (e !== on) {
|
|
173
|
+
if (Array.isArray(e)) return e.map(((t) => kt(t)));
|
|
174
|
+
if (e && typeof e == "object") for (const t in e) e[t] = kt(e[t]);
|
|
175
|
+
return e;
|
|
176
|
+
}
|
|
177
|
+
}, on = "__undefined__", At = { displayName: "Default", fragments: { edit: "rgb(42, 161, 152)" }, styles: { container: { backgroundColor: "#f6f6f6", fontFamily: "monospace" }, collection: {}, collectionInner: {}, collectionElement: {}, dropZone: {}, property: "#292929", bracket: { color: "rgb(0, 43, 54)", fontWeight: "bold" }, itemCount: { color: "rgba(0, 0, 0, 0.3)", fontStyle: "italic" }, string: "rgb(203, 75, 22)", number: "rgb(38, 139, 210)", boolean: "green", null: { color: "rgb(220, 50, 47)", fontVariant: "small-caps", fontWeight: "bold" }, input: ["#292929"], inputHighlight: "#b3d8ff", error: { fontSize: "0.8em", color: "red", fontWeight: "bold" }, iconCollection: "rgb(0, 43, 54)", iconEdit: "edit", iconDelete: "rgb(203, 75, 22)", iconAdd: "edit", iconCopy: "rgb(38, 139, 210)", iconOk: "green", iconCancel: "rgb(203, 75, 22)" } }, an = Zt({ getStyles: () => ({}), icons: {} }), Tn = ({ theme: e = At, icons: t = {}, docRoot: n, children: r }) => {
|
|
178
|
+
const a = An(e, n);
|
|
179
|
+
return o.jsx(an.Provider, { value: { getStyles: (i, s) => typeof a[i] == "function" ? a[i](s) : a[i], icons: t }, children: r });
|
|
180
|
+
}, Oe = () => Gt(an), An = (e, t) => {
|
|
181
|
+
var n, r, a, i;
|
|
182
|
+
const s = {}, p = (Array.isArray(e) ? e : [e]).map(((u) => Pn(u) ? Ot({ fragments: {}, styles: u }, s) : Ot(u, s))), d = Ot(At, {});
|
|
183
|
+
Object.keys(d).forEach(((u) => {
|
|
184
|
+
const c = u;
|
|
185
|
+
p.forEach(((h) => {
|
|
186
|
+
h[c] && (d[c] = Object.assign(Object.assign({}, d[c]), h[c]));
|
|
187
|
+
}));
|
|
188
|
+
}));
|
|
189
|
+
const l = Object.assign({}, d);
|
|
190
|
+
return Object.entries(s).forEach((([u, c]) => {
|
|
191
|
+
const h = u;
|
|
192
|
+
l[h] = (f) => {
|
|
193
|
+
const m = c(f) || {};
|
|
194
|
+
return Object.assign(Object.assign({}, d[h]), m);
|
|
195
|
+
};
|
|
196
|
+
})), typeof l?.inputHighlight != "function" && !((n = l?.inputHighlight) === null || n === void 0) && n.backgroundColor && t.style.setProperty("--jer-highlight-color", (r = l?.inputHighlight) === null || r === void 0 ? void 0 : r.backgroundColor), typeof l?.iconCopy != "function" && !((a = l?.iconCopy) === null || a === void 0) && a.color && t.style.setProperty("--jer-icon-copy-color", (i = l?.iconCopy) === null || i === void 0 ? void 0 : i.color), l;
|
|
197
|
+
}, Ot = (e, t) => {
|
|
198
|
+
const { fragments: n, styles: r } = e, a = {};
|
|
199
|
+
return Object.entries(r).forEach((([i, s]) => {
|
|
200
|
+
const p = (Array.isArray(s) ? s : [s]).reduce(((d, l) => {
|
|
201
|
+
var u, c;
|
|
202
|
+
if (typeof l == "function") return t[i] = l, Object.assign({}, d);
|
|
203
|
+
if (typeof l == "string") {
|
|
204
|
+
const h = (u = n?.[l]) !== null && u !== void 0 ? u : l;
|
|
205
|
+
return typeof h == "string" ? Object.assign(Object.assign({}, d), { [(c = Rn[i]) !== null && c !== void 0 ? c : "color"]: h }) : Object.assign(Object.assign({}, d), h);
|
|
206
|
+
}
|
|
207
|
+
return Object.assign(Object.assign({}, d), l);
|
|
208
|
+
}), {});
|
|
209
|
+
a[i] = p;
|
|
210
|
+
})), a;
|
|
211
|
+
}, Pn = (e) => !("styles" in e), Rn = { container: "backgroundColor", collection: "backgroundColor", collectionInner: "backgroundColor", collectionElement: "backgroundColor", dropZone: "borderColor", inputHighlight: "backgroundColor" }, sn = Zt(null), In = ({ children: e, onEditEvent: t, onCollapse: n }) => {
|
|
212
|
+
const [r, a] = J(null), [i, s] = J(null), [p, d] = J(null), [l, u] = J({ path: null, pathString: null }), c = ce(null), h = ce("next"), f = ce(null);
|
|
213
|
+
return o.jsx(sn.Provider, { value: { collapseState: r, setCollapseState: (m) => {
|
|
214
|
+
a(m), n && m !== null && (Array.isArray(m) ? m.forEach(((b) => n(b))) : n(m)), m !== null && setTimeout((() => a(null)), 2e3);
|
|
215
|
+
}, getMatchingCollapseState: (m) => {
|
|
216
|
+
if (Array.isArray(r)) {
|
|
217
|
+
for (const b of r) if (Ut(m, b)) return b;
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
return Ut(m, r) ? r : null;
|
|
221
|
+
}, currentlyEditingElement: i, setCurrentlyEditingElement: (m, b) => {
|
|
222
|
+
const D = typeof m == "string" || m === null ? m : Ue(m, b === "key" ? "key_" : void 0);
|
|
223
|
+
i !== null && D !== null && c.current !== null && c.current(), s(D), t && (Array.isArray(m) || m === null) && t(m, b === "key"), c.current = typeof b == "function" ? b : null;
|
|
224
|
+
}, areChildrenBeingEdited: (m) => i !== null && i.includes(m), previouslyEditedElement: f.current, setPreviouslyEditedElement: (m) => {
|
|
225
|
+
f.current = m;
|
|
226
|
+
}, tabDirection: h.current, setTabDirection: (m) => {
|
|
227
|
+
h.current = m;
|
|
228
|
+
}, previousValue: p, setPreviousValue: d, dragSource: l, setDragSource: u }, children: e });
|
|
229
|
+
}, He = () => {
|
|
230
|
+
const e = Gt(sn);
|
|
231
|
+
if (!e) throw new Error("Missing Context Provider");
|
|
232
|
+
return e;
|
|
233
|
+
}, Ut = (e, t) => {
|
|
234
|
+
if (t === null) return !1;
|
|
235
|
+
if (!t.includeChildren) return t.path.every(((n, r) => e[r] === n)) && t.path.length === e.length;
|
|
236
|
+
for (const [n, r] of t.path.entries()) if (r !== e[n]) return !1;
|
|
237
|
+
return !0;
|
|
238
|
+
}, St = "**INVALID_FUNCTION**", Vn = ({ nodeData: e, showStringQuotes: t = !0, stringTruncate: n = 200, pathString: r, canEdit: a, setIsEditing: i, styles: s, translate: p, value: d, TextWrapper: l = ({ children: u }) => u }) => {
|
|
239
|
+
const u = d ?? e.value, [c, h] = J(!1), f = t ? '"' : "", m = u.length > n, b = () => {
|
|
240
|
+
a ? i(!0) : h(!c);
|
|
241
|
+
};
|
|
242
|
+
return o.jsxs("div", { id: `${r}_display`, onDoubleClick: b, onClick: (D) => {
|
|
243
|
+
(D.getModifierState("Control") || D.getModifierState("Meta")) && b();
|
|
244
|
+
}, className: "jer-value-string", style: s, children: [f, m ? o.jsxs(o.Fragment, c ? { children: [o.jsx(l, { children: o.jsxs("span", { children: [u, f] }) }), o.jsxs("span", { className: "jer-string-expansion jer-show-less", onClick: () => h(!1), children: [" ", p("SHOW_LESS", e)] })] } : { children: [o.jsxs(l, { children: [o.jsx("span", { children: u.slice(0, n - 2).trimEnd() }), " "] }), o.jsx("span", { className: "jer-string-expansion jer-ellipsis", onClick: () => h(!0), children: "..." }), f] }) : o.jsx(l, { children: `${u}${f}` })] });
|
|
245
|
+
}, Kn = ({ styles: e, pathString: t, value: n, setValue: r, handleEdit: a, handleKeyboard: i, keyboardCommon: s }) => {
|
|
246
|
+
const p = ce(null);
|
|
247
|
+
return o.jsx(en, { className: "jer-input-text", textAreaRef: p, name: t, value: n, setValue: r, handleKeyPress: (d) => {
|
|
248
|
+
i(d, Object.assign({ stringConfirm: a, stringLineBreak: () => {
|
|
249
|
+
const l = rn(p, `
|
|
250
|
+
`);
|
|
251
|
+
r(l);
|
|
252
|
+
} }, s));
|
|
253
|
+
}, styles: e });
|
|
254
|
+
}, _n = (e) => {
|
|
255
|
+
var { isEditing: t, path: n, enumType: r } = e, a = qt(e, ["isEditing", "path", "enumType"]);
|
|
256
|
+
const { getStyles: i } = Oe(), s = Ue(n), { value: p, setValue: d, nodeData: l, handleEdit: u, handleKeyboard: c, keyboardCommon: h } = a;
|
|
257
|
+
return t && r ? o.jsxs("div", { className: "jer-select jer-select-enums", children: [o.jsx("select", { name: `${s}-value-select`, className: "jer-select-inner", onChange: (f) => d(f.target.value), value: p, autoFocus: !0, onKeyDown: (f) => {
|
|
258
|
+
c(f, Object.assign({ stringConfirm: u }, h));
|
|
259
|
+
}, children: r.values.map(((f) => o.jsx("option", { value: f, children: f }, f))) }), o.jsx("span", { className: "focus" })] }) : t ? o.jsx(Kn, Object.assign({ styles: i("input", l), pathString: s }, a, { setValue: a.setValue })) : o.jsx(Vn, Object.assign({ pathString: s, styles: i("string", l) }, a));
|
|
260
|
+
}, Ln = ({ value: e, setValue: t, isEditing: n, path: r, setIsEditing: a, handleEdit: i, nodeData: s, handleKeyboard: p, keyboardCommon: d }) => {
|
|
261
|
+
const { getStyles: l } = Oe();
|
|
262
|
+
return n ? o.jsx("input", { className: "jer-input-number", type: "text", name: Ue(r), value: e, onChange: (u) => t(u.target.value.replace(/[^0-9.-]/g, "")), autoFocus: !0, onFocus: (u) => setTimeout((() => u.target.select()), 10), onKeyDown: (u) => p(u, Object.assign({ numberConfirm: i, numberUp: () => t(Number(e) + 1), numberDown: () => t(Number(e) - 1) }, d)), style: Object.assign({ width: String(e).length / 1.5 + 2 + "em" }, l("input", s)) }) : o.jsx("span", { onDoubleClick: () => a(!0), className: "jer-value-number", style: l("number", s), children: e });
|
|
263
|
+
}, zn = ({ value: e, setValue: t, isEditing: n, path: r, setIsEditing: a, handleEdit: i, nodeData: s, handleKeyboard: p, keyboardCommon: d }) => {
|
|
264
|
+
const { getStyles: l } = Oe();
|
|
265
|
+
return typeof e != "boolean" ? null : n ? o.jsx("input", { className: "jer-input-boolean", type: "checkbox", name: Ue(r), checked: e, onChange: () => t(!e), onKeyDown: (u) => {
|
|
266
|
+
u.key === " " && u.preventDefault(), p(u, Object.assign({ booleanConfirm: i, booleanToggle: () => t(!e) }, d));
|
|
267
|
+
}, autoFocus: !0 }) : o.jsx("span", { onDoubleClick: () => a(!0), className: "jer-value-boolean", style: l("boolean", s), children: String(e) });
|
|
268
|
+
}, Mn = (e, t) => {
|
|
269
|
+
const n = ce(void 0), r = ce(t);
|
|
270
|
+
De((() => {
|
|
271
|
+
r.current = t;
|
|
272
|
+
}), [t]);
|
|
273
|
+
const a = (i) => {
|
|
274
|
+
r.current(i);
|
|
275
|
+
};
|
|
276
|
+
De((() => {
|
|
277
|
+
if (window.clearTimeout(n.current), e) return n.current = window.setTimeout((() => {
|
|
278
|
+
window.addEventListener("keydown", a);
|
|
279
|
+
}), 100), () => {
|
|
280
|
+
window.clearTimeout(n.current), window.removeEventListener("keydown", a);
|
|
281
|
+
};
|
|
282
|
+
}), [e]);
|
|
283
|
+
}, Fn = ({ value: e, isEditing: t, setIsEditing: n, handleEdit: r, nodeData: a, handleKeyboard: i, keyboardCommon: s }) => {
|
|
284
|
+
const { getStyles: p } = Oe();
|
|
285
|
+
return Mn(t, ((d) => i(d, Object.assign({ confirm: r }, s)))), o.jsx("div", { onDoubleClick: () => n(!0), className: "jer-value-null", style: p("null", a), children: String(e) });
|
|
286
|
+
}, $n = ({ value: e }) => {
|
|
287
|
+
let t = "Error!";
|
|
288
|
+
switch (typeof e) {
|
|
289
|
+
case "string":
|
|
290
|
+
e === St && (t = "Function");
|
|
291
|
+
break;
|
|
292
|
+
case "undefined":
|
|
293
|
+
t = "Undefined";
|
|
294
|
+
break;
|
|
295
|
+
case "symbol":
|
|
296
|
+
t = "Symbol";
|
|
297
|
+
}
|
|
298
|
+
return o.jsx("span", { className: "jer-value-invalid", children: t });
|
|
299
|
+
}, Bn = ({ size: e, style: t, className: n }) => o.jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: e, height: e, className: n, style: t, children: [o.jsx("path", { d: "M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z" }), o.jsx("path", { d: "M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z" })] }), Wn = ({ size: e, style: t, className: n }) => o.jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: e, height: e, className: n, style: t, transform: "translate(0, 0.5)", children: [o.jsx("path", { d: "M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z" }), o.jsx("path", { d: "M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z" })] }), Hn = ({ size: e, style: t, className: n }) => o.jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: e, height: e, className: n, style: t, children: o.jsx("path", { d: "M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z" }) }), Un = ({ size: e, style: t, className: n }) => o.jsxs("svg", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, viewBox: "0 0 24 24", width: e, height: e, className: n, style: t, children: [o.jsx("path", { d: "M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z" }), o.jsx("path", { d: "M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11" }), o.jsx("path", { d: "M15 10l-4 4 4 4" })] }), Yn = ({ size: e, style: t, className: n }) => o.jsxs("svg", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, viewBox: "0 0 24 24", width: e, height: e, className: n, style: t, children: [o.jsx("path", { d: "M22 11.08V12a10 10 0 11-5.93-9.14" }), o.jsx("path", { d: "M22 4L12 14.01l-3-3" })] }), Jn = ({ size: e, style: t, className: n }) => o.jsx("svg", { baseProfile: "tiny", viewBox: "0 0 24 24", fill: "currentColor", width: e, height: e, className: n, style: t, children: o.jsx("path", { d: "M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z" }) }), Xn = ({ size: e, style: t, className: n }) => o.jsx("svg", { viewBox: "0 0 512 512", fill: "currentColor", width: e, height: e, className: n, style: t, children: o.jsx("path", { d: "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z" }) }), We = ({ name: e, nodeData: t }) => {
|
|
300
|
+
var n, r, a, i, s, p, d;
|
|
301
|
+
const { getStyles: l, icons: u } = Oe(), c = { size: "1.4em", className: "jer-icon" };
|
|
302
|
+
switch (e) {
|
|
303
|
+
case "add":
|
|
304
|
+
return (n = u?.add) !== null && n !== void 0 ? n : o.jsx(Bn, Object.assign({}, c, { style: l("iconAdd", t) }));
|
|
305
|
+
case "edit":
|
|
306
|
+
return (r = u?.edit) !== null && r !== void 0 ? r : o.jsx(Wn, Object.assign({}, c, { style: l("iconEdit", t) }));
|
|
307
|
+
case "delete":
|
|
308
|
+
return (a = u?.delete) !== null && a !== void 0 ? a : o.jsx(Hn, Object.assign({}, c, { style: l("iconDelete", t), size: "1.45em" }));
|
|
309
|
+
case "copy":
|
|
310
|
+
return (i = u?.copy) !== null && i !== void 0 ? i : o.jsx(Un, Object.assign({}, c, { style: l("iconCopy", t), size: "1.2em" }));
|
|
311
|
+
case "ok":
|
|
312
|
+
return (s = u?.ok) !== null && s !== void 0 ? s : o.jsx(Yn, Object.assign({}, c, { style: Object.assign({ fontSize: "90%" }, l("iconOk", t)) }));
|
|
313
|
+
case "cancel":
|
|
314
|
+
return (p = u?.cancel) !== null && p !== void 0 ? p : o.jsx(Jn, Object.assign({}, c, { style: Object.assign({ fontSize: "130%" }, l("iconCancel", t)) }));
|
|
315
|
+
case "chevron":
|
|
316
|
+
return (d = u?.chevron) !== null && d !== void 0 ? d : o.jsx(Xn, { size: "1em", style: l("iconCollection", t) });
|
|
317
|
+
default:
|
|
318
|
+
return o.jsx(o.Fragment, {});
|
|
319
|
+
}
|
|
320
|
+
}, ln = ({ startEdit: e, handleDelete: t, handleAdd: n, enableClipboard: r, type: a, customButtons: i, nodeData: s, translate: p, keyboardControls: d, handleKeyboard: l, editConfirmRef: u, getNewKeyOptions: c, jsonStringify: h, onEditEvent: f, showIconTooltips: m }) => {
|
|
321
|
+
const { getStyles: b } = Oe(), D = p("KEY_NEW", s), [O, w] = J(D), [N, _] = J(!1), { key: W, path: z, value: H } = s, X = Array.isArray(N), $ = (C) => {
|
|
322
|
+
var k;
|
|
323
|
+
if (f && f(C ? [...z, null] : null, C), !C) return void _(!1);
|
|
324
|
+
const L = Object.keys(qe(s.fullData, z)), Y = c ? (k = c(s)) === null || k === void 0 ? void 0 : k.filter(((ae) => !L.includes(ae))) : null;
|
|
325
|
+
Y && w(""), _(Y == null || Y);
|
|
326
|
+
};
|
|
327
|
+
return o.jsxs("div", { className: "jer-edit-buttons", style: { opacity: N ? 1 : void 0 }, onClick: (C) => C.stopPropagation(), children: [r && o.jsx("div", { onClick: (C) => {
|
|
328
|
+
var k;
|
|
329
|
+
C.stopPropagation();
|
|
330
|
+
let L, Y, ae = "value", Z = "", ne = null;
|
|
331
|
+
if (r) {
|
|
332
|
+
const G = Tt(C);
|
|
333
|
+
if (G && d.clipboardModifier.includes(G) ? (L = Zn(z), Z = L, ae = "path") : (L = H, Z = typeof L == "object" ? h(H) : String(L)), !navigator.clipboard) return void (typeof r == "function" && r({ success: !1, value: L, stringValue: Z, path: z, key: W, type: ae, errorMessage: "Can't access clipboard API" }));
|
|
334
|
+
(k = navigator.clipboard) === null || k === void 0 || k.writeText(Z).then((() => Y = !0)).catch(((M) => {
|
|
335
|
+
Y = !1, ne = M.message;
|
|
336
|
+
})).finally((() => {
|
|
337
|
+
typeof r == "function" && r({ success: Y, errorMessage: ne, value: L, stringValue: Z, path: z, key: W, type: ae });
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
340
|
+
}, className: "jer-copy-pulse", title: m ? p("TOOLTIP_COPY", s) : "", children: o.jsx(We, { name: "copy", nodeData: s }) }), e && o.jsx("div", { onClick: e, title: m ? p("TOOLTIP_EDIT", s) : "", children: o.jsx(We, { name: "edit", nodeData: s }) }), t && o.jsx("div", { onClick: t, title: m ? p("TOOLTIP_DELETE", s) : "", children: o.jsx(We, { name: "delete", nodeData: s }) }), n && o.jsx("div", { onClick: () => {
|
|
341
|
+
a === "object" ? $(!0) : n("");
|
|
342
|
+
}, title: m ? p("TOOLTIP_ADD", s) : "", children: o.jsx(We, { name: "add", nodeData: s }) }), i?.map((({ Element: C, onClick: k }, L) => o.jsx("div", { onClick: (Y) => k && k(s, Y), children: o.jsx(C, { nodeData: s }) }, L))), N && n && a === "object" && o.jsxs(o.Fragment, { children: [X ? o.jsxs("div", { className: "jer-select jer-select-keys", children: [o.jsxs("select", { name: "new-key-select", className: "jer-select-inner", onChange: (C) => {
|
|
343
|
+
n(C.target.value), $(!1);
|
|
344
|
+
}, defaultValue: "", autoFocus: !0, onKeyDown: (C) => {
|
|
345
|
+
l(C, { cancel: () => $(!1) });
|
|
346
|
+
}, children: [o.jsx("option", { value: "", disabled: !0, children: N.length > 0 ? p("KEY_SELECT", s) : p("NO_KEY_OPTIONS", s) }), N.map(((C) => o.jsx("option", { value: C, children: C }, C)))] }), o.jsx("span", { className: "focus" })] }) : o.jsx("input", { className: "jer-input-new-key", type: "text", name: "new-object-key", value: O, onChange: (C) => w(C.target.value), autoFocus: !0, onFocus: (C) => C.target.select(), onKeyDown: (C) => {
|
|
347
|
+
l(C, { stringConfirm: () => {
|
|
348
|
+
n && ($(!1), n(O), w(D));
|
|
349
|
+
}, cancel: () => {
|
|
350
|
+
$(!1), w(D);
|
|
351
|
+
} });
|
|
352
|
+
}, style: b("input", s) }), o.jsx(Pt, { onOk: () => {
|
|
353
|
+
X && !O || ($(!1), n(O));
|
|
354
|
+
}, onCancel: () => {
|
|
355
|
+
$(!1);
|
|
356
|
+
}, nodeData: s, editConfirmRef: u, hideOk: X })] })] });
|
|
357
|
+
}, Pt = ({ onOk: e, onCancel: t, nodeData: n, editConfirmRef: r, hideOk: a = !1 }) => o.jsxs("div", { className: "jer-confirm-buttons", children: [!a && o.jsx("div", { onClick: e, ref: r, children: o.jsx(We, { name: "ok", nodeData: n }) }), o.jsx("div", { onClick: t, children: o.jsx(We, { name: "cancel", nodeData: n }) })] }), Zn = (e) => e.reduce(((t, n) => typeof n == "number" ? `${t}[${n}]` : t === "" ? n : `${t}.${n}`), ""), Gn = ["string", "number", "boolean", "null", "object", "array"], cn = ({ props: e, collapsed: t }) => {
|
|
358
|
+
const { data: n, nodeData: r, parentData: a, onEdit: i, onError: s, showErrorMessages: p, restrictEditFilter: d, restrictDeleteFilter: l, restrictAddFilter: u, restrictDragFilter: c, translate: h, errorMessageTimeout: f } = e, { currentlyEditingElement: m, setCurrentlyEditingElement: b } = He(), [D, O] = J(null), w = Object.assign(Object.assign({}, r), { collapsed: t }), { path: N, key: _, size: W } = w, z = Ue(N), H = !d(w), X = !l(w), $ = !u(w), C = !c(w) && X && m === null, k = (M) => {
|
|
359
|
+
p && (O(M), setTimeout((() => O(null)), f)), console.warn("Error", M);
|
|
360
|
+
}, L = Re(((M, F) => {
|
|
361
|
+
k(M.message), s && s({ currentData: w.fullData, errorValue: F, currentValue: n, name: _, path: N, error: M });
|
|
362
|
+
}), [s, p]), Y = m === z, ae = m === `key_${z}`, Z = typeof N.slice(-1)[0] == "number", ne = { isEditing: Y, isEditingKey: ae, isArray: Z, canEditKey: a !== null && H && $ && X && !Z }, G = _ === "" && N.length > 0 ? h("EMPTY_STRING", w) : null;
|
|
363
|
+
return { pathString: z, nodeData: w, path: N, name: _, size: W, canEdit: H, canDelete: X, canAdd: $, canDrag: C, error: D, showError: k, onError: L, setError: O, handleEditKey: (M) => {
|
|
364
|
+
if (b(null), _ === M || !a) return;
|
|
365
|
+
const F = N.slice(0, -1);
|
|
366
|
+
if (Object.keys(a).includes(M)) return void L({ code: "KEY_EXISTS", message: h("ERROR_KEY_EXISTS", w) }, M);
|
|
367
|
+
const ge = Object.fromEntries(Object.entries(a).map((([B, R]) => B === _ ? [M, R] : [B, R])));
|
|
368
|
+
i(ge, F).then(((B) => {
|
|
369
|
+
B && L({ code: "UPDATE_ERROR", message: B }, M);
|
|
370
|
+
}));
|
|
371
|
+
}, derivedValues: ne, emptyStringKey: G };
|
|
372
|
+
}, dn = ({ canDrag: e, canDragOnto: t, path: n, nodeData: r, onMove: a, onError: i, translate: s }) => {
|
|
373
|
+
const { getStyles: p } = Oe(), { dragSource: d, setDragSource: l } = He(), [u, c] = J(!1), h = Ue(n), f = le((() => e ? { onDragStart: (O) => {
|
|
374
|
+
O.stopPropagation(), l({ path: n, pathString: h });
|
|
375
|
+
}, onDragEnd: (O) => {
|
|
376
|
+
O.stopPropagation(), l({ path: null, pathString: null });
|
|
377
|
+
} } : {}), [e, h]), m = le((() => (O) => t ? { onDragOver: (w) => {
|
|
378
|
+
w.stopPropagation(), w.preventDefault();
|
|
379
|
+
}, onDrop: (w) => {
|
|
380
|
+
w.stopPropagation(), D(O), l({ path: null, pathString: null }), c(!1);
|
|
381
|
+
}, onDragEnter: (w) => {
|
|
382
|
+
var N;
|
|
383
|
+
w.stopPropagation(), h.startsWith((N = d.pathString) !== null && N !== void 0 ? N : "") || c(O);
|
|
384
|
+
}, onDragExit: (w) => {
|
|
385
|
+
w.stopPropagation(), c(!1);
|
|
386
|
+
} } : {}), [d, t, h]), b = le((() => t && d.pathString !== null ? o.jsx("div", Object.assign({ className: "jer-drop-target-bottom", style: { height: "50%", position: "absolute", width: "100%", top: "50%", zIndex: n.length } }, m("below"))) : null), [d, t, n.length]), D = (O) => {
|
|
387
|
+
var w, N;
|
|
388
|
+
const _ = (w = d.path) === null || w === void 0 ? void 0 : w.slice(-1)[0], W = (N = d.path) === null || N === void 0 ? void 0 : N.slice(0, -1).join("."), z = n.slice(0, -1).join(""), { parentData: H } = r;
|
|
389
|
+
typeof _ == "string" && H && !Array.isArray(H) && Object.keys(H).includes(_) && _ in H && W !== z ? i({ code: "KEY_EXISTS", message: s("ERROR_KEY_EXISTS", r) }, _) : a(d.path, n, O).then(((X) => {
|
|
390
|
+
X && i({ code: "UPDATE_ERROR", message: X }, r.value);
|
|
391
|
+
}));
|
|
392
|
+
};
|
|
393
|
+
return { dragSourceProps: f, getDropTargetProps: m, BottomDropTarget: b, DropTargetPadding: ({ position: O, nodeData: w }) => u === O ? o.jsx("div", { className: "jer-drag-n-drop-padding", style: p("dropZone", w) }) : null, handleDrop: D };
|
|
394
|
+
}, Qn = (e, t, n, r) => {
|
|
395
|
+
var a, i, s;
|
|
396
|
+
if (!t.current) return 0;
|
|
397
|
+
const p = parseInt((a = getComputedStyle(n.current).getPropertyValue("line-height")) !== null && a !== void 0 ? a : "16px"), d = ((s = (i = t.current) === null || i === void 0 ? void 0 : i.offsetWidth) !== null && s !== void 0 ? s : 0) / (0.5 * p), l = r(e).replace(/\\n/g, `
|
|
398
|
+
`).split(`
|
|
399
|
+
`).map(((u) => Math.ceil(u.length / d))).reduce(((u, c) => u + c), 0) * p;
|
|
400
|
+
return Math.min(l + 30, window.innerHeight - 50);
|
|
401
|
+
}, mt = ({ isEditingKey: e, canEditKey: t, pathString: n, path: r, name: a, arrayIndexFromOne: i, handleKeyboard: s, handleEditKey: p, handleCancel: d, handleClick: l, keyValueArray: u, styles: c, getNextOrPrevious: h, emptyStringKey: f }) => {
|
|
402
|
+
const { setCurrentlyEditingElement: m } = He(), b = typeof a == "number" ? String(a + (i ? 1 : 0)) : a;
|
|
403
|
+
return e ? o.jsx("input", { className: "jer-input-text jer-key-edit", type: "text", name: n, defaultValue: b, autoFocus: !0, onFocus: (D) => D.target.select(), onKeyDown: (D) => s(D, { stringConfirm: () => p(D.target.value), cancel: d, tabForward: () => {
|
|
404
|
+
if (p(D.target.value), u) {
|
|
405
|
+
const O = u?.[0][0];
|
|
406
|
+
m(O ? [...r, O] : h("next"));
|
|
407
|
+
} else m(r);
|
|
408
|
+
}, tabBack: () => {
|
|
409
|
+
p(D.target.value), m(h("prev"));
|
|
410
|
+
} }), style: { width: b.length / 1.5 + 0.5 + "em" } }) : o.jsxs("span", { className: "jer-key-text", style: Object.assign(Object.assign({}, c), { minWidth: `${Math.min(b.length + 1, 5)}ch`, flexShrink: b.length > 10 ? 1 : 0 }), onDoubleClick: () => t && m(r, "key"), onClick: l, children: [f ? o.jsx("span", { className: "jer-empty-string", children: f }) : b, b !== "" || f ? o.jsx("span", { className: "jer-key-colon", children: ":" }) : null] });
|
|
411
|
+
}, un = (e) => {
|
|
412
|
+
const { data: t, parentData: n, onEdit: r, onDelete: a, onChange: i, onMove: s, enableClipboard: p, canDragOnto: d, restrictTypeSelection: l, searchFilter: u, searchText: c, showLabel: h, stringTruncate: f, showStringQuotes: m, arrayIndexFromOne: b, indent: D, translate: O, customNodeDefinitions: w, customNodeData: N, handleKeyboard: _, keyboardControls: W, sort: z, editConfirmRef: H, jsonStringify: X, showIconTooltips: $ } = e, { getStyles: C } = Oe(), { setCurrentlyEditingElement: k, setCollapseState: L, previouslyEditedElement: Y, setPreviouslyEditedElement: ae, tabDirection: Z, setTabDirection: ne, previousValue: G, setPreviousValue: M } = He(), [F, ge] = J(typeof t == "function" ? St : t), { pathString: B, nodeData: R, path: V, name: q, canEdit: me, canDelete: Ie, canDrag: Ne, error: je, onError: de, handleEditKey: be, emptyStringKey: Ye, derivedValues: Ce } = cn({ props: e }), { dragSourceProps: nt, getDropTargetProps: rt, BottomDropTarget: re, DropTargetPadding: ue } = dn({ canDrag: Ne, canDragOnto: d, path: V, nodeData: R, onMove: s, onError: de, translate: O }), [ve, xe] = J(Nt(t, N)), S = Re(((g) => {
|
|
413
|
+
if (!i) return void ge(g);
|
|
414
|
+
const x = i({ currentData: R.fullData, newValue: g, currentValue: F, name: q, path: V });
|
|
415
|
+
ge(x);
|
|
416
|
+
}), [i]);
|
|
417
|
+
De((() => {
|
|
418
|
+
ge(typeof t == "function" ? St : t), xe(Nt(t, N));
|
|
419
|
+
}), [t, je]);
|
|
420
|
+
const { CustomNode: K, customNodeProps: Q, hideKey: Te, showEditTools: Ee = !0, showOnEdit: Ae, showOnView: Pe, passOriginalNode: Ve } = N, Ke = [...Gn, ...w.filter((({ showInTypesSelector: g = !1, name: x }) => g && !!x)).map((({ name: g }) => g))], ke = le((() => {
|
|
421
|
+
if (typeof l == "boolean") return l ? [] : Ke;
|
|
422
|
+
if (Array.isArray(l)) return l;
|
|
423
|
+
const g = l(R);
|
|
424
|
+
return typeof g == "boolean" ? g ? [] : Ke : g;
|
|
425
|
+
}), [R, l]), [se, _e] = J(((g, x) => {
|
|
426
|
+
var P;
|
|
427
|
+
if (typeof g != "string") return null;
|
|
428
|
+
const oe = x.filter(((U) => U instanceof Object && U.enum && U.values.includes(g) && U.matchPriority));
|
|
429
|
+
return oe.sort(((U, te) => {
|
|
430
|
+
var ze, Me;
|
|
431
|
+
return ((ze = te.matchPriority) !== null && ze !== void 0 ? ze : 0) - ((Me = U.matchPriority) !== null && Me !== void 0 ? Me : 0);
|
|
432
|
+
})), (P = oe[0]) !== null && P !== void 0 ? P : null;
|
|
433
|
+
})(F, ke)), { isEditing: ie } = Ce, Je = tn("value", R, u, c);
|
|
434
|
+
if (ie && (!Je || !me)) {
|
|
435
|
+
const g = Be(R.fullData, V, Z, z);
|
|
436
|
+
k(g || Y);
|
|
437
|
+
}
|
|
438
|
+
if (!Je) return null;
|
|
439
|
+
const we = (g) => {
|
|
440
|
+
let x;
|
|
441
|
+
if (k(null), M(null), g === void 0 || ((P) => P && typeof P == "object" && "type" in P && "target" in P && "preventDefault" in P && typeof P.preventDefault == "function")(g)) switch (ve) {
|
|
442
|
+
case "object":
|
|
443
|
+
x = { [O("DEFAULT_NEW_KEY", R)]: F };
|
|
444
|
+
break;
|
|
445
|
+
case "array":
|
|
446
|
+
x = F ?? [];
|
|
447
|
+
break;
|
|
448
|
+
case "number": {
|
|
449
|
+
const P = Number(F);
|
|
450
|
+
x = isNaN(P) ? 0 : P;
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
default:
|
|
454
|
+
x = F;
|
|
455
|
+
}
|
|
456
|
+
else x = g;
|
|
457
|
+
r(x, V).then(((P) => {
|
|
458
|
+
P && de({ code: "UPDATE_ERROR", message: P }, x);
|
|
459
|
+
}));
|
|
460
|
+
}, fe = () => {
|
|
461
|
+
k(null), G === null ? (ge(t), M(null)) : r(G, V);
|
|
462
|
+
}, { isEditingKey: Xe, canEditKey: Ze } = Ce, pe = !ie && je, ee = ie && ke.length > 1, Le = (ve !== "invalid" || K) && !je && Ee, v = h && !Te, j = K && (ie && Ae || !ie && Pe), E = { value: F, parentData: n, setValue: S, isEditing: ie, canEdit: me, setIsEditing: me ? () => k(V) : () => {
|
|
463
|
+
}, handleEdit: we, handleCancel: fe, path: V, stringTruncate: f, showStringQuotes: m, nodeData: R, enumType: se, translate: O, handleKeyboard: _, keyboardCommon: { cancel: fe, tabForward: () => {
|
|
464
|
+
ne("next"), ae(B);
|
|
465
|
+
const g = Be(R.fullData, V, "next", z);
|
|
466
|
+
g && (we(), k(g));
|
|
467
|
+
}, tabBack: () => {
|
|
468
|
+
ne("prev"), ae(B);
|
|
469
|
+
const g = Be(R.fullData, V, "prev", z);
|
|
470
|
+
g && (we(), k(g));
|
|
471
|
+
} } }, A = { canEditKey: Ze, isEditingKey: Xe, pathString: B, path: V, name: q, arrayIndexFromOne: b, handleKeyboard: _, handleEditKey: be, handleCancel: fe, styles: C("property", R), getNextOrPrevious: (g) => Be(R.fullData, V, g, z), emptyStringKey: Ye }, T = j ? o.jsx(K, Object.assign({}, e, { value: F, customNodeProps: Q, setValue: S, handleEdit: we, handleCancel: fe, handleKeyPress: (g) => _(g, { stringConfirm: we, cancel: fe }), isEditing: ie, setIsEditing: () => k(V), getStyles: C, originalNode: Ve ? Yt(t, E) : void 0, originalNodeKey: Ve ? o.jsx(mt, Object.assign({}, A)) : void 0, canEdit: me, keyboardCommon: E.keyboardCommon, onError: de })) : Yt(t, E);
|
|
472
|
+
return o.jsxs("div", Object.assign({ className: "jer-component jer-value-component", style: { marginLeft: n !== null ? D / 2 + "em" : 0, position: "relative" }, draggable: Ne }, nt, rt("above"), { children: [re, o.jsx(ue, { position: "above", nodeData: R }), o.jsxs("div", { className: "jer-value-main-row", style: { flexWrap: q.length > 10 ? "wrap" : "nowrap" }, children: [v && o.jsx(mt, Object.assign({}, A)), o.jsxs("div", { className: "jer-value-and-buttons", children: [o.jsx("div", { className: "jer-input-component", children: T }), ie ? o.jsx(Pt, { onOk: we, onCancel: fe, nodeData: R, editConfirmRef: H }) : Le && o.jsx(ln, { startEdit: me ? () => {
|
|
473
|
+
M(G), k(V, fe);
|
|
474
|
+
} : void 0, handleDelete: Ie ? () => {
|
|
475
|
+
a(F, V).then(((g) => {
|
|
476
|
+
g && de({ code: "DELETE_ERROR", message: g }, F);
|
|
477
|
+
}));
|
|
478
|
+
} : void 0, enableClipboard: p, translate: O, customButtons: e.customButtons, nodeData: R, handleKeyboard: _, keyboardControls: W, editConfirmRef: H, jsonStringify: X, showIconTooltips: $ }), ee && o.jsxs("div", { className: "jer-select jer-select-types", children: [o.jsx("select", { name: `${q}-type-select`, className: "jer-select-inner", onChange: (g) => ((x) => {
|
|
479
|
+
const P = w.find(((te) => te.name === x));
|
|
480
|
+
if (P) return r(P.defaultValue, V), xe(x), _e(null), k(null), void L({ path: V, collapsed: !1, includeChildren: !1 });
|
|
481
|
+
const oe = ke.find(((te) => te instanceof Object && te.enum === x));
|
|
482
|
+
if (oe) return typeof F == "string" && oe.values.includes(F) || r(oe.values[0], V).then(((te) => {
|
|
483
|
+
te && (de({ code: "UPDATE_ERROR", message: te }, U), k(null));
|
|
484
|
+
})), void _e(oe);
|
|
485
|
+
const U = qn(F, x, O("DEFAULT_NEW_KEY", R), N?.CustomNode ? O("DEFAULT_STRING", R) : void 0);
|
|
486
|
+
["string", "number", "boolean"].includes(x) || k(null), r(U, V).then(((te) => {
|
|
487
|
+
te ? (de({ code: "UPDATE_ERROR", message: te }, U), k(null)) : _e(null);
|
|
488
|
+
}));
|
|
489
|
+
})(g.target.value), value: se ? se.enum : ve, children: ke.map(((g) => g instanceof Object && "enum" in g ? o.jsx("option", { value: g.enum, children: g.enum }, g.enum) : o.jsx("option", { value: g, children: g }, g))) }), o.jsx("span", { className: "focus" })] }), pe && o.jsx("span", { className: "jer-error-slug", style: C("error", R), children: je })] })] }), o.jsx(ue, { position: "below", nodeData: R })] }));
|
|
490
|
+
}, Nt = (e, t) => t?.CustomNode && t?.name && t.showInTypesSelector ? t.name : typeof e == "string" ? "string" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : e === null ? "null" : "invalid", Yt = (e, t) => {
|
|
491
|
+
const n = Nt(e), { value: r } = t;
|
|
492
|
+
switch (n) {
|
|
493
|
+
case "string":
|
|
494
|
+
return o.jsx(_n, Object.assign({}, t, { value: r }));
|
|
495
|
+
case "number":
|
|
496
|
+
return o.jsx(Ln, Object.assign({}, t, { value: r }));
|
|
497
|
+
case "boolean":
|
|
498
|
+
return o.jsx(zn, Object.assign({}, t, { value: r }));
|
|
499
|
+
case "null":
|
|
500
|
+
return o.jsx(Fn, Object.assign({}, t));
|
|
501
|
+
default:
|
|
502
|
+
return o.jsx($n, Object.assign({}, t));
|
|
503
|
+
}
|
|
504
|
+
}, qn = (e, t, n, r) => {
|
|
505
|
+
switch (t) {
|
|
506
|
+
case "string":
|
|
507
|
+
return r ?? String(e);
|
|
508
|
+
case "number": {
|
|
509
|
+
const a = Number(e);
|
|
510
|
+
return isNaN(a) ? 0 : a;
|
|
511
|
+
}
|
|
512
|
+
case "boolean":
|
|
513
|
+
return !!e;
|
|
514
|
+
case "null":
|
|
515
|
+
return null;
|
|
516
|
+
case "object":
|
|
517
|
+
return { [n]: e };
|
|
518
|
+
case "array":
|
|
519
|
+
return [e];
|
|
520
|
+
default:
|
|
521
|
+
return String(e);
|
|
522
|
+
}
|
|
523
|
+
}, pn = (e = [], t) => {
|
|
524
|
+
const n = e.filter((({ condition: m }) => m(t)));
|
|
525
|
+
if (n.length === 0) return {};
|
|
526
|
+
const r = n[0], { element: a, wrapperElement: i, customNodeProps: s, wrapperProps: p, hideKey: d = !1, showEditTools: l = !0, showOnEdit: u = !1, showOnView: c = !0, showCollectionWrapper: h = !0 } = r, f = qt(r, ["element", "wrapperElement", "customNodeProps", "wrapperProps", "hideKey", "showEditTools", "showOnEdit", "showOnView", "showCollectionWrapper"]);
|
|
527
|
+
return Object.assign({ CustomNode: a, CustomWrapper: i, customNodeProps: s, wrapperProps: p, hideKey: d, showEditTools: l, showOnEdit: u, showOnView: c, showCollectionWrapper: h }, f);
|
|
528
|
+
}, hn = (e) => {
|
|
529
|
+
const { getStyles: t } = Oe(), { collapseState: n, setCollapseState: r, getMatchingCollapseState: a, currentlyEditingElement: i, setCurrentlyEditingElement: s, areChildrenBeingEdited: p, previousValue: d, setPreviousValue: l } = He(), { mainContainerRef: u, data: c, nodeData: h, parentData: f, showCollectionCount: m, onEdit: b, onAdd: D, onDelete: O, canDragOnto: w, collapseFilter: N, collapseAnimationTime: _, onMove: W, enableClipboard: z, onEditEvent: H, showIconTooltips: X, searchFilter: $, searchText: C, indent: k, sort: L, showArrayIndices: Y, arrayIndexFromOne: ae, defaultValue: Z, newKeyOptions: ne, translate: G, customNodeDefinitions: M, customNodeData: F, jsonParse: ge, jsonStringify: B, TextEditor: R, keyboardControls: V, handleKeyboard: q, insertAtTop: me, onCollapse: Ie, editConfirmRef: Ne, collapseClickZones: je } = e, [de, be] = J(B(c)), Ye = N(h), { contentRef: Ce, isAnimating: nt, maxHeight: rt, collapsed: re, animateCollapse: ue, cssTransitionValue: ve } = ((y, I, ye, he, Se) => {
|
|
530
|
+
const [bn, pt] = J(ye ? 0 : void 0), [ht, vn] = J(ye), vt = ce(!1), xt = ce(null), Mt = ce(0), Ft = ce(0), xn = I / 1e3 + "s", En = Re(((Et) => {
|
|
531
|
+
var wt, Dt;
|
|
532
|
+
if (ht !== Et) {
|
|
533
|
+
switch (window.clearTimeout(Ft.current), vt.current = !0, Et) {
|
|
534
|
+
case !0: {
|
|
535
|
+
const $t = (Dt = (wt = xt.current) === null || wt === void 0 ? void 0 : wt.offsetHeight) !== null && Dt !== void 0 ? Dt : 0;
|
|
536
|
+
Mt.current = $t, pt($t), setTimeout((() => {
|
|
537
|
+
pt(0);
|
|
538
|
+
}), 5);
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
case !1:
|
|
542
|
+
pt(Mt.current || Qn(y, xt, he, Se));
|
|
543
|
+
}
|
|
544
|
+
vn(!ht), Ft.current = window.setTimeout((() => {
|
|
545
|
+
vt.current = !1, Et || pt(void 0);
|
|
546
|
+
}), I);
|
|
547
|
+
}
|
|
548
|
+
}), [I, ht, y, he, Se]);
|
|
549
|
+
return { contentRef: xt, isAnimating: vt.current, animateCollapse: En, maxHeight: bn, collapsed: ht, cssTransitionValue: xn };
|
|
550
|
+
})(c, _, Ye, u, B), { pathString: xe, nodeData: S, path: K, name: Q, size: Te, canEdit: Ee, canDelete: Ae, canAdd: Pe, canDrag: Ve, error: Ke, setError: ke, onError: se, handleEditKey: _e, emptyStringKey: ie, derivedValues: Je } = cn({ props: e, collapsed: re }), { dragSourceProps: we, getDropTargetProps: fe, BottomDropTarget: Xe, DropTargetPadding: Ze } = dn({ canDrag: Ve, canDragOnto: w, path: K, nodeData: S, onMove: W, onError: se, translate: G }), pe = ce(!Ye), { isEditing: ee, isEditingKey: Le, isArray: v, canEditKey: j } = Je;
|
|
551
|
+
De((() => {
|
|
552
|
+
be(B(c));
|
|
553
|
+
}), [c, B]), De((() => {
|
|
554
|
+
const y = N(S) && !ee;
|
|
555
|
+
pe.current = !y, ue(y);
|
|
556
|
+
}), [N]), De((() => {
|
|
557
|
+
if (n !== null) {
|
|
558
|
+
const y = a(K);
|
|
559
|
+
y && (pe.current = !0, ue(y.collapsed));
|
|
560
|
+
}
|
|
561
|
+
}), [n]);
|
|
562
|
+
const E = ce(null), A = Re(((y, I) => {
|
|
563
|
+
if (typeof Z != "function") return Z;
|
|
564
|
+
const ye = Z(y, I);
|
|
565
|
+
return ye !== void 0 ? ye : null;
|
|
566
|
+
}), [Z]), T = Re(((y) => ne ? typeof ne != "function" ? ne : ne(y) : null), [ne]), { CustomNode: g, customNodeProps: x, CustomWrapper: P, wrapperProps: oe = {}, hideKey: U, showEditTools: te = !0, showOnEdit: ze, showOnView: Me, showCollectionWrapper: ft = !0 } = F, ct = p(xe);
|
|
567
|
+
if (ct && re && ue(!1), !(tn("collection", S, $, C) || S.level === 0) && !ct) return null;
|
|
568
|
+
const Ge = Array.isArray(c) ? "array" : "object", yt = Ge === "array" ? { open: "[", close: "]" } : { open: "{", close: "}" }, Rt = (y) => {
|
|
569
|
+
if (y.key !== "Tab" || y.getModifierState("Shift")) q(y, { objectConfirm: ut, cancel: ot });
|
|
570
|
+
else {
|
|
571
|
+
y.preventDefault();
|
|
572
|
+
const I = rn(E, " ");
|
|
573
|
+
be(I);
|
|
574
|
+
}
|
|
575
|
+
}, dt = (y) => {
|
|
576
|
+
y.stopPropagation();
|
|
577
|
+
const I = Tt(y);
|
|
578
|
+
if (I && V.collapseModifier.includes(I)) return pe.current = !0, void r({ collapsed: !re, path: K, includeChildren: !0 });
|
|
579
|
+
i && i.includes(xe) || (pe.current = !0, r(null), Ie && Ie({ path: K, collapsed: !re, includeChildren: !1 }), ue(!re));
|
|
580
|
+
}, ut = () => {
|
|
581
|
+
try {
|
|
582
|
+
const y = ge(de);
|
|
583
|
+
if (s(null), l(null), ke(null), B(y) === B(c)) return;
|
|
584
|
+
b(y, K).then(((I) => {
|
|
585
|
+
I && se({ code: "UPDATE_ERROR", message: I }, y);
|
|
586
|
+
}));
|
|
587
|
+
} catch {
|
|
588
|
+
se({ code: "INVALID_JSON", message: G("ERROR_INVALID_JSON", S) }, de);
|
|
589
|
+
}
|
|
590
|
+
}, gn = K.length > 0 ? () => {
|
|
591
|
+
O(c, K).then(((y) => {
|
|
592
|
+
y && se({ code: "DELETE_ERROR", message: y }, c);
|
|
593
|
+
}));
|
|
594
|
+
} : void 0, ot = () => {
|
|
595
|
+
s(null), d === null ? (ke(null), be(B(c)), l(null)) : b(d, K);
|
|
596
|
+
}, It = m === "when-closed" ? re : m, mn = !ee && te, fn = (Y || !v) && !U && Q !== void 0, yn = g && (ee && ze || !ee && Me), jt = Object.entries(c).map((([y, I]) => [Ge === "array" ? Number(y) : y, I]));
|
|
597
|
+
Ge === "object" && L(jt, ((y) => y));
|
|
598
|
+
const Vt = pe.current ? ee ? o.jsxs("div", { className: "jer-collection-text-edit", children: [R ? o.jsx(R, { value: de, onChange: be, onKeyDown: (y) => q(y, { objectConfirm: ut, cancel: ot }) }) : o.jsx(en, { textAreaRef: E, className: "jer-collection-text-area", name: xe, value: de, setValue: be, handleKeyPress: Rt, styles: t("input", S) }), o.jsx("div", { className: "jer-collection-input-button-row", children: o.jsx(Pt, { onOk: ut, onCancel: ot, nodeData: S, editConfirmRef: Ne }) })] }) : jt.map((([y, I], ye) => {
|
|
599
|
+
const he = { key: y, value: I, path: [...K, y], level: K.length + 1, index: ye, size: et(I) ? Object.keys(I).length : null, parentData: c, fullData: S.fullData }, Se = pn(M, he);
|
|
600
|
+
return o.jsx("div", { className: "jer-collection-element", style: t("collectionElement", he), children: et(I) && !Se?.renderCollectionAsValue ? o.jsx(hn, Object.assign({}, e, { data: I, parentData: c, nodeData: he, showCollectionCount: m, canDragOnto: Ee, customNodeData: Se }), y) : o.jsx(un, Object.assign({}, e, { data: I, parentData: c, nodeData: he, canDragOnto: Ee, showLabel: Ge === "object" || Y, customNodeData: Se }), y) }, y);
|
|
601
|
+
})) : null, bt = !!ft && re && !ct;
|
|
602
|
+
bt || (pe.current = !0);
|
|
603
|
+
const Kt = Object.assign(Object.assign({}, e), { data: c, value: c, parentData: f, nodeData: S, setValue: (y) => Qe(void 0, void 0, void 0, (function* () {
|
|
604
|
+
return yield b(y, K);
|
|
605
|
+
})), handleEdit: ut, handleCancel: ot, handleKeyPress: Rt, isEditing: ee, setIsEditing: () => s(K), getStyles: t, canDragOnto: Ee, canEdit: Ee, keyboardCommon: {}, onError: se }), jn = yn ? o.jsx(g, Object.assign({ customNodeProps: x }, Kt, { children: Vt })) : Vt, _t = mn && o.jsx(ln, { startEdit: Ee ? () => {
|
|
606
|
+
pe.current = !0, l(null), s(K);
|
|
607
|
+
} : void 0, handleAdd: Pe ? (y) => {
|
|
608
|
+
ue(!1);
|
|
609
|
+
const I = A(S, y);
|
|
610
|
+
if (Ge === "array") {
|
|
611
|
+
const ye = me.array ? 0 : c.length, he = me.array ? { insert: !0 } : {};
|
|
612
|
+
D(I, [...K, ye], he).then(((Se) => {
|
|
613
|
+
Se && se({ code: "ADD_ERROR", message: Se }, I);
|
|
614
|
+
}));
|
|
615
|
+
} else if (y in c) se({ code: "KEY_EXISTS", message: G("ERROR_KEY_EXISTS", S) }, y);
|
|
616
|
+
else {
|
|
617
|
+
const ye = me.object ? { insertBefore: 0 } : {};
|
|
618
|
+
D(I, [...K, y], ye).then(((he) => {
|
|
619
|
+
he && se({ code: "ADD_ERROR", message: he }, I);
|
|
620
|
+
}));
|
|
621
|
+
}
|
|
622
|
+
} : void 0, handleDelete: Ae ? gn : void 0, enableClipboard: z, type: Ge, nodeData: S, translate: G, customButtons: e.customButtons, keyboardControls: V, handleKeyboard: q, getNewKeyOptions: T, editConfirmRef: Ne, jsonStringify: B, onEditEvent: H, showIconTooltips: X }), Lt = { canEditKey: j, isEditingKey: Le, pathString: xe, path: K, name: Q, arrayIndexFromOne: ae, handleKeyboard: q, handleEditKey: _e, handleCancel: ot, keyValueArray: jt, styles: t("property", S), getNextOrPrevious: (y) => Be(S.fullData, K, y, L), handleClick: je.includes("property") ? dt : (y) => y.stopPropagation(), emptyStringKey: ie }, zt = o.jsxs("div", Object.assign({ className: "jer-component jer-collection-component", style: Object.assign(Object.assign({ marginLeft: (K.length === 0 ? 0 : k / 2) + "em" }, t("collection", S)), { position: "relative" }), draggable: Ve }, we, fe("above"), { children: [o.jsx("div", { className: "jer-clickzone", style: { width: k / 2 + 1 + "em", zIndex: 10 + 2 * S.level }, onClick: je.includes("left") ? dt : void 0 }), !ee && Xe, o.jsx(Ze, { position: "above", nodeData: S }), ft ? o.jsxs("div", { className: "jer-collection-header-row", style: { position: "relative" }, onClick: je.includes("header") ? dt : void 0, children: [o.jsxs("div", { className: "jer-collection-name", children: [o.jsx("div", { className: "jer-collapse-icon jer-accordion-icon" + (re ? " jer-rotate-90" : ""), style: { zIndex: 11 + 2 * S.level, transition: ve }, onClick: dt, children: o.jsx(We, { name: "chevron", rotate: re, nodeData: S }) }), fn && o.jsx(mt, Object.assign({}, Lt)), !ee && o.jsx("span", { className: "jer-brackets jer-bracket-open", style: t("bracket", S), children: yt.open })] }), !ee && It && o.jsx("div", { className: "jer-collection-item-count" + (It ? " jer-visible" : " jer-hidden"), style: Object.assign(Object.assign({}, t("itemCount", S)), { transition: ve }), children: Te === 1 ? G("ITEM_SINGLE", Object.assign(Object.assign({}, S), { size: 1 }), 1) : G("ITEMS_MULTIPLE", S, Te) }), o.jsx("div", { className: "jer-brackets" + (bt ? " jer-visible" : " jer-hidden"), style: Object.assign(Object.assign({}, t("bracket", S)), { transition: ve }), children: yt.close }), _t] }) : U ? o.jsx(o.Fragment, {}) : o.jsxs("div", { className: "jer-collection-header-row", style: { position: "relative" }, children: [o.jsx(mt, Object.assign({}, Lt)), _t] }), o.jsxs("div", { className: "jer-collection-inner", style: Object.assign(Object.assign({ overflowY: bt || nt ? "clip" : "visible", maxHeight: ct ? void 0 : rt }, t("collectionInner", S)), { transition: ve }), ref: Ce, children: [jn, o.jsx("div", { className: ee ? "jer-collection-error-row" : "jer-collection-error-row-edit", children: Ke && o.jsx("span", { className: "jer-error-slug", style: t("error", S), children: Ke }) }), !ee && ft && o.jsx("div", { className: "jer-brackets jer-bracket-outside", style: Object.assign(Object.assign({}, t("bracket", S)), { marginLeft: (k < 3 ? -1 : k < 6 ? -0.5 : 0) + "em" }), children: yt.close })] }), o.jsx(Ze, { position: "below", nodeData: S })] }));
|
|
623
|
+
return P ? o.jsx(P, Object.assign({ customNodeProps: oe }, Kt, { children: zt })) : zt;
|
|
624
|
+
}, er = { ITEM_SINGLE: "{{count}} item", ITEMS_MULTIPLE: "{{count}} items", KEY_NEW: "Enter new key", KEY_SELECT: "Select key", NO_KEY_OPTIONS: "No key options", ERROR_KEY_EXISTS: "Key already exists", ERROR_INVALID_JSON: "Invalid JSON", ERROR_UPDATE: "Update unsuccessful", ERROR_DELETE: "Delete unsuccessful", ERROR_ADD: "Adding node unsuccessful", DEFAULT_STRING: "New data!", DEFAULT_NEW_KEY: "key", SHOW_LESS: "(Show less)", EMPTY_STRING: "<empty string>", TOOLTIP_COPY: "Copy to clipboard", TOOLTIP_EDIT: "Edit", TOOLTIP_DELETE: "Delete", TOOLTIP_ADD: "Add" }, tr = (e, t) => (n, r, a) => ((i, s, p, d, l) => {
|
|
625
|
+
if (s[d]) {
|
|
626
|
+
const c = s[d](p);
|
|
627
|
+
if (c !== null) return c;
|
|
628
|
+
}
|
|
629
|
+
const u = d in i ? i[d] : er[d];
|
|
630
|
+
return l === void 0 ? u : u?.replace("{{count}}", String(l));
|
|
631
|
+
})(e, t, r, n, a);
|
|
632
|
+
var Jt = [], at = [];
|
|
633
|
+
(function(e, t) {
|
|
634
|
+
if (e && typeof document < "u") {
|
|
635
|
+
var n, r = t.prepend === !0 ? "prepend" : "append", a = t.singleTag === !0, i = typeof t.container == "string" ? document.querySelector(t.container) : document.getElementsByTagName("head")[0];
|
|
636
|
+
if (a) {
|
|
637
|
+
var s = Jt.indexOf(i);
|
|
638
|
+
s === -1 && (s = Jt.push(i) - 1, at[s] = {}), n = at[s] && at[s][r] ? at[s][r] : at[s][r] = p();
|
|
639
|
+
} else n = p();
|
|
640
|
+
e.charCodeAt(0) === 65279 && (e = e.substring(1)), n.styleSheet ? n.styleSheet.cssText += e : n.appendChild(document.createTextNode(e));
|
|
641
|
+
}
|
|
642
|
+
function p() {
|
|
643
|
+
var d = document.createElement("style");
|
|
644
|
+
if (d.setAttribute("type", "text/css"), t.attributes) for (var l = Object.keys(t.attributes), u = 0; u < l.length; u++) d.setAttribute(l[u], t.attributes[l[u]]);
|
|
645
|
+
var c = r === "prepend" ? "afterbegin" : "beforeend";
|
|
646
|
+
return i.insertAdjacentElement(c, d), d;
|
|
647
|
+
}
|
|
648
|
+
})(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-select-inner{text-overflow:ellipsis;width:100%}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em;line-height:1.1em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em;width:100%}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap;word-break:break-word}.jer-string-expansion{cursor:pointer;filter:saturate(50%);opacity:.6}.jer-show-less{font-size:80%}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:.3s}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string{font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}', {});
|
|
649
|
+
const nr = ({ data: e, setData: t, rootName: n = "root", onUpdate: r = () => {
|
|
650
|
+
}, onEdit: a = r, onDelete: i = r, onAdd: s = r, onChange: p, onError: d, onEditEvent: l, showErrorMessages: u = !0, enableClipboard: c = !0, indent: h = 2, collapse: f = !1, collapseAnimationTime: m = 300, showCollectionCount: b = !0, restrictEdit: D = !1, restrictDelete: O = !1, restrictAdd: w = !1, restrictTypeSelection: N = !1, restrictDrag: _ = !0, viewOnly: W, searchFilter: z, searchText: H, searchDebounceTime: X = 350, keySort: $ = !1, showArrayIndices: C = !0, arrayIndexFromOne: k = !1, showStringQuotes: L = !0, showIconTooltips: Y = !1, defaultValue: ae = null, newKeyOptions: Z, minWidth: ne = 250, maxWidth: G = "min(600px, 90vw)", rootFontSize: M, stringTruncate: F = 250, translations: ge = {}, className: B, id: R, customText: V = {}, customNodeDefinitions: q = [], customButtons: me = [], jsonParse: Ie = JSON.parse, jsonStringify: Ne = (re, ue) => JSON.stringify(re, ue, 2), TextEditor: je, errorMessageTimeout: de = 2500, keyboardControls: be = {}, externalTriggers: Ye, insertAtTop: Ce = !1, onCollapse: nt, collapseClickZones: rt = ["header", "left"] }) => {
|
|
651
|
+
const { getStyles: re } = Oe(), { setCurrentlyEditingElement: ue } = He(), ve = le((() => it(f)), [f]), xe = le((() => tr(ge, V)), [ge, V]), [S, K] = J(H), [Q, Te] = (({ setData: v, data: j }) => {
|
|
652
|
+
const [E, A] = J(v ? void 0 : j), T = Re(((g) => {
|
|
653
|
+
v ? v(g) : A(g);
|
|
654
|
+
}), [v]);
|
|
655
|
+
return De((() => {
|
|
656
|
+
v || A(j);
|
|
657
|
+
}), [j]), [v ? j : E, T];
|
|
658
|
+
})({ setData: t, data: e }), Ee = ce(null);
|
|
659
|
+
De((() => {
|
|
660
|
+
ue(null);
|
|
661
|
+
const v = setTimeout((() => K(H)), X);
|
|
662
|
+
return () => clearTimeout(v);
|
|
663
|
+
}), [H, X]);
|
|
664
|
+
const Ae = { key: n, path: [], level: 0, index: 0, value: Q, size: typeof Q == "object" && Q !== null ? Object.keys(Q).length : 1, parentData: null, fullData: Q }, Pe = (v, j) => Qe(void 0, void 0, void 0, (function* () {
|
|
665
|
+
const E = yield v(j);
|
|
666
|
+
if (E === !0 || E === void 0) return void Te(j.newData);
|
|
667
|
+
const A = or(E) ? E : ["error", E], [T, g] = A;
|
|
668
|
+
if (T === "error") return Te(j.currentData), g === !1 ? xe("ERROR_UPDATE", Ae) : String(g);
|
|
669
|
+
Te(g);
|
|
670
|
+
})), Ve = le((() => it(D, W)), [D, W]), Ke = le((() => it(O, W)), [O, W]), ke = le((() => it(w, W)), [w, W]), se = le((() => it(_, W)), [_, W]), _e = le((() => rr(z)), [z]), ie = le((() => ((v) => {
|
|
671
|
+
const j = Object.assign({}, Ht);
|
|
672
|
+
for (const E of Object.keys(Ht)) {
|
|
673
|
+
const A = E;
|
|
674
|
+
if (v[A]) {
|
|
675
|
+
const T = v[A], g = ["clipboardModifier", "collapseModifier"].includes(E) ? Array.isArray(T) ? T : [T] : typeof T == "string" ? { key: T } : T;
|
|
676
|
+
j[A] = g, ["stringConfirm", "numberConfirm", "booleanConfirm"].forEach(((x) => {
|
|
677
|
+
!v[x] && v.confirm && (j[x] = j.confirm);
|
|
678
|
+
}));
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return j;
|
|
682
|
+
})(be)), [be]), Je = Re(((v, j) => ((E, A, T) => {
|
|
683
|
+
const g = Object.entries(A);
|
|
684
|
+
for (const [x, P] of g) if (Sn(T, E[x], x)) {
|
|
685
|
+
T.preventDefault(), P();
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
})(ie, j, v)), [ie]), we = le((() => {
|
|
689
|
+
const v = Xt(q, "stringifyReplacer");
|
|
690
|
+
return (j) => Ne(j, v);
|
|
691
|
+
}), [q, Ne]), fe = le((() => {
|
|
692
|
+
const v = Xt(q, "parseReviver");
|
|
693
|
+
return (j) => {
|
|
694
|
+
const E = Ie(j, v);
|
|
695
|
+
return kt(E);
|
|
696
|
+
};
|
|
697
|
+
}), [q, Ie]), Xe = ce(null);
|
|
698
|
+
((v, j) => {
|
|
699
|
+
const { setCurrentlyEditingElement: E, currentlyEditingElement: A, setCollapseState: T } = He();
|
|
700
|
+
De((() => {
|
|
701
|
+
if (!v) return;
|
|
702
|
+
const { collapse: g, edit: x } = v;
|
|
703
|
+
g && T(g);
|
|
704
|
+
const P = !x?.path || Ue(x.path) === A;
|
|
705
|
+
switch (x?.action) {
|
|
706
|
+
case "accept":
|
|
707
|
+
P && (j.current && j.current.click(), E(null));
|
|
708
|
+
break;
|
|
709
|
+
case "cancel":
|
|
710
|
+
P && E(null);
|
|
711
|
+
break;
|
|
712
|
+
default:
|
|
713
|
+
x?.path && E(x.path);
|
|
714
|
+
}
|
|
715
|
+
}), [v]);
|
|
716
|
+
})(Ye, Xe);
|
|
717
|
+
const Ze = Re(((v, j) => {
|
|
718
|
+
$ !== !1 && (typeof $ != "function" ? v.sort(((E, A) => {
|
|
719
|
+
const T = j(E)[0], g = j(A)[0];
|
|
720
|
+
return T < g ? -1 : T > g ? 1 : 0;
|
|
721
|
+
})) : v.sort(((E, A) => $(j(E), j(A)))));
|
|
722
|
+
}), [$]), pe = pn(q, Ae), ee = { mainContainerRef: Ee, name: n, nodeData: Ae, onEdit: (v, j) => Qe(void 0, void 0, void 0, (function* () {
|
|
723
|
+
const { currentData: E, newData: A, currentValue: T, newValue: g } = st(Q, j, v, "update");
|
|
724
|
+
if (T !== g) return yield Pe(a, { currentData: E, newData: A, currentValue: T, newValue: g, name: j.slice(-1)[0], path: j });
|
|
725
|
+
})), onDelete: (v, j) => Qe(void 0, void 0, void 0, (function* () {
|
|
726
|
+
const { currentData: E, newData: A, currentValue: T, newValue: g } = st(Q, j, v, "delete");
|
|
727
|
+
return yield Pe(i, { currentData: E, newData: A, currentValue: T, newValue: g, name: j.slice(-1)[0], path: j });
|
|
728
|
+
})), onAdd: (v, j, E) => Qe(void 0, void 0, void 0, (function* () {
|
|
729
|
+
const { currentData: A, newData: T, currentValue: g, newValue: x } = st(Q, j, v, "add", E);
|
|
730
|
+
return yield Pe(s, { currentData: A, newData: T, currentValue: g, newValue: x, name: j.slice(-1)[0], path: j });
|
|
731
|
+
})), onChange: p, onError: d, onEditEvent: l, showErrorMessages: u, onMove: (v, j, E) => Qe(void 0, void 0, void 0, (function* () {
|
|
732
|
+
if (v === null) return;
|
|
733
|
+
const { currentData: A, newData: T, currentValue: g } = st(Q, v, "", "delete"), x = v.slice(-1)[0], P = j.slice(0, -1), oe = j.slice(-1)[0];
|
|
734
|
+
let U = typeof oe == "number" ? E === "above" ? oe : oe + 1 : typeof x == "number" ? `arr_${x}` : x;
|
|
735
|
+
v.slice(0, -1).join(".") === j.slice(0, -1).join(".") && typeof x == "number" && typeof U == "number" && x < U && (U -= 1);
|
|
736
|
+
const te = typeof U == "number" ? { insert: !0 } : E === "above" ? { insertBefore: oe } : { insertAfter: oe }, { newData: ze, newValue: Me } = st(T, [...P, U], g, "add", te);
|
|
737
|
+
return yield Pe(a, { currentData: A, newData: ze, currentValue: g, newValue: Me, name: j.slice(-1)[0], path: j });
|
|
738
|
+
})), showCollectionCount: b, collapseFilter: ve, collapseAnimationTime: m, restrictEditFilter: Ve, restrictDeleteFilter: Ke, restrictAddFilter: ke, restrictTypeSelection: N, restrictDragFilter: se, canDragOnto: !1, searchFilter: _e, searchText: S, enableClipboard: c, keySort: $, sort: Ze, showArrayIndices: C, arrayIndexFromOne: k, showStringQuotes: L, showIconTooltips: Y, indent: h, defaultValue: ae, newKeyOptions: Z, stringTruncate: F, translate: xe, customNodeDefinitions: q, customNodeData: pe, customButtons: me, parentData: null, jsonParse: fe, jsonStringify: we, TextEditor: je, errorMessageTimeout: de, handleKeyboard: Je, keyboardControls: ie, insertAtTop: { object: Ce === !0 || Ce === "object", array: Ce === !0 || Ce === "array" }, onCollapse: nt, editConfirmRef: Xe, collapseClickZones: rt }, Le = Object.assign(Object.assign({}, re("container", Ae)), { minWidth: ne, maxWidth: G });
|
|
739
|
+
return Le.fontSize = M ?? Le.fontSize, o.jsx("div", { id: R, ref: Ee, className: `jer-editor-container ${B ?? ""}`, style: Le, children: et(Q) && !pe.renderCollectionAsValue ? o.jsx(hn, Object.assign({ data: Q }, ee)) : o.jsx(un, Object.assign({ data: Q, showLabel: !0 }, ee)) });
|
|
740
|
+
}, ir = (e) => {
|
|
741
|
+
var t;
|
|
742
|
+
const [n, r] = J();
|
|
743
|
+
return De((() => {
|
|
744
|
+
const a = document.documentElement;
|
|
745
|
+
r(a);
|
|
746
|
+
}), []), n ? o.jsx(Tn, { theme: (t = e.theme) !== null && t !== void 0 ? t : At, icons: e.icons, docRoot: n, children: o.jsx(In, { onEditEvent: e.onEditEvent, onCollapse: e.onCollapse, children: o.jsx(nr, Object.assign({}, e)) }) }) : null;
|
|
747
|
+
}, st = (e, t, n, r, a = {}) => {
|
|
748
|
+
if (t.length === 0) return { currentData: e, newData: n, currentValue: e, newValue: n };
|
|
749
|
+
const i = Object.assign({ remove: r === "delete" }, a), s = r !== "add" ? qe(e, t) : void 0;
|
|
750
|
+
return { currentData: e, newData: wn(e, t, n, i), currentValue: s, newValue: r !== "delete" ? n : void 0 };
|
|
751
|
+
}, it = (e, t) => t ? () => !0 : typeof e == "boolean" ? () => e : typeof e == "number" ? ({ level: n }) => n >= e : e, rr = (e) => {
|
|
752
|
+
if (e !== void 0) return e === "value" ? tt : e === "key" ? Wt : e === "all" ? (t, n) => tt(t, n) || Wt(t, n) : e;
|
|
753
|
+
}, or = (e) => Array.isArray(e) && e.length === 2 && ["error", "value"].includes(e[0]), Xt = (e, t) => {
|
|
754
|
+
const n = t === "stringifyReplacer" ? [(r) => r === void 0 ? on : r] : [];
|
|
755
|
+
if (n.push(...e.map(((r) => r[t])).filter(((r) => !!r))), n.length !== 0) return (r, a) => {
|
|
756
|
+
let i = a;
|
|
757
|
+
for (const s of n) i = s(i);
|
|
758
|
+
return i;
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
export {
|
|
762
|
+
Bn as IconAdd,
|
|
763
|
+
Jn as IconCancel,
|
|
764
|
+
Xn as IconChevron,
|
|
765
|
+
Un as IconCopy,
|
|
766
|
+
Hn as IconDelete,
|
|
767
|
+
Wn as IconEdit,
|
|
768
|
+
Yn as IconOk,
|
|
769
|
+
ir as JsonEditor,
|
|
770
|
+
Vn as StringDisplay,
|
|
771
|
+
Kn as StringEdit,
|
|
772
|
+
wn as assign,
|
|
773
|
+
At as defaultTheme,
|
|
774
|
+
qe as extract,
|
|
775
|
+
et as isCollection,
|
|
776
|
+
tt as matchNode,
|
|
777
|
+
Wt as matchNodeKey,
|
|
778
|
+
Gn as standardDataTypes,
|
|
779
|
+
Ue as toPathString,
|
|
780
|
+
Mn as useKeyboardListener
|
|
781
|
+
};
|