"use strict";(globalThis.webpackChunkgrafana=globalThis.webpackChunkgrafana||[]).push([[8926],{70669(M,s,r){r.r(s),r.d(s,{ReactMonacoEditor:()=>k});var f=r(74848),u=r(58807),d=r(10858),g=r(96540),c=r(49439),v=r(84140);function m(n){if(n===void 0)return{};{const o={"editor.background":n.components.input.background,"minimap.background":n.colors.background.secondary};return Object.keys(o).forEach(t=>{o[t]=a(o[t])}),o}}function a(n){return(0,v.A)(n).toHexString()}function y(n,o){const t=m(o);n.editor.defineTheme("grafana-dark",{base:"vs-dark",inherit:!0,colors:t,rules:[{token:"predefined",foreground:a(o?.visualization.getColorByName("purple"))},{token:"operator",foreground:a(o?.visualization.getColorByName("orange"))},{token:"tag",foreground:a(o?.visualization.getColorByName("green"))}]}),n.editor.defineTheme("grafana-light",{base:"vs",inherit:!0,colors:t,rules:[{token:"predefined",foreground:a(o?.visualization.getColorByName("purple"))},{token:"operator",foreground:a(o?.visualization.getColorByName("orange"))},{token:"tag",foreground:a(o?.visualization.getColorByName("green"))}]})}u.wG.config({monaco:d});const k=n=>{const{beforeMount:o,onMount:t,options:C,...p}=n,e=(0,c.$j)(),h=(0,g.useCallback)(i=>{o?.(i)},[o]);return(0,g.useEffect)(()=>{y(d,e)},[e]),(0,f.jsx)(u.Ay,{...p,options:{...C,fontFamily:e.typography.code.fontFamily},theme:e.isDark?"grafana-dark":"grafana-light",beforeMount:h,onMount:(i,l)=>{document.fonts.ready.then(()=>{l.editor.remeasureFonts()}),t?.(i,l)}})}}}]);

//# sourceMappingURL=react-monaco-editor.48daebd629d506724bb7.js.map