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