@harnessio/yaml-editor 0.16.0-react18.alpha.4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,14 +1,46 @@
1
- var ie = Object.defineProperty;
2
- var ce = (t, e, n) => e in t ? ie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var J = (t, e, n) => (ce(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- import le, { useState as _, useEffect as w, useRef as P, useMemo as T, useCallback as q, createContext as ue, useContext as de } from "react";
5
- import Z, { loader as A, useMonaco as U, DiffEditor as me } from "@monaco-editor/react";
6
- import * as L from "monaco-editor";
7
- import { languages as H, Uri as fe } from "monaco-editor";
8
- import { yamlDefaults as he } from "monaco-yaml";
9
- var X = { exports: {} }, B = {};
10
- /**
11
- * @license React
1
+ var Ye = Object.defineProperty;
2
+ var Ze = (e, t, r) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var Se = (e, t, r) => (Ze(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import W, { memo as ye, useState as A, useRef as y, useCallback as G, useEffect as $, useMemo as q, createContext as Ge, useContext as Je } from "react";
5
+ import * as F from "monaco-editor";
6
+ import { languages as he, Uri as Qe } from "monaco-editor";
7
+ import { yamlDefaults as Xe } from "monaco-yaml";
8
+ var Ne = { exports: {} }, ne = {};
9
+ /*
10
+ object-assign
11
+ (c) Sindre Sorhus
12
+ @license MIT
13
+ */
14
+ var Me = Object.getOwnPropertySymbols, et = Object.prototype.hasOwnProperty, tt = Object.prototype.propertyIsEnumerable;
15
+ function rt(e) {
16
+ if (e == null)
17
+ throw new TypeError("Object.assign cannot be called with null or undefined");
18
+ return Object(e);
19
+ }
20
+ function nt() {
21
+ try {
22
+ if (!Object.assign)
23
+ return !1;
24
+ var e = new String("abc");
25
+ if (e[5] = "de", Object.getOwnPropertyNames(e)[0] === "5")
26
+ return !1;
27
+ for (var t = {}, r = 0; r < 10; r++)
28
+ t["_" + String.fromCharCode(r)] = r;
29
+ var n = Object.getOwnPropertyNames(t).map(function(a) {
30
+ return t[a];
31
+ });
32
+ if (n.join("") !== "0123456789")
33
+ return !1;
34
+ var o = {};
35
+ return "abcdefghijklmnopqrst".split("").forEach(function(a) {
36
+ o[a] = a;
37
+ }), Object.keys(Object.assign({}, o)).join("") === "abcdefghijklmnopqrst";
38
+ } catch {
39
+ return !1;
40
+ }
41
+ }
42
+ nt();
43
+ /** @license React v17.0.2
12
44
  * react-jsx-runtime.production.min.js
13
45
  *
14
46
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -16,23 +48,588 @@ var X = { exports: {} }, B = {};
16
48
  * This source code is licensed under the MIT license found in the
17
49
  * LICENSE file in the root directory of this source tree.
18
50
  */
19
- var pe = le, ge = Symbol.for("react.element"), ye = Symbol.for("react.fragment"), ve = Object.prototype.hasOwnProperty, be = pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Se = { key: !0, ref: !0, __self: !0, __source: !0 };
20
- function ee(t, e, n) {
21
- var r, a = {}, o = null, s = null;
22
- n !== void 0 && (o = "" + n), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
23
- for (r in e)
24
- ve.call(e, r) && !Se.hasOwnProperty(r) && (a[r] = e[r]);
25
- if (t && t.defaultProps)
26
- for (r in e = t.defaultProps, e)
27
- a[r] === void 0 && (a[r] = e[r]);
28
- return { $$typeof: ge, type: t, key: o, ref: s, props: a, _owner: be.current };
29
- }
30
- B.Fragment = ye;
31
- B.jsx = ee;
32
- B.jsxs = ee;
33
- X.exports = B;
34
- var k = X.exports;
35
- const z = {
51
+ var ot = W, De = 60103;
52
+ ne.Fragment = 60107;
53
+ if (typeof Symbol == "function" && Symbol.for) {
54
+ var je = Symbol.for;
55
+ De = je("react.element"), ne.Fragment = je("react.fragment");
56
+ }
57
+ var at = ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, it = Object.prototype.hasOwnProperty, ct = { key: !0, ref: !0, __self: !0, __source: !0 };
58
+ function Te(e, t, r) {
59
+ var n, o = {}, a = null, i = null;
60
+ r !== void 0 && (a = "" + r), t.key !== void 0 && (a = "" + t.key), t.ref !== void 0 && (i = t.ref);
61
+ for (n in t)
62
+ it.call(t, n) && !ct.hasOwnProperty(n) && (o[n] = t[n]);
63
+ if (e && e.defaultProps)
64
+ for (n in t = e.defaultProps, t)
65
+ o[n] === void 0 && (o[n] = t[n]);
66
+ return { $$typeof: De, type: e, key: a, ref: i, props: o, _owner: at.current };
67
+ }
68
+ ne.jsx = Te;
69
+ ne.jsxs = Te;
70
+ Ne.exports = ne;
71
+ var U = Ne.exports;
72
+ function ut(e, t, r) {
73
+ return t in e ? Object.defineProperty(e, t, {
74
+ value: r,
75
+ enumerable: !0,
76
+ configurable: !0,
77
+ writable: !0
78
+ }) : e[t] = r, e;
79
+ }
80
+ function Ee(e, t) {
81
+ var r = Object.keys(e);
82
+ if (Object.getOwnPropertySymbols) {
83
+ var n = Object.getOwnPropertySymbols(e);
84
+ t && (n = n.filter(function(o) {
85
+ return Object.getOwnPropertyDescriptor(e, o).enumerable;
86
+ })), r.push.apply(r, n);
87
+ }
88
+ return r;
89
+ }
90
+ function Pe(e) {
91
+ for (var t = 1; t < arguments.length; t++) {
92
+ var r = arguments[t] != null ? arguments[t] : {};
93
+ t % 2 ? Ee(Object(r), !0).forEach(function(n) {
94
+ ut(e, n, r[n]);
95
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ee(Object(r)).forEach(function(n) {
96
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
97
+ });
98
+ }
99
+ return e;
100
+ }
101
+ function st(e, t) {
102
+ if (e == null)
103
+ return {};
104
+ var r = {}, n = Object.keys(e), o, a;
105
+ for (a = 0; a < n.length; a++)
106
+ o = n[a], !(t.indexOf(o) >= 0) && (r[o] = e[o]);
107
+ return r;
108
+ }
109
+ function lt(e, t) {
110
+ if (e == null)
111
+ return {};
112
+ var r = st(e, t), n, o;
113
+ if (Object.getOwnPropertySymbols) {
114
+ var a = Object.getOwnPropertySymbols(e);
115
+ for (o = 0; o < a.length; o++)
116
+ n = a[o], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
117
+ }
118
+ return r;
119
+ }
120
+ function dt(e, t) {
121
+ return ft(e) || pt(e, t) || gt(e, t) || mt();
122
+ }
123
+ function ft(e) {
124
+ if (Array.isArray(e))
125
+ return e;
126
+ }
127
+ function pt(e, t) {
128
+ if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
129
+ var r = [], n = !0, o = !1, a = void 0;
130
+ try {
131
+ for (var i = e[Symbol.iterator](), s; !(n = (s = i.next()).done) && (r.push(s.value), !(t && r.length === t)); n = !0)
132
+ ;
133
+ } catch (l) {
134
+ o = !0, a = l;
135
+ } finally {
136
+ try {
137
+ !n && i.return != null && i.return();
138
+ } finally {
139
+ if (o)
140
+ throw a;
141
+ }
142
+ }
143
+ return r;
144
+ }
145
+ }
146
+ function gt(e, t) {
147
+ if (e) {
148
+ if (typeof e == "string")
149
+ return Ce(e, t);
150
+ var r = Object.prototype.toString.call(e).slice(8, -1);
151
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
152
+ return Array.from(e);
153
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
154
+ return Ce(e, t);
155
+ }
156
+ }
157
+ function Ce(e, t) {
158
+ (t == null || t > e.length) && (t = e.length);
159
+ for (var r = 0, n = new Array(t); r < t; r++)
160
+ n[r] = e[r];
161
+ return n;
162
+ }
163
+ function mt() {
164
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
165
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
166
+ }
167
+ function ht(e, t, r) {
168
+ return t in e ? Object.defineProperty(e, t, {
169
+ value: r,
170
+ enumerable: !0,
171
+ configurable: !0,
172
+ writable: !0
173
+ }) : e[t] = r, e;
174
+ }
175
+ function xe(e, t) {
176
+ var r = Object.keys(e);
177
+ if (Object.getOwnPropertySymbols) {
178
+ var n = Object.getOwnPropertySymbols(e);
179
+ t && (n = n.filter(function(o) {
180
+ return Object.getOwnPropertyDescriptor(e, o).enumerable;
181
+ })), r.push.apply(r, n);
182
+ }
183
+ return r;
184
+ }
185
+ function $e(e) {
186
+ for (var t = 1; t < arguments.length; t++) {
187
+ var r = arguments[t] != null ? arguments[t] : {};
188
+ t % 2 ? xe(Object(r), !0).forEach(function(n) {
189
+ ht(e, n, r[n]);
190
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : xe(Object(r)).forEach(function(n) {
191
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
192
+ });
193
+ }
194
+ return e;
195
+ }
196
+ function vt() {
197
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
198
+ t[r] = arguments[r];
199
+ return function(n) {
200
+ return t.reduceRight(function(o, a) {
201
+ return a(o);
202
+ }, n);
203
+ };
204
+ }
205
+ function X(e) {
206
+ return function t() {
207
+ for (var r = this, n = arguments.length, o = new Array(n), a = 0; a < n; a++)
208
+ o[a] = arguments[a];
209
+ return o.length >= e.length ? e.apply(this, o) : function() {
210
+ for (var i = arguments.length, s = new Array(i), l = 0; l < i; l++)
211
+ s[l] = arguments[l];
212
+ return t.apply(r, [].concat(o, s));
213
+ };
214
+ };
215
+ }
216
+ function ce(e) {
217
+ return {}.toString.call(e).includes("Object");
218
+ }
219
+ function yt(e) {
220
+ return !Object.keys(e).length;
221
+ }
222
+ function re(e) {
223
+ return typeof e == "function";
224
+ }
225
+ function bt(e, t) {
226
+ return Object.prototype.hasOwnProperty.call(e, t);
227
+ }
228
+ function wt(e, t) {
229
+ return ce(t) || B("changeType"), Object.keys(t).some(function(r) {
230
+ return !bt(e, r);
231
+ }) && B("changeField"), t;
232
+ }
233
+ function Ot(e) {
234
+ re(e) || B("selectorType");
235
+ }
236
+ function St(e) {
237
+ re(e) || ce(e) || B("handlerType"), ce(e) && Object.values(e).some(function(t) {
238
+ return !re(t);
239
+ }) && B("handlersType");
240
+ }
241
+ function Mt(e) {
242
+ e || B("initialIsRequired"), ce(e) || B("initialType"), yt(e) && B("initialContent");
243
+ }
244
+ function jt(e, t) {
245
+ throw new Error(e[t] || e.default);
246
+ }
247
+ var Et = {
248
+ initialIsRequired: "initial state is required",
249
+ initialType: "initial state should be an object",
250
+ initialContent: "initial state shouldn't be an empty object",
251
+ handlerType: "handler should be an object or a function",
252
+ handlersType: "all handlers should be a functions",
253
+ selectorType: "selector should be a function",
254
+ changeType: "provided value of changes should be an object",
255
+ changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
256
+ default: "an unknown error accured in `state-local` package"
257
+ }, B = X(jt)(Et), ae = {
258
+ changes: wt,
259
+ selector: Ot,
260
+ handler: St,
261
+ initial: Mt
262
+ };
263
+ function Pt(e) {
264
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
265
+ ae.initial(e), ae.handler(t);
266
+ var r = {
267
+ current: e
268
+ }, n = X($t)(r, t), o = X(xt)(r), a = X(ae.changes)(e), i = X(Ct)(r);
269
+ function s() {
270
+ var f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(b) {
271
+ return b;
272
+ };
273
+ return ae.selector(f), f(r.current);
274
+ }
275
+ function l(f) {
276
+ vt(n, o, a, i)(f);
277
+ }
278
+ return [s, l];
279
+ }
280
+ function Ct(e, t) {
281
+ return re(t) ? t(e.current) : t;
282
+ }
283
+ function xt(e, t) {
284
+ return e.current = $e($e({}, e.current), t), t;
285
+ }
286
+ function $t(e, t, r) {
287
+ return re(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
288
+ var o;
289
+ return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
290
+ }), r;
291
+ }
292
+ var Lt = {
293
+ create: Pt
294
+ }, It = {
295
+ paths: {
296
+ vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"
297
+ }
298
+ };
299
+ function Nt(e) {
300
+ return function t() {
301
+ for (var r = this, n = arguments.length, o = new Array(n), a = 0; a < n; a++)
302
+ o[a] = arguments[a];
303
+ return o.length >= e.length ? e.apply(this, o) : function() {
304
+ for (var i = arguments.length, s = new Array(i), l = 0; l < i; l++)
305
+ s[l] = arguments[l];
306
+ return t.apply(r, [].concat(o, s));
307
+ };
308
+ };
309
+ }
310
+ function Dt(e) {
311
+ return {}.toString.call(e).includes("Object");
312
+ }
313
+ function Tt(e) {
314
+ return e || Le("configIsRequired"), Dt(e) || Le("configType"), e.urls ? (kt(), {
315
+ paths: {
316
+ vs: e.urls.monacoBase
317
+ }
318
+ }) : e;
319
+ }
320
+ function kt() {
321
+ console.warn(ke.deprecation);
322
+ }
323
+ function At(e, t) {
324
+ throw new Error(e[t] || e.default);
325
+ }
326
+ var ke = {
327
+ configIsRequired: "the configuration object is required",
328
+ configType: "the configuration object should be an object",
329
+ default: "an unknown error accured in `@monaco-editor/loader` package",
330
+ deprecation: `Deprecation warning!
331
+ You are using deprecated way of configuration.
332
+
333
+ Instead of using
334
+ monaco.config({ urls: { monacoBase: '...' } })
335
+ use
336
+ monaco.config({ paths: { vs: '...' } })
337
+
338
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
339
+ `
340
+ }, Le = Nt(At)(ke), Vt = {
341
+ config: Tt
342
+ }, _t = function() {
343
+ for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
344
+ r[n] = arguments[n];
345
+ return function(o) {
346
+ return r.reduceRight(function(a, i) {
347
+ return i(a);
348
+ }, o);
349
+ };
350
+ };
351
+ function Ae(e, t) {
352
+ return Object.keys(t).forEach(function(r) {
353
+ t[r] instanceof Object && e[r] && Object.assign(t[r], Ae(e[r], t[r]));
354
+ }), Pe(Pe({}, e), t);
355
+ }
356
+ var Ut = {
357
+ type: "cancelation",
358
+ msg: "operation is manually canceled"
359
+ };
360
+ function fe(e) {
361
+ var t = !1, r = new Promise(function(n, o) {
362
+ e.then(function(a) {
363
+ return t ? o(Ut) : n(a);
364
+ }), e.catch(o);
365
+ });
366
+ return r.cancel = function() {
367
+ return t = !0;
368
+ }, r;
369
+ }
370
+ var zt = Lt.create({
371
+ config: It,
372
+ isInitialized: !1,
373
+ resolve: null,
374
+ reject: null,
375
+ monaco: null
376
+ }), Ve = dt(zt, 2), oe = Ve[0], ue = Ve[1];
377
+ function Ft(e) {
378
+ var t = Vt.config(e), r = t.monaco, n = lt(t, ["monaco"]);
379
+ ue(function(o) {
380
+ return {
381
+ config: Ae(o.config, n),
382
+ monaco: r
383
+ };
384
+ });
385
+ }
386
+ function Rt() {
387
+ var e = oe(function(t) {
388
+ var r = t.monaco, n = t.isInitialized, o = t.resolve;
389
+ return {
390
+ monaco: r,
391
+ isInitialized: n,
392
+ resolve: o
393
+ };
394
+ });
395
+ if (!e.isInitialized) {
396
+ if (ue({
397
+ isInitialized: !0
398
+ }), e.monaco)
399
+ return e.resolve(e.monaco), fe(pe);
400
+ if (window.monaco && window.monaco.editor)
401
+ return _e(window.monaco), e.resolve(window.monaco), fe(pe);
402
+ _t(qt, Ht)(Wt);
403
+ }
404
+ return fe(pe);
405
+ }
406
+ function qt(e) {
407
+ return document.body.appendChild(e);
408
+ }
409
+ function Bt(e) {
410
+ var t = document.createElement("script");
411
+ return e && (t.src = e), t;
412
+ }
413
+ function Ht(e) {
414
+ var t = oe(function(n) {
415
+ var o = n.config, a = n.reject;
416
+ return {
417
+ config: o,
418
+ reject: a
419
+ };
420
+ }), r = Bt("".concat(t.config.paths.vs, "/loader.js"));
421
+ return r.onload = function() {
422
+ return e();
423
+ }, r.onerror = t.reject, r;
424
+ }
425
+ function Wt() {
426
+ var e = oe(function(r) {
427
+ var n = r.config, o = r.resolve, a = r.reject;
428
+ return {
429
+ config: n,
430
+ resolve: o,
431
+ reject: a
432
+ };
433
+ }), t = window.require;
434
+ t.config(e.config), t(["vs/editor/editor.main"], function(r) {
435
+ _e(r), e.resolve(r);
436
+ }, function(r) {
437
+ e.reject(r);
438
+ });
439
+ }
440
+ function _e(e) {
441
+ oe().monaco || ue({
442
+ monaco: e
443
+ });
444
+ }
445
+ function Kt() {
446
+ return oe(function(e) {
447
+ var t = e.monaco;
448
+ return t;
449
+ });
450
+ }
451
+ var pe = new Promise(function(e, t) {
452
+ return ue({
453
+ resolve: e,
454
+ reject: t
455
+ });
456
+ }), H = {
457
+ config: Ft,
458
+ init: Rt,
459
+ __getMonacoInstance: Kt
460
+ }, Yt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ge = Yt, Zt = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Gt = Zt;
461
+ function Jt({ children: e }) {
462
+ return W.createElement("div", { style: Gt.container }, e);
463
+ }
464
+ var Qt = Jt, Xt = Qt;
465
+ function er({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: a, wrapperProps: i }) {
466
+ return W.createElement("section", { style: { ...ge.wrapper, width: e, height: t }, ...i }, !r && W.createElement(Xt, null, n), W.createElement("div", { ref: o, style: { ...ge.fullWidth, ...!r && ge.hide }, className: a }));
467
+ }
468
+ var tr = er, Ue = ye(tr);
469
+ function rr(e) {
470
+ $(e, []);
471
+ }
472
+ var be = rr;
473
+ function nr(e, t, r = !0) {
474
+ let n = y(!0);
475
+ $(n.current || !r ? () => {
476
+ n.current = !1;
477
+ } : e, t);
478
+ }
479
+ var _ = nr;
480
+ function ee() {
481
+ }
482
+ function Z(e, t, r, n) {
483
+ return or(e, n) || ar(e, t, r, n);
484
+ }
485
+ function or(e, t) {
486
+ return e.editor.getModel(ze(e, t));
487
+ }
488
+ function ar(e, t, r, n) {
489
+ return e.editor.createModel(t, r, n ? ze(e, n) : void 0);
490
+ }
491
+ function ze(e, t) {
492
+ return e.Uri.parse(t);
493
+ }
494
+ function ir({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: a, modifiedModelPath: i, keepCurrentOriginalModel: s = !1, keepCurrentModifiedModel: l = !1, theme: f = "light", loading: b = "Loading...", options: p = {}, height: g = "100%", width: I = "100%", className: w, wrapperProps: k = {}, beforeMount: M = ee, onMount: O = ee }) {
495
+ let [m, j] = A(!1), [D, E] = A(!0), P = y(null), S = y(null), z = y(null), d = y(O), u = y(M), N = y(!1);
496
+ be(() => {
497
+ let c = H.init();
498
+ return c.then((h) => (S.current = h) && E(!1)).catch((h) => (h == null ? void 0 : h.type) !== "cancelation" && console.error("Monaco initialization: error:", h)), () => P.current ? L() : c.cancel();
499
+ }), _(() => {
500
+ if (P.current && S.current) {
501
+ let c = P.current.getOriginalEditor(), h = Z(S.current, e || "", n || r || "text", a || "");
502
+ h !== c.getModel() && c.setModel(h);
503
+ }
504
+ }, [a], m), _(() => {
505
+ if (P.current && S.current) {
506
+ let c = P.current.getModifiedEditor(), h = Z(S.current, t || "", o || r || "text", i || "");
507
+ h !== c.getModel() && c.setModel(h);
508
+ }
509
+ }, [i], m), _(() => {
510
+ let c = P.current.getModifiedEditor();
511
+ c.getOption(S.current.editor.EditorOption.readOnly) ? c.setValue(t || "") : t !== c.getValue() && (c.executeEdits("", [{ range: c.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), c.pushUndoStop());
512
+ }, [t], m), _(() => {
513
+ var c, h;
514
+ (h = (c = P.current) == null ? void 0 : c.getModel()) == null || h.original.setValue(e || "");
515
+ }, [e], m), _(() => {
516
+ let { original: c, modified: h } = P.current.getModel();
517
+ S.current.editor.setModelLanguage(c, n || r || "text"), S.current.editor.setModelLanguage(h, o || r || "text");
518
+ }, [r, n, o], m), _(() => {
519
+ var c;
520
+ (c = S.current) == null || c.editor.setTheme(f);
521
+ }, [f], m), _(() => {
522
+ var c;
523
+ (c = P.current) == null || c.updateOptions(p);
524
+ }, [p], m);
525
+ let C = G(() => {
526
+ var R;
527
+ if (!S.current)
528
+ return;
529
+ u.current(S.current);
530
+ let c = Z(S.current, e || "", n || r || "text", a || ""), h = Z(S.current, t || "", o || r || "text", i || "");
531
+ (R = P.current) == null || R.setModel({ original: c, modified: h });
532
+ }, [r, t, o, e, n, a, i]), T = G(() => {
533
+ var c;
534
+ !N.current && z.current && (P.current = S.current.editor.createDiffEditor(z.current, { automaticLayout: !0, ...p }), C(), (c = S.current) == null || c.editor.setTheme(f), j(!0), N.current = !0);
535
+ }, [p, f, C]);
536
+ $(() => {
537
+ m && d.current(P.current, S.current);
538
+ }, [m]), $(() => {
539
+ !D && !m && T();
540
+ }, [D, m, T]);
541
+ function L() {
542
+ var h, R, K, J;
543
+ let c = (h = P.current) == null ? void 0 : h.getModel();
544
+ s || ((R = c == null ? void 0 : c.original) == null || R.dispose()), l || ((K = c == null ? void 0 : c.modified) == null || K.dispose()), (J = P.current) == null || J.dispose();
545
+ }
546
+ return W.createElement(Ue, { width: I, height: g, isEditorReady: m, loading: b, _ref: z, className: w, wrapperProps: k });
547
+ }
548
+ var cr = ir, ur = ye(cr);
549
+ function sr() {
550
+ let [e, t] = A(H.__getMonacoInstance());
551
+ return be(() => {
552
+ let r;
553
+ return e || (r = H.init(), r.then((n) => {
554
+ t(n);
555
+ })), () => r == null ? void 0 : r.cancel();
556
+ }), e;
557
+ }
558
+ var se = sr;
559
+ function lr(e) {
560
+ let t = y();
561
+ return $(() => {
562
+ t.current = e;
563
+ }, [e]), t.current;
564
+ }
565
+ var dr = lr, ie = /* @__PURE__ */ new Map();
566
+ function fr({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: a, theme: i = "light", line: s, loading: l = "Loading...", options: f = {}, overrideServices: b = {}, saveViewState: p = !0, keepCurrentModel: g = !1, width: I = "100%", height: w = "100%", className: k, wrapperProps: M = {}, beforeMount: O = ee, onMount: m = ee, onChange: j, onValidate: D = ee }) {
567
+ let [E, P] = A(!1), [S, z] = A(!0), d = y(null), u = y(null), N = y(null), C = y(m), T = y(O), L = y(), c = y(n), h = dr(a), R = y(!1), K = y(!1);
568
+ be(() => {
569
+ let v = H.init();
570
+ return v.then((x) => (d.current = x) && z(!1)).catch((x) => (x == null ? void 0 : x.type) !== "cancelation" && console.error("Monaco initialization: error:", x)), () => u.current ? Ke() : v.cancel();
571
+ }), _(() => {
572
+ var x, V, Q, Y;
573
+ let v = Z(d.current, e || n || "", t || o || "", a || r || "");
574
+ v !== ((x = u.current) == null ? void 0 : x.getModel()) && (p && ie.set(h, (V = u.current) == null ? void 0 : V.saveViewState()), (Q = u.current) == null || Q.setModel(v), p && ((Y = u.current) == null || Y.restoreViewState(ie.get(a))));
575
+ }, [a], E), _(() => {
576
+ var v;
577
+ (v = u.current) == null || v.updateOptions(f);
578
+ }, [f], E), _(() => {
579
+ !u.current || n === void 0 || (u.current.getOption(d.current.editor.EditorOption.readOnly) ? u.current.setValue(n) : n !== u.current.getValue() && (K.current = !0, u.current.executeEdits("", [{ range: u.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), u.current.pushUndoStop(), K.current = !1));
580
+ }, [n], E), _(() => {
581
+ var x, V;
582
+ let v = (x = u.current) == null ? void 0 : x.getModel();
583
+ v && o && ((V = d.current) == null || V.editor.setModelLanguage(v, o));
584
+ }, [o], E), _(() => {
585
+ var v;
586
+ s !== void 0 && ((v = u.current) == null || v.revealLine(s));
587
+ }, [s], E), _(() => {
588
+ var v;
589
+ (v = d.current) == null || v.editor.setTheme(i);
590
+ }, [i], E);
591
+ let J = G(() => {
592
+ var v;
593
+ if (!(!N.current || !d.current) && !R.current) {
594
+ T.current(d.current);
595
+ let x = a || r, V = Z(d.current, n || e || "", t || o || "", x || "");
596
+ u.current = (v = d.current) == null ? void 0 : v.editor.create(N.current, { model: V, automaticLayout: !0, ...f }, b), p && u.current.restoreViewState(ie.get(x)), d.current.editor.setTheme(i), s !== void 0 && u.current.revealLine(s), P(!0), R.current = !0;
597
+ }
598
+ }, [e, t, r, n, o, a, f, b, p, i, s]);
599
+ $(() => {
600
+ E && C.current(u.current, d.current);
601
+ }, [E]), $(() => {
602
+ !S && !E && J();
603
+ }, [S, E, J]), c.current = n, $(() => {
604
+ var v, x;
605
+ E && j && ((v = L.current) == null || v.dispose(), L.current = (x = u.current) == null ? void 0 : x.onDidChangeModelContent((V) => {
606
+ K.current || j(u.current.getValue(), V);
607
+ }));
608
+ }, [E, j]), $(() => {
609
+ if (E) {
610
+ let v = d.current.editor.onDidChangeMarkers((x) => {
611
+ var Q;
612
+ let V = (Q = u.current.getModel()) == null ? void 0 : Q.uri;
613
+ if (V && x.find((Y) => Y.path === V.path)) {
614
+ let Y = d.current.editor.getModelMarkers({ resource: V });
615
+ D == null || D(Y);
616
+ }
617
+ });
618
+ return () => {
619
+ v == null || v.dispose();
620
+ };
621
+ }
622
+ return () => {
623
+ };
624
+ }, [E, D]);
625
+ function Ke() {
626
+ var v, x;
627
+ (v = L.current) == null || v.dispose(), g ? p && ie.set(a, u.current.saveViewState()) : (x = u.current.getModel()) == null || x.dispose(), u.current.dispose();
628
+ }
629
+ return W.createElement(Ue, { width: I, height: w, isEditorReady: E, loading: l, _ref: N, className: k, wrapperProps: M });
630
+ }
631
+ var pr = fr, gr = ye(pr), we = gr;
632
+ const le = {
36
633
  selectOnLineNumbers: !0,
37
634
  scrollBeyondLastLine: !1,
38
635
  padding: {
@@ -52,111 +649,111 @@ const z = {
52
649
  overviewRulerBorder: !1,
53
650
  overviewRulerLanes: 0,
54
651
  renderLineHighlight: "none"
55
- }, F = (t) => {
56
- const { themeConfig: e, editor: n, theme: r } = t, { defaultTheme: a } = e ?? {}, [o, s] = _(r ?? a ?? "vs-dark");
57
- return w(() => {
58
- var y;
59
- (y = e == null ? void 0 : e.themes) == null || y.forEach((h) => {
60
- L.editor.defineTheme(h.themeName, h.themeData);
652
+ }, de = (e) => {
653
+ const { themeConfig: t, editor: r, theme: n } = e, { defaultTheme: o } = t ?? {}, [a, i] = A(n ?? o ?? "vs-dark");
654
+ return $(() => {
655
+ var s;
656
+ (s = t == null ? void 0 : t.themes) == null || s.forEach((l) => {
657
+ F.editor.defineTheme(l.themeName, l.themeData);
61
658
  });
62
- }, [L]), w(() => {
63
- L.editor && r && (L.editor.setTheme(r), s(r));
64
- }, [n, r]), { theme: o };
659
+ }, [F]), $(() => {
660
+ F.editor && n && (F.editor.setTheme(n), i(n));
661
+ }, [r, n]), { theme: a };
65
662
  };
66
- function xe(t) {
67
- const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
68
- let n = "";
69
- for (let r = 0; r < t; r++)
70
- n += e.charAt(Math.floor(Math.random() * e.length));
71
- return n;
663
+ function mr(e) {
664
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
665
+ let r = "";
666
+ for (let n = 0; n < e; n++)
667
+ r += t.charAt(Math.floor(Math.random() * t.length));
668
+ return r;
72
669
  }
73
- function Ee(t) {
74
- return t.replace("'", "&#39;");
670
+ function hr(e) {
671
+ return e.replace("'", "&#39;");
75
672
  }
76
- function Me({
77
- instanceId: t,
78
- lineNumbersPosition: e
673
+ function vr({
674
+ instanceId: e,
675
+ lineNumbersPosition: t
79
676
  }) {
80
- let n = "";
81
- return e === "center" && (n += `
82
- .monaco-editor-${t} .monaco-scrollable-element.editor-scrollable {
677
+ let r = "";
678
+ return t === "center" && (r += `
679
+ .monaco-editor-${e} .monaco-scrollable-element.editor-scrollable {
83
680
  width: 100% !important;
84
681
  left: 0px !important;
85
682
  }
86
683
 
87
- .monaco-editor-${t} .view-lines, .view-zones {
684
+ .monaco-editor-${e} .view-lines, .view-zones {
88
685
  width: 100% !important;
89
686
  }
90
687
 
91
- .monaco-editor-${t} .margin {
688
+ .monaco-editor-${e} .margin {
92
689
  z-index: 1000;
93
690
  background: transparent !important;
94
- }`), n += `
95
- .monaco-editor-${t} .blame-editor-separator {
691
+ }`), r += `
692
+ .monaco-editor-${e} .blame-editor-separator {
96
693
  right: 14px;
97
694
  pointer-events: none;
98
695
  }
99
696
 
100
- .monaco-editor-${t} {
697
+ .monaco-editor-${e} {
101
698
  outline: none !important;
102
699
  }
103
700
 
104
- .monaco-editor-${t} .view-line .blame-editor-commit {
701
+ .monaco-editor-${e} .view-line .blame-editor-commit {
105
702
  display: inline-block;
106
703
  color: var(--canary-foreground-01);
107
- }`, n;
704
+ }`, r;
108
705
  }
109
- function Ce({
110
- instanceId: t,
111
- blameData: e,
112
- dateWidth: n,
113
- avatarSize: r
706
+ function yr({
707
+ instanceId: e,
708
+ blameData: t,
709
+ dateWidth: r,
710
+ avatarSize: n
114
711
  }) {
115
- let a = "";
116
- return e.forEach((o) => {
117
- var l, u, i, v, E, c, b, d;
118
- const s = (u = (l = o == null ? void 0 : o.commitInfo) == null ? void 0 : l.author) == null ? void 0 : u.avatarUrl, y = (v = (i = o == null ? void 0 : o.commitInfo) == null ? void 0 : i.author) == null ? void 0 : v.initials, h = s ? `background: url('${(c = (E = o == null ? void 0 : o.commitInfo) == null ? void 0 : E.author) == null ? void 0 : c.avatarUrl}');` : "";
119
- for (let f = o.fromLineNumber; f <= o.toLineNumber; f++)
120
- f === o.fromLineNumber ? a += `
121
- .monaco-editor-${t} .view-line .blame-editor-commit-${f}:before {
122
- content: '${Ee(((d = (b = o == null ? void 0 : o.commitInfo) == null ? void 0 : b.author) == null ? void 0 : d.when) || "")}';
712
+ let o = "";
713
+ return t.forEach((a) => {
714
+ var f, b, p, g, I, w, k, M;
715
+ const i = (b = (f = a == null ? void 0 : a.commitInfo) == null ? void 0 : f.author) == null ? void 0 : b.avatarUrl, s = (g = (p = a == null ? void 0 : a.commitInfo) == null ? void 0 : p.author) == null ? void 0 : g.initials, l = i ? `background: url('${(w = (I = a == null ? void 0 : a.commitInfo) == null ? void 0 : I.author) == null ? void 0 : w.avatarUrl}');` : "";
716
+ for (let O = a.fromLineNumber; O <= a.toLineNumber; O++)
717
+ O === a.fromLineNumber ? o += `
718
+ .monaco-editor-${e} .view-line .blame-editor-commit-${O}:before {
719
+ content: '${hr(((M = (k = a == null ? void 0 : a.commitInfo) == null ? void 0 : k.author) == null ? void 0 : M.when) || "")}';
123
720
  position: absolute;
124
721
  left: 10px;
125
722
  top: 0px;
126
723
  color: hsl(var(--canary-foreground-03));
127
724
  }
128
725
 
129
- .monaco-editor-${t} .view-line .blame-editor-commit-${f}:after {
130
- content: '${y ?? " "}';
726
+ .monaco-editor-${e} .view-line .blame-editor-commit-${O}:after {
727
+ content: '${s ?? " "}';
131
728
  position: absolute;
132
729
  border-radius: 50%;
133
730
  padding: 4px;
134
731
  text-align: center;
135
732
  background: hsl(var(--canary-background-11));
136
733
  line-height: 17px;
137
- left: ${n + 10}px;
734
+ left: ${r + 10}px;
138
735
  top: -4px;
139
736
  color: hsl(var(--canary-foreground-03));
140
- width: ${r}px;
141
- height: ${r}px;
142
- ${h}
737
+ width: ${n}px;
738
+ height: ${n}px;
739
+ ${l}
143
740
  background-size: 100% 100%;
144
- }` : a += `
145
- .monaco-editor-${t} .view-line .blame-editor-commit-${f}:before {
741
+ }` : o += `
742
+ .monaco-editor-${e} .view-line .blame-editor-commit-${O}:before {
146
743
  content: ' ';
147
744
  left: 10px;
148
745
  top: 0px;
149
746
  color: gray;
150
747
  }`;
151
- }), a;
748
+ }), o;
152
749
  }
153
- function $e(t, e) {
154
- let n = "";
155
- return t.length > e ? n = t.slice(0, e - 3) + "..." : t.length < e ? n = t + " ".repeat(e - t.length) : n = t, " ".repeat(25) + n + " ".repeat(10);
750
+ function br(e, t) {
751
+ let r = "";
752
+ return e.length > t ? r = e.slice(0, t - 3) + "..." : e.length < t ? r = e + " ".repeat(t - e.length) : r = e, " ".repeat(25) + r + " ".repeat(10);
156
753
  }
157
- A.config({ monaco: L });
158
- const Y = 450, Pe = 30, ke = 140, we = 24, Oe = {
159
- ...z,
754
+ H.config({ monaco: F });
755
+ const me = 450, wr = 30, Or = 140, Sr = 24, Mr = {
756
+ ...le,
160
757
  readOnly: !0,
161
758
  matchBrackets: "never",
162
759
  renderValidationDecorations: "off",
@@ -166,205 +763,206 @@ const Y = 450, Pe = 30, ke = 140, we = 24, Oe = {
166
763
  renderWhitespace: "none",
167
764
  renderLineHighlight: "none"
168
765
  };
169
- function Ke({
170
- code: t,
171
- language: e,
172
- themeConfig: n,
173
- lineNumbersPosition: r = "left",
174
- blameData: a,
175
- showSeparators: o = !0,
176
- theme: s,
177
- height: y = "75vh",
178
- options: h
766
+ function zr({
767
+ code: e,
768
+ language: t,
769
+ themeConfig: r,
770
+ lineNumbersPosition: n = "left",
771
+ blameData: o,
772
+ showSeparators: a = !0,
773
+ theme: i,
774
+ height: s = "75vh",
775
+ options: l
179
776
  }) {
180
- const l = P(a), u = P(xe(5));
181
- U();
182
- const [i, v] = _(), [E, c] = _(0), b = P(null), d = P(null);
183
- w(() => {
184
- l.current = a;
185
- }, [a]);
186
- function f() {
187
- const m = d.current, p = b.current;
188
- if (!m || !p)
777
+ const f = y(o), b = y(mr(5));
778
+ se();
779
+ const [p, g] = A(), [I, w] = A(0), k = y(null), M = y(null);
780
+ $(() => {
781
+ f.current = o;
782
+ }, [o]);
783
+ function O() {
784
+ const d = M.current, u = k.current;
785
+ if (!d || !u)
189
786
  return;
190
- o && m.changeViewZones(function(g) {
191
- g.addZone({
787
+ a && d.changeViewZones(function(C) {
788
+ C.addZone({
192
789
  afterLineNumber: 0,
193
790
  heightInPx: 10,
194
791
  domNode: document.createElement("div")
195
- }), l.current.forEach((O, M) => {
196
- if (M !== l.current.length - 1) {
197
- const x = document.createElement("div");
198
- x.style.borderTop = "1px solid hsl(var(--canary-border-01))", x.style.marginTop = "9px", x.className = "blame-editor-separator", g.addZone({
199
- afterLineNumber: O.toLineNumber,
792
+ }), f.current.forEach((T, L) => {
793
+ if (L !== f.current.length - 1) {
794
+ const c = document.createElement("div");
795
+ c.style.borderTop = "1px solid hsl(var(--canary-border-01))", c.style.marginTop = "9px", c.className = "blame-editor-separator", C.addZone({
796
+ afterLineNumber: T.toLineNumber,
200
797
  heightInPx: 20,
201
- domNode: x
798
+ domNode: c
202
799
  });
203
800
  }
204
801
  });
205
802
  });
206
- const $ = [];
207
- l.current.forEach((g) => {
208
- var O;
209
- for (let M = g.fromLineNumber; M <= g.toLineNumber; M++)
210
- $.push({
211
- range: new p.Range(M, 0, M + 1, 0),
803
+ const N = [];
804
+ f.current.forEach((C) => {
805
+ var T;
806
+ for (let L = C.fromLineNumber; L <= C.toLineNumber; L++)
807
+ N.push({
808
+ range: new u.Range(L, 0, L + 1, 0),
212
809
  options: {
213
810
  before: {
214
- content: $e(
215
- M === g.fromLineNumber && ((O = g == null ? void 0 : g.commitInfo) == null ? void 0 : O.title) || "",
216
- Pe
811
+ content: br(
812
+ L === C.fromLineNumber && ((T = C == null ? void 0 : C.commitInfo) == null ? void 0 : T.title) || "",
813
+ wr
217
814
  ),
218
- cursorStops: p.editor.InjectedTextCursorStops.None,
219
- inlineClassName: `blame-editor-commit blame-editor-commit-${M}`
815
+ cursorStops: u.editor.InjectedTextCursorStops.None,
816
+ inlineClassName: `blame-editor-commit blame-editor-commit-${L}`
220
817
  }
221
818
  }
222
819
  });
223
- }), m.createDecorationsCollection($);
820
+ }), d.createDecorationsCollection(N);
224
821
  }
225
- function C(m, p) {
226
- var $, g, O, M, x, I;
227
- d.current = m, b.current = p, m.setValue(t), v(m), (O = (g = ($ = p.languages.typescript) == null ? void 0 : $.typescriptDefaults) == null ? void 0 : g.setDiagnosticsOptions) == null || O.call(g, {
822
+ function m(d, u) {
823
+ var N, C, T, L, c, h;
824
+ M.current = d, k.current = u, d.setValue(e), g(d), (T = (C = (N = u.languages.typescript) == null ? void 0 : N.typescriptDefaults) == null ? void 0 : C.setDiagnosticsOptions) == null || T.call(C, {
228
825
  noSuggestionDiagnostics: !0,
229
826
  noSyntaxValidation: !0,
230
827
  noSemanticValidation: !0
231
- }), (I = (x = (M = p.languages.typescript) == null ? void 0 : M.javascriptDefaults) == null ? void 0 : x.setDiagnosticsOptions) == null || I.call(x, {
828
+ }), (h = (c = (L = u.languages.typescript) == null ? void 0 : L.javascriptDefaults) == null ? void 0 : c.setDiagnosticsOptions) == null || h.call(c, {
232
829
  noSuggestionDiagnostics: !0,
233
830
  noSyntaxValidation: !0,
234
831
  noSemanticValidation: !0
235
- }), f();
832
+ }), O();
236
833
  }
237
- w(() => {
238
- i == null || i.setValue(t);
239
- }, [t]);
240
- const { theme: S } = F({ monacoRef: b, themeConfig: n, editor: i, theme: s }), N = T(
241
- () => Me({
242
- instanceId: u.current,
243
- lineNumbersPosition: r
834
+ $(() => {
835
+ p == null || p.setValue(e);
836
+ }, [e]);
837
+ const { theme: j } = de({ monacoRef: k, themeConfig: r, editor: p, theme: i }), D = q(
838
+ () => vr({
839
+ instanceId: b.current,
840
+ lineNumbersPosition: n
244
841
  }),
245
- [a]
246
- ), D = T(
247
- () => Ce({
248
- instanceId: u.current,
249
- blameData: a,
250
- avatarSize: we,
251
- dateWidth: ke
842
+ [o]
843
+ ), E = q(
844
+ () => yr({
845
+ instanceId: b.current,
846
+ blameData: o,
847
+ avatarSize: Sr,
848
+ dateWidth: Or
252
849
  }),
253
- [a]
850
+ [o]
254
851
  );
255
- w(() => {
256
- if (r === "center") {
257
- const m = document.getElementsByClassName("lines-content")[0];
258
- if (m) {
259
- const p = { attributes: !0 }, $ = (O) => {
260
- for (const M of O) {
261
- const x = parseInt(getComputedStyle(m).left);
262
- c(x);
852
+ $(() => {
853
+ if (n === "center") {
854
+ const d = document.getElementsByClassName("lines-content")[0];
855
+ if (d) {
856
+ const u = { attributes: !0 }, N = (T) => {
857
+ for (const L of T) {
858
+ const c = parseInt(getComputedStyle(d).left);
859
+ w(c);
263
860
  }
264
- }, g = new MutationObserver($);
265
- return g.observe(m, p), () => {
266
- g.disconnect();
861
+ }, C = new MutationObserver(N);
862
+ return C.observe(d, u), () => {
863
+ C.disconnect();
267
864
  };
268
865
  }
269
866
  }
270
867
  });
271
- const j = T(() => `
272
- .monaco-editor-${u.current} .margin {
273
- left: ${Y + 16 + E}px !important;
868
+ const P = q(() => `
869
+ .monaco-editor-${b.current} .margin {
870
+ left: ${me + 16 + I}px !important;
274
871
  pointer-events: none;
275
- }`, [E]), R = `
276
- .monaco-editor-${u.current} .view-overlays {
277
- clip-path: polygon(${Y + 16}px 0, 100% 0%, 100% 100%, ${Y + 16}px 100%);
872
+ }`, [I]), S = `
873
+ .monaco-editor-${b.current} .view-overlays {
874
+ clip-path: polygon(${me + 16}px 0, 100% 0%, 100% 100%, ${me + 16}px 100%);
278
875
  height:100% !important;
279
- }`, W = T(
876
+ }`, z = q(
280
877
  () => ({
281
- ...Oe,
282
- ...h
878
+ ...Mr,
879
+ ...l
283
880
  }),
284
- [h]
881
+ [l]
285
882
  );
286
- return /* @__PURE__ */ k.jsxs(k.Fragment, { children: [
287
- /* @__PURE__ */ k.jsx(
883
+ return /* @__PURE__ */ U.jsxs(U.Fragment, { children: [
884
+ /* @__PURE__ */ U.jsx(
288
885
  "style",
289
886
  {
290
887
  dangerouslySetInnerHTML: {
291
- __html: `${N} ${D} ${j} ${R}`
888
+ __html: `${D} ${E} ${P} ${S}`
292
889
  }
293
890
  }
294
891
  ),
295
- /* @__PURE__ */ k.jsx(
296
- Z,
892
+ /* @__PURE__ */ U.jsx(
893
+ we,
297
894
  {
298
- className: `monaco-editor-${u.current} overflow-hidden rounded-b-md border-x border-b`,
299
- height: y,
300
- language: e,
301
- theme: S,
302
- options: W,
303
- onMount: C
895
+ className: `monaco-editor-${b.current} overflow-hidden rounded-b-md border-x border-b`,
896
+ height: s,
897
+ language: t,
898
+ theme: j,
899
+ options: z,
900
+ onMount: m
304
901
  }
305
902
  )
306
903
  ] });
307
904
  }
308
- A.config({ monaco: L });
309
- const Ne = {
310
- ...z
905
+ H.config({ monaco: F });
906
+ const jr = {
907
+ ...le
311
908
  };
312
- function qe({
313
- codeRevision: t,
314
- onCodeRevisionChange: e,
315
- language: n,
316
- themeConfig: r,
317
- options: a,
318
- theme: o,
319
- height: s = "75vh"
909
+ function Fr({
910
+ codeRevision: e,
911
+ onCodeRevisionChange: t,
912
+ language: r,
913
+ themeConfig: n,
914
+ options: o,
915
+ theme: a,
916
+ height: i = "75vh",
917
+ className: s
320
918
  }) {
321
- U();
322
- const [y, h] = _(), l = P(), u = P({ code: "", revisionId: 0 }), i = P(null), v = q(
323
- (b, d) => {
324
- var f, C, S, N, D, j;
325
- i.current = b, l.current = d, b.setValue(t.code), h(b), (S = (C = (f = d.languages.typescript) == null ? void 0 : f.typescriptDefaults) == null ? void 0 : C.setDiagnosticsOptions) == null || S.call(C, {
919
+ se();
920
+ const [l, f] = A(), b = y(), p = y({ code: "", revisionId: 0 }), g = y(null), I = G(
921
+ (M, O) => {
922
+ var m, j, D, E, P, S;
923
+ g.current = M, b.current = O, M.setValue(e.code), f(M), (D = (j = (m = O.languages.typescript) == null ? void 0 : m.typescriptDefaults) == null ? void 0 : j.setDiagnosticsOptions) == null || D.call(j, {
326
924
  noSuggestionDiagnostics: !0,
327
925
  noSyntaxValidation: !0,
328
926
  noSemanticValidation: !0
329
- }), (j = (D = (N = d.languages.typescript) == null ? void 0 : N.javascriptDefaults) == null ? void 0 : D.setDiagnosticsOptions) == null || j.call(D, {
927
+ }), (S = (P = (E = O.languages.typescript) == null ? void 0 : E.javascriptDefaults) == null ? void 0 : P.setDiagnosticsOptions) == null || S.call(P, {
330
928
  noSuggestionDiagnostics: !0,
331
929
  noSyntaxValidation: !0,
332
930
  noSemanticValidation: !0
333
931
  });
334
932
  },
335
- [t.code]
933
+ [e.code]
336
934
  );
337
- w(() => {
338
- var b, d;
339
- if (i.current && (!t.revisionId || t.revisionId > Number((b = u.current) == null ? void 0 : b.revisionId))) {
340
- const f = i.current.getModel();
341
- f && (a != null && a.readOnly ? (d = i.current) == null || d.setValue(t.code) : (i.current.pushUndoStop(), i.current.executeEdits("edit", [
935
+ $(() => {
936
+ var M, O;
937
+ if (g.current && (!e.revisionId || e.revisionId > Number((M = p.current) == null ? void 0 : M.revisionId))) {
938
+ const m = g.current.getModel();
939
+ m && (o != null && o.readOnly ? (O = g.current) == null || O.setValue(e.code) : (g.current.pushUndoStop(), g.current.executeEdits("edit", [
342
940
  {
343
- range: f.getFullModelRange(),
344
- text: t.code
941
+ range: m.getFullModelRange(),
942
+ text: e.code
345
943
  }
346
- ]), i.current.pushUndoStop()));
944
+ ]), g.current.pushUndoStop()));
347
945
  }
348
- }, [t, i.current]);
349
- const { theme: E } = F({ monacoRef: l, themeConfig: r, editor: y, theme: o }), c = T(() => ({ ...Ne, ...a || {} }), [a]);
350
- return /* @__PURE__ */ k.jsx(k.Fragment, { children: /* @__PURE__ */ k.jsx(
351
- Z,
946
+ }, [e, g.current]);
947
+ const { theme: w } = de({ monacoRef: b, themeConfig: n, editor: l, theme: a }), k = q(() => ({ ...jr, ...o || {} }), [o]);
948
+ return /* @__PURE__ */ U.jsx(U.Fragment, { children: /* @__PURE__ */ U.jsx(
949
+ we,
352
950
  {
353
- className: "overflow-hidden rounded-b-md border-x border-b",
354
- height: s,
355
- onChange: (b, d) => {
356
- u.current = { code: b ?? "", revisionId: d.versionId }, e({ ...u.current }, d);
951
+ className: s,
952
+ height: i,
953
+ onChange: (M, O) => {
954
+ p.current = { code: M ?? "", revisionId: O.versionId }, t({ ...p.current }, O);
357
955
  },
358
- language: n,
359
- theme: E,
360
- options: c,
361
- onMount: v
956
+ language: r,
957
+ theme: w,
958
+ options: k,
959
+ onMount: I
362
960
  }
363
961
  ) });
364
962
  }
365
- A.config({ monaco: L });
366
- const De = {
367
- ...z,
963
+ H.config({ monaco: F });
964
+ const Er = {
965
+ ...le,
368
966
  codeLens: !1,
369
967
  smartSelect: {
370
968
  selectLeadingAndTrailingWhitespace: !0
@@ -372,64 +970,64 @@ const De = {
372
970
  originalEditable: !1,
373
971
  overviewRulerBorder: !1
374
972
  };
375
- function Ze({
376
- original: t,
377
- modified: e,
378
- language: n,
379
- themeConfig: r,
380
- options: a,
381
- theme: o,
382
- height: s = "75vh"
973
+ function Rr({
974
+ original: e,
975
+ modified: t,
976
+ language: r,
977
+ themeConfig: n,
978
+ options: o,
979
+ theme: a,
980
+ height: i = "75vh"
383
981
  }) {
384
- U();
385
- const [y, h] = _(), l = P(), { theme: u } = F({ monacoRef: l, themeConfig: r, editor: y, theme: o }), i = T(() => ({ ...De, ...a || {} }), [a]);
386
- return /* @__PURE__ */ k.jsx(k.Fragment, { children: /* @__PURE__ */ k.jsx(
387
- me,
982
+ se();
983
+ const [s, l] = A(), f = y(), { theme: b } = de({ monacoRef: f, themeConfig: n, editor: s, theme: a }), p = q(() => ({ ...Er, ...o || {} }), [o]);
984
+ return /* @__PURE__ */ U.jsx(U.Fragment, { children: /* @__PURE__ */ U.jsx(
985
+ ur,
388
986
  {
389
987
  className: "overflow-hidden rounded-b-md border-x border-b",
390
- language: n,
391
- theme: u,
392
- original: t,
393
- modified: e,
394
- height: s,
395
- options: i,
396
- onMount: h
988
+ language: r,
989
+ theme: b,
990
+ original: e,
991
+ modified: t,
992
+ height: i,
993
+ options: p,
994
+ onMount: l
397
995
  }
398
996
  ) });
399
997
  }
400
- var te = /* @__PURE__ */ ((t) => (t.ContainsPath = "ContainsPath", t))(te || {});
401
- function Le(t) {
402
- const { pathSymbolMap: e, inlineActions: n = [], commandId: r } = t, a = Object.fromEntries(e.entries()), o = [];
403
- return n == null || n.forEach((s) => {
404
- const y = s.actions;
405
- s.selectors.forEach((l) => {
406
- switch (l.type) {
407
- case te.ContainsPath: {
408
- l.paths.forEach((u) => {
409
- let v = Object.keys(a).map((c) => ({
410
- fullPath: c,
411
- path: c,
412
- symbol: a[c]
413
- })).filter((c) => c.path.startsWith(l.basePath));
414
- v = v.map((c) => ({
415
- ...c,
416
- path: c.path.substring(l.basePath.length)
417
- })), v.filter((c) => u.test(c.path)).forEach((c) => {
418
- const b = c.fullPath, d = c.symbol, f = d.range;
419
- y.forEach((C) => {
420
- const S = {
421
- range: f,
422
- symbols: [d],
423
- onClick: C.onClick,
424
- data: C.data,
425
- path: b
998
+ var Fe = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(Fe || {});
999
+ function Pr(e) {
1000
+ const { pathSymbolMap: t, inlineActions: r = [], commandId: n } = e, o = Object.fromEntries(t.entries()), a = [];
1001
+ return r == null || r.forEach((i) => {
1002
+ const s = i.actions;
1003
+ i.selectors.forEach((f) => {
1004
+ switch (f.type) {
1005
+ case Fe.ContainsPath: {
1006
+ f.paths.forEach((b) => {
1007
+ let g = Object.keys(o).map((w) => ({
1008
+ fullPath: w,
1009
+ path: w,
1010
+ symbol: o[w]
1011
+ })).filter((w) => w.path.startsWith(f.basePath));
1012
+ g = g.map((w) => ({
1013
+ ...w,
1014
+ path: w.path.substring(f.basePath.length)
1015
+ })), g.filter((w) => b.test(w.path)).forEach((w) => {
1016
+ const k = w.fullPath, M = w.symbol, O = M.range;
1017
+ s.forEach((m) => {
1018
+ const j = {
1019
+ range: O,
1020
+ symbols: [M],
1021
+ onClick: m.onClick,
1022
+ data: m.data,
1023
+ path: k
426
1024
  };
427
- o.push({
428
- range: f,
1025
+ a.push({
1026
+ range: O,
429
1027
  command: {
430
- id: r,
431
- title: C.title,
432
- arguments: [S]
1028
+ id: n,
1029
+ title: m.title,
1030
+ arguments: [j]
433
1031
  }
434
1032
  });
435
1033
  });
@@ -439,301 +1037,301 @@ function Le(t) {
439
1037
  }
440
1038
  }
441
1039
  });
442
- }), o;
1040
+ }), a;
443
1041
  }
444
- const V = class V {
445
- static set(e) {
446
- V.data = e;
1042
+ const te = class te {
1043
+ static set(t) {
1044
+ te.data = t;
447
1045
  }
448
1046
  static get() {
449
- return V.data;
1047
+ return te.data;
450
1048
  }
451
1049
  };
452
- J(V, "data", {});
453
- let K = V;
454
- async function ne(t) {
455
- const e = K.get(), { documentSymbolProvider: n } = e.StandaloneServices.get(e.ILanguageFeaturesService);
456
- return await e.OutlineModel.create(n, t);
457
- }
458
- function re(t) {
459
- const e = /* @__PURE__ */ new Map();
460
- return G({
461
- pathSymbolMap: e,
1050
+ Se(te, "data", {});
1051
+ let ve = te;
1052
+ async function Re(e) {
1053
+ const t = ve.get(), { documentSymbolProvider: r } = t.StandaloneServices.get(t.ILanguageFeaturesService);
1054
+ return await t.OutlineModel.create(r, e);
1055
+ }
1056
+ function qe(e) {
1057
+ const t = /* @__PURE__ */ new Map();
1058
+ return Oe({
1059
+ pathSymbolMap: t,
462
1060
  parentPath: "",
463
- children: t.children,
464
- parentKind: H.SymbolKind.Module
465
- }), e;
1061
+ children: e.children,
1062
+ parentKind: he.SymbolKind.Module
1063
+ }), t;
466
1064
  }
467
- function G(t) {
468
- switch (t.parentKind) {
469
- case H.SymbolKind.Module: {
470
- _e(t);
1065
+ function Oe(e) {
1066
+ switch (e.parentKind) {
1067
+ case he.SymbolKind.Module: {
1068
+ Cr(e);
471
1069
  break;
472
1070
  }
473
- case H.SymbolKind.Array: {
474
- Te(t);
1071
+ case he.SymbolKind.Array: {
1072
+ xr(e);
475
1073
  break;
476
1074
  }
477
1075
  default:
478
- je(t);
1076
+ $r(e);
479
1077
  }
480
1078
  }
481
- function _e(t) {
482
- t.children.forEach((e) => {
483
- var r;
484
- let n = t.parentPath;
485
- e.symbol && (n = t.parentPath ? `${t.parentPath}.${e.symbol.name}` : e.symbol.name, t.pathSymbolMap.set(n, e.symbol)), G({
486
- pathSymbolMap: t.pathSymbolMap,
487
- parentPath: n,
488
- children: e.children,
489
- parentKind: ((r = e == null ? void 0 : e.symbol) == null ? void 0 : r.kind) ?? t.parentKind
1079
+ function Cr(e) {
1080
+ e.children.forEach((t) => {
1081
+ var n;
1082
+ let r = e.parentPath;
1083
+ t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)), Oe({
1084
+ pathSymbolMap: e.pathSymbolMap,
1085
+ parentPath: r,
1086
+ children: t.children,
1087
+ parentKind: ((n = t == null ? void 0 : t.symbol) == null ? void 0 : n.kind) ?? e.parentKind
490
1088
  });
491
1089
  });
492
1090
  }
493
- function Te(t) {
494
- let e = 0;
495
- t.children.forEach((n) => {
496
- const r = t.parentPath ? `${t.parentPath}.${e}` : `${e}`;
497
- t.pathSymbolMap.set(r, n.symbol), e += 1, G({
498
- pathSymbolMap: t.pathSymbolMap,
499
- parentPath: r,
500
- children: n.children,
501
- parentKind: n.symbol.kind
1091
+ function xr(e) {
1092
+ let t = 0;
1093
+ e.children.forEach((r) => {
1094
+ const n = e.parentPath ? `${e.parentPath}.${t}` : `${t}`;
1095
+ e.pathSymbolMap.set(n, r.symbol), t += 1, Oe({
1096
+ pathSymbolMap: e.pathSymbolMap,
1097
+ parentPath: n,
1098
+ children: r.children,
1099
+ parentKind: r.symbol.kind
502
1100
  });
503
1101
  });
504
1102
  }
505
- function je(t) {
506
- const e = t.children.get("0");
507
- if (e) {
508
- const n = t.parentPath ? `${t.parentPath}.${e.symbol.name}` : e == null ? void 0 : e.symbol.name;
509
- t.pathSymbolMap.set(n, e.symbol);
1103
+ function $r(e) {
1104
+ const t = e.children.get("0");
1105
+ if (t) {
1106
+ const r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t == null ? void 0 : t.symbol.name;
1107
+ e.pathSymbolMap.set(r, t.symbol);
510
1108
  }
511
1109
  }
512
- function Ie({
513
- editorRef: t,
514
- inlineActions: e
1110
+ function Lr({
1111
+ editorRef: e,
1112
+ inlineActions: t
515
1113
  }) {
516
- w(() => L.languages.registerCodeLensProvider("yaml", {
517
- provideCodeLenses: async (r) => {
518
- var h;
519
- const a = await ne(r), o = re(a), s = (h = t == null ? void 0 : t.current) == null ? void 0 : h.addCommand(0, (l, { onClick: u, path: i, range: v, data: E }) => {
520
- u({ path: i, range: v, data: E });
1114
+ $(() => F.languages.registerCodeLensProvider("yaml", {
1115
+ provideCodeLenses: async (n) => {
1116
+ var l;
1117
+ const o = await Re(n), a = qe(o), i = (l = e == null ? void 0 : e.current) == null ? void 0 : l.addCommand(0, (f, { onClick: b, path: p, range: g, data: I }) => {
1118
+ b({ path: p, range: g, data: I });
521
1119
  });
522
- return s ? {
523
- lenses: Le({ pathSymbolMap: o, inlineActions: e, commandId: s }),
1120
+ return i ? {
1121
+ lenses: Pr({ pathSymbolMap: a, inlineActions: t, commandId: i }),
524
1122
  dispose: () => {
525
1123
  }
526
1124
  } : void 0;
527
1125
  }
528
- }).dispose, [e, t]);
529
- }
530
- const Ve = ({ editorRef: t, selection: e }) => {
531
- const [n, r] = _(), a = T(
532
- () => async (o, s, y) => {
533
- var v, E, c;
534
- const h = (v = t == null ? void 0 : t.current) == null ? void 0 : v.getModel();
535
- if (!h || !s)
536
- return r(void 0);
537
- const l = await ne(h), i = (E = re(l).get(s)) == null ? void 0 : E.range;
538
- i && (r(i), y && ((c = t == null ? void 0 : t.current) == null || c.revealLineInCenter(i.startLineNumber)));
1126
+ }).dispose, [t, e]);
1127
+ }
1128
+ const Ir = ({ editorRef: e, selection: t }) => {
1129
+ const [r, n] = A(), o = q(
1130
+ () => async (a, i, s) => {
1131
+ var g, I, w;
1132
+ const l = (g = e == null ? void 0 : e.current) == null ? void 0 : g.getModel();
1133
+ if (!l || !i)
1134
+ return n(void 0);
1135
+ const f = await Re(l), p = (I = qe(f).get(i)) == null ? void 0 : I.range;
1136
+ p && (n(p), s && ((w = e == null ? void 0 : e.current) == null || w.revealLineInCenter(p.startLineNumber)));
539
1137
  },
540
1138
  []
541
1139
  );
542
- w(() => {
1140
+ $(() => {
543
1141
  if ("requestIdleCallback" in window) {
544
- const o = requestIdleCallback(() => {
545
- a(t, e == null ? void 0 : e.path, e == null ? void 0 : e.revealInCenter);
1142
+ const a = requestIdleCallback(() => {
1143
+ o(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
546
1144
  });
547
- return () => cancelIdleCallback(o);
1145
+ return () => cancelIdleCallback(a);
548
1146
  } else {
549
- const o = setTimeout(() => {
550
- a(t, e == null ? void 0 : e.path, e == null ? void 0 : e.revealInCenter);
1147
+ const a = setTimeout(() => {
1148
+ o(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
551
1149
  }, 100);
552
- return () => clearTimeout(o);
1150
+ return () => clearTimeout(a);
553
1151
  }
554
- }, [e == null ? void 0 : e.path, e == null ? void 0 : e.revealInCenter, t, a]), w(() => {
555
- var s;
556
- if (!n)
1152
+ }, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, o]), $(() => {
1153
+ var i;
1154
+ if (!r)
557
1155
  return;
558
- const o = (s = t == null ? void 0 : t.current) == null ? void 0 : s.createDecorationsCollection([
1156
+ const a = (i = e == null ? void 0 : e.current) == null ? void 0 : i.createDecorationsCollection([
559
1157
  {
560
1158
  // TODO: check why startColumn is set to "end of row"
561
- range: { ...n, startColumn: 1 },
1159
+ range: { ...r, startColumn: 1 },
562
1160
  options: {
563
1161
  isWholeLine: !1,
564
- className: e == null ? void 0 : e.className
1162
+ className: t == null ? void 0 : t.className
565
1163
  }
566
1164
  }
567
1165
  ]);
568
- return () => o == null ? void 0 : o.clear();
569
- }, [n, t, e == null ? void 0 : e.className]);
570
- }, oe = ue({
1166
+ return () => a == null ? void 0 : a.clear();
1167
+ }, [r, e, t == null ? void 0 : t.className]);
1168
+ }, Be = Ge({
571
1169
  markers: [],
572
1170
  setMarkers: () => {
573
1171
  },
574
1172
  editor: null,
575
- setEditor: (t) => {
1173
+ setEditor: (e) => {
576
1174
  },
577
- updateCursorPosition: (t) => {
1175
+ updateCursorPosition: (e) => {
578
1176
  }
579
1177
  });
580
- function Ge({
581
- children: t
1178
+ function qr({
1179
+ children: e
582
1180
  }) {
583
- const [e, n] = _([]), [r, a] = _(null), o = q(
584
- (s) => {
585
- r == null || r.setPosition(s), r == null || r.focus();
1181
+ const [t, r] = A([]), [n, o] = A(null), a = G(
1182
+ (i) => {
1183
+ n == null || n.setPosition(i), n == null || n.revealLineInCenterIfOutsideViewport(i.lineNumber), n == null || n.focus();
586
1184
  },
587
- [r]
1185
+ [n]
588
1186
  );
589
- return /* @__PURE__ */ k.jsx(
590
- oe.Provider,
1187
+ return /* @__PURE__ */ U.jsx(
1188
+ Be.Provider,
591
1189
  {
592
1190
  value: {
593
- markers: e,
594
- setMarkers: n,
595
- editor: r,
596
- setEditor: a,
597
- updateCursorPosition: o
1191
+ markers: t,
1192
+ setMarkers: r,
1193
+ editor: n,
1194
+ setEditor: o,
1195
+ updateCursorPosition: a
598
1196
  },
599
- children: t
1197
+ children: e
600
1198
  }
601
1199
  );
602
1200
  }
603
- function ae() {
604
- return de(oe);
605
- }
606
- const Ae = ({ monacoRef: t }) => {
607
- const { setMarkers: e } = ae();
608
- w(() => {
609
- let n;
610
- const r = setTimeout(() => {
611
- var o;
612
- const a = (o = t.current) == null ? void 0 : o.editor;
613
- a && (n = a.onDidChangeMarkers(([s]) => {
614
- const y = a.getModelMarkers({ resource: s });
615
- e(y);
1201
+ function He() {
1202
+ return Je(Be);
1203
+ }
1204
+ const Nr = ({ monacoRef: e }) => {
1205
+ const { setMarkers: t } = He();
1206
+ $(() => {
1207
+ let r;
1208
+ const n = setTimeout(() => {
1209
+ var a;
1210
+ const o = (a = e.current) == null ? void 0 : a.editor;
1211
+ o && (r = o.onDidChangeMarkers(([i]) => {
1212
+ const s = o.getModelMarkers({ resource: i });
1213
+ t(s);
616
1214
  }));
617
1215
  }, 100);
618
1216
  return () => {
619
- clearTimeout(r), n == null || n.dispose();
1217
+ clearTimeout(n), r == null || r.dispose();
620
1218
  };
621
- }, [t]);
1219
+ }, [e]);
622
1220
  };
623
- let Q = !1;
624
- function Ue(t) {
625
- if (Q)
1221
+ let Ie = !1;
1222
+ function Dr(e) {
1223
+ if (Ie)
626
1224
  return;
627
- const e = {
1225
+ const t = {
628
1226
  hover: !0,
629
1227
  completion: !0,
630
1228
  enableSchemaRequest: !1,
631
1229
  validate: !0,
632
- schemas: [t]
1230
+ schemas: [e]
633
1231
  };
634
- Q = !0, he.setDiagnosticsOptions({ ...e });
1232
+ Ie = !0, Xe.setDiagnosticsOptions({ ...t });
635
1233
  }
636
- const se = (t) => fe.parse(`file://${t}`).toString(), Be = (t) => {
637
- const { schemaConfig: e, instanceId: n } = t;
638
- w(() => {
639
- e != null && e.schema && Ue({
1234
+ const We = (e) => Qe.parse(`file://${e}`).toString(), Tr = (e) => {
1235
+ const { schemaConfig: t, instanceId: r } = e;
1236
+ $(() => {
1237
+ t != null && t.schema && Dr({
640
1238
  // If YAML file is opened matching this glob
641
- fileMatch: [se(n.toString())],
642
- ...e
1239
+ fileMatch: [We(r.toString())],
1240
+ ...t
643
1241
  });
644
- }, [e == null ? void 0 : e.schema, n]);
1242
+ }, [t == null ? void 0 : t.schema, r]);
645
1243
  };
646
- A.config({ monaco: L });
647
- const ze = {
648
- ...z,
1244
+ H.config({ monaco: F });
1245
+ const kr = {
1246
+ ...le,
649
1247
  folding: !0
650
- }, Je = function(e) {
1248
+ }, Br = function(t) {
651
1249
  const {
652
- yamlRevision: n,
653
- schemaConfig: r,
654
- inlineActions: a,
655
- themeConfig: o,
656
- onYamlRevisionChange: s,
657
- selection: y,
658
- theme: h,
659
- options: l,
660
- animateOnUpdate: u = !1,
661
- onAnimateEnd: i
662
- } = e, v = U(), [E] = _("yaml"), { editor: c, setEditor: b } = ae(), d = P(null), f = P(), C = P({ yaml: "", revisionId: 0 }), S = P(null), N = P(null), D = q(
663
- (m) => {
664
- var g, O, M;
665
- const p = m.split(`
666
- `), $ = (g = S.current) == null ? void 0 : g.getModel();
667
- if ($) {
668
- (O = S.current) == null || O.pushUndoStop(), $.setValue("");
669
- let x = 0;
670
- N.current = window.setInterval(() => {
671
- var I;
672
- x < p.length ? (v && ((I = S.current) == null || I.executeEdits("addLine", [
1250
+ yamlRevision: r,
1251
+ schemaConfig: n,
1252
+ inlineActions: o,
1253
+ themeConfig: a,
1254
+ onYamlRevisionChange: i,
1255
+ selection: s,
1256
+ theme: l,
1257
+ options: f,
1258
+ animateOnUpdate: b = !1,
1259
+ onAnimateEnd: p
1260
+ } = t, g = se(), [I] = A("yaml"), { editor: w, setEditor: k } = He(), M = y(null), O = y(), m = y({ yaml: "", revisionId: 0 }), j = y(null), D = y(null), E = G(
1261
+ (d) => {
1262
+ var C, T, L;
1263
+ const u = d.split(`
1264
+ `), N = (C = j.current) == null ? void 0 : C.getModel();
1265
+ if (N) {
1266
+ (T = j.current) == null || T.pushUndoStop(), N.setValue("");
1267
+ let c = 0;
1268
+ D.current = window.setInterval(() => {
1269
+ var h;
1270
+ c < u.length ? (g && ((h = j.current) == null || h.executeEdits("addLine", [
673
1271
  {
674
- range: new v.Range(x + 1, 1, x + 1, 1),
675
- text: p[x] + `
1272
+ range: new g.Range(c + 1, 1, c + 1, 1),
1273
+ text: u[c] + `
676
1274
  `
677
1275
  }
678
- ])), x++) : N.current && (clearInterval(N.current), i == null || i());
679
- }, 100), (M = S.current) == null || M.pushUndoStop();
1276
+ ])), c++) : D.current && (clearInterval(D.current), p == null || p());
1277
+ }, 100), (L = j.current) == null || L.pushUndoStop();
680
1278
  }
681
1279
  },
682
- [v]
1280
+ [g]
683
1281
  );
684
- w(() => () => {
685
- N.current && clearInterval(N.current);
1282
+ $(() => () => {
1283
+ D.current && clearInterval(D.current);
686
1284
  }, []);
687
- function j(m, p) {
688
- S.current = m, f.current = p, m.setValue(n.yaml), b(m), setTimeout(() => {
689
- var $;
690
- ($ = d.current) != null && $.style && (d.current.style.opacity = "1");
1285
+ function P(d, u) {
1286
+ j.current = d, O.current = u, d.setValue(r.yaml), k(d), setTimeout(() => {
1287
+ var N;
1288
+ (N = M.current) != null && N.style && (M.current.style.opacity = "1");
691
1289
  }, 50);
692
1290
  }
693
- w(() => {
694
- var m;
695
- if (S.current && (!n.revisionId || n.revisionId > Number((m = C.current) == null ? void 0 : m.revisionId))) {
696
- const p = S.current.getModel();
697
- p && (S.current.executeEdits("edit", [
1291
+ $(() => {
1292
+ var d;
1293
+ if (j.current && (!r.revisionId || r.revisionId > Number((d = m.current) == null ? void 0 : d.revisionId))) {
1294
+ const u = j.current.getModel();
1295
+ u && (j.current.executeEdits("edit", [
698
1296
  {
699
- range: p.getFullModelRange(),
700
- text: u ? "" : n.yaml
1297
+ range: u.getFullModelRange(),
1298
+ text: b ? "" : r.yaml
701
1299
  }
702
- ]), u && D(n.yaml));
1300
+ ]), b && E(r.yaml));
703
1301
  }
704
- }, [D, n, u]), Be({ schemaConfig: r, instanceId: E }), Ie({ editorRef: S, inlineActions: a });
705
- const { theme: R } = F({ monacoRef: f, themeConfig: o, editor: c, theme: h });
706
- Ae({ monacoRef: f }), Ve({ editorRef: S, selection: y });
707
- const W = T(
1302
+ }, [E, r, b]), Tr({ schemaConfig: n, instanceId: I }), Lr({ editorRef: j, inlineActions: o });
1303
+ const { theme: S } = de({ monacoRef: O, themeConfig: a, editor: w, theme: l });
1304
+ Nr({ monacoRef: O }), Ir({ editorRef: j, selection: s });
1305
+ const z = q(
708
1306
  () => ({
709
- ...ze,
710
- ...l
1307
+ ...kr,
1308
+ ...f
711
1309
  }),
712
- [l]
1310
+ [f]
713
1311
  );
714
- return /* @__PURE__ */ k.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: d, children: /* @__PURE__ */ k.jsx(
715
- Z,
1312
+ return /* @__PURE__ */ U.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: M, children: /* @__PURE__ */ U.jsx(
1313
+ we,
716
1314
  {
717
- onChange: (m, p) => {
718
- C.current = { yaml: m ?? "", revisionId: p.versionId }, s({ ...C.current }, p);
1315
+ onChange: (d, u) => {
1316
+ m.current = { yaml: d ?? "", revisionId: u.versionId }, i({ ...m.current }, u);
719
1317
  },
720
1318
  language: "yaml",
721
- theme: R,
722
- options: W,
723
- path: se(E),
724
- onMount: j
1319
+ theme: S,
1320
+ options: z,
1321
+ path: We(I),
1322
+ onMount: P
725
1323
  }
726
1324
  ) });
727
1325
  };
728
1326
  export {
729
- Ke as BlameEditor,
730
- Ze as CodeDiffEditor,
731
- qe as CodeEditor,
732
- K as MonacoGlobals,
733
- te as SelectorType,
734
- Je as YamlEditor,
735
- oe as YamlEditorContext,
736
- Ge as YamlEditorContextProvider,
737
- ae as useYamlEditorContext
1327
+ zr as BlameEditor,
1328
+ Rr as CodeDiffEditor,
1329
+ Fr as CodeEditor,
1330
+ ve as MonacoGlobals,
1331
+ Fe as SelectorType,
1332
+ Br as YamlEditor,
1333
+ Be as YamlEditorContext,
1334
+ qr as YamlEditorContextProvider,
1335
+ He as useYamlEditorContext
738
1336
  };
739
1337
  //# sourceMappingURL=index.js.map