@harnessio/yaml-editor 0.21.0 → 0.22.1

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.
@@ -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;
@@ -1,4 +1,4 @@
1
- import { EditorProps } from '@monaco-editor/react';
1
+ import { EditorProps, Monaco } from '@monaco-editor/react';
2
2
  import { ThemeDefinition } from '../types/themes';
3
3
 
4
4
  import * as monaco from 'monaco-editor';
@@ -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,11 @@ 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;
27
+ onMount?: (editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) => void;
22
28
  }
23
- export declare function CodeEditor<T>({ codeRevision, onCodeRevisionChange, language, themeConfig, options, theme: themeFromProps, height, className }: CodeEditorProps<T>): JSX.Element;
29
+ export declare function CodeEditor<T>({ codeRevision, onCodeRevisionChange, language, themeConfig, options, theme: themeFromProps, enableLinesSelection, selectedLine, onSelectedLineChange, onSelectedLineButtonClick, highlightKeyword, height, className, onMount }: 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 Me=(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"),pe=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,r)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Oe=(e,t,r)=>(Ke(e,typeof t!="symbol"?t+"":t,r),r);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 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 H=Je(J);var Re={exports:{}},X={};/*
2
2
  object-assign
3
3
  (c) Sindre Sorhus
4
4
  @license MIT
5
- */var Se=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={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(i){return t[i]});if(n.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,Te=60103;X.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var we=Symbol.for;Te=we("react.element"),X.Fragment=we("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 De(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:Te,type:e,key:a,ref:c,props:o,_owner:Je.current}}X.jsx=De;X.jsxs=De;Ie.exports=X;var _=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(d){o=!0,a=d}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),d=0;d<c;d++)s[d]=arguments[d];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 pt(e){Q(e)||z("selectorType")}function mt(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:pt,handler:mt,initial:gt};function yt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};te.initial(e),te.handler(t);var r={current:e},n=K(Mt)(r,t),o=K(Ot)(r),a=K(te.changes)(e),c=K(bt)(r);function s(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(v){return v};return te.selector(p),p(r.current)}function d(p){st(n,o,a,c)(p)}return[s,d]}function bt(e,t){return Q(t)?t(e.current):t}function Ot(e,t){return e.current=Ce(Ce({},e.current),t),t}function Mt(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 St={create:yt},wt={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),d=0;d<c;d++)s[d]=arguments[d];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 rt=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 nt=rt.__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,r){var n,o={},i=null,c=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)ot.call(t,n)&&!it.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:Te,type:e,key:i,ref:c,props:o,_owner:nt.current}}X.jsx=De;X.jsxs=De;Re.exports=X;var _=Re.exports;function at(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pe(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?Pe(Object(r),!0).forEach(function(n){at(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ct(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i<n.length;i++)o=n[i],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function st(e,t){if(e==null)return{};var r=ct(e,t),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}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 r=[],n=!0,o=!1,i=void 0;try{for(var c=e[Symbol.iterator](),l;!(n=(l=c.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(f){o=!0,i=f}finally{try{!n&&c.return!=null&&c.return()}finally{if(o)throw i}}return r}}function dt(e,t){if(e){if(typeof e=="string")return $e(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 $e(e,t)}}function $e(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 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,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ie(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 Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ie(Object(r),!0).forEach(function(n){pt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ie(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gt(){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,i){return i(o)},n)}}function G(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;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(r,[].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(r){return!vt(e,r)})&&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 r={current:e},n=G(Pt)(r,t),o=G(xt)(r),i=G(oe.changes)(e),c=G(jt)(r);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(h){return h};return oe.selector(d),d(r.current)}function f(d){gt(n,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,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 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 r=this,n=arguments.length,o=new Array(n),i=0;i<n;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(r,[].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 Tt={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(Tt):n(a)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var Dt=St.create({config:wt,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ne=nt(Dt,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,At)(_t)}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 At(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 _t(){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,Ae=i.memo(Wt);function Kt(e){i.useEffect(e,[])}var me=Kt;function Gt(e,t,r=!0){let n=i.useRef(!0);i.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var A=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(_e(e,t))}function Jt(e,t,r,n){return e.editor.createModel(t,r,n?_e(e,n):void 0)}function _e(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:d=!1,theme:p="light",loading:v="Loading...",options:l={},height:g="100%",width:C="100%",className:h,wrapperProps:N={},beforeMount:$=G,onMount:O=G}){let[y,D]=i.useState(!1),[P,M]=i.useState(!0),w=i.useRef(null),E=i.useRef(null),U=i.useRef(null),T=i.useRef(O),f=i.useRef($),j=i.useRef(!1);me(()=>{let u=q.init();return u.then(m=>(E.current=m)&&M(!1)).catch(m=>(m==null?void 0:m.type)!=="cancelation"&&console.error("Monaco initialization: error:",m)),()=>w.current?L():u.cancel()}),A(()=>{if(w.current&&E.current){let u=w.current.getOriginalEditor(),m=B(E.current,e||"",n||r||"text",a||"");m!==u.getModel()&&u.setModel(m)}},[a],y),A(()=>{if(w.current&&E.current){let u=w.current.getModifiedEditor(),m=B(E.current,t||"",o||r||"text",c||"");m!==u.getModel()&&u.setModel(m)}},[c],y),A(()=>{let u=w.current.getModifiedEditor();u.getOption(E.current.editor.EditorOption.readOnly)?u.setValue(t||""):t!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[t],y),A(()=>{var u,m;(m=(u=w.current)==null?void 0:u.getModel())==null||m.original.setValue(e||"")},[e],y),A(()=>{let{original:u,modified:m}=w.current.getModel();E.current.editor.setModelLanguage(u,n||r||"text"),E.current.editor.setModelLanguage(m,o||r||"text")},[r,n,o],y),A(()=>{var u;(u=E.current)==null||u.editor.setTheme(p)},[p],y),A(()=>{var u;(u=w.current)==null||u.updateOptions(l)},[l],y);let x=i.useCallback(()=>{var R;if(!E.current)return;f.current(E.current);let u=B(E.current,e||"",n||r||"text",a||""),m=B(E.current,t||"",o||r||"text",c||"");(R=w.current)==null||R.setModel({original:u,modified:m})},[r,t,o,e,n,a,c]),S=i.useCallback(()=>{var u;!j.current&&U.current&&(w.current=E.current.editor.createDiffEditor(U.current,{automaticLayout:!0,...l}),x(),(u=E.current)==null||u.editor.setTheme(p),D(!0),j.current=!0)},[l,p,x]);i.useEffect(()=>{y&&T.current(w.current,E.current)},[y]),i.useEffect(()=>{!P&&!y&&S()},[P,y,S]);function L(){var m,R,F,H;let u=(m=w.current)==null?void 0:m.getModel();s||((R=u==null?void 0:u.original)==null||R.dispose()),d||((F=u==null?void 0:u.modified)==null||F.dispose()),(H=w.current)==null||H.dispose()}return i.createElement(Ae,{width:C,height:g,isEditorReady:y,loading:v,_ref:U,className:h,wrapperProps:N})}var Xt=Qt,er=i.memo(Xt);function tr(){let[e,t]=i.useState(q.__getMonacoInstance());return me(()=>{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:d="Loading...",options:p={},overrideServices:v={},saveViewState:l=!0,keepCurrentModel:g=!1,width:C="100%",height:h="100%",className:N,wrapperProps:$={},beforeMount:O=G,onMount:y=G,onChange:D,onValidate:P=G}){let[M,w]=i.useState(!1),[E,U]=i.useState(!0),T=i.useRef(null),f=i.useRef(null),j=i.useRef(null),x=i.useRef(y),S=i.useRef(O),L=i.useRef(),u=i.useRef(n),m=nr(a),R=i.useRef(!1),F=i.useRef(!1);me(()=>{let b=q.init();return b.then(I=>(T.current=I)&&U(!1)).catch(I=>(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>f.current?ze():b.cancel()}),A(()=>{var I,k,W,Y;let b=B(T.current,e||n||"",t||o||"",a||r||"");b!==((I=f.current)==null?void 0:I.getModel())&&(l&&re.set(m,(k=f.current)==null?void 0:k.saveViewState()),(W=f.current)==null||W.setModel(b),l&&((Y=f.current)==null||Y.restoreViewState(re.get(a))))},[a],M),A(()=>{var b;(b=f.current)==null||b.updateOptions(p)},[p],M),A(()=>{!f.current||n===void 0||(f.current.getOption(T.current.editor.EditorOption.readOnly)?f.current.setValue(n):n!==f.current.getValue()&&(F.current=!0,f.current.executeEdits("",[{range:f.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),f.current.pushUndoStop(),F.current=!1))},[n],M),A(()=>{var I,k;let b=(I=f.current)==null?void 0:I.getModel();b&&o&&((k=T.current)==null||k.editor.setModelLanguage(b,o))},[o],M),A(()=>{var b;s!==void 0&&((b=f.current)==null||b.revealLine(s))},[s],M),A(()=>{var b;(b=T.current)==null||b.editor.setTheme(c)},[c],M);let H=i.useCallback(()=>{var b;if(!(!j.current||!T.current)&&!R.current){S.current(T.current);let I=a||r,k=B(T.current,n||e||"",t||o||"",I||"");f.current=(b=T.current)==null?void 0:b.editor.create(j.current,{model:k,automaticLayout:!0,...p},v),l&&f.current.restoreViewState(re.get(I)),T.current.editor.setTheme(c),s!==void 0&&f.current.revealLine(s),w(!0),R.current=!0}},[e,t,r,n,o,a,p,v,l,c,s]);i.useEffect(()=>{M&&x.current(f.current,T.current)},[M]),i.useEffect(()=>{!E&&!M&&H()},[E,M,H]),u.current=n,i.useEffect(()=>{var b,I;M&&D&&((b=L.current)==null||b.dispose(),L.current=(I=f.current)==null?void 0:I.onDidChangeModelContent(k=>{F.current||D(f.current.getValue(),k)}))},[M,D]),i.useEffect(()=>{if(M){let b=T.current.editor.onDidChangeMarkers(I=>{var W;let k=(W=f.current.getModel())==null?void 0:W.uri;if(k&&I.find(Y=>Y.path===k.path)){let Y=T.current.editor.getModelMarkers({resource:k});P==null||P(Y)}});return()=>{b==null||b.dispose()}}return()=>{}},[M,P]);function ze(){var b,I;(b=L.current)==null||b.dispose(),g?l&&re.set(a,f.current.saveViewState()):(I=f.current.getModel())==null||I.dispose(),f.current.dispose()}return i.createElement(Ae,{width:C,height:h,isEditorReady:M,loading:d,_ref:j,className:N,wrapperProps:$})}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(d=>{V.editor.defineTheme(d.themeName,d.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,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(i,c){return c(i)},o)}};function ke(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],ke(e[r],t[r]))}),Ce(Ce({},e),t)}var kt={type:"cancelation",msg:"operation is manually canceled"};function le(e){var t=!1,r=new Promise(function(n,o){e.then(function(i){return t?o(kt):n(i)}),e.catch(o)});return r.cancel=function(){return t=!0},r}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),r=t.monaco,n=st(t,["monaco"]);se(function(o){return{config:ke(o.config,n),monaco:r}})}function Ht(){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(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(n){var o=n.config,i=n.reject;return{config:o,reject:i}}),r=Ut("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function qt(){var e=ee(function(r){var n=r.config,o=r.resolve,i=r.reject;return{config:n,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){Ae(r),e.resolve(r)},function(r){e.reject(r)})}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:r,loading:n,_ref:o,className:i,wrapperProps:c}){return a.createElement("section",{style:{...de.wrapper,width:e,height:t},...c},!r&&a.createElement(Jt,null,n),a.createElement("div",{ref:o,style:{...de.fullWidth,...!r&&de.hide},className:i}))}var Xt=Qt,He=a.memo(Xt);function er(e){a.useEffect(e,[])}var ve=er;function tr(e,t,r=!0){let n=a.useRef(!0);a.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var A=tr;function K(){}function B(e,t,r,n){return rr(e,n)||nr(e,t,r,n)}function rr(e,t){return e.editor.getModel(ze(e,t))}function nr(e,t,r,n){return e.editor.createModel(t,r,n?ze(e,n):void 0)}function ze(e,t){return e.Uri.parse(t)}function or({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:c,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:f=!1,theme:d="light",loading:h="Loading...",options:m={},height:b="100%",width:j="100%",className:v,wrapperProps:I={},beforeMount:R=K,onMount:N=K}){let[x,L]=a.useState(!1),[D,w]=a.useState(!0),C=a.useRef(null),$=a.useRef(null),O=a.useRef(null),y=a.useRef(N),u=a.useRef(R),M=a.useRef(!1);ve(()=>{let s=U.init();return s.then(S=>($.current=S)&&w(!1)).catch(S=>(S==null?void 0:S.type)!=="cancelation"&&console.error("Monaco initialization: error:",S)),()=>C.current?E():s.cancel()}),A(()=>{if(C.current&&$.current){let s=C.current.getOriginalEditor(),S=B($.current,e||"",n||r||"text",i||"");S!==s.getModel()&&s.setModel(S)}},[i],x),A(()=>{if(C.current&&$.current){let s=C.current.getModifiedEditor(),S=B($.current,t||"",o||r||"text",c||"");S!==s.getModel()&&s.setModel(S)}},[c],x),A(()=>{let s=C.current.getModifiedEditor();s.getOption($.current.editor.EditorOption.readOnly)?s.setValue(t||""):t!==s.getValue()&&(s.executeEdits("",[{range:s.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),s.pushUndoStop())},[t],x),A(()=>{var s,S;(S=(s=C.current)==null?void 0:s.getModel())==null||S.original.setValue(e||"")},[e],x),A(()=>{let{original:s,modified:S}=C.current.getModel();$.current.editor.setModelLanguage(s,n||r||"text"),$.current.editor.setModelLanguage(S,o||r||"text")},[r,n,o],x),A(()=>{var s;(s=$.current)==null||s.editor.setTheme(d)},[d],x),A(()=>{var s;(s=C.current)==null||s.updateOptions(m)},[m],x);let g=a.useCallback(()=>{var k;if(!$.current)return;u.current($.current);let s=B($.current,e||"",n||r||"text",i||""),S=B($.current,t||"",o||r||"text",c||"");(k=C.current)==null||k.setModel({original:s,modified:S})},[r,t,o,e,n,i,c]),p=a.useCallback(()=>{var s;!M.current&&O.current&&(C.current=$.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...m}),g(),(s=$.current)==null||s.editor.setTheme(d),L(!0),M.current=!0)},[m,d,g]);a.useEffect(()=>{x&&y.current(C.current,$.current)},[x]),a.useEffect(()=>{!D&&!x&&p()},[D,x,p]);function E(){var S,k,z,F;let s=(S=C.current)==null?void 0:S.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:j,height:b,isEditorReady:x,loading:h,_ref:O,className:v,wrapperProps:I})}var ir=or,ar=a.memo(ir);function cr(){let[e,t]=a.useState(U.__getMonacoInstance());return ve(()=>{let r;return e||(r=U.init(),r.then(n=>{t(n)})),()=>r==null?void 0:r.cancel()}),e}var te=cr;function sr(e){let t=a.useRef();return a.useEffect(()=>{t.current=e},[e]),t.current}var ur=sr,ie=new Map;function lr({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:i,theme:c="light",line:l,loading:f="Loading...",options:d={},overrideServices:h={},saveViewState:m=!0,keepCurrentModel:b=!1,width:j="100%",height:v="100%",className:I,wrapperProps:R={},beforeMount:N=K,onMount:x=K,onChange:L,onValidate:D=K}){let[w,C]=a.useState(!1),[$,O]=a.useState(!0),y=a.useRef(null),u=a.useRef(null),M=a.useRef(null),g=a.useRef(x),p=a.useRef(N),E=a.useRef(),s=a.useRef(n),S=ur(i),k=a.useRef(!1),z=a.useRef(!1);ve(()=>{let P=U.init();return P.then(T=>(y.current=T)&&O(!1)).catch(T=>(T==null?void 0:T.type)!=="cancelation"&&console.error("Monaco initialization: error:",T)),()=>u.current?Ye():P.cancel()}),A(()=>{var T,V,Y,W;let P=B(y.current,e||n||"",t||o||"",i||r||"");P!==((T=u.current)==null?void 0:T.getModel())&&(m&&ie.set(S,(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],w),A(()=>{var P;(P=u.current)==null||P.updateOptions(d)},[d],w),A(()=>{!u.current||n===void 0||(u.current.getOption(y.current.editor.EditorOption.readOnly)?u.current.setValue(n):n!==u.current.getValue()&&(z.current=!0,u.current.executeEdits("",[{range:u.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),u.current.pushUndoStop(),z.current=!1))},[n],w),A(()=>{var T,V;let P=(T=u.current)==null?void 0:T.getModel();P&&o&&((V=y.current)==null||V.editor.setModelLanguage(P,o))},[o],w),A(()=>{var P;l!==void 0&&((P=u.current)==null||P.revealLine(l))},[l],w),A(()=>{var P;(P=y.current)==null||P.editor.setTheme(c)},[c],w);let F=a.useCallback(()=>{var P;if(!(!M.current||!y.current)&&!k.current){p.current(y.current);let T=i||r,V=B(y.current,n||e||"",t||o||"",T||"");u.current=(P=y.current)==null?void 0:P.editor.create(M.current,{model:V,automaticLayout:!0,...d},h),m&&u.current.restoreViewState(ie.get(T)),y.current.editor.setTheme(c),l!==void 0&&u.current.revealLine(l),C(!0),k.current=!0}},[e,t,r,n,o,i,d,h,m,c,l]);a.useEffect(()=>{w&&g.current(u.current,y.current)},[w]),a.useEffect(()=>{!$&&!w&&F()},[$,w,F]),s.current=n,a.useEffect(()=>{var P,T;w&&L&&((P=E.current)==null||P.dispose(),E.current=(T=u.current)==null?void 0:T.onDidChangeModelContent(V=>{z.current||L(u.current.getValue(),V)}))},[w,L]),a.useEffect(()=>{if(w){let P=y.current.editor.onDidChangeMarkers(T=>{var Y;let V=(Y=u.current.getModel())==null?void 0:Y.uri;if(V&&T.find(W=>W.path===V.path)){let W=y.current.editor.getModelMarkers({resource:V});D==null||D(W)}});return()=>{P==null||P.dispose()}}return()=>{}},[w,D]);function Ye(){var P,T;(P=E.current)==null||P.dispose(),b?m&&ie.set(i,u.current.saveViewState()):(T=u.current.getModel())==null||T.dispose(),u.current.dispose()}return a.createElement(He,{width:j,height:v,isEditorReady:w,loading:f,_ref:M,className:I,wrapperProps:R})}var fr=lr,dr=a.memo(fr),ue=dr;const re={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},ne=e=>{const{themeConfig:t,editor:r,theme:n}=e,{defaultTheme:o}=t??{},[i,c]=a.useState(n??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&&n&&(H.editor.setTheme(n),c(n))},[r,n]),{theme:i}};function ye(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 mr(e){return e.replace("'","&#39;")}const pr=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 i=Math.floor(o/30);if(i<12)return t.format(-i,"month");const c=Math.floor(i/12);return t.format(-c,"year")},gr=e=>{const t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.abs(n);return pr(o)};function Ue({instanceId:e,lineNumbersPosition:t}){let r="";return t==="center"&&(r+=`
23
23
  .monaco-editor-${e} .monaco-scrollable-element.editor-scrollable {
24
24
  width: 100% !important;
25
25
  left: 0px !important;
@@ -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 p,v,l,g,C,h,N,$;const c=(v=(p=a==null?void 0:a.commitInfo)==null?void 0:p.author)==null?void 0:v.avatarUrl,s=(g=(l=a==null?void 0:a.commitInfo)==null?void 0:l.author)==null?void 0:g.initials,d=c?`background: url('${(h=(C=a==null?void 0:a.commitInfo)==null?void 0:C.author)==null?void 0:h.avatarUrl}');`:"";for(let O=a.fromLineNumber;O<=a.toLineNumber;O++)O===a.fromLineNumber?o+=`
49
- .monaco-editor-${e} .view-line .blame-editor-commit-${O}:before {
50
- content: '${ur(lr((($=(N=a==null?void 0:a.commitInfo)==null?void 0:N.author)==null?void 0:$.when)||""))}';
48
+ }`,r}function hr({instanceId:e,blameData:t,dateWidth:r,avatarSize:n}){let o="";return t.forEach(i=>{var d,h,m,b,j,v,I,R;const c=(h=(d=i==null?void 0:i.commitInfo)==null?void 0:d.author)==null?void 0:h.avatarUrl,l=(b=(m=i==null?void 0:i.commitInfo)==null?void 0:m.author)==null?void 0:b.initials,f=c?`background: url('${(v=(j=i==null?void 0:i.commitInfo)==null?void 0:j.author)==null?void 0:v.avatarUrl}');`:"";for(let N=i.fromLineNumber;N<=i.toLineNumber;N++)N===i.fromLineNumber?o+=`
49
+ .monaco-editor-${e} .view-line .blame-editor-commit-${N}:before {
50
+ content: '${mr(gr(((R=(I=i==null?void 0:i.commitInfo)==null?void 0:I.author)==null?void 0:R.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-${O}:after {
58
- content: '${s??" "}';
57
+ .monaco-editor-${e} .view-line .blame-editor-commit-${N}: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
64
  left: ${r+10}px;
66
- top: -4px;
67
- color: var(--cn-text-3);
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);
68
72
  width: ${n}px;
69
73
  height: ${n}px;
70
- ${d}
74
+ ${f}
71
75
  background-size: 100% 100%;
72
76
  }`:o+=`
73
- .monaco-editor-${e} .view-line .blame-editor-commit-${O}:before {
77
+ .monaco-editor-${e} .view-line .blame-editor-commit-${N}:before {
74
78
  content: ' ';
75
79
  left: 10px;
76
80
  top: 0px;
77
81
  color: gray;
78
- }`}),o}function pr(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,mr=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 yr({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,showSeparators:a=!0,theme:c,height:s="75vh",options:d,className:p}){const v=i.useRef(o),l=i.useRef(null),g=i.useRef(cr(5));ie();const[C,h]=i.useState(),N=i.useRef(null),$=i.useRef(null);i.useEffect(()=>{v.current=o},[o]);function O(){const f=$.current,j=N.current;if(!f||!j)return;a&&f.changeViewZones(function(S){S.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),v.current.forEach((L,u)=>{if(u!==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",S.addZone({afterLineNumber:L.toLineNumber,heightInPx:20,domNode:m})}})});const x=[];v.current.forEach(S=>{var L;for(let u=S.fromLineNumber;u<=S.toLineNumber;u++)x.push({range:new j.Range(u,0,u+1,0),options:{before:{content:pr(u===S.fromLineNumber&&((L=S==null?void 0:S.commitInfo)==null?void 0:L.title)||"",mr),cursorStops:j.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${u}`}}})}),f.createDecorationsCollection(x)}function y(f,j){var x,S,L,u,m,R;$.current=f,N.current=j,f.setValue(e),h(f),(L=(S=(x=j.languages.typescript)==null?void 0:x.typescriptDefaults)==null?void 0:S.setDiagnosticsOptions)==null||L.call(S,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(R=(m=(u=j.languages.typescript)==null?void 0:u.javascriptDefaults)==null?void 0:m.setDiagnosticsOptions)==null||R.call(m,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),O()}i.useEffect(()=>{C==null||C.setValue(e)},[e]);const{theme:D}=ue({monacoRef:N,themeConfig:r,editor:C,theme:c}),P=i.useMemo(()=>fr({instanceId:g.current,lineNumbersPosition:n}),[o]),M=i.useMemo(()=>dr({instanceId:g.current,blameData:o,avatarSize:hr,dateWidth:gr}),[o]);i.useLayoutEffect(()=>{l.current&&l.current.style.setProperty("--line-number-display","none")},[]),i.useEffect(()=>{if(n==="center"&&l.current){const f=l.current.getElementsByClassName("lines-content")[0];if(f){const j={attributes:!0},x=()=>{const L=parseInt(getComputedStyle(f).left);l.current&&(l.current.style.setProperty("--line-number-offset",`${de+16+L}px`),l.current.style.setProperty("--line-number-display","block"))},S=new MutationObserver(x);return S.observe(f,j),x(),()=>{S.disconnect()}}}});const w=i.useMemo(()=>`
79
- .monaco-editor-${g.current} .margin {
82
+ }`}),o}function Fe(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)}U.config({monaco:H});const me=450,vr=30,yr=140,br=24,Mr={...re,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function Er({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,showSeparators:i=!0,theme:c,height:l="75vh",options:f,className:d}){const h=a.useRef(o),m=a.useRef(null),b=a.useRef(ye(5));te();const[j,v]=a.useState(),I=a.useRef(null),R=a.useRef(null);a.useEffect(()=>{h.current=o},[o]);function N(){const u=R.current,M=I.current;if(!u||!M)return;i&&u.changeViewZones(function(p){p.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),h.current.forEach((E,s)=>{if(s!==h.current.length-1){const S=document.createElement("div");S.style.borderTop="1px solid var(--cn-border-2)",S.style.marginTop="9px",S.className="blame-editor-separator",p.addZone({afterLineNumber:E.toLineNumber,heightInPx:20,domNode:S})}})});const g=[];h.current.forEach(p=>{var E;for(let s=p.fromLineNumber;s<=p.toLineNumber;s++)g.push({range:new M.Range(s,0,s+1,0),options:{before:{content:Fe(s===p.fromLineNumber&&((E=p==null?void 0:p.commitInfo)==null?void 0:E.title)||"",vr),cursorStops:M.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${s}`}}})}),u.createDecorationsCollection(g)}function x(u,M){var g,p,E,s,S,k;R.current=u,I.current=M,u.setValue(e),v(u),(E=(p=(g=M.languages.typescript)==null?void 0:g.typescriptDefaults)==null?void 0:p.setDiagnosticsOptions)==null||E.call(p,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(k=(S=(s=M.languages.typescript)==null?void 0:s.javascriptDefaults)==null?void 0:S.setDiagnosticsOptions)==null||k.call(S,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),N()}a.useEffect(()=>{j==null||j.setValue(e)},[e]);const{theme:L}=ne({monacoRef:I,themeConfig:r,editor:j,theme:c}),D=a.useMemo(()=>Ue({instanceId:b.current,lineNumbersPosition:n}),[o]),w=a.useMemo(()=>hr({instanceId:b.current,blameData:o,avatarSize:br,dateWidth:yr}),[o]);a.useLayoutEffect(()=>{m.current&&m.current.style.setProperty("--line-number-display","none")},[]),a.useEffect(()=>{if(n==="center"&&m.current){const u=m.current.getElementsByClassName("lines-content")[0];if(u){const M={attributes:!0},g=()=>{const E=parseInt(getComputedStyle(u).left);m.current&&(m.current.style.setProperty("--line-number-offset",`${me+16+E}px`),m.current.style.setProperty("--line-number-display","block"))},p=new MutationObserver(g);return p.observe(u,M),g(),()=>{p.disconnect()}}}});const C=a.useMemo(()=>`
83
+ .monaco-editor-${b.current} .margin {
84
+ display: var(--line-number-display);
85
+ left: var(--line-number-offset);
86
+ pointer-events: none;
87
+ }`,[]),$=a.useMemo(()=>`.monaco-editor-${b.current} .view-overlays {
88
+ clip-path: polygon(${me+16}px 0, 100% 0%, 100% 100%, ${me+16}px 100%);
89
+ height:100% !important;
90
+ }`,[]),O=a.useMemo(()=>({...Mr,...f}),[f]),y=a.useMemo(()=>_.jsx("style",{dangerouslySetInnerHTML:{__html:`${D} ${w} ${C} ${$}`}}),[D,w,$,C]);return _.jsxs("div",{className:d,ref:m,children:[y,_.jsx(ue,{className:`monaco-editor-${b.current} overflow-hidden rounded-b-cn-3`,height:l,language:t,theme:L,options:O,onMount:x})]})}U.config({monaco:H});const pe=450,wr=30,Sr={...re,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function Or({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,theme:i,height:c="75vh",options:l,className:f}){const d=a.useRef(o),h=a.useRef(null),m=a.useRef(ye(5));te();const[b,j]=a.useState(),v=a.useRef(null),I=a.useRef(null);a.useEffect(()=>{d.current=o},[o]);function R(){const O=I.current,y=v.current;if(!O||!y)return;O.changeViewZones(function(M){M.addZone({afterLineNumber:0,heightInPx:1,domNode:document.createElement("div")}),d.current.forEach(g=>{if(g.infoContent){const E=document.createElement("div");E.className="blame-editor-info-holder",E.style.position="relative",E.style.zIndex="100",E.style.overflow="visible",jr(E,g.infoContent),M.addZone({afterLineNumber:g.fromLineNumber-1,heightInPx:0,domNode:E})}const p=document.createElement("div");p.style.borderTop="1px solid var(--cn-border-2)",p.style.marginTop="9px",p.className="blame-editor-separator",M.addZone({afterLineNumber:g.toLineNumber,heightInPx:20,domNode:p})})});const u=[];d.current.forEach(M=>{for(let g=M.fromLineNumber;g<=M.toLineNumber;g++)u.push({range:new y.Range(g,0,g+1,0),options:{before:{content:Fe("",wr),cursorStops:y.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${g}`}}})}),O.createDecorationsCollection(u)}function N(O,y){var u,M,g,p,E,s;I.current=O,v.current=y,O.setValue(e),j(O),(g=(M=(u=y.languages.typescript)==null?void 0:u.typescriptDefaults)==null?void 0:M.setDiagnosticsOptions)==null||g.call(M,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(s=(E=(p=y.languages.typescript)==null?void 0:p.javascriptDefaults)==null?void 0:E.setDiagnosticsOptions)==null||s.call(E,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),R()}a.useEffect(()=>{b==null||b.setValue(e)},[e]);const{theme:x}=ne({monacoRef:v,themeConfig:r,editor:b,theme:i}),L=a.useMemo(()=>Ue({instanceId:m.current,lineNumbersPosition:n}),[o]);a.useLayoutEffect(()=>{h.current&&h.current.style.setProperty("--line-number-display","none")},[]),a.useEffect(()=>{if(n==="center"&&h.current){const O=h.current.getElementsByClassName("lines-content")[0];if(O){const y={attributes:!0},u=()=>{const g=parseInt(getComputedStyle(O).left);h.current&&(h.current.style.setProperty("--line-number-offset",`${pe+16+g}px`),h.current.style.setProperty("--line-number-display","block"))},M=new MutationObserver(u);return M.observe(O,y),u(),()=>{M.disconnect()}}}});const D=a.useMemo(()=>`
91
+ .monaco-editor-${m.current} .margin {
80
92
  display: var(--line-number-display);
81
93
  left: var(--line-number-offset);
82
94
  pointer-events: none;
83
- }`,[]),E=i.useMemo(()=>`.monaco-editor-${g.current} .view-overlays {
84
- clip-path: polygon(${de+16}px 0, 100% 0%, 100% 100%, ${de+16}px 100%);
95
+ }`,[]),w=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,...d}),[d]),T=i.useMemo(()=>_.jsx("style",{dangerouslySetInnerHTML:{__html:`${P} ${M} ${w} ${E}`}}),[P,M,E,w]);return _.jsxs("div",{className:p,ref:l,children:[T,_.jsx(ge,{className:`monaco-editor-${g.current} overflow-hidden rounded-b-md border-x border-b`,height:s,language:t,theme:D,options:U,onMount:y})]})}q.config({monaco:V});const br={...ce};function Or({codeRevision:e,onCodeRevisionChange:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh",className:s}){ie();const[d,p]=i.useState(),v=i.useRef(),l=i.useRef({code:"",revisionId:0}),g=i.useRef(null),C=i.useCallback(($,O)=>{var y,D,P,M,w,E;g.current=$,v.current=O,$.setValue(e.code),p($),(P=(D=(y=O.languages.typescript)==null?void 0:y.typescriptDefaults)==null?void 0:D.setDiagnosticsOptions)==null||P.call(D,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(E=(w=(M=O.languages.typescript)==null?void 0:M.javascriptDefaults)==null?void 0:w.setDiagnosticsOptions)==null||E.call(w,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0})},[e.code]);i.useEffect(()=>{var $,O;if(g.current&&(!e.revisionId||e.revisionId>Number(($=l.current)==null?void 0:$.revisionId))){const y=g.current.getModel();y&&(o!=null&&o.readOnly?(O=g.current)==null||O.setValue(e.code):(g.current.pushUndoStop(),g.current.executeEdits("edit",[{range:y.getFullModelRange(),text:e.code}]),g.current.pushUndoStop()))}},[e,g.current]);const{theme:h}=ue({monacoRef:v,themeConfig:n,editor:d,theme:a}),N=i.useMemo(()=>({...br,...o||{}}),[o]);return _.jsx(_.Fragment,{children:_.jsx(ge,{className:s,height:c,onChange:($,O)=>{l.current={code:$??"",revisionId:O.versionId},t({...l.current},O)},language:r,theme:h,options:N,onMount:C})})}q.config({monaco:V});const Mr={...ce,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function Sr({original:e,modified:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh"}){ie();const[s,d]=i.useState(),p=i.useRef(),{theme:v}=ue({monacoRef:p,themeConfig:n,editor:s,theme:a}),l=i.useMemo(()=>({...Mr,...o||{}}),[o]);return _.jsx(_.Fragment,{children:_.jsx(er,{className:"overflow-hidden rounded-b-md border-x border-b",language:r,theme:v,original:e,modified:t,height:c,options:l,onMount:d})})}var he=(e=>(e.ContainsPath="ContainsPath",e))(he||{});function wr(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(p=>{switch(p.type){case he.ContainsPath:{p.paths.forEach(v=>{let g=Object.keys(o).map(h=>({fullPath:h,path:h,symbol:o[h]})).filter(h=>h.path.startsWith(p.basePath));g=g.map(h=>({...h,path:h.path.substring(p.basePath.length)})),g.filter(h=>v.test(h.path)).forEach(h=>{const N=h.fullPath,$=h.symbol,O=$.range;s.forEach(y=>{const D={range:O,symbols:[$],onClick:y.onClick,data:y.data,path:N};a.push({range:O,command:{id:n,title:y.title,arguments:[D]}})})})});break}}})}),a}const Z=class Z{static set(t){Z.data=t}static get(){return Z.data}};Me(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 d;const o=await Ve(n),a=Ue(o),c=(d=e==null?void 0:e.current)==null?void 0:d.addCommand(0,(p,{onClick:v,path:l,range:g,data:C})=>{v({path:l,range:g,data:C})});return c?{lenses:wr({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,C,h;const d=(g=e==null?void 0:e.current)==null?void 0:g.getModel();if(!d||!c)return n(void 0);const p=await Ve(d),l=(C=Ue(p).get(c))==null?void 0:C.range;l&&(n(l),s&&((h=e==null?void 0:e.current)==null||h.revealLineInCenter(l.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])},ye=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 _.jsx(ye.Provider,{value:{markers:t,setMarkers:r,editor:n,setEditor:o,updateCursorPosition:a},children:e})}function be(){return i.useContext(ye)}const Ir=({monacoRef:e,editorRef:t,instanceId:r})=>{const{setMarkers:n}=be();i.useEffect(()=>{let o;const a=setTimeout(()=>{var s;const c=(s=e.current)==null?void 0:s.editor;c&&(o=c.onDidChangeMarkers(d=>{var l;const p=(l=t.current)==null?void 0:l.getModel();if(!p)return;const v=p.uri.toString();if(d.some(g=>g.toString()===v)){const g=V.editor.getModelMarkers({resource:p.uri});n(g)}}))},100);return()=>{clearTimeout(a),o==null||o.dispose()}},[e,r,n])};function Tr(e){var n,o;const t=((o=(n=pe.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 Dr(e){var n,o;const r=(((o=(n=pe.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};pe.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 Tr({fileMatch:[Oe(r.toString())],...t}),()=>{Dr(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:d,options:p,animateOnUpdate:v=!1,onAnimateEnd:l,instanceId:g}=t,C=ie(),[h]=i.useState(g??`yaml-editor-${Math.random()}`),{editor:N,setEditor:$}=be(),O=i.useRef(null),y=i.useRef(),D=i.useRef({yaml:"",revisionId:0}),P=i.useRef(null),M=i.useRef(null),w=i.useCallback(j=>{var L,u,m;const x=j.split(`
87
- `),S=(L=P.current)==null?void 0:L.getModel();if(S){(u=P.current)==null||u.pushUndoStop(),S.setValue("");let R=0;M.current=window.setInterval(()=>{var F;R<x.length?(C&&((F=P.current)==null||F.executeEdits("addLine",[{range:new C.Range(R+1,1,R+1,1),text:x[R]+`
88
- `}])),R++):M.current&&(clearInterval(M.current),l==null||l())},100),(m=P.current)==null||m.pushUndoStop()}},[C]);i.useEffect(()=>()=>{M.current&&clearInterval(M.current)},[]);function E(j,x){P.current=j,y.current=x,j.setValue(r.yaml),$(j),setTimeout(()=>{var S;(S=O.current)!=null&&S.style&&(O.current.style.opacity="1")},50)}i.useEffect(()=>{var j;if(P.current&&(!r.revisionId||r.revisionId>Number((j=D.current)==null?void 0:j.revisionId))){const x=P.current.getModel();x&&(P.current.executeEdits("edit",[{range:x.getFullModelRange(),text:v?"":r.yaml}]),v&&w(r.yaml))}},[w,r,v]),Lr({schemaConfig:n,instanceId:h}),xr({editorRef:P,inlineActions:o});const{theme:U}=ue({monacoRef:y,themeConfig:a,editor:N,theme:d});Ir({monacoRef:y,editorRef:P,instanceId:h}),Cr({editorRef:P,selection:s});const T=i.useMemo(()=>Oe(h),[]),f=i.useMemo(()=>({...Rr,...p}),[p]);return _.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:O,children:_.jsx(ge,{onChange:(j,x)=>{D.current={yaml:j??"",revisionId:x.versionId},c({...D.current},x)},language:"yaml",theme:U,options:f,path:T,onMount:E})})};exports.BlameEditor=yr;exports.CodeDiffEditor=Sr;exports.CodeEditor=Or;exports.MonacoGlobals=oe;exports.SelectorType=he;exports.YamlEditor=Nr;exports.YamlEditorContext=ye;exports.YamlEditorContextProvider=$r;exports.useYamlEditorContext=be;
98
+ }`,[]),C=a.useMemo(()=>({...Sr,...l}),[l]),$=a.useMemo(()=>_.jsx("style",{dangerouslySetInnerHTML:{__html:`${L} ${D} ${w}`}}),[L,w,D]);return _.jsxs("div",{className:f,ref:h,children:[$,_.jsx(ue,{className:`monaco-editor-${m.current} overflow-hidden rounded-b-cn-3`,height:c,language:t,theme:x,options:C,onMount:N})]})}function jr(e,t){return new IntersectionObserver(([n],o)=>{if(n.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 xr(e){const{editor:t,keyword:r}=e;a.useEffect(()=>{if(!t||!r)return;const n=t.getModel(),o=n.findMatches(r,!1,!1,!1,null,!1);o.length>0&&o.forEach(i=>{n.deltaDecorations([],[{range:i.range,options:{isWholeLine:!1,inlineClassName:"CodeEditor_HighlightedText"}}])})},[t,r])}function Pr(e){const{enable:t,editor:r,onSelectedLineChange:n,selectedLine:o,onSelectedLineButtonClick:i}=e,c=a.useRef(null),l=a.useRef(!1),f=a.useRef(null);f.current=f.current??(r==null?void 0:r.createDecorationsCollection([]))??null,a.useEffect(()=>{let d;const h=setTimeout(()=>{if(!t||!r)return;const m=b=>{var v,I,R,N;if((I=(v=b.target)==null?void 0:v.element)!=null&&I.classList.contains("CodeEditor_HighlightedGlyphMargin")){i==null||i((R=b.target)==null?void 0:R.element);return}const j=Cr((N=b.target)==null?void 0:N.element);if(!j){n==null||n(void 0),i==null||i(void 0),ge(r,f.current,void 0);return}l.current=!0,c.current=j,n==null||n(j),ge(r,f.current,j,!1),i==null||i(void 0)};d=r.onMouseDown(m)},100);return()=>{clearTimeout(h),d==null||d.dispose()}},[l,o,n,t,r,i,f]),a.useEffect(()=>{r&&c.current!==o&&ge(r,f.current,o,!0)},[r,o,f])}function ge(e,t,r,n){if(!r){t==null||t.set([]);return}t==null||t.set([{range:new H.Range(r,1,r,1),options:{isWholeLine:!0,className:"CodeEditor_HighlightedLine"}}]),e==null||e.setSelection(new H.Range(r,0,r,0)),n&&(e==null||e.revealLineInCenter(r))}function Cr(e){const t=e!=null&&e.classList.contains("line-numbers")?e:void 0;if(!t)return;const r=parseInt(t.textContent??"");if(!isNaN(r))return r}const $r=`.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 Ir={...re};function Nr({codeRevision:e,onCodeRevisionChange:t,language:r,themeConfig:n,options:o,theme:i,enableLinesSelection:c=!1,selectedLine:l,onSelectedLineChange:f,onSelectedLineButtonClick:d,highlightKeyword:h,height:m="75vh",className:b,onMount:j}){const v=a.useRef(ye(5));te();const[I,R]=a.useState(),N=a.useRef(),x=a.useRef({code:"",revisionId:0}),L=a.useRef(null),D=a.useCallback((O,y)=>{var u,M,g,p,E,s;L.current=O,N.current=y,O.setValue(e.code),R(O),(g=(M=(u=y.languages.typescript)==null?void 0:u.typescriptDefaults)==null?void 0:M.setDiagnosticsOptions)==null||g.call(M,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(s=(E=(p=y.languages.typescript)==null?void 0:p.javascriptDefaults)==null?void 0:E.setDiagnosticsOptions)==null||s.call(E,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),j==null||j(O,y)},[e.code,j]);a.useEffect(()=>{var O,y;if(L.current&&(!e.revisionId||e.revisionId>Number((O=x.current)==null?void 0:O.revisionId))){const u=L.current.getModel();u&&(o!=null&&o.readOnly?(y=L.current)==null||y.setValue(e.code):(L.current.pushUndoStop(),L.current.executeEdits("edit",[{range:u.getFullModelRange(),text:e.code}]),L.current.pushUndoStop()))}},[e,o==null?void 0:o.readOnly,L]);const{theme:w}=ne({monacoRef:N,themeConfig:n,editor:I,theme:i});Pr({enable:c,editor:I,selectedLine:l,onSelectedLineChange:f,onSelectedLineButtonClick:d}),xr({editor:I,keyword:h});const C=a.useMemo(()=>({...Ir,...o||{}}),[o]),$=a.useMemo(()=>`.monaco-editor-${v.current} .margin-view-overlays .line-numbers { cursor: pointer !important; } ${$r}`,[]);return _.jsxs(_.Fragment,{children:[c&&_.jsx("style",{dangerouslySetInnerHTML:{__html:$}}),_.jsx(ue,{className:`monaco-editor-${v.current} ${b}`,height:m,onChange:(O,y)=>{x.current={code:O??"",revisionId:y.versionId},t==null||t({...x.current},y)},language:r,theme:w,options:C,onMount:D})]})}U.config({monaco:H});const Lr={...re,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function Rr({original:e,modified:t,language:r,themeConfig:n,options:o,theme:i,height:c="75vh"}){te();const[l,f]=a.useState(),d=a.useRef(),{theme:h}=ne({monacoRef:d,themeConfig:n,editor:l,theme:i}),m=a.useMemo(()=>({...Lr,...o||{}}),[o]);return _.jsx(_.Fragment,{children:_.jsx(ar,{className:"overflow-hidden rounded-b-cn-3 border-x border-b",language:r,theme:h,original:e,modified:t,height:c,options:m,onMount:f})})}var be=(e=>(e.ContainsPath="ContainsPath",e))(be||{});function Tr(e){const{pathSymbolMap:t,inlineActions:r=[],commandId:n}=e,o=Object.fromEntries(t.entries()),i=[];return r==null||r.forEach(c=>{const l=c.actions;c.selectors.forEach(d=>{switch(d.type){case be.ContainsPath:{d.paths.forEach(h=>{let b=Object.keys(o).map(v=>({fullPath:v,path:v,symbol:o[v]})).filter(v=>v.path.startsWith(d.basePath));b=b.map(v=>({...v,path:v.path.substring(d.basePath.length)})),b.filter(v=>h.test(v.path)).forEach(v=>{const I=v.fullPath,R=v.symbol,N=R.range;l.forEach(x=>{const L={range:N,symbols:[R],onClick:x.onClick,data:x.data,path:I};i.push({range:N,command:{id:n,title:x.title,arguments:[L]}})})})});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:r}=t.StandaloneServices.get(t.ILanguageFeaturesService);return await t.OutlineModel.create(r,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:{Dr(e);break}case J.languages.SymbolKind.Array:{_r(e);break}default:kr(e)}}function Dr(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)),Me({pathSymbolMap:e.pathSymbolMap,parentPath:r,children:t.children,parentKind:((n=t==null?void 0:t.symbol)==null?void 0:n.kind)??e.parentKind})})}function _r(e){let t=0;e.children.forEach(r=>{const n=e.parentPath?`${e.parentPath}.${t}`:`${t}`;e.pathSymbolMap.set(n,r.symbol),t+=1,Me({pathSymbolMap:e.pathSymbolMap,parentPath:n,children:r.children,parentKind:r.symbol.kind})})}function kr(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 Vr({editorRef:e,inlineActions:t}){a.useEffect(()=>H.languages.registerCodeLensProvider("yaml",{provideCodeLenses:async n=>{var f,d,h,m,b;if(((f=n==null?void 0:n.uri)==null?void 0:f.toString())!==((m=(h=(d=e.current)==null?void 0:d.getModel())==null?void 0:h.uri)==null?void 0:m.toString()))return{lenses:[],dispose:()=>{}};const o=await qe(n),i=We(o),c=(b=e==null?void 0:e.current)==null?void 0:b.addCommand(0,(j,{onClick:v,path:I,range:R,data:N})=>{v({path:I,range:R,data:N})});return c?{lenses:Tr({pathSymbolMap:i,inlineActions:t,commandId:c}),dispose:()=>{}}:void 0}}).dispose,[t,e])}const Ar=({editorRef:e,selection:t})=>{const[r,n]=a.useState(),o=a.useMemo(()=>async(i,c,l)=>{var b,j,v;const f=(b=e==null?void 0:e.current)==null?void 0:b.getModel();if(!f||!c)return n(void 0);const d=await qe(f),m=(j=We(d).get(c))==null?void 0:j.range;m&&(n(m),l&&((v=e==null?void 0:e.current)==null||v.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(!r)return;const i=(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()=>i==null?void 0:i.clear()},[r,e,t==null?void 0:t.className])},Ee=a.createContext({markers:[],setMarkers:()=>{},editor:null,setEditor:e=>{},updateCursorPosition:e=>{}});function Hr({children:e}){const[t,r]=a.useState([]),[n,o]=a.useState(null),i=a.useCallback(c=>{n==null||n.setPosition(c),n==null||n.revealLineInCenterIfOutsideViewport(c.lineNumber),n==null||n.focus()},[n]);return _.jsx(Ee.Provider,{value:{markers:t,setMarkers:r,editor:n,setEditor:o,updateCursorPosition:i},children:e})}function we(){return a.useContext(Ee)}const zr=({monacoRef:e,editorRef:t,instanceId:r})=>{const{setMarkers:n}=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 h=d.uri.toString();if(f.some(b=>b.toString()===h)){const b=H.editor.getModelMarkers({resource:d.uri});n(b)}}))},100);return()=>{clearTimeout(i),o==null||o.dispose()}},[e,r,n])};function Ur(e){var n,o;const t=((o=(n=he.yamlDefaults)==null?void 0:n.diagnosticsOptions)==null?void 0:o.schemas)??[],r=t.findIndex(i=>i.fileMatch[0]===e.fileMatch[0]);r!==-1?t[r]=e:t.push(e),Be(t)}function Fr(e){var n,o;const r=(((o=(n=he.yamlDefaults)==null?void 0:n.diagnosticsOptions)==null?void 0:o.schemas)??[]).filter(i=>i.fileMatch[0]!==Se(e));Be(r)}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(),qr=e=>{const{schemaConfig:t,instanceId:r}=e;a.useEffect(()=>{if(t!=null&&t.schema)return Ur({fileMatch:[Se(r.toString())],...t}),()=>{Fr(r)}},[t==null?void 0:t.schema,r])};U.config({monaco:H});const Wr={...re,folding:!0},Br=function(t){const{yamlRevision:r,schemaConfig:n,inlineActions:o,themeConfig:i,onYamlRevisionChange:c,selection:l,theme:f,options:d,animateOnUpdate:h=!1,onAnimateEnd:m,instanceId:b,height:j}=t,v=te(),[I]=a.useState(b??`yaml-editor-${Math.random()}`),{editor:R,setEditor:N}=we(),x=a.useRef(null),L=a.useRef(),D=a.useRef({yaml:"",revisionId:0}),w=a.useRef(null),C=a.useRef(null),$=a.useCallback(g=>{var s,S,k;const p=g.split(`
122
+ `),E=(s=w.current)==null?void 0:s.getModel();if(E){(S=w.current)==null||S.pushUndoStop(),E.setValue("");let z=0;C.current=window.setInterval(()=>{var F;z<p.length?(v&&((F=w.current)==null||F.executeEdits("addLine",[{range:new v.Range(z+1,1,z+1,1),text:p[z]+`
123
+ `}])),z++):C.current&&(clearInterval(C.current),m==null||m())},100),(k=w.current)==null||k.pushUndoStop()}},[v]);a.useEffect(()=>()=>{C.current&&clearInterval(C.current)},[]);function O(g,p){w.current=g,L.current=p,g.setValue(r.yaml),N(g),setTimeout(()=>{var E;(E=x.current)!=null&&E.style&&(x.current.style.opacity="1")},50)}a.useEffect(()=>{var g;if(w.current&&(!r.revisionId||r.revisionId>Number((g=D.current)==null?void 0:g.revisionId))){const p=w.current.getModel();p&&(w.current.executeEdits("edit",[{range:p.getFullModelRange(),text:h?"":r.yaml}]),h&&$(r.yaml))}},[$,r,h]),qr({schemaConfig:n,instanceId:I}),Vr({editorRef:w,inlineActions:o});const{theme:y}=ne({monacoRef:L,themeConfig:i,editor:R,theme:f});zr({monacoRef:L,editorRef:w,instanceId:I}),Ar({editorRef:w,selection:l});const u=a.useMemo(()=>Se(I),[]),M=a.useMemo(()=>({...Wr,...d}),[d]);return _.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:x,children:_.jsx(ue,{onChange:(g,p)=>{D.current={yaml:g??"",revisionId:p.versionId},c({...D.current},p)},language:"yaml",theme:y,options:M,path:u,onMount:O,height:j})})};exports.BlameEditor=Er;exports.BlameEditorV2=Or;exports.CodeDiffEditor=Rr;exports.CodeEditor=Nr;exports.MonacoGlobals=ce;exports.SelectorType=be;exports.YamlEditor=Br;exports.YamlEditorContext=Ee;exports.YamlEditorContextProvider=Hr;exports.useYamlEditorContext=we;
89
124
  //# sourceMappingURL=index.cjs.map