"use strict";(self.webpackChunkfeno_web=self.webpackChunkfeno_web||[]).push([["6800"],{16547(e,n,t){t.r(n),t.d(n,{MonacoDiffViewer:()=>d});var i=t(10199),r=t(90063),o=t(82318),l=t(43346),u=t(23945);function d(e){let{original:n,modified:t,language:d="typescript",inline:s=!1,onContentHeightChange:a}=e,f=(0,r.useRef)(null),c=(0,r.useRef)(null),g=(0,r.useRef)(null),[h,S]=(0,r.useState)(l.$);(0,l.j)(S);let m=(0,r.useRef)(a),b=(0,r.useRef)(s);return(0,r.useEffect)(()=>{m.current=a},[a]),(0,r.useEffect)(()=>{b.current=s},[s]),(0,r.useEffect)(()=>{if(!f.current)return;(0,u.O)();let e=o.S.EN.createModel(n,d),i=o.S.EN.createModel(t,d),r=o.S.EN.createDiffEditor(f.current,{theme:"dark"===h?"feno-dark":"feno-light",readOnly:!0,renderSideBySide:!s,minimap:{enabled:!1},lineNumbers:"on",lineNumbersMinChars:3,glyphMargin:!1,folding:!1,scrollBeyondLastLine:!1,fontSize:12,lineHeight:20,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',automaticLayout:!1,renderOverviewRuler:!1,stickyScroll:{enabled:!1},smoothScrolling:!1,renderLineHighlight:"none",occurrencesHighlight:"off",selectionHighlight:!1,renderValidationDecorations:"off",links:!1,hover:{enabled:!1},hideUnchangedRegions:{enabled:!1},lightbulb:{enabled:o.S.EN.ShowLightbulbIconMode.Off}});r.setModel({original:e,modified:i}),c.current=r,g.current={original:e,modified:i};let l=r.getModifiedEditor(),a=r.getOriginalEditor(),S=()=>{let e=m.current;e&&e(b.current?l.getContentHeight():Math.max(l.getContentHeight(),a.getContentHeight()))},E=[l.onDidContentSizeChange(S),a.onDidContentSizeChange(S),r.onDidUpdateDiff(S)];S();let p=new ResizeObserver(()=>r.layout());return p.observe(f.current),()=>{for(let e of(p.disconnect(),E))e.dispose();r.setModel(null),r.dispose(),e.dispose(),i.dispose(),c.current=null,g.current=null}},[]),(0,r.useEffect)(()=>{let e=g.current;e&&(e.original.getValue()!==n&&e.original.setValue(n),e.modified.getValue()!==t&&e.modified.setValue(t))},[n,t]),(0,r.useEffect)(()=>{let e=g.current;e&&(o.S.EN.setModelLanguage(e.original,d),o.S.EN.setModelLanguage(e.modified,d))},[d]),(0,r.useEffect)(()=>{let e=c.current;e&&e.updateOptions({renderSideBySide:!s})},[s]),(0,r.useEffect)(()=>{o.S.EN.setTheme("dark"===h?"feno-dark":"feno-light")},[h]),(0,i.jsx)("div",{ref:f,className:"h-full w-full"})}}}]);