@epam/ai-dial-sidebar 1.1.0-dev.182 → 1.1.0-dev.183
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/index.css +1 -1
- package/index.d.ts +0 -2
- package/index.d.ts.map +1 -1
- package/index.js +77 -49923
- package/package.json +2 -3
- package/JsonEditor-oVyN8mBH-4_lVc0wh-B2lYzGFt.js +0 -732
- package/components/SearchInput/SearchInput.d.ts +0 -40
- package/components/SearchInput/SearchInput.d.ts.map +0 -1
- package/index-BU5Qz5JM-BXYoqD6l-L4brbFsj.js +0 -58296
|
@@ -1,732 +0,0 @@
|
|
|
1
|
-
import { l as e, t } from "./index-BU5Qz5JM-BXYoqD6l-L4brbFsj.js";
|
|
2
|
-
import n, { memo as r, useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
3
|
-
//#region ../ai-dial-kit/dist/JsonEditor-oVyN8mBH-4_lVc0wh.js
|
|
4
|
-
function c(e, t) {
|
|
5
|
-
(t == null || t > e.length) && (t = e.length);
|
|
6
|
-
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
7
|
-
return r;
|
|
8
|
-
}
|
|
9
|
-
function l(e) {
|
|
10
|
-
if (Array.isArray(e)) return e;
|
|
11
|
-
}
|
|
12
|
-
function u(e, t, n) {
|
|
13
|
-
return (t = y(t)) in e ? Object.defineProperty(e, t, {
|
|
14
|
-
value: n,
|
|
15
|
-
enumerable: !0,
|
|
16
|
-
configurable: !0,
|
|
17
|
-
writable: !0
|
|
18
|
-
}) : e[t] = n, e;
|
|
19
|
-
}
|
|
20
|
-
function d(e, t) {
|
|
21
|
-
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
22
|
-
if (n != null) {
|
|
23
|
-
var r, i, a, o, s = [], c = !0, l = !1;
|
|
24
|
-
try {
|
|
25
|
-
if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
26
|
-
} catch (e) {
|
|
27
|
-
l = !0, i = e;
|
|
28
|
-
} finally {
|
|
29
|
-
try {
|
|
30
|
-
if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
31
|
-
} finally {
|
|
32
|
-
if (l) throw i;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return s;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function f() {
|
|
39
|
-
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
40
|
-
}
|
|
41
|
-
function p(e, t) {
|
|
42
|
-
var n = Object.keys(e);
|
|
43
|
-
if (Object.getOwnPropertySymbols) {
|
|
44
|
-
var r = Object.getOwnPropertySymbols(e);
|
|
45
|
-
t && (r = r.filter(function(t) {
|
|
46
|
-
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
47
|
-
})), n.push.apply(n, r);
|
|
48
|
-
}
|
|
49
|
-
return n;
|
|
50
|
-
}
|
|
51
|
-
function m(e) {
|
|
52
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
53
|
-
var n = arguments[t] == null ? {} : arguments[t];
|
|
54
|
-
t % 2 ? p(Object(n), !0).forEach(function(t) {
|
|
55
|
-
u(e, t, n[t]);
|
|
56
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : p(Object(n)).forEach(function(t) {
|
|
57
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return e;
|
|
61
|
-
}
|
|
62
|
-
function h(e, t) {
|
|
63
|
-
if (e == null) return {};
|
|
64
|
-
var n, r, i = g(e, t);
|
|
65
|
-
if (Object.getOwnPropertySymbols) {
|
|
66
|
-
var a = Object.getOwnPropertySymbols(e);
|
|
67
|
-
for (r = 0; r < a.length; r++) n = a[r], t.indexOf(n) === -1 && {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
68
|
-
}
|
|
69
|
-
return i;
|
|
70
|
-
}
|
|
71
|
-
function g(e, t) {
|
|
72
|
-
if (e == null) return {};
|
|
73
|
-
var n = {};
|
|
74
|
-
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
75
|
-
if (t.indexOf(r) !== -1) continue;
|
|
76
|
-
n[r] = e[r];
|
|
77
|
-
}
|
|
78
|
-
return n;
|
|
79
|
-
}
|
|
80
|
-
function _(e, t) {
|
|
81
|
-
return l(e) || d(e, t) || b(e, t) || f();
|
|
82
|
-
}
|
|
83
|
-
function v(e, t) {
|
|
84
|
-
if (typeof e != "object" || !e) return e;
|
|
85
|
-
var n = e[Symbol.toPrimitive];
|
|
86
|
-
if (n !== void 0) {
|
|
87
|
-
var r = n.call(e, t);
|
|
88
|
-
if (typeof r != "object") return r;
|
|
89
|
-
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
90
|
-
}
|
|
91
|
-
return (t === "string" ? String : Number)(e);
|
|
92
|
-
}
|
|
93
|
-
function y(e) {
|
|
94
|
-
var t = v(e, "string");
|
|
95
|
-
return typeof t == "symbol" ? t : t + "";
|
|
96
|
-
}
|
|
97
|
-
function b(e, t) {
|
|
98
|
-
if (e) {
|
|
99
|
-
if (typeof e == "string") return c(e, t);
|
|
100
|
-
var n = {}.toString.call(e).slice(8, -1);
|
|
101
|
-
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? c(e, t) : void 0;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function x(e, t, n) {
|
|
105
|
-
return t in e ? Object.defineProperty(e, t, {
|
|
106
|
-
value: n,
|
|
107
|
-
enumerable: !0,
|
|
108
|
-
configurable: !0,
|
|
109
|
-
writable: !0
|
|
110
|
-
}) : e[t] = n, e;
|
|
111
|
-
}
|
|
112
|
-
function S(e, t) {
|
|
113
|
-
var n = Object.keys(e);
|
|
114
|
-
if (Object.getOwnPropertySymbols) {
|
|
115
|
-
var r = Object.getOwnPropertySymbols(e);
|
|
116
|
-
t && (r = r.filter(function(t) {
|
|
117
|
-
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
118
|
-
})), n.push.apply(n, r);
|
|
119
|
-
}
|
|
120
|
-
return n;
|
|
121
|
-
}
|
|
122
|
-
function C(e) {
|
|
123
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
124
|
-
var n = arguments[t] == null ? {} : arguments[t];
|
|
125
|
-
t % 2 ? S(Object(n), !0).forEach(function(t) {
|
|
126
|
-
x(e, t, n[t]);
|
|
127
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : S(Object(n)).forEach(function(t) {
|
|
128
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return e;
|
|
132
|
-
}
|
|
133
|
-
function w() {
|
|
134
|
-
var e = [...arguments];
|
|
135
|
-
return function(t) {
|
|
136
|
-
return e.reduceRight(function(e, t) {
|
|
137
|
-
return t(e);
|
|
138
|
-
}, t);
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function T(e) {
|
|
142
|
-
return function t() {
|
|
143
|
-
var n = this, r = [...arguments];
|
|
144
|
-
return r.length >= e.length ? e.apply(this, r) : function() {
|
|
145
|
-
var e = [...arguments];
|
|
146
|
-
return t.apply(n, [].concat(r, e));
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function E(e) {
|
|
151
|
-
return {}.toString.call(e).includes("Object");
|
|
152
|
-
}
|
|
153
|
-
function D(e) {
|
|
154
|
-
return !Object.keys(e).length;
|
|
155
|
-
}
|
|
156
|
-
function O(e) {
|
|
157
|
-
return typeof e == "function";
|
|
158
|
-
}
|
|
159
|
-
function k(e, t) {
|
|
160
|
-
return Object.prototype.hasOwnProperty.call(e, t);
|
|
161
|
-
}
|
|
162
|
-
function A(e, t) {
|
|
163
|
-
return E(t) || F("changeType"), Object.keys(t).some(function(t) {
|
|
164
|
-
return !k(e, t);
|
|
165
|
-
}) && F("changeField"), t;
|
|
166
|
-
}
|
|
167
|
-
function j(e) {
|
|
168
|
-
O(e) || F("selectorType");
|
|
169
|
-
}
|
|
170
|
-
function M(e) {
|
|
171
|
-
O(e) || E(e) || F("handlerType"), E(e) && Object.values(e).some(function(e) {
|
|
172
|
-
return !O(e);
|
|
173
|
-
}) && F("handlersType");
|
|
174
|
-
}
|
|
175
|
-
function N(e) {
|
|
176
|
-
e || F("initialIsRequired"), E(e) || F("initialType"), D(e) && F("initialContent");
|
|
177
|
-
}
|
|
178
|
-
function P(e, t) {
|
|
179
|
-
throw Error(e[t] || e.default);
|
|
180
|
-
}
|
|
181
|
-
var F = T(P)({
|
|
182
|
-
initialIsRequired: "initial state is required",
|
|
183
|
-
initialType: "initial state should be an object",
|
|
184
|
-
initialContent: "initial state shouldn't be an empty object",
|
|
185
|
-
handlerType: "handler should be an object or a function",
|
|
186
|
-
handlersType: "all handlers should be a functions",
|
|
187
|
-
selectorType: "selector should be a function",
|
|
188
|
-
changeType: "provided value of changes should be an object",
|
|
189
|
-
changeField: "it seams you want to change a field in the state which is not specified in the \"initial\" state",
|
|
190
|
-
default: "an unknown error accured in `state-local` package"
|
|
191
|
-
}), I = {
|
|
192
|
-
changes: A,
|
|
193
|
-
selector: j,
|
|
194
|
-
handler: M,
|
|
195
|
-
initial: N
|
|
196
|
-
};
|
|
197
|
-
function L(e) {
|
|
198
|
-
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
199
|
-
I.initial(e), I.handler(t);
|
|
200
|
-
var n = { current: e }, r = T(B)(n, t), i = T(z)(n), a = T(I.changes)(e), o = T(R)(n);
|
|
201
|
-
function s() {
|
|
202
|
-
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(e) {
|
|
203
|
-
return e;
|
|
204
|
-
};
|
|
205
|
-
return I.selector(e), e(n.current);
|
|
206
|
-
}
|
|
207
|
-
function c(e) {
|
|
208
|
-
w(r, i, a, o)(e);
|
|
209
|
-
}
|
|
210
|
-
return [s, c];
|
|
211
|
-
}
|
|
212
|
-
function R(e, t) {
|
|
213
|
-
return O(t) ? t(e.current) : t;
|
|
214
|
-
}
|
|
215
|
-
function z(e, t) {
|
|
216
|
-
return e.current = C(C({}, e.current), t), t;
|
|
217
|
-
}
|
|
218
|
-
function B(e, t, n) {
|
|
219
|
-
return O(t) ? t(e.current) : Object.keys(n).forEach(function(n) {
|
|
220
|
-
return t[n]?.call(t, e.current[n]);
|
|
221
|
-
}), n;
|
|
222
|
-
}
|
|
223
|
-
var ee = { create: L }, te = { paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs" } };
|
|
224
|
-
function ne(e) {
|
|
225
|
-
return function t() {
|
|
226
|
-
var n = this, r = [...arguments];
|
|
227
|
-
return r.length >= e.length ? e.apply(this, r) : function() {
|
|
228
|
-
var e = [...arguments];
|
|
229
|
-
return t.apply(n, [].concat(r, e));
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
function re(e) {
|
|
234
|
-
return {}.toString.call(e).includes("Object");
|
|
235
|
-
}
|
|
236
|
-
function ie(e) {
|
|
237
|
-
return e || H("configIsRequired"), re(e) || H("configType"), e.urls ? (ae(), { paths: { vs: e.urls.monacoBase } }) : e;
|
|
238
|
-
}
|
|
239
|
-
function ae() {
|
|
240
|
-
console.warn(V.deprecation);
|
|
241
|
-
}
|
|
242
|
-
function oe(e, t) {
|
|
243
|
-
throw Error(e[t] || e.default);
|
|
244
|
-
}
|
|
245
|
-
var V = {
|
|
246
|
-
configIsRequired: "the configuration object is required",
|
|
247
|
-
configType: "the configuration object should be an object",
|
|
248
|
-
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
249
|
-
deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "
|
|
250
|
-
}, H = ne(oe)(V), se = { config: ie }, ce = function() {
|
|
251
|
-
var e = [...arguments];
|
|
252
|
-
return function(t) {
|
|
253
|
-
return e.reduceRight(function(e, t) {
|
|
254
|
-
return t(e);
|
|
255
|
-
}, t);
|
|
256
|
-
};
|
|
257
|
-
};
|
|
258
|
-
function U(e, t) {
|
|
259
|
-
return Object.keys(t).forEach(function(n) {
|
|
260
|
-
t[n] instanceof Object && e[n] && Object.assign(t[n], U(e[n], t[n]));
|
|
261
|
-
}), m(m({}, e), t);
|
|
262
|
-
}
|
|
263
|
-
var le = {
|
|
264
|
-
type: "cancelation",
|
|
265
|
-
msg: "operation is manually canceled"
|
|
266
|
-
};
|
|
267
|
-
function W(e) {
|
|
268
|
-
var t = !1, n = new Promise(function(n, r) {
|
|
269
|
-
e.then(function(e) {
|
|
270
|
-
return t ? r(le) : n(e);
|
|
271
|
-
}), e.catch(r);
|
|
272
|
-
});
|
|
273
|
-
return n.cancel = function() {
|
|
274
|
-
return t = !0;
|
|
275
|
-
}, n;
|
|
276
|
-
}
|
|
277
|
-
var ue = ["monaco"], G = _(ee.create({
|
|
278
|
-
config: te,
|
|
279
|
-
isInitialized: !1,
|
|
280
|
-
resolve: null,
|
|
281
|
-
reject: null,
|
|
282
|
-
monaco: null
|
|
283
|
-
}), 2), K = G[0], q = G[1];
|
|
284
|
-
function de(e) {
|
|
285
|
-
var t = se.config(e), n = t.monaco, r = h(t, ue);
|
|
286
|
-
q(function(e) {
|
|
287
|
-
return {
|
|
288
|
-
config: U(e.config, r),
|
|
289
|
-
monaco: n
|
|
290
|
-
};
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
function fe() {
|
|
294
|
-
var e = K(function(e) {
|
|
295
|
-
return {
|
|
296
|
-
monaco: e.monaco,
|
|
297
|
-
isInitialized: e.isInitialized,
|
|
298
|
-
resolve: e.resolve
|
|
299
|
-
};
|
|
300
|
-
});
|
|
301
|
-
if (!e.isInitialized) {
|
|
302
|
-
if (q({ isInitialized: !0 }), e.monaco) return e.resolve(e.monaco), W(J);
|
|
303
|
-
if (window.monaco && window.monaco.editor) return _e(window.monaco), e.resolve(window.monaco), W(J);
|
|
304
|
-
ce(pe, he)(ge);
|
|
305
|
-
}
|
|
306
|
-
return W(J);
|
|
307
|
-
}
|
|
308
|
-
function pe(e) {
|
|
309
|
-
return document.body.appendChild(e);
|
|
310
|
-
}
|
|
311
|
-
function me(e) {
|
|
312
|
-
var t = document.createElement("script");
|
|
313
|
-
return e && (t.src = e), t;
|
|
314
|
-
}
|
|
315
|
-
function he(e) {
|
|
316
|
-
var t = K(function(e) {
|
|
317
|
-
return {
|
|
318
|
-
config: e.config,
|
|
319
|
-
reject: e.reject
|
|
320
|
-
};
|
|
321
|
-
}), n = me(`${t.config.paths.vs}/loader.js`);
|
|
322
|
-
return n.onload = function() {
|
|
323
|
-
return e();
|
|
324
|
-
}, n.onerror = t.reject, n;
|
|
325
|
-
}
|
|
326
|
-
function ge() {
|
|
327
|
-
var e = K(function(e) {
|
|
328
|
-
return {
|
|
329
|
-
config: e.config,
|
|
330
|
-
resolve: e.resolve,
|
|
331
|
-
reject: e.reject
|
|
332
|
-
};
|
|
333
|
-
}), t = window.require;
|
|
334
|
-
t.config(e.config), t(["vs/editor/editor.main"], function(t) {
|
|
335
|
-
var n = t.m || t;
|
|
336
|
-
_e(n), e.resolve(n);
|
|
337
|
-
}, function(t) {
|
|
338
|
-
e.reject(t);
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
function _e(e) {
|
|
342
|
-
K().monaco || q({ monaco: e });
|
|
343
|
-
}
|
|
344
|
-
function ve() {
|
|
345
|
-
return K(function(e) {
|
|
346
|
-
return e.monaco;
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
var J = new Promise(function(e, t) {
|
|
350
|
-
return q({
|
|
351
|
-
resolve: e,
|
|
352
|
-
reject: t
|
|
353
|
-
});
|
|
354
|
-
}), ye = {
|
|
355
|
-
config: de,
|
|
356
|
-
init: fe,
|
|
357
|
-
__getMonacoInstance: ve
|
|
358
|
-
}, Y = {
|
|
359
|
-
wrapper: {
|
|
360
|
-
display: "flex",
|
|
361
|
-
position: "relative",
|
|
362
|
-
textAlign: "initial"
|
|
363
|
-
},
|
|
364
|
-
fullWidth: { width: "100%" },
|
|
365
|
-
hide: { display: "none" }
|
|
366
|
-
}, be = { container: {
|
|
367
|
-
display: "flex",
|
|
368
|
-
height: "100%",
|
|
369
|
-
width: "100%",
|
|
370
|
-
justifyContent: "center",
|
|
371
|
-
alignItems: "center"
|
|
372
|
-
} };
|
|
373
|
-
function xe({ children: e }) {
|
|
374
|
-
return n.createElement("div", { style: be.container }, e);
|
|
375
|
-
}
|
|
376
|
-
var Se = xe;
|
|
377
|
-
function Ce({ width: e, height: t, isEditorReady: r, loading: i, _ref: a, className: o, wrapperProps: s }) {
|
|
378
|
-
return n.createElement("section", {
|
|
379
|
-
style: {
|
|
380
|
-
...Y.wrapper,
|
|
381
|
-
width: e,
|
|
382
|
-
height: t
|
|
383
|
-
},
|
|
384
|
-
...s
|
|
385
|
-
}, !r && n.createElement(Se, null, i), n.createElement("div", {
|
|
386
|
-
ref: a,
|
|
387
|
-
style: {
|
|
388
|
-
...Y.fullWidth,
|
|
389
|
-
...!r && Y.hide
|
|
390
|
-
},
|
|
391
|
-
className: o
|
|
392
|
-
}));
|
|
393
|
-
}
|
|
394
|
-
var we = r(Ce);
|
|
395
|
-
function Te(e) {
|
|
396
|
-
a(e, []);
|
|
397
|
-
}
|
|
398
|
-
var Ee = Te;
|
|
399
|
-
function De(e, t, n = !0) {
|
|
400
|
-
let r = o(!0);
|
|
401
|
-
a(r.current || !n ? () => {
|
|
402
|
-
r.current = !1;
|
|
403
|
-
} : e, t);
|
|
404
|
-
}
|
|
405
|
-
var X = De;
|
|
406
|
-
function Z() {}
|
|
407
|
-
function Q(e, t, n, r) {
|
|
408
|
-
return Oe(e, r) || ke(e, t, n, r);
|
|
409
|
-
}
|
|
410
|
-
function Oe(e, t) {
|
|
411
|
-
return e.editor.getModel(Ae(e, t));
|
|
412
|
-
}
|
|
413
|
-
function ke(e, t, n, r) {
|
|
414
|
-
return e.editor.createModel(t, n, r ? Ae(e, r) : void 0);
|
|
415
|
-
}
|
|
416
|
-
function Ae(e, t) {
|
|
417
|
-
return e.Uri.parse(t);
|
|
418
|
-
}
|
|
419
|
-
function je({ original: e, modified: t, language: r, originalLanguage: c, modifiedLanguage: l, originalModelPath: u, modifiedModelPath: d, keepCurrentOriginalModel: f = !1, keepCurrentModifiedModel: p = !1, theme: m = "light", loading: h = "Loading...", options: g = {}, height: _ = "100%", width: v = "100%", className: y, wrapperProps: b = {}, beforeMount: x = Z, onMount: S = Z }) {
|
|
420
|
-
let [C, w] = s(!1), [T, E] = s(!0), D = o(null), O = o(null), k = o(null), A = o(S), j = o(x), M = o(!1);
|
|
421
|
-
Ee(() => {
|
|
422
|
-
let e = ye.init();
|
|
423
|
-
return e.then((e) => (O.current = e) && E(!1)).catch((e) => e?.type !== "cancelation" && console.error("Monaco initialization: error:", e)), () => D.current ? F() : e.cancel();
|
|
424
|
-
}), X(() => {
|
|
425
|
-
if (D.current && O.current) {
|
|
426
|
-
let t = D.current.getOriginalEditor(), n = Q(O.current, e || "", c || r || "text", u || "");
|
|
427
|
-
n !== t.getModel() && t.setModel(n);
|
|
428
|
-
}
|
|
429
|
-
}, [u], C), X(() => {
|
|
430
|
-
if (D.current && O.current) {
|
|
431
|
-
let e = D.current.getModifiedEditor(), n = Q(O.current, t || "", l || r || "text", d || "");
|
|
432
|
-
n !== e.getModel() && e.setModel(n);
|
|
433
|
-
}
|
|
434
|
-
}, [d], C), X(() => {
|
|
435
|
-
let e = D.current.getModifiedEditor();
|
|
436
|
-
e.getOption(O.current.editor.EditorOption.readOnly) ? e.setValue(t || "") : t !== e.getValue() && (e.executeEdits("", [{
|
|
437
|
-
range: e.getModel().getFullModelRange(),
|
|
438
|
-
text: t || "",
|
|
439
|
-
forceMoveMarkers: !0
|
|
440
|
-
}]), e.pushUndoStop());
|
|
441
|
-
}, [t], C), X(() => {
|
|
442
|
-
D.current?.getModel()?.original.setValue(e || "");
|
|
443
|
-
}, [e], C), X(() => {
|
|
444
|
-
let { original: e, modified: t } = D.current.getModel();
|
|
445
|
-
O.current.editor.setModelLanguage(e, c || r || "text"), O.current.editor.setModelLanguage(t, l || r || "text");
|
|
446
|
-
}, [
|
|
447
|
-
r,
|
|
448
|
-
c,
|
|
449
|
-
l
|
|
450
|
-
], C), X(() => {
|
|
451
|
-
O.current?.editor.setTheme(m);
|
|
452
|
-
}, [m], C), X(() => {
|
|
453
|
-
D.current?.updateOptions(g);
|
|
454
|
-
}, [g], C);
|
|
455
|
-
let N = i(() => {
|
|
456
|
-
if (!O.current) return;
|
|
457
|
-
j.current(O.current);
|
|
458
|
-
let n = Q(O.current, e || "", c || r || "text", u || ""), i = Q(O.current, t || "", l || r || "text", d || "");
|
|
459
|
-
D.current?.setModel({
|
|
460
|
-
original: n,
|
|
461
|
-
modified: i
|
|
462
|
-
});
|
|
463
|
-
}, [
|
|
464
|
-
r,
|
|
465
|
-
t,
|
|
466
|
-
l,
|
|
467
|
-
e,
|
|
468
|
-
c,
|
|
469
|
-
u,
|
|
470
|
-
d
|
|
471
|
-
]), P = i(() => {
|
|
472
|
-
!M.current && k.current && (D.current = O.current.editor.createDiffEditor(k.current, {
|
|
473
|
-
automaticLayout: !0,
|
|
474
|
-
...g
|
|
475
|
-
}), N(), O.current?.editor.setTheme(m), w(!0), M.current = !0);
|
|
476
|
-
}, [
|
|
477
|
-
g,
|
|
478
|
-
m,
|
|
479
|
-
N
|
|
480
|
-
]);
|
|
481
|
-
a(() => {
|
|
482
|
-
C && A.current(D.current, O.current);
|
|
483
|
-
}, [C]), a(() => {
|
|
484
|
-
!T && !C && P();
|
|
485
|
-
}, [
|
|
486
|
-
T,
|
|
487
|
-
C,
|
|
488
|
-
P
|
|
489
|
-
]);
|
|
490
|
-
function F() {
|
|
491
|
-
let e = D.current?.getModel();
|
|
492
|
-
f || e?.original?.dispose(), p || e?.modified?.dispose(), D.current?.dispose();
|
|
493
|
-
}
|
|
494
|
-
return n.createElement(we, {
|
|
495
|
-
width: v,
|
|
496
|
-
height: _,
|
|
497
|
-
isEditorReady: C,
|
|
498
|
-
loading: h,
|
|
499
|
-
_ref: k,
|
|
500
|
-
className: y,
|
|
501
|
-
wrapperProps: b
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
r(je);
|
|
505
|
-
function Me(e) {
|
|
506
|
-
let t = o();
|
|
507
|
-
return a(() => {
|
|
508
|
-
t.current = e;
|
|
509
|
-
}, [e]), t.current;
|
|
510
|
-
}
|
|
511
|
-
var Ne = Me, $ = /* @__PURE__ */ new Map();
|
|
512
|
-
function Pe({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: c, language: l, path: u, theme: d = "light", line: f, loading: p = "Loading...", options: m = {}, overrideServices: h = {}, saveViewState: g = !0, keepCurrentModel: _ = !1, width: v = "100%", height: y = "100%", className: b, wrapperProps: x = {}, beforeMount: S = Z, onMount: C = Z, onChange: w, onValidate: T = Z }) {
|
|
513
|
-
let [E, D] = s(!1), [O, k] = s(!0), A = o(null), j = o(null), M = o(null), N = o(C), P = o(S), F = o(), I = o(c), L = Ne(u), R = o(!1), z = o(!1);
|
|
514
|
-
Ee(() => {
|
|
515
|
-
let e = ye.init();
|
|
516
|
-
return e.then((e) => (A.current = e) && k(!1)).catch((e) => e?.type !== "cancelation" && console.error("Monaco initialization: error:", e)), () => j.current ? ee() : e.cancel();
|
|
517
|
-
}), X(() => {
|
|
518
|
-
let n = Q(A.current, e || c || "", t || l || "", u || r || "");
|
|
519
|
-
n !== j.current?.getModel() && (g && $.set(L, j.current?.saveViewState()), j.current?.setModel(n), g && j.current?.restoreViewState($.get(u)));
|
|
520
|
-
}, [u], E), X(() => {
|
|
521
|
-
j.current?.updateOptions(m);
|
|
522
|
-
}, [m], E), X(() => {
|
|
523
|
-
!j.current || c === void 0 || (j.current.getOption(A.current.editor.EditorOption.readOnly) ? j.current.setValue(c) : c !== j.current.getValue() && (z.current = !0, j.current.executeEdits("", [{
|
|
524
|
-
range: j.current.getModel().getFullModelRange(),
|
|
525
|
-
text: c,
|
|
526
|
-
forceMoveMarkers: !0
|
|
527
|
-
}]), j.current.pushUndoStop(), z.current = !1));
|
|
528
|
-
}, [c], E), X(() => {
|
|
529
|
-
let e = j.current?.getModel();
|
|
530
|
-
e && l && A.current?.editor.setModelLanguage(e, l);
|
|
531
|
-
}, [l], E), X(() => {
|
|
532
|
-
f !== void 0 && j.current?.revealLine(f);
|
|
533
|
-
}, [f], E), X(() => {
|
|
534
|
-
A.current?.editor.setTheme(d);
|
|
535
|
-
}, [d], E);
|
|
536
|
-
let B = i(() => {
|
|
537
|
-
if (!(!M.current || !A.current) && !R.current) {
|
|
538
|
-
P.current(A.current);
|
|
539
|
-
let n = u || r, i = Q(A.current, c || e || "", t || l || "", n || "");
|
|
540
|
-
j.current = A.current?.editor.create(M.current, {
|
|
541
|
-
model: i,
|
|
542
|
-
automaticLayout: !0,
|
|
543
|
-
...m
|
|
544
|
-
}, h), g && j.current.restoreViewState($.get(n)), A.current.editor.setTheme(d), f !== void 0 && j.current.revealLine(f), D(!0), R.current = !0;
|
|
545
|
-
}
|
|
546
|
-
}, [
|
|
547
|
-
e,
|
|
548
|
-
t,
|
|
549
|
-
r,
|
|
550
|
-
c,
|
|
551
|
-
l,
|
|
552
|
-
u,
|
|
553
|
-
m,
|
|
554
|
-
h,
|
|
555
|
-
g,
|
|
556
|
-
d,
|
|
557
|
-
f
|
|
558
|
-
]);
|
|
559
|
-
a(() => {
|
|
560
|
-
E && N.current(j.current, A.current);
|
|
561
|
-
}, [E]), a(() => {
|
|
562
|
-
!O && !E && B();
|
|
563
|
-
}, [
|
|
564
|
-
O,
|
|
565
|
-
E,
|
|
566
|
-
B
|
|
567
|
-
]), I.current = c, a(() => {
|
|
568
|
-
E && w && (F.current?.dispose(), F.current = j.current?.onDidChangeModelContent((e) => {
|
|
569
|
-
z.current || w(j.current.getValue(), e);
|
|
570
|
-
}));
|
|
571
|
-
}, [E, w]), a(() => {
|
|
572
|
-
if (E) {
|
|
573
|
-
let e = A.current.editor.onDidChangeMarkers((e) => {
|
|
574
|
-
let t = j.current.getModel()?.uri;
|
|
575
|
-
if (t && e.find((e) => e.path === t.path)) {
|
|
576
|
-
let e = A.current.editor.getModelMarkers({ resource: t });
|
|
577
|
-
T?.(e);
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
return () => {
|
|
581
|
-
e?.dispose();
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
return () => {};
|
|
585
|
-
}, [E, T]);
|
|
586
|
-
function ee() {
|
|
587
|
-
F.current?.dispose(), _ ? g && $.set(u, j.current.saveViewState()) : j.current.getModel()?.dispose(), j.current.dispose();
|
|
588
|
-
}
|
|
589
|
-
return n.createElement(we, {
|
|
590
|
-
width: v,
|
|
591
|
-
height: y,
|
|
592
|
-
isEditorReady: E,
|
|
593
|
-
loading: p,
|
|
594
|
-
_ref: M,
|
|
595
|
-
className: b,
|
|
596
|
-
wrapperProps: x
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
var Fe = r(Pe), Ie = {
|
|
600
|
-
[t.dark]: {
|
|
601
|
-
base: "vs-dark",
|
|
602
|
-
inherit: !1,
|
|
603
|
-
rules: [
|
|
604
|
-
{
|
|
605
|
-
token: "string.key.json",
|
|
606
|
-
foreground: "#37BABC"
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
token: "string.value.json",
|
|
610
|
-
foreground: "#5C8DEA"
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
token: "number",
|
|
614
|
-
foreground: "#D97C27"
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
token: "keyword.json",
|
|
618
|
-
foreground: "#F4CE46"
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
token: "delimiter",
|
|
622
|
-
foreground: "#EEF1F7"
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
token: "delimiter.bracket.json",
|
|
626
|
-
foreground: "#A972FF"
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
token: "delimiter.parenthesis",
|
|
630
|
-
foreground: "#A972FF"
|
|
631
|
-
}
|
|
632
|
-
],
|
|
633
|
-
colors: {
|
|
634
|
-
"editor.foreground": "#F76464",
|
|
635
|
-
"editor.background": "#161B2D",
|
|
636
|
-
"editorCursor.foreground": "#EEF1F7",
|
|
637
|
-
"editor.selectionBackground": "#5C8DEA2B",
|
|
638
|
-
"editorLineNumber.foreground": "#242C42",
|
|
639
|
-
"scrollbarSlider.background": "#242C42",
|
|
640
|
-
"scrollbarSlider.hoverBackground": "#242C42",
|
|
641
|
-
"scrollbarSlider.activeBackground": "#242C42"
|
|
642
|
-
}
|
|
643
|
-
},
|
|
644
|
-
[t.light]: {
|
|
645
|
-
base: "vs",
|
|
646
|
-
inherit: !1,
|
|
647
|
-
rules: [
|
|
648
|
-
{
|
|
649
|
-
token: "string.key.json",
|
|
650
|
-
foreground: "#009D9F"
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
token: "string.value.json",
|
|
654
|
-
foreground: "#2764D9"
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
token: "number",
|
|
658
|
-
foreground: "#B25500"
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
token: "keyword.json",
|
|
662
|
-
foreground: "#3F3D25"
|
|
663
|
-
},
|
|
664
|
-
{
|
|
665
|
-
token: "delimiter",
|
|
666
|
-
foreground: "#161B2D"
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
token: "delimiter.bracket.json",
|
|
670
|
-
foreground: "#7E39EC"
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
token: "delimiter.parenthesis",
|
|
674
|
-
foreground: "#7E39EC"
|
|
675
|
-
}
|
|
676
|
-
],
|
|
677
|
-
colors: {
|
|
678
|
-
"editor.foreground": "#AE2F2F",
|
|
679
|
-
"editor.background": "#EEF1F7",
|
|
680
|
-
"editorCursor.foreground": "#161B2D",
|
|
681
|
-
"editor.selectionBackground": "#5C8DEA2B",
|
|
682
|
-
"editorLineNumber.foreground": "#242C42",
|
|
683
|
-
"scrollbarSlider.background": "#242C42",
|
|
684
|
-
"scrollbarSlider.hoverBackground": "#242C42",
|
|
685
|
-
"scrollbarSlider.activeBackground": "#242C42"
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}, Le = ({ value: t, onChange: n, onValidateJSON: r, options: i, currentTheme: a, themesConfig: o = Ie }) => {
|
|
689
|
-
function s(e) {
|
|
690
|
-
e?.editor?.defineTheme(a, o[a]), e.languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
691
|
-
validate: !0,
|
|
692
|
-
enableSchemaRequest: !1,
|
|
693
|
-
schemas: [{
|
|
694
|
-
uri: "http://custom-schema/object-required.json",
|
|
695
|
-
fileMatch: ["*"],
|
|
696
|
-
schema: {
|
|
697
|
-
type: "object",
|
|
698
|
-
description: "Top-level value must be an object",
|
|
699
|
-
additionalProperties: !0
|
|
700
|
-
}
|
|
701
|
-
}]
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
return /* @__PURE__ */ e.jsx(Fe, {
|
|
705
|
-
beforeMount: s,
|
|
706
|
-
height: "100%",
|
|
707
|
-
defaultLanguage: "json",
|
|
708
|
-
value: t,
|
|
709
|
-
onChange: n,
|
|
710
|
-
theme: a,
|
|
711
|
-
onValidate: r,
|
|
712
|
-
options: {
|
|
713
|
-
minimap: { enabled: !1 },
|
|
714
|
-
formatOnType: !0,
|
|
715
|
-
formatOnPaste: !0,
|
|
716
|
-
selectOnLineNumbers: !1,
|
|
717
|
-
automaticLayout: !0,
|
|
718
|
-
scrollBeyondLastLine: !1,
|
|
719
|
-
wordWrap: "on",
|
|
720
|
-
smoothScrolling: !0,
|
|
721
|
-
overviewRulerLanes: 0,
|
|
722
|
-
scrollbar: {
|
|
723
|
-
horizontal: "hidden",
|
|
724
|
-
verticalScrollbarSize: 4,
|
|
725
|
-
verticalSliderSize: 4
|
|
726
|
-
},
|
|
727
|
-
...i ?? {}
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
};
|
|
731
|
-
//#endregion
|
|
732
|
-
export { Le as DialJsonEditor };
|