@harnessio/yaml-editor 0.20.0 → 0.22.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.
@@ -17,5 +17,6 @@ export interface BlameEditorProps {
17
17
  showSeparators?: boolean;
18
18
  height?: EditorProps['height'];
19
19
  options?: monaco.editor.IStandaloneEditorConstructionOptions;
20
+ className?: string;
20
21
  }
21
- export declare function BlameEditor({ code, language, themeConfig, lineNumbersPosition, blameData, showSeparators, theme: themeFromProps, height, options }: BlameEditorProps): JSX.Element;
22
+ export declare function BlameEditor({ code, language, themeConfig, lineNumbersPosition, blameData, showSeparators, theme: themeFromProps, height, options, className }: BlameEditorProps): JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { EditorProps } from '@monaco-editor/react';
2
+ import { BlameItem } from '../types/blame';
3
+ import { ThemeDefinition } from '../types/themes';
4
+
5
+ import * as monaco from 'monaco-editor';
6
+ export interface BlameEditorV2Props {
7
+ code: string;
8
+ language: string;
9
+ themeConfig?: {
10
+ rootElementSelector?: string;
11
+ defaultTheme?: string;
12
+ themes?: ThemeDefinition[];
13
+ };
14
+ theme?: string;
15
+ lineNumbersPosition?: 'left' | 'center';
16
+ blameData: BlameItem[];
17
+ height?: EditorProps['height'];
18
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
19
+ className?: string;
20
+ }
21
+ export declare function BlameEditorV2({ code, language, themeConfig, lineNumbersPosition, blameData, theme: themeFromProps, height, options, className }: BlameEditorV2Props): JSX.Element;
@@ -8,7 +8,7 @@ export interface CodeRevision {
8
8
  }
9
9
  export interface CodeEditorProps<_> {
10
10
  codeRevision: CodeRevision;
11
- onCodeRevisionChange: (codeRevision: CodeRevision | undefined, ev: monaco.editor.IModelContentChangedEvent) => void;
11
+ onCodeRevisionChange?: (codeRevision: CodeRevision | undefined, ev: monaco.editor.IModelContentChangedEvent) => void;
12
12
  language: string;
13
13
  themeConfig?: {
14
14
  rootElementSelector?: string;
@@ -19,5 +19,10 @@ export interface CodeEditorProps<_> {
19
19
  options?: monaco.editor.IStandaloneEditorConstructionOptions;
20
20
  height?: EditorProps['height'];
21
21
  className?: string;
22
+ enableLinesSelection?: boolean;
23
+ selectedLine?: number;
24
+ onSelectedLineChange?: (line: number | undefined) => void;
25
+ onSelectedLineButtonClick?: (ev: HTMLDivElement | undefined) => void;
26
+ highlightKeyword?: string;
22
27
  }
23
- export declare function CodeEditor<T>({ codeRevision, onCodeRevisionChange, language, themeConfig, options, theme: themeFromProps, height, className }: CodeEditorProps<T>): JSX.Element;
28
+ export declare function CodeEditor<T>({ codeRevision, onCodeRevisionChange, language, themeConfig, options, theme: themeFromProps, enableLinesSelection, selectedLine, onSelectedLineChange, onSelectedLineButtonClick, highlightKeyword, height, className }: CodeEditorProps<T>): JSX.Element;
@@ -32,5 +32,6 @@ export interface YamlEditorProps<T> {
32
32
  animateOnUpdate?: boolean;
33
33
  onAnimateEnd?: () => void;
34
34
  instanceId?: string;
35
+ height?: string | number;
35
36
  }
36
37
  export declare const YamlEditor: <T>(props: YamlEditorProps<T>) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as monaco from 'monaco-editor';
2
+ export interface UseHighlightProps {
3
+ editor?: monaco.editor.IStandaloneCodeEditor;
4
+ keyword?: string;
5
+ }
6
+ export declare function useHighlight(props: UseHighlightProps): void;
@@ -0,0 +1,9 @@
1
+ import * as monaco from 'monaco-editor';
2
+ export interface UseLinesSelectionProps {
3
+ enable: boolean;
4
+ editor?: monaco.editor.IStandaloneCodeEditor;
5
+ selectedLine?: number;
6
+ onSelectedLineChange?: (line: number | undefined) => void;
7
+ onSelectedLineButtonClick?: (ev: HTMLDivElement | undefined) => void;
8
+ }
9
+ export declare function useLinesSelection(props: UseLinesSelectionProps): void;
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
- "use strict";var qe=Object.defineProperty;var Ye=(e,t,r)=>t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Se=(e,t,r)=>(Ye(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),J=require("monaco-editor"),me=require("monaco-yaml");function Be(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const V=Be(J);var Ie={exports:{}},X={};/*
1
+ "use strict";var Ge=Object.defineProperty;var Ke=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Oe=(e,t,n)=>(Ke(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),J=require("monaco-editor"),Ze=require("react-dom"),he=require("monaco-yaml");function Je(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const H=Je(J);var Re={exports:{}},X={};/*
2
2
  object-assign
3
3
  (c) Sindre Sorhus
4
4
  @license MIT
5
- */var we=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;function Ke(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Ge(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(a){return t[a]});if(n.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(a){o[a]=a}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Ge();/** @license React v17.0.2
5
+ */var je=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable;function et(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function tt(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(i){return t[i]});if(r.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(i){o[i]=i}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}tt();/** @license React v17.0.2
6
6
  * react-jsx-runtime.production.min.js
7
7
  *
8
8
  * Copyright (c) Facebook, Inc. and its affiliates.
9
9
  *
10
10
  * This source code is licensed under the MIT license found in the
11
11
  * LICENSE file in the root directory of this source tree.
12
- */var Ze=i,De=60103;X.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var Me=Symbol.for;De=Me("react.element"),X.Fragment=Me("react.fragment")}var Je=Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qe=Object.prototype.hasOwnProperty,Xe={key:!0,ref:!0,__self:!0,__source:!0};function Te(e,t,r){var n,o={},a=null,c=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Qe.call(t,n)&&!Xe.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:De,type:e,key:a,ref:c,props:o,_owner:Je.current}}X.jsx=Te;X.jsxs=Te;Ie.exports=X;var A=Ie.exports;function et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function je(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(r),!0).forEach(function(n){et(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ee(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tt(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function rt(e,t){if(e==null)return{};var r=tt(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nt(e,t){return ot(e)||at(e,t)||it(e,t)||ct()}function ot(e){if(Array.isArray(e))return e}function at(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var c=e[Symbol.iterator](),s;!(n=(s=c.next()).done)&&(r.push(s.value),!(t&&r.length===t));n=!0);}catch(f){o=!0,a=f}finally{try{!n&&c.return!=null&&c.return()}finally{if(o)throw a}}return r}}function it(e,t){if(e){if(typeof e=="string")return Pe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pe(e,t)}}function Pe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ut(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xe(Object(r),!0).forEach(function(n){ut(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function st(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,a){return a(o)},n)}}function K(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function ne(e){return{}.toString.call(e).includes("Object")}function lt(e){return!Object.keys(e).length}function Q(e){return typeof e=="function"}function ft(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dt(e,t){return ne(t)||z("changeType"),Object.keys(t).some(function(r){return!ft(e,r)})&&z("changeField"),t}function mt(e){Q(e)||z("selectorType")}function pt(e){Q(e)||ne(e)||z("handlerType"),ne(e)&&Object.values(e).some(function(t){return!Q(t)})&&z("handlersType")}function gt(e){e||z("initialIsRequired"),ne(e)||z("initialType"),lt(e)&&z("initialContent")}function ht(e,t){throw new Error(e[t]||e.default)}var vt={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},z=K(ht)(vt),te={changes:dt,selector:mt,handler:pt,initial:gt};function bt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};te.initial(e),te.handler(t);var r={current:e},n=K(St)(r,t),o=K(Ot)(r),a=K(te.changes)(e),c=K(yt)(r);function s(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(h){return h};return te.selector(l),l(r.current)}function f(l){st(n,o,a,c)(l)}return[s,f]}function yt(e,t){return Q(t)?t(e.current):t}function Ot(e,t){return e.current=Ce(Ce({},e.current),t),t}function St(e,t,r){return Q(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var wt={create:bt},Mt={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function Et(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function jt(e){return{}.toString.call(e).includes("Object")}function Pt(e){return e||$e("configIsRequired"),jt(e)||$e("configType"),e.urls?(xt(),{paths:{vs:e.urls.monacoBase}}):e}function xt(){console.warn(Le.deprecation)}function Ct(e,t){throw new Error(e[t]||e.default)}var Le={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
12
+ */var nt=a,Te=60103;X.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var xe=Symbol.for;Te=xe("react.element"),X.Fragment=xe("react.fragment")}var rt=nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ot=Object.prototype.hasOwnProperty,it={key:!0,ref:!0,__self:!0,__source:!0};function De(e,t,n){var r,o={},i=null,c=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(r in t)ot.call(t,r)&&!it.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Te,type:e,key:i,ref:c,props:o,_owner:rt.current}}X.jsx=De;X.jsxs=De;Re.exports=X;var _=Re.exports;function at(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pe(Object(n),!0).forEach(function(r){at(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pe(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ct(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function st(e,t){if(e==null)return{};var n=ct(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ut(e,t){return lt(e)||ft(e,t)||dt(e,t)||mt()}function lt(e){if(Array.isArray(e))return e}function ft(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,i=void 0;try{for(var c=e[Symbol.iterator](),l;!(r=(l=c.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(f){o=!0,i=f}finally{try{!r&&c.return!=null&&c.return()}finally{if(o)throw i}}return n}}function dt(e,t){if(e){if(typeof e=="string")return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $e(e,t)}}function $e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ie(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function gt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,i){return i(o)},r)}}function G(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,l=new Array(c),f=0;f<c;f++)l[f]=arguments[f];return t.apply(n,[].concat(o,l))}}}function ae(e){return{}.toString.call(e).includes("Object")}function ht(e){return!Object.keys(e).length}function Q(e){return typeof e=="function"}function vt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yt(e,t){return ae(t)||q("changeType"),Object.keys(t).some(function(n){return!vt(e,n)})&&q("changeField"),t}function bt(e){Q(e)||q("selectorType")}function Mt(e){Q(e)||ae(e)||q("handlerType"),ae(e)&&Object.values(e).some(function(t){return!Q(t)})&&q("handlersType")}function Et(e){e||q("initialIsRequired"),ae(e)||q("initialType"),ht(e)&&q("initialContent")}function wt(e,t){throw new Error(e[t]||e.default)}var St={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},q=G(wt)(St),oe={changes:yt,selector:bt,handler:Mt,initial:Et};function Ot(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};oe.initial(e),oe.handler(t);var n={current:e},r=G(Pt)(n,t),o=G(xt)(n),i=G(oe.changes)(e),c=G(jt)(n);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(v){return v};return oe.selector(d),d(n.current)}function f(d){gt(r,o,i,c)(d)}return[l,f]}function jt(e,t){return Q(t)?t(e.current):t}function xt(e,t){return e.current=Ne(Ne({},e.current),t),t}function Pt(e,t,n){return Q(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var Ct={create:Ot},$t={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function It(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,l=new Array(c),f=0;f<c;f++)l[f]=arguments[f];return t.apply(n,[].concat(o,l))}}}function Nt(e){return{}.toString.call(e).includes("Object")}function Lt(e){return e||Le("configIsRequired"),Nt(e)||Le("configType"),e.urls?(Rt(),{paths:{vs:e.urls.monacoBase}}):e}function Rt(){console.warn(_e.deprecation)}function Tt(e,t){throw new Error(e[t]||e.default)}var _e={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
14
14
  You are using deprecated way of configuration.
15
15
 
16
16
  Instead of using
@@ -19,7 +19,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
19
19
  monaco.config({ paths: { vs: '...' } })
20
20
 
21
21
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
22
- `},$e=Et(Ct)(Le),$t={config:Pt},It=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(a,c){return c(a)},o)}};function Re(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Re(e[r],t[r]))}),je(je({},e),t)}var Dt={type:"cancelation",msg:"operation is manually canceled"};function se(e){var t=!1,r=new Promise(function(n,o){e.then(function(a){return t?o(Dt):n(a)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var Tt=wt.create({config:Mt,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ne=nt(Tt,2),ee=Ne[0],ae=Ne[1];function Lt(e){var t=$t.config(e),r=t.monaco,n=rt(t,["monaco"]);ae(function(o){return{config:Re(o.config,n),monaco:r}})}function Rt(){var e=ee(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(ae({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),se(le);if(window.monaco&&window.monaco.editor)return ke(window.monaco),e.resolve(window.monaco),se(le);It(Nt,_t)(At)}return se(le)}function Nt(e){return document.body.appendChild(e)}function kt(e){var t=document.createElement("script");return e&&(t.src=e),t}function _t(e){var t=ee(function(n){var o=n.config,a=n.reject;return{config:o,reject:a}}),r=kt("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function At(){var e=ee(function(r){var n=r.config,o=r.resolve,a=r.reject;return{config:n,resolve:o,reject:a}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){ke(r),e.resolve(r)},function(r){e.reject(r)})}function ke(e){ee().monaco||ae({monaco:e})}function Vt(){return ee(function(e){var t=e.monaco;return t})}var le=new Promise(function(e,t){return ae({resolve:e,reject:t})}),q={config:Lt,init:Rt,__getMonacoInstance:Vt},Ut={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},fe=Ut,Ft={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},zt=Ft;function qt({children:e}){return i.createElement("div",{style:zt.container},e)}var Yt=qt,Bt=Yt;function Ht({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:a,wrapperProps:c}){return i.createElement("section",{style:{...fe.wrapper,width:e,height:t},...c},!r&&i.createElement(Bt,null,n),i.createElement("div",{ref:o,style:{...fe.fullWidth,...!r&&fe.hide},className:a}))}var Wt=Ht,_e=i.memo(Wt);function Kt(e){i.useEffect(e,[])}var pe=Kt;function Gt(e,t,r=!0){let n=i.useRef(!0);i.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var _=Gt;function G(){}function B(e,t,r,n){return Zt(e,n)||Jt(e,t,r,n)}function Zt(e,t){return e.editor.getModel(Ae(e,t))}function Jt(e,t,r,n){return e.editor.createModel(t,r,n?Ae(e,n):void 0)}function Ae(e,t){return e.Uri.parse(t)}function Qt({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:a,modifiedModelPath:c,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:f=!1,theme:l="light",loading:h="Loading...",options:m={},height:g="100%",width:I="100%",className:v,wrapperProps:R={},beforeMount:C=G,onMount:S=G}){let[b,L]=i.useState(!1),[x,M]=i.useState(!0),E=i.useRef(null),j=i.useRef(null),U=i.useRef(null),w=i.useRef(S),d=i.useRef(C),P=i.useRef(!1);pe(()=>{let u=q.init();return u.then(y=>(j.current=y)&&M(!1)).catch(y=>(y==null?void 0:y.type)!=="cancelation"&&console.error("Monaco initialization: error:",y)),()=>E.current?D():u.cancel()}),_(()=>{if(E.current&&j.current){let u=E.current.getOriginalEditor(),y=B(j.current,e||"",n||r||"text",a||"");y!==u.getModel()&&u.setModel(y)}},[a],b),_(()=>{if(E.current&&j.current){let u=E.current.getModifiedEditor(),y=B(j.current,t||"",o||r||"text",c||"");y!==u.getModel()&&u.setModel(y)}},[c],b),_(()=>{let u=E.current.getModifiedEditor();u.getOption(j.current.editor.EditorOption.readOnly)?u.setValue(t||""):t!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[t],b),_(()=>{var u,y;(y=(u=E.current)==null?void 0:u.getModel())==null||y.original.setValue(e||"")},[e],b),_(()=>{let{original:u,modified:y}=E.current.getModel();j.current.editor.setModelLanguage(u,n||r||"text"),j.current.editor.setModelLanguage(y,o||r||"text")},[r,n,o],b),_(()=>{var u;(u=j.current)==null||u.editor.setTheme(l)},[l],b),_(()=>{var u;(u=E.current)==null||u.updateOptions(m)},[m],b);let p=i.useCallback(()=>{var N;if(!j.current)return;d.current(j.current);let u=B(j.current,e||"",n||r||"text",a||""),y=B(j.current,t||"",o||r||"text",c||"");(N=E.current)==null||N.setModel({original:u,modified:y})},[r,t,o,e,n,a,c]),T=i.useCallback(()=>{var u;!P.current&&U.current&&(E.current=j.current.editor.createDiffEditor(U.current,{automaticLayout:!0,...m}),p(),(u=j.current)==null||u.editor.setTheme(l),L(!0),P.current=!0)},[m,l,p]);i.useEffect(()=>{b&&w.current(E.current,j.current)},[b]),i.useEffect(()=>{!x&&!b&&T()},[x,b,T]);function D(){var y,N,F,H;let u=(y=E.current)==null?void 0:y.getModel();s||((N=u==null?void 0:u.original)==null||N.dispose()),f||((F=u==null?void 0:u.modified)==null||F.dispose()),(H=E.current)==null||H.dispose()}return i.createElement(_e,{width:I,height:g,isEditorReady:b,loading:h,_ref:U,className:v,wrapperProps:R})}var Xt=Qt,er=i.memo(Xt);function tr(){let[e,t]=i.useState(q.__getMonacoInstance());return pe(()=>{let r;return e||(r=q.init(),r.then(n=>{t(n)})),()=>r==null?void 0:r.cancel()}),e}var ie=tr;function rr(e){let t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}var nr=rr,re=new Map;function or({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:a,theme:c="light",line:s,loading:f="Loading...",options:l={},overrideServices:h={},saveViewState:m=!0,keepCurrentModel:g=!1,width:I="100%",height:v="100%",className:R,wrapperProps:C={},beforeMount:S=G,onMount:b=G,onChange:L,onValidate:x=G}){let[M,E]=i.useState(!1),[j,U]=i.useState(!0),w=i.useRef(null),d=i.useRef(null),P=i.useRef(null),p=i.useRef(b),T=i.useRef(S),D=i.useRef(),u=i.useRef(n),y=nr(a),N=i.useRef(!1),F=i.useRef(!1);pe(()=>{let O=q.init();return O.then($=>(w.current=$)&&U(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>d.current?ze():O.cancel()}),_(()=>{var $,k,W,Y;let O=B(w.current,e||n||"",t||o||"",a||r||"");O!==(($=d.current)==null?void 0:$.getModel())&&(m&&re.set(y,(k=d.current)==null?void 0:k.saveViewState()),(W=d.current)==null||W.setModel(O),m&&((Y=d.current)==null||Y.restoreViewState(re.get(a))))},[a],M),_(()=>{var O;(O=d.current)==null||O.updateOptions(l)},[l],M),_(()=>{!d.current||n===void 0||(d.current.getOption(w.current.editor.EditorOption.readOnly)?d.current.setValue(n):n!==d.current.getValue()&&(F.current=!0,d.current.executeEdits("",[{range:d.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),d.current.pushUndoStop(),F.current=!1))},[n],M),_(()=>{var $,k;let O=($=d.current)==null?void 0:$.getModel();O&&o&&((k=w.current)==null||k.editor.setModelLanguage(O,o))},[o],M),_(()=>{var O;s!==void 0&&((O=d.current)==null||O.revealLine(s))},[s],M),_(()=>{var O;(O=w.current)==null||O.editor.setTheme(c)},[c],M);let H=i.useCallback(()=>{var O;if(!(!P.current||!w.current)&&!N.current){T.current(w.current);let $=a||r,k=B(w.current,n||e||"",t||o||"",$||"");d.current=(O=w.current)==null?void 0:O.editor.create(P.current,{model:k,automaticLayout:!0,...l},h),m&&d.current.restoreViewState(re.get($)),w.current.editor.setTheme(c),s!==void 0&&d.current.revealLine(s),E(!0),N.current=!0}},[e,t,r,n,o,a,l,h,m,c,s]);i.useEffect(()=>{M&&p.current(d.current,w.current)},[M]),i.useEffect(()=>{!j&&!M&&H()},[j,M,H]),u.current=n,i.useEffect(()=>{var O,$;M&&L&&((O=D.current)==null||O.dispose(),D.current=($=d.current)==null?void 0:$.onDidChangeModelContent(k=>{F.current||L(d.current.getValue(),k)}))},[M,L]),i.useEffect(()=>{if(M){let O=w.current.editor.onDidChangeMarkers($=>{var W;let k=(W=d.current.getModel())==null?void 0:W.uri;if(k&&$.find(Y=>Y.path===k.path)){let Y=w.current.editor.getModelMarkers({resource:k});x==null||x(Y)}});return()=>{O==null||O.dispose()}}return()=>{}},[M,x]);function ze(){var O,$;(O=D.current)==null||O.dispose(),g?m&&re.set(a,d.current.saveViewState()):($=d.current.getModel())==null||$.dispose(),d.current.dispose()}return i.createElement(_e,{width:I,height:v,isEditorReady:M,loading:f,_ref:P,className:R,wrapperProps:C})}var ar=or,ir=i.memo(ar),ge=ir;const ce={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,padding:{top:16,bottom:16},minimap:{enabled:!1},fontSize:14,fontFamily:'"JetBrains Mono", "monospace"',lineHeight:20,scrollbar:{verticalScrollbarSize:14,horizontalScrollbarSize:14,verticalSliderSize:6,horizontalSliderSize:6},overviewRulerBorder:!1,overviewRulerLanes:0,renderLineHighlight:"none",automaticLayout:!0},ue=e=>{const{themeConfig:t,editor:r,theme:n}=e,{defaultTheme:o}=t??{},[a,c]=i.useState(n??o??"vs-dark");return i.useEffect(()=>{var s;(s=t==null?void 0:t.monacoThemes)==null||s.forEach(f=>{V.editor.defineTheme(f.themeName,f.themeData)})},[V]),i.useEffect(()=>{V.editor&&n&&(V.editor.setTheme(n),c(n))},[r,n]),{theme:a}};function cr(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let r="";for(let n=0;n<e;n++)r+=t.charAt(Math.floor(Math.random()*t.length));return r}function ur(e){return e.replace("'","&#39;")}const sr=e=>{const t=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(e<60)return t.format(-e,"second");const r=Math.floor(e/60);if(r<60)return t.format(-r,"minute");const n=Math.floor(r/60);if(n<24)return t.format(-n,"hour");const o=Math.floor(n/24);if(o<30)return t.format(-o,"day");const a=Math.floor(o/30);if(a<12)return t.format(-a,"month");const c=Math.floor(a/12);return t.format(-c,"year")},lr=e=>{const t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.abs(n);return sr(o)};function fr({instanceId:e,lineNumbersPosition:t}){let r="";return t==="center"&&(r+=`
22
+ `},Le=It(Tt)(_e),Dt={config:Lt},_t=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(i,c){return c(i)},o)}};function ke(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],ke(e[n],t[n]))}),Ce(Ce({},e),t)}var kt={type:"cancelation",msg:"operation is manually canceled"};function le(e){var t=!1,n=new Promise(function(r,o){e.then(function(i){return t?o(kt):r(i)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var Vt=Ct.create({config:$t,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ve=ut(Vt,2),ee=Ve[0],se=Ve[1];function At(e){var t=Dt.config(e),n=t.monaco,r=st(t,["monaco"]);se(function(o){return{config:ke(o.config,r),monaco:n}})}function Ht(){var e=ee(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(se({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),le(fe);if(window.monaco&&window.monaco.editor)return Ae(window.monaco),e.resolve(window.monaco),le(fe);_t(zt,Ft)(qt)}return le(fe)}function zt(e){return document.body.appendChild(e)}function Ut(e){var t=document.createElement("script");return e&&(t.src=e),t}function Ft(e){var t=ee(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),n=Ut("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function qt(){var e=ee(function(n){var r=n.config,o=n.resolve,i=n.reject;return{config:r,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){Ae(n),e.resolve(n)},function(n){e.reject(n)})}function Ae(e){ee().monaco||se({monaco:e})}function Wt(){return ee(function(e){var t=e.monaco;return t})}var fe=new Promise(function(e,t){return se({resolve:e,reject:t})}),U={config:At,init:Ht,__getMonacoInstance:Wt},Bt={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},de=Bt,Yt={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Gt=Yt;function Kt({children:e}){return a.createElement("div",{style:Gt.container},e)}var Zt=Kt,Jt=Zt;function Qt({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:i,wrapperProps:c}){return a.createElement("section",{style:{...de.wrapper,width:e,height:t},...c},!n&&a.createElement(Jt,null,r),a.createElement("div",{ref:o,style:{...de.fullWidth,...!n&&de.hide},className:i}))}var Xt=Qt,He=a.memo(Xt);function en(e){a.useEffect(e,[])}var ve=en;function tn(e,t,n=!0){let r=a.useRef(!0);a.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var A=tn;function K(){}function B(e,t,n,r){return nn(e,r)||rn(e,t,n,r)}function nn(e,t){return e.editor.getModel(ze(e,t))}function rn(e,t,n,r){return e.editor.createModel(t,n,r?ze(e,r):void 0)}function ze(e,t){return e.Uri.parse(t)}function on({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:c,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:f=!1,theme:d="light",loading:v="Loading...",options:m={},height:y="100%",width:$="100%",className:h,wrapperProps:N={},beforeMount:L=K,onMount:I=K}){let[O,D]=a.useState(!1),[T,b]=a.useState(!0),C=a.useRef(null),E=a.useRef(null),x=a.useRef(null),j=a.useRef(I),u=a.useRef(L),w=a.useRef(!1);ve(()=>{let s=U.init();return s.then(M=>(E.current=M)&&b(!1)).catch(M=>(M==null?void 0:M.type)!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>C.current?S():s.cancel()}),A(()=>{if(C.current&&E.current){let s=C.current.getOriginalEditor(),M=B(E.current,e||"",r||n||"text",i||"");M!==s.getModel()&&s.setModel(M)}},[i],O),A(()=>{if(C.current&&E.current){let s=C.current.getModifiedEditor(),M=B(E.current,t||"",o||n||"text",c||"");M!==s.getModel()&&s.setModel(M)}},[c],O),A(()=>{let s=C.current.getModifiedEditor();s.getOption(E.current.editor.EditorOption.readOnly)?s.setValue(t||""):t!==s.getValue()&&(s.executeEdits("",[{range:s.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),s.pushUndoStop())},[t],O),A(()=>{var s,M;(M=(s=C.current)==null?void 0:s.getModel())==null||M.original.setValue(e||"")},[e],O),A(()=>{let{original:s,modified:M}=C.current.getModel();E.current.editor.setModelLanguage(s,r||n||"text"),E.current.editor.setModelLanguage(M,o||n||"text")},[n,r,o],O),A(()=>{var s;(s=E.current)==null||s.editor.setTheme(d)},[d],O),A(()=>{var s;(s=C.current)==null||s.updateOptions(m)},[m],O);let g=a.useCallback(()=>{var k;if(!E.current)return;u.current(E.current);let s=B(E.current,e||"",r||n||"text",i||""),M=B(E.current,t||"",o||n||"text",c||"");(k=C.current)==null||k.setModel({original:s,modified:M})},[n,t,o,e,r,i,c]),p=a.useCallback(()=>{var s;!w.current&&x.current&&(C.current=E.current.editor.createDiffEditor(x.current,{automaticLayout:!0,...m}),g(),(s=E.current)==null||s.editor.setTheme(d),D(!0),w.current=!0)},[m,d,g]);a.useEffect(()=>{O&&j.current(C.current,E.current)},[O]),a.useEffect(()=>{!T&&!O&&p()},[T,O,p]);function S(){var M,k,z,F;let s=(M=C.current)==null?void 0:M.getModel();l||((k=s==null?void 0:s.original)==null||k.dispose()),f||((z=s==null?void 0:s.modified)==null||z.dispose()),(F=C.current)==null||F.dispose()}return a.createElement(He,{width:$,height:y,isEditorReady:O,loading:v,_ref:x,className:h,wrapperProps:N})}var an=on,cn=a.memo(an);function sn(){let[e,t]=a.useState(U.__getMonacoInstance());return ve(()=>{let n;return e||(n=U.init(),n.then(r=>{t(r)})),()=>n==null?void 0:n.cancel()}),e}var te=sn;function un(e){let t=a.useRef();return a.useEffect(()=>{t.current=e},[e]),t.current}var ln=un,ie=new Map;function fn({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:i,theme:c="light",line:l,loading:f="Loading...",options:d={},overrideServices:v={},saveViewState:m=!0,keepCurrentModel:y=!1,width:$="100%",height:h="100%",className:N,wrapperProps:L={},beforeMount:I=K,onMount:O=K,onChange:D,onValidate:T=K}){let[b,C]=a.useState(!1),[E,x]=a.useState(!0),j=a.useRef(null),u=a.useRef(null),w=a.useRef(null),g=a.useRef(O),p=a.useRef(I),S=a.useRef(),s=a.useRef(r),M=ln(i),k=a.useRef(!1),z=a.useRef(!1);ve(()=>{let P=U.init();return P.then(R=>(j.current=R)&&x(!1)).catch(R=>(R==null?void 0:R.type)!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>u.current?Ye():P.cancel()}),A(()=>{var R,V,Y,W;let P=B(j.current,e||r||"",t||o||"",i||n||"");P!==((R=u.current)==null?void 0:R.getModel())&&(m&&ie.set(M,(V=u.current)==null?void 0:V.saveViewState()),(Y=u.current)==null||Y.setModel(P),m&&((W=u.current)==null||W.restoreViewState(ie.get(i))))},[i],b),A(()=>{var P;(P=u.current)==null||P.updateOptions(d)},[d],b),A(()=>{!u.current||r===void 0||(u.current.getOption(j.current.editor.EditorOption.readOnly)?u.current.setValue(r):r!==u.current.getValue()&&(z.current=!0,u.current.executeEdits("",[{range:u.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),u.current.pushUndoStop(),z.current=!1))},[r],b),A(()=>{var R,V;let P=(R=u.current)==null?void 0:R.getModel();P&&o&&((V=j.current)==null||V.editor.setModelLanguage(P,o))},[o],b),A(()=>{var P;l!==void 0&&((P=u.current)==null||P.revealLine(l))},[l],b),A(()=>{var P;(P=j.current)==null||P.editor.setTheme(c)},[c],b);let F=a.useCallback(()=>{var P;if(!(!w.current||!j.current)&&!k.current){p.current(j.current);let R=i||n,V=B(j.current,r||e||"",t||o||"",R||"");u.current=(P=j.current)==null?void 0:P.editor.create(w.current,{model:V,automaticLayout:!0,...d},v),m&&u.current.restoreViewState(ie.get(R)),j.current.editor.setTheme(c),l!==void 0&&u.current.revealLine(l),C(!0),k.current=!0}},[e,t,n,r,o,i,d,v,m,c,l]);a.useEffect(()=>{b&&g.current(u.current,j.current)},[b]),a.useEffect(()=>{!E&&!b&&F()},[E,b,F]),s.current=r,a.useEffect(()=>{var P,R;b&&D&&((P=S.current)==null||P.dispose(),S.current=(R=u.current)==null?void 0:R.onDidChangeModelContent(V=>{z.current||D(u.current.getValue(),V)}))},[b,D]),a.useEffect(()=>{if(b){let P=j.current.editor.onDidChangeMarkers(R=>{var Y;let V=(Y=u.current.getModel())==null?void 0:Y.uri;if(V&&R.find(W=>W.path===V.path)){let W=j.current.editor.getModelMarkers({resource:V});T==null||T(W)}});return()=>{P==null||P.dispose()}}return()=>{}},[b,T]);function Ye(){var P,R;(P=S.current)==null||P.dispose(),y?m&&ie.set(i,u.current.saveViewState()):(R=u.current.getModel())==null||R.dispose(),u.current.dispose()}return a.createElement(He,{width:$,height:h,isEditorReady:b,loading:f,_ref:w,className:N,wrapperProps:L})}var dn=fn,mn=a.memo(dn),ue=mn;const ne={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,padding:{top:16,bottom:16},minimap:{enabled:!1},fontSize:14,fontFamily:'"JetBrains Mono", "monospace"',lineHeight:20,scrollbar:{verticalScrollbarSize:14,horizontalScrollbarSize:14,verticalSliderSize:6,horizontalSliderSize:6},overviewRulerBorder:!1,overviewRulerLanes:0,renderLineHighlight:"none",automaticLayout:!0},re=e=>{const{themeConfig:t,editor:n,theme:r}=e,{defaultTheme:o}=t??{},[i,c]=a.useState(r??o??"vs-dark");return a.useEffect(()=>{var l;(l=t==null?void 0:t.monacoThemes)==null||l.forEach(f=>{H.editor.defineTheme(f.themeName,f.themeData)})},[H]),a.useEffect(()=>{H.editor&&r&&(H.editor.setTheme(r),c(r))},[n,r]),{theme:i}};function ye(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n}function pn(e){return e.replace("'","&#39;")}const gn=e=>{const t=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(e<60)return t.format(-e,"second");const n=Math.floor(e/60);if(n<60)return t.format(-n,"minute");const r=Math.floor(n/60);if(r<24)return t.format(-r,"hour");const o=Math.floor(r/24);if(o<30)return t.format(-o,"day");const i=Math.floor(o/30);if(i<12)return t.format(-i,"month");const c=Math.floor(i/12);return t.format(-c,"year")},hn=e=>{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.abs(r);return gn(o)};function Ue({instanceId:e,lineNumbersPosition:t}){let n="";return t==="center"&&(n+=`
23
23
  .monaco-editor-${e} .monaco-scrollable-element.editor-scrollable {
24
24
  width: 100% !important;
25
25
  left: 0px !important;
@@ -32,7 +32,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
32
32
  .monaco-editor-${e} .margin {
33
33
  z-index: 1000;
34
34
  background: transparent !important;
35
- }`),r+=`
35
+ }`),n+=`
36
36
  .monaco-editor-${e} .blame-editor-separator {
37
37
  right: 14px;
38
38
  pointer-events: none;
@@ -45,45 +45,80 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
45
45
  .monaco-editor-${e} .view-line .blame-editor-commit {
46
46
  display: inline-block;
47
47
  color: var(--cn-text-1);
48
- }`,r}function dr({instanceId:e,blameData:t,dateWidth:r,avatarSize:n}){let o="";return t.forEach(a=>{var l,h,m,g,I,v,R,C;const c=(h=(l=a==null?void 0:a.commitInfo)==null?void 0:l.author)==null?void 0:h.avatarUrl,s=(g=(m=a==null?void 0:a.commitInfo)==null?void 0:m.author)==null?void 0:g.initials,f=c?`background: url('${(v=(I=a==null?void 0:a.commitInfo)==null?void 0:I.author)==null?void 0:v.avatarUrl}');`:"";for(let S=a.fromLineNumber;S<=a.toLineNumber;S++)S===a.fromLineNumber?o+=`
49
- .monaco-editor-${e} .view-line .blame-editor-commit-${S}:before {
50
- content: '${ur(lr(((C=(R=a==null?void 0:a.commitInfo)==null?void 0:R.author)==null?void 0:C.when)||""))}';
48
+ }`,n}function vn({instanceId:e,blameData:t,dateWidth:n,avatarSize:r}){let o="";return t.forEach(i=>{var d,v,m,y,$,h,N,L;const c=(v=(d=i==null?void 0:i.commitInfo)==null?void 0:d.author)==null?void 0:v.avatarUrl,l=(y=(m=i==null?void 0:i.commitInfo)==null?void 0:m.author)==null?void 0:y.initials,f=c?`background: url('${(h=($=i==null?void 0:i.commitInfo)==null?void 0:$.author)==null?void 0:h.avatarUrl}');`:"";for(let I=i.fromLineNumber;I<=i.toLineNumber;I++)I===i.fromLineNumber?o+=`
49
+ .monaco-editor-${e} .view-line .blame-editor-commit-${I}:before {
50
+ content: '${pn(hn(((L=(N=i==null?void 0:i.commitInfo)==null?void 0:N.author)==null?void 0:L.when)||""))}';
51
51
  position: absolute;
52
52
  left: 10px;
53
53
  top: 0px;
54
54
  color: var(--cn-text-3);
55
55
  }
56
56
 
57
- .monaco-editor-${e} .view-line .blame-editor-commit-${S}:after {
58
- content: '${s??" "}';
57
+ .monaco-editor-${e} .view-line .blame-editor-commit-${I}:after {
58
+ content: '${l??" "}';
59
59
  position: absolute;
60
60
  border-radius: 50%;
61
61
  padding: 4px;
62
62
  text-align: center;
63
- background: var(--cn-set-gray-soft-bg);
64
63
  line-height: 17px;
65
- left: ${r+10}px;
66
- top: -4px;
67
- color: var(--cn-text-3);
68
- width: ${n}px;
69
- height: ${n}px;
64
+ left: ${n+10}px;
65
+ top: -2px;
66
+ box-shadow: var(--cn-shadow-comp-avatar-inner);
67
+ font-size: var(--cn-font-size-0);
68
+ font-weight: var(--cn-font-weight-default-normal-500);
69
+ background-color: var(--cn-set-brand-secondary-bg);
70
+ color: var(--cn-set-brand-secondary-text);
71
+ font-family: var(--font-family);
72
+ width: ${r}px;
73
+ height: ${r}px;
70
74
  ${f}
71
75
  background-size: 100% 100%;
72
76
  }`:o+=`
73
- .monaco-editor-${e} .view-line .blame-editor-commit-${S}:before {
77
+ .monaco-editor-${e} .view-line .blame-editor-commit-${I}:before {
74
78
  content: ' ';
75
79
  left: 10px;
76
80
  top: 0px;
77
81
  color: gray;
78
- }`}),o}function mr(e,t){let r="";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)}q.config({monaco:V});const de=450,pr=30,gr=140,hr=24,vr={...ce,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function br({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,showSeparators:a=!0,theme:c,height:s="75vh",options:f}){const l=i.useRef(o),h=i.useRef(cr(5));ie();const[m,g]=i.useState(),[I,v]=i.useState(0),R=i.useRef(null),C=i.useRef(null);i.useEffect(()=>{l.current=o},[o]);function S(){const w=C.current,d=R.current;if(!w||!d)return;a&&w.changeViewZones(function(p){p.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),l.current.forEach((T,D)=>{if(D!==l.current.length-1){const u=document.createElement("div");u.style.borderTop="1px solid var(--cn-border-2)",u.style.marginTop="9px",u.className="blame-editor-separator",p.addZone({afterLineNumber:T.toLineNumber,heightInPx:20,domNode:u})}})});const P=[];l.current.forEach(p=>{var T;for(let D=p.fromLineNumber;D<=p.toLineNumber;D++)P.push({range:new d.Range(D,0,D+1,0),options:{before:{content:mr(D===p.fromLineNumber&&((T=p==null?void 0:p.commitInfo)==null?void 0:T.title)||"",pr),cursorStops:d.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${D}`}}})}),w.createDecorationsCollection(P)}function b(w,d){var P,p,T,D,u,y;C.current=w,R.current=d,w.setValue(e),g(w),(T=(p=(P=d.languages.typescript)==null?void 0:P.typescriptDefaults)==null?void 0:p.setDiagnosticsOptions)==null||T.call(p,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(y=(u=(D=d.languages.typescript)==null?void 0:D.javascriptDefaults)==null?void 0:u.setDiagnosticsOptions)==null||y.call(u,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),S()}i.useEffect(()=>{m==null||m.setValue(e)},[e]);const{theme:L}=ue({monacoRef:R,themeConfig:r,editor:m,theme:c}),x=i.useMemo(()=>fr({instanceId:h.current,lineNumbersPosition:n}),[o]),M=i.useMemo(()=>dr({instanceId:h.current,blameData:o,avatarSize:hr,dateWidth:gr}),[o]);i.useEffect(()=>{if(n==="center"){const w=document.getElementsByClassName("lines-content")[0];if(w){const d={attributes:!0},P=T=>{for(const D of T){const u=parseInt(getComputedStyle(w).left);v(u)}},p=new MutationObserver(P);return p.observe(w,d),()=>{p.disconnect()}}}});const E=i.useMemo(()=>`
79
- .monaco-editor-${h.current} .margin {
80
- left: ${de+16+I}px !important;
82
+ }`}),o}function Fe(e,t){let n="";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)}U.config({monaco:H});const me=450,yn=30,bn=140,Mn=24,En={...ne,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function wn({code:e,language:t,themeConfig:n,lineNumbersPosition:r="left",blameData:o,showSeparators:i=!0,theme:c,height:l="75vh",options:f,className:d}){const v=a.useRef(o),m=a.useRef(null),y=a.useRef(ye(5));te();const[$,h]=a.useState(),N=a.useRef(null),L=a.useRef(null);a.useEffect(()=>{v.current=o},[o]);function I(){const u=L.current,w=N.current;if(!u||!w)return;i&&u.changeViewZones(function(p){p.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),v.current.forEach((S,s)=>{if(s!==v.current.length-1){const M=document.createElement("div");M.style.borderTop="1px solid var(--cn-border-2)",M.style.marginTop="9px",M.className="blame-editor-separator",p.addZone({afterLineNumber:S.toLineNumber,heightInPx:20,domNode:M})}})});const g=[];v.current.forEach(p=>{var S;for(let s=p.fromLineNumber;s<=p.toLineNumber;s++)g.push({range:new w.Range(s,0,s+1,0),options:{before:{content:Fe(s===p.fromLineNumber&&((S=p==null?void 0:p.commitInfo)==null?void 0:S.title)||"",yn),cursorStops:w.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${s}`}}})}),u.createDecorationsCollection(g)}function O(u,w){var g,p,S,s,M,k;L.current=u,N.current=w,u.setValue(e),h(u),(S=(p=(g=w.languages.typescript)==null?void 0:g.typescriptDefaults)==null?void 0:p.setDiagnosticsOptions)==null||S.call(p,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(k=(M=(s=w.languages.typescript)==null?void 0:s.javascriptDefaults)==null?void 0:M.setDiagnosticsOptions)==null||k.call(M,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),I()}a.useEffect(()=>{$==null||$.setValue(e)},[e]);const{theme:D}=re({monacoRef:N,themeConfig:n,editor:$,theme:c}),T=a.useMemo(()=>Ue({instanceId:y.current,lineNumbersPosition:r}),[o]),b=a.useMemo(()=>vn({instanceId:y.current,blameData:o,avatarSize:Mn,dateWidth:bn}),[o]);a.useLayoutEffect(()=>{m.current&&m.current.style.setProperty("--line-number-display","none")},[]),a.useEffect(()=>{if(r==="center"&&m.current){const u=m.current.getElementsByClassName("lines-content")[0];if(u){const w={attributes:!0},g=()=>{const S=parseInt(getComputedStyle(u).left);m.current&&(m.current.style.setProperty("--line-number-offset",`${me+16+S}px`),m.current.style.setProperty("--line-number-display","block"))},p=new MutationObserver(g);return p.observe(u,w),g(),()=>{p.disconnect()}}}});const C=a.useMemo(()=>`
83
+ .monaco-editor-${y.current} .margin {
84
+ display: var(--line-number-display);
85
+ left: var(--line-number-offset);
86
+ pointer-events: none;
87
+ }`,[]),E=a.useMemo(()=>`.monaco-editor-${y.current} .view-overlays {
88
+ clip-path: polygon(${me+16}px 0, 100% 0%, 100% 100%, ${me+16}px 100%);
89
+ height:100% !important;
90
+ }`,[]),x=a.useMemo(()=>({...En,...f}),[f]),j=a.useMemo(()=>_.jsx("style",{dangerouslySetInnerHTML:{__html:`${T} ${b} ${C} ${E}`}}),[T,b,E,C]);return _.jsxs("div",{className:d,ref:m,children:[j,_.jsx(ue,{className:`monaco-editor-${y.current} overflow-hidden rounded-b-cn-3`,height:l,language:t,theme:D,options:x,onMount:O})]})}U.config({monaco:H});const pe=450,Sn=30,On={...ne,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function jn({code:e,language:t,themeConfig:n,lineNumbersPosition:r="left",blameData:o,theme:i,height:c="75vh",options:l,className:f}){const d=a.useRef(o),v=a.useRef(null),m=a.useRef(ye(5));te();const[y,$]=a.useState(),h=a.useRef(null),N=a.useRef(null);a.useEffect(()=>{d.current=o},[o]);function L(){const x=N.current,j=h.current;if(!x||!j)return;x.changeViewZones(function(w){w.addZone({afterLineNumber:0,heightInPx:1,domNode:document.createElement("div")}),d.current.forEach(g=>{if(g.infoContent){const S=document.createElement("div");S.className="blame-editor-info-holder",S.style.position="relative",S.style.zIndex="100",S.style.overflow="visible",xn(S,g.infoContent),w.addZone({afterLineNumber:g.fromLineNumber-1,heightInPx:0,domNode:S})}const p=document.createElement("div");p.style.borderTop="1px solid var(--cn-border-2)",p.style.marginTop="9px",p.className="blame-editor-separator",w.addZone({afterLineNumber:g.toLineNumber,heightInPx:20,domNode:p})})});const u=[];d.current.forEach(w=>{for(let g=w.fromLineNumber;g<=w.toLineNumber;g++)u.push({range:new j.Range(g,0,g+1,0),options:{before:{content:Fe("",Sn),cursorStops:j.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${g}`}}})}),x.createDecorationsCollection(u)}function I(x,j){var u,w,g,p,S,s;N.current=x,h.current=j,x.setValue(e),$(x),(g=(w=(u=j.languages.typescript)==null?void 0:u.typescriptDefaults)==null?void 0:w.setDiagnosticsOptions)==null||g.call(w,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(s=(S=(p=j.languages.typescript)==null?void 0:p.javascriptDefaults)==null?void 0:S.setDiagnosticsOptions)==null||s.call(S,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),L()}a.useEffect(()=>{y==null||y.setValue(e)},[e]);const{theme:O}=re({monacoRef:h,themeConfig:n,editor:y,theme:i}),D=a.useMemo(()=>Ue({instanceId:m.current,lineNumbersPosition:r}),[o]);a.useLayoutEffect(()=>{v.current&&v.current.style.setProperty("--line-number-display","none")},[]),a.useEffect(()=>{if(r==="center"&&v.current){const x=v.current.getElementsByClassName("lines-content")[0];if(x){const j={attributes:!0},u=()=>{const g=parseInt(getComputedStyle(x).left);v.current&&(v.current.style.setProperty("--line-number-offset",`${pe+16+g}px`),v.current.style.setProperty("--line-number-display","block"))},w=new MutationObserver(u);return w.observe(x,j),u(),()=>{w.disconnect()}}}});const T=a.useMemo(()=>`
91
+ .monaco-editor-${m.current} .margin {
92
+ display: var(--line-number-display);
93
+ left: var(--line-number-offset);
81
94
  pointer-events: none;
82
- }`,[I]),j=`
83
- .monaco-editor-${h.current} .view-overlays {
84
- clip-path: polygon(${de+16}px 0, 100% 0%, 100% 100%, ${de+16}px 100%);
95
+ }`,[]),b=a.useMemo(()=>`.monaco-editor-${m.current} .view-overlays {
96
+ clip-path: polygon(${pe+16}px 0, 100% 0%, 100% 100%, ${pe+16}px 100%);
85
97
  height:100% !important;
86
- }`,U=i.useMemo(()=>({...vr,...f}),[f]);return A.jsxs(A.Fragment,{children:[A.jsx("style",{dangerouslySetInnerHTML:{__html:`${x} ${M} ${E} ${j}`}}),A.jsx(ge,{className:`monaco-editor-${h.current} overflow-hidden rounded-b-md border-x border-b`,height:s,language:t,theme:L,options:U,onMount:b})]})}q.config({monaco:V});const yr={...ce};function Or({codeRevision:e,onCodeRevisionChange:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh",className:s}){ie();const[f,l]=i.useState(),h=i.useRef(),m=i.useRef({code:"",revisionId:0}),g=i.useRef(null),I=i.useCallback((C,S)=>{var b,L,x,M,E,j;g.current=C,h.current=S,C.setValue(e.code),l(C),(x=(L=(b=S.languages.typescript)==null?void 0:b.typescriptDefaults)==null?void 0:L.setDiagnosticsOptions)==null||x.call(L,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(j=(E=(M=S.languages.typescript)==null?void 0:M.javascriptDefaults)==null?void 0:E.setDiagnosticsOptions)==null||j.call(E,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0})},[e.code]);i.useEffect(()=>{var C,S;if(g.current&&(!e.revisionId||e.revisionId>Number((C=m.current)==null?void 0:C.revisionId))){const b=g.current.getModel();b&&(o!=null&&o.readOnly?(S=g.current)==null||S.setValue(e.code):(g.current.pushUndoStop(),g.current.executeEdits("edit",[{range:b.getFullModelRange(),text:e.code}]),g.current.pushUndoStop()))}},[e,g.current]);const{theme:v}=ue({monacoRef:h,themeConfig:n,editor:f,theme:a}),R=i.useMemo(()=>({...yr,...o||{}}),[o]);return A.jsx(A.Fragment,{children:A.jsx(ge,{className:s,height:c,onChange:(C,S)=>{m.current={code:C??"",revisionId:S.versionId},t({...m.current},S)},language:r,theme:v,options:R,onMount:I})})}q.config({monaco:V});const Sr={...ce,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function wr({original:e,modified:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh"}){ie();const[s,f]=i.useState(),l=i.useRef(),{theme:h}=ue({monacoRef:l,themeConfig:n,editor:s,theme:a}),m=i.useMemo(()=>({...Sr,...o||{}}),[o]);return A.jsx(A.Fragment,{children:A.jsx(er,{className:"overflow-hidden rounded-b-md border-x border-b",language:r,theme:h,original:e,modified:t,height:c,options:m,onMount:f})})}var he=(e=>(e.ContainsPath="ContainsPath",e))(he||{});function Mr(e){const{pathSymbolMap:t,inlineActions:r=[],commandId:n}=e,o=Object.fromEntries(t.entries()),a=[];return r==null||r.forEach(c=>{const s=c.actions;c.selectors.forEach(l=>{switch(l.type){case he.ContainsPath:{l.paths.forEach(h=>{let g=Object.keys(o).map(v=>({fullPath:v,path:v,symbol:o[v]})).filter(v=>v.path.startsWith(l.basePath));g=g.map(v=>({...v,path:v.path.substring(l.basePath.length)})),g.filter(v=>h.test(v.path)).forEach(v=>{const R=v.fullPath,C=v.symbol,S=C.range;s.forEach(b=>{const L={range:S,symbols:[C],onClick:b.onClick,data:b.data,path:R};a.push({range:S,command:{id:n,title:b.title,arguments:[L]}})})})});break}}})}),a}const Z=class Z{static set(t){Z.data=t}static get(){return Z.data}};Se(Z,"data",{});let oe=Z;async function Ve(e){const t=oe.get(),{documentSymbolProvider:r}=t.StandaloneServices.get(t.ILanguageFeaturesService);return await t.OutlineModel.create(r,e)}function Ue(e){const t=new Map;return ve({pathSymbolMap:t,parentPath:"",children:e.children,parentKind:J.languages.SymbolKind.Module}),t}function ve(e){switch(e.parentKind){case J.languages.SymbolKind.Module:{Er(e);break}case J.languages.SymbolKind.Array:{jr(e);break}default:Pr(e)}}function Er(e){e.children.forEach(t=>{var n;let r=e.parentPath;t.symbol&&(r=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t.symbol.name,e.pathSymbolMap.set(r,t.symbol)),ve({pathSymbolMap:e.pathSymbolMap,parentPath:r,children:t.children,parentKind:((n=t==null?void 0:t.symbol)==null?void 0:n.kind)??e.parentKind})})}function jr(e){let t=0;e.children.forEach(r=>{const n=e.parentPath?`${e.parentPath}.${t}`:`${t}`;e.pathSymbolMap.set(n,r.symbol),t+=1,ve({pathSymbolMap:e.pathSymbolMap,parentPath:n,children:r.children,parentKind:r.symbol.kind})})}function Pr(e){const t=e.children.get("0");if(t){const r=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t==null?void 0:t.symbol.name;e.pathSymbolMap.set(r,t.symbol)}}function xr({editorRef:e,inlineActions:t}){i.useEffect(()=>V.languages.registerCodeLensProvider("yaml",{provideCodeLenses:async n=>{var f;const o=await Ve(n),a=Ue(o),c=(f=e==null?void 0:e.current)==null?void 0:f.addCommand(0,(l,{onClick:h,path:m,range:g,data:I})=>{h({path:m,range:g,data:I})});return c?{lenses:Mr({pathSymbolMap:a,inlineActions:t,commandId:c}),dispose:()=>{}}:void 0}}).dispose,[t,e])}const Cr=({editorRef:e,selection:t})=>{const[r,n]=i.useState(),o=i.useMemo(()=>async(a,c,s)=>{var g,I,v;const f=(g=e==null?void 0:e.current)==null?void 0:g.getModel();if(!f||!c)return n(void 0);const l=await Ve(f),m=(I=Ue(l).get(c))==null?void 0:I.range;m&&(n(m),s&&((v=e==null?void 0:e.current)==null||v.revealLineInCenter(m.startLineNumber)))},[]);i.useEffect(()=>{if("requestIdleCallback"in window){const a=requestIdleCallback(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)});return()=>cancelIdleCallback(a)}else{const a=setTimeout(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)},100);return()=>clearTimeout(a)}},[t==null?void 0:t.path,t==null?void 0:t.revealInCenter,e,o]),i.useEffect(()=>{var c;if(!r)return;const a=(c=e==null?void 0:e.current)==null?void 0:c.createDecorationsCollection([{range:{...r,startColumn:1},options:{isWholeLine:!1,className:t==null?void 0:t.className}}]);return()=>a==null?void 0:a.clear()},[r,e,t==null?void 0:t.className])},be=i.createContext({markers:[],setMarkers:()=>{},editor:null,setEditor:e=>{},updateCursorPosition:e=>{}});function $r({children:e}){const[t,r]=i.useState([]),[n,o]=i.useState(null),a=i.useCallback(c=>{n==null||n.setPosition(c),n==null||n.revealLineInCenterIfOutsideViewport(c.lineNumber),n==null||n.focus()},[n]);return A.jsx(be.Provider,{value:{markers:t,setMarkers:r,editor:n,setEditor:o,updateCursorPosition:a},children:e})}function ye(){return i.useContext(be)}const Ir=({monacoRef:e,editorRef:t,instanceId:r})=>{const{setMarkers:n}=ye();i.useEffect(()=>{let o;const a=setTimeout(()=>{var s;const c=(s=e.current)==null?void 0:s.editor;c&&(o=c.onDidChangeMarkers(f=>{var m;const l=(m=t.current)==null?void 0:m.getModel();if(!l)return;const h=l.uri.toString();if(f.some(g=>g.toString()===h)){const g=V.editor.getModelMarkers({resource:l.uri});n(g)}}))},100);return()=>{clearTimeout(a),o==null||o.dispose()}},[e,r,n])};function Dr(e){var n,o;const t=((o=(n=me.yamlDefaults)==null?void 0:n.diagnosticsOptions)==null?void 0:o.schemas)??[],r=t.findIndex(a=>a.fileMatch[0]===e.fileMatch[0]);r!==-1?t[r]=e:t.push(e),Fe(t)}function Tr(e){var n,o;const r=(((o=(n=me.yamlDefaults)==null?void 0:n.diagnosticsOptions)==null?void 0:o.schemas)??[]).filter(a=>a.fileMatch[0]!==Oe(e));Fe(r)}function Fe(e){const t={hover:!0,completion:!0,enableSchemaRequest:!1,validate:!0,schemas:e};me.yamlDefaults.setDiagnosticsOptions({...t})}const Oe=e=>J.Uri.parse(`file://${e}`).toString(),Lr=e=>{const{schemaConfig:t,instanceId:r}=e;i.useEffect(()=>{if(t!=null&&t.schema)return Dr({fileMatch:[Oe(r.toString())],...t}),()=>{Tr(r)}},[t==null?void 0:t.schema,r])};q.config({monaco:V});const Rr={...ce,folding:!0},Nr=function(t){const{yamlRevision:r,schemaConfig:n,inlineActions:o,themeConfig:a,onYamlRevisionChange:c,selection:s,theme:f,options:l,animateOnUpdate:h=!1,onAnimateEnd:m,instanceId:g}=t,I=ie(),[v]=i.useState(g??`yaml-editor-${Math.random()}`),{editor:R,setEditor:C}=ye(),S=i.useRef(null),b=i.useRef(),L=i.useRef({yaml:"",revisionId:0}),x=i.useRef(null),M=i.useRef(null),E=i.useCallback(P=>{var D,u,y;const p=P.split(`
87
- `),T=(D=x.current)==null?void 0:D.getModel();if(T){(u=x.current)==null||u.pushUndoStop(),T.setValue("");let N=0;M.current=window.setInterval(()=>{var F;N<p.length?(I&&((F=x.current)==null||F.executeEdits("addLine",[{range:new I.Range(N+1,1,N+1,1),text:p[N]+`
88
- `}])),N++):M.current&&(clearInterval(M.current),m==null||m())},100),(y=x.current)==null||y.pushUndoStop()}},[I]);i.useEffect(()=>()=>{M.current&&clearInterval(M.current)},[]);function j(P,p){x.current=P,b.current=p,P.setValue(r.yaml),C(P),setTimeout(()=>{var T;(T=S.current)!=null&&T.style&&(S.current.style.opacity="1")},50)}i.useEffect(()=>{var P;if(x.current&&(!r.revisionId||r.revisionId>Number((P=L.current)==null?void 0:P.revisionId))){const p=x.current.getModel();p&&(x.current.executeEdits("edit",[{range:p.getFullModelRange(),text:h?"":r.yaml}]),h&&E(r.yaml))}},[E,r,h]),Lr({schemaConfig:n,instanceId:v}),xr({editorRef:x,inlineActions:o});const{theme:U}=ue({monacoRef:b,themeConfig:a,editor:R,theme:f});Ir({monacoRef:b,editorRef:x,instanceId:v}),Cr({editorRef:x,selection:s});const w=i.useMemo(()=>Oe(v),[]),d=i.useMemo(()=>({...Rr,...l}),[l]);return A.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:S,children:A.jsx(ge,{onChange:(P,p)=>{L.current={yaml:P??"",revisionId:p.versionId},c({...L.current},p)},language:"yaml",theme:U,options:d,path:w,onMount:j})})};exports.BlameEditor=br;exports.CodeDiffEditor=wr;exports.CodeEditor=Or;exports.MonacoGlobals=oe;exports.SelectorType=he;exports.YamlEditor=Nr;exports.YamlEditorContext=be;exports.YamlEditorContextProvider=$r;exports.useYamlEditorContext=ye;
98
+ }`,[]),C=a.useMemo(()=>({...On,...l}),[l]),E=a.useMemo(()=>_.jsx("style",{dangerouslySetInnerHTML:{__html:`${D} ${T} ${b}`}}),[D,b,T]);return _.jsxs("div",{className:f,ref:v,children:[E,_.jsx(ue,{className:`monaco-editor-${m.current} overflow-hidden rounded-b-cn-3`,height:c,language:t,theme:O,options:C,onMount:I})]})}function xn(e,t){return new IntersectionObserver(([r],o)=>{if(r.isIntersecting){o.disconnect();const i=document.createElement("div");i.style.position="absolute",i.style.top="-2px",e.appendChild(i),Ze.render(t,i)}},{root:document.querySelector(".monaco-scrollable-element"),threshold:.2}).observe(e),e}function Pn(e){const{editor:t,keyword:n}=e;a.useEffect(()=>{if(!t||!n)return;const r=t.getModel(),o=r.findMatches(n,!1,!1,!1,null,!1);o.length>0&&o.forEach(i=>{r.deltaDecorations([],[{range:i.range,options:{isWholeLine:!1,inlineClassName:"CodeEditor_HighlightedText"}}])})},[t,n])}function Cn(e){const{enable:t,editor:n,onSelectedLineChange:r,selectedLine:o,onSelectedLineButtonClick:i}=e,c=a.useRef(null),l=a.useRef(!1),f=a.useRef(null);f.current=f.current??(n==null?void 0:n.createDecorationsCollection([]))??null,a.useEffect(()=>{let d;const v=setTimeout(()=>{if(!t||!n)return;const m=y=>{var h,N,L,I;if((N=(h=y.target)==null?void 0:h.element)!=null&&N.classList.contains("CodeEditor_HighlightedGlyphMargin")){i==null||i((L=y.target)==null?void 0:L.element);return}const $=$n((I=y.target)==null?void 0:I.element);if(!$){r==null||r(void 0),i==null||i(void 0),ge(n,f.current,void 0);return}l.current=!0,c.current=$,r==null||r($),ge(n,f.current,$,!1),i==null||i(void 0)};d=n.onMouseDown(m)},100);return()=>{clearTimeout(v),d==null||d.dispose()}},[l,o,r,t,n,i,f]),a.useEffect(()=>{n&&c.current!==o&&ge(n,f.current,o,!0)},[n,o,f])}function ge(e,t,n,r){if(!n){t==null||t.set([]);return}t==null||t.set([{range:new H.Range(n,1,n,1),options:{isWholeLine:!0,className:"CodeEditor_HighlightedLine"}}]),e==null||e.setSelection(new H.Range(n,0,n,0)),r&&(e==null||e.revealLineInCenter(n))}function $n(e){const t=e!=null&&e.classList.contains("line-numbers")?e:void 0;if(!t)return;const n=parseInt(t.textContent??"");if(!isNaN(n))return n}const In=`.CodeEditor_HighlightedLine {
99
+ opacity: 0.1;
100
+ background-color: var(--cn-yellow-300, orange) !important;
101
+ }
102
+
103
+ .CodeEditor_HighlightedText {
104
+ background-color: var(--cn-yellow-100, orange) !important;
105
+ }
106
+
107
+ .CodeEditor_HighlightedGlyphMargin {
108
+ background: rgb(183, 183, 183);
109
+ border: 1px solid gray;
110
+ border-radius: 4px;
111
+ margin-left: 5px;
112
+ height: 20px;
113
+ position: relative;
114
+ }
115
+
116
+ .CodeEditor_HighlightedGlyphMargin::after {
117
+ content: '...';
118
+ position: absolute;
119
+ padding: 7px 3px;
120
+ }
121
+ `;U.config({monaco:H});const Nn={...ne};function Ln({codeRevision:e,onCodeRevisionChange:t,language:n,themeConfig:r,options:o,theme:i,enableLinesSelection:c=!1,selectedLine:l,onSelectedLineChange:f,onSelectedLineButtonClick:d,highlightKeyword:v,height:m="75vh",className:y}){const $=a.useRef(ye(5));te();const[h,N]=a.useState(),L=a.useRef(),I=a.useRef({code:"",revisionId:0}),O=a.useRef(null),D=a.useCallback((E,x)=>{var j,u,w,g,p,S;O.current=E,L.current=x,E.setValue(e.code),N(E),(w=(u=(j=x.languages.typescript)==null?void 0:j.typescriptDefaults)==null?void 0:u.setDiagnosticsOptions)==null||w.call(u,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(S=(p=(g=x.languages.typescript)==null?void 0:g.javascriptDefaults)==null?void 0:p.setDiagnosticsOptions)==null||S.call(p,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0})},[e.code]);a.useEffect(()=>{var E,x;if(O.current&&(!e.revisionId||e.revisionId>Number((E=I.current)==null?void 0:E.revisionId))){const j=O.current.getModel();j&&(o!=null&&o.readOnly?(x=O.current)==null||x.setValue(e.code):(O.current.pushUndoStop(),O.current.executeEdits("edit",[{range:j.getFullModelRange(),text:e.code}]),O.current.pushUndoStop()))}},[e,o==null?void 0:o.readOnly,O]);const{theme:T}=re({monacoRef:L,themeConfig:r,editor:h,theme:i});Cn({enable:c,editor:h,selectedLine:l,onSelectedLineChange:f,onSelectedLineButtonClick:d}),Pn({editor:h,keyword:v});const b=a.useMemo(()=>({...Nn,...o||{}}),[o]),C=a.useMemo(()=>`.monaco-editor-${$.current} .margin-view-overlays .line-numbers { cursor: pointer !important; } ${In}`,[]);return _.jsxs(_.Fragment,{children:[c&&_.jsx("style",{dangerouslySetInnerHTML:{__html:C}}),_.jsx(ue,{className:`monaco-editor-${$.current} ${y}`,height:m,onChange:(E,x)=>{I.current={code:E??"",revisionId:x.versionId},t==null||t({...I.current},x)},language:n,theme:T,options:b,onMount:D})]})}U.config({monaco:H});const Rn={...ne,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function Tn({original:e,modified:t,language:n,themeConfig:r,options:o,theme:i,height:c="75vh"}){te();const[l,f]=a.useState(),d=a.useRef(),{theme:v}=re({monacoRef:d,themeConfig:r,editor:l,theme:i}),m=a.useMemo(()=>({...Rn,...o||{}}),[o]);return _.jsx(_.Fragment,{children:_.jsx(cn,{className:"overflow-hidden rounded-b-cn-3 border-x border-b",language:n,theme:v,original:e,modified:t,height:c,options:m,onMount:f})})}var be=(e=>(e.ContainsPath="ContainsPath",e))(be||{});function Dn(e){const{pathSymbolMap:t,inlineActions:n=[],commandId:r}=e,o=Object.fromEntries(t.entries()),i=[];return n==null||n.forEach(c=>{const l=c.actions;c.selectors.forEach(d=>{switch(d.type){case be.ContainsPath:{d.paths.forEach(v=>{let y=Object.keys(o).map(h=>({fullPath:h,path:h,symbol:o[h]})).filter(h=>h.path.startsWith(d.basePath));y=y.map(h=>({...h,path:h.path.substring(d.basePath.length)})),y.filter(h=>v.test(h.path)).forEach(h=>{const N=h.fullPath,L=h.symbol,I=L.range;l.forEach(O=>{const D={range:I,symbols:[L],onClick:O.onClick,data:O.data,path:N};i.push({range:I,command:{id:r,title:O.title,arguments:[D]}})})})});break}}})}),i}const Z=class Z{static set(t){Z.data=t}static get(){return Z.data}};Oe(Z,"data",{});let ce=Z;async function qe(e){const t=ce.get(),{documentSymbolProvider:n}=t.StandaloneServices.get(t.ILanguageFeaturesService);return await t.OutlineModel.create(n,e)}function We(e){const t=new Map;return Me({pathSymbolMap:t,parentPath:"",children:e.children,parentKind:J.languages.SymbolKind.Module}),t}function Me(e){switch(e.parentKind){case J.languages.SymbolKind.Module:{_n(e);break}case J.languages.SymbolKind.Array:{kn(e);break}default:Vn(e)}}function _n(e){e.children.forEach(t=>{var r;let n=e.parentPath;t.symbol&&(n=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t.symbol.name,e.pathSymbolMap.set(n,t.symbol)),Me({pathSymbolMap:e.pathSymbolMap,parentPath:n,children:t.children,parentKind:((r=t==null?void 0:t.symbol)==null?void 0:r.kind)??e.parentKind})})}function kn(e){let t=0;e.children.forEach(n=>{const r=e.parentPath?`${e.parentPath}.${t}`:`${t}`;e.pathSymbolMap.set(r,n.symbol),t+=1,Me({pathSymbolMap:e.pathSymbolMap,parentPath:r,children:n.children,parentKind:n.symbol.kind})})}function Vn(e){const t=e.children.get("0");if(t){const n=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t==null?void 0:t.symbol.name;e.pathSymbolMap.set(n,t.symbol)}}function An({editorRef:e,inlineActions:t}){a.useEffect(()=>H.languages.registerCodeLensProvider("yaml",{provideCodeLenses:async r=>{var f,d,v,m,y;if(((f=r==null?void 0:r.uri)==null?void 0:f.toString())!==((m=(v=(d=e.current)==null?void 0:d.getModel())==null?void 0:v.uri)==null?void 0:m.toString()))return{lenses:[],dispose:()=>{}};const o=await qe(r),i=We(o),c=(y=e==null?void 0:e.current)==null?void 0:y.addCommand(0,($,{onClick:h,path:N,range:L,data:I})=>{h({path:N,range:L,data:I})});return c?{lenses:Dn({pathSymbolMap:i,inlineActions:t,commandId:c}),dispose:()=>{}}:void 0}}).dispose,[t,e])}const Hn=({editorRef:e,selection:t})=>{const[n,r]=a.useState(),o=a.useMemo(()=>async(i,c,l)=>{var y,$,h;const f=(y=e==null?void 0:e.current)==null?void 0:y.getModel();if(!f||!c)return r(void 0);const d=await qe(f),m=($=We(d).get(c))==null?void 0:$.range;m&&(r(m),l&&((h=e==null?void 0:e.current)==null||h.revealLineInCenter(m.startLineNumber)))},[]);a.useEffect(()=>{if("requestIdleCallback"in window){const i=requestIdleCallback(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)});return()=>cancelIdleCallback(i)}else{const i=setTimeout(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)},100);return()=>clearTimeout(i)}},[t==null?void 0:t.path,t==null?void 0:t.revealInCenter,e,o]),a.useEffect(()=>{var c;if(!n)return;const i=(c=e==null?void 0:e.current)==null?void 0:c.createDecorationsCollection([{range:{...n,startColumn:1},options:{isWholeLine:!1,className:t==null?void 0:t.className}}]);return()=>i==null?void 0:i.clear()},[n,e,t==null?void 0:t.className])},Ee=a.createContext({markers:[],setMarkers:()=>{},editor:null,setEditor:e=>{},updateCursorPosition:e=>{}});function zn({children:e}){const[t,n]=a.useState([]),[r,o]=a.useState(null),i=a.useCallback(c=>{r==null||r.setPosition(c),r==null||r.revealLineInCenterIfOutsideViewport(c.lineNumber),r==null||r.focus()},[r]);return _.jsx(Ee.Provider,{value:{markers:t,setMarkers:n,editor:r,setEditor:o,updateCursorPosition:i},children:e})}function we(){return a.useContext(Ee)}const Un=({monacoRef:e,editorRef:t,instanceId:n})=>{const{setMarkers:r}=we();a.useEffect(()=>{let o;const i=setTimeout(()=>{var l;const c=(l=e.current)==null?void 0:l.editor;c&&(o=c.onDidChangeMarkers(f=>{var m;const d=(m=t.current)==null?void 0:m.getModel();if(!d)return;const v=d.uri.toString();if(f.some(y=>y.toString()===v)){const y=H.editor.getModelMarkers({resource:d.uri});r(y)}}))},100);return()=>{clearTimeout(i),o==null||o.dispose()}},[e,n,r])};function Fn(e){var r,o;const t=((o=(r=he.yamlDefaults)==null?void 0:r.diagnosticsOptions)==null?void 0:o.schemas)??[],n=t.findIndex(i=>i.fileMatch[0]===e.fileMatch[0]);n!==-1?t[n]=e:t.push(e),Be(t)}function qn(e){var r,o;const n=(((o=(r=he.yamlDefaults)==null?void 0:r.diagnosticsOptions)==null?void 0:o.schemas)??[]).filter(i=>i.fileMatch[0]!==Se(e));Be(n)}function Be(e){const t={hover:!0,completion:!0,enableSchemaRequest:!1,validate:!0,schemas:e};he.yamlDefaults.setDiagnosticsOptions({...t})}const Se=e=>J.Uri.parse(`file://${e}`).toString(),Wn=e=>{const{schemaConfig:t,instanceId:n}=e;a.useEffect(()=>{if(t!=null&&t.schema)return Fn({fileMatch:[Se(n.toString())],...t}),()=>{qn(n)}},[t==null?void 0:t.schema,n])};U.config({monaco:H});const Bn={...ne,folding:!0},Yn=function(t){const{yamlRevision:n,schemaConfig:r,inlineActions:o,themeConfig:i,onYamlRevisionChange:c,selection:l,theme:f,options:d,animateOnUpdate:v=!1,onAnimateEnd:m,instanceId:y,height:$}=t,h=te(),[N]=a.useState(y??`yaml-editor-${Math.random()}`),{editor:L,setEditor:I}=we(),O=a.useRef(null),D=a.useRef(),T=a.useRef({yaml:"",revisionId:0}),b=a.useRef(null),C=a.useRef(null),E=a.useCallback(g=>{var s,M,k;const p=g.split(`
122
+ `),S=(s=b.current)==null?void 0:s.getModel();if(S){(M=b.current)==null||M.pushUndoStop(),S.setValue("");let z=0;C.current=window.setInterval(()=>{var F;z<p.length?(h&&((F=b.current)==null||F.executeEdits("addLine",[{range:new h.Range(z+1,1,z+1,1),text:p[z]+`
123
+ `}])),z++):C.current&&(clearInterval(C.current),m==null||m())},100),(k=b.current)==null||k.pushUndoStop()}},[h]);a.useEffect(()=>()=>{C.current&&clearInterval(C.current)},[]);function x(g,p){b.current=g,D.current=p,g.setValue(n.yaml),I(g),setTimeout(()=>{var S;(S=O.current)!=null&&S.style&&(O.current.style.opacity="1")},50)}a.useEffect(()=>{var g;if(b.current&&(!n.revisionId||n.revisionId>Number((g=T.current)==null?void 0:g.revisionId))){const p=b.current.getModel();p&&(b.current.executeEdits("edit",[{range:p.getFullModelRange(),text:v?"":n.yaml}]),v&&E(n.yaml))}},[E,n,v]),Wn({schemaConfig:r,instanceId:N}),An({editorRef:b,inlineActions:o});const{theme:j}=re({monacoRef:D,themeConfig:i,editor:L,theme:f});Un({monacoRef:D,editorRef:b,instanceId:N}),Hn({editorRef:b,selection:l});const u=a.useMemo(()=>Se(N),[]),w=a.useMemo(()=>({...Bn,...d}),[d]);return _.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:O,children:_.jsx(ue,{onChange:(g,p)=>{T.current={yaml:g??"",revisionId:p.versionId},c({...T.current},p)},language:"yaml",theme:j,options:w,path:u,onMount:x,height:$})})};exports.BlameEditor=wn;exports.BlameEditorV2=jn;exports.CodeDiffEditor=Tn;exports.CodeEditor=Ln;exports.MonacoGlobals=ce;exports.SelectorType=be;exports.YamlEditor=Yn;exports.YamlEditorContext=Ee;exports.YamlEditorContextProvider=zn;exports.useYamlEditorContext=we;
89
124
  //# sourceMappingURL=index.cjs.map