import{E as S,a as I}from"./chunk-JPHJ3OD7.js";import{B as q,K as F}from"./chunk-LDWBA6DZ.js";import{Db as v,E as f,Eb as w,Nc as E,Oc as O,Pc as N,Qb as h,Rb as C,Ub as y,Xa as M,be as R,na as j,od as D,sa as g,ua as m,wa as p,ya as a,za as _,zc as b}from"./chunk-WL5U2YIT.js";import{e as z}from"./chunk-ADEKKGI2.js";function Y(o={}){return _([{provide:c,useValue:o}])}var A,c,x,T,V,J,K,L=z(()=>{R();R();S();j();F();A=["editorContainer"],c=new p("NGX_MONACO_EDITOR_CONFIG"),x=!1,V=(()=>{let i=class i{constructor(){this.config=a(c),this.onInit=new v,this._insideNg=!1}set insideNg(e){this._insideNg=e,this._editor&&(this._editor.dispose(),this.initMonaco(this._options,this.insideNg))}get insideNg(){return this._insideNg}ngAfterViewInit(){x?T.then(()=>{this.initMonaco(this._options,this.insideNg)}):(x=!0,T=new Promise(e=>{let t=this.config.baseUrl;if((t==="assets"||!t)&&(t="./assets/monaco/min/vs"),typeof window.monaco=="object"){this.initMonaco(this._options,this.insideNg),e();return}let n=r=>{let l=r||window.require,u={paths:{vs:`${t}`}};Object.assign(u,this.config.requireConfig||{}),l.config(u),l(["vs/editor/editor.main"],()=>{typeof this.config.onMonacoLoad=="function"&&this.config.onMonacoLoad(),this.initMonaco(this._options,this.insideNg),e()})};if(this.config.monacoRequire)n(this.config.monacoRequire);else if(window.require)if(window.require.config)n();else{var s=`${t}/loader.js`,d=new XMLHttpRequest;d.addEventListener("load",()=>{let r=document.createElement("script");r.type="text/javascript",r.text=["var nodeRequire = require;",d.responseText.replace('"use strict";',""),"var monacoAmdRequire = require;","require = nodeRequire;","require.nodeRequire = require;"].join(`
`),document.body.appendChild(r),n(window.monacoAmdRequire)}),d.open("GET",s),d.send()}else{let r=document.createElement("script");r.type="text/javascript",r.src=`${t}/loader.js`,r.addEventListener("load",()=>{n()}),document.body.appendChild(r)}}))}ngOnDestroy(){this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._editor&&(this._editor.dispose(),this._editor=void 0)}};i.\u0275fac=function(t){return new(t||i)},i.\u0275cmp=h({type:i,selectors:[["ng-component"]],viewQuery:function(t,n){if(t&1&&E(A,7),t&2){let s;O(s=N())&&(n._editorContainer=s.first)}},inputs:{insideNg:"insideNg"},outputs:{onInit:"onInit"},standalone:!1,decls:0,vars:0,template:function(t,n){},encapsulation:2});let o=i;return o})(),J=(()=>{let i=class i extends V{constructor(){super(...arguments),this.zone=a(w),this._value="",this.propagateChange=e=>{},this.onTouched=()=>{}}set options(e){this._options=Object.assign({},this.config.defaultOptions,e),this._editor&&(this._editor.dispose(),this.initMonaco(this._options,this.insideNg))}get options(){return this._options}set model(e){this.options.model=e,this._editor&&(this._editor.dispose(),this.initMonaco(this.options,this.insideNg))}writeValue(e){this._value=e||"",setTimeout(()=>{this._editor&&!this.options.model&&this._editor.setValue(this._value)})}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.options.readOnly=e||this._options.readOnly}initMonaco(e,t){let n=!!e.model;if(n){let s=monaco.editor.getModel(e.model.uri||"");s?(e.model=s,e.model.setValue(this._value)):e.model=monaco.editor.createModel(e.model.value,e.model.language,e.model.uri)}t?this._editor=monaco.editor.create(this._editorContainer.nativeElement,e):this.zone.runOutsideAngular(()=>{this._editor=monaco.editor.create(this._editorContainer.nativeElement,e)}),n||this._editor.setValue(this._value),this._editor.onDidChangeModelContent(s=>{let d=this._editor.getValue();this.zone.run(()=>{this.propagateChange(d),this._value=d})}),this._editor.onDidBlurEditorWidget(()=>{this.onTouched()}),this._editor.setTheme=s=>{this.options.theme=s,monaco.editor.setTheme(s)},this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._windowResizeSubscription=f(window,"resize").subscribe(()=>this._editor.layout()),this.onInit.emit(this._editor)}};i.\u0275fac=(()=>{let e;return function(n){return(e||(e=M(i)))(n||i)}})(),i.\u0275cmp=h({type:i,selectors:[["ngx-monaco-editor"]],inputs:{options:"options",model:"model"},features:[D([{provide:I,useExisting:g(()=>i),multi:!0}]),y],decls:2,vars:0,consts:[["editorContainer",""],[1,"editor-container"]],template:function(t,n){t&1&&b(0,"div",1,0)},styles:["[_nghost-%COMP%]{display:block;height:200px}.editor-container[_ngcontent-%COMP%]{width:100%;height:98%}"],changeDetection:0});let o=i;return o})(),K=(()=>{let i=class i{static forRoot(e={}){return{ngModule:i,providers:[{provide:c,useValue:e}]}}};i.\u0275fac=function(t){return new(t||i)},i.\u0275mod=C({type:i}),i.\u0275inj=m({imports:[q]});let o=i;return o})()});export{J as a,K as b,Y as c,L as d};
