@object-ui/plugin-editor 3.1.3 → 3.1.5

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.
@@ -1,18 +1,24 @@
1
1
 
2
- > @object-ui/plugin-editor@3.1.3 build /home/runner/work/objectui/objectui/packages/plugin-editor
2
+ > @object-ui/plugin-editor@3.1.5 build /home/runner/work/objectui/objectui/packages/plugin-editor
3
3
  > vite build
4
4
 
5
- vite v7.3.1 building client environment for production...
6
- transforming...
7
- ✓ 23 modules transformed.
5
+ vite v8.0.1 building client environment for production...
6
+ 
8
7
  rendering chunks...
9
8
  
10
9
  [vite:dts] Start generate declaration files...
10
+ [vite:dts] Declaration files built in 12281ms.
11
+ 
11
12
  computing gzip size...
12
- dist/index.js  0.19 kB │ gzip: 0.15 kB
13
- dist/index-CuYbY6xb.js 10.34 kB │ gzip: 3.36 kB
14
- dist/MonacoImpl-hfdmoz6k.js 18.58 kB │ gzip: 5.71 kB
15
- [vite:dts] Declaration files built in 20051ms.
13
+ dist/index.js 1.65 kB │ gzip: 0.74 kB
14
+ dist/jsx-runtime-HjdTyiyb.js 7.81 kB │ gzip: 2.84 kB
15
+ dist/MonacoImpl-BMgw4JKF.js 18.40 kB │ gzip: 5.69 kB
16
+
17
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `vite:dts`. See https://rolldown.rs/options/checks#plugintimings for more details.
16
18
  
17
- dist/index.umd.cjs 22.22 kB │ gzip: 7.94 kB
18
- ✓ built in 23.23s
19
+ 
20
+ rendering chunks...
21
+ computing gzip size...
22
+ dist/index.umd.cjs 22.90 kB │ gzip: 8.06 kB
23
+
24
+ ✓ built in 13.06s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @object-ui/plugin-editor
2
2
 
3
+ ## 3.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/react@3.1.5
8
+ - @object-ui/components@3.1.5
9
+ - @object-ui/types@3.1.5
10
+ - @object-ui/core@3.1.5
11
+
12
+ ## 3.1.4
13
+
14
+ ### Patch Changes
15
+
16
+ - @object-ui/types@3.1.4
17
+ - @object-ui/core@3.1.4
18
+ - @object-ui/react@3.1.4
19
+ - @object-ui/components@3.1.4
20
+
3
21
  ## 3.1.3
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,635 @@
1
+ import { t as e } from "./jsx-runtime-HjdTyiyb.js";
2
+ import t, { memo as n, useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
3
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/_virtual/_rollupPluginBabelHelpers.js
4
+ function s(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 c(e) {
10
+ if (Array.isArray(e)) return e;
11
+ }
12
+ function l(e, t, n) {
13
+ return (t = v(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 u(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 d() {
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 f(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 p(e) {
52
+ for (var t = 1; t < arguments.length; t++) {
53
+ var n = arguments[t] == null ? {} : arguments[t];
54
+ t % 2 ? f(Object(n), !0).forEach(function(t) {
55
+ l(e, t, n[t]);
56
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : f(Object(n)).forEach(function(t) {
57
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
58
+ });
59
+ }
60
+ return e;
61
+ }
62
+ function m(e, t) {
63
+ if (e == null) return {};
64
+ var n, r, i = h(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 h(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 g(e, t) {
81
+ return c(e) || u(e, t) || y(e, t) || d();
82
+ }
83
+ function _(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 v(e) {
94
+ var t = _(e, "string");
95
+ return typeof t == "symbol" ? t : t + "";
96
+ }
97
+ function y(e, t) {
98
+ if (e) {
99
+ if (typeof e == "string") return s(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) ? s(e, t) : void 0;
102
+ }
103
+ }
104
+ //#endregion
105
+ //#region ../../node_modules/.pnpm/state-local@1.0.7/node_modules/state-local/lib/es/state-local.js
106
+ function b(e, t, n) {
107
+ return t in e ? Object.defineProperty(e, t, {
108
+ value: n,
109
+ enumerable: !0,
110
+ configurable: !0,
111
+ writable: !0
112
+ }) : e[t] = n, e;
113
+ }
114
+ function x(e, t) {
115
+ var n = Object.keys(e);
116
+ if (Object.getOwnPropertySymbols) {
117
+ var r = Object.getOwnPropertySymbols(e);
118
+ t && (r = r.filter(function(t) {
119
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
120
+ })), n.push.apply(n, r);
121
+ }
122
+ return n;
123
+ }
124
+ function S(e) {
125
+ for (var t = 1; t < arguments.length; t++) {
126
+ var n = arguments[t] == null ? {} : arguments[t];
127
+ t % 2 ? x(Object(n), !0).forEach(function(t) {
128
+ b(e, t, n[t]);
129
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : x(Object(n)).forEach(function(t) {
130
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
131
+ });
132
+ }
133
+ return e;
134
+ }
135
+ function C() {
136
+ var e = [...arguments];
137
+ return function(t) {
138
+ return e.reduceRight(function(e, t) {
139
+ return t(e);
140
+ }, t);
141
+ };
142
+ }
143
+ function w(e) {
144
+ return function t() {
145
+ var n = this, r = [...arguments];
146
+ return r.length >= e.length ? e.apply(this, r) : function() {
147
+ var e = [...arguments];
148
+ return t.apply(n, [].concat(r, e));
149
+ };
150
+ };
151
+ }
152
+ function T(e) {
153
+ return {}.toString.call(e).includes("Object");
154
+ }
155
+ function E(e) {
156
+ return !Object.keys(e).length;
157
+ }
158
+ function D(e) {
159
+ return typeof e == "function";
160
+ }
161
+ function O(e, t) {
162
+ return Object.prototype.hasOwnProperty.call(e, t);
163
+ }
164
+ function k(e, t) {
165
+ return T(t) || P("changeType"), Object.keys(t).some(function(t) {
166
+ return !O(e, t);
167
+ }) && P("changeField"), t;
168
+ }
169
+ function A(e) {
170
+ D(e) || P("selectorType");
171
+ }
172
+ function j(e) {
173
+ D(e) || T(e) || P("handlerType"), T(e) && Object.values(e).some(function(e) {
174
+ return !D(e);
175
+ }) && P("handlersType");
176
+ }
177
+ function M(e) {
178
+ e || P("initialIsRequired"), T(e) || P("initialType"), E(e) && P("initialContent");
179
+ }
180
+ function N(e, t) {
181
+ throw Error(e[t] || e.default);
182
+ }
183
+ var P = w(N)({
184
+ initialIsRequired: "initial state is required",
185
+ initialType: "initial state should be an object",
186
+ initialContent: "initial state shouldn't be an empty object",
187
+ handlerType: "handler should be an object or a function",
188
+ handlersType: "all handlers should be a functions",
189
+ selectorType: "selector should be a function",
190
+ changeType: "provided value of changes should be an object",
191
+ changeField: "it seams you want to change a field in the state which is not specified in the \"initial\" state",
192
+ default: "an unknown error accured in `state-local` package"
193
+ }), F = {
194
+ changes: k,
195
+ selector: A,
196
+ handler: j,
197
+ initial: M
198
+ };
199
+ function I(e) {
200
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
201
+ F.initial(e), F.handler(t);
202
+ var n = { current: e }, r = w(R)(n, t), i = w(L)(n), a = w(F.changes)(e), o = w(ee)(n);
203
+ function s() {
204
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(e) {
205
+ return e;
206
+ };
207
+ return F.selector(e), e(n.current);
208
+ }
209
+ function c(e) {
210
+ C(r, i, a, o)(e);
211
+ }
212
+ return [s, c];
213
+ }
214
+ function ee(e, t) {
215
+ return D(t) ? t(e.current) : t;
216
+ }
217
+ function L(e, t) {
218
+ return e.current = S(S({}, e.current), t), t;
219
+ }
220
+ function R(e, t, n) {
221
+ return D(t) ? t(e.current) : Object.keys(n).forEach(function(n) {
222
+ return t[n]?.call(t, e.current[n]);
223
+ }), n;
224
+ }
225
+ var z = { create: I }, B = { paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs" } };
226
+ //#endregion
227
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/utils/curry.js
228
+ function te(e) {
229
+ return function t() {
230
+ var n = this, r = [...arguments];
231
+ return r.length >= e.length ? e.apply(this, r) : function() {
232
+ var e = [...arguments];
233
+ return t.apply(n, [].concat(r, e));
234
+ };
235
+ };
236
+ }
237
+ //#endregion
238
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/utils/isObject.js
239
+ function ne(e) {
240
+ return {}.toString.call(e).includes("Object");
241
+ }
242
+ //#endregion
243
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/validators/index.js
244
+ function re(e) {
245
+ return e || V("configIsRequired"), ne(e) || V("configType"), e.urls ? (ie(), { paths: { vs: e.urls.monacoBase } }) : e;
246
+ }
247
+ function ie() {
248
+ console.warn(oe.deprecation);
249
+ }
250
+ function ae(e, t) {
251
+ throw Error(e[t] || e.default);
252
+ }
253
+ var oe = {
254
+ configIsRequired: "the configuration object is required",
255
+ configType: "the configuration object should be an object",
256
+ default: "an unknown error accured in `@monaco-editor/loader` package",
257
+ 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 "
258
+ }, V = te(ae)(oe), se = { config: re }, ce = function() {
259
+ var e = [...arguments];
260
+ return function(t) {
261
+ return e.reduceRight(function(e, t) {
262
+ return t(e);
263
+ }, t);
264
+ };
265
+ };
266
+ //#endregion
267
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/utils/deepMerge.js
268
+ function H(e, t) {
269
+ return Object.keys(t).forEach(function(n) {
270
+ t[n] instanceof Object && e[n] && Object.assign(t[n], H(e[n], t[n]));
271
+ }), p(p({}, e), t);
272
+ }
273
+ //#endregion
274
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/utils/makeCancelable.js
275
+ var le = {
276
+ type: "cancelation",
277
+ msg: "operation is manually canceled"
278
+ };
279
+ function U(e) {
280
+ var t = !1, n = new Promise(function(n, r) {
281
+ e.then(function(e) {
282
+ return t ? r(le) : n(e);
283
+ }), e.catch(r);
284
+ });
285
+ return n.cancel = function() {
286
+ return t = !0;
287
+ }, n;
288
+ }
289
+ //#endregion
290
+ //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/loader/index.js
291
+ var ue = ["monaco"], W = g(z.create({
292
+ config: B,
293
+ isInitialized: !1,
294
+ resolve: null,
295
+ reject: null,
296
+ monaco: null
297
+ }), 2), G = W[0], K = W[1];
298
+ function de(e) {
299
+ var t = se.config(e), n = t.monaco, r = m(t, ue);
300
+ K(function(e) {
301
+ return {
302
+ config: H(e.config, r),
303
+ monaco: n
304
+ };
305
+ });
306
+ }
307
+ function fe() {
308
+ var e = G(function(e) {
309
+ return {
310
+ monaco: e.monaco,
311
+ isInitialized: e.isInitialized,
312
+ resolve: e.resolve
313
+ };
314
+ });
315
+ if (!e.isInitialized) {
316
+ if (K({ isInitialized: !0 }), e.monaco) return e.resolve(e.monaco), U(q);
317
+ if (window.monaco && window.monaco.editor) return _e(window.monaco), e.resolve(window.monaco), U(q);
318
+ ce(pe, he)(ge);
319
+ }
320
+ return U(q);
321
+ }
322
+ function pe(e) {
323
+ return document.body.appendChild(e);
324
+ }
325
+ function me(e) {
326
+ var t = document.createElement("script");
327
+ return e && (t.src = e), t;
328
+ }
329
+ function he(e) {
330
+ var t = G(function(e) {
331
+ return {
332
+ config: e.config,
333
+ reject: e.reject
334
+ };
335
+ }), n = me(`${t.config.paths.vs}/loader.js`);
336
+ return n.onload = function() {
337
+ return e();
338
+ }, n.onerror = t.reject, n;
339
+ }
340
+ function ge() {
341
+ var e = G(function(e) {
342
+ return {
343
+ config: e.config,
344
+ resolve: e.resolve,
345
+ reject: e.reject
346
+ };
347
+ }), t = window.require;
348
+ t.config(e.config), t(["vs/editor/editor.main"], function(t) {
349
+ var n = t.m || t;
350
+ _e(n), e.resolve(n);
351
+ }, function(t) {
352
+ e.reject(t);
353
+ });
354
+ }
355
+ function _e(e) {
356
+ G().monaco || K({ monaco: e });
357
+ }
358
+ function ve() {
359
+ return G(function(e) {
360
+ return e.monaco;
361
+ });
362
+ }
363
+ var q = new Promise(function(e, t) {
364
+ return K({
365
+ resolve: e,
366
+ reject: t
367
+ });
368
+ }), ye = {
369
+ config: de,
370
+ init: fe,
371
+ __getMonacoInstance: ve
372
+ }, J = {
373
+ wrapper: {
374
+ display: "flex",
375
+ position: "relative",
376
+ textAlign: "initial"
377
+ },
378
+ fullWidth: { width: "100%" },
379
+ hide: { display: "none" }
380
+ }, be = { container: {
381
+ display: "flex",
382
+ height: "100%",
383
+ width: "100%",
384
+ justifyContent: "center",
385
+ alignItems: "center"
386
+ } };
387
+ function xe({ children: e }) {
388
+ return t.createElement("div", { style: be.container }, e);
389
+ }
390
+ var Se = xe;
391
+ function Ce({ width: e, height: n, isEditorReady: r, loading: i, _ref: a, className: o, wrapperProps: s }) {
392
+ return t.createElement("section", {
393
+ style: {
394
+ ...J.wrapper,
395
+ width: e,
396
+ height: n
397
+ },
398
+ ...s
399
+ }, !r && t.createElement(Se, null, i), t.createElement("div", {
400
+ ref: a,
401
+ style: {
402
+ ...J.fullWidth,
403
+ ...!r && J.hide
404
+ },
405
+ className: o
406
+ }));
407
+ }
408
+ var we = n(Ce);
409
+ function Te(e) {
410
+ i(e, []);
411
+ }
412
+ var Ee = Te;
413
+ function De(e, t, n = !0) {
414
+ let r = a(!0);
415
+ i(r.current || !n ? () => {
416
+ r.current = !1;
417
+ } : e, t);
418
+ }
419
+ var Y = De;
420
+ function X() {}
421
+ function Z(e, t, n, r) {
422
+ return Oe(e, r) || ke(e, t, n, r);
423
+ }
424
+ function Oe(e, t) {
425
+ return e.editor.getModel(Ae(e, t));
426
+ }
427
+ function ke(e, t, n, r) {
428
+ return e.editor.createModel(t, n, r ? Ae(e, r) : void 0);
429
+ }
430
+ function Ae(e, t) {
431
+ return e.Uri.parse(t);
432
+ }
433
+ function je({ original: e, modified: n, language: s, 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 = X, onMount: S = X }) {
434
+ let [C, w] = o(!1), [T, E] = o(!0), D = a(null), O = a(null), k = a(null), A = a(S), j = a(x), M = a(!1);
435
+ Ee(() => {
436
+ let e = ye.init();
437
+ 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();
438
+ }), Y(() => {
439
+ if (D.current && O.current) {
440
+ let t = D.current.getOriginalEditor(), n = Z(O.current, e || "", c || s || "text", u || "");
441
+ n !== t.getModel() && t.setModel(n);
442
+ }
443
+ }, [u], C), Y(() => {
444
+ if (D.current && O.current) {
445
+ let e = D.current.getModifiedEditor(), t = Z(O.current, n || "", l || s || "text", d || "");
446
+ t !== e.getModel() && e.setModel(t);
447
+ }
448
+ }, [d], C), Y(() => {
449
+ let e = D.current.getModifiedEditor();
450
+ e.getOption(O.current.editor.EditorOption.readOnly) ? e.setValue(n || "") : n !== e.getValue() && (e.executeEdits("", [{
451
+ range: e.getModel().getFullModelRange(),
452
+ text: n || "",
453
+ forceMoveMarkers: !0
454
+ }]), e.pushUndoStop());
455
+ }, [n], C), Y(() => {
456
+ D.current?.getModel()?.original.setValue(e || "");
457
+ }, [e], C), Y(() => {
458
+ let { original: e, modified: t } = D.current.getModel();
459
+ O.current.editor.setModelLanguage(e, c || s || "text"), O.current.editor.setModelLanguage(t, l || s || "text");
460
+ }, [
461
+ s,
462
+ c,
463
+ l
464
+ ], C), Y(() => {
465
+ O.current?.editor.setTheme(m);
466
+ }, [m], C), Y(() => {
467
+ D.current?.updateOptions(g);
468
+ }, [g], C);
469
+ let N = r(() => {
470
+ if (!O.current) return;
471
+ j.current(O.current);
472
+ let t = Z(O.current, e || "", c || s || "text", u || ""), r = Z(O.current, n || "", l || s || "text", d || "");
473
+ D.current?.setModel({
474
+ original: t,
475
+ modified: r
476
+ });
477
+ }, [
478
+ s,
479
+ n,
480
+ l,
481
+ e,
482
+ c,
483
+ u,
484
+ d
485
+ ]), P = r(() => {
486
+ !M.current && k.current && (D.current = O.current.editor.createDiffEditor(k.current, {
487
+ automaticLayout: !0,
488
+ ...g
489
+ }), N(), O.current?.editor.setTheme(m), w(!0), M.current = !0);
490
+ }, [
491
+ g,
492
+ m,
493
+ N
494
+ ]);
495
+ i(() => {
496
+ C && A.current(D.current, O.current);
497
+ }, [C]), i(() => {
498
+ !T && !C && P();
499
+ }, [
500
+ T,
501
+ C,
502
+ P
503
+ ]);
504
+ function F() {
505
+ let e = D.current?.getModel();
506
+ f || e?.original?.dispose(), p || e?.modified?.dispose(), D.current?.dispose();
507
+ }
508
+ return t.createElement(we, {
509
+ width: v,
510
+ height: _,
511
+ isEditorReady: C,
512
+ loading: h,
513
+ _ref: k,
514
+ className: y,
515
+ wrapperProps: b
516
+ });
517
+ }
518
+ n(je);
519
+ function Me(e) {
520
+ let t = a();
521
+ return i(() => {
522
+ t.current = e;
523
+ }, [e]), t.current;
524
+ }
525
+ var Ne = Me, Q = /* @__PURE__ */ new Map();
526
+ function Pe({ defaultValue: e, defaultLanguage: n, defaultPath: s, 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 = X, onMount: C = X, onChange: w, onValidate: T = X }) {
527
+ let [E, D] = o(!1), [O, k] = o(!0), A = a(null), j = a(null), M = a(null), N = a(C), P = a(S), F = a(), I = a(c), ee = Ne(u), L = a(!1), R = a(!1);
528
+ Ee(() => {
529
+ let e = ye.init();
530
+ return e.then((e) => (A.current = e) && k(!1)).catch((e) => e?.type !== "cancelation" && console.error("Monaco initialization: error:", e)), () => j.current ? B() : e.cancel();
531
+ }), Y(() => {
532
+ let t = Z(A.current, e || c || "", n || l || "", u || s || "");
533
+ t !== j.current?.getModel() && (g && Q.set(ee, j.current?.saveViewState()), j.current?.setModel(t), g && j.current?.restoreViewState(Q.get(u)));
534
+ }, [u], E), Y(() => {
535
+ j.current?.updateOptions(m);
536
+ }, [m], E), Y(() => {
537
+ !j.current || c === void 0 || (j.current.getOption(A.current.editor.EditorOption.readOnly) ? j.current.setValue(c) : c !== j.current.getValue() && (R.current = !0, j.current.executeEdits("", [{
538
+ range: j.current.getModel().getFullModelRange(),
539
+ text: c,
540
+ forceMoveMarkers: !0
541
+ }]), j.current.pushUndoStop(), R.current = !1));
542
+ }, [c], E), Y(() => {
543
+ let e = j.current?.getModel();
544
+ e && l && A.current?.editor.setModelLanguage(e, l);
545
+ }, [l], E), Y(() => {
546
+ f !== void 0 && j.current?.revealLine(f);
547
+ }, [f], E), Y(() => {
548
+ A.current?.editor.setTheme(d);
549
+ }, [d], E);
550
+ let z = r(() => {
551
+ if (!(!M.current || !A.current) && !L.current) {
552
+ P.current(A.current);
553
+ let t = u || s, r = Z(A.current, c || e || "", n || l || "", t || "");
554
+ j.current = A.current?.editor.create(M.current, {
555
+ model: r,
556
+ automaticLayout: !0,
557
+ ...m
558
+ }, h), g && j.current.restoreViewState(Q.get(t)), A.current.editor.setTheme(d), f !== void 0 && j.current.revealLine(f), D(!0), L.current = !0;
559
+ }
560
+ }, [
561
+ e,
562
+ n,
563
+ s,
564
+ c,
565
+ l,
566
+ u,
567
+ m,
568
+ h,
569
+ g,
570
+ d,
571
+ f
572
+ ]);
573
+ i(() => {
574
+ E && N.current(j.current, A.current);
575
+ }, [E]), i(() => {
576
+ !O && !E && z();
577
+ }, [
578
+ O,
579
+ E,
580
+ z
581
+ ]), I.current = c, i(() => {
582
+ E && w && (F.current?.dispose(), F.current = j.current?.onDidChangeModelContent((e) => {
583
+ R.current || w(j.current.getValue(), e);
584
+ }));
585
+ }, [E, w]), i(() => {
586
+ if (E) {
587
+ let e = A.current.editor.onDidChangeMarkers((e) => {
588
+ let t = j.current.getModel()?.uri;
589
+ if (t && e.find((e) => e.path === t.path)) {
590
+ let e = A.current.editor.getModelMarkers({ resource: t });
591
+ T?.(e);
592
+ }
593
+ });
594
+ return () => {
595
+ e?.dispose();
596
+ };
597
+ }
598
+ return () => {};
599
+ }, [E, T]);
600
+ function B() {
601
+ F.current?.dispose(), _ ? g && Q.set(u, j.current.saveViewState()) : j.current.getModel()?.dispose(), j.current.dispose();
602
+ }
603
+ return t.createElement(we, {
604
+ width: v,
605
+ height: y,
606
+ isEditorReady: E,
607
+ loading: p,
608
+ _ref: M,
609
+ className: b,
610
+ wrapperProps: x
611
+ });
612
+ }
613
+ var Fe = n(Pe), $ = e();
614
+ function Ie({ value: e = "", language: t = "javascript", theme: n = "vs-dark", height: r = "400px", onChange: i, readOnly: a = !1, className: o = "" }) {
615
+ return /* @__PURE__ */ (0, $.jsx)("div", {
616
+ className: o,
617
+ children: /* @__PURE__ */ (0, $.jsx)(Fe, {
618
+ height: r,
619
+ language: t,
620
+ theme: n,
621
+ value: e,
622
+ onChange: i,
623
+ options: {
624
+ readOnly: a,
625
+ minimap: { enabled: !1 },
626
+ fontSize: 14,
627
+ lineNumbers: "on",
628
+ scrollBeyondLastLine: !1,
629
+ automaticLayout: !0
630
+ }
631
+ })
632
+ });
633
+ }
634
+ //#endregion
635
+ export { Ie as default };