@harnessio/yaml-editor 0.19.0 → 0.20.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.
@@ -7,7 +7,7 @@ export type UseTheme = (arg: {
7
7
  themeConfig?: {
8
8
  rootElementSelector?: string;
9
9
  defaultTheme?: string;
10
- themes?: ThemeDefinition[];
10
+ monacoThemes?: ThemeDefinition[];
11
11
  };
12
12
  theme?: string;
13
13
  editor: any;
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var qe=Object.defineProperty;var Be=(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)=>(Be(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 Ye(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=Ye(J);var Le={exports:{}},X={};/*
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={};/*
2
2
  object-assign
3
3
  (c) Sindre Sorhus
4
4
  @license MIT
@@ -9,8 +9,8 @@ object-assign
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 Ie(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=Ie;X.jsxs=Ie;Le.exports=X;var A=Le.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 Ce(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 xe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ce(Object(r),!0).forEach(function(n){ut(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(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 dt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ft(e,t){return ne(t)||F("changeType"),Object.keys(t).some(function(r){return!dt(e,r)})&&F("changeField"),t}function pt(e){Q(e)||F("selectorType")}function mt(e){Q(e)||ne(e)||F("handlerType"),ne(e)&&Object.values(e).some(function(t){return!Q(t)})&&F("handlersType")}function gt(e){e||F("initialIsRequired"),ne(e)||F("initialType"),lt(e)&&F("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"},F=K(ht)(vt),te={changes:ft,selector:pt,handler:mt,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 d(l){st(n,o,a,c)(l)}return[s,d]}function yt(e,t){return Q(t)?t(e.current):t}function Ot(e,t){return e.current=xe(xe({},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),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?(Ct(),{paths:{vs:e.urls.monacoBase}}):e}function Ct(){console.warn(Re.deprecation)}function xt(e,t){throw new Error(e[t]||e.default)}var Re={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 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!
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(xt)(Re),$t={config:Pt},Lt=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 Te(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Te(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 It=wt.create({config:Mt,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ne=nt(It,2),ee=Ne[0],ae=Ne[1];function Rt(e){var t=$t.config(e),r=t.monaco,n=rt(t,["monaco"]);ae(function(o){return{config:Te(o.config,n),monaco:r}})}function Tt(){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);Lt(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:Rt,init:Tt,__getMonacoInstance:Vt},Ut={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},de=Ut,zt={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ft=zt;function qt({children:e}){return i.createElement("div",{style:Ft.container},e)}var Bt=qt,Yt=Bt;function Ht({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:a,wrapperProps:c}){return i.createElement("section",{style:{...de.wrapper,width:e,height:t},...c},!r&&i.createElement(Yt,null,n),i.createElement("div",{ref:o,style:{...de.fullWidth,...!r&&de.hide},className:a}))}var Wt=Ht,_e=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 _=Gt;function G(){}function Y(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:d=!1,theme:l="light",loading:h="Loading...",options:p={},height:g="100%",width:L="100%",className:v,wrapperProps:T={},beforeMount:x=G,onMount:S=G}){let[b,R]=i.useState(!1),[C,M]=i.useState(!0),E=i.useRef(null),j=i.useRef(null),U=i.useRef(null),w=i.useRef(S),f=i.useRef(x),P=i.useRef(!1);me(()=>{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=Y(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=Y(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(p)},[p],b);let m=i.useCallback(()=>{var N;if(!j.current)return;f.current(j.current);let u=Y(j.current,e||"",n||r||"text",a||""),y=Y(j.current,t||"",o||r||"text",c||"");(N=E.current)==null||N.setModel({original:u,modified:y})},[r,t,o,e,n,a,c]),I=i.useCallback(()=>{var u;!P.current&&U.current&&(E.current=j.current.editor.createDiffEditor(U.current,{automaticLayout:!0,...p}),m(),(u=j.current)==null||u.editor.setTheme(l),R(!0),P.current=!0)},[p,l,m]);i.useEffect(()=>{b&&w.current(E.current,j.current)},[b]),i.useEffect(()=>{!C&&!b&&I()},[C,b,I]);function D(){var y,N,z,H;let u=(y=E.current)==null?void 0:y.getModel();s||((N=u==null?void 0:u.original)==null||N.dispose()),d||((z=u==null?void 0:u.modified)==null||z.dispose()),(H=E.current)==null||H.dispose()}return i.createElement(_e,{width:L,height:g,isEditorReady:b,loading:h,_ref:U,className:v,wrapperProps:T})}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:l={},overrideServices:h={},saveViewState:p=!0,keepCurrentModel:g=!1,width:L="100%",height:v="100%",className:T,wrapperProps:x={},beforeMount:S=G,onMount:b=G,onChange:R,onValidate:C=G}){let[M,E]=i.useState(!1),[j,U]=i.useState(!0),w=i.useRef(null),f=i.useRef(null),P=i.useRef(null),m=i.useRef(b),I=i.useRef(S),D=i.useRef(),u=i.useRef(n),y=nr(a),N=i.useRef(!1),z=i.useRef(!1);me(()=>{let O=q.init();return O.then($=>(w.current=$)&&U(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>f.current?Fe():O.cancel()}),_(()=>{var $,k,W,B;let O=Y(w.current,e||n||"",t||o||"",a||r||"");O!==(($=f.current)==null?void 0:$.getModel())&&(p&&re.set(y,(k=f.current)==null?void 0:k.saveViewState()),(W=f.current)==null||W.setModel(O),p&&((B=f.current)==null||B.restoreViewState(re.get(a))))},[a],M),_(()=>{var O;(O=f.current)==null||O.updateOptions(l)},[l],M),_(()=>{!f.current||n===void 0||(f.current.getOption(w.current.editor.EditorOption.readOnly)?f.current.setValue(n):n!==f.current.getValue()&&(z.current=!0,f.current.executeEdits("",[{range:f.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),f.current.pushUndoStop(),z.current=!1))},[n],M),_(()=>{var $,k;let O=($=f.current)==null?void 0:$.getModel();O&&o&&((k=w.current)==null||k.editor.setModelLanguage(O,o))},[o],M),_(()=>{var O;s!==void 0&&((O=f.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){I.current(w.current);let $=a||r,k=Y(w.current,n||e||"",t||o||"",$||"");f.current=(O=w.current)==null?void 0:O.editor.create(P.current,{model:k,automaticLayout:!0,...l},h),p&&f.current.restoreViewState(re.get($)),w.current.editor.setTheme(c),s!==void 0&&f.current.revealLine(s),E(!0),N.current=!0}},[e,t,r,n,o,a,l,h,p,c,s]);i.useEffect(()=>{M&&m.current(f.current,w.current)},[M]),i.useEffect(()=>{!j&&!M&&H()},[j,M,H]),u.current=n,i.useEffect(()=>{var O,$;M&&R&&((O=D.current)==null||O.dispose(),D.current=($=f.current)==null?void 0:$.onDidChangeModelContent(k=>{z.current||R(f.current.getValue(),k)}))},[M,R]),i.useEffect(()=>{if(M){let O=w.current.editor.onDidChangeMarkers($=>{var W;let k=(W=f.current.getModel())==null?void 0:W.uri;if(k&&$.find(B=>B.path===k.path)){let B=w.current.editor.getModelMarkers({resource:k});C==null||C(B)}});return()=>{O==null||O.dispose()}}return()=>{}},[M,C]);function Fe(){var O,$;(O=D.current)==null||O.dispose(),g?p&&re.set(a,f.current.saveViewState()):($=f.current.getModel())==null||$.dispose(),f.current.dispose()}return i.createElement(_e,{width:L,height:v,isEditorReady:M,loading:d,_ref:P,className:T,wrapperProps:x})}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.themes)==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;")}function sr({instanceId:e,lineNumbersPosition:t}){let r="";return t==="center"&&(r+=`
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+=`
23
23
  .monaco-editor-${e} .monaco-scrollable-element.editor-scrollable {
24
24
  width: 100% !important;
25
25
  left: 0px !important;
@@ -44,14 +44,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
44
44
 
45
45
  .monaco-editor-${e} .view-line .blame-editor-commit {
46
46
  display: inline-block;
47
- color: var(--canary-foreground-01);
48
- }`,r}function lr({instanceId:e,blameData:t,dateWidth:r,avatarSize:n}){let o="";return t.forEach(a=>{var l,h,p,g,L,v,T,x;const c=(h=(l=a==null?void 0:a.commitInfo)==null?void 0:l.author)==null?void 0:h.avatarUrl,s=(g=(p=a==null?void 0:a.commitInfo)==null?void 0:p.author)==null?void 0:g.initials,d=c?`background: url('${(v=(L=a==null?void 0:a.commitInfo)==null?void 0:L.author)==null?void 0:v.avatarUrl}');`:"";for(let S=a.fromLineNumber;S<=a.toLineNumber;S++)S===a.fromLineNumber?o+=`
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
49
  .monaco-editor-${e} .view-line .blame-editor-commit-${S}:before {
50
- content: '${ur(((x=(T=a==null?void 0:a.commitInfo)==null?void 0:T.author)==null?void 0:x.when)||"")}';
50
+ content: '${ur(lr(((C=(R=a==null?void 0:a.commitInfo)==null?void 0:R.author)==null?void 0:C.when)||""))}';
51
51
  position: absolute;
52
52
  left: 10px;
53
53
  top: 0px;
54
- color: hsl(var(--canary-foreground-03));
54
+ color: var(--cn-text-3);
55
55
  }
56
56
 
57
57
  .monaco-editor-${e} .view-line .blame-editor-commit-${S}:after {
@@ -60,14 +60,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
60
60
  border-radius: 50%;
61
61
  padding: 4px;
62
62
  text-align: center;
63
- background: hsl(var(--canary-background-11));
63
+ background: var(--cn-set-gray-soft-bg);
64
64
  line-height: 17px;
65
65
  left: ${r+10}px;
66
66
  top: -4px;
67
- color: hsl(var(--canary-foreground-03));
67
+ color: var(--cn-text-3);
68
68
  width: ${n}px;
69
69
  height: ${n}px;
70
- ${d}
70
+ ${f}
71
71
  background-size: 100% 100%;
72
72
  }`:o+=`
73
73
  .monaco-editor-${e} .view-line .blame-editor-commit-${S}:before {
@@ -75,15 +75,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
75
75
  left: 10px;
76
76
  top: 0px;
77
77
  color: gray;
78
- }`}),o}function dr(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 fe=450,fr=30,pr=140,mr=24,gr={...ce,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function hr({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,showSeparators:a=!0,theme:c,height:s="75vh",options:d}){const l=i.useRef(o),h=i.useRef(cr(5));ie();const[p,g]=i.useState(),[L,v]=i.useState(0),T=i.useRef(null),x=i.useRef(null);i.useEffect(()=>{l.current=o},[o]);function S(){const w=x.current,f=T.current;if(!w||!f)return;a&&w.changeViewZones(function(m){m.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),l.current.forEach((I,D)=>{if(D!==l.current.length-1){const u=document.createElement("div");u.style.borderTop="1px solid hsl(var(--canary-border-01))",u.style.marginTop="9px",u.className="blame-editor-separator",m.addZone({afterLineNumber:I.toLineNumber,heightInPx:20,domNode:u})}})});const P=[];l.current.forEach(m=>{var I;for(let D=m.fromLineNumber;D<=m.toLineNumber;D++)P.push({range:new f.Range(D,0,D+1,0),options:{before:{content:dr(D===m.fromLineNumber&&((I=m==null?void 0:m.commitInfo)==null?void 0:I.title)||"",fr),cursorStops:f.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${D}`}}})}),w.createDecorationsCollection(P)}function b(w,f){var P,m,I,D,u,y;x.current=w,T.current=f,w.setValue(e),g(w),(I=(m=(P=f.languages.typescript)==null?void 0:P.typescriptDefaults)==null?void 0:m.setDiagnosticsOptions)==null||I.call(m,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(y=(u=(D=f.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(()=>{p==null||p.setValue(e)},[e]);const{theme:R}=ue({monacoRef:T,themeConfig:r,editor:p,theme:c}),C=i.useMemo(()=>sr({instanceId:h.current,lineNumbersPosition:n}),[o]),M=i.useMemo(()=>lr({instanceId:h.current,blameData:o,avatarSize:mr,dateWidth:pr}),[o]);i.useEffect(()=>{if(n==="center"){const w=document.getElementsByClassName("lines-content")[0];if(w){const f={attributes:!0},P=I=>{for(const D of I){const u=parseInt(getComputedStyle(w).left);v(u)}},m=new MutationObserver(P);return m.observe(w,f),()=>{m.disconnect()}}}});const E=i.useMemo(()=>`
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
79
  .monaco-editor-${h.current} .margin {
80
- left: ${fe+16+L}px !important;
80
+ left: ${de+16+I}px !important;
81
81
  pointer-events: none;
82
- }`,[L]),j=`
82
+ }`,[I]),j=`
83
83
  .monaco-editor-${h.current} .view-overlays {
84
- clip-path: polygon(${fe+16}px 0, 100% 0%, 100% 100%, ${fe+16}px 100%);
84
+ clip-path: polygon(${de+16}px 0, 100% 0%, 100% 100%, ${de+16}px 100%);
85
85
  height:100% !important;
86
- }`,U=i.useMemo(()=>({...gr,...d}),[d]);return A.jsxs(A.Fragment,{children:[A.jsx("style",{dangerouslySetInnerHTML:{__html:`${C} ${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:R,options:U,onMount:b})]})}q.config({monaco:V});const vr={...ce};function br({codeRevision:e,onCodeRevisionChange:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh",className:s}){ie();const[d,l]=i.useState(),h=i.useRef(),p=i.useRef({code:"",revisionId:0}),g=i.useRef(null),L=i.useCallback((x,S)=>{var b,R,C,M,E,j;g.current=x,h.current=S,x.setValue(e.code),l(x),(C=(R=(b=S.languages.typescript)==null?void 0:b.typescriptDefaults)==null?void 0:R.setDiagnosticsOptions)==null||C.call(R,{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 x,S;if(g.current&&(!e.revisionId||e.revisionId>Number((x=p.current)==null?void 0:x.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:d,theme:a}),T=i.useMemo(()=>({...vr,...o||{}}),[o]);return A.jsx(A.Fragment,{children:A.jsx(ge,{className:s,height:c,onChange:(x,S)=>{p.current={code:x??"",revisionId:S.versionId},t({...p.current},S)},language:r,theme:v,options:T,onMount:L})})}q.config({monaco:V});const yr={...ce,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function Or({original:e,modified:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh"}){ie();const[s,d]=i.useState(),l=i.useRef(),{theme:h}=ue({monacoRef:l,themeConfig:n,editor:s,theme:a}),p=i.useMemo(()=>({...yr,...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:p,onMount:d})})}var he=(e=>(e.ContainsPath="ContainsPath",e))(he||{});function Sr(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 T=v.fullPath,x=v.symbol,S=x.range;s.forEach(b=>{const R={range:S,symbols:[x],onClick:b.onClick,data:b.data,path:T};a.push({range:S,command:{id:n,title:b.title,arguments:[R]}})})})});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:{wr(e);break}case J.languages.SymbolKind.Array:{Mr(e);break}default:Er(e)}}function wr(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 Mr(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 Er(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 jr({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,(l,{onClick:h,path:p,range:g,data:L})=>{h({path:p,range:g,data:L})});return c?{lenses:Sr({pathSymbolMap:a,inlineActions:t,commandId:c}),dispose:()=>{}}:void 0}}).dispose,[t,e])}const Pr=({editorRef:e,selection:t})=>{const[r,n]=i.useState(),o=i.useMemo(()=>async(a,c,s)=>{var g,L,v;const d=(g=e==null?void 0:e.current)==null?void 0:g.getModel();if(!d||!c)return n(void 0);const l=await Ve(d),p=(L=Ue(l).get(c))==null?void 0:L.range;p&&(n(p),s&&((v=e==null?void 0:e.current)==null||v.revealLineInCenter(p.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 Cr({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 xr=({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(d=>{var p;const l=(p=t.current)==null?void 0:p.getModel();if(!l)return;const h=l.uri.toString();if(d.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 $r(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),ze(t)}function Lr(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));ze(r)}function ze(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(),Dr=e=>{const{schemaConfig:t,instanceId:r}=e;i.useEffect(()=>{if(t!=null&&t.schema)return $r({fileMatch:[Oe(r.toString())],...t}),()=>{Lr(r)}},[t==null?void 0:t.schema,r])};q.config({monaco:V});const Ir={...ce,folding:!0},Rr=function(t){const{yamlRevision:r,schemaConfig:n,inlineActions:o,themeConfig:a,onYamlRevisionChange:c,selection:s,theme:d,options:l,animateOnUpdate:h=!1,onAnimateEnd:p,instanceId:g}=t,L=ie(),[v]=i.useState(g??`yaml-editor-${Math.random()}`),{editor:T,setEditor:x}=ye(),S=i.useRef(null),b=i.useRef(),R=i.useRef({yaml:"",revisionId:0}),C=i.useRef(null),M=i.useRef(null),E=i.useCallback(P=>{var D,u,y;const m=P.split(`
87
- `),I=(D=C.current)==null?void 0:D.getModel();if(I){(u=C.current)==null||u.pushUndoStop(),I.setValue("");let N=0;M.current=window.setInterval(()=>{var z;N<m.length?(L&&((z=C.current)==null||z.executeEdits("addLine",[{range:new L.Range(N+1,1,N+1,1),text:m[N]+`
88
- `}])),N++):M.current&&(clearInterval(M.current),p==null||p())},100),(y=C.current)==null||y.pushUndoStop()}},[L]);i.useEffect(()=>()=>{M.current&&clearInterval(M.current)},[]);function j(P,m){C.current=P,b.current=m,P.setValue(r.yaml),x(P),setTimeout(()=>{var I;(I=S.current)!=null&&I.style&&(S.current.style.opacity="1")},50)}i.useEffect(()=>{var P;if(C.current&&(!r.revisionId||r.revisionId>Number((P=R.current)==null?void 0:P.revisionId))){const m=C.current.getModel();m&&(C.current.executeEdits("edit",[{range:m.getFullModelRange(),text:h?"":r.yaml}]),h&&E(r.yaml))}},[E,r,h]),Dr({schemaConfig:n,instanceId:v}),jr({editorRef:C,inlineActions:o});const{theme:U}=ue({monacoRef:b,themeConfig:a,editor:T,theme:d});xr({monacoRef:b,editorRef:C,instanceId:v}),Pr({editorRef:C,selection:s});const w=i.useMemo(()=>Oe(v),[]),f=i.useMemo(()=>({...Ir,...l}),[l]);return A.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:S,children:A.jsx(ge,{onChange:(P,m)=>{R.current={yaml:P??"",revisionId:m.versionId},c({...R.current},m)},language:"yaml",theme:U,options:f,path:w,onMount:j})})};exports.BlameEditor=hr;exports.CodeDiffEditor=Or;exports.CodeEditor=br;exports.MonacoGlobals=oe;exports.SelectorType=he;exports.YamlEditor=Rr;exports.YamlEditorContext=be;exports.YamlEditorContextProvider=Cr;exports.useYamlEditorContext=ye;
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;
89
89
  //# sourceMappingURL=index.cjs.map