@opensumi/cli-engine 3.6.5-next-1735183968.0 → 3.6.5-next-1735612114.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.
@@ -28252,7 +28252,7 @@ ${JSON.stringify(r,null,2)}`);const l=n[o]();return new Language(INTERNAL,l)})}}
28252
28252
  `);let f=0;_.forEach((a,b)=>{const{parts:y,currentStyle:S}=(0,v.ansiParser)(a,this.lastStyle);this.lastStyle=S,this.matchOutput(c,y,f||b);const A=y.map(T=>T.content).join(""),w=Math.ceil(A.length/u);f+=Math.max(1,w)})}}getMatcherRules(){const c=this.inlineChatFeatureRegistry.getTerminalActions(),h=[];return c.forEach(d=>{const u=this.inlineChatFeatureRegistry.getTerminalHandler(d.id);Array.isArray(u?.triggerRules)&&u.triggerRules.forEach(_=>{_ instanceof p.BaseTerminalDetectionLineMatcher?h.push({matcher:_,action:d}):typeof _=="function"&&Object.getPrototypeOf(_)===p.BaseTerminalDetectionLineMatcher&&h.push({matcher:new _,action:d})})}),h}matchOutput(c,h,d){var u,_;if(this.currentActions)this.currentActions.matcher.match(h)?(u=this.outputRecordMap.get(c))===null||u===void 0||u.push({type:this.currentActions.matcher.type,text:h.map(f=>f.content).join("")}):this.matchedEnd(c,this.currentActions);else{const a=this.getMatcherRules().find(b=>b.matcher.match(h));a&&(this.registerMarker(c,d),(_=this.outputRecordMap.get(c))===null||_===void 0||_.push({type:a.matcher.type,text:h.map(b=>b.content).join("")}),a.matcher.isMultiLine?this.currentActions={action:a.action,matcher:a.matcher}:this.matchedEnd(c,a))}}matchedEnd(c,h){var d,u;const _=this.resolveDelControl((d=this.inputRecordMap.get(c))===null||d===void 0?void 0:d.map(a=>a.text).join(`
28253
28253
  `)),f=(u=this.outputRecordMap.get(c))===null||u===void 0?void 0:u.map(a=>a.text).join(`
28254
28254
  `);this.addDecoration(c,h,_,f),this.report(h.matcher.type,_,f),this.resetState(c)}addDecoration(c,h,d,u){const _=this.terminalController.clients.get(c),f=_?.term,a=this.clientCurrentMarker.get(c);if(f&&u&&a){const b=u?.split(`
28255
- `).length;this.terminalDecorations.addZoneDecoration(f,a,b,{operationList:[h.action],onClickItem:()=>{const y=this.inlineChatFeatureRegistry.getTerminalHandler(h.action.id);y&&y.execute(u,d||"",h.matcher)}})}}resolveDelControl(c=""){const h=c.split("");let d=0;for(;d<h.length;)if(h[d].charCodeAt(0)===127){const u=Math.max(d-1,0);h.splice(u,1),d=u}else d++;return h.join("")}report(c,h,d){}registerMarker(c,h){const d=this.terminalController.clients.get(c);if(d){const u=d.term.registerMarker(h);this.clientCurrentMarker.set(c,u),this.disposables.push(u)}}handleClientInput(c,h){const d=h.toString(),u=this.inputRecordMap.get(c);/[\r\n]/.test(d)?(this.isTyping=!1,u?.push({text:this.inputCache})):(this.inputCache+=d,this.isTyping=!0)}};t.AITerminalService=s,n.__decorate([(0,r.Autowired)(l.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(E.AITerminalDecorationService),n.__metadata("design:type",E.AITerminalDecorationService)],s.prototype,"terminalDecorations",void 0),n.__decorate([(0,r.Autowired)(o.InlineChatFeatureRegistryToken),n.__metadata("design:type",m.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalService=s=n.__decorate([(0,r.Injectable)()],s)},32113:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalPrompt=t.KeyboardSelectableList=void 0;const n=e(85608),r=e(45250),o=n.__importStar(e(14041)),l=e(41869),m=e(81878),E=e(89195),p=n.__importDefault(e(58274)),v=g=>{const{items:c,handleSuggestionClick:h,noListen:d=!1,controller:u}=g,[_,f]=(0,o.useState)(-1),a=b=>{switch(b.key){case"ArrowUp":f(y=>Math.max(y-1,0));break;case"ArrowDown":f(y=>Math.min(y+1,c.length-1));break;case"Enter":c[_]&&h(c[_].command);break;default:break}};return(0,o.useEffect)(()=>{if(!d)return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[c,_]),(0,o.useEffect)(()=>{if(!u)return;const b=u.event(y=>{y==="ArrowUp"&&f(S=>Math.max(S-1,0)),(y==="ArrowDown"||y==="Tab")&&f(S=>Math.min(S+1,c.length-1)),y==="Enter"&&c[_]&&h(c[_].command)});return()=>{b.dispose()}},[u,_,c]),(0,o.useEffect)(()=>{f(0)},[c]),o.default.createElement("div",{className:p.default.suggestions},c.map((b,y)=>o.default.createElement("div",{key:y,className:p.default.suggestionItem,style:{backgroundColor:y===_?"var(--selection-background)":""},onClick:()=>h(b.command)},o.default.createElement("div",{className:p.default.suggestionItemContainer},o.default.createElement("div",{className:p.default.suggestionDesc},b.description),o.default.createElement("div",{className:p.default.suggestionCmd},b.command)))))};t.KeyboardSelectableList=v;const s=g=>{const{onEscTriggered:c,onSuggestionClick:h,getAICommandSuggestions:d,cancelAIRequst:u}=g,[_,f]=(0,o.useState)(""),[a,b]=(0,o.useState)([]),[y,S]=(0,o.useState)(!1),[A,w]=(0,o.useState)((0,l.localize)("terminal.ai.escClose")),T=(0,o.useRef)(null),D=(0,o.useCallback)(async M=>{S(!0),w((0,l.localize)("terminal.ai.requesting")),d(M,()=>{S(!1),w((0,l.localize)("terminal.ai.selectHint"))},()=>{S(!0),w((0,l.localize)("terminal.ai.thinking"))},k=>{b([...k].reverse())})},[a]),I=(0,o.useCallback)((0,r.debounce)(M=>{D(M)},1e3),[]);(0,o.useEffect)(()=>{const M=k=>{(k.key==="Escape"||k.keyCode===27)&&c()};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[]),(0,o.useEffect)(()=>{const M=k=>{T.current&&!T.current.contains(k.target)&&c()};return document.addEventListener("mousedown",M),()=>{document.removeEventListener("mousedown",M)}},[c]);const O=M=>{const k=M.target.value;f(k),k.length>0&&!k.includes("'")&&I(k),k.length===0&&(b([]),w((0,l.localize)("terminal.ai.escClose")),u&&u())},L=(0,o.useCallback)(()=>{D(_)},[_]),R=M=>{h(M)};return o.default.createElement("div",{className:p.default.container,ref:T},o.default.createElement("div",{className:p.default.header},o.default.createElement("div",{style:{flex:"1"}},(0,l.localize)("terminal.ai.headerHint")),o.default.createElement("div",null,o.default.createElement(E.EnhanceIcon,{className:(0,m.getIcon)("close1"),onClick:()=>{c()}}))),o.default.createElement("div",{style:{position:"relative",marginLeft:"-14px"}},a.length>0&&o.default.createElement(t.KeyboardSelectableList,{items:a,handleSuggestionClick:R})),o.default.createElement("div",{className:p.default.inputContainer},o.default.createElement(m.Input,{type:"text",value:_,onKeyDown:M=>{(M.key==="ArrowUp"||M.key==="ArrowDown")&&M.preventDefault()},onChange:O,onPressEnter:()=>L(),placeholder:(0,l.localize)("terminal.ai.inputHint"),className:p.default.input,autoFocus:!0}),y?o.default.createElement("div",{className:p.default.ai_loading},o.default.createElement("div",{className:p.default.loader}),o.default.createElement("div",{className:p.default.loader}),o.default.createElement("div",{className:p.default.loader})):o.default.createElement(E.EnhanceIcon,{wrapperClassName:p.default.send_icon,className:(0,m.getIcon)("send-solid"),onClick:()=>{I(_)}})),o.default.createElement("div",{className:p.default.statusContainer},A))};t.AITerminalPrompt=s},39273:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalInlineWidgetForDetection=t.TerminalInlineWidgetForSelection=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(89195),l=n.__importDefault(e(57410)),m=({actions:p,onClickItem:v})=>r.default.createElement("div",{className:l.default.terminal_inline_chat},r.default.createElement(o.AIAction,{operationList:p,onClickItem:v}));t.TerminalInlineWidgetForSelection=m;const E=({actions:p,onClickItem:v})=>{const[s,g]=(0,r.useState)(!1);return r.default.createElement("div",{onMouseOver:c=>{g(!0),c.currentTarget.style.backgroundColor="rgba(255, 0, 0, 0.1)"},onMouseOut:c=>{g(!1),c.currentTarget.style.backgroundColor=""},style:{width:"100%",height:"100%"}},r.default.createElement("div",{className:l.default.terminal_inline_chat,style:{display:s?"block":"none"}},r.default.createElement(o.AIAction,{operationList:p,onClickItem:v})))};t.TerminalInlineWidgetForDetection=E},96415:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalDecorationService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(25873),l=e(76003),m=e(43718),E=e(6487),p=e(2281),v=e(39273);let s=class extends m.Disposable{constructor(){super(...arguments),this.decorationList=[],this.decorationRootMap=new Map}active(){this.disposables.push(this.terminalController.onDidOpenTerminal(({id:c})=>this.doSelectionDecoration(c)))}addZoneDecoration(c,h,d,u){const _=c.registerDecoration({marker:h,width:c.cols,height:d});if(!_){console.error("Failed to create decoration for line",h);return}let f;_.onRender(a=>{f||(f=(0,o.createRoot)(a)),f.render(r.default.createElement(v.TerminalInlineWidgetForDetection,{actions:u.operationList,onClickItem:()=>{u.onClickItem()}}))}),_.onDispose(()=>{f&&f.unmount()})}doSelectionDecoration(c){const h=this.terminalController.clients.get(c),d=h?.term;d&&this.addDispose(d.onSelectionChange(()=>{const u=this.decorationList.pop();u&&(0,m.runWhenIdle)(()=>{u?.dispose()});const _=d.getSelectionPosition(),f=d.getSelection().trim();if(_&&f.length>0){const a=_.end.y,b=_.start.y,y=d.buffer.active.cursorY+d.buffer.active.baseY,S=b-y,A=a-b+1,w=d.registerMarker(S);if(w){const T=d.registerDecoration({marker:w,width:d.cols,height:A});if(T){let D;T.onRender(I=>{D||(D=(0,o.createRoot)(I));const L=this.inlineChatFeatureRegistry.getTerminalActions().filter(R=>{var M;return((M=this.inlineChatFeatureRegistry.getTerminalHandler(R.id))===null||M===void 0?void 0:M.triggerRules)==="selection"});D.render(r.default.createElement(v.TerminalInlineWidgetForSelection,{actions:L,onClickItem:R=>{const M=this.inlineChatFeatureRegistry.getTerminalHandler(R);M&&M.execute(f,"")}}))}),T.onDispose(()=>{D&&D.unmount()}),this.decorationList.push(T)}}}}))}};t.AITerminalDecorationService=s,n.__decorate([(0,l.Autowired)(E.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,l.Autowired)(m.InlineChatFeatureRegistryToken),n.__metadata("design:type",p.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalDecorationService=s=n.__decorate([(0,l.Injectable)()],s)},4397:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTerminalDetectionLineMatcher=t.MatcherType=void 0;var e;(function(r){r[r.base=0]="base",r[r.npm=1]="npm",r[r.typescript=2]="typescript",r[r.node=3]="node",r[r.shell=4]="shell",r[r.java=5]="java"})(e||(t.MatcherType=e={}));class n{constructor(){this.type=e.base,this.isMultiLine=!1,this.isMatched=!1,this.maxSpaceLine=0,this.currentSpaceLine=0}match(o){return this.doMatch(o)?(this.isMatched=!0,this.currentSpaceLine=0,!0):this.isMultiLine&&this.isMatched&&this.currentSpaceLine<this.maxSpaceLine?(this.currentSpaceLine++,!0):(this.isMatched=!1,!1)}}t.BaseTerminalDetectionLineMatcher=n},28358:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=t.ShellMatcher=t.NPMMatcher=t.TSCMatcher=t.NodeMatcher=void 0,e(85608).__exportStar(e(4397),t);var r=e(12636);Object.defineProperty(t,"NodeMatcher",{enumerable:!0,get:function(){return r.NodeMatcher}});var o=e(41084);Object.defineProperty(t,"TSCMatcher",{enumerable:!0,get:function(){return o.TSCMatcher}});var l=e(97323);Object.defineProperty(t,"NPMMatcher",{enumerable:!0,get:function(){return l.NPMMatcher}});var m=e(29640);Object.defineProperty(t,"ShellMatcher",{enumerable:!0,get:function(){return m.ShellMatcher}});var E=e(82036);Object.defineProperty(t,"JavaMatcher",{enumerable:!0,get:function(){return E.JavaMatcher}})},82036:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.java,this.isMultiLine=!0}doMatch(l){return this.isErrorStack(l)||this.isCasuseByError(l)||this.isExceptionError(l)}isErrorStack(l){return this.isMatched&&!!l.find(m=>/^\s+at\s/i.test(m.content))}isCasuseByError(l){return!!l.find(m=>/caused\sby:/i.test(m.content))}isExceptionError(l){return!!l.find(m=>/\w+Exception:/i.test(m.content))}}t.JavaMatcher=r},12636:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.node,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(m){return this.isSingleLineError(m)||this.isMultiPartError(m)}isSingleLineError(m){return m.length===1&&(0,n.isRedColor)(m[0])&&(this.isMatched||!this.isExcludeContent(m[0].content))}isMultiPartError(m){return m.length>1&&!m.some(E=>!(0,n.isRedColor)(E))}isExcludeContent(m){return m.length<20||/mfsu/i.test(m)||/\s-\s/.test(m)}}t.NodeMatcher=o},97323:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NPMMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.npm,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(m){return!!m.find(E=>/ERR/.test(E.content)&&(0,n.isRedColor)(E))}}t.NPMMatcher=o},29640:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShellMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.shell,this.isMultiLine=!1}doMatch(l){return!!l.find(m=>/command\snot\sfound/.test(m.content))}}t.ShellMatcher=r},41084:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TSCMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.typescript,this.isMultiLine=!0}doMatch(m){let E=!1,p=!1,v=!1;return m.forEach(s=>{/error/i.test(s.content)&&(0,n.isRedColor)(s)&&(E=!0),/TS\d+/.test(s.content)&&(p=!0),/Error:/i.test(s.content)&&(v=!0)}),E||p||v||this.isErrorStack(m)}isErrorStack(m){return this.isMatched&&!!m.find(E=>/^\s+at\s/i.test(E.content))}}t.TSCMatcher=o},14717:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PS1TerminalService=void 0;const n=e(85608),r=n.__importDefault(e(124)),o=n.__importDefault(e(14041)),l=e(25873),m=e(76003),E=e(41869),p=e(43718),v=e(6487),s=e(93062),g=e(32113),c=e(95121);var h;(function(u){u.PromptStarted="PS",u.PromptEnded="PE",u.CurrentWorkingDirectory="CWD"})(h||(h={}));let d=class extends p.Disposable{constructor(){super(...arguments),this.cancelToken=new p.CancellationTokenSource}active(){this.initContainer(),this.disposables.push(this.terminalController.onDidOpenTerminal(({id:_})=>this.listenTerminalEvent(_)))}listenTerminalEvent(_){const f=this.terminalController.clients.get(_);f&&setTimeout(()=>{this.listenPromptState(f.term)},0)}initContainer(){this.popupContainer=document.createElement("div"),document.body.appendChild(this.popupContainer)}listenPromptState(_){_.parser.registerOscHandler(6973,f=>{const a=f.indexOf(";");switch(a===-1?f:f.substring(0,a)){case h.PromptEnded:this.handlePromptEnd(_);break;default:return!1}return!1})}handlePromptEnd(_){this.promptEndMarker&&this.promptEndMarker.dispose(),this.promptEndDecoration&&this.promptEndDecoration.dispose(),this.promptEndMarker=_.registerMarker(0);const f=_.buffer.active.cursorX;this.onDataDisposable&&this.onDataDisposable.dispose();const a=_.registerDecoration({marker:this.promptEndMarker,width:_.cols,height:1,x:f+2,layer:"top"});a?.onRender(b=>{b.innerText=(0,E.localize)("terminal.ai.inputSharpToGetHint"),b.style.opacity="0.3"}),this.onDataDisposable=_.onData(b=>{var y;const S=_.buffer.active,A=S.cursorX,w=S.cursorY;a?.dispose(),b==="#"&&w+S.baseY===((y=this.promptEndMarker)===null||y===void 0?void 0:y.line)&&(A===f||A===f+1)&&this.showAICommandPopup(_,f)})}showAICommandPopup(_,f){var a,b,y;if(!this.promptEndMarker)return;this.promptEndDecoration=_.registerDecoration({marker:this.promptEndMarker,width:1,height:1,backgroundColor:"#2472C8",x:f,layer:"top"});const S=_._addonManager._addons.find(w=>{var T;return!!(!((T=w?.instance)===null||T===void 0)&&T.connection)}),A=(a=S?.instance)===null||a===void 0?void 0:a.connection;if(!A){console.error((0,E.localize)("terminal.ai.cannotGetTerminalConnection"));return}(b=this.promptEndDecoration)===null||b===void 0||b.onRender(w=>{const T=w.clientWidth;this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),this.promptEndReactRoot=(0,l.createRoot)(this.popupContainer),this.promptEndReactRoot.render(o.default.createElement(g.AITerminalPrompt,{onEscTriggered:()=>{setTimeout(()=>{var D;A.sendData("\b"),(D=this.promptEndDecoration)===null||D===void 0||D.dispose()},0)},onSuggestionClick:D=>{setTimeout(()=>{var I;A.sendData("\b"),A.sendData(D),(I=this.promptEndDecoration)===null||I===void 0||I.dispose()},0)},getAICommandSuggestions:this.getAICommandSuggestions.bind(this),cancelAIRequst:this.stopAIStreamRequest.bind(this)})),(0,r.default)(this.popupContainer,w,{points:["bl","bl"],offset:[-T-6,0],targetOffset:[0,0],overflow:{adjustX:!1,adjustY:!1}})}),(y=this.promptEndDecoration)===null||y===void 0||y.onDispose(()=>{this.stopAIStreamRequest(),this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),_.focus()})}async stopAIStreamRequest(){this.cancelToken.cancel(),this.cancelToken=new p.CancellationTokenSource}async getAICommandSuggestions(_,f,a,b){await this.stopAIStreamRequest();const y=this.aiReporter.start(p.AIServiceType.TerminalAICommand,{message:_}),S=await this.terminalFeatureRegistry.readableCommandSuggestions(_,this.cancelToken.token),A=[];(0,s.listenReadable)(S,{onData:w=>{A.push(w),b(A)},onEnd:()=>{f(),this.aiReporter.end(y,{message:_,success:!0,actionSource:p.ActionSourceEnum.Terminal})}})}};t.PS1TerminalService=d,n.__decorate([(0,m.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],d.prototype,"terminalController",void 0),n.__decorate([(0,m.Autowired)(p.TerminalRegistryToken),n.__metadata("design:type",c.TerminalFeatureRegistry)],d.prototype,"terminalFeatureRegistry",void 0),n.__decorate([(0,m.Autowired)(p.IAIReporter),n.__metadata("design:type",Object)],d.prototype,"aiReporter",void 0),t.PS1TerminalService=d=n.__decorate([(0,m.Injectable)()],d)},28505:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalAIContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(63439),E=e(96415),p=e(14717),v=e(95121);let s=class{onDidStart(){this.aiNativeConfigService.capabilities.supportsTerminalDetection&&(this.aiTerminalService.active(),this.aiTerminalDecorationService.active()),this.aiNativeConfigService.capabilities.supportsTerminalCommandSuggest&&this.terminalFeatureRegistry.hasProvider()&&this.ps1TerminalService.active()}};t.TerminalAIContribution=s,n.__decorate([(0,r.Autowired)(m.AITerminalService),n.__metadata("design:type",m.AITerminalService)],s.prototype,"aiTerminalService",void 0),n.__decorate([(0,r.Autowired)(E.AITerminalDecorationService),n.__metadata("design:type",E.AITerminalDecorationService)],s.prototype,"aiTerminalDecorationService",void 0),n.__decorate([(0,r.Autowired)(p.PS1TerminalService),n.__metadata("design:type",p.PS1TerminalService)],s.prototype,"ps1TerminalService",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],s.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(l.TerminalRegistryToken),n.__metadata("design:type",v.TerminalFeatureRegistry)],s.prototype,"terminalFeatureRegistry",void 0),t.TerminalAIContribution=s=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],s)},95121:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(93062),m=e(77633);let E=class extends o.Disposable{constructor(){super(...arguments),this.providerMap=new Set}hasProvider(){return this.providerMap.size>0}registerCommandSuggestionsProvider(v){this.providerMap.add(v)}async readableCommandSuggestions(v,s){const g=Array.from(this.providerMap),c=[],h=[];for await(const u of g){const _=await u(v,s);if((0,l.isReadableStream)(_)){c.push(_);continue}h.push(..._)}const d=m.TerminalSuggestionReadableStream.create();return h.forEach(d.emitData.bind(d)),c.length===0?queueMicrotask(()=>{d.end()}):(0,l.listenGroupReadable)(c,{onData:d.emitData.bind(d),onEnd:d.end.bind(d)}),d}};t.TerminalFeatureRegistry=E,t.TerminalFeatureRegistry=E=n.__decorate([(0,r.Injectable)()],E)},60772:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorCode=t.StyleCode=void 0,t.ansiParser=p,t.isRedColor=v;const r=e(85608).__importDefault(e(91371)),o={color:0,isSpecialColor:!1,isRgbColor:!1,is256Color:!1,bgColor:0,isSpecialBg:!1,isRgbBg:!1,is256Bg:!1,bold:!1,underline:!1};var l;(function(s){s[s.RESET=0]="RESET",s[s.BOLD=1]="BOLD",s[s.UNDERLINE=4]="UNDERLINE",s[s.RESET_BOLD=22]="RESET_BOLD",s[s.RESET_UNDERLINE=24]="RESET_UNDERLINE"})(l||(t.StyleCode=l={}));var m;(function(s){s[s.MODE_RGB=2]="MODE_RGB",s[s.MODE_256=5]="MODE_256",s[s.BLACK=30]="BLACK",s[s.RED=31]="RED",s[s.GREEN=32]="GREEN",s[s.YELLOW=33]="YELLOW",s[s.BLUE=34]="BLUE",s[s.MAGENTA=35]="MAGENTA",s[s.CYAN=36]="CYAN",s[s.WHITE=37]="WHITE",s[s.SPECIAL_COLOR_MODE=38]="SPECIAL_COLOR_MODE",s[s.RESET_COLOR=39]="RESET_COLOR",s[s.BLACK_BG=40]="BLACK_BG",s[s.RED_BG=41]="RED_BG",s[s.GREEN_BG=42]="GREEN_BG",s[s.YELLOW_BG=43]="YELLOW_BG",s[s.BLUE_BG=44]="BLUE_BG",s[s.MAGENTA_BG=45]="MAGENTA_BG",s[s.CYAN_BG=46]="CYAN_BG",s[s.WHITE_BG=47]="WHITE_BG",s[s.SPECIAL_BG_MODE=48]="SPECIAL_BG_MODE",s[s.RESET_BG=49]="RESET_BG",s[s.BLACK_BRIGHT=90]="BLACK_BRIGHT",s[s.RED_BRIGHT=91]="RED_BRIGHT",s[s.GREEN_BRIGHT=92]="GREEN_BRIGHT",s[s.YELLOW_BRIGHT=93]="YELLOW_BRIGHT",s[s.BLUE_BRIGHT=94]="BLUE_BRIGHT",s[s.MAGENTA_BRIGHT=95]="MAGENTA_BRIGHT",s[s.CYAN_BRIGHT=96]="CYAN_BRIGHT",s[s.WHITE_BRIGHT=97]="WHITE_BRIGHT",s[s.BLACK_HIGH_INTENSITY=100]="BLACK_HIGH_INTENSITY",s[s.RED_HIGH_INTENSITY=101]="RED_HIGH_INTENSITY",s[s.GREEN_HIGH_INTENSITY=102]="GREEN_HIGH_INTENSITY",s[s.BLUE_HIGH_INTENSITY=104]="BLUE_HIGH_INTENSITY",s[s.MAGENTA_HIGH_INTENSITY=105]="MAGENTA_HIGH_INTENSITY",s[s.CYAN_HIGH_INTENSITY=106]="CYAN_HIGH_INTENSITY",s[s.WHITE_HIGH_INTENSITY=107]="WHITE_HIGH_INTENSITY"})(m||(t.ColorCode=m={}));function E(s,g,c){g.isSpecialColor||g.isSpecialBg?c===m.SPECIAL_COLOR_MODE?g.color=s:g.bgColor=s:s>=30&&s<=37||s>=90&&s<=97?g.color=s:(s>=40&&s<=47||s>=100&&s<=107)&&(g.bgColor=s)}function p(s,g){const c=(0,r.default)(),h=[];let d,u=0;const _={...g||o};for(;d=c.exec(s);){const a=s.slice(u,d.index);a&&h.push({content:a,..._});const b=d[0].slice(2,-1).split(";").map(Number);if(b.length)for(let y=0;y<b.length;y++){const S=b[y],A=b[y-1];switch(S){case l.RESET:Object.assign(_,o);break;case l.BOLD:_.bold=!0;break;case l.UNDERLINE:_.underline=!0;break;case l.RESET_BOLD:_.bold=!1;break;case l.RESET_UNDERLINE:_.underline=!1;break;case m.RESET_COLOR:_.color=0;break;case m.RESET_BG:_.bgColor=0;break;case m.SPECIAL_COLOR_MODE:_.isSpecialColor=!0;break;case m.SPECIAL_BG_MODE:_.isSpecialBg=!0;break;case m.MODE_RGB:A===m.SPECIAL_COLOR_MODE?_.isRgbColor=!0:_.isRgbBg=!0;break;case m.MODE_256:A===m.SPECIAL_COLOR_MODE?_.is256Color=!0:_.is256Bg=!0;break;default:E(S,_,b[y-2])}}u=d.index+d[0].length}const f=s.slice(u);return f&&h.push({content:f,..._}),{parts:h,currentStyle:_}}function v(s){const{color:g,isSpecialColor:c,is256Color:h}=s;return c?h?g===1||g===9||g>=160&&g<=196:g===255:g===m.RED||g===m.RED_BRIGHT}},32004:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(19413),E=e(19413),p=e(32016),v=e(74055),s=e(84543),g=e(61282),c=e(51081),h=e(29770),d=e(11735),u=e(59347),_=e(70394),f=e(72713),a=e(57232),b=e(99301),y=e(74292),S=e(35363),A=e(44298),w=e(33588),T=e(2204),D=e(2994),I=e(28505),O=e(95121),L=e(85679),R=e(3841),M=e(77633),k=e(2281),B=e(31031),x=e(15989);let N=class extends o.BrowserModule{constructor(){super(),this.contributionProvider=M.AINativeCoreContribution,this.providers=[p.AINativeBrowserContribution,S.InterfaceNavigationContribution,I.TerminalAIContribution,A.MergeConflictContribution,f.AICodeActionContribution,R.AINativePreferencesContribution,b.IntelligentCompletionsContribution,{token:o.InlineChatFeatureRegistryToken,useClass:k.InlineChatFeatureRegistry},{token:o.ChatFeatureRegistryToken,useClass:d.ChatFeatureRegistry},{token:o.ChatRenderRegistryToken,useClass:_.ChatRenderRegistry},{token:o.ResolveConflictRegistryToken,useClass:w.ResolveConflictRegistry},{token:l.IntelligentCompletionsRegistryToken,useClass:y.IntelligentCompletionsRegistry},{token:o.IAIInlineChatService,useClass:B.AIInlineChatService},{token:m.IChatManagerService,useClass:g.ChatManagerService},{token:m.IChatAgentService,useClass:v.ChatAgentService},{token:o.ChatAgentViewServiceToken,useClass:s.ChatAgentViewService},{token:m.IChatInternalService,useClass:u.ChatInternalService},{token:m.ChatProxyServiceToken,useClass:c.ChatProxyService},{token:o.ChatServiceToken,useClass:h.ChatService},{token:o.RenameCandidatesProviderRegistryToken,useClass:D.RenameCandidatesProviderRegistry},{token:l.ProblemFixRegistryToken,useClass:T.ProblemFixProviderRegistry},{token:l.TerminalRegistryToken,useClass:O.TerminalFeatureRegistry},{token:L.LanguageParserService,useClass:L.LanguageParserService},{token:E.IAIInlineCompletionsProvider,useClass:a.AIInlineCompletionsProvider},{token:x.InlineDiffService,useClass:x.InlineDiffService}],this.backServices=[{servicePath:o.AIBackSerivcePath,token:o.AIBackSerivceToken,clientToken:m.ChatProxyServiceToken}],this.aiNativeConfig.setAINativeModuleLoaded(!0)}};t.AINativeModule=N,n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],N.prototype,"aiNativeConfig",void 0),t.AINativeModule=N=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],N)},3073:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParser=t.DEFAULT_MIN_BLOCK_COUNT=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),l=e(70392),m=e(53374),E=e(22486),p=e(67045);t.DEFAULT_MIN_BLOCK_COUNT=20;let v=class{constructor(g){this.language=g,this.parserLoaded=new l.Deferred,this.lruCache=new l.LRUCache(500),this.initializeParser()}ready(){return this.parserLoaded.promise}getParser(){return this.parser}async initializeParser(){this.parser=await this.wasmModuleManager.initParser();const g=await this.wasmModuleManager.loadLanguage(this.language),c=await r.default.Language.load(new Uint8Array(g));this.parser.setLanguage(c),this.parserLoaded.resolve()}findContainingCodeBlockWithPosition(g,c){return g.startIndex<=c&&g.endIndex>=c&&this.languageFacts.isCodeBlock(this.language,g.type)?g:g.parent?this.findContainingCodeBlockWithPosition(g.parent,c):null}findFunctionCodeBlock(g,c){return g.startIndex<=c&&g.endIndex>=c&&this.languageFacts.isFunctionCodeBlock(this.language,g.type)?g:g.parent?this.findFunctionCodeBlock(g.parent,c):null}async parseAST(g){const c=`${g.id}@${g.getVersionId()}`,h=this.lruCache.get(c);if(h)return h;await this.parserLoaded.promise;const d=g.getValue(),u=this.parser.parse(d);if(u){const _=u.rootNode;return this.lruCache.set(c,_),_}}async getSyntaxNodeAsPosition(g,c){const h=await this.parseAST(g);return h?h.namedDescendantForIndex(c):null}async findCodeBlockWithSyntaxError(g,c){await this.parserLoaded.promise;const h=this.parser.parse(g);if(h){const d=h.rootNode,u={row:c.startLineNumber-1,column:c.startColumn},_=d.namedDescendantForPosition(u);let f=_.parent;if(!f)return{range:(0,m.toMonacoRange)(_),type:_.type,infoCategory:"other"};for(;f&&!f.hasError;)f=f.parent;return f?{range:(0,m.toMonacoRange)(f),type:f.type,infoCategory:"other"}:{range:c,type:_.type,infoCategory:"other"}}return null}async provideCodeBlockInfo(g,c){const h=g.getOffsetAt(c),d=await this.getSyntaxNodeAsPosition(g,h);if(!d)return null;const u=this.findFunctionCodeBlock(d,h);if(u)return this.languageFacts.provideFunctionInfo(this.language,u);const _=this.findContainingCodeBlockWithPosition(d,h);return _?{infoCategory:"other",range:{startLineNumber:_.startPosition.row+1,startColumn:0,endLineNumber:_.endPosition.row+1,endColumn:1/0},type:_.type}:null}async provideCodeBlockInfoInRange(g,c){const h=await this.parseAST(g);if(h){const d={row:c.startLineNumber-1,column:c.startColumn-1},u={row:c.endLineNumber,column:c.endColumn},_=this.languageFacts.getCodeBlockTypes(this.language);if(!_||_.size===0)return null;const f=h.descendantsOfType(Array.from(_),d,u);if(f&&f.length>0){const a=f[0];return{infoCategory:"other",range:(0,m.toMonacoRange)(a),type:a.type}}}return null}async trimSuffixSyntaxErrors(g,c=t.DEFAULT_MIN_BLOCK_COUNT){var h;await this.parserLoaded.promise;const d=(h=this.parser)===null||h===void 0?void 0:h.parse(g),u=d?.rootNode;if(!u)return g;const{namedChildren:_}=u;if(!u.hasError||_.length<=c)return this.trimToLastCompleteBlock(u,!0);let f=null,a=null;for(let w=_.length-1;w>=c;w--){const T=_[w];if(T.hasError&&w!==0)f=T;else if(f){a=T;break}}a||(a=_[c-1]);const y=g.split(`
28255
+ `).length;this.terminalDecorations.addZoneDecoration(f,a,b,{operationList:[h.action],onClickItem:()=>{const y=this.inlineChatFeatureRegistry.getTerminalHandler(h.action.id);y&&y.execute(u,d||"",h.matcher)}})}}resolveDelControl(c=""){const h=c.split("");let d=0;for(;d<h.length;)if(h[d].charCodeAt(0)===127){const u=Math.max(d-1,0);h.splice(u,1),d=u}else d++;return h.join("")}report(c,h,d){}registerMarker(c,h){const d=this.terminalController.clients.get(c);if(d){const u=d.term.registerMarker(h);this.clientCurrentMarker.set(c,u),this.disposables.push(u)}}handleClientInput(c,h){const d=h.toString(),u=this.inputRecordMap.get(c);/[\r\n]/.test(d)?(this.isTyping=!1,u?.push({text:this.inputCache})):(this.inputCache+=d,this.isTyping=!0)}};t.AITerminalService=s,n.__decorate([(0,r.Autowired)(l.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(E.AITerminalDecorationService),n.__metadata("design:type",E.AITerminalDecorationService)],s.prototype,"terminalDecorations",void 0),n.__decorate([(0,r.Autowired)(o.InlineChatFeatureRegistryToken),n.__metadata("design:type",m.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalService=s=n.__decorate([(0,r.Injectable)()],s)},32113:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalPrompt=t.KeyboardSelectableList=void 0;const n=e(85608),r=e(45250),o=n.__importStar(e(14041)),l=e(41869),m=e(81878),E=e(89195),p=n.__importDefault(e(58274)),v=g=>{const{items:c,handleSuggestionClick:h,noListen:d=!1,controller:u}=g,[_,f]=(0,o.useState)(-1),a=b=>{switch(b.key){case"ArrowUp":f(y=>Math.max(y-1,0));break;case"ArrowDown":f(y=>Math.min(y+1,c.length-1));break;case"Enter":c[_]&&h(c[_].command);break;default:break}};return(0,o.useEffect)(()=>{if(!d)return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[c,_]),(0,o.useEffect)(()=>{if(!u)return;const b=u.event(y=>{y==="ArrowUp"&&f(S=>Math.max(S-1,0)),(y==="ArrowDown"||y==="Tab")&&f(S=>Math.min(S+1,c.length-1)),y==="Enter"&&c[_]&&h(c[_].command)});return()=>{b.dispose()}},[u,_,c]),(0,o.useEffect)(()=>{f(0)},[c]),o.default.createElement("div",{className:p.default.suggestions},c.map((b,y)=>o.default.createElement("div",{key:y,className:p.default.suggestionItem,style:{backgroundColor:y===_?"var(--selection-background)":""},onClick:()=>h(b.command)},o.default.createElement("div",{className:p.default.suggestionItemContainer},o.default.createElement("div",{className:p.default.suggestionDesc},b.description),o.default.createElement("div",{className:p.default.suggestionCmd},b.command)))))};t.KeyboardSelectableList=v;const s=g=>{const{onEscTriggered:c,onSuggestionClick:h,getAICommandSuggestions:d,cancelAIRequst:u}=g,[_,f]=(0,o.useState)(""),[a,b]=(0,o.useState)([]),[y,S]=(0,o.useState)(!1),[A,w]=(0,o.useState)((0,l.localize)("terminal.ai.escClose")),T=(0,o.useRef)(null),D=(0,o.useCallback)(async M=>{S(!0),w((0,l.localize)("terminal.ai.requesting")),d(M,()=>{S(!1),w((0,l.localize)("terminal.ai.selectHint"))},()=>{S(!0),w((0,l.localize)("terminal.ai.thinking"))},k=>{b([...k].reverse())})},[a]),I=(0,o.useCallback)((0,r.debounce)(M=>{D(M)},1e3),[]);(0,o.useEffect)(()=>{const M=k=>{(k.key==="Escape"||k.keyCode===27)&&c()};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[]),(0,o.useEffect)(()=>{const M=k=>{T.current&&!T.current.contains(k.target)&&c()};return document.addEventListener("mousedown",M),()=>{document.removeEventListener("mousedown",M)}},[c]);const O=M=>{const k=M.target.value;f(k),k.length>0&&!k.includes("'")&&I(k),k.length===0&&(b([]),w((0,l.localize)("terminal.ai.escClose")),u&&u())},L=(0,o.useCallback)(()=>{D(_)},[_]),R=M=>{h(M)};return o.default.createElement("div",{className:p.default.container,ref:T},o.default.createElement("div",{className:p.default.header},o.default.createElement("div",{style:{flex:"1"}},(0,l.localize)("terminal.ai.headerHint")),o.default.createElement("div",null,o.default.createElement(E.EnhanceIcon,{className:(0,m.getIcon)("close1"),onClick:()=>{c()}}))),o.default.createElement("div",{style:{position:"relative",marginLeft:"-14px"}},a.length>0&&o.default.createElement(t.KeyboardSelectableList,{items:a,handleSuggestionClick:R})),o.default.createElement("div",{className:p.default.inputContainer},o.default.createElement(m.Input,{type:"text",value:_,onKeyDown:M=>{(M.key==="ArrowUp"||M.key==="ArrowDown")&&M.preventDefault()},onChange:O,onPressEnter:()=>L(),placeholder:(0,l.localize)("terminal.ai.inputHint"),className:p.default.input,autoFocus:!0}),y?o.default.createElement("div",{className:p.default.ai_loading},o.default.createElement("div",{className:p.default.loader}),o.default.createElement("div",{className:p.default.loader}),o.default.createElement("div",{className:p.default.loader})):o.default.createElement(E.EnhanceIcon,{wrapperClassName:p.default.send_icon,className:(0,m.getIcon)("send-solid"),onClick:()=>{I(_)}})),o.default.createElement("div",{className:p.default.statusContainer},A))};t.AITerminalPrompt=s},39273:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalInlineWidgetForDetection=t.TerminalInlineWidgetForSelection=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(89195),l=n.__importDefault(e(57410)),m=({actions:p,onClickItem:v})=>r.default.createElement("div",{className:l.default.terminal_inline_chat},r.default.createElement(o.AIAction,{operationList:p,onClickItem:v}));t.TerminalInlineWidgetForSelection=m;const E=({actions:p,onClickItem:v})=>{const[s,g]=(0,r.useState)(!1);return r.default.createElement("div",{onMouseOver:c=>{g(!0),c.currentTarget.style.backgroundColor="rgba(255, 0, 0, 0.1)"},onMouseOut:c=>{g(!1),c.currentTarget.style.backgroundColor=""},style:{width:"100%",height:"100%"}},r.default.createElement("div",{className:l.default.terminal_inline_chat,style:{display:s?"block":"none"}},r.default.createElement(o.AIAction,{operationList:p,onClickItem:v})))};t.TerminalInlineWidgetForDetection=E},96415:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalDecorationService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(25873),l=e(76003),m=e(43718),E=e(6487),p=e(2281),v=e(39273);let s=class extends m.Disposable{constructor(){super(...arguments),this.decorationList=[],this.decorationRootMap=new Map}active(){this.disposables.push(this.terminalController.onDidOpenTerminal(({id:c})=>this.doSelectionDecoration(c)))}addZoneDecoration(c,h,d,u){const _=c.registerDecoration({marker:h,width:c.cols,height:d});if(!_){console.error("Failed to create decoration for line",h);return}let f;_.onRender(a=>{f||(f=(0,o.createRoot)(a)),f.render(r.default.createElement(v.TerminalInlineWidgetForDetection,{actions:u.operationList,onClickItem:()=>{u.onClickItem()}}))}),_.onDispose(()=>{f&&f.unmount()})}doSelectionDecoration(c){const h=this.terminalController.clients.get(c),d=h?.term;d&&this.addDispose(d.onSelectionChange(()=>{const u=this.decorationList.pop();u&&(0,m.runWhenIdle)(()=>{u?.dispose()});const _=d.getSelectionPosition(),f=d.getSelection().trim();if(_&&f.length>0){const a=_.end.y,b=_.start.y,y=d.buffer.active.cursorY+d.buffer.active.baseY,S=b-y,A=a-b+1,w=d.registerMarker(S);if(w){const T=d.registerDecoration({marker:w,width:d.cols,height:A});if(T){let D;T.onRender(I=>{D||(D=(0,o.createRoot)(I));const L=this.inlineChatFeatureRegistry.getTerminalActions().filter(R=>{var M;return((M=this.inlineChatFeatureRegistry.getTerminalHandler(R.id))===null||M===void 0?void 0:M.triggerRules)==="selection"});D.render(r.default.createElement(v.TerminalInlineWidgetForSelection,{actions:L,onClickItem:R=>{const M=this.inlineChatFeatureRegistry.getTerminalHandler(R);M&&M.execute(f,"")}}))}),T.onDispose(()=>{D&&D.unmount()}),this.decorationList.push(T)}}}}))}};t.AITerminalDecorationService=s,n.__decorate([(0,l.Autowired)(E.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,l.Autowired)(m.InlineChatFeatureRegistryToken),n.__metadata("design:type",p.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalDecorationService=s=n.__decorate([(0,l.Injectable)()],s)},4397:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTerminalDetectionLineMatcher=t.MatcherType=void 0;var e;(function(r){r[r.base=0]="base",r[r.npm=1]="npm",r[r.typescript=2]="typescript",r[r.node=3]="node",r[r.shell=4]="shell",r[r.java=5]="java"})(e||(t.MatcherType=e={}));class n{constructor(){this.type=e.base,this.isMultiLine=!1,this.isMatched=!1,this.maxSpaceLine=0,this.currentSpaceLine=0}match(o){return this.doMatch(o)?(this.isMatched=!0,this.currentSpaceLine=0,!0):this.isMultiLine&&this.isMatched&&this.currentSpaceLine<this.maxSpaceLine?(this.currentSpaceLine++,!0):(this.isMatched=!1,!1)}}t.BaseTerminalDetectionLineMatcher=n},28358:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=t.ShellMatcher=t.NPMMatcher=t.TSCMatcher=t.NodeMatcher=void 0,e(85608).__exportStar(e(4397),t);var r=e(12636);Object.defineProperty(t,"NodeMatcher",{enumerable:!0,get:function(){return r.NodeMatcher}});var o=e(41084);Object.defineProperty(t,"TSCMatcher",{enumerable:!0,get:function(){return o.TSCMatcher}});var l=e(97323);Object.defineProperty(t,"NPMMatcher",{enumerable:!0,get:function(){return l.NPMMatcher}});var m=e(29640);Object.defineProperty(t,"ShellMatcher",{enumerable:!0,get:function(){return m.ShellMatcher}});var E=e(82036);Object.defineProperty(t,"JavaMatcher",{enumerable:!0,get:function(){return E.JavaMatcher}})},82036:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.java,this.isMultiLine=!0}doMatch(l){return this.isErrorStack(l)||this.isCasuseByError(l)||this.isExceptionError(l)}isErrorStack(l){return this.isMatched&&!!l.find(m=>/^\s+at\s/i.test(m.content))}isCasuseByError(l){return!!l.find(m=>/caused\sby:/i.test(m.content))}isExceptionError(l){return!!l.find(m=>/\w+Exception:/i.test(m.content))}}t.JavaMatcher=r},12636:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.node,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(m){return this.isSingleLineError(m)||this.isMultiPartError(m)}isSingleLineError(m){return m.length===1&&(0,n.isRedColor)(m[0])&&(this.isMatched||!this.isExcludeContent(m[0].content))}isMultiPartError(m){return m.length>1&&!m.some(E=>!(0,n.isRedColor)(E))}isExcludeContent(m){return m.length<20||/mfsu/i.test(m)||/\s-\s/.test(m)}}t.NodeMatcher=o},97323:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NPMMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.npm,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(m){return!!m.find(E=>/ERR/.test(E.content)&&(0,n.isRedColor)(E))}}t.NPMMatcher=o},29640:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShellMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.shell,this.isMultiLine=!1}doMatch(l){return!!l.find(m=>/command\snot\sfound/.test(m.content))}}t.ShellMatcher=r},41084:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TSCMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.typescript,this.isMultiLine=!0}doMatch(m){let E=!1,p=!1,v=!1;return m.forEach(s=>{/error/i.test(s.content)&&(0,n.isRedColor)(s)&&(E=!0),/TS\d+/.test(s.content)&&(p=!0),/Error:/i.test(s.content)&&(v=!0)}),E||p||v||this.isErrorStack(m)}isErrorStack(m){return this.isMatched&&!!m.find(E=>/^\s+at\s/i.test(E.content))}}t.TSCMatcher=o},14717:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PS1TerminalService=void 0;const n=e(85608),r=n.__importDefault(e(124)),o=n.__importDefault(e(14041)),l=e(25873),m=e(76003),E=e(41869),p=e(43718),v=e(6487),s=e(93062),g=e(32113),c=e(95121);var h;(function(u){u.PromptStarted="PS",u.PromptEnded="PE",u.CurrentWorkingDirectory="CWD"})(h||(h={}));let d=class extends p.Disposable{constructor(){super(...arguments),this.cancelToken=new p.CancellationTokenSource}active(){this.initContainer(),this.disposables.push(this.terminalController.onDidOpenTerminal(({id:_})=>this.listenTerminalEvent(_)))}listenTerminalEvent(_){const f=this.terminalController.clients.get(_);f&&setTimeout(()=>{this.listenPromptState(f.term)},0)}initContainer(){this.popupContainer=document.createElement("div"),document.body.appendChild(this.popupContainer)}listenPromptState(_){_.parser.registerOscHandler(6973,f=>{const a=f.indexOf(";");switch(a===-1?f:f.substring(0,a)){case h.PromptEnded:this.handlePromptEnd(_);break;default:return!1}return!1})}handlePromptEnd(_){this.promptEndMarker&&this.promptEndMarker.dispose(),this.promptEndDecoration&&this.promptEndDecoration.dispose(),this.promptEndMarker=_.registerMarker(0);const f=_.buffer.active.cursorX;this.onDataDisposable&&this.onDataDisposable.dispose();const a=_.registerDecoration({marker:this.promptEndMarker,width:_.cols,height:1,x:f+2,layer:"top"});a?.onRender(b=>{b.innerText=(0,E.localize)("terminal.ai.inputSharpToGetHint"),b.style.opacity="0.3"}),this.onDataDisposable=_.onData(b=>{var y;const S=_.buffer.active,A=S.cursorX,w=S.cursorY;a?.dispose(),b==="#"&&w+S.baseY===((y=this.promptEndMarker)===null||y===void 0?void 0:y.line)&&(A===f||A===f+1)&&this.showAICommandPopup(_,f)})}showAICommandPopup(_,f){var a,b,y;if(!this.promptEndMarker)return;this.promptEndDecoration=_.registerDecoration({marker:this.promptEndMarker,width:1,height:1,backgroundColor:"#2472C8",x:f,layer:"top"});const S=_._addonManager._addons.find(w=>{var T;return!!(!((T=w?.instance)===null||T===void 0)&&T.connection)}),A=(a=S?.instance)===null||a===void 0?void 0:a.connection;if(!A){console.error((0,E.localize)("terminal.ai.cannotGetTerminalConnection"));return}(b=this.promptEndDecoration)===null||b===void 0||b.onRender(w=>{const T=w.clientWidth;this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),this.promptEndReactRoot=(0,l.createRoot)(this.popupContainer),this.promptEndReactRoot.render(o.default.createElement(g.AITerminalPrompt,{onEscTriggered:()=>{setTimeout(()=>{var D;A.sendData("\b"),(D=this.promptEndDecoration)===null||D===void 0||D.dispose()},0)},onSuggestionClick:D=>{setTimeout(()=>{var I;A.sendData("\b"),A.sendData(D),(I=this.promptEndDecoration)===null||I===void 0||I.dispose()},0)},getAICommandSuggestions:this.getAICommandSuggestions.bind(this),cancelAIRequst:this.stopAIStreamRequest.bind(this)})),(0,r.default)(this.popupContainer,w,{points:["bl","bl"],offset:[-T-6,0],targetOffset:[0,0],overflow:{adjustX:!1,adjustY:!1}})}),(y=this.promptEndDecoration)===null||y===void 0||y.onDispose(()=>{this.stopAIStreamRequest(),this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),_.focus()})}async stopAIStreamRequest(){this.cancelToken.cancel(),this.cancelToken=new p.CancellationTokenSource}async getAICommandSuggestions(_,f,a,b){await this.stopAIStreamRequest();const y=this.aiReporter.start(p.AIServiceType.TerminalAICommand,{message:_}),S=await this.terminalFeatureRegistry.readableCommandSuggestions(_,this.cancelToken.token),A=[];(0,s.listenReadable)(S,{onData:w=>{A.push(w),b(A)},onEnd:()=>{f(),this.aiReporter.end(y,{message:_,success:!0,actionSource:p.ActionSourceEnum.Terminal})}})}};t.PS1TerminalService=d,n.__decorate([(0,m.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],d.prototype,"terminalController",void 0),n.__decorate([(0,m.Autowired)(p.TerminalRegistryToken),n.__metadata("design:type",c.TerminalFeatureRegistry)],d.prototype,"terminalFeatureRegistry",void 0),n.__decorate([(0,m.Autowired)(p.IAIReporter),n.__metadata("design:type",Object)],d.prototype,"aiReporter",void 0),t.PS1TerminalService=d=n.__decorate([(0,m.Injectable)()],d)},28505:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalAIContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(63439),E=e(96415),p=e(14717),v=e(95121);let s=class{onDidStart(){this.aiNativeConfigService.capabilities.supportsTerminalDetection&&(this.aiTerminalService.active(),this.aiTerminalDecorationService.active()),this.aiNativeConfigService.capabilities.supportsTerminalCommandSuggest&&this.terminalFeatureRegistry.hasProvider()&&this.ps1TerminalService.active()}};t.TerminalAIContribution=s,n.__decorate([(0,r.Autowired)(m.AITerminalService),n.__metadata("design:type",m.AITerminalService)],s.prototype,"aiTerminalService",void 0),n.__decorate([(0,r.Autowired)(E.AITerminalDecorationService),n.__metadata("design:type",E.AITerminalDecorationService)],s.prototype,"aiTerminalDecorationService",void 0),n.__decorate([(0,r.Autowired)(p.PS1TerminalService),n.__metadata("design:type",p.PS1TerminalService)],s.prototype,"ps1TerminalService",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],s.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(l.TerminalRegistryToken),n.__metadata("design:type",v.TerminalFeatureRegistry)],s.prototype,"terminalFeatureRegistry",void 0),t.TerminalAIContribution=s=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],s)},95121:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(93062),m=e(77633);let E=class extends o.Disposable{constructor(){super(...arguments),this.providerMap=new Set}hasProvider(){return this.providerMap.size>0}registerCommandSuggestionsProvider(v){this.providerMap.add(v)}async readableCommandSuggestions(v,s){const g=Array.from(this.providerMap),c=[],h=[];for await(const u of g){const _=await u(v,s);if((0,l.isReadableStream)(_)){c.push(_);continue}h.push(..._)}const d=m.TerminalSuggestionReadableStream.create();return h.forEach(d.emitData.bind(d)),c.length===0?queueMicrotask(()=>{d.end()}):(0,l.listenGroupReadable)(c,{onData:d.emitData.bind(d),onEnd:d.end.bind(d)}),d}};t.TerminalFeatureRegistry=E,t.TerminalFeatureRegistry=E=n.__decorate([(0,r.Injectable)()],E)},60772:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorCode=t.StyleCode=void 0,t.ansiParser=p,t.isRedColor=v;const r=e(85608).__importDefault(e(91371)),o={color:0,isSpecialColor:!1,isRgbColor:!1,is256Color:!1,bgColor:0,isSpecialBg:!1,isRgbBg:!1,is256Bg:!1,bold:!1,underline:!1};var l;(function(s){s[s.RESET=0]="RESET",s[s.BOLD=1]="BOLD",s[s.UNDERLINE=4]="UNDERLINE",s[s.RESET_BOLD=22]="RESET_BOLD",s[s.RESET_UNDERLINE=24]="RESET_UNDERLINE"})(l||(t.StyleCode=l={}));var m;(function(s){s[s.MODE_RGB=2]="MODE_RGB",s[s.MODE_256=5]="MODE_256",s[s.BLACK=30]="BLACK",s[s.RED=31]="RED",s[s.GREEN=32]="GREEN",s[s.YELLOW=33]="YELLOW",s[s.BLUE=34]="BLUE",s[s.MAGENTA=35]="MAGENTA",s[s.CYAN=36]="CYAN",s[s.WHITE=37]="WHITE",s[s.SPECIAL_COLOR_MODE=38]="SPECIAL_COLOR_MODE",s[s.RESET_COLOR=39]="RESET_COLOR",s[s.BLACK_BG=40]="BLACK_BG",s[s.RED_BG=41]="RED_BG",s[s.GREEN_BG=42]="GREEN_BG",s[s.YELLOW_BG=43]="YELLOW_BG",s[s.BLUE_BG=44]="BLUE_BG",s[s.MAGENTA_BG=45]="MAGENTA_BG",s[s.CYAN_BG=46]="CYAN_BG",s[s.WHITE_BG=47]="WHITE_BG",s[s.SPECIAL_BG_MODE=48]="SPECIAL_BG_MODE",s[s.RESET_BG=49]="RESET_BG",s[s.BLACK_BRIGHT=90]="BLACK_BRIGHT",s[s.RED_BRIGHT=91]="RED_BRIGHT",s[s.GREEN_BRIGHT=92]="GREEN_BRIGHT",s[s.YELLOW_BRIGHT=93]="YELLOW_BRIGHT",s[s.BLUE_BRIGHT=94]="BLUE_BRIGHT",s[s.MAGENTA_BRIGHT=95]="MAGENTA_BRIGHT",s[s.CYAN_BRIGHT=96]="CYAN_BRIGHT",s[s.WHITE_BRIGHT=97]="WHITE_BRIGHT",s[s.BLACK_HIGH_INTENSITY=100]="BLACK_HIGH_INTENSITY",s[s.RED_HIGH_INTENSITY=101]="RED_HIGH_INTENSITY",s[s.GREEN_HIGH_INTENSITY=102]="GREEN_HIGH_INTENSITY",s[s.BLUE_HIGH_INTENSITY=104]="BLUE_HIGH_INTENSITY",s[s.MAGENTA_HIGH_INTENSITY=105]="MAGENTA_HIGH_INTENSITY",s[s.CYAN_HIGH_INTENSITY=106]="CYAN_HIGH_INTENSITY",s[s.WHITE_HIGH_INTENSITY=107]="WHITE_HIGH_INTENSITY"})(m||(t.ColorCode=m={}));function E(s,g,c){g.isSpecialColor||g.isSpecialBg?c===m.SPECIAL_COLOR_MODE?g.color=s:g.bgColor=s:s>=30&&s<=37||s>=90&&s<=97?g.color=s:(s>=40&&s<=47||s>=100&&s<=107)&&(g.bgColor=s)}function p(s,g){const c=(0,r.default)(),h=[];let d,u=0;const _={...g||o};for(;d=c.exec(s);){const a=s.slice(u,d.index);a&&h.push({content:a,..._});const b=d[0].slice(2,-1).split(";").map(Number);if(b.length)for(let y=0;y<b.length;y++){const S=b[y],A=b[y-1];switch(S){case l.RESET:Object.assign(_,o);break;case l.BOLD:_.bold=!0;break;case l.UNDERLINE:_.underline=!0;break;case l.RESET_BOLD:_.bold=!1;break;case l.RESET_UNDERLINE:_.underline=!1;break;case m.RESET_COLOR:_.color=0;break;case m.RESET_BG:_.bgColor=0;break;case m.SPECIAL_COLOR_MODE:_.isSpecialColor=!0;break;case m.SPECIAL_BG_MODE:_.isSpecialBg=!0;break;case m.MODE_RGB:A===m.SPECIAL_COLOR_MODE?_.isRgbColor=!0:_.isRgbBg=!0;break;case m.MODE_256:A===m.SPECIAL_COLOR_MODE?_.is256Color=!0:_.is256Bg=!0;break;default:E(S,_,b[y-2])}}u=d.index+d[0].length}const f=s.slice(u);return f&&h.push({content:f,..._}),{parts:h,currentStyle:_}}function v(s){const{color:g,isSpecialColor:c,is256Color:h}=s;return c?h?g===1||g===9||g>=160&&g<=196:g===255:g===m.RED||g===m.RED_BRIGHT}},32004:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(19413),E=e(19413),p=e(32016),v=e(74055),s=e(84543),g=e(61282),c=e(51081),h=e(29770),d=e(11735),u=e(59347),_=e(70394),f=e(72713),a=e(57232),b=e(99301),y=e(74292),S=e(35363),A=e(44298),w=e(33588),T=e(2204),D=e(2994),I=e(28505),O=e(95121),L=e(85679),R=e(3841),M=e(77633),k=e(2281),B=e(31031),x=e(15989);let N=class extends o.BrowserModule{constructor(){super(),this.contributionProvider=M.AINativeCoreContribution,this.providers=[p.AINativeBrowserContribution,S.InterfaceNavigationContribution,I.TerminalAIContribution,A.MergeConflictContribution,f.AICodeActionContribution,R.AINativePreferencesContribution,b.IntelligentCompletionsContribution,{token:o.InlineChatFeatureRegistryToken,useClass:k.InlineChatFeatureRegistry},{token:o.ChatFeatureRegistryToken,useClass:d.ChatFeatureRegistry},{token:o.ChatRenderRegistryToken,useClass:_.ChatRenderRegistry},{token:o.ResolveConflictRegistryToken,useClass:w.ResolveConflictRegistry},{token:l.IntelligentCompletionsRegistryToken,useClass:y.IntelligentCompletionsRegistry},{token:o.IAIInlineChatService,useClass:B.AIInlineChatService},{token:m.IChatManagerService,useClass:g.ChatManagerService},{token:m.IChatAgentService,useClass:v.ChatAgentService},{token:o.ChatAgentViewServiceToken,useClass:s.ChatAgentViewService},{token:m.IChatInternalService,useClass:u.ChatInternalService},{token:m.ChatProxyServiceToken,useClass:c.ChatProxyService},{token:o.ChatServiceToken,useClass:h.ChatService},{token:o.RenameCandidatesProviderRegistryToken,useClass:D.RenameCandidatesProviderRegistry},{token:l.ProblemFixRegistryToken,useClass:T.ProblemFixProviderRegistry},{token:l.TerminalRegistryToken,useClass:O.TerminalFeatureRegistry},{token:L.LanguageParserService,useClass:L.LanguageParserService},{token:E.IAIInlineCompletionsProvider,useClass:a.AIInlineCompletionsProvider},{token:x.InlineDiffService,useClass:x.InlineDiffService}],this.backServices=[{servicePath:o.AIBackSerivcePath,token:o.AIBackSerivceToken,clientToken:m.ChatProxyServiceToken}],this.aiNativeConfig.setAINativeModuleLoaded(!0)}};t.AINativeModule=N,n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],N.prototype,"aiNativeConfig",void 0),t.AINativeModule=N=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],N)},3073:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParser=t.DEFAULT_MIN_BLOCK_COUNT=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),l=e(70392),m=e(53374),E=e(22486),p=e(67045);t.DEFAULT_MIN_BLOCK_COUNT=20;let v=class{constructor(g){this.language=g,this.parserLoaded=new l.Deferred,this.lruCache=new l.LRUCache(500),this.initializeParser()}ready(){return this.parserLoaded.promise}getParser(){return this.parser}async initializeParser(){this.parser=await this.wasmModuleManager.initParser();const g=await this.wasmModuleManager.loadLanguage(this.language),c=await r.default.Language.load(new Uint8Array(g));this.parser.setLanguage(c),this.parserLoaded.resolve()}findContainingCodeBlockWithPosition(g,c){return g.startIndex<=c&&g.endIndex>=c&&this.languageFacts.isCodeBlock(this.language,g.type)?g:g.parent?this.findContainingCodeBlockWithPosition(g.parent,c):null}findFunctionCodeBlock(g,c){return g.startIndex<=c&&g.endIndex>=c&&this.languageFacts.isFunctionCodeBlock(this.language,g.type)?g:g.parent?this.findFunctionCodeBlock(g.parent,c):null}async parseAST(g){const c=`${g.id}@${g.getVersionId()}`,h=this.lruCache.get(c);if(h)return h;await this.parserLoaded.promise;const d=g.getValue(),u=this.parser.parse(d);if(u){const _=u.rootNode;return this.lruCache.set(c,_),_}}async getSyntaxNodeAsPosition(g,c){const h=await this.parseAST(g);return h?h.namedDescendantForIndex(c):null}async findCodeBlockWithoutSyntaxError(g,c){await this.parserLoaded.promise;const h=this.parser.parse(g);if(h){const d=h.rootNode,u={row:c.startLineNumber-1,column:c.startColumn},_=d.namedDescendantForPosition(u);let f=_.parent;if(!f)return{range:(0,m.toMonacoRange)(_),type:_.type,infoCategory:"other"};for(;f&&!f.hasError;)f=f.parent;return f?{range:(0,m.toMonacoRange)(f),type:f.type,infoCategory:"other"}:{range:c,type:_.type,infoCategory:"other"}}return null}async provideCodeBlockInfo(g,c){const h=g.getOffsetAt(c),d=await this.getSyntaxNodeAsPosition(g,h);if(!d)return null;const u=this.findFunctionCodeBlock(d,h);if(u)return this.languageFacts.provideFunctionInfo(this.language,u);const _=this.findContainingCodeBlockWithPosition(d,h);return _?{infoCategory:"other",range:{startLineNumber:_.startPosition.row+1,startColumn:0,endLineNumber:_.endPosition.row+1,endColumn:1/0},type:_.type}:null}async provideCodeBlockInfoInRange(g,c){const h=await this.parseAST(g);if(h){const d={row:c.startLineNumber-1,column:c.startColumn-1},u={row:c.endLineNumber,column:c.endColumn},_=this.languageFacts.getCodeBlockTypes(this.language);if(!_||_.size===0)return null;const f=h.descendantsOfType(Array.from(_),d,u);if(f&&f.length>0){const a=f[0];return{infoCategory:"other",range:(0,m.toMonacoRange)(a),type:a.type}}}return null}async trimSuffixSyntaxErrors(g,c=t.DEFAULT_MIN_BLOCK_COUNT){var h;await this.parserLoaded.promise;const d=(h=this.parser)===null||h===void 0?void 0:h.parse(g),u=d?.rootNode;if(!u)return g;const{namedChildren:_}=u;if(!u.hasError||_.length<=c)return this.trimToLastCompleteBlock(u,!0);let f=null,a=null;for(let w=_.length-1;w>=c;w--){const T=_[w];if(T.hasError&&w!==0)f=T;else if(f){a=T;break}}a||(a=_[c-1]);const y=g.split(`
28256
28256
  `).slice(0,a.endPosition.row+1),S=y[y.length-1].slice(0,a.endPosition.column);return`${y.length>1?`${y.slice(0,-1).join(`
28257
28257
  `)}
28258
28258
  `:""}${S}`}async trimPrefixSyntaxErrors(g,c=t.DEFAULT_MIN_BLOCK_COUNT){var h;await this.parserLoaded.promise;const d=(h=this.parser)===null||h===void 0?void 0:h.parse(g),u=d?.rootNode;if(!u)return g;const{namedChildren:_}=u;if(!u.hasError||_.length<=c)return this.trimToLastCompleteBlock(u);let f=null,a=null;for(let w=0;w<_.length-c;w++){const T=_[w];if(T.hasError&&w!==_.length-1)f=T;else if(f){a=T;break}}a||(a=_[_.length-c]);const y=g.split(`
@@ -28264,7 +28264,8 @@ ${y.slice(1).join(`
28264
28264
  `:""}${f}`}}else{const d=h[1];if(d){const _=g.text.split(`
28265
28265
  `).slice(d.startPosition.row);return`${_[0].slice(d.startPosition.column)}${_.length>1?`
28266
28266
  ${_.slice(1).join(`
28267
- `)}`:""}`}}return g.text}async extractImportPaths(g){var c,h;const d=[];if(this.language==="typescript"){await this.parserLoaded.promise;const u=(c=this.parser)===null||c===void 0?void 0:c.parse(g),_=u?.rootNode;if(_)for(let f=0;f<_?.childCount;f++){const a=_.child(f);if(a?.type==="import_statement"){let b=(h=a.child(3))===null||h===void 0?void 0:h.text;(b?.includes("'")||b?.includes('"'))&&(b=b.slice(1,-1)),b&&d.push(b)}}}return d}async extractInterfaceOrTypeCode(g){var c;const h=[];if(this.language==="typescript"){await this.parserLoaded.promise;const d=(c=this.parser)===null||c===void 0?void 0:c.parse(g),u=d?.rootNode;if(u)for(let _=0;_<u?.childCount;_++){const f=u.child(_);if(f?.type==="export_statement"){const a=f.child(1);(a?.type==="interface_declaration"||a?.type==="type_alias_declaration")&&h.push(a.text)}else(f?.type==="interface_declaration"||f?.type==="type_alias_declaration")&&h.push(f.text)}}return h}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=v,n.__decorate([(0,o.Autowired)(p.WasmModuleManager),n.__metadata("design:type",p.WasmModuleManager)],v.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(E.TreeSitterLanguageFacts),n.__metadata("design:type",E.TreeSitterLanguageFacts)],v.prototype,"languageFacts",void 0),t.LanguageParser=v=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],v)},85679:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParserService=void 0;const n=e(85608),r=e(76003),o=e(3073),l=e(22486);let m=class{constructor(){this.pool=new Map}createParser(p){const v=l.parserNameMap[p];if(v)return this.pool.has(v)||this.pool.set(v,this.injector.get(o.LanguageParser,[v])),this.pool.get(v)}dispose(){this.pool.forEach(p=>p.dispose()),this.pool.clear()}};t.LanguageParserService=m,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],m.prototype,"injector",void 0),t.LanguageParserService=m=n.__decorate([(0,r.Injectable)()],m)},53374:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toMonacoRange=e;function e(n){return{startLineNumber:n.startPosition.row+1,startColumn:n.startPosition.column+1,endLineNumber:n.endPosition.row+1,endColumn:n.endPosition.column+1}}},19584:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GolangLanguageFacts=void 0;const e=["function_declaration","method_declaration","block","if_statement","else_statement","switch_statement","case_clause","for_statement","range_clause","type_switch_statement","type_case_clause","comm_clause","select_statement","go_statement","defer_statement"],n=new Set(e);class r{constructor(){this.name="go",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return n}isCodeBlock(l){return n.has(l)}}t.GolangLanguageFacts=r},22486:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeSitterLanguageFacts=t.knownLanguageFacts=void 0;const n=e(85608);n.__exportStar(e(17973),t);const r=e(76003),o=e(19584),l=e(44606),m=e(82381),E=e(41486),p=e(98588),v=e(96436),s=e(2349),g=e(78542),c=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,l.JavaLanguageFacts,m.JavaScriptLanguageFacts,E.JavaScriptReactLanguageFacts,p.PythonLanguageFacts,v.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(u=>{const _=new u;this.langs.set(_.name,_)})}isCodeBlock(u,_){const f=this.langs.get(u);return f&&f.isCodeBlock?f.isCodeBlock(_):!1}isFunctionCodeBlock(u,_){const f=this.langs.get(u);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(_):!1}provideFunctionInfo(u,_){const f=this.langs.get(u);return f&&f.provideFunctionInfo?f.provideFunctionInfo(_):null}getCodeBlockTypes(u){const _=this.langs.get(u);return _?_.provideCodeBlocks():c}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaLanguageFacts=void 0;const e=["compilation_unit","class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","block","static_initializer","instance_initializer","if_statement","switch_statement","while_statement","do_statement","for_statement","enhanced_for_statement","try_statement","catch_clause","finally_clause"],n=new Set(["method_declaration","constructor_declaration"]),r=new Set(e);class o{constructor(){this.name="java",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(m){return r.has(m)}isFunctionCodeBlocks(m){return n.has(m)}}t.JavaLanguageFacts=o},82381:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptLanguageFacts=t.functionBlockCodeTypes=t.javascriptBlockCodeTypes=void 0;const n=e(53374);t.javascriptBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","method_definition","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","try_statement","catch_clause","block","export_statement","lexical_declaration"],t.functionBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","method_definition"];const r=new Set(t.functionBlockCodeTypes),o=new Set(t.javascriptBlockCodeTypes);class l{constructor(){this.name="javascript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return o}isCodeBlock(E){return o.has(E)}isFunctionCodeBlocks(E){return r.has(E)}provideFunctionInfo(E){var p,v,s;switch(E.type){case"function_declaration":case"function_expression":return{infoCategory:"function",type:E.type,name:((p=E.firstNamedChild)===null||p===void 0?void 0:p.text)||"",signatures:E.children.filter(g=>g.type==="parameter").map(g=>{var c;return((c=g.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(E)};case"arrow_function":{const g=E.parent;return g&&g.type==="variable_declarator"&&g.parent&&(g.parent.type==="lexical_declaration"||g.parent.type==="export_statement"||g.parent.type==="variable_declaration")?{infoCategory:"function",type:E.type,name:((v=g.firstChild)===null||v===void 0?void 0:v.text)||"",signatures:E.children.filter(c=>c.type==="parameter").map(c=>{var h;return((h=c.firstChild)===null||h===void 0?void 0:h.text)||""}),range:(0,n.toMonacoRange)(g.parent)}:null}case"method_definition":return{infoCategory:"function",type:E.type,name:((s=E.firstNamedChild)===null||s===void 0?void 0:s.text)||"",signatures:E.children.filter(g=>g.type==="parameter").map(g=>{var c;return((c=g.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(E)}}return null}}t.JavaScriptLanguageFacts=l},41486:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptReactLanguageFacts=t.javascriptreactBlockCodeTypes=void 0;const n=e(82381);t.javascriptreactBlockCodeTypes=[...n.javascriptBlockCodeTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.javascriptreactBlockCodeTypes);class o{constructor(){this.name="jsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(m){return r.has(m)}}t.JavaScriptReactLanguageFacts=o},98588:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PythonLanguageFacts=t.pythonBlockCodeTypes=void 0,t.pythonBlockCodeTypes=["function_definition","class_definition","compound_statement","if_statement","elif_clause","else_clause","for_statement","while_statement","try_statement","except_clause","with_statement","decorated_definition"];const e=new Set(t.pythonBlockCodeTypes);class n{constructor(){this.name="python",this.listCommentStyle="# ",this.blockCommentStyle={start:"'''",end:"'''",linePrefix:""}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.PythonLanguageFacts=n},96436:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RustLanguageFacts=t.rustBlockCodeTypes=void 0,t.rustBlockCodeTypes=["function_item","impl_item","trait_item","block","if_expression","match_expression","while_expression","loop_expression","for_expression","closure_expression","struct_item","enum_item","union_item","mod_item"];const e=new Set(t.rustBlockCodeTypes);class n{constructor(){this.name="rust",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.RustLanguageFacts=n},17973:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parserIdentifierMap=t.parserNameMap=void 0;const r=e(85608).__importDefault(e(19891)),o={typescript:"typescript",typescriptreact:"tsx",javascript:"javascript",javascriptreact:"jsx",rust:"rust",python:"python",java:"java",go:"go"};t.parserNameMap=o,t.parserIdentifierMap=(0,r.default)(t.parserNameMap)},2349:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptLanguageFacts=t.typescriptBlockTypes=void 0,t.typescriptBlockTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","interface_declaration","method_definition","method_signature","enum_declaration","type_alias_declaration","lexical_declaration","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","for_of_statement","try_statement","catch_clause","block","module","public_field_definition","private_field_definition","export_statement"];const e=new Set(t.typescriptBlockTypes);class n{constructor(){this.name="typescript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.TypeScriptLanguageFacts=n},78542:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptReactLanguageFacts=t.typescriptreactBlockTypes=void 0;const n=e(2349);t.typescriptreactBlockTypes=[...n.typescriptBlockTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.typescriptreactBlockTypes);class o{constructor(){this.name="tsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(m){return r.has(m)}}t.TypeScriptReactLanguageFacts=o},67045:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WasmModuleManager=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),l=e(6858),m=e(70392);let E=class{async resolveResourceUri(){const v=await this.rendererRuntime.provideResourceUri(l.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(v)}constructor(){this.resolvedResourceUriDeferred=new m.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const s=`${await this.resolvedResourceUriDeferred.promise}/tree-sitter.wasm`;return this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(v){if(!this.cachedRuntime.has(v)){const s=new m.Deferred;this.cachedRuntime.set(v,s);const c=`${await this.resolvedResourceUriDeferred.promise}/tree-sitter-${v}.wasm`;fetch(c).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(v).promise}};t.WasmModuleManager=E,n.__decorate([(0,o.Autowired)(l.RendererRuntime),n.__metadata("design:type",l.RendererRuntime)],E.prototype,"rendererRuntime",void 0),t.WasmModuleManager=E=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],E)},4972:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIRightTabRenderer=t.AILeftTabRenderer=t.AIChatTabRendererWithTab=t.AIChatTabRenderer=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),m=e(89195),E=e(1149),p=e(43718),v=e(11090),s=e(63067),g=e(46245),c=e(66368),h=e(19951),d=e(752),u=e(19413),_=n.__importDefault(e(87708)),f=()=>{const{side:w}=o.default.useContext(h.TabbarConfig),T=(0,l.useInjectable)(d.TabbarServiceFactory)(w);return(0,o.useEffect)(()=>{T.setIsLatter(!0)},[T]),o.default.createElement("div",{style:{width:0}},o.default.createElement(g.TabbarViewBase,{tabSize:0,MoreTabView:g.IconElipses,TabView:g.IconTabView,barSize:0,panelBorderSize:1}))},a=({className:w,components:T})=>o.default.createElement(h.TabRendererBase,{side:u.AI_CHAT_VIEW_ID,direction:"left-to-right",id:_.default.ai_chat_panel,className:(0,r.default)(w,`${u.AI_CHAT_VIEW_ID}-slot`),components:T,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:_.default.ai_chat_view_container}})});t.AIChatTabRenderer=a;const b=({className:w,components:T})=>o.default.createElement(h.TabRendererBase,{side:u.AI_CHAT_VIEW_ID,direction:"right-to-left",id:_.default.ai_chat_panel,className:(0,r.default)(w,`${u.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:T,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:_.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=b;const y=({className:w,components:T})=>o.default.createElement(v.DesignLeftTabRenderer,{className:w,components:T,tabbarView:S});t.AILeftTabRenderer=y;const S=()=>{const w=(0,l.useInjectable)(s.IMainLayoutService),T=(0,l.useInjectable)(d.TabbarServiceFactory)(l.SlotLocation.right),D=(0,l.useAutorun)(T.currentContainerId),I=o.default.useMemo(()=>w.getExtraMenu(),[w]),[O]=(0,l.useContextMenus)(I),L=(0,o.useCallback)(({renderContainers:R})=>{const M=T.visibleContainers.filter(k=>{var B;return!(!((B=k.options)===null||B===void 0)&&B.hideTab)});return o.default.createElement(o.default.Fragment,null,M.length>0&&o.default.createElement(m.HorizontalVertical,{margin:"8px auto 0px",width:"60%"}),M.map(k=>R(k,T,D)))},[D,T]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:L,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:_.default.extra_bottom_icon_container},O.length>=0?O.map(R=>o.default.createElement(m.EnhanceIconWithCtxMenu,{key:R.id,id:R.id,wrapperClassName:_.default.extra_bottom_icon,iconClass:R.icon,menuNodes:R.children,skew:{x:-8,y:-4}})):null)})},A=({className:w,components:T})=>{const D=(0,l.useInjectable)(d.TabbarServiceFactory)(l.SlotLocation.right),I=(0,l.useInjectable)(E.DesignLayoutConfig),O=(0,o.useCallback)(()=>{D.updateCurrentContainerId("")},[]),L=(0,o.useCallback)(M=>{const{component:k}=M,{options:B}=k;return o.default.createElement(c.ContainerView,{...M,renderContainerWrap:({children:x})=>o.default.createElement("div",{className:_.default.right_slot_container_wrap},o.default.createElement("div",{className:_.default.header},o.default.createElement("span",{className:_.default.title},B&&B.title),o.default.createElement("div",{className:_.default.side},o.default.createElement(m.EnhancePopover,{id:"ai_right_panel_header_close",title:(0,p.localize)("editor.title.context.close")},o.default.createElement(m.EnhanceIcon,{icon:"close",onClick:O})))),o.default.createElement("div",{className:_.default.container},x))})},[]),R=(0,o.useMemo)(()=>I.useMergeRightWithLeftPanel?_.default.right_tab_renderer:"",[I]);return o.default.createElement(v.DesignRightTabRenderer,{components:T,className:R,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:L})})};t.AIRightTabRenderer=A},82983:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatLogoAvatar=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),l=e(89195),m=e(63067),E=e(19413),p=n.__importDefault(e(88473)),v=()=>{const s=(0,o.useInjectable)(m.IMainLayoutService),g=r.default.useCallback(()=>{s.toggleSlot(E.AI_CHAT_VIEW_ID)},[s]);return r.default.createElement("div",{className:p.default.ai_switch,onClick:g},r.default.createElement(l.AILogoAvatar,{iconClassName:p.default.avatar_icon_large}))};t.AIChatLogoAvatar=v},53617:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EnhanceDecorationsCollection=void 0;const n=e(85608),r=e(43718),o=e(20868),l=e(77714),m=n.__importDefault(e(4619));class E{get isHidden(){return this._hidden}get codeEditor(){return this.metadata.codeEditor}get deltaData(){return this.metadata.deltaData}get id(){return this.metadata.id}get editorDecoration(){return this.metadata.editorDecoration}get group(){return this._group}constructor(s){this.metadata=s,this._hidden=!1;const{editorDecoration:g,deltaData:c,isHidden:h,group:d}=s;(0,r.isUndefined)(c.length)?this.length=g.range.endLineNumber-g.range.startLineNumber:this.length=c.length,this.range=g.range,this.options=g.options,this.resumeRange=this.range,this._hidden=!!h,this._hidden&&this.hide(),(0,r.isDefined)(d)&&this.setGroup(d)}setGroup(s){this._group=s}changeVisibility(s,g){if(!this.options.className)return;const c=this.options.className.split(l.space).filter(h=>h!==m.default.hidden&&h!==m.default.visible).filter(Boolean);c.push(s),this.options.className=c.join(l.space),this.codeEditor.changeDecorations(h=>{h.changeDecorationOptions(this.id,this.options),h.changeDecoration(this.id,g)})}setRange(s){this.range=s}getRange(){return this.range}dispose(){var s,g;(g=(s=this.deltaData).dispose)===null||g===void 0||g.call(s)}hide(){this.resumeRange=this.range,this._hidden=!0;const s={lineNumber:this.range.startLineNumber,column:1},g=o.Range.fromPositions(s);this.changeVisibility(m.default.hidden,g)}resume(){this._hidden=!1,this.changeVisibility(m.default.visible,o.Range.lift(this.resumeRange))}}class p extends r.Disposable{get model(){return this.codeEditor.getModel()}constructor(s){super(),this.codeEditor=s,this.deltaDecorations=[],this._onDidDecorationsChange=this.registerDispose(new r.Emitter),this.onDidDecorationsChange=this._onDidDecorationsChange.event,this.addDispose(this.codeEditor.onDidContentSizeChange(g=>{const{contentHeightChanged:c}=g;c&&this.flush()}))}flush(){this.deltaDecorations=this.deltaDecorations.map(s=>{const{id:g,editorDecoration:{range:c}}=s,h=this.model.getDecorationRange(g);return s.setRange(h??c),s}),this._onDidDecorationsChange.fire(this.deltaDecorations)}delete(s){this.codeEditor.changeDecorations(g=>{g.removeDecoration(s),this.deltaDecorations=this.deltaDecorations.filter(c=>c.id!==s)})}createDecorations(s){return new E(s)}set(s){this.clear(),this.codeEditor.changeDecorations(g=>{const c=[];for(const h of s){const d=g.addDecoration(h.range,h.options);c.push(this.createDecorations({id:d,editorDecoration:h,codeEditor:this.codeEditor,isHidden:h.isHidden,group:h.group,deltaData:{dispose:()=>this.delete(d),length:h.length}}))}this.deltaDecorations=c})}getDecorations(){return this.deltaDecorations}getDecorationByGroup(s){return this.deltaDecorations.find(g=>g.group===s)}getDecorationByLineNumber(s){return this.deltaDecorations.find(g=>g.getRange().startLineNumber===s)}clear(){this.codeEditor.changeDecorations(s=>{for(const g of this.deltaDecorations)s.removeDecoration(g.id);this.deltaDecorations=[]})}}t.EnhanceDecorationsCollection=p},44260:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MsgHistoryManager=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class extends o.Disposable{constructor(){super(...arguments),this.messageMap=new Map,this._onMessageChange=new o.Emitter,this.onMessageChange=this._onMessageChange.event}dispose(){this.clearMessages(),super.dispose()}clearMessages(){this.messageMap.clear()}doAddMessage(E){const p=(0,o.uuid)(6),v=this.messageMap.size,s={...E,id:p,order:v,type:E.type||"string"};return this.messageMap.set(p,s),this._onMessageChange.fire(this.getMessages()),p}getMessages(){return Array.from(this.messageMap.values()).sort((E,p)=>E.order-p.order)}addUserMessage(E){return this.doAddMessage({...E,role:1})}addAssistantMessage(E){return this.doAddMessage({...E,role:2})}updateAssistantMessage(E,p){if(!this.messageMap.has(E))return;const v=this.messageMap.get(E);this.messageMap.set(E,{...v,content:p.content})}};t.MsgHistoryManager=l,t.MsgHistoryManager=l=n.__decorate([(0,r.Injectable)({multiple:!1})],l)},3841:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativePreferencesContribution=void 0;const n=e(85608),r=e(41869),o=e(83854);let l=class{constructor(){this.schema=o.aiNativePreferenceSchema}};t.AINativePreferencesContribution=l,t.AINativePreferencesContribution=l=n.__decorate([(0,r.Domain)(r.PreferenceContribution)],l)},83854:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aiNativePreferenceSchema=t.EInlineDiffPreviewMode=void 0;const n=e(41869),r=e(43718);var o;(function(l){l.inlineLive="inlineLive",l.sideBySide="sideBySide"})(o||(t.EInlineDiffPreviewMode=o={})),t.aiNativePreferenceSchema={properties:{[n.AINativeSettingSectionsId.InlineDiffPreviewMode]:{type:"string",enum:[o.inlineLive,o.sideBySide],enumDescriptions:[(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.inlineLive"),(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.sideBySide")],default:o.inlineLive},[n.AINativeSettingSectionsId.InlineChatAutoVisible]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InlineChatCodeActionEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.ChatVisibleType]:{type:"string",enum:["never","always","default"],default:"default"},[n.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime]:{type:"number",default:150},[n.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLintErrors]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLineChange]:{type:"boolean",default:!1}}}},77633:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeCoreContribution=t.TerminalSuggestionReadableStream=t.ERunStrategy=void 0;const n=e(93062);var r;(function(l){l.EXECUTE="EXECUTE",l.PREVIEW="PREVIEW"})(r||(t.ERunStrategy=r={}));class o extends n.SumiReadableStream{static create(){return new o}}t.TerminalSuggestionReadableStream=o,t.AINativeCoreContribution=Symbol("AINativeCoreContribution")},24522:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ttPolicy=t.renderLines=void 0;const n=e(85608),r=e(55405),o=n.__importStar(e(98236)),l=e(27357),m=e(31324),E=e(33892),p=e(24315),v=(s,g,c,h)=>{const d=h.get(m.EditorOption.disableMonospaceOptimizations),u=h.get(m.EditorOption.stopRenderingLineAfter),_="none",f=h.get(m.EditorOption.renderControlCharacters),a=h.get(m.EditorOption.fontLigatures),b=h.get(m.EditorOption.fontInfo),y=h.get(m.EditorOption.lineHeight),S=new E.StringBuilder(1e4);S.appendString('<div class="suggest-preview-text">');for(let T=0,D=c.length;T<D;T++){const I=c[T],O=I.content;S.appendString('<div class="view-line'),S.appendString('" style="top:'),S.appendString(String(T*y)),S.appendString('px;width:1000000px;">');const L=o.isBasicASCII(O),R=o.containsRTL(O);(0,p.renderViewLine)(new p.RenderLineInput(b.isMonospace&&!d,b.canUseHalfwidthRightwardsArrow,O,!1,L,R,0,I.lineTokens,I.decorations,g,0,b.spaceWidth,b.middotWidth,b.wsmiddotWidth,u,_,f,a!==m.EditorFontLigatures.OFF,null),S),S.appendString("</div>")}S.appendString("</div>"),(0,l.applyFontInfo)(s,b);const A=S.build(),w=t.ttPolicy?t.ttPolicy.createHTML(A):A;s.innerHTML=w};t.renderLines=v,t.ttPolicy=(0,r.createTrustedTypesPolicy)("editorGhostText",{createHTML:s=>s})},90614:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineResultAction=void 0;const r=e(85608).__importStar(e(14041)),o=e(66205),l=e(89195),m=e(43718),E=e(31031),p=({onResultClick:v})=>{const s=(0,r.useMemo)(()=>[{icon:"check",text:(0,m.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>v(E.EResultKind.ACCEPT)},{icon:"discard",text:(0,m.localize)("aiNative.operate.discard.title"),onClick:()=>v(E.EResultKind.DISCARD)},{icon:"afresh",text:(0,m.localize)("aiNative.operate.afresh.title"),onClick:()=>v(E.EResultKind.REGENERATE)}],[v]);return r.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},r.default.createElement(l.AIInlineResult,{iconItems:s}))};t.InlineResultAction=p},40111:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatController=void 0;const n=e(43718),r=e(93062),o=e(98864);class l{static is(E){return E instanceof l&&typeof E.mountReadable=="function"}constructor(E){this.options=E,this._onData=new n.Emitter,this.onData=this._onData.event,this._onEnd=new n.Emitter,this.onEnd=this._onEnd.event,this._onAbort=new n.Emitter,this.onAbort=this._onAbort.event,this._onError=new n.Emitter,this.onError=this._onError.event,this._stream=null,this._listened=!1}calculateCodeBlocks(E){var p;return!((p=this.options)===null||p===void 0)&&p.enableCodeblockRender?(0,o.extractCodeBlocks)(E):E}mountReadable(E){this._stream=E}get isListened(){return this._listened}listen(){if(this._listened)return;if(!this._stream)throw new Error("No Stream mounted");this._listened=!0;const E=new n.ReplyResponse("");let p="";(0,r.listenReadable)(this._stream,{onData:v=>{p+=v.content;const s=this.calculateCodeBlocks(p);E.updateMessage(s),this._onData.fire(E)},onEnd:()=>{this._onEnd.fire()},onError:v=>{n.AbortError.is(v)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(v))}})}}t.InlineChatController=l},51221:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatEditorController=void 0;const n=e(41869),r=e(43718),o=e(66482),l=e(54414),m=e(52902),E=e(99906),p=e(89132),v=e(77633),s=e(38890),g=e(40111),c=e(31031),h=e(26664);class d extends E.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new r.Disposable,this.aiInlineChatOperationDisposable=new r.Disposable,this.inlineChatInUsing=!1}static get(_){return _.getContribution(d.ID)}get aiNativeConfigService(){return this.injector.get(n.AINativeConfigService)}get aiInlineChatService(){return this.injector.get(n.IAIInlineChatService)}get inlineChatFeatureRegistry(){return this.injector.get(r.InlineChatFeatureRegistryToken)}get preferenceService(){return this.injector.get(n.PreferenceService)}get aiReporter(){return this.injector.get(r.IAIReporter)}get workbenchEditorService(){return this.injector.get(l.WorkbenchEditorService)}get codeActionService(){return this.injector.get(p.CodeActionService)}get logger(){return this.injector.get(r.ILogger)}get contextKeyService(){return this.injector.get(n.IContextKeyService)}mount(){if(this.inlineDiffController=s.InlineDiffController.get(this.monacoEditor),!this.monacoEditor)return this.featureDisposable;this.featureDisposable.addDispose(this.aiInlineChatService.onInlineChatVisible(a=>{a?this.showInlineChat(this.monacoEditor):(this.cancelToken(),this.disposeAllWidget())})),this.featureDisposable.addDispose(this.codeActionService.onCodeActionRun(({id:a,range:b})=>{const y=this.workbenchEditorService.currentEditor;y?.getId()===this.monacoEditor.getId()&&(this.monacoEditor.setSelection(b),this.showInlineChat(this.monacoEditor),this.aiInlineContentWidget&&this.aiInlineContentWidget.clickActionId(a,"codeAction"))})),this.featureDisposable.addDispose(this.monacoEditor.onWillChangeModel(()=>{this.disposeAllWidget()}));let _=!1;this.featureDisposable.addDispose(this.monacoEditor.onMouseDown(a=>{const y=a.target.detail;_=!1,!(y&&typeof y=="string"&&y===r.AIInlineChatContentWidgetId)&&this.aiInlineContentWidget&&!this.aiInlineContentWidget.isPersisted&&this.disposeAllWidget()})),this.featureDisposable.addDispose(this.monacoEditor.onMouseUp(a=>{const y=a.target.detail;y&&typeof y=="string"&&y===r.AIInlineChatContentWidgetId?_=!1:_=!0}));let f=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineChatAutoVisible,!0);return this.featureDisposable.addDispose(this.preferenceService.onSpecificPreferenceChange(r.AINativeSettingSectionsId.InlineChatAutoVisible,({newValue:a})=>{f=a})),this.featureDisposable.addDispose(r.Event.debounce(r.Event.any(this.monacoEditor.onDidChangeCursorSelection,this.monacoEditor.onMouseUp),(a,b)=>b,100)(()=>{!f||!_||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(this.monacoEditor)})),this.featureDisposable}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(_=>{_?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}showInlineContentWidget(_,f){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(h.AIInlineContentWidget,[_]),this.aiInlineContentWidget.show({selection:f})}async showInlineChat(_){if(this.contextKeyService.getContextValue(o.CONTEXT_IN_DEBUG_MODE_KEY)||!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const a=_.getSelection();!a||a.isEmpty()||(this.showInlineContentWidget(_,a),this.aiInlineChatDisposable.addDispose(this.inlineChatFeatureRegistry.onChatClick(()=>{this.aiInlineChatService.launchInputVisible(!0)})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onActionClick(({actionId:b,source:y})=>{const S=this.inlineChatFeatureRegistry.getEditorHandler(b),A=this.inlineChatFeatureRegistry.getAction(b);if(!S||!A)return;const w=this.getCrossSelection(_);if(!w)return;const T=()=>{const D=S.providerDiffPreviewStrategy?S.providerDiffPreviewStrategy:S.providePreviewStrategy;if(D)return D.bind(this,_,this.token)};this.runAction({monacoEditor:_,crossSelection:w,reporterFn:()=>this.aiReporter.start(A.name,{message:A.name,type:r.AIServiceType.InlineChat,source:y,runByCodeAction:y==="codeAction",actionSource:y==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:A.name}),execute:S.execute?S.execute.bind(this,_,this.token):void 0,providerPreview:T(),extraData:{actionSource:y==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:A.name}})})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onInteractiveInputValue(async b=>{const y=this.inlineChatFeatureRegistry.getInteractiveInputHandler();if(!y)return;const S=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(_,b),A=this.getCrossSelection(_);A&&this.runAction({monacoEditor:_,crossSelection:A,reporterFn:()=>this.aiReporter.start(r.AIServiceType.InlineChatInput,{message:b,type:r.AIServiceType.InlineChatInput,source:"input",actionSource:r.ActionSourceEnum.InlineChatInput}),execute:y.execute&&S===v.ERunStrategy.EXECUTE?y.execute.bind(this,_,b,this.token):void 0,providerPreview:y.providePreviewStrategy&&S===v.ERunStrategy.PREVIEW?y.providePreviewStrategy.bind(this,_,b,this.token):void 0,extraData:{actionSource:r.ActionSourceEnum.InlineChatInput,actionType:S}})})))}getCrossSelection(_){const f=_.getSelection();if(!f){this.logger.error("No selection found, aborting inline chat action.");return}return f.setStartPosition(f.startLineNumber,1).setEndPosition(f.endLineNumber,_.getModel().getLineMaxColumn(f.endLineNumber))}convertInlineChatStatus(_,f){if(!this.aiInlineContentWidget)return;const{relationId:a,message:b,startTime:y,isRetry:S,isStop:A}=f;let w;_===c.EInlineChatStatus.DONE&&(w=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(_)),this.aiReporter.end(a,{message:b,success:_!==c.EInlineChatStatus.ERROR,replytime:Date.now()-y,isStop:A,isRetry:S,code:w,actionType:f?.actionType,actionSource:f?.actionSource})}visibleDiffWidget(_){const{monacoEditor:f,options:a,reportInfo:b}=_,{chatResponse:y}=a,{relationId:S,startTime:A,isRetry:w,actionType:T,actionSource:D}=b;if(g.InlineChatController.is(y))this.aiInlineChatOperationDisposable.addDispose([y.onError(O=>{this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:O.message||"",startTime:A,isRetry:w,actionSource:D,actionType:T})}),y.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:"abort",startTime:A,isRetry:w,isStop:!0,actionSource:D,actionType:T})}),y.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:w,actionSource:D,actionType:T})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||r.CancelResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:y.message||"",startTime:A,isRetry:w,isStop:!0,actionSource:D,actionType:T});return}if(r.ErrorResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:y.message||"",startTime:A,isRetry:w,actionSource:D,actionType:T});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:w,actionSource:D,actionType:T})}this.inlineDiffController.showPreviewerByStream(f,a).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(_,f){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(_,f):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(_){if(!this.aiInlineContentWidget)return;const{monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:S,actionType:A,actionSource:w}=_,T=f.getModel();this.inlineDiffController.destroyPreviewer(T.uri.toString()),this.aiInlineChatOperationDisposable.dispose(),this.ensureInlineChatVisible(f,b),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(c.EInlineChatStatus.THINKING));const D=Date.now();if(this.token.isCancellationRequested){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:y,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:w,actionType:A});return}const I=await a();if(r.CancelResponse.is(I)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:y,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:w,actionType:A}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:f,options:{crossSelection:b,chatResponse:I},reportInfo:{relationId:y,startTime:D,isRetry:S,actionType:A,actionSource:w}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(O=>{const L=this.inlineDiffController.getModifyContent(),R=this.inlineDiffController.getOriginContent();this.inlineDiffController.handleAction(O),O===c.EResultKind.ACCEPT?(this.aiReporter.end(y,{message:"accept",success:!0,isReceive:!0,isDrop:!1,code:L,originCode:R,actionType:r.ActionTypeEnum.Accept}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):O===c.EResultKind.DISCARD?(this.aiReporter.end(y,{message:"discard",success:!0,isDrop:!0,isReceive:!1,code:L,originCode:R,actionType:r.ActionTypeEnum.Discard}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):O===c.EResultKind.REGENERATE&&(this.aiReporter.end(y,{message:"regenerate",success:!0,isDrop:!0,isReceive:!1,code:L,originCode:R,actionType:r.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:!0,actionSource:w,actionType:A}))}),this.aiInlineChatService.onThumbs(O=>{this.aiReporter.end(y,{isLike:O})}),this.inlineDiffController.onMaxLineCount(O=>{requestAnimationFrame(()=>{if(b.endLineNumber===T.getLineCount()){const L=f.getOption(m.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(L*O+12)}})})])}async runAction(_){const{monacoEditor:f,crossSelection:a,reporterFn:b,execute:y,providerPreview:S,extraData:A}=_;if(y&&(await y(),this.disposeAllWidget()),S){const w=b();await this.handleDiffPreviewStrategy({monacoEditor:f,strategy:S,crossSelection:a,relationId:w,isRetry:!1,actionSource:A?.actionSource,actionType:A?.actionType})}}}t.InlineChatEditorController=d,d.ID="editor.contrib.ai.inline.chat"},2281:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),m=e(83913),E=e(43718),p=e(89132),v=e(77633);class s{setHandler(h){this._handler=h}handler(){return this._handler}setStrategyHandler(h){this._strategyHandler=h}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}s.ID=`${m.InteractiveInput.displayName}:${(0,E.uuid)(4)}`;let g=class extends E.Disposable{constructor(){super(...arguments),this.actionsMap=new Map,this.editorHandlerMap=new Map,this.terminalHandlerMap=new Map,this.interactiveInputModel=new s,this._onChatClick=new E.Emitter,this.onChatClick=this._onChatClick.event}dispose(){super.dispose(),this.actionsMap.clear(),this.editorHandlerMap.clear(),this.terminalHandlerMap.clear()}updateActions(h,d){this.actionsMap.set(h,d)}collectActions(h){const{id:d}=h;return this.actionsMap.has(d)?(this.logger.warn(`InlineChatFeatureRegistry: id ${d} already exists`),!1):((0,E.isUndefined)(h.renderType)&&(h.renderType="button"),(0,E.isUndefined)(h.order)&&(h.order=0),this.actionsMap.set(d,h),!0)}removeCollectedActions(h){this.actionsMap.delete(h.id),this.codeActionService.deleteCodeActionById(h.id)}getInteractiveInputId(){return s.ID}registerEditorInlineChat(h,d){return this.collectActions(h)&&(this.editorHandlerMap.set(h.id,d),this.codeActionService.registerCodeAction(h)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterEditorInlineChat(h){return this.removeCollectedActions(h)}registerTerminalInlineChat(h,d){return this.collectActions(h)&&((0,E.isUndefined)(d.triggerRules)&&(d.triggerRules="selection"),this.terminalHandlerMap.set(h.id,d)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterTerminalInlineChat(h){return this.removeCollectedActions(h)}registerInteractiveInput(h,d){this.interactiveInputModel.setHandler(d),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||v.ERunStrategy.EXECUTE);const u=()=>{const _=String(this.getSequenceKeyString());if(_){const f={id:s.ID,name:`Chat(${_.toLocaleUpperCase()})`,renderType:"button",order:Number.MAX_SAFE_INTEGER};this.actionsMap.has(f.id)?this.updateActions(f.id,f):this.collectActions(f)}};return this.addDispose(E.Event.filter(this.keybindingRegistry.onKeybindingsChanged,({affectsCommands:_})=>_.includes(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>u())),u(),{dispose:()=>{this.interactiveInputModel.dispose()}}}getSequenceKeyString(){var h;const u=(h=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return u?this.keybindingRegistry.acceleratorForSequence(u,"+"):""}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}getEditorActionButtons(){const h=Array.from(this.editorHandlerMap.keys()).filter(d=>{const u=this.actionsMap.get(d);return u&&u.renderType==="button"}).map(d=>this.actionsMap.get(d)).sort((d,u)=>d.order-u.order);return this.actionsMap.has(s.ID)&&h.push(this.actionsMap.get(s.ID)),h}getEditorActionMenus(){return Array.from(this.editorHandlerMap.keys()).filter(h=>{const d=this.actionsMap.get(h);return d&&d.renderType==="dropdown"}).map(h=>this.actionsMap.get(h))}getEditorHandler(h){return this.editorHandlerMap.get(h)}getTerminalHandler(h){return this.terminalHandlerMap.get(h)}getTerminalActions(){return Array.from(this.terminalHandlerMap.keys()).map(h=>this.actionsMap.get(h))}getAction(h){return this.actionsMap.get(h)}};t.InlineChatFeatureRegistry=g,n.__decorate([(0,r.Autowired)(o.Logger),n.__metadata("design:type",o.Logger)],g.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(p.CodeActionService),n.__metadata("design:type",p.CodeActionService)],g.prototype,"codeActionService",void 0),n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],g.prototype,"keybindingRegistry",void 0),t.InlineChatFeatureRegistry=g=n.__decorate([(0,r.Injectable)()],g)},31031:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineChatService=t.EResultKind=t.EInlineChatStatus=void 0;const n=e(85608),r=e(76003),o=e(43718);var l=e(19413);Object.defineProperty(t,"EInlineChatStatus",{enumerable:!0,get:function(){return l.EInlineChatStatus}}),Object.defineProperty(t,"EResultKind",{enumerable:!0,get:function(){return l.EResultKind}});let m=class{constructor(){this._interactiveInputVisible=!1,this._onInteractiveInputVisible=new o.Emitter,this.onInteractiveInputVisible=this._onInteractiveInputVisible.event,this._onInlineChatVisible=new o.Emitter,this.onInlineChatVisible=this._onInlineChatVisible.event,this._onThumbs=new o.Emitter,this.onThumbs=this._onThumbs.event}get interactiveInputVisible(){return this._interactiveInputVisible}fireThumbsEvent(p){this._onThumbs.fire(p)}launchInputVisible(p){return(0,o.runWhenIdle)(()=>{this._interactiveInputVisible=p,this._onInteractiveInputVisible.fire(p)})}};t.AIInlineChatService=m,t.AIInlineChatService=m=n.__decorate([(0,r.Injectable)({multiple:!1})],m)},26664:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineContentWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),l=e(41869),m=e(89195),E=e(83913),p=e(64102),v=e(43718),s=n.__importStar(e(20868)),g=e(62663),c=e(52659),h=e(77659),d=e(90614),u=e(2281),_=n.__importDefault(e(26899)),f=e(31031),a=y=>{const{onClickActions:S,onClose:A,onInteractiveInputSend:w,onLayoutChange:T,onChatStatus:D,onResultClick:I}=y,O=(0,l.useInjectable)(l.IAIInlineChatService),L=(0,l.useInjectable)(v.InlineChatFeatureRegistryToken),[R,M]=(0,r.useState)(f.EInlineChatStatus.READY),[k,B]=(0,r.useState)(""),[x,N]=(0,r.useState)(!1);(0,r.useEffect)(()=>{const Z=new v.Disposable;return Z.addDispose(D(re=>M(re))),Z.addDispose(O.onInteractiveInputVisible(re=>{N(re)})),()=>{Z.dispose()}},[D,O]),(0,r.useEffect)(()=>{R===f.EInlineChatStatus.ERROR&&A?.()},[A]);const j=(0,r.useMemo)(()=>R===f.EInlineChatStatus.THINKING,[R]),K=(0,r.useMemo)(()=>R===f.EInlineChatStatus.DONE,[R]),U=(0,r.useMemo)(()=>R===f.EInlineChatStatus.ERROR,[R]),X=(0,r.useMemo)(()=>L.getEditorActionButtons(),[L]),z=(0,r.useCallback)(Z=>{S?.(Z)},[S]),Q=(0,r.useCallback)(()=>{A?.()},[A]),G=(0,r.useCallback)(Z=>{w?.(Z)},[w]),J=(0,r.useMemo)(()=>L.getEditorActionMenus().map(Z=>new p.MenuNode({id:`ai.menu.operation.${Z.id}`,label:Z.name,className:_.default.more_operation_menu_item,execute:()=>{z(Z.id)}})),[L]),Y=(0,r.useCallback)(Z=>{B(Z)},[]),H=(0,r.useMemo)(()=>x?r.default.createElement(E.InteractiveInput,{autoFocus:!0,onHeightChange:Z=>T(Z),size:"small",placeholder:(0,v.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:j,value:k,onValueChange:Y,onSend:G}):null,[j,x,k]),$=(0,r.useCallback)(()=>X.length===0&&J.length===0||U?null:K?r.default.createElement(d.InlineResultAction,{onResultClick:I}):r.default.createElement(m.AIAction,{operationList:X,moreOperation:J,onClickItem:z,onClose:Q,loading:j,loadingShowOperation:x,customOperationRender:H}),[X,J,H,I,R,x]);return r.default.createElement("div",{className:_.default.inline_chat_controller_box},$())};let b=class extends c.ReactInlineContentWidget{get interactiveInputValue(){return this._interactiveInputValue}get status(){return this._status}get isPersisted(){return!this.isHidden&&this.status!==f.EInlineChatStatus.READY&&this.status!==f.EInlineChatStatus.ERROR}constructor(S){super(S),this.editor=S,this.allowEditorOverflow=!0,this._onActionClickEmitter=new v.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onInteractiveInputValue=new v.Emitter,this.onInteractiveInputValue=this._onInteractiveInputValue.event,this._onStatusChange=new v.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new v.Emitter,this.onResultClick=this._onResultClick.event,this._status=f.EInlineChatStatus.READY,this.aiNativeContextKey=this.injector.get(h.AINativeContextKey,[this.editor.contextKeyService]),this.addDispose(this.editor.onDidLayoutChange(()=>{this.isOutOfArea()&&this.dispose()}))}launchChatStatus(S){return(0,v.runWhenIdle)(()=>{this._status=S,this._onStatusChange.fire(S)})}dispose(){this.launchChatStatus(f.EInlineChatStatus.READY),super.dispose()}clickActionId(S,A){if(S===this.inlineChatFeatureRegistry.getInteractiveInputId()){this.inlineChatFeatureRegistry._onChatClick.fire();return}this._onActionClickEmitter.fire({actionId:S,source:A})}renderView(){return r.default.createElement(a,{onClickActions:S=>this.clickActionId(S,"widget"),onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:S=>{this.launchChatStatus(f.EInlineChatStatus.THINKING),this._interactiveInputValue=S,this._onInteractiveInputValue.fire(S)},onResultClick:S=>{this._onResultClick.fire(S)}})}async show(S){super.show(S),this.aiNativeContextKey.inlineChatIsVisible.set(!0)}getDomNode(){const S=super.getDomNode();return requestAnimationFrame(()=>{S.style.zIndex=(l.StackingLevel.FindWidget-1).toString()}),S}async hide(){this.aiNativeContextKey.inlineChatIsVisible.set(!1),super.hide()}setOptions(S){this.options=S}setOffsetTop(S){this.domNode.style.transform=`translateY(${S}px)`}id(){return v.AIInlineChatContentWidgetId}getPosition(){const S=super.getPosition();if(S)return S;if(!this.options)return null;const{selection:A}=this.options;if(!A)return null;const w=this.computePosition(A);return w||null}safeGetLineLastNonWhitespaceColumn(S){const A=this.editor.getModel();S<1&&(S=1);const w=A.getLineCount();return S>w&&(S=w),A.getLineLastNonWhitespaceColumn(S)}toAbovePosition(S,A){return{position:new s.Position(S,A),preference:[g.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE,g.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW]}}toBelowPosition(S,A){return{position:new s.Position(S,A),preference:[g.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW,g.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE]}}recheckSelection(S){const A=S.getStartPosition(),w=S.getEndPosition(),D=this.editor.getModel().getLineCount(),I=Math.max(1,w.lineNumber-1),O=Math.min(D,w.lineNumber+1),L=A.with(I,1),R=w.with(O,this.safeGetLineLastNonWhitespaceColumn(O));if(D===1)return this.toBelowPosition(O,this.safeGetLineLastNonWhitespaceColumn(O));if(R.lineNumber===1&&w.lineNumber!==A.lineNumber)return this.computePosition(s.Selection.fromPositions(L,R));const M=this.safeGetLineLastNonWhitespaceColumn(I),k=this.safeGetLineLastNonWhitespaceColumn(O),B=this.safeGetLineLastNonWhitespaceColumn(w.lineNumber);return k>B&&k>M?this.computePosition(s.Selection.fromPositions(R,L)):this.computePosition(s.Selection.fromPositions(L,R))}isProtrudeAbove(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S-1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S-2)}isProtrudeBelow(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S+1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S+2)}computePosition(S){let A=S.getStartPosition(),w=S.getEndPosition(),T=S.getPosition();const I=this.editor.getModel().getLineCount();if(A.lineNumber===w.lineNumber)return this.recheckSelection(S);w.lineNumber-A.lineNumber===1&&(T=w);const O=this.safeGetLineLastNonWhitespaceColumn(T.lineNumber);let L=T.lineNumber,R="below";if(T.equals(A)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(T.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(T.lineNumber-2))<=O)return this.toAbovePosition(T.lineNumber,O);for(let B=A.lineNumber;B<=w.lineNumber;B++){if(this.isProtrudeAbove(B)){L=B,R="above";break}if(this.isProtrudeBelow(B)){L=B,R="below";break}}}else if(T.equals(w)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(T.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(T.lineNumber+2))<=O)return this.toBelowPosition(T.lineNumber,O);for(let B=Math.min(I,w.lineNumber+1);B>=A.lineNumber;B--){if(this.isProtrudeBelow(B)){L=B,R="below";break}if(this.isProtrudeAbove(B)){L=B,R="above";break}}}const M=this.safeGetLineLastNonWhitespaceColumn(L)+1;return R==="below"?this.toBelowPosition(L,M):this.toAbovePosition(L,M)}};t.AIInlineContentWidget=b,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(v.InlineChatFeatureRegistryToken),n.__metadata("design:type",u.InlineChatFeatureRegistry)],b.prototype,"inlineChatFeatureRegistry",void 0),t.AIInlineContentWidget=b=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],b)},15989:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(38890),t),n.__exportStar(e(49444),t),n.__exportStar(e(37679),t),n.__exportStar(e(51347),t)},49444:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveInlineDiffPreviewer=t.SideBySideInlineDiffWidget=t.BaseInlineDiffPreviewer=void 0;const r=e(85608),o=e(76003),l=e(43718),m=e(20868),E=e(90052),p=e(77714),v=e(43255),s=e(74547),g=e(11827),c=e(9491),h=e(31031),d=e(33062),u=e(37679);let _=class extends l.Disposable{constructor(y){super(),this.monacoEditor=y,this.inlineContentWidget=null,this.model=this.monacoEditor.getModel(),this.addDispose(l.Disposable.create(()=>{this.inlineContentWidget&&this.inlineContentWidget.dispose(),this.attachNode(void 0)}))}formatIndentation(y){const S=this.selection.startLineNumber,A=(0,p.getLeadingWhitespace)(this.model.getLineContent(S));if(y===p.empty||A===p.empty)return y;const{tabSize:w,insertSpaces:T}=this.model.getOptions(),D=this.model.getEOL(),I=(0,c.getSpaceCnt)(A,w);let O=(0,c.generateIndent)(I,w,T);const L=y.split(D),R=L[0];let M=!1;if(R){const B=(0,p.getLeadingWhitespace)(R);O===B?O="":O.length>B.length?O=O.slice(B.length):(O=B.slice(O.length),M=!0)}return L.map(B=>{if(M){const x=(0,p.getLeadingWhitespace)(B);return B=O+B.substring(x.length),B}return O+B}).join(D)}getNode(){return this.node}createNodeSnapshot(){return this.node}mount(y){this.inlineContentWidget=y}layout(){var y,S;(y=this.inlineContentWidget)===null||y===void 0||y.setOptions({position:this.getPosition()}),(S=this.inlineContentWidget)===null||S===void 0||S.layoutContentWidget()}onReady(y){return y(),l.Disposable.NULL}create(y,S={disposeWhenEditorClosed:!0}){this.selection=y,this.node=this.createNode(),this.node.setPreviewerOptions(S)}attachNode(y){this.node=y}show(y,S){}onLineCount(y){return this}setValue(y){}getValue(){return""}getOriginValue(){return""}onError(y){}onAbort(){}onEnd(){}revealFirstDiff(){}isModel(y){return this.model.uri.toString()===y}};t.BaseInlineDiffPreviewer=_,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],_.prototype,"injector",void 0),t.BaseInlineDiffPreviewer=_=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],_);let f=n=class extends _{createNode(){const y=this.injector.get(u.InlineDiffWidget,[n.AI_DIFF_WIDGET_ID,{editor:this.monacoEditor,selection:this.selection}]);return y.create(),this.addDispose(y),y}mount(y){super.mount(y),y.addDispose(this)}getPosition(){return m.Position.lift({lineNumber:this.selection.endLineNumber+1,column:1})}layout(){var y;(y=this.inlineContentWidget)===null||y===void 0||y.setPositionPreference([E.ContentWidgetPositionPreference.BELOW]),super.layout()}onReady(y){return this.node?this.node.onReady(y.bind(this)):l.Disposable.NULL}show(y,S){var A;(A=this.node)===null||A===void 0||A.showByLine(y,S)}setValue(y){var S;const A=(S=this.node)===null||S===void 0?void 0:S.getModifiedModel();A?.setValue(this.formatIndentation(y))}getValue(){var y;return((y=this.node)===null||y===void 0?void 0:y.getModifiedModel()).getValue()}getOriginValue(){var y;return((y=this.node)===null||y===void 0?void 0:y.getOriginModel()).getValue()||""}handleAction(y){if(y===h.EResultKind.ACCEPT){const S=this.getValue();this.model.pushEditOperations(null,[{range:this.selection,text:S}],()=>null),this.model.pushStackElement()}}onLineCount(y){var S;return(S=this.node)===null||S===void 0||S.onMaxLineCount(y.bind(this)),this}onData(y){var S,A;const{message:w}=y,T=this.formatIndentation(w),D=(S=this.node)===null||S===void 0?void 0:S.getModifiedModel(),I=D.getEOL()===`\r
28267
+ `)}`:""}`}}return g.text}findTypeIdentifier(g){let c=g;for(;c;){if(c.type==="type_identifier")return c.text;const h=c.child(1);if(!h)break;c=h}return""}async extractImportPaths(g){var c;const h=[],d=await this.parser.parse(g),u=d?.rootNode,_=[],f=[];if(u)for(let a=0;a<u?.childCount;a++){const b=u.child(a);if(b?.type==="import_statement")_.push(b);else if(b?.type==="type_annotation"){const y=b.child(1);y&&f.push(y.text)}else if(b?.type==="lexical_declaration"){const y=this.findTypeIdentifier(b);y&&f.push(y)}}for(const a of _)if(f.some(b=>a.text.includes(b))){let b=(c=a.child(3))===null||c===void 0?void 0:c.text;(b?.includes("'")||b?.includes('"'))&&(b=b.slice(1,-1)),b&&h.push(b)}return h}async extractInterfaceOrTypeCode(g){var c;const h=[];if(this.language==="typescript"){await this.parserLoaded.promise;const d=(c=this.parser)===null||c===void 0?void 0:c.parse(g),u=d?.rootNode;if(u)for(let _=0;_<u?.childCount;_++){const f=u.child(_);if(f?.type==="export_statement"){const a=f.child(1);(a?.type==="interface_declaration"||a?.type==="type_alias_declaration")&&h.push(a.text)}else(f?.type==="interface_declaration"||f?.type==="type_alias_declaration")&&h.push(f.text)}}return h}async findSyntaxErrorCount(g){var c;await this.parserLoaded.promise;const h=(c=this.parser)===null||c===void 0?void 0:c.parse(g),d=h?.rootNode;if(!d)return 0;let u=0;const _=f=>{(f.type==="function_declaration"||f.type==="class_declaration"||f.type==="variable_declarator"||f.type==="statement_block"||f.type==="expression_statement")&&(f.hasError||f.isMissing||f.type==="ERROR")&&u++;for(let b=0;b<f.childCount;b++){const y=f.child(b);y&&_(y)}};return _(d),u}async findNearestCodeBlockWithPosition(g,c){const h=await this.parser.parse(g);if(h){const{rootNode:d}=h,u=d.namedDescendantForIndex(c),_=this.findContainingCodeBlockWithPosition(u,c);if(!_)return null;let a=g.split(`
28268
+ `).slice(0,_.startPosition.row).reduce((b,y)=>b+y.length,0);return a+=_.startPosition.row,a+=_.startPosition.column,{codeBlock:_.text,range:{start:{line:_.startPosition.row,character:0},end:{line:_.endPosition.row,character:1/0}},offset:a,type:_.type}}return null}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=v,n.__decorate([(0,o.Autowired)(p.WasmModuleManager),n.__metadata("design:type",p.WasmModuleManager)],v.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(E.TreeSitterLanguageFacts),n.__metadata("design:type",E.TreeSitterLanguageFacts)],v.prototype,"languageFacts",void 0),t.LanguageParser=v=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],v)},85679:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParserService=void 0;const n=e(85608),r=e(76003),o=e(3073),l=e(22486);let m=class{constructor(){this.pool=new Map}createParser(p){const v=l.parserNameMap[p];if(v)return this.pool.has(v)||this.pool.set(v,this.injector.get(o.LanguageParser,[v])),this.pool.get(v)}dispose(){this.pool.forEach(p=>p.dispose()),this.pool.clear()}};t.LanguageParserService=m,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],m.prototype,"injector",void 0),t.LanguageParserService=m=n.__decorate([(0,r.Injectable)()],m)},53374:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toMonacoRange=e;function e(n){return{startLineNumber:n.startPosition.row+1,startColumn:n.startPosition.column+1,endLineNumber:n.endPosition.row+1,endColumn:n.endPosition.column+1}}},19584:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GolangLanguageFacts=void 0;const e=["function_declaration","method_declaration","block","if_statement","else_statement","switch_statement","case_clause","for_statement","range_clause","type_switch_statement","type_case_clause","comm_clause","select_statement","go_statement","defer_statement"],n=new Set(e);class r{constructor(){this.name="go",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return n}isCodeBlock(l){return n.has(l)}}t.GolangLanguageFacts=r},22486:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeSitterLanguageFacts=t.knownLanguageFacts=void 0;const n=e(85608);n.__exportStar(e(17973),t);const r=e(76003),o=e(19584),l=e(44606),m=e(82381),E=e(41486),p=e(98588),v=e(96436),s=e(2349),g=e(78542),c=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,l.JavaLanguageFacts,m.JavaScriptLanguageFacts,E.JavaScriptReactLanguageFacts,p.PythonLanguageFacts,v.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(u=>{const _=new u;this.langs.set(_.name,_)})}isCodeBlock(u,_){const f=this.langs.get(u);return f&&f.isCodeBlock?f.isCodeBlock(_):!1}isFunctionCodeBlock(u,_){const f=this.langs.get(u);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(_):!1}provideFunctionInfo(u,_){const f=this.langs.get(u);return f&&f.provideFunctionInfo?f.provideFunctionInfo(_):null}getCodeBlockTypes(u){const _=this.langs.get(u);return _?_.provideCodeBlocks():c}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaLanguageFacts=void 0;const e=["compilation_unit","class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","block","static_initializer","instance_initializer","if_statement","switch_statement","while_statement","do_statement","for_statement","enhanced_for_statement","try_statement","catch_clause","finally_clause"],n=new Set(["method_declaration","constructor_declaration"]),r=new Set(e);class o{constructor(){this.name="java",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(m){return r.has(m)}isFunctionCodeBlocks(m){return n.has(m)}}t.JavaLanguageFacts=o},82381:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptLanguageFacts=t.functionBlockCodeTypes=t.javascriptBlockCodeTypes=void 0;const n=e(53374);t.javascriptBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","method_definition","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","try_statement","catch_clause","block","export_statement","lexical_declaration"],t.functionBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","method_definition"];const r=new Set(t.functionBlockCodeTypes),o=new Set(t.javascriptBlockCodeTypes);class l{constructor(){this.name="javascript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return o}isCodeBlock(E){return o.has(E)}isFunctionCodeBlocks(E){return r.has(E)}provideFunctionInfo(E){var p,v,s;switch(E.type){case"function_declaration":case"function_expression":return{infoCategory:"function",type:E.type,name:((p=E.firstNamedChild)===null||p===void 0?void 0:p.text)||"",signatures:E.children.filter(g=>g.type==="parameter").map(g=>{var c;return((c=g.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(E)};case"arrow_function":{const g=E.parent;return g&&g.type==="variable_declarator"&&g.parent&&(g.parent.type==="lexical_declaration"||g.parent.type==="export_statement"||g.parent.type==="variable_declaration")?{infoCategory:"function",type:E.type,name:((v=g.firstChild)===null||v===void 0?void 0:v.text)||"",signatures:E.children.filter(c=>c.type==="parameter").map(c=>{var h;return((h=c.firstChild)===null||h===void 0?void 0:h.text)||""}),range:(0,n.toMonacoRange)(g.parent)}:null}case"method_definition":return{infoCategory:"function",type:E.type,name:((s=E.firstNamedChild)===null||s===void 0?void 0:s.text)||"",signatures:E.children.filter(g=>g.type==="parameter").map(g=>{var c;return((c=g.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(E)}}return null}}t.JavaScriptLanguageFacts=l},41486:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptReactLanguageFacts=t.javascriptreactBlockCodeTypes=void 0;const n=e(82381);t.javascriptreactBlockCodeTypes=[...n.javascriptBlockCodeTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.javascriptreactBlockCodeTypes);class o{constructor(){this.name="jsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(m){return r.has(m)}}t.JavaScriptReactLanguageFacts=o},98588:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PythonLanguageFacts=t.pythonBlockCodeTypes=void 0,t.pythonBlockCodeTypes=["function_definition","class_definition","compound_statement","if_statement","elif_clause","else_clause","for_statement","while_statement","try_statement","except_clause","with_statement","decorated_definition"];const e=new Set(t.pythonBlockCodeTypes);class n{constructor(){this.name="python",this.listCommentStyle="# ",this.blockCommentStyle={start:"'''",end:"'''",linePrefix:""}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.PythonLanguageFacts=n},96436:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RustLanguageFacts=t.rustBlockCodeTypes=void 0,t.rustBlockCodeTypes=["function_item","impl_item","trait_item","block","if_expression","match_expression","while_expression","loop_expression","for_expression","closure_expression","struct_item","enum_item","union_item","mod_item"];const e=new Set(t.rustBlockCodeTypes);class n{constructor(){this.name="rust",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.RustLanguageFacts=n},17973:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parserIdentifierMap=t.parserNameMap=void 0;const r=e(85608).__importDefault(e(19891)),o={typescript:"typescript",typescriptreact:"tsx",javascript:"javascript",javascriptreact:"jsx",rust:"rust",python:"python",java:"java",go:"go"};t.parserNameMap=o,t.parserIdentifierMap=(0,r.default)(t.parserNameMap)},2349:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptLanguageFacts=t.typescriptBlockTypes=void 0,t.typescriptBlockTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","interface_declaration","method_definition","method_signature","enum_declaration","type_alias_declaration","lexical_declaration","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","for_of_statement","try_statement","catch_clause","block","module","public_field_definition","private_field_definition","export_statement"];const e=new Set(t.typescriptBlockTypes);class n{constructor(){this.name="typescript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.TypeScriptLanguageFacts=n},78542:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptReactLanguageFacts=t.typescriptreactBlockTypes=void 0;const n=e(2349);t.typescriptreactBlockTypes=[...n.typescriptBlockTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.typescriptreactBlockTypes);class o{constructor(){this.name="tsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(m){return r.has(m)}}t.TypeScriptReactLanguageFacts=o},67045:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WasmModuleManager=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),l=e(6858),m=e(70392);let E=class{async resolveResourceUri(){const v=await this.rendererRuntime.provideResourceUri(l.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(v)}constructor(){this.resolvedResourceUriDeferred=new m.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const s=`${await this.resolvedResourceUriDeferred.promise}/tree-sitter.wasm`;return this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(v){if(!this.cachedRuntime.has(v)){const s=new m.Deferred;this.cachedRuntime.set(v,s);const c=`${await this.resolvedResourceUriDeferred.promise}/tree-sitter-${v}.wasm`;fetch(c).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(v).promise}};t.WasmModuleManager=E,n.__decorate([(0,o.Autowired)(l.RendererRuntime),n.__metadata("design:type",l.RendererRuntime)],E.prototype,"rendererRuntime",void 0),t.WasmModuleManager=E=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],E)},4972:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIRightTabRenderer=t.AILeftTabRenderer=t.AIChatTabRendererWithTab=t.AIChatTabRenderer=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),m=e(89195),E=e(1149),p=e(43718),v=e(11090),s=e(63067),g=e(46245),c=e(66368),h=e(19951),d=e(752),u=e(19413),_=n.__importDefault(e(87708)),f=()=>{const{side:w}=o.default.useContext(h.TabbarConfig),T=(0,l.useInjectable)(d.TabbarServiceFactory)(w);return(0,o.useEffect)(()=>{T.setIsLatter(!0)},[T]),o.default.createElement("div",{style:{width:0}},o.default.createElement(g.TabbarViewBase,{tabSize:0,MoreTabView:g.IconElipses,TabView:g.IconTabView,barSize:0,panelBorderSize:1}))},a=({className:w,components:T})=>o.default.createElement(h.TabRendererBase,{side:u.AI_CHAT_VIEW_ID,direction:"left-to-right",id:_.default.ai_chat_panel,className:(0,r.default)(w,`${u.AI_CHAT_VIEW_ID}-slot`),components:T,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:_.default.ai_chat_view_container}})});t.AIChatTabRenderer=a;const b=({className:w,components:T})=>o.default.createElement(h.TabRendererBase,{side:u.AI_CHAT_VIEW_ID,direction:"right-to-left",id:_.default.ai_chat_panel,className:(0,r.default)(w,`${u.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:T,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:_.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=b;const y=({className:w,components:T})=>o.default.createElement(v.DesignLeftTabRenderer,{className:w,components:T,tabbarView:S});t.AILeftTabRenderer=y;const S=()=>{const w=(0,l.useInjectable)(s.IMainLayoutService),T=(0,l.useInjectable)(d.TabbarServiceFactory)(l.SlotLocation.right),D=(0,l.useAutorun)(T.currentContainerId),I=o.default.useMemo(()=>w.getExtraMenu(),[w]),[O]=(0,l.useContextMenus)(I),L=(0,o.useCallback)(({renderContainers:R})=>{const M=T.visibleContainers.filter(k=>{var B;return!(!((B=k.options)===null||B===void 0)&&B.hideTab)});return o.default.createElement(o.default.Fragment,null,M.length>0&&o.default.createElement(m.HorizontalVertical,{margin:"8px auto 0px",width:"60%"}),M.map(k=>R(k,T,D)))},[D,T]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:L,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:_.default.extra_bottom_icon_container},O.length>=0?O.map(R=>o.default.createElement(m.EnhanceIconWithCtxMenu,{key:R.id,id:R.id,wrapperClassName:_.default.extra_bottom_icon,iconClass:R.icon,menuNodes:R.children,skew:{x:-8,y:-4}})):null)})},A=({className:w,components:T})=>{const D=(0,l.useInjectable)(d.TabbarServiceFactory)(l.SlotLocation.right),I=(0,l.useInjectable)(E.DesignLayoutConfig),O=(0,o.useCallback)(()=>{D.updateCurrentContainerId("")},[]),L=(0,o.useCallback)(M=>{const{component:k}=M,{options:B}=k;return o.default.createElement(c.ContainerView,{...M,renderContainerWrap:({children:x})=>o.default.createElement("div",{className:_.default.right_slot_container_wrap},o.default.createElement("div",{className:_.default.header},o.default.createElement("span",{className:_.default.title},B&&B.title),o.default.createElement("div",{className:_.default.side},o.default.createElement(m.EnhancePopover,{id:"ai_right_panel_header_close",title:(0,p.localize)("editor.title.context.close")},o.default.createElement(m.EnhanceIcon,{icon:"close",onClick:O})))),o.default.createElement("div",{className:_.default.container},x))})},[]),R=(0,o.useMemo)(()=>I.useMergeRightWithLeftPanel?_.default.right_tab_renderer:"",[I]);return o.default.createElement(v.DesignRightTabRenderer,{components:T,className:R,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:L})})};t.AIRightTabRenderer=A},82983:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatLogoAvatar=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),l=e(89195),m=e(63067),E=e(19413),p=n.__importDefault(e(88473)),v=()=>{const s=(0,o.useInjectable)(m.IMainLayoutService),g=r.default.useCallback(()=>{s.toggleSlot(E.AI_CHAT_VIEW_ID)},[s]);return r.default.createElement("div",{className:p.default.ai_switch,onClick:g},r.default.createElement(l.AILogoAvatar,{iconClassName:p.default.avatar_icon_large}))};t.AIChatLogoAvatar=v},53617:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EnhanceDecorationsCollection=void 0;const n=e(85608),r=e(43718),o=e(20868),l=e(77714),m=n.__importDefault(e(4619));class E{get isHidden(){return this._hidden}get codeEditor(){return this.metadata.codeEditor}get deltaData(){return this.metadata.deltaData}get id(){return this.metadata.id}get editorDecoration(){return this.metadata.editorDecoration}get group(){return this._group}constructor(s){this.metadata=s,this._hidden=!1;const{editorDecoration:g,deltaData:c,isHidden:h,group:d}=s;(0,r.isUndefined)(c.length)?this.length=g.range.endLineNumber-g.range.startLineNumber:this.length=c.length,this.range=g.range,this.options=g.options,this.resumeRange=this.range,this._hidden=!!h,this._hidden&&this.hide(),(0,r.isDefined)(d)&&this.setGroup(d)}setGroup(s){this._group=s}changeVisibility(s,g){if(!this.options.className)return;const c=this.options.className.split(l.space).filter(h=>h!==m.default.hidden&&h!==m.default.visible).filter(Boolean);c.push(s),this.options.className=c.join(l.space),this.codeEditor.changeDecorations(h=>{h.changeDecorationOptions(this.id,this.options),h.changeDecoration(this.id,g)})}setRange(s){this.range=s}getRange(){return this.range}dispose(){var s,g;(g=(s=this.deltaData).dispose)===null||g===void 0||g.call(s)}hide(){this.resumeRange=this.range,this._hidden=!0;const s={lineNumber:this.range.startLineNumber,column:1},g=o.Range.fromPositions(s);this.changeVisibility(m.default.hidden,g)}resume(){this._hidden=!1,this.changeVisibility(m.default.visible,o.Range.lift(this.resumeRange))}}class p extends r.Disposable{get model(){return this.codeEditor.getModel()}constructor(s){super(),this.codeEditor=s,this.deltaDecorations=[],this._onDidDecorationsChange=this.registerDispose(new r.Emitter),this.onDidDecorationsChange=this._onDidDecorationsChange.event,this.addDispose(this.codeEditor.onDidContentSizeChange(g=>{const{contentHeightChanged:c}=g;c&&this.flush()}))}flush(){this.deltaDecorations=this.deltaDecorations.map(s=>{const{id:g,editorDecoration:{range:c}}=s,h=this.model.getDecorationRange(g);return s.setRange(h??c),s}),this._onDidDecorationsChange.fire(this.deltaDecorations)}delete(s){this.codeEditor.changeDecorations(g=>{g.removeDecoration(s),this.deltaDecorations=this.deltaDecorations.filter(c=>c.id!==s)})}createDecorations(s){return new E(s)}set(s){this.clear(),this.codeEditor.changeDecorations(g=>{const c=[];for(const h of s){const d=g.addDecoration(h.range,h.options);c.push(this.createDecorations({id:d,editorDecoration:h,codeEditor:this.codeEditor,isHidden:h.isHidden,group:h.group,deltaData:{dispose:()=>this.delete(d),length:h.length}}))}this.deltaDecorations=c})}getDecorations(){return this.deltaDecorations}getDecorationByGroup(s){return this.deltaDecorations.find(g=>g.group===s)}getDecorationByLineNumber(s){return this.deltaDecorations.find(g=>g.getRange().startLineNumber===s)}clear(){this.codeEditor.changeDecorations(s=>{for(const g of this.deltaDecorations)s.removeDecoration(g.id);this.deltaDecorations=[]})}}t.EnhanceDecorationsCollection=p},44260:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MsgHistoryManager=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class extends o.Disposable{constructor(){super(...arguments),this.messageMap=new Map,this._onMessageChange=new o.Emitter,this.onMessageChange=this._onMessageChange.event}dispose(){this.clearMessages(),super.dispose()}clearMessages(){this.messageMap.clear()}doAddMessage(E){const p=(0,o.uuid)(6),v=this.messageMap.size,s={...E,id:p,order:v,type:E.type||"string"};return this.messageMap.set(p,s),this._onMessageChange.fire(this.getMessages()),p}getMessages(){return Array.from(this.messageMap.values()).sort((E,p)=>E.order-p.order)}addUserMessage(E){return this.doAddMessage({...E,role:1})}addAssistantMessage(E){return this.doAddMessage({...E,role:2})}updateAssistantMessage(E,p){if(!this.messageMap.has(E))return;const v=this.messageMap.get(E);this.messageMap.set(E,{...v,content:p.content})}};t.MsgHistoryManager=l,t.MsgHistoryManager=l=n.__decorate([(0,r.Injectable)({multiple:!1})],l)},3841:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativePreferencesContribution=void 0;const n=e(85608),r=e(41869),o=e(83854);let l=class{constructor(){this.schema=o.aiNativePreferenceSchema}};t.AINativePreferencesContribution=l,t.AINativePreferencesContribution=l=n.__decorate([(0,r.Domain)(r.PreferenceContribution)],l)},83854:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aiNativePreferenceSchema=t.EInlineDiffPreviewMode=void 0;const n=e(41869),r=e(43718);var o;(function(l){l.inlineLive="inlineLive",l.sideBySide="sideBySide"})(o||(t.EInlineDiffPreviewMode=o={})),t.aiNativePreferenceSchema={properties:{[n.AINativeSettingSectionsId.InlineDiffPreviewMode]:{type:"string",enum:[o.inlineLive,o.sideBySide],enumDescriptions:[(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.inlineLive"),(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.sideBySide")],default:o.inlineLive},[n.AINativeSettingSectionsId.InlineChatAutoVisible]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InlineChatCodeActionEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.ChatVisibleType]:{type:"string",enum:["never","always","default"],default:"default"},[n.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime]:{type:"number",default:150},[n.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLintErrors]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLineChange]:{type:"boolean",default:!1}}}},77633:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeCoreContribution=t.TerminalSuggestionReadableStream=t.ERunStrategy=void 0;const n=e(93062);var r;(function(l){l.EXECUTE="EXECUTE",l.PREVIEW="PREVIEW"})(r||(t.ERunStrategy=r={}));class o extends n.SumiReadableStream{static create(){return new o}}t.TerminalSuggestionReadableStream=o,t.AINativeCoreContribution=Symbol("AINativeCoreContribution")},24522:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ttPolicy=t.renderLines=void 0;const n=e(85608),r=e(55405),o=n.__importStar(e(98236)),l=e(27357),m=e(31324),E=e(33892),p=e(24315),v=(s,g,c,h)=>{const d=h.get(m.EditorOption.disableMonospaceOptimizations),u=h.get(m.EditorOption.stopRenderingLineAfter),_="none",f=h.get(m.EditorOption.renderControlCharacters),a=h.get(m.EditorOption.fontLigatures),b=h.get(m.EditorOption.fontInfo),y=h.get(m.EditorOption.lineHeight),S=new E.StringBuilder(1e4);S.appendString('<div class="suggest-preview-text">');for(let T=0,D=c.length;T<D;T++){const I=c[T],O=I.content;S.appendString('<div class="view-line'),S.appendString('" style="top:'),S.appendString(String(T*y)),S.appendString('px;width:1000000px;">');const L=o.isBasicASCII(O),R=o.containsRTL(O);(0,p.renderViewLine)(new p.RenderLineInput(b.isMonospace&&!d,b.canUseHalfwidthRightwardsArrow,O,!1,L,R,0,I.lineTokens,I.decorations,g,0,b.spaceWidth,b.middotWidth,b.wsmiddotWidth,u,_,f,a!==m.EditorFontLigatures.OFF,null),S),S.appendString("</div>")}S.appendString("</div>"),(0,l.applyFontInfo)(s,b);const A=S.build(),w=t.ttPolicy?t.ttPolicy.createHTML(A):A;s.innerHTML=w};t.renderLines=v,t.ttPolicy=(0,r.createTrustedTypesPolicy)("editorGhostText",{createHTML:s=>s})},90614:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineResultAction=void 0;const r=e(85608).__importStar(e(14041)),o=e(66205),l=e(89195),m=e(43718),E=e(31031),p=({onResultClick:v})=>{const s=(0,r.useMemo)(()=>[{icon:"check",text:(0,m.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>v(E.EResultKind.ACCEPT)},{icon:"discard",text:(0,m.localize)("aiNative.operate.discard.title"),onClick:()=>v(E.EResultKind.DISCARD)},{icon:"afresh",text:(0,m.localize)("aiNative.operate.afresh.title"),onClick:()=>v(E.EResultKind.REGENERATE)}],[v]);return r.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},r.default.createElement(l.AIInlineResult,{iconItems:s}))};t.InlineResultAction=p},40111:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatController=void 0;const n=e(43718),r=e(93062),o=e(98864);class l{static is(E){return E instanceof l&&typeof E.mountReadable=="function"}constructor(E){this.options=E,this._onData=new n.Emitter,this.onData=this._onData.event,this._onEnd=new n.Emitter,this.onEnd=this._onEnd.event,this._onAbort=new n.Emitter,this.onAbort=this._onAbort.event,this._onError=new n.Emitter,this.onError=this._onError.event,this._stream=null,this._listened=!1}calculateCodeBlocks(E){var p;return!((p=this.options)===null||p===void 0)&&p.enableCodeblockRender?(0,o.extractCodeBlocks)(E):E}mountReadable(E){this._stream=E}get isListened(){return this._listened}listen(){if(this._listened)return;if(!this._stream)throw new Error("No Stream mounted");this._listened=!0;const E=new n.ReplyResponse("");let p="";(0,r.listenReadable)(this._stream,{onData:v=>{p+=v.content;const s=this.calculateCodeBlocks(p);E.updateMessage(s),this._onData.fire(E)},onEnd:()=>{this._onEnd.fire()},onError:v=>{n.AbortError.is(v)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(v))}})}}t.InlineChatController=l},51221:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatEditorController=void 0;const n=e(41869),r=e(43718),o=e(66482),l=e(54414),m=e(52902),E=e(99906),p=e(89132),v=e(77633),s=e(38890),g=e(40111),c=e(31031),h=e(26664);class d extends E.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new r.Disposable,this.aiInlineChatOperationDisposable=new r.Disposable,this.inlineChatInUsing=!1}static get(_){return _.getContribution(d.ID)}get aiNativeConfigService(){return this.injector.get(n.AINativeConfigService)}get aiInlineChatService(){return this.injector.get(n.IAIInlineChatService)}get inlineChatFeatureRegistry(){return this.injector.get(r.InlineChatFeatureRegistryToken)}get preferenceService(){return this.injector.get(n.PreferenceService)}get aiReporter(){return this.injector.get(r.IAIReporter)}get workbenchEditorService(){return this.injector.get(l.WorkbenchEditorService)}get codeActionService(){return this.injector.get(p.CodeActionService)}get logger(){return this.injector.get(r.ILogger)}get contextKeyService(){return this.injector.get(n.IContextKeyService)}mount(){if(this.inlineDiffController=s.InlineDiffController.get(this.monacoEditor),!this.monacoEditor)return this.featureDisposable;this.featureDisposable.addDispose(this.aiInlineChatService.onInlineChatVisible(a=>{a?this.showInlineChat(this.monacoEditor):(this.cancelToken(),this.disposeAllWidget())})),this.featureDisposable.addDispose(this.codeActionService.onCodeActionRun(({id:a,range:b})=>{const y=this.workbenchEditorService.currentEditor;y?.getId()===this.monacoEditor.getId()&&(this.monacoEditor.setSelection(b),this.showInlineChat(this.monacoEditor),this.aiInlineContentWidget&&this.aiInlineContentWidget.clickActionId(a,"codeAction"))})),this.featureDisposable.addDispose(this.monacoEditor.onWillChangeModel(()=>{this.disposeAllWidget()}));let _=!1;this.featureDisposable.addDispose(this.monacoEditor.onMouseDown(a=>{const y=a.target.detail;_=!1,!(y&&typeof y=="string"&&y===r.AIInlineChatContentWidgetId)&&this.aiInlineContentWidget&&!this.aiInlineContentWidget.isPersisted&&this.disposeAllWidget()})),this.featureDisposable.addDispose(this.monacoEditor.onMouseUp(a=>{const y=a.target.detail;y&&typeof y=="string"&&y===r.AIInlineChatContentWidgetId?_=!1:_=!0}));let f=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineChatAutoVisible,!0);return this.featureDisposable.addDispose(this.preferenceService.onSpecificPreferenceChange(r.AINativeSettingSectionsId.InlineChatAutoVisible,({newValue:a})=>{f=a})),this.featureDisposable.addDispose(r.Event.debounce(r.Event.any(this.monacoEditor.onDidChangeCursorSelection,this.monacoEditor.onMouseUp),(a,b)=>b,100)(()=>{!f||!_||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(this.monacoEditor)})),this.featureDisposable}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(_=>{_?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}showInlineContentWidget(_,f){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(h.AIInlineContentWidget,[_]),this.aiInlineContentWidget.show({selection:f})}async showInlineChat(_){if(this.contextKeyService.getContextValue(o.CONTEXT_IN_DEBUG_MODE_KEY)||!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const a=_.getSelection();!a||a.isEmpty()||(this.showInlineContentWidget(_,a),this.aiInlineChatDisposable.addDispose(this.inlineChatFeatureRegistry.onChatClick(()=>{this.aiInlineChatService.launchInputVisible(!0)})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onActionClick(({actionId:b,source:y})=>{const S=this.inlineChatFeatureRegistry.getEditorHandler(b),A=this.inlineChatFeatureRegistry.getAction(b);if(!S||!A)return;const w=this.getCrossSelection(_);if(!w)return;const T=()=>{const D=S.providerDiffPreviewStrategy?S.providerDiffPreviewStrategy:S.providePreviewStrategy;if(D)return D.bind(this,_,this.token)};this.runAction({monacoEditor:_,crossSelection:w,reporterFn:()=>this.aiReporter.start(A.name,{message:A.name,type:r.AIServiceType.InlineChat,source:y,runByCodeAction:y==="codeAction",actionSource:y==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:A.name}),execute:S.execute?S.execute.bind(this,_,this.token):void 0,providerPreview:T(),extraData:{actionSource:y==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:A.name}})})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onInteractiveInputValue(async b=>{const y=this.inlineChatFeatureRegistry.getInteractiveInputHandler();if(!y)return;const S=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(_,b),A=this.getCrossSelection(_);A&&this.runAction({monacoEditor:_,crossSelection:A,reporterFn:()=>this.aiReporter.start(r.AIServiceType.InlineChatInput,{message:b,type:r.AIServiceType.InlineChatInput,source:"input",actionSource:r.ActionSourceEnum.InlineChatInput}),execute:y.execute&&S===v.ERunStrategy.EXECUTE?y.execute.bind(this,_,b,this.token):void 0,providerPreview:y.providePreviewStrategy&&S===v.ERunStrategy.PREVIEW?y.providePreviewStrategy.bind(this,_,b,this.token):void 0,extraData:{actionSource:r.ActionSourceEnum.InlineChatInput,actionType:S}})})))}getCrossSelection(_){const f=_.getSelection();if(!f){this.logger.error("No selection found, aborting inline chat action.");return}return f.setStartPosition(f.startLineNumber,1).setEndPosition(f.endLineNumber,_.getModel().getLineMaxColumn(f.endLineNumber))}convertInlineChatStatus(_,f){if(!this.aiInlineContentWidget)return;const{relationId:a,message:b,startTime:y,isRetry:S,isStop:A}=f;let w;_===c.EInlineChatStatus.DONE&&(w=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(_)),this.aiReporter.end(a,{message:b,success:_!==c.EInlineChatStatus.ERROR,replytime:Date.now()-y,isStop:A,isRetry:S,code:w,actionType:f?.actionType,actionSource:f?.actionSource})}visibleDiffWidget(_){const{monacoEditor:f,options:a,reportInfo:b}=_,{chatResponse:y}=a,{relationId:S,startTime:A,isRetry:w,actionType:T,actionSource:D}=b;if(g.InlineChatController.is(y))this.aiInlineChatOperationDisposable.addDispose([y.onError(O=>{this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:O.message||"",startTime:A,isRetry:w,actionSource:D,actionType:T})}),y.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:"abort",startTime:A,isRetry:w,isStop:!0,actionSource:D,actionType:T})}),y.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:w,actionSource:D,actionType:T})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||r.CancelResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:y.message||"",startTime:A,isRetry:w,isStop:!0,actionSource:D,actionType:T});return}if(r.ErrorResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:y.message||"",startTime:A,isRetry:w,actionSource:D,actionType:T});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:w,actionSource:D,actionType:T})}this.inlineDiffController.showPreviewerByStream(f,a).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(_,f){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(_,f):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(_){if(!this.aiInlineContentWidget)return;const{monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:S,actionType:A,actionSource:w}=_,T=f.getModel();this.inlineDiffController.destroyPreviewer(T.uri.toString()),this.aiInlineChatOperationDisposable.dispose(),this.ensureInlineChatVisible(f,b),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(c.EInlineChatStatus.THINKING));const D=Date.now();if(this.token.isCancellationRequested){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:y,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:w,actionType:A});return}const I=await a();if(r.CancelResponse.is(I)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:y,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:w,actionType:A}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:f,options:{crossSelection:b,chatResponse:I},reportInfo:{relationId:y,startTime:D,isRetry:S,actionType:A,actionSource:w}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(O=>{const L=this.inlineDiffController.getModifyContent(),R=this.inlineDiffController.getOriginContent();this.inlineDiffController.handleAction(O),O===c.EResultKind.ACCEPT?(this.aiReporter.end(y,{message:"accept",success:!0,isReceive:!0,isDrop:!1,code:L,originCode:R,actionType:r.ActionTypeEnum.Accept}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):O===c.EResultKind.DISCARD?(this.aiReporter.end(y,{message:"discard",success:!0,isDrop:!0,isReceive:!1,code:L,originCode:R,actionType:r.ActionTypeEnum.Discard}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):O===c.EResultKind.REGENERATE&&(this.aiReporter.end(y,{message:"regenerate",success:!0,isDrop:!0,isReceive:!1,code:L,originCode:R,actionType:r.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:!0,actionSource:w,actionType:A}))}),this.aiInlineChatService.onThumbs(O=>{this.aiReporter.end(y,{isLike:O})}),this.inlineDiffController.onMaxLineCount(O=>{requestAnimationFrame(()=>{if(b.endLineNumber===T.getLineCount()){const L=f.getOption(m.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(L*O+12)}})})])}async runAction(_){const{monacoEditor:f,crossSelection:a,reporterFn:b,execute:y,providerPreview:S,extraData:A}=_;if(y&&(await y(),this.disposeAllWidget()),S){const w=b();await this.handleDiffPreviewStrategy({monacoEditor:f,strategy:S,crossSelection:a,relationId:w,isRetry:!1,actionSource:A?.actionSource,actionType:A?.actionType})}}}t.InlineChatEditorController=d,d.ID="editor.contrib.ai.inline.chat"},2281:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),m=e(83913),E=e(43718),p=e(89132),v=e(77633);class s{setHandler(h){this._handler=h}handler(){return this._handler}setStrategyHandler(h){this._strategyHandler=h}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}s.ID=`${m.InteractiveInput.displayName}:${(0,E.uuid)(4)}`;let g=class extends E.Disposable{constructor(){super(...arguments),this.actionsMap=new Map,this.editorHandlerMap=new Map,this.terminalHandlerMap=new Map,this.interactiveInputModel=new s,this._onChatClick=new E.Emitter,this.onChatClick=this._onChatClick.event}dispose(){super.dispose(),this.actionsMap.clear(),this.editorHandlerMap.clear(),this.terminalHandlerMap.clear()}updateActions(h,d){this.actionsMap.set(h,d)}collectActions(h){const{id:d}=h;return this.actionsMap.has(d)?(this.logger.warn(`InlineChatFeatureRegistry: id ${d} already exists`),!1):((0,E.isUndefined)(h.renderType)&&(h.renderType="button"),(0,E.isUndefined)(h.order)&&(h.order=0),this.actionsMap.set(d,h),!0)}removeCollectedActions(h){this.actionsMap.delete(h.id),this.codeActionService.deleteCodeActionById(h.id)}getInteractiveInputId(){return s.ID}registerEditorInlineChat(h,d){return this.collectActions(h)&&(this.editorHandlerMap.set(h.id,d),this.codeActionService.registerCodeAction(h)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterEditorInlineChat(h){return this.removeCollectedActions(h)}registerTerminalInlineChat(h,d){return this.collectActions(h)&&((0,E.isUndefined)(d.triggerRules)&&(d.triggerRules="selection"),this.terminalHandlerMap.set(h.id,d)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterTerminalInlineChat(h){return this.removeCollectedActions(h)}registerInteractiveInput(h,d){this.interactiveInputModel.setHandler(d),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||v.ERunStrategy.EXECUTE);const u=()=>{const _=String(this.getSequenceKeyString());if(_){const f={id:s.ID,name:`Chat(${_.toLocaleUpperCase()})`,renderType:"button",order:Number.MAX_SAFE_INTEGER};this.actionsMap.has(f.id)?this.updateActions(f.id,f):this.collectActions(f)}};return this.addDispose(E.Event.filter(this.keybindingRegistry.onKeybindingsChanged,({affectsCommands:_})=>_.includes(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>u())),u(),{dispose:()=>{this.interactiveInputModel.dispose()}}}getSequenceKeyString(){var h;const u=(h=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return u?this.keybindingRegistry.acceleratorForSequence(u,"+"):""}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}getEditorActionButtons(){const h=Array.from(this.editorHandlerMap.keys()).filter(d=>{const u=this.actionsMap.get(d);return u&&u.renderType==="button"}).map(d=>this.actionsMap.get(d)).sort((d,u)=>d.order-u.order);return this.actionsMap.has(s.ID)&&h.push(this.actionsMap.get(s.ID)),h}getEditorActionMenus(){return Array.from(this.editorHandlerMap.keys()).filter(h=>{const d=this.actionsMap.get(h);return d&&d.renderType==="dropdown"}).map(h=>this.actionsMap.get(h))}getEditorHandler(h){return this.editorHandlerMap.get(h)}getTerminalHandler(h){return this.terminalHandlerMap.get(h)}getTerminalActions(){return Array.from(this.terminalHandlerMap.keys()).map(h=>this.actionsMap.get(h))}getAction(h){return this.actionsMap.get(h)}};t.InlineChatFeatureRegistry=g,n.__decorate([(0,r.Autowired)(o.Logger),n.__metadata("design:type",o.Logger)],g.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(p.CodeActionService),n.__metadata("design:type",p.CodeActionService)],g.prototype,"codeActionService",void 0),n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],g.prototype,"keybindingRegistry",void 0),t.InlineChatFeatureRegistry=g=n.__decorate([(0,r.Injectable)()],g)},31031:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineChatService=t.EResultKind=t.EInlineChatStatus=void 0;const n=e(85608),r=e(76003),o=e(43718);var l=e(19413);Object.defineProperty(t,"EInlineChatStatus",{enumerable:!0,get:function(){return l.EInlineChatStatus}}),Object.defineProperty(t,"EResultKind",{enumerable:!0,get:function(){return l.EResultKind}});let m=class{constructor(){this._interactiveInputVisible=!1,this._onInteractiveInputVisible=new o.Emitter,this.onInteractiveInputVisible=this._onInteractiveInputVisible.event,this._onInlineChatVisible=new o.Emitter,this.onInlineChatVisible=this._onInlineChatVisible.event,this._onThumbs=new o.Emitter,this.onThumbs=this._onThumbs.event}get interactiveInputVisible(){return this._interactiveInputVisible}fireThumbsEvent(p){this._onThumbs.fire(p)}launchInputVisible(p){return(0,o.runWhenIdle)(()=>{this._interactiveInputVisible=p,this._onInteractiveInputVisible.fire(p)})}};t.AIInlineChatService=m,t.AIInlineChatService=m=n.__decorate([(0,r.Injectable)({multiple:!1})],m)},26664:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineContentWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),l=e(41869),m=e(89195),E=e(83913),p=e(64102),v=e(43718),s=n.__importStar(e(20868)),g=e(62663),c=e(52659),h=e(77659),d=e(90614),u=e(2281),_=n.__importDefault(e(26899)),f=e(31031),a=y=>{const{onClickActions:S,onClose:A,onInteractiveInputSend:w,onLayoutChange:T,onChatStatus:D,onResultClick:I}=y,O=(0,l.useInjectable)(l.IAIInlineChatService),L=(0,l.useInjectable)(v.InlineChatFeatureRegistryToken),[R,M]=(0,r.useState)(f.EInlineChatStatus.READY),[k,B]=(0,r.useState)(""),[x,N]=(0,r.useState)(!1);(0,r.useEffect)(()=>{const Z=new v.Disposable;return Z.addDispose(D(re=>M(re))),Z.addDispose(O.onInteractiveInputVisible(re=>{N(re)})),()=>{Z.dispose()}},[D,O]),(0,r.useEffect)(()=>{R===f.EInlineChatStatus.ERROR&&A?.()},[A]);const j=(0,r.useMemo)(()=>R===f.EInlineChatStatus.THINKING,[R]),K=(0,r.useMemo)(()=>R===f.EInlineChatStatus.DONE,[R]),U=(0,r.useMemo)(()=>R===f.EInlineChatStatus.ERROR,[R]),X=(0,r.useMemo)(()=>L.getEditorActionButtons(),[L]),z=(0,r.useCallback)(Z=>{S?.(Z)},[S]),Q=(0,r.useCallback)(()=>{A?.()},[A]),G=(0,r.useCallback)(Z=>{w?.(Z)},[w]),J=(0,r.useMemo)(()=>L.getEditorActionMenus().map(Z=>new p.MenuNode({id:`ai.menu.operation.${Z.id}`,label:Z.name,className:_.default.more_operation_menu_item,execute:()=>{z(Z.id)}})),[L]),Y=(0,r.useCallback)(Z=>{B(Z)},[]),H=(0,r.useMemo)(()=>x?r.default.createElement(E.InteractiveInput,{autoFocus:!0,onHeightChange:Z=>T(Z),size:"small",placeholder:(0,v.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:j,value:k,onValueChange:Y,onSend:G}):null,[j,x,k]),$=(0,r.useCallback)(()=>X.length===0&&J.length===0||U?null:K?r.default.createElement(d.InlineResultAction,{onResultClick:I}):r.default.createElement(m.AIAction,{operationList:X,moreOperation:J,onClickItem:z,onClose:Q,loading:j,loadingShowOperation:x,customOperationRender:H}),[X,J,H,I,R,x]);return r.default.createElement("div",{className:_.default.inline_chat_controller_box},$())};let b=class extends c.ReactInlineContentWidget{get interactiveInputValue(){return this._interactiveInputValue}get status(){return this._status}get isPersisted(){return!this.isHidden&&this.status!==f.EInlineChatStatus.READY&&this.status!==f.EInlineChatStatus.ERROR}constructor(S){super(S),this.editor=S,this.allowEditorOverflow=!0,this._onActionClickEmitter=new v.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onInteractiveInputValue=new v.Emitter,this.onInteractiveInputValue=this._onInteractiveInputValue.event,this._onStatusChange=new v.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new v.Emitter,this.onResultClick=this._onResultClick.event,this._status=f.EInlineChatStatus.READY,this.aiNativeContextKey=this.injector.get(h.AINativeContextKey,[this.editor.contextKeyService]),this.addDispose(this.editor.onDidLayoutChange(()=>{this.isOutOfArea()&&this.dispose()}))}launchChatStatus(S){return(0,v.runWhenIdle)(()=>{this._status=S,this._onStatusChange.fire(S)})}dispose(){this.launchChatStatus(f.EInlineChatStatus.READY),super.dispose()}clickActionId(S,A){if(S===this.inlineChatFeatureRegistry.getInteractiveInputId()){this.inlineChatFeatureRegistry._onChatClick.fire();return}this._onActionClickEmitter.fire({actionId:S,source:A})}renderView(){return r.default.createElement(a,{onClickActions:S=>this.clickActionId(S,"widget"),onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:S=>{this.launchChatStatus(f.EInlineChatStatus.THINKING),this._interactiveInputValue=S,this._onInteractiveInputValue.fire(S)},onResultClick:S=>{this._onResultClick.fire(S)}})}async show(S){super.show(S),this.aiNativeContextKey.inlineChatIsVisible.set(!0)}getDomNode(){const S=super.getDomNode();return requestAnimationFrame(()=>{S.style.zIndex=(l.StackingLevel.FindWidget-1).toString()}),S}async hide(){this.aiNativeContextKey.inlineChatIsVisible.set(!1),super.hide()}setOptions(S){this.options=S}setOffsetTop(S){this.domNode.style.transform=`translateY(${S}px)`}id(){return v.AIInlineChatContentWidgetId}getPosition(){const S=super.getPosition();if(S)return S;if(!this.options)return null;const{selection:A}=this.options;if(!A)return null;const w=this.computePosition(A);return w||null}safeGetLineLastNonWhitespaceColumn(S){const A=this.editor.getModel();S<1&&(S=1);const w=A.getLineCount();return S>w&&(S=w),A.getLineLastNonWhitespaceColumn(S)}toAbovePosition(S,A){return{position:new s.Position(S,A),preference:[g.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE,g.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW]}}toBelowPosition(S,A){return{position:new s.Position(S,A),preference:[g.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW,g.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE]}}recheckSelection(S){const A=S.getStartPosition(),w=S.getEndPosition(),D=this.editor.getModel().getLineCount(),I=Math.max(1,w.lineNumber-1),O=Math.min(D,w.lineNumber+1),L=A.with(I,1),R=w.with(O,this.safeGetLineLastNonWhitespaceColumn(O));if(D===1)return this.toBelowPosition(O,this.safeGetLineLastNonWhitespaceColumn(O));if(R.lineNumber===1&&w.lineNumber!==A.lineNumber)return this.computePosition(s.Selection.fromPositions(L,R));const M=this.safeGetLineLastNonWhitespaceColumn(I),k=this.safeGetLineLastNonWhitespaceColumn(O),B=this.safeGetLineLastNonWhitespaceColumn(w.lineNumber);return k>B&&k>M?this.computePosition(s.Selection.fromPositions(R,L)):this.computePosition(s.Selection.fromPositions(L,R))}isProtrudeAbove(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S-1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S-2)}isProtrudeBelow(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S+1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S+2)}computePosition(S){let A=S.getStartPosition(),w=S.getEndPosition(),T=S.getPosition();const I=this.editor.getModel().getLineCount();if(A.lineNumber===w.lineNumber)return this.recheckSelection(S);w.lineNumber-A.lineNumber===1&&(T=w);const O=this.safeGetLineLastNonWhitespaceColumn(T.lineNumber);let L=T.lineNumber,R="below";if(T.equals(A)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(T.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(T.lineNumber-2))<=O)return this.toAbovePosition(T.lineNumber,O);for(let B=A.lineNumber;B<=w.lineNumber;B++){if(this.isProtrudeAbove(B)){L=B,R="above";break}if(this.isProtrudeBelow(B)){L=B,R="below";break}}}else if(T.equals(w)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(T.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(T.lineNumber+2))<=O)return this.toBelowPosition(T.lineNumber,O);for(let B=Math.min(I,w.lineNumber+1);B>=A.lineNumber;B--){if(this.isProtrudeBelow(B)){L=B,R="below";break}if(this.isProtrudeAbove(B)){L=B,R="above";break}}}const M=this.safeGetLineLastNonWhitespaceColumn(L)+1;return R==="below"?this.toBelowPosition(L,M):this.toAbovePosition(L,M)}};t.AIInlineContentWidget=b,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(v.InlineChatFeatureRegistryToken),n.__metadata("design:type",u.InlineChatFeatureRegistry)],b.prototype,"inlineChatFeatureRegistry",void 0),t.AIInlineContentWidget=b=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],b)},15989:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(38890),t),n.__exportStar(e(49444),t),n.__exportStar(e(37679),t),n.__exportStar(e(51347),t)},49444:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveInlineDiffPreviewer=t.SideBySideInlineDiffWidget=t.BaseInlineDiffPreviewer=void 0;const r=e(85608),o=e(76003),l=e(43718),m=e(20868),E=e(90052),p=e(77714),v=e(43255),s=e(74547),g=e(11827),c=e(9491),h=e(31031),d=e(33062),u=e(37679);let _=class extends l.Disposable{constructor(y){super(),this.monacoEditor=y,this.inlineContentWidget=null,this.model=this.monacoEditor.getModel(),this.addDispose(l.Disposable.create(()=>{this.inlineContentWidget&&this.inlineContentWidget.dispose(),this.attachNode(void 0)}))}formatIndentation(y){const S=this.selection.startLineNumber,A=(0,p.getLeadingWhitespace)(this.model.getLineContent(S));if(y===p.empty||A===p.empty)return y;const{tabSize:w,insertSpaces:T}=this.model.getOptions(),D=this.model.getEOL(),I=(0,c.getSpaceCnt)(A,w);let O=(0,c.generateIndent)(I,w,T);const L=y.split(D),R=L[0];let M=!1;if(R){const B=(0,p.getLeadingWhitespace)(R);O===B?O="":O.length>B.length?O=O.slice(B.length):(O=B.slice(O.length),M=!0)}return L.map(B=>{if(M){const x=(0,p.getLeadingWhitespace)(B);return B=O+B.substring(x.length),B}return O+B}).join(D)}getNode(){return this.node}createNodeSnapshot(){return this.node}mount(y){this.inlineContentWidget=y}layout(){var y,S;(y=this.inlineContentWidget)===null||y===void 0||y.setOptions({position:this.getPosition()}),(S=this.inlineContentWidget)===null||S===void 0||S.layoutContentWidget()}onReady(y){return y(),l.Disposable.NULL}create(y,S={disposeWhenEditorClosed:!0}){this.selection=y,this.node=this.createNode(),this.node.setPreviewerOptions(S)}attachNode(y){this.node=y}show(y,S){}onLineCount(y){return this}setValue(y){}getValue(){return""}getOriginValue(){return""}onError(y){}onAbort(){}onEnd(){}revealFirstDiff(){}isModel(y){return this.model.uri.toString()===y}};t.BaseInlineDiffPreviewer=_,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],_.prototype,"injector",void 0),t.BaseInlineDiffPreviewer=_=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],_);let f=n=class extends _{createNode(){const y=this.injector.get(u.InlineDiffWidget,[n.AI_DIFF_WIDGET_ID,{editor:this.monacoEditor,selection:this.selection}]);return y.create(),this.addDispose(y),y}mount(y){super.mount(y),y.addDispose(this)}getPosition(){return m.Position.lift({lineNumber:this.selection.endLineNumber+1,column:1})}layout(){var y;(y=this.inlineContentWidget)===null||y===void 0||y.setPositionPreference([E.ContentWidgetPositionPreference.BELOW]),super.layout()}onReady(y){return this.node?this.node.onReady(y.bind(this)):l.Disposable.NULL}show(y,S){var A;(A=this.node)===null||A===void 0||A.showByLine(y,S)}setValue(y){var S;const A=(S=this.node)===null||S===void 0?void 0:S.getModifiedModel();A?.setValue(this.formatIndentation(y))}getValue(){var y;return((y=this.node)===null||y===void 0?void 0:y.getModifiedModel()).getValue()}getOriginValue(){var y;return((y=this.node)===null||y===void 0?void 0:y.getOriginModel()).getValue()||""}handleAction(y){if(y===h.EResultKind.ACCEPT){const S=this.getValue();this.model.pushEditOperations(null,[{range:this.selection,text:S}],()=>null),this.model.pushStackElement()}}onLineCount(y){var S;return(S=this.node)===null||S===void 0||S.onMaxLineCount(y.bind(this)),this}onData(y){var S,A;const{message:w}=y,T=this.formatIndentation(w),D=(S=this.node)===null||S===void 0?void 0:S.getModifiedModel(),I=D.getEOL()===`\r
28268
28269
  `?v.DefaultEndOfLine.CRLF:v.DefaultEndOfLine.LF,{textBuffer:O,disposable:L}=(0,s.createTextBuffer)(T,I),R=g.ModelService._computeEdits(D,O);D.pushEditOperations([],R,()=>[]),L.dispose(),(A=this.node)===null||A===void 0||A.layout()}onError(y){var S;(S=this.node)===null||S===void 0||S.layout()}onAbort(){var y;(y=this.node)===null||y===void 0||y.layout()}onEnd(){var y;(y=this.node)===null||y===void 0||y.layout()}};t.SideBySideInlineDiffWidget=f,f.AI_DIFF_WIDGET_ID="AI-DIFF-WIDGET",t.SideBySideInlineDiffWidget=f=n=r.__decorate([(0,o.Injectable)({multiple:!0})],f);let a=class extends _{listenNode(y){y.addDispose(y.onDidEditChange(()=>this.layout())),y.addDispose(y.onPartialEditWidgetListChange(A=>{var w;A.every(T=>T.isHidden)&&(this.dispose(),(w=this.inlineContentWidget)===null||w===void 0||w.dispose())}));const S=y.onDispose(()=>{this.dispose(),S.dispose()});this.addDispose(y)}createNode(){const y=this.injector.get(d.InlineStreamDiffHandler,[this.monacoEditor]);return y.initialize(this.selection),this.listenNode(y),y}attachNode(y){var S;if((S=this.node)===null||S===void 0||S.dispose(),this.node=y,y){const A=y.currentSnapshotStore;A&&(this.node.restoreDecorationSnapshot(A.decorationSnapshotData),this.listenNode(y))}}createNodeSnapshot(){if(!this.node)return this.createNode();const y=this.node.createSnapshot(),S=this.injector.get(d.InlineStreamDiffHandler,[this.monacoEditor]);return S.restoreSnapshot(y),S}getPosition(){var y;const S=(y=this.node)===null||y===void 0?void 0:y.getZone();return S?m.Position.lift({lineNumber:S.startLineNumber,column:1}):m.Position.lift({lineNumber:1,column:1})}handleAction(y){var S,A;switch(y){case h.EResultKind.ACCEPT:(S=this.node)===null||S===void 0||S.acceptAll();break;case h.EResultKind.DISCARD:case h.EResultKind.REGENERATE:(A=this.node)===null||A===void 0||A.rejectAll();break;default:break}}onLineCount(){return l.Disposable.NULL}layout(){var y,S,A;(y=this.inlineContentWidget)===null||y===void 0||y.setPositionPreference([E.ContentWidgetPositionPreference.ABOVE,E.ContentWidgetPositionPreference.BELOW]),super.layout();const w=this.getPosition();if(w&&this.inlineContentWidget){const T=(S=this.node)===null||S===void 0?void 0:S.livePreviewDiffDecorationModel.getRemovedWidgets();if(T?.length){const D=w.lineNumber,I=T[0];if(I&&((A=I.getLastPosition())===null||A===void 0?void 0:A.lineNumber)<=D){const L=this.inlineContentWidget.getLineHeight(),R=I.height;this.inlineContentWidget.setOffsetTop(-L*R-4)}}}}onData(y){var S;const{message:A}=y;(S=this.node)===null||S===void 0||S.addLinesToDiff(this.formatIndentation(A))}onEnd(){var y,S;const A=(y=this.node)===null||y===void 0?void 0:y.recompute(d.EComputerMode.legacy);A&&((S=this.node)===null||S===void 0||S.pushRateFinallyDiffStack(A))}getValue(){var y;return((y=this.node)===null||y===void 0?void 0:y.getVirtualModelValue())||""}getOriginValue(){var y;return((y=this.node)===null||y===void 0?void 0:y.getOriginModelValue())||""}setValue(y){var S,A;const w=(S=this.node)===null||S===void 0?void 0:S.recompute(d.EComputerMode.legacy,this.formatIndentation(y));w&&((A=this.node)===null||A===void 0||A.finallyRender(w))}revealFirstDiff(){var y;(y=this.node)===null||y===void 0||y.revealFirstDiff()}};t.LiveInlineDiffPreviewer=a,t.LiveInlineDiffPreviewer=a=r.__decorate([(0,o.Injectable)({multiple:!0})],a)},37679:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(43144),l=n.__importDefault(e(25873)),m=e(76003),E=e(41869),p=n.__importStar(e(20868)),v=e(87822),s=e(34819),g=e(90626),c=n.__importDefault(e(69790)),h={fixedOverflowWidgets:!0,readOnly:!1,enableSplitViewResizing:!0,ignoreTrimWhitespace:!0,renderSideBySide:!0,lineNumbers:"on",glyphMargin:!0,scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,vertical:"hidden"},scrollBeyondLastLine:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,diffCodeLens:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,renderIndicators:!1,inDiffEditor:!0},d=r.default.memo(_=>{const{range:f,onMaxLineCount:a,editor:b,onReady:y}=_,S=(0,E.useInjectable)(E.MonacoService),A=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!f)return;const w=b.getModel();if(!w)return;const T=w.getValueInRange(f),D=S.createDiffEditor(A.current,{...h,lineDecorationsWidth:b.getLayoutInfo().decorationsWidth,lineNumbersMinChars:b.getOption(p.editor.EditorOption.lineNumbersMinChars)}),I=g.StandaloneServices.get(v.IModelService),O={languageId:w.getLanguageId(),onDidChange:E.Event.None},L=I.createModel(T,O,p.Uri.from({scheme:E.Schemes.inMemory,path:"inline-diff-widget/"+(0,E.randomString)(8)}),!0),R=I.createModel("",O,p.Uri.from({scheme:E.Schemes.inMemory,path:"inline-diff-widget/"+(0,E.randomString)(8)}),!0);D.setModel({original:L,modified:R}),D.revealLine(f.startLineNumber,p.editor.ScrollType.Immediate);const M=()=>{if(a){const k=L.getLineCount(),B=R.getLineCount();a(Math.max(k,B)+1)}};return y&&y({getModifiedModel:()=>R,getOriginModel:()=>L,layout:M}),M(),()=>{D&&D.dispose()}},[f,b]),r.default.createElement("div",{ref:A,className:c.default.diff_editor_widget})});let u=class extends s.ZoneWidget{setPreviewerOptions(f){this.previewerOptions=f}_fillContainer(f){this.setCssClass("inline-diff-widget"),this.root=l.default.createRoot(f);let a=null;if(this._resolveResultWidget)if(f.parentNode){const b=document.createElement("div");requestAnimationFrame(()=>{b.className=c.default.ai_diff_editor_resolve_result_widget;const y=this.editor.getLayoutInfo();b.style.width=`${y.contentWidth}px`,b.style.left=`${y.contentLeft}px`}),f.parentNode.appendChild(b),a=(0,o.createPortal)(this._resolveResultWidget,b),this.resultContainer=b}else throw new Error("[impossible path] container.parentNode is null");this.root.render(r.default.createElement(E.ConfigProvider,{value:this.configContext},r.default.createElement("div",{className:c.default.ai_diff_editor_container},r.default.createElement(d,{range:this.range,editor:this.editor,onMaxLineCount:b=>{b&&(this._relayout(b),this._onMaxLineCount.fire(b))},onReady:b=>{this.diffWidgetHandler=b,this._onReady.fire()}})),a))}computeResultWidgetWidth(){const f=this.editor.getLayoutInfo();return f.contentWidth+f.contentLeft}_onWidth(f){super._onWidth(f),requestAnimationFrame(()=>{this.resultContainer&&(this.resultContainer.style.width=`${this.computeResultWidgetWidth()}px`)})}getModifiedModel(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.getModifiedModel()}getOriginModel(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.getOriginModel()}layout(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.layout()}constructor(f,a){super(a.editor,{showArrow:!1,showFrame:!1,arrowColor:void 0,frameColor:void 0,keepEditorSelection:!0,showInHiddenAreas:!0}),this.id=f,this._onMaxLineCount=new E.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._onReady=new E.Emitter,this.onReady=this._onReady.event,this.diffWidgetHandler=null,this.resultContainer=null,this._resolveResultWidget=null;const{selection:b,hiddenArea:y,editor:S}=a;this.range=b,this.hiddenArea=y||b,S.setHiddenAreas([this.hiddenArea],this.id)}revealRange(f,a){}setContainerStyle(f){var a;const b=Object.keys(f);for(const y of b)Object.prototype.hasOwnProperty.call((a=this.container)===null||a===void 0?void 0:a.style,y)&&(this.container.style[y]=f[y])}addClassName(f){return this.setCssClass(f),this}dispose(){this.hide(),super.dispose()}hide(){this.editor.setHiddenAreas([],this.id),super.hide(),this.root&&this.root.unmount()}showByLine(f,a=20){this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible=()=>!0,super.show({startLineNumber:f,startColumn:1,endLineNumber:f,endColumn:Number.MAX_SAFE_INTEGER},a)}setResolveResultWidget(f){this._resolveResultWidget=f}};t.InlineDiffWidget=u,n.__decorate([(0,m.Autowired)(E.AppConfig),n.__metadata("design:type",Object)],u.prototype,"configContext",void 0),t.InlineDiffWidget=u=n.__decorate([(0,m.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],u)},38890:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffController=void 0;const n=e(41869),r=e(43718),o=e(57517),l=e(99906),m=e(83854),E=e(40111),p=e(49444);class v extends l.BaseAIMonacoEditorController{constructor(){super(...arguments),this._onMaxLineCount=new r.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._previewerNodeStore=new Map}static get(g){return g.getContribution(v.ID)}get preferenceService(){return this.injector.get(n.PreferenceService)}get eventBus(){return this.injector.get(r.IEventBus)}mount(){return this.featureDisposable.addDispose(this.eventBus.on(o.EditorGroupCloseEvent,g=>{const c=g.payload.resource.uri.toString(),h=this.getStoredState(c);h&&h.previewerOptions.disposeWhenEditorClosed&&this.destroyPreviewer(c)})),this.registerInlineDiffFeature(this.monacoEditor),this.featureDisposable}storeState(g){if(!this.previewer)return;const c=this.previewer.createNodeSnapshot();c&&this._previewerNodeStore.set(g,c)}tryRestoreState(g,c){const h=this.getStoredState(c);if(h){if(h.disposed){this.destroyPreviewer(c);return}return this.restoreState(g,h)}}restoreState(g,c){var h;if((h=g.getModel())===null||h===void 0?void 0:h.uri){this.previewer=this.injector.get(p.LiveInlineDiffPreviewer,[g]),this.previewer.attachNode(c),this.listenPreviewer(this.previewer);const u=this.previewer.onDispose(()=>{this.destroyPreviewer(),u.dispose()})}}registerInlineDiffFeature(g){const c=g.getModel();this.featureDisposable.addDispose(g.onWillChangeModel(h=>{if(!h.oldModelUrl)return;const d=h.oldModelUrl.toString();this.storeState(d),this.destroyPreviewer()})),this.featureDisposable.addDispose(g.onDidChangeModel(h=>{h.newModelUrl&&this.tryRestoreState(g,h.newModelUrl.toString())})),c&&this.featureDisposable.addDispose(c.onWillDispose(()=>{const h=c.uri.toString();this.destroyPreviewer(h)}))}showPreviewerByStream(g,c){const{crossSelection:h,chatResponse:d}=c,u=new r.Disposable,_=this.createDiffPreviewer(g,h,c.previewerOptions),f=()=>{_.layout(),u.dispose()};return u.addDispose(_.onReady(()=>{if(E.InlineChatController.is(d)){const a=d;u.addDispose([a.onData(b=>{r.ReplyResponse.is(b)&&_.onData(b)}),a.onError(b=>{_.onError(b),f()}),a.onAbort(()=>{_.onAbort(),f()}),a.onEnd(()=>{_.onEnd(),f()})]),a.listen()}else _.setValue(d.message),f()})),_.layout(),_}createDiffPreviewer(g,c,h){const d=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineDiffPreviewMode,m.EInlineDiffPreviewMode.inlineLive);return this.destroyPreviewer(),d===m.EInlineDiffPreviewMode.sideBySide?this.previewer=this.injector.get(p.SideBySideInlineDiffWidget,[g]):this.previewer=this.injector.get(p.LiveInlineDiffPreviewer,[g]),this.previewer.create(c,h),this.previewer.show(c.startLineNumber-1,c.endLineNumber-c.startLineNumber+2),this.listenPreviewer(this.previewer),this.previewer}listenPreviewer(g){g&&g.addDispose(g.onLineCount(c=>this._onMaxLineCount.fire(c)))}getPreviewer(){return this.previewer}getStoredState(g){return this._previewerNodeStore.get(g)}handleAction(g){var c;(c=this.previewer)===null||c===void 0||c.handleAction(g)}getModifyContent(){var g;return(g=this.previewer)===null||g===void 0?void 0:g.getValue()}getOriginContent(){var g;return(g=this.previewer)===null||g===void 0?void 0:g.getOriginValue()}destroyPreviewer(g){var c;(c=this.previewer)===null||c===void 0||c.dispose(),this.previewer=void 0,g&&this._previewerNodeStore.delete(g)}revealFirstDiff(){var g;(g=this.previewer)===null||g===void 0||g.revealFirstDiff()}}t.InlineDiffController=v,v.ID="editor.contrib.ai.inline.diff"},51347:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffService=void 0;const n=e(85608),r=e(76003),o=e(70392);let l=class{constructor(){this._partialEventEmitter=new o.Emitter,this.onPartialEdit=this._partialEventEmitter.event}firePartialEdit(E){this._partialEventEmitter.fire(E)}};t.InlineDiffService=l,t.InlineDiffService=l=n.__decorate([(0,r.Injectable)()],l)},53182:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintLineDecoration=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),m=e(43718),E=e(20868),p=e(60304),v=e(52416),s=e(75189),g="inline_hint_description",c="inline_hint_description_key";let h=class extends m.Disposable{constructor(u){super(),this.monacoEditor=u,this.colorRegister=(0,v.getColorRegistry)(),p.StandaloneServices.get(s.ICodeEditorService).registerDecorationType(g,c,{isWholeLine:!0}),this.addDispose(m.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(g,c,[])}))}getSequenceKeyString(){var u;const f=(u=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||u===void 0?void 0:u.resolved;return f?this.keybindingRegistry.acceleratorForSequence(f,"+"):""}async show(u){var _;const f=(0,m.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString()),a=await this.themeService.getCurrentTheme(),b=this.colorRegister.resolveDefaultColor(v.inputPlaceholderForeground,a);this.monacoEditor.setDecorationsByType(g,c,[{range:E.Range.fromPositions(u),renderOptions:{after:{contentText:f,opacity:"0.5",color:(_=b?.toString())!==null&&_!==void 0?_:"",padding:"0 0 0 12px",width:"max-content"}}}])}};t.InlineHintLineDecoration=h,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],h.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(v.IThemeService),n.__metadata("design:type",Object)],h.prototype,"themeService",void 0),t.InlineHintLineDecoration=h=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],h)},77886:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintController=void 0;const n=e(43718),r=e(77714),o=e(77659),l=e(99906),m=e(71863),E=e(74353),p=e(19520),v=e(53182);class s extends l.BaseAIMonacoEditorController{static get(c){return c.getContribution(s.ID)}get inlineCompletionsService(){return this.injector.get(m.AICompletionsService)}get inlineInputChatService(){return this.injector.get(E.InlineInputChatService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(c){const h=new n.Disposable,d=this.injector.get(o.AINativeContextKey,[c.contextKeyService]),u=()=>{h.dispose()},_=f=>{var a;const b=c.getModel();if(!b||this.inlineCompletionsService.isVisibleCompletion)return;const y=b.getLineContent(f.lineNumber),S=b.getLineDecorations(f.lineNumber),A=y?.trim()===r.empty,w=(a=c.getSelection())===null||a===void 0?void 0:a.isEmpty(),T=S.some(D=>D.options.description===p.InlineInputPreviewDecorationID);if(A&&w&&!T){const D=this.injector.get(v.InlineHintLineDecoration,[c]);D.show(f),this.inlineInputChatService.setCurrentVisiblePosition(f),d.inlineHintWidgetIsVisible.set(!0),h.addDispose(D.onDispose(()=>{this.inlineInputChatService.setCurrentVisiblePosition(void 0),d.inlineHintWidgetIsVisible.set(!1)})),h.addDispose(D)}};return this.featureDisposable.addDispose(c.onDidChangeCursorPosition(f=>{u(),_(f.position)})),this.featureDisposable.addDispose(c.onDidFocusEditorWidget(()=>{const f=c.getPosition();f&&(u(),_(f))})),this.featureDisposable.addDispose(c.onDidBlurEditorWidget(()=>{u()})),this.featureDisposable.addDispose(this.inlineCompletionsService.onVisibleCompletion(f=>{f&&u()})),this.featureDisposable.addDispose(h),this.featureDisposable}}t.InlineHintController=s,s.ID="editor.contrib.ai.inline.hint"},32213:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputChatWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),l=e(89195),m=e(43718),E=e(90052),p=e(90614),v=e(31031),s=e(26664),g=n.__importDefault(e(13185)),c=e(74353),h=u=>{const{onClose:_,onInteractiveInputSend:f,onLayoutChange:a,onChatStatus:b,onResultClick:y}=u,[S,A]=(0,r.useState)(v.EInlineChatStatus.READY),[w,T]=(0,r.useState)("");(0,r.useEffect)(()=>{const k=new m.Disposable;return k.addDispose(b(B=>A(B))),()=>{k.dispose()}},[b]);const D=(0,r.useMemo)(()=>S===v.EInlineChatStatus.THINKING,[S]),I=(0,r.useMemo)(()=>S===v.EInlineChatStatus.DONE,[S]),O=(0,r.useMemo)(()=>S===v.EInlineChatStatus.ERROR,[S]),L=(0,r.useCallback)(()=>{_?.()},[_]),R=(0,r.useCallback)(k=>{f?.(k)},[f]),M=(0,r.useCallback)(k=>{T(k)},[]);return O?null:I?r.default.createElement(p.InlineResultAction,{onResultClick:y}):r.default.createElement(l.AIAction,{loadingShowOperation:!0,onClose:L,loading:D,customOperationRender:r.default.createElement(l.InteractiveInput,{autoFocus:!0,onHeightChange:k=>a(k),size:"small",placeholder:(0,m.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,value:w,onValueChange:M,disabled:D,onSend:R})})};let d=class extends s.AIInlineContentWidget{constructor(){super(...arguments),this.allowEditorOverflow=!0,this.positionPreference=[E.ContentWidgetPositionPreference.ABOVE]}dispose(){super.dispose(),this.inlineInputChatService.hide()}id(){return m.AIInlineInputChatContentWidgetId}renderView(){return r.default.createElement("div",{className:g.default.input_wrapper},r.default.createElement(h,{onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:_=>{this.launchChatStatus(v.EInlineChatStatus.THINKING),this._onInteractiveInputValue.fire(_)},onResultClick:_=>{this._onResultClick.fire(_)}}))}};t.InlineInputChatWidget=d,n.__decorate([(0,o.Autowired)(c.InlineInputChatService),n.__metadata("design:type",c.InlineInputChatService)],d.prototype,"inlineInputChatService",void 0),t.InlineInputChatWidget=d=n.__decorate([(0,o.Injectable)({multiple:!0})],d)},89060:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputController=void 0;const r=e(85608),o=e(76003),l=e(43718),m=r.__importStar(e(20868)),E=e(2261),p=e(52451),v=e(74547),s=e(77659),g=e(99906),c=e(77633),h=e(40111),d=e(31031),u=e(19520),_=e(32213),f=r.__importDefault(e(13185)),a=e(74353);let b=n=class extends g.BaseAIMonacoEditorController{static get(S){return S.getContribution(n.ID)}get inlineInputChatService(){return this.injector.get(a.InlineInputChatService)}get inlineChatFeatureRegistry(){return this.injector.get(l.InlineChatFeatureRegistryToken)}mount(){return this.registerInlineInputFeature(this.monacoEditor)}async doRequestReadable(S,A,w,T,D,I){const O=this.inlineChatFeatureRegistry.getInteractiveInputHandler(),L=w.getModel();if(!O||!L)return;A.launchChatStatus(d.EInlineChatStatus.THINKING);const R=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(w,S);if(R===c.ERunStrategy.EXECUTE&&O.execute){O.execute(w,S,this.token),A.launchChatStatus(d.EInlineChatStatus.DONE),I();return}if(R===c.ERunStrategy.PREVIEW&&O.providePreviewStrategy){const M=await O.providePreviewStrategy(w,S,this.token);if(l.CancelResponse.is(M)){A.launchChatStatus(d.EInlineChatStatus.READY),I();return}if(h.InlineChatController.is(M)){const k=M;let B;const x=this.registerDispose(new l.RunOnceScheduler(()=>{const N=D.getRange(0);N&&B&&L.pushEditOperations(null,[E.EditOperation.replace(N,B)],()=>null)},16*12.5));T.addDispose([k.onData(async N=>{l.ReplyResponse.is(N)&&(B=N.message,x.isScheduled()||x.schedule())}),k.onError(N=>{A.launchChatStatus(d.EInlineChatStatus.ERROR)}),k.onAbort(()=>{A.launchChatStatus(d.EInlineChatStatus.READY)}),k.onEnd(()=>{L.pushStackElement(),A.launchChatStatus(d.EInlineChatStatus.DONE)})]),k.listen()}}}registerInlineInputFeature(S){const A=new l.Disposable,w=this.injector.get(s.AINativeContextKey,[S.contextKeyService]),T=()=>{A.dispose()};this.featureDisposable.addDispose(this.inlineInputChatService.onInteractiveInputVisibleInPosition(I=>{T(),I&&D(I,S)}));const D=(I,O)=>{this.featureDisposable.addDispose(O.onWillChangeModel(()=>{T()}));const L=O.getModel();if(!L||!O.hasTextFocus())return;const M=this.injector.get(_.InlineInputChatWidget,[O]),k=O.createDecorationsCollection();k.append([{range:m.Range.fromPositions(I),options:v.ModelDecorationOptions.register({description:u.InlineInputPreviewDecorationID,isWholeLine:!0,className:f.default.input_decoration_readable_container,inlineClassName:f.default.inline_chat_inserted_range})}]);const B=k.getRange(0);let x=p.LineRange.fromRange(B);M.show({position:B.getStartPosition()}),w.inlineInputWidgetIsVisible.set(!0),A.addDispose(M.onDispose(()=>{this.cancelToken(),k.clear(),w.inlineInputWidgetIsVisible.set(!1)})),A.addDispose(M.onResultClick(async N=>{const j=()=>{const K=k.getRange(0);L.pushStackElement(),L.pushEditOperations(null,[E.EditOperation.delete(K)],()=>null),L.pushStackElement()};switch(N){case d.EResultKind.ACCEPT:T();break;case d.EResultKind.DISCARD:j(),T();break;case d.EResultKind.REGENERATE:j(),await this.doRequestReadable(M.interactiveInputValue,M,O,A,k,T);break;default:break}})),A.addDispose(l.Event.debounce(k.onDidChange.bind(k),()=>{},l.FRAME_THREE)(()=>{if(!k.getRange(0))return;const N=k.getRange(0),j=p.LineRange.fromRange(N);x.equals(j)||(M.setOptions({position:N.getStartPosition()}),M.layoutContentWidget()),x=j})),A.addDispose(M.onInteractiveInputValue(async N=>{await this.doRequestReadable(N,M,O,A,k,T)})),A.addDispose(M)};return this.featureDisposable.addDispose(A),this.featureDisposable}};t.InlineInputController=b,b.ID="editor.contrib.ai.inline.input",t.InlineInputController=b=n=r.__decorate([(0,o.Injectable)()],b)},74353:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputChatService=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class{constructor(){this._onInteractiveInputVisibleInPosition=new o.Emitter,this.onInteractiveInputVisibleInPosition=this._onInteractiveInputVisibleInPosition.event}get currentVisiblePosition(){return this._currentVisiblePosition}setCurrentVisiblePosition(E){this._currentVisiblePosition=E}visible(){this._onInteractiveInputVisibleInPosition.fire(this._currentVisiblePosition)}hide(){this._onInteractiveInputVisibleInPosition.fire(void 0)}};t.InlineInputChatService=l,t.InlineInputChatService=l=n.__decorate([(0,r.Injectable)()],l)},76755:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffComputer=void 0;const n=e(9514),r=e(52451),o=e(37348),l=e(44781),m=e(68450),E=e(56702),p=e(89216),v=e(10438),s=e(30861),g=e(46739),c=(d,u,_=m.InfiniteTimeout.instance)=>{if(!d.length||!u.length)return m.DiffAlgorithmResult.trivial(d,u);const f=new v.Array2D(2*d.length+1,u.length+1),a=new v.Array2D(2*d.length+1,u.length+1);for(let D=0;D<=u.length;D++)f.set(0,D,D),a.set(0,D,D>0);for(let D=0;D<=2*d.length;D++)f.set(D,0,Math.floor((D+1)/2)),a.set(D,0,!1);for(let D=1;D<=u.length;D++)for(let I=1;I<=2*d.length;I++){if(!_.isValid())return m.DiffAlgorithmResult.trivialTimedOut(d,u);if(I%2===0){const O=f.get(I,D-1)+1,L=f.get(I-1,D),R=O<L;f.set(I,D,R?O:L),a.set(I,D,R)}else{const O=f.get(I-1,D)+.4,L=d.getElement(Math.floor(I/2))===u.getElement(D-1)?f.get(I-1,D-1):Number.MAX_VALUE,R=L<O;f.set(I,D,R?L:O),a.set(I,D,R)}}let b=Number.MAX_VALUE,y=-1;for(let D=0;D<=2*d.length;D++){const I=f.get(D,u.length);I<b&&(b=I,y=D)}const S=[];let A=y,w=u.length;A<=2*d.length-2&&S.push(new m.SequenceDiff(new o.OffsetRange(Math.floor((A+1)/2),d.length),new o.OffsetRange(w,w)));let T;for(;A>=0&&w>=0;)a.get(A,w)?(A%2===0?T===void 0&&(T={originalLineIndex:Math.floor(A/2),modifiedLineIndex:w}):(T!==void 0&&((T.originalLineIndex!==Math.floor(A/2)+1||T.modifiedLineIndex!==w)&&S.push(new m.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,T.originalLineIndex),new o.OffsetRange(w,T.modifiedLineIndex))),T=void 0),A-=1),w-=1):(T=T||{originalLineIndex:Math.floor((A+1)/2),modifiedLineIndex:w},A-=1);return T!==void 0&&((T.originalLineIndex!==Math.floor(A/2)+1||T.modifiedLineIndex!==w)&&S.push(new m.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,T.originalLineIndex),new o.OffsetRange(w,T.modifiedLineIndex))),T=void 0),S.reverse(),new m.DiffAlgorithmResult(S,!1)};class h extends E.DefaultLinesDiffComputer{computeDiff(u,_,f){if(u.length<=1&&(0,n.equals)(u,_,(M,k)=>M===k))return new s.LinesDiff([],[],!1);if(u.length===1&&u[0].length===0||_.length===1&&_[0].length===0)return new s.LinesDiff([new g.DetailedLineRangeMapping(new r.LineRange(1,u.length+1),new r.LineRange(1,_.length+1),[new g.RangeMapping(new l.Range(1,1,u.length,u[u.length-1].length+1),new l.Range(1,1,_.length,_[_.length-1].length+1))])],[],!1);const a=f.maxComputationTimeMs===0?m.InfiniteTimeout.instance:new m.DateTimeout(f.maxComputationTimeMs),b=new Map;function y(M){let k=b.get(M);return k===void 0&&(k=b.size,b.set(M,k)),k}const S=u.length*_.length<1e6&&f.onlyCareAboutPrefixOfOriginalLines,A=u.map(M=>y(S?M:M.trim())),w=_.map(M=>y(S?M:M.trim())),T=new p.LineSequence(A,u),D=new p.LineSequence(w,_),I=u.every(M=>M.trim().length===0);let O;S?I?O=m.DiffAlgorithmResult.trivial(T,D):O=c(T,D,a):T.length+D.length<1700?O=this.dynamicProgrammingDiffing.compute(T,D,a,(M,k)=>u[M]===_[k]?_[k].length===0?.1:1+Math.log(1+_[k].length):.99):O=this.myersDiffingAlgorithm.compute(T,D,a);const L=O.diffs,R=O.hitTimeout;if(S){const M=L.map(k=>new g.DetailedLineRangeMapping(new r.LineRange(k.seq1Range.start+1,k.seq1Range.endExclusive+1),new r.LineRange(k.seq2Range.start+1,k.seq2Range.endExclusive+1),[]));return new s.LinesDiff(M,[],R)}return super.computeDiff(u,_,f)}}t.InlineStreamDiffComputer=h},33062:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffHandler=t.EComputerMode=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(20868),m=e(60304),E=e(52451),p=e(84968),v=e(46739),s=e(87822),g=e(25539),c=e(76755),h=e(80715);var d;(function(f){f.legacy="legacy",f.default="default"})(d||(t.EComputerMode=d={}));const u=new c.InlineStreamDiffComputer;let _=class extends o.Disposable{constructor(a){super(),this.monacoEditor=a,this._onDidEditChange=this.registerDispose(new o.Emitter),this.onDidEditChange=this._onDidEditChange.event,this.rawOriginalTextLinesTokens=[],this.currentEditLine=0,this.finallyDiffModel=null,this.isEditing=!1,this.undoRedoGroup=new g.UndoRedoGroup;const b=m.StandaloneServices.get(s.IModelService);this.virtualModel=b.createModel("",null,o.Uri.from({scheme:o.Schemes.inMemory,path:"inline-stream-diff/"+(0,o.randomString)(8)}),!0),this.originalModel=this.monacoEditor.getModel(),this.livePreviewDiffDecorationModel=this.injector.get(h.LivePreviewDiffDecorationModel,[this.monacoEditor]),this.addDispose(this.livePreviewDiffDecorationModel),this.addDispose(this.virtualModel);const y=this.livePreviewDiffDecorationModel.onDispose(()=>{this.dispose(),y.dispose()})}setPreviewerOptions(a){this.previewerOptions=a,this.livePreviewDiffDecorationModel.setPreviewerOptions({partialEditWidgetOptions:{hideAcceptPartialEditWidget:a.hideAcceptPartialEditWidget},renderRemovedWidgetImmediately:a.renderRemovedWidgetImmediately})}initialize(a){const b=this.originalModel.getEOL(),y=a.getStartPosition(),S=a.getEndPosition();this.rawOriginalTextLines=this.originalModel.getValueInRange(l.Range.fromPositions(y,S)).split(b),this.rawOriginalTextLinesTokens=this.rawOriginalTextLines.map((w,T)=>{const D=y.lineNumber+T;return this.originalModel.tokenization.forceTokenization(D),this.originalModel.tokenization.getLineTokens(D)});const A=E.LineRange.fromRangeInclusive(l.Range.fromPositions({lineNumber:a.startLineNumber,column:1},{lineNumber:a.endLineNumber,column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(A)}restoreSnapshot(a){this._snapshotStore=a;const{rawOriginalTextLines:b,rawOriginalTextLinesTokens:y,undoRedoGroup:S,decorationSnapshotData:A,previewerOptions:w}=a;this.setPreviewerOptions(w),this.rawOriginalTextLines=b,this.rawOriginalTextLinesTokens=y,this.undoRedoGroup=S,this.livePreviewDiffDecorationModel.initialize(A.zone)}get currentSnapshotStore(){return this._snapshotStore}restoreDecorationSnapshot(a){this.livePreviewDiffDecorationModel.restoreSnapshot(a)}createSnapshot(){return{rawOriginalTextLines:this.rawOriginalTextLines,rawOriginalTextLinesTokens:this.rawOriginalTextLinesTokens,undoRedoGroup:this.undoRedoGroup,decorationSnapshotData:this.livePreviewDiffDecorationModel.createSnapshot(),previewerOptions:this.previewerOptions}}getVirtualModelValue(){return this.virtualModel.getValue()}getOriginModelValue(){return this.rawOriginalTextLines.join(`
28269
28270
  `)}get onPartialEditWidgetListChange(){return this.livePreviewDiffDecorationModel.onPartialEditWidgetListChange}computeDiff(a,b,y=d.default){const S=(y===d.default?u:p.linesDiffComputers.getLegacy()).computeDiff(a,b,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1,onlyCareAboutPrefixOfOriginalLines:!0});let A=S.changes;S.hitTimeout&&(A=[new v.DetailedLineRangeMapping(new E.LineRange(1,a.length+1),new E.LineRange(1,b.length+1),void 0)]);const w=[];let T=[];for(const L of A)if(L.modified.endLineNumberExclusive===b.length+1&&y===d.default){if(T=a.slice(L.original.startLineNumber-1,L.original.endLineNumberExclusive-1),L.modified.isEmpty)continue;w.push({removedTextLines:[],removedLinesOriginalRange:new E.LineRange(L.original.startLineNumber,L.original.startLineNumber),addedRange:L.modified,relativeInnerChanges:void 0})}else w.push({removedTextLines:a.slice(L.original.startLineNumber-1,L.original.endLineNumberExclusive-1),removedLinesOriginalRange:L.original,addedRange:L.modified,relativeInnerChanges:L.innerChanges?L.innerChanges.map(R=>({originalRange:R.originalRange.delta(-L.original.startLineNumber+1),modifiedRange:R.modifiedRange.delta(-L.modified.startLineNumber+1)})):void 0});const D=[...b,...T];let I=0,O=new E.LineRange(1,1);return T.length>0&&(I=b.length+1,O=new E.LineRange(b.length+1,b.length+1+T.length)),{changes:w,newFullRangeTextLines:D,activeLine:I,pendingRange:O}}calculateAddedDecorationCollectionState(a){const b=this.getZone();return a.changes.map(S=>{const A=S.addedRange,w={lineNumber:b.startLineNumber+A.startLineNumber-1,column:1},T={lineNumber:b.startLineNumber+A.endLineNumberExclusive-2,column:1};return{startPosition:w,endPosition:T,len:A.endLineNumberExclusive-A.startLineNumber}})}renderPartialEditWidgets(a){const b=this.calculateAddedDecorationCollectionState(a);this.livePreviewDiffDecorationModel.touchPartialEditWidgets(b.map(y=>y.startPosition.lineNumber))}renderAddedRangeDecoration(a){const b=this.calculateAddedDecorationCollectionState(a);this.livePreviewDiffDecorationModel.touchAddedRange(b)}renderRemovedRangeDecoration(a){const{changes:b}=a,y=this.getZone();let S=0;const A=[];for(const w of b){const{removedTextLines:T,removedLinesOriginalRange:D,addedRange:I}=w;T.length>0&&A.push({position:{column:1,lineNumber:y.startLineNumber+D.startLineNumber-2-S},textLines:T.map((O,L)=>({text:O,lineTokens:this.rawOriginalTextLinesTokens[D.startLineNumber-1+L]}))}),S+=D.length-I.length}this.livePreviewDiffDecorationModel.touchRemovedWidget(A)}pushStackElement(){const a=this.livePreviewDiffDecorationModel.createEditStackElement(this.undoRedoGroup);a.attachModel(this.livePreviewDiffDecorationModel),a.registerUndo(b=>{b.dispose()})}handleEdits(a){const{activeLine:b,newFullRangeTextLines:y,pendingRange:S}=a,A=this.originalModel.getEOL(),w=this.getZone(),T=w.startLineNumber<w.endLineNumberExclusive?new l.Range(w.startLineNumber,1,w.endLineNumberExclusive-1,this.originalModel.getLineMaxColumn(w.endLineNumberExclusive-1)):new l.Range(w.startLineNumber,1,w.startLineNumber,1),D=this.originalModel.getValueInRange(T).split(A),I=p.linesDiffComputers.getDefault().computeDiff(D,y,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1}),O=[];if(I.hitTimeout){let L=y.join(A);T.isEmpty()&&(L+=A);const R={range:T,text:L,forceMoveMarkers:!1};O.push(R)}else for(const L of I.changes){let R=y.slice(L.modified.startLineNumber-1,L.modified.endLineNumberExclusive-1).join(A),M;L.original.isEmpty?(M=new l.Range(T.startLineNumber+L.original.startLineNumber-1,1,T.startLineNumber+L.original.startLineNumber-1,1),R+=A):L.modified.isEmpty?(M=new l.Range(T.startLineNumber+L.original.startLineNumber-1,1,T.startLineNumber+L.original.endLineNumberExclusive-1,1),R=null):M=new l.Range(T.startLineNumber+L.original.startLineNumber-1,1,T.startLineNumber+L.original.endLineNumberExclusive-2,this.originalModel.getLineMaxColumn(T.startLineNumber+L.original.endLineNumberExclusive-2));const k={range:M,text:R,forceMoveMarkers:!1};O.push(k)}this.originalModel.pushEditOperations(null,O,()=>null,this.undoRedoGroup),this.livePreviewDiffDecorationModel.updateZone(new E.LineRange(w.startLineNumber,w.startLineNumber+y.length)),b>0?this.livePreviewDiffDecorationModel.touchActiveLine(b):this.livePreviewDiffDecorationModel.clearActiveLine(),this.renderAddedRangeDecoration(a),S.length>0?this.livePreviewDiffDecorationModel.touchPendingRange(S):this.livePreviewDiffDecorationModel.clearPendingLine(),this.renderRemovedRangeDecoration(a),this._onDidEditChange.fire()}recompute(a,b){b&&this.virtualModel.setValue(b);const y=this.virtualModel.getLinesContent();return this.computeDiff(this.rawOriginalTextLines,y,a)}async rateEditController(){if(this.isEditing===!1){for(this.isEditing=!0;this.currentEditLine<=this.virtualModel.getLinesContent().length;){if(this.disposed)return;const b=this.virtualModel.getLinesContent().slice(0,this.currentEditLine),y=this.computeDiff(this.rawOriginalTextLines,b);this.handleEdits(y),this.currentEditLine+=1,await(0,o.sleep)(o.FRAME_THREE)}this.finallyDiffModel&&this.finallyRender(this.finallyDiffModel),this.isEditing=!1}}addLinesToDiff(a,b=d.default){this.recompute(b,a),this.rateEditController()}pushRateFinallyDiffStack(a){this.finallyDiffModel=a,this.isEditing===!1&&this.finallyRender(this.finallyDiffModel)}finallyRender(a){this.renderPartialEditWidgets(a),this.handleEdits(a),this.pushStackElement(),this.monacoEditor.focus()}acceptAll(){this.livePreviewDiffDecorationModel.acceptUnProcessed(),this.dispose()}rejectAll(){this.livePreviewDiffDecorationModel.discardUnProcessed(),this.dispose()}revealFirstDiff(){this.livePreviewDiffDecorationModel.revealFirstDiff()}getZone(){return this.livePreviewDiffDecorationModel.getZone()}getTotalCodeInfo(){return this.livePreviewDiffDecorationModel.getTotalCodeInfo()}};t.InlineStreamDiffHandler=_,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],_.prototype,"injector",void 0),t.InlineStreamDiffHandler=_=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],_)},22169:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffService=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class{constructor(){this._onAcceptDiscardPartialEdit=new o.Emitter,this.onAcceptDiscardPartialEdit=this._onAcceptDiscardPartialEdit.event}launchAcceptDiscardPartialEdit(E){this._onAcceptDiscardPartialEdit.fire(E)}};t.InlineStreamDiffService=l,t.InlineStreamDiffService=l=n.__decorate([(0,r.Injectable)()],l)},54362:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LivePreviewUndoRedoStackElement=void 0;const n=e(25539);class r{get type(){return n.UndoRedoElementType.Resource}get label(){return"Live.Preview.UndoRedo"}get code(){return"Live.Preview.UndoRedo"}get resource(){return this.model.uri}constructor(l){this.model=l,this.confirmBeforeUndo=!1}attachModel(l){this.decorationModel=l}registerUndo(l){this._undo=l}undo(){var l;(l=this._undo)===null||l===void 0||l.call(this,this.decorationModel)}registerRedo(l){this._redo=l}redo(){var l;(l=this._redo)===null||l===void 0||l.call(this,this.decorationModel)}}t.LivePreviewUndoRedoStackElement=r},8106:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.RemovedZoneWidget=t.AcceptPartialEditWidget=t.EPartialEdit=t.PendingRangeDecoration=t.AddedRangeDecoration=t.ActiveLineDecoration=void 0;const r=e(85608),o=r.__importDefault(e(53373)),l=r.__importStar(e(14041)),m=r.__importDefault(e(25873)),E=e(76003),p=e(41869),v=e(57925),s=e(43718),g=e(52659),c=e(90052),h=e(31324),d=e(34819),u=e(24522),_=r.__importDefault(e(71749));t.ActiveLineDecoration="activeLine-decoration",t.AddedRangeDecoration="added-range-decoration",t.PendingRangeDecoration="pending-range-decoration";var f;(function(A){A.accept="accept",A.discard="discard"})(f||(t.EPartialEdit=f={}));const a=A=>{const{keyStrings:w,onAccept:T,onDiscard:D,editor:I}=A,[O,L]=l.default.useState(0),R=(0,l.useCallback)(()=>{T?.()},[T]),M=(0,l.useCallback)(()=>{D?.()},[D]);return(0,p.useDisposable)(()=>I.onDidScrollChange(k=>{const{scrollLeftChanged:B,scrollLeft:x}=k;B&&L(x)}),[I]),l.default.createElement("div",{className:(0,o.default)("kt-inline-diff-accept-partial-widget-container",_.default.inline_diff_accept_partial_widget_container),style:{marginLeft:O}},l.default.createElement("div",{className:_.default.content},l.default.createElement("span",{className:(0,o.default)(_.default.accept_btn,_.default.btn),onClick:R},(0,s.localize)("aiNative.inline.diff.accept"),l.default.createElement("span",null,w.acceptSequence)),l.default.createElement("span",{className:(0,o.default)(_.default.discard_btn,_.default.btn),onClick:M},(0,s.localize)("aiNative.inline.diff.reject"),l.default.createElement("span",null,w.discardSequence))))};let b=n=class extends g.ReactInlineContentWidget{constructor(w,T){super(w),this.editor=w,this.editWidgetOptions=T,this._onAccept=this.registerDispose(new s.Emitter),this.onAccept=this._onAccept.event,this._onDiscard=this.registerDispose(new s.Emitter),this.onDiscard=this._onDiscard.event,this.positionPreference=[c.ContentWidgetPositionPreference.EXACT],this.addedLinesCount=0,this.deletedLinesCount=0,this.status="pending"}get group(){return this._group}getSequenceKeyStrings(){let w=this.keybindingRegistry.getKeybindingsForCommand(v.AI_INLINE_DIFF_PARTIAL_EDIT.id);if(w=w.sort((T,D)=>D.args-T.args),!(!w||w.length!==2&&w.some(T=>(0,s.isUndefined)(T.resolved))))return{acceptSequence:this.keybindingRegistry.acceleratorForSequence(w[0].resolved,"")[0],discardSequence:this.keybindingRegistry.acceleratorForSequence(w[1].resolved,"")[0]}}renderView(){var w;if(!((w=this.editWidgetOptions)===null||w===void 0)&&w.hideAcceptPartialEditWidget)return;const T=this.getSequenceKeyStrings();if(T)return l.default.createElement(a,{keyStrings:T,onAccept:()=>this._onAccept.fire(),onDiscard:()=>this._onDiscard.fire(),editor:this.editor})}id(){return this._id||(this._id=`${n.ID}_${(0,s.uuid)(4)}`),this._id}getClassName(){return _.default.accept_partial_edit_widget_id}recordDecorationId(w){this._decorationId=w}getDecorationId(){return this._decorationId}resume(){this.status="pending",this.addedLinesCount=0,this.deletedLinesCount=0,super.resume()}setGroup(w){this._group=w}get isPending(){return this.status==="pending"}accept(w,T){this.status="accept",this.addedLinesCount=w,this.deletedLinesCount=T,super.hide()}get isAccepted(){return this.status==="accept"}discard(w,T){this.status="discard",this.addedLinesCount=w,this.deletedLinesCount=T,super.hide()}get isRejected(){return this.status==="discard"}};t.AcceptPartialEditWidget=b,b.ID="AcceptPartialEditWidgetID",r.__decorate([(0,E.Autowired)(p.KeybindingRegistry),r.__metadata("design:type",Object)],b.prototype,"keybindingRegistry",void 0),t.AcceptPartialEditWidget=b=n=r.__decorate([(0,E.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object,Object])],b);const y=({dom:A,editor:w})=>{const T=l.default.useRef(null),[D,I]=l.default.useState(0),[O,L]=l.default.useState(0);return(0,l.useEffect)(()=>{A&&T&&T.current&&T.current.appendChild(A)},[A,T]),(0,p.useDisposable)(()=>w.onDidScrollChange(R=>{const{scrollLeftChanged:M,scrollLeft:k}=R;M&&I(k)}),[w]),(0,p.useDisposable)(()=>(L(w.getOption(h.EditorOption.layoutInfo).contentLeft),w.onDidChangeConfiguration(R=>{R.hasChanged(h.EditorOption.layoutInfo)&&L(w.getOption(h.EditorOption.layoutInfo).contentLeft)})),[w]),l.default.createElement("div",{className:_.default.inline_diff_remove_zone_fixed_box,style:{marginLeft:O+"px"}},l.default.createElement("div",{className:_.default.inline_diff_remove_zone,ref:T,style:{marginLeft:-D+"px"}}))};class S extends d.ZoneWidget{get isHidden(){return this._hidden}get group(){return this._group}constructor(w,T,D){super(w,D),this.textLines=T,this._hidden=!1,(0,s.isDefined)(D.isHidden)&&(this._hidden=D.isHidden),(0,s.isDefined)(D.recordPosition)&&(this._recordPosition=D.recordPosition),(0,s.isDefined)(D.undoRedoGroup)&&(this._group=D.undoRedoGroup);const I=this._positionMarkerId;this._disposables.add(I.onDidChange(O=>{const L=I.getRange(0);L&&(this._recordPosition=L.getStartPosition())}))}setGroup(w){this._group=w}_fillContainer(w){w.classList.add(_.default.inline_diff_remove_zone_widget_container),this.root=m.default.createRoot(w)}getRemovedTextLines(){return this.textLines.map(w=>w.text)}get height(){return this.textLines.length}getLastPosition(){return this.position||this._recordPosition}hide(){this._hidden=!0,super.hide()}resume(){const w=this.getLastPosition();w&&this.show(w,this.height)}show(w,T){this._hidden=!1,super.show(w,T)}revealRange(){}create(){super.create(),this.mountRender()}mountRender(){const w=document.createElement("div");(0,u.renderLines)(w,this.editor.getOption(h.EditorOption.tabIndex),this.textLines.map(({text:T,lineTokens:D})=>({content:T,decorations:[],lineTokens:D})),this.editor.getOptions()),this.root.render(l.default.createElement(y,{dom:w,editor:this.editor}))}dispose(){this.root.unmount(),super.dispose()}}t.RemovedZoneWidget=S},80715:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LivePreviewDiffDecorationModel=void 0;const r=e(85608),o=e(76003),l=e(41869),m=e(43718),E=e(20868),p=e(60304),v=e(2261),s=e(74547),g=e(25539),c=e(77659),h=e(53617),d=e(15989),u=r.__importDefault(e(71749)),_=e(22169),f=e(54362),a=e(8106);let b=n=class extends m.Disposable{constructor(S){super(),this.monacoEditor=S,this._onPartialEditWidgetListChange=this.registerDispose(new m.Emitter),this.onPartialEditWidgetListChange=this._onPartialEditWidgetListChange.event,this.options={partialEditWidgetOptions:{}},this.partialEditWidgetList=[],this.removedZoneWidgets=[],this.model=this.monacoEditor.getModel(),this.undoRedoService=p.StandaloneServices.get(g.IUndoRedoService),this.activeLineDec=this.monacoEditor.createDecorationsCollection(),this.pendingRangeDec=this.monacoEditor.createDecorationsCollection(),this.aiNativeContextKey=this.injector.get(c.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.addDispose(this.inlineStreamDiffService.onAcceptDiscardPartialEdit(A=>{const w=this.monacoEditor.getPosition(),T=this.partialEditWidgetList.filter(D=>!D.isHidden).sort((D,I)=>{var O,L,R,M;const k=((L=(O=D.getPosition())===null||O===void 0?void 0:O.position)===null||L===void 0?void 0:L.lineNumber)||1,B=((M=(R=I.getPosition())===null||R===void 0?void 0:R.position)===null||M===void 0?void 0:M.lineNumber)||1,x=Math.abs(w.lineNumber-k),N=Math.abs(w.lineNumber-B);return x-N});T.length>0&&this.handlePartialEditAction(A?a.EPartialEdit.accept:a.EPartialEdit.discard,T[0])})),this.addedRangeDec=new h.EnhanceDecorationsCollection(this.monacoEditor),this.addDispose(this.addedRangeDec.onDidDecorationsChange(A=>{this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.get()&&this.partialEditWidgetList.forEach(T=>{const D=A.find(I=>T.getDecorationId()===I.id);if(D){const I=D.getRange();T.setOptions({position:{lineNumber:I.startLineNumber,column:1}}),T.layoutContentWidget()}})})),this.addDispose(m.Disposable.create(()=>{this.clear()}))}clear(){this.clearPendingLine(),this.clearActiveLine(),this.clearAddedLine(),this.clearRemovedWidgets(),this.clearPartialEditWidgetList()}initialize(S){this.updateZone(S)}getRemovedWidgets(){return this.removedZoneWidgets}restoreSnapshot(S){const{addedDecList:A,removedWidgetList:w,zone:T,editStackSnapshot:D,partialEditWidgetList:I}=S;this.updateZone(T),this.addedRangeDec.set(A),this.clearRemovedWidgets(),w.forEach(R=>{const M=R.getLastPosition();M&&this.showRemovedWidgetByLineNumber(M.lineNumber,R.textLines,{isHidden:R.isHidden,recordPosition:R.getLastPosition(),undoRedoGroup:R.group})}),this.clearPartialEditWidgetList(),I.forEach(R=>{var M,k;const B=(k=(M=R.getPosition())===null||M===void 0?void 0:M.position)===null||k===void 0?void 0:k.lineNumber;if(B){const x=this.createPartialEditWidget(B);R.status==="accept"?x.accept(R.addedLinesCount,R.deletedLinesCount):R.status==="discard"&&x.discard(R.addedLinesCount,R.deletedLinesCount),x.setGroup(R.group),this.partialEditWidgetList.push(x)}}),this.firePartialEditWidgetList(),this.recordPartialEditWidgetWithAddedDec();const O=this.model.uri;this.undoRedoService.restoreSnapshot(D);const L=this.undoRedoService.getElements(O);L.future.concat(L.past).forEach(R=>{R instanceof f.LivePreviewUndoRedoStackElement&&R.attachModel(this)})}createSnapshot(){return{addedDecList:this.addedRangeDec.getDecorations(),partialEditWidgetList:this.partialEditWidgetList,removedWidgetList:this.removedZoneWidgets,editStackSnapshot:this.undoRedoService.createSnapshot(this.model.uri),zone:this.zone}}showRemovedWidgetByLineNumber(S,A,w){const T=new E.Position(S,1),D=A.length,I=new a.RemovedZoneWidget(this.monacoEditor,A,{...w,showInHiddenAreas:!0,showFrame:!1,showArrow:!1});I.create(),this.removedZoneWidgets.push(I),w.isHidden?I.hide():I.show(T,D)}updateZone(S){this.zone=S}getZone(){return this.zone}touchActiveLine(S){const A=this.getZone();this.activeLineDec.set([{range:E.Range.fromPositions({lineNumber:A.startLineNumber+S-1,column:0}),options:s.ModelDecorationOptions.register({description:a.ActiveLineDecoration,isWholeLine:!0,className:u.default.inline_diff_current,zIndex:l.StackingLevel.Workbench})}])}doDiscardPartialWidget(S,A,w){let T=null,D=0,I=0;if(A&&A.length>0){const O=A.getRange();T=v.EditOperation.delete(E.Range.lift({startLineNumber:O.startLineNumber,startColumn:O.startColumn,endLineNumber:O.endLineNumber+1,endColumn:1})),D=A.length,A.hide()}if(w){const O=w.getLastPosition(),L=this.model.getEOL(),R=w.getRemovedTextLines();I=R.length;const M=R.join(L)+L;T?T=v.EditOperation.replace(E.Range.lift(T.range),M):T=v.EditOperation.insert(O.delta(1),M),w.hide()}return S.discard(D,I),T}handlePartialEditAction(S,A,w=!0,T=!1){const D=A.getPosition().position,I=this.aiReporter.getRelationId(),O=this.model,L=this.removedZoneWidgets.find(Y=>Y.getLastPosition().lineNumber===Math.max(1,D.lineNumber-1)),R=this.addedRangeDec.getDecorationByLineNumber(D.lineNumber),M=R?.length||0,k=L?.height||0,B=new g.UndoRedoGroup;A.setGroup(B),L?.setGroup(B),R?.setGroup(B);const x=Y=>Y.partialEditWidgetList.find(H=>H.group===B),N=Y=>Y.removedZoneWidgets.find(H=>H.group===B),j=Y=>Y.addedRangeDec.getDecorationByGroup(B);let K;const U=L?.getRemovedTextLines().join(`
28270
28271
  `)||"",X=R?.getRange();X&&(K=O.getValueInRange({...X,endColumn:O.getLineMaxColumn(X.endLineNumber)}));const z=Y=>{T&&this.aiReporter.end(I,{message:"discard",success:!0,isDrop:!0,code:K,originCode:U,actionSource:m.ActionSourceEnum.InlineChat,actionType:m.ActionTypeEnum.LineDiscard});const H=N(Y);H?.hide();const $=j(Y);$?.hide();const Z=x(Y);return this.doDiscardPartialWidget(Z,$,H)},Q=Y=>{T&&this.aiReporter.end(I,{message:"accept",success:!0,isReceive:!0,code:K,originCode:U,actionSource:m.ActionSourceEnum.InlineChat,actionType:m.ActionTypeEnum.lineAccept});const H=x(Y);H?.accept(M,k);const $=N(Y);$?.hide();const Z=j(Y);Z?.hide()},G=Y=>{const H=x(Y);H?.resume();const $=N(Y);$?.resume();const Z=j(Y);Z?.resume()};switch(S){case a.EPartialEdit.accept:if(Q(this),w){const Y=this.createEditStackElement(B);Y.attachModel(this),Y.registerUndo(H=>{G(H)}),Y.registerRedo(H=>{Q(H)})}break;case a.EPartialEdit.discard:{const Y=z(this);if(Y){if(w){const H=this.createEditStackElement(B);H.attachModel(this),H.registerUndo($=>{G($)}),H.registerRedo($=>{z($)})}O.pushStackElement(),O.pushEditOperations(null,[Y],()=>null,B),O.pushStackElement()}}break;default:break}const J={uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter(Y=>Y.isHidden).length,currentPartialEdit:{addedLinesCount:M,deletedLinesCount:k,type:S},...this.getTotalCodeInfo()};this.monacoEditor.focus(),this.inlineDiffService.firePartialEdit(J),this.firePartialEditWidgetList()}firePartialEditWidgetList(){this._onPartialEditWidgetListChange.fire(this.partialEditWidgetList);const S=this.partialEditWidgetList.filter(A=>!A.isHidden);this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(S.length!==0)}createEditStackElement(S){const A=new f.LivePreviewUndoRedoStackElement(this.model);return this.undoRedoService.pushElement(A,S),A}static computeCodeInfo(S,A,w){const T=I(S),D={added:0,deleted:0,changed:0};return S.forEach((O,L)=>{if(O.status==="pending"){const R=A[L],M=w[L],k=R?.length||0,B=M?.height||0;D.added+=k,D.deleted+=B,D.changed+=Math.max(k,B)}}),{totalAddedLinesCount:T.added,totalDeletedLinesCount:T.deleted,totalChangedLinesCount:T.changed,unresolvedAddedLinesCount:D.added,unresolvedDeletedLinesCount:D.deleted,unresolvedChangedLinesCount:D.changed};function I(O){const L={added:0,deleted:0,changed:0};return O.forEach(R=>{const M=R.addedLinesCount,k=R.deletedLinesCount;L.added+=M,L.deleted+=k,L.changed+=Math.max(M,k)}),L}}getTotalCodeInfo(){const S=this.partialEditWidgetList,A=this.addedRangeDec.getDecorations(),w=this.removedZoneWidgets;return n.computeCodeInfo(S,A,w)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(S=>{var A,w;const T=(w=(A=S.getPosition())===null||A===void 0?void 0:A.position)===null||w===void 0?void 0:w.lineNumber;if(T){const D=this.addedRangeDec.getDecorationByLineNumber(T);D&&S.recordDecorationId(D.id)}})}acceptUnProcessed(){this.partialEditWidgetList.filter(A=>!A.isHidden).forEach(A=>{this.handlePartialEditAction(a.EPartialEdit.accept,A,!1)})}discardUnProcessed(){this.partialEditWidgetList.filter(A=>!A.isHidden).forEach(A=>{this.handlePartialEditAction(a.EPartialEdit.discard,A,!1)})}createPartialEditWidget(S){const A=this.injector.get(a.AcceptPartialEditWidget,[this.monacoEditor,this.options.partialEditWidgetOptions]);A.show({position:{lineNumber:S,column:1}});const w=A.onDispose(()=>{const T=A.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(D=>D.getId()!==T),w.dispose()});return A.addDispose([A.onAccept(()=>{this.handlePartialEditAction(a.EPartialEdit.accept,A,!0,!0)}),A.onDiscard(()=>{this.handlePartialEditAction(a.EPartialEdit.discard,A,!0,!0)})]),A}touchPartialEditWidgets(S){this.clearPartialEditWidgetList(),this.partialEditWidgetList=S.map(A=>this.createPartialEditWidget(A)),this.firePartialEditWidgetList()}touchAddedRange(S){this.addedRangeDec.set(S.map(A=>{const w=A.startPosition,T=A.endPosition,D=A.len;let I=E.Range.fromPositions(w,T),O=u.default.inline_diff_added_range+" ";return D===0&&(I=E.Range.fromPositions(w),O+=u.default.hide),{length:D,range:I,isHidden:D===0,options:s.ModelDecorationOptions.register({description:a.AddedRangeDecoration,isWholeLine:!0,className:O})}})),this.recordPartialEditWidgetWithAddedDec()}touchRemovedWidget(S){const A=()=>{this.clearRemovedWidgets(),S.forEach(({textLines:w,position:T})=>{this.showRemovedWidgetByLineNumber(T.lineNumber,w,{})})};this.options.renderRemovedWidgetImmediately?A():(0,m.runWhenIdle)(A)}touchPendingRange(S){const A=this.getZone();this.pendingRangeDec.set([{range:E.Range.fromPositions({lineNumber:A.startLineNumber+S.startLineNumber-1,column:0},{lineNumber:A.startLineNumber+S.endLineNumberExclusive-2,column:Number.MAX_SAFE_INTEGER}),options:s.ModelDecorationOptions.register({description:a.PendingRangeDecoration,isWholeLine:!0,className:u.default.inline_diff_pending_range})}])}clearPendingLine(){this.pendingRangeDec.clear()}clearActiveLine(){this.activeLineDec.clear()}clearAddedLine(){this.addedRangeDec.clear()}clearPartialEditWidgetList(){this.partialEditWidgetList.forEach(S=>{S.dispose()}),this.partialEditWidgetList=[],this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(!1)}clearRemovedWidgets(){this.removedZoneWidgets.forEach(S=>{S.dispose()}),this.removedZoneWidgets=[]}revealFirstDiff(){const S=this.removedZoneWidgets[0];if(S){const A=S.getLastPosition();A&&this.monacoEditor.revealLineInCenterIfOutsideViewport(A.lineNumber)}}setPreviewerOptions(S){this.options=S}};t.LivePreviewDiffDecorationModel=b,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(m.IAIReporter),r.__metadata("design:type",Object)],b.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(_.InlineStreamDiffService),r.__metadata("design:type",_.InlineStreamDiffService)],b.prototype,"inlineStreamDiffService",void 0),r.__decorate([(0,o.Autowired)(d.InlineDiffService),r.__metadata("design:type",d.InlineDiffService)],b.prototype,"inlineDiffService",void 0),t.LivePreviewDiffDecorationModel=b=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],b)},19520:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputPreviewDecorationID=void 0,t.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SumiLightBulbWidget=void 0;const n=e(41869),r=e(3908),o=e(19202);class l extends o.LightBulbWidget{_updateLightBulbTitleAndIcon(){super._updateLightBulbTitleAndIcon();const E=super.state;if(E.type!==1)return;let p=super.icon;(E.actions.allAIFixes||E.actions.hasAutoFix&&E.actions.hasAIFix||E.actions.hasAIFix)&&(p=r.Sumicon.magicWand),p&&(this.getDomNode().classList.remove(...this._iconClasses),this.getDomNode().classList.add(...(0,n.asClassNameArrayWrapper)(p)))}}t.SumiLightBulbWidget=l},8191:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RewriteWidget=t.REWRITE_DECORATION_INLINE_ADD=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=n.__importDefault(e(25873)),m=e(76003),E=e(41869),p=n.__importStar(e(20868)),v=e(52659),s=e(90052),g=e(77714),c=e(2261),h=e(87822),d=e(90626),u=n.__importDefault(e(32518)),_={fixedOverflowWidgets:!0,readOnly:!0,domReadOnly:!0,lineNumbers:"off",glyphMargin:!1,scrollBeyondLastLine:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,scrollbar:{horizontal:"hidden",vertical:"hidden",horizontalScrollbarSize:0,verticalScrollbarSize:0,arrowSize:0,verticalSliderSize:0,horizontalSliderSize:0,ignoreHorizontalScrollbarInContentHeight:!0},hover:{enabled:!1},guides:{indentation:!1}};t.REWRITE_DECORATION_INLINE_ADD="rewrite-decoration-inline-add";const f=o.default.memo(b=>{const{editor:y,onReady:S}=b,A=(0,E.useInjectable)(E.MonacoService),w=(0,o.useRef)(null),T=(0,o.useRef)(null),[D,I]=(0,o.useState)(null),[O,L]=(0,o.useState)(0),[R,M]=(0,o.useState)(null),k=(0,o.useCallback)((j,K,U)=>{const X=y.getModel().getEOL();let z=K.startLineNumber,Q=K.startColumn;const G=j.getModel();j.changeDecorations(ce=>{if(j){G.getAllDecorations().map(ge=>ge.id).forEach(ge=>ce.removeDecoration(ge));for(const ge of U){if(ge.removed)continue;const Ae=ge.value.split(X);for(let te=0;te<Ae.length;te++){const Pe=Ae[te];te!==0&&(z++,Q=1),ge.added&&ce.addDecoration(new p.Range(z,Q,z,Q+Pe.length),{description:t.REWRITE_DECORATION_INLINE_ADD,className:u.default.ghost_text_decoration_inline_add}),Q+=Pe.length}}}});const J=j.getOption(p.editor.EditorOption.lineHeight);j?.setScrollTop(Math.max(K.startLineNumber-1,0)*J);const Y=z-K.startLineNumber,H=j.getOption(p.editor.EditorOption.fontInfo).spaceWidth,$=j.getOption(p.editor.EditorOption.layoutInfo).contentLeft;let Z=0;const re=G.getOptions().tabSize;Array.from({length:Y+1},(ce,ge)=>K.startLineNumber+ge).forEach(ce=>{const ge=G.getLineContent(ce);let Ae=0;for(const te of ge)te===g.space?Ae+=re:Ae+=1,Z=Math.max(Z,Ae)}),I({width:Z*H+$*2,height:J*(Y+1)})},[D,y]);(0,o.useEffect)(()=>{if(y.getModel())return S&&S({getVirtualEditor:()=>R,renderVirtualEditor:(K,U,X)=>B(K,U,X),renderTextLineThrough:K=>x(K),layout:K=>N(K)}),()=>{R&&R.dispose(),T.current&&(0,E.runWhenIdle)(()=>{var K;(K=T.current)===null||K===void 0||K.unmount(),T.current=null})}},[y,S,R]);const B=(0,o.useCallback)((j,K,U)=>{if(!w.current)return;const X=y.getModel();if(!X)return;let z=R;if(!z){z=A.createCodeEditor(w.current,_);const Q=d.StandaloneServices.get(h.IModelService),G={languageId:X.getLanguageId(),onDidChange:E.Event.None},J=Q.createModel("",G);z.setModel(J),M(z)}z.setValue(j),k(z,K,U)},[w,R]),x=(0,o.useCallback)(j=>{if(!w.current)return;R&&(R.dispose(),M(null));const K=({changes:U})=>{const X=y.getOption(p.editor.EditorOption.lineHeight),z=y.getOption(p.editor.EditorOption.fontInfo).spaceWidth,Q=(J,Y=u.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,r.default)(u.default.space_span,Y),style:{width:`${z*J}px`}},g.space.repeat(J)),G=(J,Y)=>o.default.createElement("span",{className:(0,r.default)(u.default.text_span,Y)},J);return o.default.createElement(o.default.Fragment,null,U.map((J,Y)=>{let H=!0,$="",Z=0;const re=[];for(const ce of J){const{value:ge,added:Ae,removed:te}=ce;if(te)$+=ge;else{H=!1,Z+=ge.length;const Pe=ge.length-ge.trimStart().length,Te=ge.length-ge.trimEnd().length,ie=ge.trim();re.push(Q(Pe)),ie&&(re.push(G(ie,Ae?u.default.ghost_text_decoration_inline_add:u.default.ghost_text_decoration)),re.push(Q(Te)))}}if(H){const ce=$.length-$.trimStart().length,ge=$.length-$.trimEnd().length,Ae=$.trim();re.push(Q(ce,u.default.ghost_text_decoration_remove)),Ae&&(re.push(G(Ae,u.default.ghost_text_decoration_inline_remove)),re.push(Q(ge,u.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:Y,className:u.default.deletions_code_line,style:{height:`${X}px`}},re)}))};T.current&&(T.current.unmount(),T.current=null),T.current=l.default.createRoot(w.current),T.current.render(o.default.createElement(o.default.Fragment,null,j.map((U,X)=>o.default.createElement(K,{key:X,changes:U.changes}))))},[y,w,R,T]),N=(0,o.useCallback)(j=>{const K=y.getOption(p.editor.EditorOption.fontInfo).spaceWidth;let U=0;for(let X=j.startLineNumber;X<=j.endLineNumber;X++){const z=y.getModel().getLineMaxColumn(X);U=Math.max(U,z)}L(U*K+10)},[y]);return o.default.createElement("div",{className:u.default.rewrite_widget_container,style:{width:D?.width,height:D?.height,marginLeft:O}},o.default.createElement("div",{className:u.default.virtual_editor_container,ref:w}))});let a=class extends v.ReactInlineContentWidget{constructor(){super(...arguments),this.virtualEditorHandler=null,this.positionPreference=[s.ContentWidgetPositionPreference.EXACT],this.defered=new E.Deferred,this.updateFontStyle=()=>{const y=this.editor.getOption(p.editor.EditorOption.fontInfo);this.domNode.style.fontFamily=y.fontFamily,this.domNode.style.fontSize=y.fontSize+"px"}}renderView(){return this.updateFontStyle(),o.default.createElement(f,{editor:this.editor,onReady:y=>{this.defered.resolve(),this.virtualEditorHandler=y}})}id(){return"RewriteWidget"}show(y){const{position:S}=y;if(!S)return;const{lineNumber:A}=S;super.show({position:p.Position.lift({lineNumber:A,column:1})})}setInsertText(y){this.insertText=y}setEditArea(y){this.editArea=y}getEditArea(){return this.editArea}getVirtualEditor(){var y,S;return(S=(y=this.virtualEditorHandler)===null||y===void 0?void 0:y.getVirtualEditor())!==null&&S!==void 0?S:null}renderTextLineThrough(y){var S,A;(S=this.virtualEditorHandler)===null||S===void 0||S.renderTextLineThrough(y),(A=this.virtualEditorHandler)===null||A===void 0||A.layout(this.editArea)}renderVirtualEditor(y,S){this.virtualEditorHandler.renderVirtualEditor(y,this.editArea,S),this.virtualEditorHandler.layout(this.editArea)}accept(){(0,E.isUndefined)(this.insertText)||(this.editor.pushUndoStop(),this.editor.getModel().pushEditOperations(null,[c.EditOperation.replace(p.Range.lift(this.editArea),this.insertText)],()=>null))}};t.RewriteWidget=a,t.RewriteWidget=a=n.__decorate([(0,m.Injectable)({multiple:!0})],a)},19413:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IAIInlineCompletionsProvider=t.EResultKind=t.EInlineChatStatus=t.ChatProxyServiceToken=t.IChatAgentService=t.IChatManagerService=t.IChatInternalService=t.ChatCompletionRequestMessageRoleEnum=t.AT_SIGN_SYMBOL=t.SLASH_SYMBOL=t.AI_MENUBAR_CONTAINER_VIEW_ID=t.AI_MENU_BAR_DEBUG_TOOLBAR=t.AI_CHAT_LOGO_AVATAR_ID=t.AI_CHAT_CONTAINER_ID=t.AI_CHAT_VIEW_ID=t.AIInlineChatContentWidget=t.IAINativeService=void 0;const n=e(43718),r=e(66338);t.IAINativeService=Symbol("IAINativeService"),t.AIInlineChatContentWidget=n.AIInlineChatContentWidgetId,t.AI_CHAT_VIEW_ID="AI-Chat",t.AI_CHAT_CONTAINER_ID="AI-Chat-Container",t.AI_CHAT_LOGO_AVATAR_ID="AI-Chat-Logo-Avatar",t.AI_MENU_BAR_DEBUG_TOOLBAR="AI_MENU_BAR_DEBUG_TOOLBAR",t.AI_MENUBAR_CONTAINER_VIEW_ID=r.DESIGN_MENUBAR_CONTAINER_VIEW_ID,t.SLASH_SYMBOL="/",t.AT_SIGN_SYMBOL="@";var o;(function(E){E.System="system",E.User="user",E.Assistant="assistant"})(o||(t.ChatCompletionRequestMessageRoleEnum=o={})),t.IChatInternalService=Symbol("IChatInternalService"),t.IChatManagerService=Symbol("IChatManagerService"),t.IChatAgentService=Symbol("IChatAgentService"),t.ChatProxyServiceToken=Symbol("ChatProxyServiceToken");var l;(function(E){E[E.READY=0]="READY",E[E.THINKING=1]="THINKING",E[E.DONE=2]="DONE",E[E.ERROR=3]="ERROR"})(l||(t.EInlineChatStatus=l={}));var m;(function(E){E.ACCEPT="ACCEPT",E.DISCARD="DISCARD",E.REGENERATE="REGENERATE"})(m||(t.EResultKind=m={})),t.IAIInlineCompletionsProvider=Symbol("IAIInlineCompletionsProvider")},98864:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractCodeBlocks=t.isDocumentValid=t.isDocumentTooShort=t.isDocumentTooLarge=void 0;const e="```",n=10,r=E=>{try{E.getText()}catch(p){if(p instanceof RangeError)return!0}return!1};t.isDocumentTooLarge=r;const o=E=>E.getText().length<n;t.isDocumentTooShort=o;const l=E=>!((0,t.isDocumentTooLarge)(E)||(0,t.isDocumentTooShort)(E));t.isDocumentValid=l;const m=E=>{const p=E.split(`
@@ -28341,7 +28342,7 @@ ${a}`)}return this.keybindingsChanged.fire({affectsCommands:[_.command]}),{dispo
28341
28342
  `)}))}}}t.TextMateTokenizer=m},54324:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextmateService=void 0,t.getEncodedLanguageId=y,t.getLegalThemeName=S;const n=e(85608),r=e(27107),o=e(25726),l=e(76003),m=e(41869),E=e(6858),p=e(43718),v=e(42933),s=e(52902),g=e(33096),c=e(89944),h=e(96068),d=e(14162),u=e(90626),_=e(96689),f=e(41977),a=e(58837);let b=!1;function y(I){return s.monaco.languages.getEncodedLanguageId(I)}function S(I){return I.toLowerCase().replace(/[^a-z0-9-]/g,"-")}class A{createOnigScanner(O){return new r.OnigScanner(O)}createOnigString(O){return new r.OnigString(O)}}function w(I){if(!Array.isArray(I))return!1;for(let O=0,L=I.length;O<L;O++)if(typeof I[O]!="string")return!1;return!0}function T(I){return w(I)&&I.length===2}let D=class extends m.WithEventBus{constructor(){super(...arguments),this.registeredGrammarDisposableCollection=new Map,this.injections=new Map,this.activatedLanguage=new Set,this.languageConfigLocation=new Map,this.languageConfiguration=new Map,this.initialized=!1,this.dynamicLanguages=[]}init(){this.initGrammarRegistry(),this.listenThemeChange(),this.listenPreferenceChange()}listenThemeChange(){this.eventBus.on(c.ThemeChangedEvent,O=>{const L=O.payload.theme.themeData;L!==this.editorTheme&&(this.editorTheme=L,this.setTheme(L))})}async registerLanguage(O,L){return this.registerLanguages([O],L)}reviveLanguageConfiguration(O,L){return{wordPattern:this.createRegex(L.wordPattern),autoClosingPairs:this.extractValidAutoClosingPairs(O,L),brackets:this.extractValidBrackets(O,L),comments:this.extractValidCommentRule(O,L),folding:this.convertFolding(L.folding),surroundingPairs:this.extractValidSurroundingPairs(O,L),indentationRules:this.convertIndentationRules(L.indentationRules),autoCloseBefore:L.autoCloseBefore,colorizedBracketPairs:this.extractValidColorizedBracketPairs(O,L),onEnterRules:this.extractValidOnEnterRules(O,L)}}get monacoLanguageService(){return u.StandaloneServices.get(d.ILanguageService)}isEmbeddedLanguageOnly(O){return!O.filenames&&!O.extensions&&!O.filenamePatterns&&!O.firstLine&&!O.mimetypes&&(!O.aliases||O.aliases.length===0)}async registerLanguages(O,L){const R=O.map(M=>({id:M.id,aliases:M.aliases,extensions:M.extensions,filenamePatterns:M.filenamePatterns,filenames:M.filenames,firstLine:M.firstLine,mimetypes:M.mimetypes}));if(this.dynamicLanguages.push(...R.filter(M=>!this.isEmbeddedLanguageOnly(M))),this.monacoLanguageService._registry._registerLanguages(R),O.forEach(async M=>{this.languageConfigLocation.set(M.id,L),this.addDispose(s.monaco.languages.onLanguage(M.id,async()=>{await this.loadLanguageConfiguration(M,L),this.activateLanguage(M.id)})),this.languageConfiguration.set(M.id,M)}),this.initialized){const M=this.editorDocumentModelService.getAllModels().map(k=>k.uri);for(const k of M){const B=this.editorDocumentModelService.getModelReference(p.URI.parse(k.codeUri.toString()));if(B&&B.instance){const x=B.instance.getMonacoModel().getLanguageId();if(this.languageConfiguration.has(x)){const N=this.languageConfigLocation.get(x);await this.loadLanguageConfiguration(this.languageConfiguration.get(x),N),this.activateLanguage(x)}}B?.dispose()}}}async registerGrammar(O,L){if(O.path){const R=O.path.replace(/^\.\//,"");O.location=L.resolve(R)}this.doRegisterGrammar(O)}unregisterGrammar(O){const L=this.registeredGrammarDisposableCollection.get(O.scopeName);L&&L.dispose()}doRegisterGrammar(O){const L=new p.Disposable;if(O.injectTo)for(const R of O.injectTo){let M=this.injections.get(R);M||(M=[],L.addDispose(p.Disposable.create(()=>{this.injections.delete(R)})),this.injections.set(R,M)),M.push(O.scopeName)}L.addDispose(p.Disposable.create(this.textmateRegistry.registerTextmateGrammarScope(O.scopeName,{async getGrammarDefinition(){return{format:/\.json$/.test(O.path)?"json":"plist",location:O.location,content:await O.resolvedConfiguration}},getInjections:R=>{const M=R.split(".");let k=[];for(let B=1;B<=M.length;B++){const x=M.slice(0,B).join(".");k=[...k,...this.injections.get(x)||[]]}return k}}))),O.language&&(L.addDispose(p.Disposable.create(this.textmateRegistry.mapLanguageIdToTextmateGrammar(O.language,O.scopeName))),L.addDispose(p.Disposable.create(this.textmateRegistry.registerGrammarConfiguration(O.language,()=>({embeddedLanguages:this.convertEmbeddedLanguages(O.embeddedLanguages),tokenTypes:this.convertTokenTypes(O.tokenTypes),balancedBracketSelectors:(0,h.asStringArray)(O.balancedBracketScopes,["*"]),unbalancedBracketSelectors:(0,h.asStringArray)(O.unbalancedBracketScopes,[])}))))),this.registeredGrammarDisposableCollection.set(O.scopeName,L)}async loadLanguageConfiguration(O,L){let R;if(typeof O.resolvedConfiguration=="object"){const M=await O.resolvedConfiguration;R=this.reviveLanguageConfiguration(O.id,M)}else if(O.configuration){const M=O.configuration.replace(/^\.\//,""),k=L.resolve(M),x=(await this.fileServiceClient.resolveContent(k.toString())).content;if(x){const N=this.safeParseJSON(x);N&&(R=this.reviveLanguageConfiguration(O.id,N))}}R&&s.monaco.languages.setLanguageConfiguration(O.id,R)}async activateLanguage(O){this.eventBus.fire(new m.ExtensionActivateEvent({topic:"onLanguage",data:O})),!this.activatedLanguage.has(O)&&(this.activatedLanguage.add(O),this.setTokensProviderByLanguageId(O))}async setTokensProviderByLanguageId(O){const L=this.textmateRegistry.getScope(O);if(!L||!this.textmateRegistry.getProvider(L))return;const M={lineLimit:this.preferenceService.getValid("editor.maxTokenizationLineLength",2e4)},k=this.textmateRegistry.getGrammarConfiguration(O)(),B=y(O);try{const x=await this.grammarRegistry.loadGrammarWithConfiguration(L,B,k),N=k.tokenizerOption?k.tokenizerOption:M,j=k.embeddedLanguages&&Object.keys(k.embeddedLanguages).length>0;if(x){const K=new a.TextMateTokenizer(x,N,j);this.addDispose(K.onDidEncounterLanguage(async U=>{const X=this.monacoLanguageService._registry.languageIdCodec.decodeLanguageId(U),z=this.languageConfigLocation.get(X);z&&this.languageConfiguration.has(X)&&(await this.loadLanguageConfiguration(this.languageConfiguration.get(X),z),this.activateLanguage(X))})),s.monaco.languages.setTokensProvider(O,K)}}catch(x){this.logger.warn("No grammar for this language id",O,x)}}setTheme(O){this.generateEncodedTokenColors(O),s.monaco.editor.defineTheme(S(O.name),O),s.monaco.editor.setTheme(S(O.name))}generateEncodedTokenColors(O){this.grammarRegistry.setTheme(O),O.encodedTokensColors=this.grammarRegistry.getColorMap(),O.encodedTokensColors[0]=null}createRegex(O){if(typeof O=="string")return new RegExp(O,"");if((0,p.isObject)(O)){if(typeof O.pattern!="string"||typeof O.flags<"u"&&typeof O.flags!="string")return;try{return new RegExp(O.pattern,O.flags)}catch{return}}}safeParseJSON(O){let L;try{return L=(0,m.parseWithComments)(O),L}catch(R){this.logger.error(`Language configuration file parsing error, ${R.stack}`);return}}convertFolding(O){if(!O)return;const L={offSide:O.offSide};return O.markers&&(L.markers={end:O.markers.end,start:O.markers.start}),L}convertIndentationRules(O){if(!O)return;const L={decreaseIndentPattern:this.createRegex(O.decreaseIndentPattern),increaseIndentPattern:this.createRegex(O.increaseIndentPattern)};return O.indentNextLinePattern&&(L.indentNextLinePattern=this.createRegex(O.indentNextLinePattern)),O.unIndentedLinePattern&&(L.unIndentedLinePattern=this.createRegex(O.unIndentedLinePattern)),L}convertEmbeddedLanguages(O){if(typeof O>"u"||O===null)return;const L=Object.create(null),R=Object.keys(O),M=R.length;for(let k=0;k<M;k++){const B=R[k],x=O[B];L[B]=y(x)}return L}convertTokenTypes(O){if(typeof O>"u"||O===null)return;const L=Object.create(null),R=Object.keys(O),M=R.length;for(let k=0;k<M;k++){const B=R[k];switch(O[B]){case"string":L[B]=2;break;case"other":L[B]=0;break;case"comment":L[B]=1;break}}return L}extractValidSurroundingPairs(O,L){if(!L)return;const R=L.surroundingPairs;if(typeof R>"u")return;if(!Array.isArray(R)){this.logger.warn(`[${O}: language configuration: expected \`surroundingPairs\` to be an array.`);return}let M;for(let k=0,B=R.length;k<B;k++){const x=R[k];if(Array.isArray(x)){if(!T(x)){this.logger.warn(`[${O}: language configuration: expected \`surroundingPairs[${k}]\` to be an array of two strings or an object.`);continue}M=M||[],M.push({open:x[0],close:x[1]})}else{if(typeof x!="object"){this.logger.warn(`[${O}: language configuration: expected \`surroundingPairs[${k}]\` to be an array of two strings or an object.`);continue}if(typeof x.open!="string"){this.logger.warn(`[${O}: language configuration: expected \`surroundingPairs[${k}].open\` to be a string.`);continue}if(typeof x.close!="string"){this.logger.warn(`[${O}: language configuration: expected \`surroundingPairs[${k}].close\` to be a string.`);continue}M=M||[],M.push({open:x.open,close:x.close})}}return M}extractValidColorizedBracketPairs(O,L){const R=L.colorizedBracketPairs;if(typeof R>"u")return;if(!Array.isArray(R)){this.logger.warn(`[${O}]: language configuration: expected \`colorizedBracketPairs\` to be an array.`);return}const M=[];for(let k=0,B=R.length;k<B;k++){const x=R[k];if(!T(x)){this.logger.warn(`[${O}]: language configuration: expected \`colorizedBracketPairs[${k}]\` to be an array of two strings.`);continue}M.push([x[0],x[1]])}return M}extractValidOnEnterRules(O,L){const R=L.onEnterRules;if(typeof R>"u")return;if(!Array.isArray(R)){this.logger.warn(`[${O}]: language configuration: expected \`onEnterRules\` to be an array.`);return}let M;for(let k=0,B=R.length;k<B;k++){const x=R[k];if(!(0,p.isObject)(x)){this.logger.warn(`[${O}]: language configuration: expected \`onEnterRules[${k}]\` to be an object.`);continue}if(!(0,p.isObject)(x.action)){this.logger.warn(`[${O}]: language configuration: expected \`onEnterRules[${k}].action\` to be an object.`);continue}let N;if(x.action.indent==="none")N=g.IndentAction.None;else if(x.action.indent==="indent")N=g.IndentAction.Indent;else if(x.action.indent==="indentOutdent")N=g.IndentAction.IndentOutdent;else if(x.action.indent==="outdent")N=g.IndentAction.Outdent;else{this.logger.warn(`[${O}]: language configuration: expected \`onEnterRules[${k}].action.indent\` to be 'none', 'indent', 'indentOutdent' or 'outdent'.`);continue}const j={indentAction:N};x.action.appendText&&(typeof x.action.appendText=="string"?j.appendText=x.action.appendText:this.logger.warn(`[${O}]: language configuration: expected \`onEnterRules[${k}].action.appendText\` to be undefined or a string.`)),x.action.removeText&&(typeof x.action.removeText=="number"?j.removeText=x.action.removeText:this.logger.warn(`[${O}]: language configuration: expected \`onEnterRules[${k}].action.removeText\` to be undefined or a number.`));const K=this.createRegex(x.beforeText);if(!K)continue;const U={beforeText:K,action:j};if(x.afterText){const X=this.createRegex(x.afterText);X&&(U.afterText=X)}if(x.previousLineText){const X=this.createRegex(x.previousLineText);X&&(U.previousLineText=X)}M=M||[],M.push(U)}return M}extractValidBrackets(O,L){const R=L.brackets;if(typeof R>"u")return;if(!Array.isArray(R)){this.logger.warn(`[${O}]: language configuration: expected \`brackets\` to be an array.`);return}let M;for(let k=0,B=R.length;k<B;k++){const x=R[k];if(!T(x)){this.logger.warn(`[${O}]: language configuration: expected \`brackets[${k}]\` to be an array of two strings.`);continue}M=M||[],M.push(x)}return M}extractValidAutoClosingPairs(O,L){const R=L.autoClosingPairs;if(typeof R>"u")return;if(!Array.isArray(R)){this.logger.warn(`[${O}]: language configuration: expected \`autoClosingPairs\` to be an array.`);return}let M;for(let k=0,B=R.length;k<B;k++){const x=R[k];if(Array.isArray(x)){if(!T(x)){this.logger.warn(`[${O}]: language configuration: expected \`autoClosingPairs[${k}]\` to be an array of two strings or an object.`);continue}M=M||[],M.push({open:x[0],close:x[1]})}else{if(typeof x!="object"){this.logger.warn(`[${O}]: language configuration: expected \`autoClosingPairs[${k}]\` to be an array of two strings or an object.`);continue}if(typeof x.open!="string"){this.logger.warn(`[${O}]: language configuration: expected \`autoClosingPairs[${k}].open\` to be a string.`);continue}if(typeof x.close!="string"){this.logger.warn(`[${O}]: language configuration: expected \`autoClosingPairs[${k}].close\` to be a string.`);continue}if(typeof x.notIn<"u"&&!w(x.notIn)){this.logger.warn(`[${O}]: language configuration: expected \`autoClosingPairs[${k}].notIn\` to be a string array.`);continue}M=M||[],M.push({open:x.open,close:x.close,notIn:x.notIn})}}return M}extractValidCommentRule(O,L){const R=L.comments;if(typeof R>"u")return;if(typeof R!="object"){this.logger.warn(`[${O}]: language configuration: expected \`comments\` to be an object.`);return}let M;return typeof R.lineComment<"u"&&(typeof R.lineComment!="string"?this.logger.warn(`[${O}]: language configuration: expected \`comments.lineComment\` to be a string.`):(M=M||{},M.lineComment=R.lineComment)),typeof R.blockComment<"u"&&(T(R.blockComment)?(M=M||{},M.blockComment=R.blockComment):this.logger.warn(`[${O}]: language configuration: expected \`comments.blockComment\` to be an array of two strings.`)),M}async initGrammarRegistry(){this.grammarRegistry=new o.Registry({onigLib:this.getOnigLib(),loadGrammar:async O=>{const L=this.textmateRegistry.getProvider(O);if(L){const R=await L.getGrammarDefinition();if(!R.content){const B=(await this.fileServiceClient.resolveContent(R.location.toString())).content;R.content=R.format==="json"?this.safeParseJSON(B):B}let M;return typeof R.content=="string"?M=(0,o.parseRawGrammar)(R.content,R.format==="json"?"grammar.json":"grammar.plist"):M=R.content,M}},getInjections:O=>{const L=this.textmateRegistry.getProvider(O);return L&&L.getInjections?L.getInjections(O):[]}}),this.activateLanguages()}getLanguages(){return[...s.monaco.languages.getLanguages(),...this.dynamicLanguages]}activateLanguages(){for(const{id:O}of this.getLanguages())this.editorDocumentModelService.hasLanguage(O)&&this.activateLanguage(O)}async getOnigLib(){if(b)return new A;const O=await this.rendererRuntime.provideResourceUri(E.EKnownResources.OnigWasm),R=await(await fetch(O)).arrayBuffer();return await(0,r.loadWASM)(R),b=!0,new A}listenPreferenceChange(){this.preferenceService.onPreferenceChanged(O=>{if(O.preferenceName==="editor.maxTokenizationLineLength")for(const L of this.activatedLanguage)this.setTokensProviderByLanguageId(L)})}async testTokenize(O,L){const R=this.textmateRegistry.getScope(L);if(!R)return;const M=this.textmateRegistry.getGrammarConfiguration(L)(),k=y(L),B=await this.grammarRegistry.loadGrammarWithConfiguration(R,k,M);let x=o.INITIAL;const N=B.tokenizeLine(O,x),j=(0,m.getDebugLogger)("tokenize");j.log(`
28342
28343
  Tokenizing line: ${O}`);for(let K=0;K<N.tokens.length;K++){const U=N.tokens[K];j.log(` - token from ${U.startIndex} to ${U.endIndex} (${O.substring(U.startIndex,U.endIndex)}) with scopes ${U.scopes.join(", ")}`)}x=N.ruleStack}dispose(){super.dispose(),this.monacoLanguageService._requestedRichLanguages?this.monacoLanguageService._requestedRichLanguages.clear():this.logger.warn("monaco language service not found _requestedRichLanguages"),this.monacoLanguageService._requestedBasicLanguages?this.monacoLanguageService._requestedBasicLanguages.clear():this.logger.warn("monaco language service not found _requestedBasicLanguages")}};t.TextmateService=D,n.__decorate([(0,l.Autowired)(),n.__metadata("design:type",f.TextmateRegistry)],D.prototype,"textmateRegistry",void 0),n.__decorate([(0,l.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],D.prototype,"fileServiceClient",void 0),n.__decorate([(0,l.Autowired)(m.PreferenceService),n.__metadata("design:type",Object)],D.prototype,"preferenceService",void 0),n.__decorate([(0,l.Autowired)(m.ILogger),n.__metadata("design:type",Object)],D.prototype,"logger",void 0),n.__decorate([(0,l.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],D.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,l.Autowired)(E.RendererRuntime),n.__metadata("design:type",E.RendererRuntime)],D.prototype,"rendererRuntime",void 0),t.TextmateService=D=n.__decorate([(0,l.Injectable)()],D)},88412:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHierarchyContribution=t.executeProvideSubtypesCommand=t.executeProvideSupertypesCommand=t.executePrepareTypeHierarchyCommand=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(40191),m=e(28694),E=e(82196);t.executePrepareTypeHierarchyCommand={id:"_executePrepareTypeHierarchy"},t.executeProvideSupertypesCommand={id:"_executeProvideSupertypes"},t.executeProvideSubtypesCommand={id:"_executeProvideSubtypes"};const p=new l.RawContextKey("editorHasCallHierarchyProvider",!1);let v=class{registerCommands(g){g.registerCommand(t.executePrepareTypeHierarchyCommand,{execute:(c,h)=>this.typeHierarchyService.prepareTypeHierarchyProvider(c,h)}),g.registerCommand(t.executeProvideSupertypesCommand,{execute:c=>this.typeHierarchyService.provideSupertypes(c)}),g.registerCommand(t.executeProvideSubtypesCommand,{execute:c=>this.typeHierarchyService.provideSubtypes(c)})}registerEditorFeature(g){this.ctxHasProvider=p.bind(this.contextKeyService),g.registerEditorFeatureContribution({contribute:c=>{const h=c.monacoEditor;return o.Event.any(h.onDidChangeModel,h.onDidChangeModelLanguage,m.TypeHierarchyProviderRegistry.onDidChange)(()=>{h.hasModel()&&this.ctxHasProvider.set(m.TypeHierarchyProviderRegistry.has(h.getModel()))})}})}};t.TypeHierarchyContribution=v,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],v.prototype,"contextKeyService",void 0),n.__decorate([(0,r.Autowired)(m.ITypeHierarchyService),n.__metadata("design:type",Object)],v.prototype,"typeHierarchyService",void 0),t.TypeHierarchyContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,E.BrowserEditorContribution)],v)},7795:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHierarchyService=t.TypeHierarchyModel=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(28694),m=e(96689),{isNonEmptyArray:E}=o.arrays;class p{static async create(g,c,h){const[d]=l.TypeHierarchyProviderRegistry.ordered(g);if(!d)return;const u=await d.prepareTypeHierarchy(g,c,h);if(u)return new p(u.roots.reduce((_,f)=>_+f._sessionId,""),d,u.roots,new o.RefCountedDisposable(u))}constructor(g,c,h,d){this.id=g,this.provider=c,this.roots=h,this.ref=d,this.root=h[0]}dispose(){this.ref.release()}fork(g){const c=this;return new class extends p{constructor(){super(c.id,c.provider,[g],c.ref.acquire())}}}async provideSupertypes(g,c){try{const h=await this.provider.provideSupertypes(g,c);if(E(h))return h}catch(h){(0,o.onUnexpectedExternalError)(h)}return[]}async provideSubtypes(g,c){try{const h=await this.provider.provideSubtypes(g,c);if(E(h))return h}catch(h){(0,o.onUnexpectedExternalError)(h)}return[]}}t.TypeHierarchyModel=p;let v=class{constructor(){this.models=new Map}registerTypeHierarchyProvider(g,c){l.TypeHierarchyProviderRegistry.register(g,c)}async prepareTypeHierarchyProvider(g,c){let h=this.modelService.getModelReference(o.URI.parse(g.toString())),d=h?.instance.getMonacoModel();if(h?.dispose(),!d){const u=await this.modelService.createModelReference(o.URI.parse(g.toString()));d=u.instance.getMonacoModel(),h=u}try{const u=await p.create(d,c,o.CancellationToken.None);return u?(this.models.set(u.id,u),this.models.forEach((_,f,a)=>{a.size>10&&(_.dispose(),this.models.delete(f))}),[u.root]):[]}finally{h?.dispose()}}async provideSupertypes(g){const c=this.models.get(g._sessionId);if(c)return c.provideSupertypes(g,o.CancellationToken.None)}async provideSubtypes(g){const c=this.models.get(g._sessionId);if(c)return c.provideSubtypes(g,o.CancellationToken.None)}};t.TypeHierarchyService=v,n.__decorate([(0,r.Autowired)(m.IEditorDocumentModelService),n.__metadata("design:type",Object)],v.prototype,"modelService",void 0),t.TypeHierarchyService=v=n.__decorate([(0,r.Injectable)()],v)},93532:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NavigationMenuModel=t.NavigationBarViewService=t.NavigationMenuContainer=t.NavigationMenu=t.NavigationItem=t.NavigationBar=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(76003),m=e(97267),E=e(41869),p=e(28423),v=e(26209),s=n.__importDefault(e(69418)),g=e(82196),c=e(50674),h=({editorGroup:a})=>{const b=(0,E.useInjectable)(g.IBreadCrumbService),y=(0,E.useDesignStyles)(s.default.navigation_container,"navigation_container"),S=(0,E.useDesignStyles)(s.default.navigation_icon,"navigation_icon");if((0,c.useUpdateOnGroupTabChange)(a),(0,E.useUpdateOnEvent)(b.onDidUpdateBreadCrumbResults,[],w=>{var T;const D=a.currentEditor&&a.currentEditor.currentDocumentModel?a.currentEditor:null,I=a.currentEditor&&a.currentEditor.currentDocumentModel?a.currentEditor.currentDocumentModel.uri:(T=a.currentResource)===null||T===void 0?void 0:T.uri;return!!I&&w.editor===D&&w.uri.isEqual(I)}),a.resources.length===0||!a.currentResource)return null;let A;return a.currentEditor&&a.currentEditor.currentDocumentModel?A=b.getBreadCrumbs(a.currentEditor.currentDocumentModel.uri,a.currentEditor):A=b.getBreadCrumbs(a.currentResource.uri,null),A?A.length===0?null:o.default.createElement("div",{className:(0,r.default)("kt-navigation-container",y),onContextMenu:w=>{w.preventDefault()}},A.map((w,T)=>o.default.createElement(o.default.Fragment,{key:T+"-crumb:"+w.name},T>0&&o.default.createElement(m.Icon,{icon:"right",size:"small",className:S}),o.default.createElement(t.NavigationItem,{part:w,editorGroup:a})))):null};t.NavigationBar=h,t.NavigationItem=(0,o.memo)(({part:a,editorGroup:b})=>{const y=(0,E.useInjectable)(_),S=(0,E.useInjectable)(v.BreadCrumbsMenuService),A=(0,o.useRef)(),w=(0,E.useDesignStyles)(s.default["navigation-part"],"navigation-part"),T=(0,o.useCallback)(async()=>{if(a.getSiblings&&A.current){const{left:D,top:I,height:O}=A.current.getBoundingClientRect(),L=await a.getSiblings();let R=D;window.innerWidth-R<210&&(R=window.innerWidth-200-5),y.showMenu(L.parts,R,I+O+5,L.currentIndex,a.uri,b)}},[A.current,a]);return o.default.createElement("span",{onClick:T,onContextMenu:D=>{!a.isSymbol&&a.uri&&S.show(D.nativeEvent.x,D.nativeEvent.y,b,a.uri),D.preventDefault()},className:w,ref:A},a.icon&&o.default.createElement("span",{className:a.icon}),o.default.createElement("span",null,a.name))});const d=({model:a})=>{let b=window.innerHeight-a.y-20,y=a.y;const S=a.parts.length*22;b<100&&b<S&&(b=100,y=window.innerHeight-20-b);const A=(0,o.useRef)(),w=(0,E.useDesignStyles)(s.default.navigation_menu,"navigation_menu"),T=(0,E.useDesignStyles)(s.default.navigation_menu_item,"navigation_menu_item"),D=(0,E.useInjectable)(_),I=(0,E.useAutorun)(a.subMenu),O=(0,o.useCallback)(()=>{E.fastdom.measure(()=>{try{if(A.current){const L=A.current.querySelector(`.${s.default.navigation_menu_item_current}`);L&&L.scrollIntoView({behavior:"auto",block:"center"})}}catch{}})},[A.current]);return o.default.createElement("div",{className:w,style:{left:a.x+"px",top:y+"px",maxHeight:b+"px",height:S+"px"}},o.default.createElement(m.Scrollbars,{className:s.default.navigation_menu_items,universal:!0,forwardedRef:L=>{A.current=L,O()}},a.parts.map((L,R)=>{let M;const k=L.getChildren?async()=>{if(M){const{left:x,top:N,width:j}=M.getBoundingClientRect();let K=x+j+5;window.innerWidth-K<210&&(K=x-j-5);const U=await L.getChildren();a.showSubMenu(U,K,N,a)}}:void 0,B=L.onClick?()=>{L.onClick(),D.dispose()}:void 0;return o.default.createElement("div",{onClick:B||k,ref:x=>M=x,className:(0,r.default)(T,{[s.default.navigation_menu_item_current]:R===a.initialIndex}),key:"menu-"+L.name},o.default.createElement("span",{className:L.icon||(0,E.getIcon)("smile")}),o.default.createElement("span",{className:s.default.navigation_menu_item_label},L.name),L.getChildren&&o.default.createElement("span",{className:s.default.navigation_right,onClick:B&&k?x=>{x.stopPropagation(),k()}:void 0},o.default.createElement(m.Icon,{icon:"right",size:"small"})))})),I&&o.default.createElement(t.NavigationMenu,{model:I}))};t.NavigationMenu=d;const u=()=>{const a=(0,o.useRef)(),b=(0,E.useInjectable)(_),y=(0,E.useAutorun)(b.current);return(0,o.useEffect)(()=>{if(a.current){const S=new E.Disposable;return S.addDispose(new E.DomListener(window,"mouseup",()=>{b.dispose()})),S.addDispose(new E.DomListener(a.current,"mouseup",A=>{A.stopPropagation()})),S.dispose.bind(S)}}),y?o.default.createElement("div",{tabIndex:1,ref:a},o.default.createElement(t.NavigationMenu,{model:y})):null};t.NavigationMenuContainer=u;let _=class{constructor(){this.current=(0,p.observableValue)(this,null)}showMenu(b,y,S,A,w,T){(0,p.transaction)(D=>{this.current.set(new f(b,y,S,A,w),D)})}dispose(){(0,p.transaction)(b=>{const y=this.current.get();y?.dispose(),this.current.set(null,b)})}};t.NavigationBarViewService=_,t.NavigationBarViewService=_=n.__decorate([(0,l.Injectable)()],_);class f{constructor(b,y,S,A=-1,w){this.parts=b,this.x=y,this.y=S,this.initialIndex=A,this.uri=w,this.subMenu=(0,p.observableValue)(this,null)}showSubMenu(b,y,S,A){(0,p.transaction)(w=>{this.subMenu.set(new f(b,y,S,-1,A),w)})}dispose(){(0,p.transaction)(b=>{const y=this.subMenu.get();y?.dispose(),this.subMenu.set(null,b)})}}t.NavigationMenuModel=f},71145:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotebookService=void 0;const n=e(85608),r=e(76003),o=e(41869);let l=class extends o.WithEventBus{constructor(){super(...arguments),this._onDidOpenNotebookDocument=new o.Emitter,this.onDidOpenNotebookDocument=this._onDidOpenNotebookDocument.event,this._onDidCloseNotebookDocument=new o.Emitter,this.onDidCloseNotebookDocument=this._onDidCloseNotebookDocument.event,this._onDidSaveNotebookDocument=new o.Emitter,this.onDidSaveNotebookDocument=this._onDidSaveNotebookDocument.event,this._onDidChangeNotebookDocument=new o.Emitter,this.onDidChangeNotebookDocument=this._onDidChangeNotebookDocument.event}};t.NotebookService=l,t.NotebookService=l=n.__decorate([(0,r.Injectable)()],l)},34885:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorPreferenceContribution=void 0;const n=e(85608),r=e(41869),o=e(24328);let l=class{constructor(){this.schema=o.editorPreferenceSchema}};t.EditorPreferenceContribution=l,t.EditorPreferenceContribution=l=n.__decorate([(0,r.Domain)(r.PreferenceContribution)],l)},6043:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diffEditorOptionsConverters=t.textModelUpdateOptionsConverters=t.editorOptionsConverters=void 0,t.isEditorOption=l,t.isDiffEditorOption=m,t.getConvertedMonacoOptions=s;const n=e(41869),{removeUndefined:r}=n.objects;t.editorOptionsConverters=new Map([["editor.ariaLabel",{monaco:"ariaLabel"}],["editor.rulers",{monaco:"rulers"}],["editor.wordSeparators",{monaco:"wordSeparators"}],["editor.selectionClipboard",{monaco:"selectionClipboard"}],["editor.lineNumbers",{monaco:"lineNumbers"}],["editor.renderFinalNewline",{monaco:"renderFinalNewline"}],["editor.selectOnLineNumbers",{monaco:"selectOnLineNumbers"}],["editor.lineNumbersMinChars",{monaco:"lineNumbersMinChars"}],["editor.glyphMargin",{monaco:"glyphMargin"}],["editor.lineDecorationsWidth",{monaco:"lineDecorationsWidth"}],["editor.revealHorizontalRightPadding",{monaco:"revealHorizontalRightPadding"}],["editor.roundedSelection",{monaco:"roundedSelection"}],["editor.extraEditorClassName",{monaco:"extraEditorClassName"}],["editor.readOnly",{monaco:"readOnly"}],["editor.scrollbar",{monaco:"scrollbar"}],["editor.minimap",{monaco:"minimap",convert:g=>({enabled:g})}],["editor.find",{monaco:"find"}],["editor.fixedOverflowWidgets",{monaco:"fixedOverflowWidgets"}],["editor.overviewRulerLanes",{monaco:"overviewRulerLanes"}],["editor.overviewRulerBorder",{monaco:"overviewRulerBorder"}],["editor.cursorBlinking",{monaco:"cursorBlinking"}],["editor.mouseWheelZoom",{monaco:"mouseWheelZoom"}],["editor.cursorSmoothCaretAnimation",{monaco:"cursorSmoothCaretAnimation"}],["editor.cursorStyle",{monaco:"cursorStyle"}],["editor.cursorWidth",{monaco:"cursorWidth"}],["editor.fontLigatures",{monaco:"fontLigatures"}],["editor.columnSelection",{monaco:"columnSelection"}],["editor.disableLayerHinting",{monaco:"disableLayerHinting"}],["editor.disableMonospaceOptimizations",{monaco:"disableMonospaceOptimizations"}],["editor.hideCursorInOverviewRuler",{monaco:"hideCursorInOverviewRuler"}],["editor.scrollBeyondLastLine",{monaco:"scrollBeyondLastLine"}],["editor.scrollBeyondLastColumn",{monaco:"scrollBeyondLastColumn"}],["editor.smoothScrolling",{monaco:"smoothScrolling"}],["editor.automaticLayout",{monaco:"automaticLayout"}],["editor.wordWrap",{monaco:"wordWrap"}],["editor.wordWrapColumn",{monaco:"wordWrapColumn"}],["editor.wordWrapMinified",{monaco:"wordWrapMinified"}],["editor.wrappingIndent",{monaco:"wrappingIndent"}],["editor.wordWrapBreakBeforeCharacters",{monaco:"wordWrapBreakBeforeCharacters"}],["editor.wordWrapBreakAfterCharacters",{monaco:"wordWrapBreakAfterCharacters"}],["editor.wordWrapBreakObtrusiveCharacters",{monaco:"wordWrapBreakObtrusiveCharacters"}],["editor.stopRenderingLineAfter",{monaco:"stopRenderingLineAfter"}],["editor.hover",{monaco:"hover"}],["editor.links",{monaco:"links"}],["editor.colorDecorators",{monaco:"colorDecorators"}],["editor.contextmenu",{monaco:"contextmenu"}],["editor.mouseWheelScrollSensitivity",{monaco:"mouseWheelScrollSensitivity"}],["editor.fastScrollSensitivity",{monaco:"fastScrollSensitivity"}],["editor.multiCursorModifier",{monaco:"multiCursorModifier"}],["editor.multiCursorMergeOverlapping",{monaco:"multiCursorMergeOverlapping"}],["editor.accessibilitySupport",{monaco:"accessibilitySupport"}],["editor.suggest",{monaco:"suggest"}],["editor.gotoLocation",{monaco:"gotoLocation"}],["editor.quickSuggestions",{monaco:"quickSuggestions"}],["editor.quickSuggestionsDelay",{monaco:"quickSuggestionsDelay"}],["editor.parameterHints",{monaco:"parameterHints"}],["editor.autoClosingBrackets",{monaco:"autoClosingBrackets"}],["editor.autoClosingQuotes",{monaco:"autoClosingQuotes"}],["editor.autoSurround",{monaco:"autoSurround"}],["editor.autoIndent",{monaco:"autoIndent"}],["editor.formatOnType",{monaco:"formatOnType"}],["editor.formatOnPaste",{monaco:"formatOnPaste"}],["editor.dragAndDrop",{monaco:"dragAndDrop"}],["editor.suggestOnTriggerCharacters",{monaco:"suggestOnTriggerCharacters"}],["editor.acceptSuggestionOnEnter",{monaco:"acceptSuggestionOnEnter"}],["editor.acceptSuggestionOnCommitCharacter",{monaco:"acceptSuggestionOnCommitCharacter"}],["editor.snippetSuggestions",{monaco:"snippetSuggestions"}],["editor.emptySelectionClipboard",{monaco:"emptySelectionClipboard"}],["editor.copyWithSyntaxHighlighting",{monaco:"copyWithSyntaxHighlighting"}],["editor.wordBasedSuggestions",{monaco:"wordBasedSuggestions"}],["editor.suggestSelection",{monaco:"suggestSelection"}],["editor.suggestFontSize",{monaco:"suggestFontSize"}],["editor.suggestLineHeight",{monaco:"suggestLineHeight"}],["editor.tabCompletion",{monaco:"tabCompletion"}],["editor.selectionHighlight",{monaco:"selectionHighlight"}],["editor.occurrencesHighlight",{monaco:"occurrencesHighlight"}],["editor.codeLens",{monaco:"codeLens"}],["editor.lightbulb",{monaco:"lightbulb"}],["editor.codeActionsOnSave",{monaco:"codeActionsOnSave"}],["editor.codeActionsOnSaveTimeout",{monaco:"codeActionsOnSaveTimeout"}],["editor.folding",{monaco:"folding"}],["editor.foldingStrategy",{monaco:"foldingStrategy"}],["editor.showFoldingControls",{monaco:"showFoldingControls"}],["editor.matchBrackets",{monaco:"matchBrackets"}],["editor.renderWhitespace",{monaco:"renderWhitespace"}],["editor.renderControlCharacters",{monaco:"renderControlCharacters"}],["editor.renderIndentGuides",{monaco:"guides.indentation"}],["editor.highlightActiveIndentGuide",{monaco:"guides.highlightActiveIndentation"}],["editor.guides",{monaco:"guides"}],["editor.renderLineHighlight",{monaco:"renderLineHighlight"}],["editor.useTabStops",{monaco:"useTabStops"}],["editor.fontFamily",{monaco:"fontFamily"}],["editor.fontWeight",{monaco:"fontWeight"}],["editor.fontSize",{monaco:"fontSize"}],["editor.lineHeight",{monaco:"lineHeight"}],["editor.letterSpacing",{monaco:"letterSpacing"}],["editor.showUnused",{monaco:"showUnused"}],["editor.rename.enablePreview",{monaco:"editor.rename.enablePreview"}],["editor.semanticHighlighting",{monaco:"semanticHighlighting"}],["editor.bracketPairColorization",{monaco:"bracketPairColorization"}],["editor.wrappingStrategy",{monaco:"wrappingStrategy"}],["editor.experimental.stickyScroll.enabled",{monaco:"experimental",convert:g=>({stickyScroll:{enabled:g}})}],["editor.forceReadOnly",{monaco:"readOnly",convert:g=>{if(g)return!0}}],["editor.unicodeHighlight",{monaco:"unicodeHighlight"}],["editor.inlineSuggest.showToolbar",{monaco:"inlineSuggest",convert:g=>{if(g)return{showToolbar:g}}}]]),t.textModelUpdateOptionsConverters=new Map([["editor.tabSize",{monaco:"tabSize"}],["editor.indentSize",{monaco:"indentSize"}],["editor.insertSpaces",{monaco:"insertSpaces"}],["editor.trimAutoWhitespace",{monaco:"trimAutoWhitespace"}]]),t.diffEditorOptionsConverters=new Map([["diffEditor.enableSplitViewResizing",{monaco:"enableSplitViewResizing"}],["diffEditor.renderSideBySide",{monaco:"renderSideBySide"}],["diffEditor.ignoreTrimWhitespace",{monaco:"ignoreTrimWhitespace"}],["diffEditor.renderIndicators",{monaco:"renderIndicators"}],["diffEditor.originalEditable",{monaco:"originalEditable"}],["diffEditor.minimap",{monaco:"minimap",convert:g=>({enabled:g})}],["diffEditor.experimental.stickyScroll.enabled",{monaco:"experimental",convert:g=>({stickyScroll:{enabled:g}})}],["diffEditor.hideUnchangedRegions.enabled",{monaco:"hideUnchangedRegions",convert:g=>({enabled:g})}],["diffEditor.hideUnchangedRegions.revealLineCount",{monaco:"hideUnchangedRegions",convert:g=>({revealLineCount:g})}],["diffEditor.hideUnchangedRegions.minimumLineCount",{monaco:"hideUnchangedRegions",convert:g=>({minimumLineCount:g})}],["diffEditor.hideUnchangedRegions.contextLineCount",{monaco:"hideUnchangedRegions",convert:g=>({contextLineCount:g})}],["diffEditor.experimental.showMoves",{monaco:"experimental",convert:g=>({showMoves:g})}],["diffEditor.experimental.showEmptyDecorations",{monaco:"experimental",convert:g=>({showEmptyDecorations:g})}]]);function o(g,c){if(c.has(g))return!0;{const h=c.keys();for(const d of h)if(g.startsWith(d))return!0}return!1}function l(g){return o(g,t.editorOptionsConverters)||o(g,t.textModelUpdateOptionsConverters)||o(g,t.diffEditorOptionsConverters)}function m(g){return o(g,t.diffEditorOptionsConverters)}const E=[...t.editorOptionsConverters.keys()],p=[...t.textModelUpdateOptionsConverters.keys()],v=[...t.diffEditorOptionsConverters.keys()];function s(g,c,h,d){const u=c?n.Uri.parse(c):void 0,_=(w,T)=>w.reduce((D,I)=>{const O=g.getValue(I,{resource:u,overrideIdentifier:h});if(O!==void 0){const L=T.get(I);if(!L)return D[I]=O,D;const R=L?L.monaco:I,M=L?.convert?L.convert(O):O;D[R]?Object.assign(D[R],M):D[R]=M}return D},{}),f=d?d.filter(w=>t.editorOptionsConverters.has(w)):[...E],a=d?d.filter(w=>t.textModelUpdateOptionsConverters.has(w)):[...p],b=d?d.filter(w=>t.diffEditorOptionsConverters.has(w)):[...v],y=r(_(f,t.editorOptionsConverters)),S=r(_(a,t.textModelUpdateOptionsConverters)),A=r(_(b,t.diffEditorOptionsConverters));return{editorOptions:y,modelOptions:S,diffOptions:A}}},24328:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorPreferences=t.editorPreferenceSchema=t.DIFF_EDITOR_DEFAULTS=t.EDITOR_DEFAULTS=t.EDITOR_INLINE_SUGGEST_DEFAULTS=t.EDITOR_SUGGEST_DEFAULTS=t.EDITOR_MODEL_DEFAULTS=t.EDITOR_FONT_DEFAULTS=t.USUAL_WORD_SEPARATORS=void 0;const n=e(41869),r=e(82196);t.USUAL_WORD_SEPARATORS="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";const o="Consolas, 'Courier New', monospace",l="Menlo, Monaco, 'Courier New', monospace",m="'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'";t.EDITOR_FONT_DEFAULTS={fontFamily:n.isOSX?l:n.isLinux?m:o,fontWeight:"normal",fontSize:12,tabSize:2,renderWhitespace:!1,cursorStyle:"line",insertSpace:!0,wordWrap:"off",wordWrapColumn:80,lineHeight:0,letterSpacing:0},t.EDITOR_MODEL_DEFAULTS={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0},t.EDITOR_SUGGEST_DEFAULTS={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!0,localityBonus:!1,shareSuggestSelections:!1,showIcons:!0,maxVisibleSuggestions:12,showMethods:!0,showFunctions:!0,showConstructors:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0,detailsVisible:!0,preview:!0,statusBar:{visible:!1}},t.EDITOR_INLINE_SUGGEST_DEFAULTS={enabled:!0,showToolbar:"onHover"},t.EDITOR_DEFAULTS={inDiffEditor:!1,wordSeparators:t.USUAL_WORD_SEPARATORS,lineNumbersMinChars:3,lineDecorationsWidth:10,readOnly:!1,columnSelection:!1,mouseStyle:"text",disableLayerHinting:!1,automaticLayout:!0,wordWrap:"off",wordWrapColumn:80,wordWrapMinified:!0,wrappingIndent:1,wordWrapBreakBeforeCharacters:"([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B",wordWrapBreakAfterCharacters:" })]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63",wordWrapBreakObtrusiveCharacters:".",autoClosingBrackets:"languageDefined",autoClosingQuotes:"languageDefined",autoSurround:"languageDefined",autoIndent:!0,dragAndDrop:!0,emptySelectionClipboard:!0,copyWithSyntaxHighlighting:!0,useTabStops:!0,multiCursorModifier:"altKey",multiCursorMergeOverlapping:!0,accessibilitySupport:"off",showUnused:!0,wrappingStrategy:"simple",viewInfo:{extraEditorClassName:"",disableMonospaceOptimizations:!1,rulers:[],ariaLabel:(0,n.localize)("editorViewAccessibleLabel","Editor Content"),renderLineNumbers:0,renderCustomLineNumbers:null,renderFinalNewline:!0,selectOnLineNumbers:!0,glyphMargin:!0,revealHorizontalRightPadding:30,roundedSelection:!0,overviewRulerLanes:2,overviewRulerBorder:!0,cursorBlinking:1,mouseWheelZoom:!1,cursorSmoothCaretAnimation:!1,cursorStyle:1,cursorWidth:0,hideCursorInOverviewRuler:!1,scrollBeyondLastLine:!0,scrollBeyondLastColumn:5,smoothScrolling:!1,stopRenderingLineAfter:1e4,renderWhitespace:"none",renderControlCharacters:!1,fontLigatures:!1,renderLineHighlight:"none",scrollbar:{vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:10,horizontalSliderSize:10,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,mouseWheelScrollSensitivity:1,fastScrollSensitivity:5},minimap:{enabled:!0,side:"right",showSlider:"mouseover",renderCharacters:!0,maxColumn:120},guides:{indentation:!0,highlightActiveIndentGuide:!0,bracketPairs:!0},fixedOverflowWidgets:!0},contribInfo:{selectionClipboard:!0,hover:{enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0},links:!0,contextmenu:!0,quickSuggestions:{other:!0,comments:!1,strings:!1},quickSuggestionsDelay:10,parameterHints:{enabled:!0,cycle:!1},formatOnType:!1,formatOnPaste:!1,suggestOnTriggerCharacters:!0,acceptSuggestionOnEnter:"on",acceptSuggestionOnCommitCharacter:!0,wordBasedSuggestions:!1,suggestSelection:"recentlyUsed",suggestFontSize:0,suggestLineHeight:0,tabCompletion:"off",gotoLocation:{multiple:"peek"},selectionHighlight:!0,occurrencesHighlight:!0,codeLens:!0,folding:!0,foldingStrategy:"auto",showFoldingControls:"mouseover",matchBrackets:!0,find:{seedSearchStringFromSelection:!0,autoFindInSelection:!1,globalFindClipboard:!1,addExtraSpaceOnTop:!0},colorDecorators:!0,lightbulbEnabled:r.ShowLightbulbIconMode.On,codeActionsOnSave:{},codeActionsOnSaveTimeout:750}},t.DIFF_EDITOR_DEFAULTS={renderIndicators:!0,minimap:!1,renderSideBySide:!0,ignoreTrimWhitespace:!1,hideUnchangedRegions:{enabled:!0,revealLineCount:20,minimumLineCount:3,contextLineCount:3},experimental:{showMoves:!1,showEmptyDecorations:!0,collapseUnchangedRegions:!0,stickyScroll:{enable:!1}}};const E={"editor.ariaLabel":{type:"string",default:t.EDITOR_DEFAULTS.viewInfo.ariaLabel,description:"%editor.configuration.ariaLabel%"},"editor.extraEditorClassName":{type:"string",description:"%editor.configuration.extraEditorClassName%"},"editor.fixedOverflowWidgets":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.fixedOverflowWidgets,description:"%editor.configuration.fixedOverflowWidgets%"},"editor.revealHorizontalRightPadding":{type:"number",description:"%editor.configuration.revealHorizontalRightPadding%"},"editor.selectOnLineNumbers":{type:"boolean",description:"%editor.configuration.selectOnLineNumbers%"},"editor.wordWrapMinified":{type:"boolean",description:"%editor.configuration.wordWrapMinified%"},"editor.wordWrapBreakAfterCharacters":{type:"string",default:" })]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63",description:"%editor.configuration.wordWrapBreakAfterCharacters%"},"editor.wrappingStrategy":{type:"string",enum:["advanced","simple"],default:"simple",description:"%editor.configuration.wrappingStrategy%"},"editor.wordWrapBreakBeforeCharacters":{type:"string",default:"([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B",description:"%editor.configuration.wordWrapBreakBeforeCharacters%"},"editor.lineNumbersMinChars":{type:"number",default:t.EDITOR_DEFAULTS.lineNumbersMinChars,description:"%editor.configuration.lineNumbersMinChars%"},"editor.lineDecorationsWidth":{type:"number",default:t.EDITOR_DEFAULTS.lineDecorationsWidth,description:"%editor.configuration.lineDecorationsWidth%"},"editor.fontFamily":{type:"string",default:t.EDITOR_FONT_DEFAULTS.fontFamily,description:"%editor.configuration.fontFamily%"},"editor.fontWeight":{type:"string",default:t.EDITOR_FONT_DEFAULTS.fontWeight,description:"%editor.configuration.fontWeight%"},"editor.fontSize":{type:"number",default:t.EDITOR_FONT_DEFAULTS.fontSize,description:(0,n.localize)("fontSize","Controls the font size in pixels.")},"editor.lineHeight":{type:"number",default:t.EDITOR_FONT_DEFAULTS.lineHeight,description:(0,n.localize)("lineHeight","Controls the line height. Use 0 to compute the line height from the font size.")},"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[(0,n.localize)("editor.configuration.suggest.insertMode.insert","Insert suggestion without overwriting text right of the cursor."),(0,n.localize)("editor.configuration.suggest.insertMode.replace","Insert suggestion and overwrite text right of the cursor.")],default:"insert",description:"%editor.configuration.suggest.insertMode%"},"editor.suggest.filterGraceful":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.filterGraceful,description:"%editor.configuration.suggest.filterGraceful%"},"editor.suggest.localityBonus":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.localityBonus,description:"%editor.configuration.suggest.localityBonus%"},"editor.suggest.shareSuggestSelections":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.shareSuggestSelections,description:"%editor.configuration.suggest.shareSuggestSelections%"},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.snippetsPreventQuickSuggestions,description:"%editor.configuration.suggest.snippetsPreventQuickSuggestions%"},"editor.suggest.showIcons":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.showIcons,description:"%editor.configuration.suggest.showIcons%"},"editor.suggest.maxVisibleSuggestions":{type:"number",default:t.EDITOR_SUGGEST_DEFAULTS.maxVisibleSuggestions,minimum:1,maximum:15,description:"%editor.configuration.suggest.maxVisibleSuggestions%"},"editor.suggest.showMethods":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showMethods%"},"editor.suggest.showFunctions":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showFunctions%"},"editor.suggest.showConstructors":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showConstructors%"},"editor.suggest.showFields":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showFields%"},"editor.suggest.showVariables":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showVariables%"},"editor.suggest.showClasses":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showClasss%"},"editor.suggest.showStructs":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showStructs%"},"editor.suggest.showInterfaces":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showInterfaces%"},"editor.suggest.showModules":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showModules%"},"editor.suggest.showProperties":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showPropertys%"},"editor.suggest.showEvents":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showEvents%"},"editor.suggest.showOperators":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showOperators%"},"editor.suggest.showUnits":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showUnits%"},"editor.suggest.showValues":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showValues%"},"editor.suggest.showConstants":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showConstants%"},"editor.suggest.showEnums":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showEnums%"},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showEnumMembers%"},"editor.suggest.showKeywords":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showKeywords%"},"editor.suggest.showWords":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showTexts%"},"editor.suggest.showColors":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showColors%"},"editor.suggest.showFiles":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showFiles%"},"editor.suggest.showReferences":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showReferences%"},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showCustomcolors%"},"editor.suggest.showFolders":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showFolders%"},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showTypeParameters%"},"editor.suggest.showSnippets":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showSnippets%"},"editor.suggest.showUsers":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showUsers%"},"editor.suggest.showIssues":{type:"boolean",default:!0,description:"%editor.configuration.suggest.showIssues%"},"editor.suggest.statusBar.visible":{type:"boolean",default:!1,description:"%editor.configuration.suggest.statusBar.visible%"},"editor.suggest.preview":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.preview,description:"%editor.configuration.suggest.preview%"},"editor.suggest.details.visible":{type:"boolean",default:t.EDITOR_SUGGEST_DEFAULTS.detailsVisible,description:"%editor.configuration.suggest.details.visible%"},"editor.inlineSuggest.enabled":{type:"boolean",default:t.EDITOR_INLINE_SUGGEST_DEFAULTS.enabled,description:"%editor.configuration.inlineSuggest.enabled%"},"editor.inlineSuggest.showToolbar":{type:"string",default:t.EDITOR_INLINE_SUGGEST_DEFAULTS.showToolbar,enum:["always","onHover","never"],enumDescriptions:[(0,n.localize)("editor.configuration.inlineSuggest.showToolbar.always","Show the inline suggestion toolbar whenever an inline suggestion is shown."),(0,n.localize)("editor.configuration.inlineSuggest.showToolbar.onHover","Show the inline suggestion toolbar when hovering over an inline suggestion."),(0,n.localize)("editor.configuration.inlineSuggest.showToolbar.never","Never show the inline suggestion toolbar.")],description:"%editor.configuration.inlineSuggest.showToolbar%"},"editor.experimental.stickyScroll.enabled":{type:"boolean",default:!0,description:"%editor.configuration.experimental.stickyScroll%"},"editor.customCodeActionMenu.showHeaders":{type:"boolean",default:!0,description:"%editor.configuration.customCodeActionMenu.showHeaders"},"editor.useCustomCodeActionMenu":{type:"boolean",default:!0,description:"%editor.configuration.useCustomCodeActionMenu%"},"editor.letterSpacing":{type:"number",default:t.EDITOR_FONT_DEFAULTS.letterSpacing,description:"%editor.configuration.letterSpacing%"},"editor.lineNumbers":{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[(0,n.localize)("editor.configuration.lineNumbers.off","Line numbers are not rendered."),(0,n.localize)("editor.configuration.lineNumbers.on","Line numbers are rendered as absolute number."),(0,n.localize)("editor.configuration.lineNumbers.relative","Line numbers are rendered as distance in lines to cursor position."),(0,n.localize)("editor.configuration.lineNumbers.interval","Line numbers are rendered every 10 lines.")],default:"on",description:"%editor.configuration.lineNumbers%"},"editor.renderFinalNewline":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.renderFinalNewline,description:"%editor.configuration.renderFinalNewline%"},"editor.rulers":{type:"array",items:{type:"number"},default:t.EDITOR_DEFAULTS.viewInfo.rulers,description:"%editor.configuration.rulers%"},"editor.wordSeparators":{type:"string",default:t.EDITOR_DEFAULTS.wordSeparators,description:"%editor.configuration.wordSeparators%"},"editor.tabSize":{type:"number",default:t.EDITOR_MODEL_DEFAULTS.tabSize,minimum:1,markdownDescription:"%editor.configuration.tabSize%"},"editor.insertSpaces":{type:"boolean",default:t.EDITOR_MODEL_DEFAULTS.insertSpaces,markdownDescription:"%editor.configuration.insertSpaces%"},"editor.detectIndentation":{type:"boolean",default:t.EDITOR_MODEL_DEFAULTS.detectIndentation,markdownDescription:"%editor.configuration.detectIndentation%"},"editor.roundedSelection":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.roundedSelection,description:"%editor.configuration.roundedSelection%"},"editor.scrollBeyondLastLine":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.scrollBeyondLastLine,description:"%editor.configuration.scrollBeyondLastLine%"},"editor.scrollBeyondLastColumn":{type:"number",default:t.EDITOR_DEFAULTS.viewInfo.scrollBeyondLastColumn,description:"%editor.configuration.scrollBeyondLastColumn%"},"editor.smoothScrolling":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.smoothScrolling,description:"%editor.configuration.smoothScrolling%"},"editor.minimap.enabled":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.minimap.enabled,description:"%editor.configuration.minimap.enabled%"},"editor.minimap.side":{type:"string",enum:["left","right"],default:t.EDITOR_DEFAULTS.viewInfo.minimap.side,description:"%editor.configuration.minimap.side%"},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:t.EDITOR_DEFAULTS.viewInfo.minimap.showSlider,description:"%editor.configuration.minimap.showSlider%"},"editor.minimap.renderCharacters":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.minimap.renderCharacters,description:"%editor.configuration.minimap.renderCharacters%"},"editor.minimap.maxColumn":{type:"number",default:t.EDITOR_DEFAULTS.viewInfo.minimap.maxColumn,description:"%editor.configuration.minimap.maxColumn%"},"editor.hover.enabled":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.hover.enabled,description:"%editor.configuration.hover.enabled%"},"editor.hover.delay":{type:"number",default:t.EDITOR_DEFAULTS.contribInfo.hover.delay,description:"%editor.configuration.hover.delay%"},"editor.hover.sticky":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.hover.sticky,description:"%editor.configuration.hover.sticky%"},"editor.hover.hidingDelay":{type:"number",default:t.EDITOR_DEFAULTS.contribInfo.hover.hidingDelay,description:"%editor.configuration.hover.hidingDelay%"},"editor.hover.above":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.hover.above,description:"%editor.configuration.hover.above%"},"editor.find.seedSearchStringFromSelection":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.find.seedSearchStringFromSelection,description:"%editor.configuration.find.seedSearchStringFromSelection%"},"editor.find.autoFindInSelection":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.find.autoFindInSelection,description:"%editor.configuration.find.autoFindInSelection%"},"editor.find.globalFindClipboard":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.find.globalFindClipboard,description:"%editor.configuration.find.globalFindClipboard%",included:n.isOSX},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:!0,description:"%editor.configuration.find.addExtraSpaceOnTop%"},"editor.wordWrap":{type:"string",enum:["off","on","wordWrapColumn","bounded"],markdownEnumDescriptions:[(0,n.localize)("editor.configuration.wordWrap.off","Lines will never wrap."),(0,n.localize)("editor.configuration.wordWrap.on","Lines will wrap at the viewport width."),(0,n.localize)("editor.configuration.wordWrap.wordWrapColumn","Lines will wrap at `#editor.wordWrapColumn#`."),(0,n.localize)("editor.configuration.wordWrap.bounded","Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],default:t.EDITOR_DEFAULTS.wordWrap,description:"%editor.configuration.wordWrap%"},"editor.wordWrapColumn":{type:"integer",default:t.EDITOR_DEFAULTS.wordWrapColumn,minimum:1,markdownDescription:"%editor.configuration.wordWrapColumn%"},"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[(0,n.localize)("editor.configuration.wrappingIndent.none","No indentation. Wrapped lines begin at column 1."),(0,n.localize)("editor.configuration.wrappingIndent.same","Wrapped lines get the same indentation as the parent."),(0,n.localize)("editor.configuration.wrappingIndent.indent","Wrapped lines get +1 indentation toward the parent."),(0,n.localize)("editor.configuration.wrappingIndent.deepIndent","Wrapped lines get +2 indentation toward the parent.")],default:"same",description:"%editor.configuration.wrappingIndent%"},"editor.mouseWheelScrollSensitivity":{type:"number",default:t.EDITOR_DEFAULTS.viewInfo.scrollbar.mouseWheelScrollSensitivity,markdownDescription:"%editor.configuration.mouseWheelScrollSensitivity%"},"editor.fastScrollSensitivity":{type:"number",default:t.EDITOR_DEFAULTS.viewInfo.scrollbar.fastScrollSensitivity,markdownDescription:"%editor.configuration.fastScrollSensitivity%"},"editor.multiCursorModifier":{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[(0,n.localize)("editor.configuration.multiCursorModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),(0,n.localize)("editor.configuration.multiCursorModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"alt",markdownDescription:(0,n.localize)("multiCursorModifier","The modifier to be used to add multiple cursors with the mouse. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")},"editor.multiCursorMergeOverlapping":{type:"boolean",default:t.EDITOR_DEFAULTS.multiCursorMergeOverlapping,description:"%editor.configuration.multiCursorMergeOverlapping%"},"editor.quickSuggestions":{anyOf:[{type:"boolean"},{type:"object",properties:{strings:{type:"boolean",default:!1,description:(0,n.localize)("editor.configuration.quickSuggestions.strings","Enable quick suggestions inside strings.")},comments:{type:"boolean",default:!1,description:(0,n.localize)("editor.configuration.quickSuggestions.comments","Enable quick suggestions inside comments.")},other:{type:"boolean",default:!0,description:"%editor.configuration.quickSuggestions.other%"}}}],default:t.EDITOR_DEFAULTS.contribInfo.quickSuggestions,description:"%editor.configuration.quickSuggestions%"},"editor.quickSuggestionsDelay":{type:"integer",default:t.EDITOR_DEFAULTS.contribInfo.quickSuggestionsDelay,minimum:0,description:"%editor.configuration.quickSuggestionsDelay%"},"editor.parameterHints.enabled":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.parameterHints.enabled,description:"%editor.configuration.parameterHints.enabled%"},"editor.parameterHints.cycle":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.parameterHints.cycle,description:"%editor.configuration.parameterHints.cycle%"},"editor.autoClosingBrackets":{type:"string",enum:["always","languageDefined","beforeWhitespace","never"],enumDescriptions:["",(0,n.localize)("editor.configuration.autoClosingBrackets.languageDefined","Use language configurations to determine when to autoclose brackets."),(0,n.localize)("editor.configuration.autoClosingBrackets.beforeWhitespace","Autoclose brackets only when the cursor is to the left of whitespace."),""],default:t.EDITOR_DEFAULTS.autoClosingBrackets,description:"%editor.configuration.autoClosingBrackets%"},"editor.autoClosingQuotes":{type:"string",enum:["always","languageDefined","beforeWhitespace","never"],enumDescriptions:["",(0,n.localize)("editor.configuration.autoClosingQuotes.languageDefined","Use language configurations to determine when to autoclose quotes."),(0,n.localize)("editor.configuration.autoClosingQuotes.beforeWhitespace","Autoclose quotes only when the cursor is to the left of whitespace."),""],default:t.EDITOR_DEFAULTS.autoClosingQuotes,description:"%editor.configuration.autoClosingQuotes%"},"editor.autoSurround":{type:"string",enum:["languageDefined","brackets","quotes","never"],enumDescriptions:[(0,n.localize)("editor.configuration.autoSurround.languageDefined","Use language configurations to determine when to automatically surround selections."),(0,n.localize)("editor.configuration.autoSurround.brackets","Surround with brackets but not quotes."),(0,n.localize)("editor.configuration.autoSurround.quotes","Surround with quotes but not brackets."),""],default:t.EDITOR_DEFAULTS.autoSurround,description:"%editor.configuration.autoSurround%"},"editor.formatOnType":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.formatOnType,description:"%editor.configuration.formatOnType%"},"editor.formatOnPaste":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.formatOnPaste,description:"%editor.configuration.formatOnPaste%"},"editor.autoIndent":{type:"boolean",default:t.EDITOR_DEFAULTS.autoIndent,description:"%editor.configuration.autoIndent%"},"editor.suggestOnTriggerCharacters":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.suggestOnTriggerCharacters,description:"%editor.configuration.suggestOnTriggerCharacters%"},"editor.acceptSuggestionOnEnter":{type:"string",enum:["on","smart","off"],default:t.EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnEnter,markdownEnumDescriptions:["",(0,n.localize)("editor.configuration.acceptSuggestionOnEnterSmart","Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:(0,n.localize)("editor.configuration.acceptSuggestionOnEnter","Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")},"editor.acceptSuggestionOnCommitCharacter":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnCommitCharacter,markdownDescription:(0,n.localize)("editor.configuration.acceptSuggestionOnCommitCharacter","Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")},"editor.snippetSuggestions":{type:"string",enum:["top","bottom","inline","none"],enumDescriptions:[(0,n.localize)("editor.configuration.snippetSuggestions.top","Show snippet suggestions on top of other suggestions."),(0,n.localize)("editor.configuration.snippetSuggestions.bottom","Show snippet suggestions below other suggestions."),(0,n.localize)("editor.configuration.snippetSuggestions.inline","Show snippets suggestions with other suggestions."),(0,n.localize)("editor.configuration.snippetSuggestions.none","Do not show snippet suggestions.")],default:"inline",description:"%editor.configuration.snippetSuggestions%"},"editor.emptySelectionClipboard":{type:"boolean",default:t.EDITOR_DEFAULTS.emptySelectionClipboard,description:"%editor.configuration.emptySelectionClipboard%"},"editor.copyWithSyntaxHighlighting":{type:"boolean",default:t.EDITOR_DEFAULTS.copyWithSyntaxHighlighting,description:"%editor.configuration.copyWithSyntaxHighlighting%"},"editor.wordBasedSuggestions":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.wordBasedSuggestions,description:"%editor.configuration.wordBasedSuggestions%"},"editor.suggestSelection":{type:"string",enum:["first","recentlyUsed","recentlyUsedByPrefix"],markdownEnumDescriptions:[(0,n.localize)("editor.configuration.suggestSelection.first","Always select the first suggestion."),(0,n.localize)("editor.configuration.suggestSelection.recentlyUsed","Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),(0,n.localize)("editor.configuration.suggestSelection.recentlyUsedByPrefix","Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],default:"recentlyUsed",description:"%editor.configuration.suggestSelection%"},"editor.suggestFontSize":{type:"integer",default:0,minimum:0,markdownDescription:"%editor.configuration.suggestFontSize%"},"editor.suggestLineHeight":{type:"integer",default:0,minimum:0,markdownDescription:"%editor.configuration.suggestLineHeight%"},"editor.tabCompletion":{type:"string",default:"off",enum:["on","off","onlySnippets"],enumDescriptions:[(0,n.localize)("editor.configuration.tabCompletion.on","Tab complete will insert the best matching suggestion when pressing tab."),(0,n.localize)("editor.configuration.tabCompletion.off","Disable tab completions."),(0,n.localize)("editor.configuration.tabCompletion.onlySnippets","Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:"%editor.configuration.tabCompletion%"},"editor.suggest.filteredTypes":{type:"object",default:{keyword:!0,snippet:!0},markdownDescription:"%editor.configuration.suggest.filtered%",properties:{method:{type:"boolean",default:!0,markdownDescription:(0,n.localize)("editor.configuration.suggest.filtered.method","When set to `false` IntelliSense never shows `method` suggestions.")},function:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.function%"},constructor:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.constructor%"},field:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.field%"},variable:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.variable%"},class:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.class%"},struct:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.struct%"},interface:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.interface%"},module:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.module%"},property:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.property%"},event:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.event%"},operator:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.operator%"},unit:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.unit%"},value:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.value"},constant:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.constant%"},enum:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.enum%"},enumMember:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.enumMember%"},keyword:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.keyword%"},text:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.text%"},color:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.color%"},file:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.file%"},reference:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.reference%"},customcolor:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.customcolor%"},folder:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.folder%"},typeParameter:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.typeParameter%"},snippet:{type:"boolean",default:!0,markdownDescription:"%editor.configuration.suggest.filtered.snippet%"}}},"editor.gotoLocation.multiple":{description:"%editor.configuration.editor.gotoLocation.multiple%",type:"string",enum:["peek","gotoAndPeek","goto"],default:t.EDITOR_DEFAULTS.contribInfo.gotoLocation.multiple,enumDescriptions:[(0,n.localize)("editor.configuration.gotoLocation.multiple.peek","Show peek view of the results (default)"),(0,n.localize)("editor.configuration.gotoLocation.multiple.gotoAndPeek","Go to the primary result and show a peek view"),(0,n.localize)("editor.configuration.gotoLocation.multiple.goto","Go to the primary result and enable peek-less navigation to others")]},"editor.selectionHighlight":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.selectionHighlight,description:"%editor.configuration.selectionHighlight%"},"editor.columnSelection":{type:"boolean",default:t.EDITOR_DEFAULTS.columnSelection,description:"%editor.configuration.columnSelection%"},"editor.occurrencesHighlight":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.occurrencesHighlight,description:"%editor.configuration.occurrencesHighlight%"},"editor.overviewRulerLanes":{type:"integer",default:3,description:"%editor.configuration.overviewRulerLanes%"},"editor.overviewRulerBorder":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.overviewRulerBorder,description:"%editor.configuration.overviewRulerBorder%"},"editor.cursorBlinking":{type:"string",enum:["blink","smooth","phase","expand","solid"],default:"blink",description:"%editor.configuration.cursorBlinking%"},"editor.mouseWheelZoom":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.mouseWheelZoom,markdownDescription:"%editor.configuration.mouseWheelZoom%"},"editor.cursorSmoothCaretAnimation":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.cursorSmoothCaretAnimation,description:"%editor.configuration.cursorSmoothCaretAnimation%"},"editor.cursorStyle":{type:"string",enum:["block","block-outline","line","line-thin","underline","underline-thin"],default:t.EDITOR_FONT_DEFAULTS.cursorStyle,description:"%editor.configuration.cursorStyle%"},"editor.cursorWidth":{type:"integer",default:t.EDITOR_DEFAULTS.viewInfo.cursorWidth,markdownDescription:"%editor.configuration.cursorWidth%"},"editor.fontLigatures":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.fontLigatures,description:"%editor.configuration.fontLigatures%"},"editor.hideCursorInOverviewRuler":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.hideCursorInOverviewRuler,description:"%editor.configuration.hideCursorInOverviewRuler%"},"editor.renderWhitespace":{type:"string",enum:["none","boundary","selection","all"],enumDescriptions:["",(0,n.localize)("editor.configuration.renderWhitespace.boundary","Render whitespace characters except for single spaces between words."),(0,n.localize)("editor.configuration.renderWhitespace.selection","Render whitespace characters only on selected text."),""],default:t.EDITOR_DEFAULTS.viewInfo.renderWhitespace,description:"%editor.configuration.renderWhitespace%"},"editor.rename.enablePreview":{type:"boolean",default:!0,description:"%editor.configuration.rename.enablePreview%"},"editor.renderControlCharacters":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.renderControlCharacters,description:"%editor.configuration.renderControlCharacters%"},"editor.guides.indentation":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.guides.indentation,description:"%editor.configuration.guides.indentation%"},"editor.guides.highlightActiveIndentation":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.guides.highlightActiveIndentGuide,description:"%editor.configuration.guides.highlightActiveIndentation%"},"editor.guides.bracketPairs":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.guides.bracketPairs,description:"%editor.configuration.guides.bracketPairs%"},"editor.renderLineHighlight":{type:"string",enum:["none","gutter","line","all"],enumDescriptions:["","","",(0,n.localize)("editor.configuration.renderLineHighlight.all","Highlights both the gutter and the current line.")],default:t.EDITOR_DEFAULTS.viewInfo.renderLineHighlight,description:"%editor.configuration.renderLineHighlight%"},"editor.codeLens":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.codeLens,description:"%editor.configuration.codeLens%"},"editor.folding":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.folding,description:"%editor.configuration.folding%"},"editor.foldingStrategy":{type:"string",enum:["auto","indentation"],default:t.EDITOR_DEFAULTS.contribInfo.foldingStrategy,markdownDescription:"%editor.configuration.foldingStrategy%"},"editor.showFoldingControls":{type:"string",enum:["always","mouseover"],default:t.EDITOR_DEFAULTS.contribInfo.showFoldingControls,description:"%editor.configuration.showFoldingControls%"},"editor.matchBrackets":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.matchBrackets,description:"%editor.configuration.matchBrackets%"},"editor.glyphMargin":{type:"boolean",default:t.EDITOR_DEFAULTS.viewInfo.glyphMargin,description:"%editor.configuration.glyphMargin%"},"editor.useTabStops":{type:"boolean",default:t.EDITOR_DEFAULTS.useTabStops,description:"%editor.configuration.useTabStops%"},"editor.trimAutoWhitespace":{type:"boolean",default:t.EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,description:"%editor.configuration.trimAutoWhitespace%"},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:"%editor.configuration.stablePeek%"},"editor.dragAndDrop":{type:"boolean",default:t.EDITOR_DEFAULTS.dragAndDrop,description:"%editor.configuration.dragAndDrop%"},"editor.accessibilitySupport":{type:"string",enum:["auto","on","off"],enumDescriptions:[(0,n.localize)("editor.configuration.accessibilitySupport.auto","The editor will use platform APIs to detect when a Screen Reader is attached."),(0,n.localize)("editor.configuration.accessibilitySupport.on","The editor will be permanently optimized for usage with a Screen Reader."),(0,n.localize)("editor.configuration.accessibilitySupport.off","The editor will never be optimized for usage with a Screen Reader.")],default:t.EDITOR_DEFAULTS.accessibilitySupport,description:(0,n.localize)("accessibilitySupport","Controls whether the editor should run in a mode where it is optimized for screen readers.")},"editor.showUnused":{type:"boolean",default:t.EDITOR_DEFAULTS.showUnused,description:"%editor.configuration.showUnused%"},"editor.comments.insertSpace":{type:"boolean",default:!0,description:"%editor.configuration.comments.insertSpace%"},"editor.comments.ignoreEmptyLines":{type:"boolean",default:!0,description:"%editor.configuration.comments.ignoreEmptyLines%"},"editor.links":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.links,description:"%editor.configuration.links%"},"editor.colorDecorators":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.colorDecorators,description:"%editor.configuration.colorDecorators%"},"editor.lightbulb.enabled":{type:"string",default:t.EDITOR_DEFAULTS.contribInfo.lightbulbEnabled,enum:[r.ShowLightbulbIconMode.Off,r.ShowLightbulbIconMode.OnCode,r.ShowLightbulbIconMode.On],enumDescriptions:[],description:"%editor.configuration.lightbulb.enabled%"},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:"%editor.configuration.maxTokenizationLineLength%"},"editor.codeActionsOnSave":{type:"object",properties:{"source.organizeImports":{type:"boolean",description:"%editor.configuration.codeActionsOnSave.organizeImports%"},"source.fixAll":{type:"boolean",description:"%editor.configuration.codeActionsOnSave.fixAll%"}},additionalProperties:{type:"boolean"},default:t.EDITOR_DEFAULTS.contribInfo.codeActionsOnSave,description:"%editor.configuration.codeActionsOnSave%"},"editor.codeActionsOnSaveTimeout":{type:"number",default:t.EDITOR_DEFAULTS.contribInfo.codeActionsOnSaveTimeout,description:"%editor.configuration.codeActionsOnSaveTimeout%"},"editor.codeActionsOnSaveNotification":{type:"boolean",default:!0,description:"%editor.configuration.codeActionsOnSaveNotification%"},"editor.selectionClipboard":{type:"boolean",default:t.EDITOR_DEFAULTS.contribInfo.selectionClipboard,description:"%editor.configuration.selectionClipboard%",included:n.isLinux},"editor.largeFileOptimizations":{type:"boolean",default:t.EDITOR_MODEL_DEFAULTS.largeFileOptimizations,description:"%editor.configuration.largeFileOptimizations%"},"editor.defaultFormatter":{type:"string",description:"%editor.configuration.defaultFormatter%"},"editor.unicodeHighlight.ambiguousCharacters":{type:"boolean",default:!0,description:"%editor.configuration.unicodeHighlight.ambiguousCharacters%"},"editor.unicodeHighlight.allowedCharacters":{type:"object",default:{},description:"%editor.configuration.unicodeHighlight.allowedCharacters%"},"editor.unicodeHighlight.allowedLocales":{type:"object",default:{},description:"%editor.configuration.unicodeHighlight.allowedLocales%"},"diffEditor.renderIndicators":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.renderIndicators,description:"%editor.configuration.renderIndicators%"},"diffEditor.minimap":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.minimap},"diffEditor.experimental.stickyScroll.enabled":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.experimental.stickyScroll.enable}},p={"editor.tokenColorCustomizations":{type:"object",description:"%editor.configuration.tokenColorCustomizations%",default:{}},"editor.askIfDiff":{type:"boolean",default:!0,description:"%editor.configuration.askIfDiff%"},"editor.showActionWhenGroupEmpty":{type:"boolean",default:!1,description:"%editor.configuration.showActionWhenGroupEmpty%"},"editor.autoSave":{type:"string",enum:["off","afterDelay","editorFocusChange","windowLostFocus"],default:"off",description:"%editor.configuration.autoSave%"},"editor.autoSaveDelay":{type:"number",default:1e3,markdownDescription:"%editor.configuration.autoSaveDelay%"},"editor.preferredFormatter":{type:"object",default:{},description:"%editor.configuration.preferredFormatter%"},"editor.previewMode":{type:"boolean",default:!0,description:"%editor.configuration.previewMode%"},"editor.preventScrollAfterFocused":{type:"boolean",default:!1,description:"%editor.configuration.preventScrollAfterFocused%"},"editor.wrapTab":{type:"boolean",default:!1,description:"%editor.configuration.wrapTab%"},"editor.enablePreviewFromCodeNavigation":{type:"boolean",default:!1,markdownDescription:"%editor.configuration.enablePreviewFromCodeNavigation%"},"editor.minimap":{type:"boolean",default:!0},"editor.forceReadOnly":{type:"boolean",default:!1,description:"%editor.configuration.forceReadOnly%"},"editor.languageFeatureEnabledMaxSize":{type:"number",default:4*1024*1024*1024,description:"%editor.configuration.languageFeatureEnabledMaxSize%"},"editor.docExtHostSyncMaxSize":{type:"number",default:4*1024*1024*1024,description:"%editor.configuration.docExtHostSyncMaxSize%"},"editor.renderLineHighlight":{type:"string",enum:["none","gutter","line","all"],default:"all",description:"%editor.configuration.renderLineHighlight%"},"editor.fontFamily":{type:"string",default:t.EDITOR_FONT_DEFAULTS.fontFamily},"editor.fontSize":{type:"number",default:t.EDITOR_FONT_DEFAULTS.fontSize,minimum:6},"editor.tabSize":{type:"number",default:t.EDITOR_FONT_DEFAULTS.tabSize,minimum:1,description:"%editor.configuration.tabSize%"},"editor.formatOnPaste":{type:"boolean",default:!1},"editor.detectIndentation":{type:"boolean",default:!0},"editor.renderWhitespace":{type:"boolean",default:t.EDITOR_FONT_DEFAULTS.renderWhitespace},"editor.cursorStyle":{type:"string",enum:["line","block","block-outline","line-thin","underline","underline-thin"],default:t.EDITOR_FONT_DEFAULTS.cursorStyle},"editor.insertSpaces":{type:"boolean",default:t.EDITOR_FONT_DEFAULTS.insertSpace},"editor.wordWrap":{type:"string",enum:["off","on"],default:t.EDITOR_FONT_DEFAULTS.wordWrap},"editor.wordWrapColumn":{type:"number",default:t.EDITOR_FONT_DEFAULTS.wordWrapColumn,description:"%editor.configuration.wordWrapColumn%"},"editor.readonlyFiles":{type:"array",default:[],items:{type:"string"}},"editor.formatOnSave":{type:"boolean",default:!1,description:"%editor.configuration.formatOnSave%"},"editor.formatOnSaveTimeout":{type:"number",default:750,markdownDescription:"%editor.configuration.formatOnSaveTimeout%"},"editor.lineHeight":{type:"number",default:0,description:"%editor.lineHeight.description%"},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:"%editor.configuration.maxTokenizationLineLength%"},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[(0,n.localize)("editor.configuration.semanticHighlighting.true","Semantic highlighting enabled for all color themes."),(0,n.localize)("editor.configuration.semanticHighlighting.false","Semantic highlighting disabled for all color themes."),(0,n.localize)("editor.configuration.semanticHighlighting.configuredByTheme","Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:!0,description:"%editor.configuration.semanticHighlighting.enabled%"},"editor.bracketPairColorization.enabled":{type:"boolean",default:!0,description:"%editor.configuration.bracketPairColorization.enabled%"},"editor.largeFile":{type:"number",default:4*1024*1024*1024,description:"%editor.configuration.largeFileSize%"},"editor.quickSuggestionsDelay":{type:"integer",default:100,description:"%editor.configuration.quickSuggestionsDelay%"},"editor.modelDisposeTime":{type:"integer",default:3e3},"workbench.editorAssociations":{type:"object",markdownDescription:"%editor.configuration.workbench.editorAssociations%",default:{},additionalProperties:{type:"string"}},"editor.experimental.stickyScroll.enabled":{type:"boolean",default:!1,description:"%editor.configuration.experimental.stickyScroll.enabled%"},"editor.mouseBackForwardToNavigate":{type:"boolean",default:!0,description:"%editor.configuration.mouseBackForwardToNavigate%"},"diffEditor.renderSideBySide":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.renderSideBySide,description:"%diffEditor.configuration.renderSideBySide%"},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.ignoreTrimWhitespace,description:"%diffEditor.configuration.ignoreTrimWhitespace%"},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.hideUnchangedRegions.enabled,description:"Controls whether the diff editor shows unchanged regions."},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:t.DIFF_EDITOR_DEFAULTS.hideUnchangedRegions.revealLineCount,description:"Controls how many lines are used for unchanged regions.",minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:t.DIFF_EDITOR_DEFAULTS.hideUnchangedRegions.minimumLineCount,description:"Controls how many lines are used as a minimum for unchanged regions.",minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:t.DIFF_EDITOR_DEFAULTS.hideUnchangedRegions.contextLineCount,description:"Controls how many lines are used as context when comparing unchanged regions.",minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.experimental.showMoves,description:"Controls whether the diff editor should show detected code moves."},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.experimental.showEmptyDecorations,description:"Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted."},"diffEditor.experimental.collapseUnchangedRegions":{type:"boolean",default:t.DIFF_EDITOR_DEFAULTS.experimental.collapseUnchangedRegions,description:"Controls whether the diff editor shows unchanged regions."}};t.editorPreferenceSchema={type:"object",properties:{...E,...p}},t.EditorPreferences=Symbol("EditorPreference")},90915:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createEditorPreferenceProxy=o;const n=e(41869),r=e(24328);function o(l,m,E){return(0,n.createPreferenceProxy)(l,r.editorPreferenceSchema,{resourceUri:m,overrideIdentifier:E})}},53135:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GoToLineQuickOpenHandler=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(74404),m=n.__importStar(e(20868)),E=e(55979),p=e(82196);class v extends E.AbstractGotoLineQuickAccessProvider{clearDecorations(c){super.clearDecorations(c)}preview(c,h){c.revealRangeInCenter(h,m.editor.ScrollType.Smooth),this.addDecorations(c,h)}goTo(c,h,d=!0){this.gotoLocation({editor:c},{range:h,preserveFocus:d,keyMods:{alt:!1,ctrlCmd:!1}})}}let s=class{constructor(){this.prefix=":",this.description=(0,o.localize)("quickopen.goToLine.desc"),this.quickAccess=new v}getFirstSelection(){const c=this.workbenchEditorService.currentEditor,h=c?.getSelections();return h?.[0]}getRange(c=1,h=1){return{startLineNumber:c,endLineNumber:c,startColumn:h,endColumn:h}}init(){var c;this.savedViewState=(0,o.withNullAsUndefined)((c=this.workbenchEditorService.currentEditor)===null||c===void 0?void 0:c.monacoEditor.saveViewState())}getModel(){var c,h,d,u,_;const f=this.workbenchEditorService.currentEditor,a=this.getFirstSelection();if(!a||!f)return{onType:(A,w)=>{w([new l.QuickOpenItem({label:(0,o.localize)("quickopen.goToLine.notValid"),run:()=>!1})])}};const b=(c=a.positionLineNumber)!==null&&c!==void 0?c:1,y=(h=a.positionColumn)!==null&&h!==void 0?h:1,S=(_=(u=(d=f.currentDocumentModel)===null||d===void 0?void 0:d.getMonacoModel())===null||u===void 0?void 0:u.getLineCount())!==null&&_!==void 0?_:1;return{onType:(A,w)=>{const T=A.split(/,|:|#|:|,/).map(O=>parseInt(O,10)).filter(O=>!isNaN(O)),D=T[0],I=T[1];if(D){let O=(0,o.formatLocalize)("quickopen.goToLine.lineInfo",D);I&&(O+=(0,o.formatLocalize)("quickopen.goToLine.colInfo",I));const L=this.getRange(D,I);w([new l.QuickOpenItem({label:O,run:R=>R===l.Mode.PREVIEW?(this.quickAccess.preview(f.monacoEditor,L),!1):(this.quickAccess.goTo(f.monacoEditor,L,!0),!0)})])}else this.quickAccess.clearDecorations(f.monacoEditor),w([new l.QuickOpenItem({label:(0,o.formatLocalize)("quickopen.goToLine.defaultMessage",b,y,S),run:()=>!1})])}}}getOptions(){return{}}onClose(c){const h=this.workbenchEditorService.currentEditor;h&&(h.monacoEditor.focus(),this.quickAccess.clearDecorations(h.monacoEditor),c&&this.savedViewState&&h.monacoEditor.restoreViewState(this.savedViewState))}};t.GoToLineQuickOpenHandler=s,n.__decorate([(0,r.Autowired)(l.PrefixQuickOpenService),n.__metadata("design:type",Object)],s.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],s.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(p.WorkbenchEditorService),n.__metadata("design:type",p.WorkbenchEditorService)],s.prototype,"workbenchEditorService",void 0),t.GoToLineQuickOpenHandler=s=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],s)},50236:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SymbolInformationQuickOpenItem=t.WorkspaceSymbolQuickOpenHandler=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(97821),E=e(51500),p=e(40540),v=e(23418);let s=class extends m.QuickOpenBaseAction{constructor(){super({id:"workspace-symbol:splitToRight",tooltip:(0,l.localize)("quickOpen.openOnTheRightSide"),class:(0,o.getIcon)("embed")})}async run(u){await u.openSide()}};s=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],s);let g=class{hasActions(){return!0}getActions(){return[this.workspaceSymbolOpenSideActionOpen]}};n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s)],g.prototype,"workspaceSymbolOpenSideActionOpen",void 0),g=n.__decorate([(0,r.Injectable)()],g);let c=class{constructor(){this.prefix="#",this.cancellationSource=new o.CancellationTokenSource}get description(){return(0,l.localize)("editor.workspaceSymbol.description")}getModel(){return{onType:(u,_)=>{if(u===""){_([new o.QuickOpenItem({label:(0,l.localize)("editor.workspaceSymbol.search"),run:()=>!1})]);return}if(u==="#")return void _([new o.QuickOpenItem({label:(0,l.localize)("editor.workspaceSymbolClass.search"),run:()=>!1})]);if(this.languageService.workspaceSymbolProviders.length===0){_([new o.QuickOpenItem({label:(0,l.localize)("editor.workspaceSymbol.notfound"),run:()=>!1})]);return}const f=u[0]==="#",a=[];this.cancellationSource.cancel();const b=new o.CancellationTokenSource;this.cancellationSource=b;const y={query:f?u.slice(1):u},S=this.reporterService.time(l.REPORT_NAME.QUICK_OPEN_MEASURE);Promise.all(this.languageService.workspaceSymbolProviders.map(async A=>{let w=await A.provideWorkspaceSymbols(y,b.token);if(f&&(w=w?.filter(T=>T.kind===p.SymbolKind.Class)),w&&w.length&&!b.token.isCancellationRequested){const T=await Promise.all(w.map(async D=>{const I=await this.workspaceService.asRelativePath(new o.URI(D.location.uri).parent);return new h(D,A,this.workbenchEditorService,b.token,I?.path||"")}));a.push(...T),_(a,this.workspaceSymbolActionProvider)}return w})).catch(A=>{this.logger.log(A)}).finally(()=>{b.token.isCancellationRequested||(a.length||_([]),S.timeEnd(f?"class":"symbol",{lookFor:u,stat:{symbol:a.length}}))})}}}getOptions(){return{fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:!1,getPlaceholderItem:(u,_)=>new o.QuickOpenItem({label:(0,l.localize)(_.startsWith("##")?"editor.workspaceSymbolClass.notfound":"editor.workspaceSymbol.notfound"),run:()=>!1})}}onClose(){this.cancellationSource.cancel()}onToggle(){this.cancellationSource.cancel()}};t.WorkspaceSymbolQuickOpenHandler=c,n.__decorate([(0,r.Autowired)(v.ILanguageService),n.__metadata("design:type",Object)],c.prototype,"languageService",void 0),n.__decorate([(0,r.Autowired)(E.IWorkspaceService),n.__metadata("design:type",Object)],c.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(l.ILogger),n.__metadata("design:type",Object)],c.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],c.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",g)],c.prototype,"workspaceSymbolActionProvider",void 0),n.__decorate([(0,r.Autowired)(l.IReporterService),n.__metadata("design:type",Object)],c.prototype,"reporterService",void 0),t.WorkspaceSymbolQuickOpenHandler=c=n.__decorate([(0,r.Injectable)()],c);class h extends o.QuickOpenItem{constructor(u,_,f,a,b){super({}),this.symbol=u,this.provider=_,this.workbenchEditorService=f,this.token=a,this.relativePath=b}getLabel(){return this.symbol.name}getUri(){return new o.URI(this.symbol.location.uri)}getIconClass(){return(0,o.getSymbolIcon)(this.symbol.kind)}getDescription(){const u=this.symbol.containerName;return`${u?`${u} \xB7 `:""}${decodeURIComponent(this.relativePath)}`}fromRange(u){if(!u)return;const{start:_,end:f}=u;return{startLineNumber:_.line+1,startColumn:_.character+1,endLineNumber:f.line+1,endColumn:f.character+1}}open(u,_){this.workbenchEditorService.open(u,{range:this.fromRange(_)})}run(u){const _=this.getUri();return u===o.QuickOpenMode.OPEN&&this.provider.resolveWorkspaceSymbol(this.symbol,this.token).then(f=>{f?this.open(_,f.location.range):this.open(_,this.symbol.location.range)}),!0}openSide(){const u=this.getUri();return this.provider.resolveWorkspaceSymbol(this.symbol,this.token).then(_=>{this.workbenchEditorService.open(u,{preview:!1,split:v.EditorGroupSplitAction.Right,range:this.fromRange(_?_.location.range:this.symbol.location.range),focus:!0})})}}t.SymbolInformationQuickOpenItem=h},80200:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(23418),{addElement:E}=l.arrays;let p=class extends o.WithEventBus{constructor(){super(),this.providers=[],this.resources=new Map,this.gettingResources=new Map,this.resourceDecoration=new Map,this.cachedProvider=new l.LRUMap(500,200),this.onRegisterResourceProviderEmitter=new l.Emitter,this.onRegisterResourceProvider=this.onRegisterResourceProviderEmitter.event,this.onUnregisterResourceProviderEmitter=new l.Emitter,this.onUnregisterResourceProvider=this.onUnregisterResourceProviderEmitter.event}onResourceNeedUpdateEvent(c){const h=c.payload;if(this.resources.has(h.toString())){const d=this.resources.get(h.toString());this.doGetResource(h).then(u=>{d&&(Object.assign(d?.resource,u?.resource),d.provider=u?.provider),this.eventBus.fire(new m.ResourceDidUpdateEvent(h))})}}onResourceDecorationNeedChangeEvent(c){this.getResourceDecoration(c.payload.uri);let h=!1;const d=this.resourceDecoration.get(c.payload.uri.toString())||{};new Set([...Object.keys(d),...Object.keys(c.payload.decoration)]).forEach(u=>{d[u]!==c.payload.decoration[u]&&(h=!0)}),h&&(Object.assign(this.resourceDecoration.get(c.payload.uri.toString()),c.payload.decoration),this.eventBus.fire(new m.ResourceDecorationChangeEvent(c.payload)))}getSupportedSchemes(){return Array.from(this.providers.values()).map(c=>c.scheme).filter(Boolean)}async getResource(c){if(!this.resources.has(c.toString())){const h=await this.doGetResource(c);if(!h)return null;const d={resource:h.resource,provider:h.provider};this.resources.set(c.toString(),d)}return this.resources.get(c.toString()).resource}handlesUri(c){return!!this.calculateProvider(c)}async doGetResource(c){if(!this.gettingResources.has(c.toString())){const h=(async()=>{const d=this.calculateProvider(c);if(d){const u=await d.provideResource(c);return u.uri=c,{resource:u,provider:d}}else return this.logger.error("URI has no resource provider: "+c),null})();this.gettingResources.set(c.toString(),h),h.finally(()=>{this.gettingResources.delete(c.toString())})}return this.gettingResources.get(c.toString())}registerResourceProvider(c){this.onRegisterResourceProviderEmitter.fire(c);const h=new l.Disposable;return h.addDispose(E(this.providers,c)),h.addDispose({dispose:()=>{for(const d of this.resources.values())d.provider===c&&(d.provider=s,this.onUnregisterResourceProviderEmitter.fire(c));this.cachedProvider.clear()}}),this.cachedProvider.clear(),h}async shouldCloseResource(c,h){const d=this.getProvider(c.uri);return!d||!d.shouldCloseResource?!0:await d.shouldCloseResource(c,h)}async shouldCloseResourceWithoutConfirm(c){const h=this.getProvider(c.uri);return h&&h.shouldCloseResourceWithoutConfirm?await h.shouldCloseResourceWithoutConfirm(c):!1}async close(c,h){const d=this.getProvider(c.uri);return!d||!d.close?!0:await d.close(c,h)}calculateProvider(c){if(this.cachedProvider.has(c.toString()))return this.cachedProvider.get(c.toString());let h,d={weight:-1,index:-1};function u(_,f,a){d={weight:f,index:a},h=_}return this.providers.forEach((_,f)=>{let a=-1;_.handlesUri?a=_.handlesUri(c):_.scheme&&(a=_.scheme===c.scheme?10:-1),a>=0&&(a>d.weight||a===d.weight&&f>d.index)&&u(_,a,f)}),this.cachedProvider.set(c.toString(),h),h}getProvider(c){const h=this.resources.get(c.toString());if(h)return h.provider}getResourceDecoration(c){return this.resourceDecoration.has(c.toString())||this.resourceDecoration.set(c.toString(),{...v}),this.resourceDecoration.get(c.toString())}getResourceSubname(c,h){const d=this.getProvider(c.uri);return d&&d.provideResourceSubname?d.provideResourceSubname(c,h):null}disposeResource(c){const h=this.getProvider(c.uri);if(this.resources.delete(c.uri.toString()),this.resourceDecoration.delete(c.uri.toString()),!(!h||!h.onDisposeResource))return h.onDisposeResource(c)}};t.ResourceServiceImpl=p,n.__decorate([(0,r.Autowired)(l.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,o.OnEvent)(m.ResourceNeedUpdateEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[m.ResourceNeedUpdateEvent]),n.__metadata("design:returntype",void 0)],p.prototype,"onResourceNeedUpdateEvent",null),n.__decorate([(0,o.OnEvent)(m.ResourceDecorationNeedChangeEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[m.ResourceDecorationNeedChangeEvent]),n.__metadata("design:returntype",void 0)],p.prototype,"onResourceDecorationNeedChangeEvent",null),t.ResourceServiceImpl=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p);const v={dirty:!1,readOnly:!1},s={handlesUri:()=>-1,provideResource:g=>({uri:g,name:"",icon:""})}},52795:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorActions=t.Tabs=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),m=e(25918),E=e(1149),p=e(63373),v=e(93899),s=e(48560),g=e(43718),c=e(23418),h=e(19352),d=n.__importDefault(e(62711)),u=e(78680),_=e(82196),f=e(50674),a=e(72570).UU,b=({group:S})=>{const A=(0,o.useRef)(),w=(0,o.useRef)(),T=(0,o.useRef)(),D=(0,o.useRef)(null),I=(0,o.useRef)(null),O=(0,s.useInjectable)(c.ResourceService),L=(0,s.useInjectable)(l.IEventBus),R=(0,o.useContext)(l.ConfigContext),M=(0,s.useInjectable)(c.WorkbenchEditorService),k=(0,s.useInjectable)(u.TabTitleMenuService),B=(0,s.useInjectable)(l.PreferenceService),x=(0,s.useInjectable)(v.IMenuRegistry),N=(0,s.useInjectable)(_.IEditorTabService),j=(0,s.useInjectable)(E.LayoutViewSizeConfig),K=(0,s.useInjectable)(l.ComponentRegistry),U=(0,l.useDesignStyles)(d.default.tab_right,"tab_right"),X=(0,l.useDesignStyles)(d.default.close_tab,"close_tab"),z=(0,l.useDesignStyles)(d.default.kt_editor_close_icon,"kt_editor_close_icon"),Q=(0,l.useDesignStyles)(d.default.kt_editor_tabs_content,"kt_editor_tabs_content"),G=(0,l.useDesignStyles)(d.default.kt_editor_tabs_current_last,"kt_editor_tabs_current_last"),J=(0,l.useDesignStyles)(d.default.kt_editor_tab,"kt_editor_tab"),Y=(0,l.useDesignStyles)(d.default.kt_editor_tab_current_prev,"kt_editor_tab_current_prev"),H=(0,l.useDesignStyles)(d.default.kt_editor_tab_current_next,"kt_editor_tab_current_next"),$=(0,l.useDesignStyles)(d.default.kt_editor_tab_current,"kt_editor_tab_current"),Z=(0,l.useDesignStyles)(d.default.kt_editor_tab_dirty,"kt_editor_tab_dirty"),re=(0,l.useDesignStyles)(d.default.kt_editor_tabs,"kt_editor_tabs"),ce=(0,l.useDesignStyles)(d.default.kt_editor_tabs_scroll_wrapper,"kt_editor_tabs_scroll_wrapper"),[ge,Ae]=(0,o.useState)({}),[te,Pe]=(0,o.useState)(!!B.get("editor.wrapTab")),[Te,ie]=(0,o.useState)(new Map),[se,me]=(0,o.useState)(),ye=(0,o.useMemo)(()=>(0,l.getSlotLocation)(a,R.layoutConfig),[]),_e=o.default.useMemo(()=>{var Fe,We;const Ve=(We=(Fe=K.getComponentRegistryInfo(c.TabbarRightExtraContentId))===null||Fe===void 0?void 0:Fe.views)===null||We===void 0?void 0:We[0];if(Ve)return Ve},[]);(0,f.useUpdateOnGroupTabChange)(S),(0,s.useUpdateOnEventBusEvent)(c.ResourceDidUpdateEvent,[S.resources],Fe=>!!T&&S.resources.findIndex(We=>We.uri.isEqual(Fe))!==-1),(0,o.useEffect)(()=>{const Fe=new l.Disposable;return Fe.addDispose(S.onDidEditorGroupContentLoading(We=>{var Ve;(Ve=S.resourceStatus.get(We))===null||Ve===void 0||Ve.finally(()=>{Ae(Object.assign({},ge,{[We.uri.toString()]:!1}))}),Ae(Object.assign({},ge,{[We.uri.toString()]:!0}))})),Fe.addDispose(S.onDidEditorGroupTabChanged(()=>{te||Ee()})),()=>{Fe.dispose()}},[S]);const Ce=(0,o.useCallback)((Fe,We,Ve)=>{if(Fe.dataTransfer.getData("uri")){const Ke=new l.URI(Fe.dataTransfer.getData("uri"));let dt;Fe.dataTransfer.getData("uri-source-group")&&(dt=M.getEditorGroup(Fe.dataTransfer.getData("uri-source-group"))),S.dropUri(Ke,_.DragOverPosition.CENTER,dt,Ve)}Fe.dataTransfer.files.length>0&&L.fire(new _.EditorGroupFileDropEvent({group:S,tabIndex:We,files:Fe.dataTransfer.files}))},[S]),Ee=(0,o.useCallback)(()=>{l.fastdom.measure(()=>{try{if(A.current&&S.currentResource){const Fe=A.current.querySelector("."+d.default.kt_editor_tab+"[data-uri='"+S.currentResource.uri.toString()+"']");Fe&&Fe.scrollIntoView({block:"nearest",inline:"nearest"})}}catch{}})},[S,A.current]),xe=(0,o.useCallback)(()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{l.fastdom.measure(()=>{var Fe;const We=(Fe=I.current)===null||Fe===void 0?void 0:Fe.offsetWidth;We!==se&&me(We)})},200)},[I.current,D.current,se]);(0,o.useEffect)(()=>{te||queueMicrotask(()=>{Ee()})},[te,A.current]),(0,o.useEffect)(()=>{if(!te){const Fe=new l.Disposable;return A.current&&Fe.addDispose(new l.DomListener(A.current,"mousewheel",y)),Fe.addDispose(L.onDirective(l.ResizeEvent.createDirective(ye),()=>{Ee()})),Fe.addDispose(L.onDirective(_.GridResizeEvent.createDirective(S.grid.uid),()=>{Ee()})),()=>{Fe.dispose()}}},[te]);const Ye=(0,o.useCallback)(()=>{l.fastdom.measureAtNextFrame(()=>{if(T.current&&te){const Fe=new Map;let We,Ve;const Ke=Array.from(T.current.children);Ke.pop(),Ke.forEach(dt=>{dt.offsetTop!==We&&(We=dt.offsetTop,Ve&&Fe.set(Ke.indexOf(Ve),!0)),Ve=dt,Fe.set(Ke.indexOf(dt),!1)}),ie(Fe)}})},[T.current,te]);(0,o.useEffect)(()=>{xe()},[I.current,te]),(0,o.useEffect)(Ye,[te,T.current,S,S.resources.length]),(0,o.useEffect)(()=>{const Fe=new l.DisposableCollection;return Fe.push(L.onDirective(l.ResizeEvent.createDirective(ye),()=>{Ye()})),Fe.push(B.onPreferenceChanged(We=>{We.preferenceName==="editor.wrapTab"&&Pe(!!We.newValue)})),Fe.push(M.onDidCurrentEditorGroupChanged(()=>{xe()})),Fe.push(l.Event.debounce(l.Event.filter(x.onDidChangeMenu,We=>We===v.MenuId.EditorTitle),()=>{},200)(()=>{xe()})),()=>{Fe.dispose()}},[]),(0,o.useEffect)(()=>{const Fe=new l.DisposableCollection;return Fe.push(S.onDidEditorFocusChange(()=>{xe()})),()=>{Fe.dispose()}},[S]);const Ue=(0,o.useCallback)(Fe=>{Fe.preventDefault(),Fe.stopPropagation(),w.current&&w.current.classList.add(d.default.kt_on_drag_over)},[w.current]),Qe=(0,o.useCallback)(Fe=>{w.current&&w.current.classList.remove(d.default.kt_on_drag_over)},[w.current]),we=(0,o.useCallback)(Fe=>{w.current&&w.current.classList.remove(d.default.kt_on_drag_over),Ce&&Ce(Fe,-1)},[Ce,w.current]),le=(0,o.useCallback)(Fe=>{Fe.target===Fe.currentTarget&&M.createUntitledResource()},[M]),Se=o.default.useCallback((Fe,We)=>{const Ve=O.getResourceDecoration(Fe.uri),Ke=O.getResourceSubname(Fe,S.resources);return N.renderEditorTab(o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:ge[Fe.uri.toString()]?"loading_indicator":(0,r.default)(Fe.icon)}," "),o.default.createElement("div",{tabIndex:0,role:"tab","aria-selected":We?"true":"false"},Fe.name),Ke?o.default.createElement("div",{className:d.default.subname},Ke):null,Ve.readOnly?o.default.createElement("span",{className:(0,r.default)((0,l.getExternalIcon)("lock"),d.default.editor_readonly_icon)}):null,o.default.createElement("div",{className:U},o.default.createElement("div",{className:(0,r.default)({[d.default.kt_hidden]:!Ve.dirty,[d.default.dirty]:!0})}),o.default.createElement("div",{className:X,onMouseDown:dt=>{dt.stopPropagation(),S.close(Fe.uri)}},N.renderTabCloseComponent(o.default.createElement("div",{className:(0,r.default)((0,l.getIcon)("close"),z),tabIndex:0,role:"button","aria-label":(0,g.formatLocalize)("editor.closeTab.title",Fe.name)}))))),We)},[N]),Oe=()=>{const Fe=S.resources.length===0,We=S.resources.findIndex(Ve=>S.currentResource===Ve);return o.default.createElement("div",{draggable:!1,className:(0,r.default)({[Q]:!0,[d.default.kt_editor_tabs_content_empty]:Fe,[G]:We===S.resources.length-1}),ref:T,role:"tablist"},S.resources.map((Ve,Ke)=>{let dt;const ot=O.getResourceDecoration(Ve.uri);return o.default.createElement("div",{draggable:!0,title:Ve.title,className:(0,r.default)({[J]:!0,[d.default.last_in_row]:Te.get(Ke),[Y]:We-1===Ke,[H]:We+1===Ke,[$]:S.currentResource===Ve,[d.default.kt_editor_tab_preview]:S.previewURI&&S.previewURI.isEqual(Ve.uri),[Z]:ot.dirty}),style:te&&Ke===S.resources.length-1?{marginRight:se,height:j.editorTabsHeight}:{height:j.editorTabsHeight},onContextMenu:vt=>{k.show(vt.nativeEvent.x,vt.nativeEvent.y,Ve&&Ve.uri,S),vt.preventDefault()},key:Ve.uri.toString(),onMouseUp:vt=>{vt.nativeEvent.button===l.MouseEventButton.Middle&&(vt.preventDefault(),vt.stopPropagation(),S.close(Ve.uri))},onMouseDown:vt=>{vt.nativeEvent.button===l.MouseEventButton.Left&&S.open(Ve.uri,{focus:!0})},"data-uri":Ve.uri.toString(),onDragOver:vt=>{vt.preventDefault(),vt.stopPropagation(),dt&&dt.classList.add(d.default.kt_on_drag_over)},onDragLeave:vt=>{dt&&dt.classList.remove(d.default.kt_on_drag_over)},onDrop:vt=>{dt&&dt.classList.remove(d.default.kt_on_drag_over),Ce&&Ce(vt,Ke,Ve)},onDoubleClick:vt=>{S.pinPreviewed(Ve.uri)},ref:vt=>dt=vt,onDragStart:vt=>{vt.dataTransfer.setData("uri",Ve.uri.toString()),vt.dataTransfer.setData("uri-source-group",S.name)}},Se(Ve,S.currentResource===Ve))}))};return o.default.createElement("div",{id:p.VIEW_CONTAINERS.EDITOR_TABS,className:re},o.default.createElement("div",{className:ce,ref:w,onDragOver:Ue,onDragLeave:Qe,onDrop:we,onDoubleClick:le},te?o.default.createElement("div",{className:d.default.kt_editor_wrap_container},Oe()):o.default.createElement(h.Scroll,{forwardedRef:Fe=>Fe?A.current=Fe:null,className:d.default.kt_editor_tabs_scroll},Oe())),o.default.createElement(t.EditorActions,{className:(0,r.default)({[d.default.kt_editor_wrap_mode_action]:te}),ref:I,group:S}),(0,l.renderView)(_e))};t.Tabs=b,t.EditorActions=(0,o.forwardRef)((S,A)=>{const w=(0,l.useDesignStyles)(d.default.editor_actions,"editor_actions"),{group:T,className:D}=S,I=(0,o.useCallback)(()=>{var K,U;return T.currentResource?[T.currentResource.uri,T,((K=T.currentOrPreviousFocusedEditor)===null||K===void 0?void 0:K.currentUri)||((U=T.currentEditor)===null||U===void 0?void 0:U.currentUri)]:void 0},[T]),O=(0,s.useInjectable)(_.IEditorActionRegistry),L=(0,s.useInjectable)(c.WorkbenchEditorService),R=(0,s.useInjectable)(E.LayoutViewSizeConfig),M=O.getMenu(T),[k,B]=(0,o.useState)(L.currentEditorGroup===T),[x,N]=(0,o.useState)(I()),j=M.getMergedMenuNodes().length===0;return(0,o.useEffect)(()=>{const K=new l.DisposableCollection;return K.push(L.onDidCurrentEditorGroupChanged(()=>{B(L.currentEditorGroup===T)})),K.push(L.onActiveResourceChange(()=>{N(I())})),K.push(T.onDidEditorGroupTabChanged(()=>{N(I())})),()=>{K.dispose()}},[T]),o.default.createElement("div",{ref:A,className:(0,r.default)(w,D,{[d.default.editor_actions_no_actions]:j}),style:{height:R.editorTabsHeight}},o.default.createElement(m.InlineMenuBar,{menus:M,context:x,regroup:(K,U)=>k?[K,U]:[[],U]}))});function y(S){(this.offsetWidth+this.scrollLeft+S.deltaX>this.scrollWidth||this.scrollLeft+S.deltaX<0)&&S.preventDefault()}},82196:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IEditorTabService=t.ResoucesOfActiveComponentChangedEvent=t.CodeEditorDidVisibleEvent=t.EditorComponentDisposeEvent=t.ResourceOpenTypeChangedEvent=t.IEditorFeatureRegistry=t.IBreadCrumbService=t.CompareResult=t.ICompareService=t.IEditorActionRegistry=t.EditorDecorationTypeRemovedEvent=t.EditorDecorationChangeEvent=t.EditorDecorationProviderRegistrationEvent=t.RegisterEditorSideComponentEvent=t.EditorGroupsResetSizeEvent=t.EditorGroupIndexChangedEvent=t.EditorConfigurationChangedEvent=t.EditorVisibleChangeEvent=t.EditorSelectionChangeEvent=t.IEditorDecorationCollectionService=t.EditorGroupFileDropEvent=t.EditorActiveResourceStateChangedEvent=t.EditorGroupChangeEvent=t.EditorGroupDisposeEvent=t.EditorGroupCloseEvent=t.EditorGroupOpenEvent=t.GridResizeEvent=t.BrowserEditorContribution=t.EditorComponentRegistry=t.RegisterEditorComponentEvent=t.RegisterEditorComponentResolverEvent=t.EditorComponentRenderMode=void 0;const n=e(85608),r=e(41869);n.__exportStar(e(23418),t);var o;(function(R){R[R.ONE_PER_RESOURCE=1]="ONE_PER_RESOURCE",R[R.ONE_PER_GROUP=2]="ONE_PER_GROUP",R[R.ONE_PER_WORKBENCH=3]="ONE_PER_WORKBENCH"})(o||(t.EditorComponentRenderMode=o={}));class l extends r.BasicEvent{}t.RegisterEditorComponentResolverEvent=l;class m extends r.BasicEvent{}t.RegisterEditorComponentEvent=m;class E{}t.EditorComponentRegistry=E,t.BrowserEditorContribution=Symbol("BrowserEditorContribution");class p extends r.BasicEvent{static createDirective(M){return`grid-resize-${M}`}}t.GridResizeEvent=p;class v extends r.BasicEvent{}t.EditorGroupOpenEvent=v;class s extends r.BasicEvent{}t.EditorGroupCloseEvent=s;class g extends r.BasicEvent{}t.EditorGroupDisposeEvent=g;class c extends r.BasicEvent{}t.EditorGroupChangeEvent=c;class h extends r.BasicEvent{}t.EditorActiveResourceStateChangedEvent=h;class d extends r.BasicEvent{}t.EditorGroupFileDropEvent=d,t.IEditorDecorationCollectionService=Symbol("IEditorDecorationCollectionService");class u extends r.BasicEvent{}t.EditorSelectionChangeEvent=u;class _ extends r.BasicEvent{}t.EditorVisibleChangeEvent=_;class f extends r.BasicEvent{}t.EditorConfigurationChangedEvent=f;class a extends r.BasicEvent{}t.EditorGroupIndexChangedEvent=a;class b extends r.BasicEvent{}t.EditorGroupsResetSizeEvent=b;class y extends r.BasicEvent{}t.RegisterEditorSideComponentEvent=y;class S extends r.BasicEvent{}t.EditorDecorationProviderRegistrationEvent=S;class A extends r.BasicEvent{}t.EditorDecorationChangeEvent=A;class w extends r.BasicEvent{}t.EditorDecorationTypeRemovedEvent=w,t.IEditorActionRegistry=Symbol("IEditorActionRegistry"),t.ICompareService=Symbol("ICompareService");var T;(function(R){R.revert="revert",R.accept="accept",R.cancel="cancel"})(T||(t.CompareResult=T={})),t.IBreadCrumbService=Symbol("IBreadScrumbService"),t.IEditorFeatureRegistry=Symbol("IEditorFeatureRegistry");class D extends r.BasicEvent{}t.ResourceOpenTypeChangedEvent=D;class I extends r.BasicEvent{}t.EditorComponentDisposeEvent=I;class O extends r.BasicEvent{}t.CodeEditorDidVisibleEvent=O;class L extends r.BasicEvent{}t.ResoucesOfActiveComponentChangedEvent=L,t.IEditorTabService=Symbol("IEditorTabService")},17878:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.UntitledSchemeResourceProvider=t.UntitledSchemeDocumentProvider=t.UntitledDocumentIdCounter=void 0;const r=e(85608),o=e(76003),l=e(41869),m=e(72665),E=e(51500),p=e(23418),v=e(96689);let s=n=class{constructor(){this._id=1}async update(){this._id=await this.getLatestUnitiedIndex()}async getLatestUnitiedIndex(d){var u;await this.workspaceService.whenReady;const a=(d||((u=this.workspaceService.workspace)===null||u===void 0?void 0:u.children)||[]).filter(b=>l.URI.file(b.uri).displayName.startsWith(n.UNTITLED_FILE_NAME_PREFIX)).map(b=>{const y=l.URI.file(b.uri).displayName.match(new RegExp(`^${n.UNTITLED_FILE_NAME_PREFIX}(\\d+)`,"i"));return y?parseInt(y[1],10):-1}).filter(b=>b!==-1);return a.length>0?Math.max(...a)+1:1}get id(){return this._id++}};t.UntitledDocumentIdCounter=s,s.UNTITLED_FILE_NAME_PREFIX="Untitled-",r.__decorate([(0,o.Autowired)(E.IWorkspaceService),r.__metadata("design:type",Object)],s.prototype,"workspaceService",void 0),t.UntitledDocumentIdCounter=s=n=r.__decorate([(0,o.Injectable)()],s);let g=class{constructor(){this._onDidChangeContent=new l.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(d){return d===l.Schemes.untitled}async provideEncoding(d){return this.preferenceService.get("files.encoding",void 0,d.toString(),(0,l.getLanguageIdFromMonaco)(d))||"utf8"}async provideEOL(d){const u=await this.applicationService.getBackendOS(),_=this.preferenceService.get("files.eol","auto",d.toString(),(0,l.getLanguageIdFromMonaco)(d));return _!=="auto"?_:u===l.OperatingSystem.Windows?`\r
28343
28344
  `:`
28344
- `}async provideEditorDocumentModelContent(d,u){return""}isReadonly(d){return!1}isAlwaysDirty(d){return!0}disposeEvenDirty(d){return!0}closeAutoSave(d){return!0}async saveDocumentModel(d,u,_,f,a,b=!1){const{name:y}=d.getParsedQuery(),S=d.path.toString()!=="/"?l.path.dirname(d.path.toString()):this.appConfig.workspaceDir,A=await this.commandService.tryExecuteCommand("file.save",{showNameInput:!0,defaultFileName:y||d.displayName,defaultUri:l.URI.file(l.isWindows?S.replaceAll("\\","/"):S)});return A&&(await this.editorDocumentModelService.saveEditorDocumentModel(A,u,_,f,a,b),await this.workbenchEditorService.open(A,{preview:!1,focus:!0,replace:!0,forceClose:!0})),{state:l.SaveTaskResponseState.SUCCESS}}onDidDisposeModel(){}};t.UntitledSchemeDocumentProvider=g,r.__decorate([(0,o.Autowired)(v.IEditorDocumentModelService),r.__metadata("design:type",Object)],g.prototype,"editorDocumentModelService",void 0),r.__decorate([(0,o.Autowired)(p.WorkbenchEditorService),r.__metadata("design:type",p.WorkbenchEditorService)],g.prototype,"workbenchEditorService",void 0),r.__decorate([(0,o.Autowired)(l.CommandService),r.__metadata("design:type",Object)],g.prototype,"commandService",void 0),r.__decorate([(0,o.Autowired)(l.AppConfig),r.__metadata("design:type",Object)],g.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(l.IApplicationService),r.__metadata("design:type",Object)],g.prototype,"applicationService",void 0),r.__decorate([(0,o.Autowired)(s),r.__metadata("design:type",s)],g.prototype,"untitledIndex",void 0),r.__decorate([(0,o.Autowired)(l.PreferenceService),r.__metadata("design:type",Object)],g.prototype,"preferenceService",void 0),t.UntitledSchemeDocumentProvider=g=r.__decorate([(0,o.Injectable)()],g);let c=class extends l.WithEventBus{constructor(){super(...arguments),this.scheme=l.Schemes.untitled}provideResource(d){const{name:u}=d.getParsedQuery();return{name:u||d.displayName,uri:d,icon:"",metadata:null}}async shouldCloseResourceWithoutConfirm(d){const u=this.documentModelService.getModelDescription(d.uri,"close-resource-check");return!!(u&&u.dirty)}async close(d,u){const _=this.documentModelService.getModelReference(d.uri,"close-resource-check");if(!_)return!1;if(u===p.AskSaveResult.SAVE){const f=await _.instance.save();return _.dispose(),f}else return u===p.AskSaveResult.REVERT?(await _.instance.revert(),_.dispose(),!0):!u||u===p.AskSaveResult.CANCEL?(_.dispose(),!1):(_.dispose(),!0)}async shouldCloseResource(d){const u=this.documentModelService.getModelDescription(d.uri,"close-resource-check");if(!u||!u.dirty)return!0;const _={[(0,l.localize)("file.prompt.dontSave","Don't Save")]:p.AskSaveResult.REVERT,[(0,l.localize)("file.prompt.save","Save")]:p.AskSaveResult.SAVE,[(0,l.localize)("file.prompt.cancel","Cancel")]:p.AskSaveResult.CANCEL},f=await this.dialogService.open({message:(0,l.formatLocalize)("saveChangesMessage",d.name),type:l.MessageType.Info,buttons:Object.keys(_)});return await this.close(d,_[f])}};t.UntitledSchemeResourceProvider=c,r.__decorate([(0,o.Autowired)(m.IDialogService),r.__metadata("design:type",Object)],c.prototype,"dialogService",void 0),r.__decorate([(0,o.Autowired)(v.IEditorDocumentModelService),r.__metadata("design:type",Object)],c.prototype,"documentModelService",void 0),t.UntitledSchemeResourceProvider=c=r.__decorate([(0,o.Injectable)()],c)},33835:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeEditor=void 0;const r=e(85608).__importDefault(e(14041)),o=e(41869),l=e(23418),m=e(96689),E=p=>{const v=r.default.useRef(),s=(0,o.useInjectable)(l.EditorCollectionService),g=(0,o.useInjectable)(m.IEditorDocumentModelService),[c,h]=r.default.useState(void 0),[d,u]=r.default.useState(void 0),[_,f]=r.default.useState(void 0),[a,b]=r.default.useState(void 0);let y=!1;return r.default.useEffect(()=>{if(v.current){c&&c.dispose();const S=s.createCodeEditor(v.current,{automaticLayout:!0,...p.options});h(S),d&&S.open(d)}return()=>{y=!0,c&&c.dispose(),d&&d.dispose()}},[v.current]),p&&c&&p.editorRef&&p.editorRef(c),_&&a!==_&&(b(_),g.createModelReference(new o.URI(_),"editor-react-component").then(S=>{d&&d.dispose(),!y&&S.instance.uri.toString()===_?u(S):S.dispose()})),d&&c&&c.currentDocumentModel!==d.instance&&c.open(d),p.uri&&p.uri.toString()!==_&&f(p.uri.toString()),r.default.createElement("div",{ref:S=>S&&(v.current=S),...p})};t.CodeEditor=E},50674:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useUpdateOnGroupTabChange=r;const n=e(41869);function r(o){return(0,n.useUpdateOnEvent)(o.onDidEditorGroupTabChanged,[o])}},6670:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorSuggestWidgetContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(76835);let E=class{contribute(v){const s=new o.DisposableCollection,g=v.monacoEditor.getContribution(m.SuggestController.ID);if(g&&g.widget&&g.widget.value){const c=g.widget.value;s.push(c.onDidSelect(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidSelect",data:h}))})),s.push(c.onDidHide(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidHide",data:h}))})),s.push(c.onDidShow(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidShow",data:h}))})),s.push(c.onDidFocus(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidFocus",data:h}))})),c&&c._setDetailsVisible&&c._setDetailsVisible(this.preferenceService.get("editor.suggest.details.visible",!0))}return s}};t.EditorSuggestWidgetContribution=E,n.__decorate([(0,r.Autowired)(l.IEventBus),n.__metadata("design:type",Object)],E.prototype,"eventBus",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],E.prototype,"preferenceService",void 0),t.EditorSuggestWidgetContribution=E=n.__decorate([(0,r.Injectable)()],E)},67903:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorTopPaddingContribution=void 0;class e{contribute(r){return r.monacoEditor.onDidChangeModel(()=>{r.monacoEditor.changeViewZones(o=>{o.addZone({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:0})})})}}t.EditorTopPaddingContribution=e},51553:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorGroup=t.WorkbenchEditorServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(91830),m=e(75524),E=e(43718),p=n.__importStar(e(20868)),v=e(72665),s=e(23418),g=e(96689),c=e(76759),h=e(47049),d=e(82196),u=e(17878),_=10,f=A=>!!(A.supportsRevive&&!A.deleted);let a=class extends E.WithEventBus{constructor(){super(),this.editorGroups=[],this._onDidEditorGroupsChanged=new E.Emitter,this.onDidEditorGroupsChanged=this._onDidEditorGroupsChanged.event,this._sortedEditorGroups=[],this._onActiveResourceChange=new E.Emitter,this.onActiveResourceChange=this._onActiveResourceChange.event,this._onActiveEditorUriChange=new E.Emitter,this.onActiveEditorUriChange=this._onActiveEditorUriChange.event,this._onCursorChange=new E.Emitter,this.onCursorChange=this._onCursorChange.event,this._onDidCurrentEditorGroupChanged=new E.Emitter,this.onDidCurrentEditorGroupChanged=this._onDidCurrentEditorGroupChanged.event,this._restoring=!0,this.contributionsReady=new E.Deferred,this.untitledCloseIndex=[],this.gridReady=!1,this._onDidGridReady=new E.Emitter,this.onDidGridReady=this._onDidGridReady.event,this.editorGroupIdGen=0,this.untitledIndex.update(),this.initialize()}setEditorContextKeyService(w){this.editorContextKeyService=w}setCurrentGroup(w){var T;if(w){if(this._currentEditorGroup===w)return;this._currentEditorGroup=w,this._onActiveResourceChange.fire(w.currentResource),this.eventBus.fire(new d.EditorActiveResourceStateChangedEvent({resource:w.currentResource,openType:w.currentOpenType,editorUri:(T=this.currentEditor)===null||T===void 0?void 0:T.currentUri})),this._onDidCurrentEditorGroupChanged.fire(this._currentEditorGroup)}}onEditorGroupChangeEvent(w){var T;w.payload.group===this.currentEditorGroup&&this.eventBus.fire(new d.EditorActiveResourceStateChangedEvent({resource:w.payload.newResource,openType:w.payload.newOpenType,editorUri:(T=this.currentEditor)===null||T===void 0?void 0:T.currentUri}))}getAllOpenedUris(){const w=[];for(const T of this.editorGroups)for(const D of T.resources)w.findIndex(O=>O.isEqual(D.uri))===-1&&w.push(D.uri);return w}async getAllOpenedDocuments(){const w=[];for(const T of this.editorGroups)for(const D of T.resources){if(D.uri.scheme!=="file")continue;if(w.findIndex(O=>O.uri.isEqual(D.uri))===-1){const O=await T.getDocumentModelRef(D.uri);O&&w.push(O.instance)}}return w}async saveAll(w,T){for(const D of this.editorGroups)await D.saveAll(w,T)}hasDirty(){for(const w of this.editorGroups)if(w.hasDirty())return!0;return!1}calcDirtyCount(){const w=new Set;return this.editorGroups.reduce((T,D)=>T+D.calcDirtyCount(w),0)}createEditorGroup(){const w=this.injector.get(b,[this.generateRandomEditorGroupName(),this.editorGroupIdGen++]);this.editorGroups.push(w);const T=new E.Disposable(w.onDidEditorGroupBodyChanged(()=>{w===this.currentEditorGroup&&(!w.currentOpenType&&w.currentResource||this._onActiveResourceChange.fire(w.currentResource))}),w.onDidEditorFocusChange(()=>{var I;w===this.currentEditorGroup&&(!w.currentOpenType&&w.currentResource||this._onActiveEditorUriChange.fire((I=w.currentOrPreviousFocusedEditor)===null||I===void 0?void 0:I.currentUri))}));w.addDispose({dispose:()=>{T.dispose()}});const D=w.onDidEditorGroupTabChanged(()=>{this.saveOpenedResourceState()});return w.addDispose({dispose:()=>{D.dispose()}}),w.onCurrentEditorCursorChange(I=>{this._currentEditorGroup===w&&this._onCursorChange.fire(I)}),w}generateRandomEditorGroupName(){let w=(0,E.makeRandomHexString)(5);for(;this.editorGroups.findIndex(T=>T.name===w)!==-1;)w=(0,E.makeRandomHexString)(5);return w}initialize(){return this.initializing||(this.initializing=this.doInitialize()),this.initializing}async doInitialize(){this.openedResourceState=await this.initializeState(),await this.contributionsReady.promise,await this.restoreState(),this._currentEditorGroup=this.editorGroups[0]}async initializeState(){return await this.getStorage(E.STORAGE_NAMESPACE.WORKBENCH)}get currentEditor(){return this.currentEditorGroup&&this.currentEditorGroup.currentEditor}get currentCodeEditor(){return this.currentEditorGroup.currentCodeEditor}get currentEditorGroup(){return this._currentEditorGroup}get currentOrPreviousFocusedEditor(){return this.currentEditorGroup&&this.currentEditorGroup.currentOrPreviousFocusedEditor}async open(w,T){await this.initialize();let D=this.currentEditorGroup,I;if(T&&typeof T.groupIndex<"u"?I=T.groupIndex:T&&T.relativeGroupIndex&&(I=this.currentEditorGroup.index+T.relativeGroupIndex),typeof I=="number"&&I>=0){if(I>=this.editorGroups.length)return D.open(w,Object.assign({},T,{split:s.EditorGroupSplitAction.Right}));D=this.sortedEditorGroups[I]||this.currentEditorGroup}return D.open(w,T)}async openUris(w){await this.initialize(),await this.currentEditorGroup.openUris(w)}getEditorGroup(w){return this.editorGroups.find(T=>T.name===w)}get currentResource(){return this.currentEditorGroup?this.currentEditorGroup.currentResource:null}removeGroup(w){const T=this.editorGroups.findIndex(D=>D===w);if(T!==-1){if(this.editorGroups.length===1)return;this.editorGroups.splice(T,1),this.currentEditorGroup===w&&this.setCurrentGroup(this.editorGroups[0]);for(let D=T;D<this.editorGroups.length;D++)this.eventBus.fire(new d.EditorGroupIndexChangedEvent({group:this.editorGroups[D],index:D}))}}async saveOpenedResourceState(){if(this._restoring)return;const w=this.topGrid.serialize();await this.openedResourceState.set("grid",w)}prepareContextKeyService(){const w=D=>{let I=null;const O=this.documentModelManager.getModelDescription(D,"resourceContextKey");return O&&(I=O.languageId),I},T=new l.ResourceContextKey(this.editorContextKeyService,D=>{const I=w(D);return I||w(D)});this.onActiveResourceChange(D=>{this.currentEditor&&this.currentEditor.currentUri?T.set(this.currentEditor.currentUri):D?T.set(D.uri):T.reset()}),this.currentEditor&&this.currentEditor.currentUri?T.set(this.currentEditor.currentUri):this.currentResource?T.set(this.currentResource.uri):T.reset()}onDomCreated(w){this.editorContextKeyService&&this.editorContextKeyService.attachToDomNode(w)}notifyGroupChanged(){this._sortedEditorGroups=void 0,this._onDidEditorGroupsChanged.fire()}async restoreState(){let w={editorGroup:{uris:[],previewIndex:-1}};this.appConfig.disableRestoreEditorGroupState||(w=this.openedResourceState.get("grid",w)),this.topGrid=new h.EditorGrid,this.addDispose(this.topGrid),this.addDispose(this.topGrid.onDidGridAndDesendantStateChange(()=>{this._sortedEditorGroups=void 0,this._onDidEditorGroupsChanged.fire()}));const T=[],D=this.topGrid.deserialize(w,()=>this.createEditorGroup(),T).then(()=>{this.topGrid.children.length===0&&!this.topGrid.editorGroup&&this.topGrid.setEditorGroup(this.createEditorGroup()),this.gridReady=!0,this._onDidGridReady.fire(),this.notifyGroupChanged()});return Promise.all(T).then(()=>{this._restoring=!1;for(const I of this.contributions.getContributions())I.onDidRestoreState&&I.onDidRestoreState()}),D}async closeAll(w,T){for(const D of this.editorGroups.slice(0))w?await D.close(w,{force:T}):await D.closeAll()}async closeAllOnlyConfirmOnce(){const w=[];for(const k of this.editorGroups)for(const B of k.resources)w.push(B);const D=(await Promise.all(w.map(async k=>({shouldClose:await this.resourceService.shouldCloseResourceWithoutConfirm(k),resource:k})))).filter(k=>k.shouldClose);if(D.length===0)return!1;const I={[(0,E.localize)("file.prompt.dontSave","Don't Save")]:d.AskSaveResult.REVERT,[(0,E.localize)("file.prompt.save","Save")]:d.AskSaveResult.SAVE,[(0,E.localize)("file.prompt.cancel","Cancel")]:d.AskSaveResult.CANCEL};let L=D.slice(0,_).map(k=>k.resource.name).join("\u3001");D.length>_&&(D.length-_===1?L+=(0,E.localize)("file.prompt.more.one"):L+=(0,E.formatLocalize)("file.prompt.more.number",D.length-_));const R=await this.dialogService.open({message:(0,o.toMarkdown)((0,E.formatLocalize)("saveNFilesChangesMessage",D.length,L),this.openner),type:E.MessageType.Info,buttons:Object.keys(I)}),M=I[R];return M===d.AskSaveResult.SAVE?(await Promise.all(D.map(k=>{var B,x;return(x=(B=this.resourceService).close)===null||x===void 0?void 0:x.call(B,k.resource,d.AskSaveResult.SAVE)})),!1):M===d.AskSaveResult.REVERT?(await Promise.all(D.map(k=>{var B,x;return(x=(B=this.resourceService).close)===null||x===void 0?void 0:x.call(B,k.resource,d.AskSaveResult.REVERT)})),!1):!0}async close(w,T){return this.closeAll(w,T)}get sortedEditorGroups(){return this._sortedEditorGroups||(this._sortedEditorGroups=[],this.topGrid.sortEditorGroups(this._sortedEditorGroups)),this._sortedEditorGroups}handleOnCloseUntitledResource(w){if(w.payload.resource.uri.scheme===E.Schemes.untitled){const{index:T}=w.payload.resource.uri.getParsedQuery();this.untitledCloseIndex.push(parseInt(T,10)),this.untitledCloseIndex.sort((D,I)=>D-I)}}createUntitledURI(){const w=this.untitledCloseIndex.shift()||this.untitledIndex.id;return new E.URI().withScheme(E.Schemes.untitled).withQuery(`name=${u.UntitledDocumentIdCounter.UNTITLED_FILE_NAME_PREFIX}${w}&index=${w}`)}createUntitledResource(w={uri:this.createUntitledURI()}){return this.open(w.uri,{preview:!1,focus:!0,...w.resourceOpenOptions})}};t.WorkbenchEditorServiceImpl=a,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],a.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(s.ResourceService),n.__metadata("design:type",s.ResourceService)],a.prototype,"resourceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],a.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(E.StorageProvider),n.__metadata("design:type",Function)],a.prototype,"getStorage",void 0),n.__decorate([(0,r.Autowired)(v.IDialogService),n.__metadata("design:type",Object)],a.prototype,"dialogService",void 0),n.__decorate([(0,r.Autowired)(o.IOpenerService),n.__metadata("design:type",Object)],a.prototype,"openner",void 0),n.__decorate([(0,r.Autowired)(d.BrowserEditorContribution),n.__metadata("design:type",Object)],a.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(g.IEditorDocumentModelService),n.__metadata("design:type",Object)],a.prototype,"documentModelManager",void 0),n.__decorate([(0,r.Autowired)(u.UntitledDocumentIdCounter),n.__metadata("design:type",u.UntitledDocumentIdCounter)],a.prototype,"untitledIndex",void 0),n.__decorate([(0,E.OnEvent)(d.EditorGroupChangeEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.EditorGroupChangeEvent]),n.__metadata("design:returntype",void 0)],a.prototype,"onEditorGroupChangeEvent",null),n.__decorate([(0,E.OnEvent)(d.EditorGroupCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.EditorGroupCloseEvent]),n.__metadata("design:returntype",void 0)],a.prototype,"handleOnCloseUntitledResource",null),t.WorkbenchEditorServiceImpl=a=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],a);let b=class extends E.WithEventBus{constructor(w,T){super(),this.name=w,this.groupId=T,this.openingPromise=new Map,this._onDidEditorFocusChange=this.registerDispose(new E.Emitter),this.onDidEditorFocusChange=this._onDidEditorFocusChange.event,this._onDidEditorGroupTabChanged=new E.Emitter,this.onDidEditorGroupTabChanged=this._onDidEditorGroupTabChanged.event,this._onDidEditorGroupTabOperation=new E.Emitter,this.onDidEditorGroupTabOperation=this._onDidEditorGroupTabOperation.event,this._onDidEditorGroupBodyChanged=new E.Emitter,this.onDidEditorGroupBodyChanged=this._onDidEditorGroupBodyChanged.event,this._onDidEditorGroupContentLoading=new E.Emitter,this.onDidEditorGroupContentLoading=this._onDidEditorGroupContentLoading.event,this.previewURI=null,this.resources=[],this.resourceStatus=new Map,this.cachedResourcesActiveOpenTypes=new Map,this.cachedResourcesOpenTypes=new Map,this.availableOpenTypes=[],this.activeComponents=new Map,this.activateComponentsProps=new Map,this.holdDocumentModelRefs=new Map,this.toDispose=[],this._prevDomHeight=0,this._prevDomWidth=0,this._onCurrentEditorCursorChange=new E.Emitter,this.onCurrentEditorCursorChange=this._onCurrentEditorCursorChange.event,this.resourceOpenHistory=[],this._domNode=null,this._diffEditorDomNode=null,this._diffEditorDomNodeAttached=!1,this._mergeEditorDomNode=null,this._mergeEditorDomNodeAttached=!1,this.codeEditorReady=new E.ReadyEvent,this.diffEditorReady=new E.ReadyEvent,this.diffEditorDomReady=new E.ReadyEvent,this.mergeEditorReady=new E.ReadyEvent,this.mergeEditorDomReady=new E.ReadyEvent,this._restoringState=!1,this.eventBus.onDirective(o.ResizeEvent.createDirective((0,o.getSlotLocation)("@opensumi/ide-editor",this.config.layoutConfig)),()=>{this.doLayoutEditors()}),this.eventBus.on(d.GridResizeEvent,D=>{D.payload.gridId===this.grid.uid&&this.doLayoutEditors()}),this.eventBus.on(d.EditorComponentDisposeEvent,D=>{this.activeComponents.delete(D.payload),this.activateComponentsProps.delete(D.payload)}),this.listenToExplorerAutoRevealConfig()}listenToExplorerAutoRevealConfig(){this.explorerAutoRevealConfig=!!this.preferenceService.get("explorer.autoReveal"),this.disposables.push(this.preferenceService.onPreferenceChanged(w=>{w.preferenceName==="explorer.autoReveal"&&(this.explorerAutoRevealConfig=w.newValue)}))}attachDiffEditorDom(w){this._diffEditorDomNodeAttached||(this._diffEditorDomNode=w,this.diffEditorDomReady.ready(),this._diffEditorDomNodeAttached=!0)}attachMergeEditorDom(w){this._mergeEditorDomNodeAttached||(this._mergeEditorDomNode=w,this.mergeEditorDomReady.ready(),this._mergeEditorDomNodeAttached=!0)}attachToDom(w){this._domNode=w,w&&(this.contextKeyService.attachToDomNode(w),this.layoutEditors())}layoutEditors(){o.fastdom.measure(()=>{if(this._domNode){const w=this._domNode.offsetWidth,T=this._domNode.offsetHeight;(w!==this._prevDomWidth||T!==this._prevDomHeight)&&this.doLayoutEditors(),this._prevDomWidth=w,this._prevDomHeight=T}})}_layoutEditorWorker(){if(this.currentOpenType)switch(this.currentOpenType.type){case d.EditorOpenType.code:this.codeEditor&&this.codeEditor.layout();break;case d.EditorOpenType.diff:this.diffEditor&&this.diffEditor.layout();break;default:break}}doLayoutEditors(){this._measure&&this._measure.dispose(),this._measure=o.fastdom.mutate(()=>{this._layoutEditorWorker()})}setContextKeys(){var w;if(!this._resourceContext){const T=D=>{let I=null;const O=this.documentModelManager.getModelDescription(D,"resourceContextKey");return O&&(I=O.languageId),I};this._resourceContext=new l.ResourceContextKey(this.contextKeyService,D=>T(D)),this._diffResourceContextKey=new l.ResourceContextKey(this.contextKeyService,D=>T(D),"diffResource"),this._editorLangIDContextKey=this.contextKeyService.createKey("editorLangId",""),this._isInDiffEditorContextKey=this.contextKeyService.createKey("isInDiffEditor",!1),this._activeEditorIsDirtyContextKey=this.contextKeyService.createKey("activeEditorIsDirty",!1),this._isInDiffRightEditorContextKey=this.contextKeyService.createKey("isInDiffRightEditor",!1),this._isInEditorComponentContextKey=this.contextKeyService.createKey("inEditorComponent",!1)}this.currentOrPreviousFocusedEditor&&this.currentOrPreviousFocusedEditor.currentUri?(this._resourceContext.set(this.currentOrPreviousFocusedEditor.currentUri),this.currentOrPreviousFocusedEditor.currentDocumentModel&&this._editorLangIDContextKey.set(this.currentOrPreviousFocusedEditor.currentDocumentModel.languageId)):this.currentEditor&&this.currentEditor.currentUri?(this._resourceContext.set(this.currentEditor.currentUri),this.currentEditor.currentDocumentModel&&this._editorLangIDContextKey.set(this.currentEditor.currentDocumentModel.languageId)):(this.currentResource?this._resourceContext.set(this.currentResource.uri):this._resourceContext.reset(),this._editorLangIDContextKey.reset()),this._activeEditorIsDirtyContextKey.set(this.activeEditorIsDirty()),this._isInDiffEditorContextKey.set(this.isDiffEditorMode()),this._isInDiffRightEditorContextKey.set(this.isDiffEditorMode()),this._isInEditorComponentContextKey.set(this.isComponentMode()),this.isDiffEditorMode()&&this._diffResourceContextKey.set((w=this.currentResource)===null||w===void 0?void 0:w.uri),this.updateContextKeyWhenDiffEditorChangesFocus()}updateContextKeyWhenDiffEditorChangesFocus(){if(this.updateContextKeyWhenEditorChangesFocusDisposer||!this.diffEditor)return;const w=()=>{this.currentFocusedEditor||(this.setContextKeys(),this._onDidEditorFocusChange.fire())};this.updateContextKeyWhenEditorChangesFocusDisposer=new E.Disposable(this.diffEditor.modifiedEditor.onFocus(()=>{this._currentOrPreviousFocusedEditor=this.diffEditor.modifiedEditor,this.setContextKeys(),this._onDidEditorFocusChange.fire()}),this.diffEditor.originalEditor.onFocus(()=>{this._currentOrPreviousFocusedEditor=this.diffEditor.originalEditor,this.setContextKeys(),this._onDidEditorFocusChange.fire()}),this.codeEditor.onFocus(()=>{this.codeEditor.currentUri&&this.locateInFileTree(this.codeEditor.currentUri),this._currentOrPreviousFocusedEditor=this.codeEditor,this.setContextKeys(),this._onDidEditorFocusChange.fire()}),this.codeEditor.onBlur(w),this.diffEditor.originalEditor.onBlur(w),this.diffEditor.modifiedEditor.onBlur(w)),this.addDispose(this.updateContextKeyWhenEditorChangesFocusDisposer)}get contextKeyService(){return this._contextKeyService||(this._contextKeyService=this.workbenchEditorService.editorContextKeyService.createScoped()),this._contextKeyService}get index(){return this.workbenchEditorService.sortedEditorGroups.indexOf(this)}onResourceDecorationChangeEvent(w){w.payload.decoration.dirty&&this.previewURI&&this.previewURI.isEqual(w.payload.uri)&&this.pinPreviewed(),this.resources.find(D=>D.uri.isEqual(w.payload.uri))&&this.notifyTabChanged()}resetOpenType(){this._currentOpenType=null}oResourceOpenTypeChangedEvent(w){const T=w.payload;this.cachedResourcesOpenTypes.has(T.toString())&&this.cachedResourcesOpenTypes.delete(T.toString()),this.currentResource&&this.currentResource.uri.isEqual(T)&&(this.resetOpenType(),this.notifyBodyChanged(),this.displayResourceComponent(this.currentResource,{}))}async onRegisterEditorComponentEvent(){if(this.currentResource){const w=this.currentResource,T=await this.editorComponentRegistry.resolveEditorComponent(w);this.currentResource===w&&(this.availableOpenTypes=T,this.cachedResourcesOpenTypes.set(w.uri.toString(),T))}}pinPreviewed(w){const T=this.previewURI;w===void 0?this.previewURI=null:this.previewURI&&this.previewURI.isEqual(w)&&(this.previewURI=null),T!==this.previewURI&&this.notifyTabChanged()}notifyTabChanged(){this._restoringState||this._onDidEditorGroupTabChanged.fire()}notifyBodyChanged(){this._onDidEditorGroupBodyChanged.fire()}notifyTabLoading(w){this._onDidEditorGroupContentLoading.fire(w)}get currentEditor(){return this.currentOpenType?this.currentOpenType.type===d.EditorOpenType.code?this.codeEditor:this.currentOpenType.type===d.EditorOpenType.diff?this.diffEditor.modifiedEditor:null:null}get currentOrPreviousFocusedEditor(){return this._currentOrPreviousFocusedEditor||this.currentEditor}get currentFocusedEditor(){if(this.currentOpenType){if(this.currentOpenType.type===d.EditorOpenType.code){if(this.codeEditor.monacoEditor.hasWidgetFocus())return this.codeEditor}else if(this.currentOpenType.type===d.EditorOpenType.diff){if(this.diffEditor.modifiedEditor.monacoEditor.hasTextFocus())return this.diffEditor.modifiedEditor;if(this.diffEditor.originalEditor.monacoEditor.hasTextFocus())return this.diffEditor.originalEditor;if(this.diffEditor.modifiedEditor.monacoEditor.hasWidgetFocus())return this.diffEditor.modifiedEditor;if(this.diffEditor.originalEditor.monacoEditor.hasWidgetFocus())return this.diffEditor.originalEditor}}return null}get currentCodeEditor(){return this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code?this.codeEditor:null}createEditor(w){this.codeEditor=this.collectionService.createCodeEditor(w,{},{[o.ServiceNames.CONTEXT_KEY_SERVICE]:this.contextKeyService.contextKeyService}),setTimeout(()=>{this.doLayoutEditors()}),this.addDispose(this.codeEditor.onRefOpen(()=>{this.doLayoutEditors()})),this.toDispose.push(this.codeEditor.onCursorPositionChanged(T=>{this._onCurrentEditorCursorChange.fire(T)})),this.toDispose.push(this.codeEditor.onSelectionsChanged(T=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.eventBus.fire(new d.EditorSelectionChangeEvent({group:this,resource:this.currentResource,selections:T.selections,source:T.source,editorUri:this.codeEditor.currentUri}))})),this.toDispose.push(this.codeEditor.onVisibleRangesChanged(T=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.eventBus.fire(new d.EditorVisibleChangeEvent({group:this,resource:this.currentResource,visibleRanges:T,editorUri:this.codeEditor.currentUri}))})),this.toDispose.push(this.codeEditor.onConfigurationChanged(()=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.eventBus.fire(new d.EditorConfigurationChangedEvent({group:this,resource:this.currentResource,editorUri:this.codeEditor.currentUri}))})),this.eventBus.fire(new d.CodeEditorDidVisibleEvent({groupName:this.name,type:d.EditorOpenType.code,editorId:this.codeEditor.getId()})),this.toDispose.push(this.codeEditor.monacoEditor.onDidChangeModelContent(()=>{this._activeEditorIsDirtyContextKey.set(this.activeEditorIsDirty())})),this.codeEditorReady.ready()}createMergeEditor(w){this.mergeEditor=this.collectionService.createMergeEditor(w,{},{[o.ServiceNames.CONTEXT_KEY_SERVICE]:this.contextKeyService.contextKeyService}),this.mergeEditorReady.ready()}createDiffEditor(w){this.diffEditor=this.collectionService.createDiffEditor(w,{},{[o.ServiceNames.CONTEXT_KEY_SERVICE]:this.contextKeyService.contextKeyService}),setTimeout(()=>{this.doLayoutEditors()}),this.diffEditor.onRefOpen(()=>{this.doLayoutEditors()}),this.addDiffEditorEventListeners(this.diffEditor.originalEditor,"original"),this.addDiffEditorEventListeners(this.diffEditor.modifiedEditor,"modified"),this.eventBus.fire(new d.CodeEditorDidVisibleEvent({groupName:this.name,type:d.EditorOpenType.diff,editorId:this.diffEditor.modifiedEditor.getId()})),this.eventBus.fire(new d.CodeEditorDidVisibleEvent({groupName:this.name,type:d.EditorOpenType.diff,editorId:this.diffEditor.originalEditor.getId()})),this.diffEditorReady.ready()}addDiffEditorEventListeners(w,T){this.toDispose.push(w.onSelectionsChanged(D=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.eventBus.fire(new d.EditorSelectionChangeEvent({group:this,resource:this.currentResource,selections:D.selections,source:D.source,editorUri:E.URI.from(w.monacoEditor.getModel().uri),side:T}))})),this.toDispose.push(w.onVisibleRangesChanged(D=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.eventBus.fire(new d.EditorVisibleChangeEvent({group:this,resource:this.currentResource,visibleRanges:D,editorUri:w.currentUri}))})),this.toDispose.push(w.onConfigurationChanged(()=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.eventBus.fire(new d.EditorConfigurationChangedEvent({group:this,resource:this.currentResource,editorUri:w.currentUri}))}))}async split(w,T,D){var I,O,L;const R=this.workbenchEditorService.createEditorGroup(),M=w===s.EditorGroupSplitAction.Left||w===s.EditorGroupSplitAction.Right?h.SplitDirection.Horizontal:h.SplitDirection.Vertical,k=w===s.EditorGroupSplitAction.Left||w===s.EditorGroupSplitAction.Top;if(this.grid.split(M,R,k),D&&!D.scrollTop&&(D.scrollTop=(I=this.currentEditor)===null||I===void 0?void 0:I.monacoEditor.getScrollTop()),D&&!D.scrollLeft&&(D.scrollLeft=(O=this.currentEditor)===null||O===void 0?void 0:O.monacoEditor.getScrollLeft()),D&&!D?.range){const B=(L=this.currentCodeEditor)===null||L===void 0?void 0:L.monacoEditor.getSelection();B&&(D.range=new p.Range(B.startLineNumber,B.startColumn,B.endLineNumber,B.endColumn))}return R.open(T,{...D,preview:!1,revealRangeInCenter:!1})}async open(w,T={}){if(w.scheme===E.Schemes.file&&this.recentFilesManager.setMostRecentlyOpenedFile(w.withoutFragment().toString()),T&&T.split)return this.split(T.split,w,Object.assign({},T,{split:void 0,preview:!1}));if(!this.openingPromise.has(w.toString())){const I=this.doOpen(w,T);this.openingPromise.set(w.toString(),I),I.then(()=>{this.openingPromise.delete(w.toString())},()=>{this.openingPromise.delete(w.toString())})}return this.preferenceService.get("editor.previewMode")&&((0,E.isUndefinedOrNull)(T.preview)?!0:T.preview)||this.openingPromise.get(w.toString()).then(()=>{this.pinPreviewed(w)}),this.openingPromise.get(w.toString())}async pin(w){return this.pinPreviewed(w)}getPreventScrollOption(w={}){var T;return(T=w.preventScroll)!==null&&T!==void 0?T:this.preferenceService.get("editor.preventScrollAfterFocused")}async doOpen(w,T={}){var D,I,O;if(!this.resourceService.handlesUri(w))return this.openerService.open(w),!1;let L;try{const R=this.preferenceService.get("editor.previewMode")&&((0,E.isUndefinedOrNull)(T.preview)?!0:T.preview);if(this.currentResource&&this.currentResource.uri.isEqual(w)&&(!T.forceOpenType||T.forceOpenType.type===((D=this.currentOpenType)===null||D===void 0?void 0:D.type))){if(T.focus&&this.currentEditor){const M=this.getPreventScrollOption(T);(I=this._domNode)===null||I===void 0||I.focus({preventScroll:M}),this.currentEditor.monacoEditor.focus()}return T.range&&this.currentEditor&&(this.currentEditor.monacoEditor.setSelection(T.range),setTimeout(()=>{var M;(M=this.currentEditor)===null||M===void 0||M.monacoEditor.revealRangeInCenter(T.range,0)},0)),this.locationInTree(T,w),this.notifyTabChanged(),{group:this,resource:this.currentResource}}else{const M=this._currentOpenType,k=this._currentResource;let B=null,x=this.resources.find(K=>K.uri.toString()===w.toString());if(!x){if(x=await this.resourceService.getResource(w),!x)throw new Error("This uri cannot be opened!: "+w);if(x.deleted){if(T.deletedPolicy==="fail")throw new Error("resource deleted "+w);if(T.deletedPolicy==="skip")return!1}T&&T.label&&(x.name=T.label),T&&(0,E.isDefined)(T.supportsRevive)&&(x.supportsRevive=T.supportsRevive);let K=null;if(T&&T.index!==void 0&&T.index<this.resources.length)K=this.resources[T.index],this.resources.splice(T.index,0,x),B={type:"open",resource:x,index:T.index};else if(this.currentResource){const U=this.resources.indexOf(this.currentResource);this.resources.splice(U+1,0,x),B={type:"open",resource:x,index:U+1},K=this.currentResource}else this.resources.push(x),B={type:"open",resource:x,index:this.resources.length-1};R&&(this.previewURI&&await this.close(this.previewURI,{treatAsNotCurrent:!0,force:T.forceClose}),this.previewURI=x.uri),T.replace&&K&&await this.close(K.uri,{treatAsNotCurrent:!0,force:T.forceClose})}if(T.backend)return this.notifyTabChanged(),!1;if(k&&this.resourceOpenHistory[this.resourceOpenHistory.length-1]!==k.uri){this.resourceOpenHistory.push(k.uri);const K=(O=this.currentCodeEditor)===null||O===void 0?void 0:O.getSelections();K&&K.length>0&&this.recentFilesManager.updateMostRecentlyOpenedFile(k.uri.toString(),{lineNumber:K[0].selectionStartLineNumber,column:K[0].selectionStartColumn})}this._currentOpenType=null,this._currentResource=x;const N=this.reporterService.time(E.REPORT_NAME.EDITOR_REACTIVE);L=new E.Deferred,this.resourceStatus.set(x,L.promise);const j=setTimeout(()=>{this.notifyTabLoading(x)},60);this.notifyTabChanged(),this.notifyBodyChanged();try{await this.displayResourceComponent(x,T)}finally{B&&this._onDidEditorGroupTabOperation.fire(B)}return this._currentOrPreviousFocusedEditor=this.currentEditor,clearTimeout(j),L.resolve(),N.timeEnd(x.uri.toString()),this._onDidEditorFocusChange.fire(),this.setContextKeys(),this.eventBus.fire(new d.EditorGroupOpenEvent({group:this,resource:x})),this.locationInTree(T,w),this.eventBus.fire(new d.EditorGroupChangeEvent({group:this,newOpenType:this.currentOpenType,newResource:this.currentResource,oldOpenType:M,oldResource:k})),{group:this,resource:x}}}catch(R){return(0,E.getDebugLogger)().error(R),L&&L.reject(),(0,c.isEditorError)(R,c.EditorTabChangedError)||this.messageService.error((0,E.formatLocalize)("editor.failToOpen",w.displayName,R.message),[],!0),!1}}locationInTree(w,T){w?.backend||(w?.disableNavigate||this.locateInFileTree(T),w.disableNavigateOnOpendEditor||this.locateInOpenedEditor(T))}locateInFileTree(w){this.explorerAutoRevealConfig&&this.commands.tryExecuteCommand(o.FILE_COMMANDS.LOCATION.id,w)}locateInOpenedEditor(w){this.explorerAutoRevealConfig&&this.commands.tryExecuteCommand(o.OPEN_EDITORS_COMMANDS.LOCATION.id,w)}async openUris(w){for(const T of w)await this.open(T)}async getDocumentModelRef(w){const T=w.toString();return this.holdDocumentModelRefs.has(T)||this.holdDocumentModelRefs.set(T,await this.documentModelManager.createModelReference(w,"editor-group-"+this.name)),this.holdDocumentModelRefs.get(T)}disposeDocumentRef(w){if(w.scheme==="diff"){const T=w.getParsedQuery();this.doDisposeDocRef(new E.URI(T.original)),this.doDisposeDocRef(new E.URI(T.modified))}else w.scheme==="mergeEditor"?this.mergeEditor&&this.mergeEditor.dispose():this.doDisposeDocRef(w)}doDisposeDocRef(w){const T=w.toString();this.holdDocumentModelRefs.has(T)&&(this.holdDocumentModelRefs.get(T).dispose(),this.holdDocumentModelRefs.delete(T))}async openCodeEditor(w,T){this.resolveTabChanged(w,this.currentResource),await this.codeEditorReady.onceReady(async()=>{var D;const I=await this.getDocumentModelRef(w.uri);if(await this.codeEditor.open(I),T.range){const O=new p.Range(T.range.startLineNumber,T.range.startColumn,T.range.endLineNumber,T.range.endColumn);this.codeEditor.monacoEditor.setSelection(O),T.revealRangeInCenter&&setTimeout(()=>{this.codeEditor.monacoEditor.revealRangeInCenter(O,1)})}if(queueMicrotask(()=>{T.scrollTop&&this.codeEditor.monacoEditor.setScrollTop(T.scrollTop),T.scrollLeft&&this.codeEditor.monacoEditor.setScrollLeft(T.scrollLeft)}),T.focus){const O=this.getPreventScrollOption(T);(D=this._domNode)===null||D===void 0||D.focus({preventScroll:O});const L=this.eventBus.on(d.CodeEditorDidVisibleEvent,R=>{var M;if(R.payload.groupName===this.name&&R.payload.type===d.EditorOpenType.code){if(L.dispose(),this.disposed||this!==this.workbenchEditorService.currentEditorGroup)return;if(this.currentEditor===this.codeEditor&&(!((M=this.codeEditor.currentUri)===null||M===void 0)&&M.isEqual(w.uri)))try{this.codeEditor.focus()}catch{}}})}I.instance.dirty&&this.pinPreviewed(w.uri)})}async openDiffEditor(w,T){this.diffEditor||await this.diffEditorDomReady.onceReady(()=>{var L;const R=document.createElement("div");(L=this._diffEditorDomNode)===null||L===void 0||L.appendChild(R),this.createDiffEditor(R)});const D=w,[I,O]=await Promise.all([this.getDocumentModelRef(D.metadata.original),this.getDocumentModelRef(D.metadata.modified)]);await this.diffEditorReady.onceReady(async()=>{var L;if(!(!I||!O)&&(await this.diffEditor.compare(I,O,T,w.uri),T.focus)){const R=this.getPreventScrollOption(T);(L=this._domNode)===null||L===void 0||L.focus({preventScroll:R});const M=this.eventBus.on(d.CodeEditorDidVisibleEvent,k=>{if(k.payload.groupName===this.name&&k.payload.type===d.EditorOpenType.diff){if(M.dispose(),this.disposed||this!==this.workbenchEditorService.currentEditorGroup)return;if(this.currentEditor===this.diffEditor.modifiedEditor)try{this.diffEditor.focus()}catch{}}})}})}async openMergeEditor(w){const{metadata:T}=w;if(!T)return;this.mergeEditor||await this.mergeEditorDomReady.onceReady(()=>{var j;const K=document.createElement("div");(j=this._mergeEditorDomNode)===null||j===void 0||j.appendChild(K),this.createMergeEditor(K)});const{ancestor:D,input1:I,input2:O,output:L}=T,R=m.MergeEditorInputData.from(I),M=m.MergeEditorInputData.from(O),[k,B,x,N]=await Promise.all([this.getDocumentModelRef(E.URI.parse(D)),this.getDocumentModelRef(R.uri),this.getDocumentModelRef(E.URI.parse(L)),this.getDocumentModelRef(M.uri)]);await this.mergeEditorReady.onceReady(async()=>{await this.mergeEditor.open({ancestor:{uri:E.URI.parse(T.ancestor),textModel:k.instance.getMonacoModel(),baseContent:k.instance.baseContent||""},input1:R.setTextModel(B.instance.getMonacoModel()),input2:M.setTextModel(N.instance.getMonacoModel()),output:{uri:E.URI.parse(T.output),textModel:x.instance.getMonacoModel()}})})}async openCustomEditor(w,T){const D=this.editorComponentRegistry.getEditorComponent(T),I=this.editorComponentRegistry.getEditorInitialProps(T);if(D){if(this.activateComponentsProps.set(D,I),D.renderMode===d.EditorComponentRenderMode.ONE_PER_RESOURCE){const O=this.activeComponents.get(D)||[];O.findIndex(R=>R.uri.toString()===w.uri.toString())===-1&&O.push(w),this.activeComponents.set(D,O)}else if(D.renderMode===d.EditorComponentRenderMode.ONE_PER_GROUP)this.activeComponents.set(D,[w]);else if(D.renderMode===d.EditorComponentRenderMode.ONE_PER_WORKBENCH){const O=[];this.workbenchEditorService.editorGroups.forEach(L=>{if(L===this)return;const R=L.resources.find(M=>M.uri.isEqual(w.uri));R&&O.push(L.close(R.uri))}),await Promise.all(O).catch((0,E.getDebugLogger)().error),this.activeComponents.set(D,[w])}}else throw new Error("Cannot find Editor Component with id: "+T);this._onCurrentEditorCursorChange.fire({position:null,selectionLength:0})}async displayResourceComponent(w,T){T.revealRangeInCenter===void 0&&(T.revealRangeInCenter=!0);const D=w,I=await this.resolveOpenType(w,T);if(I){const{activeOpenType:O,openTypes:L}=I;switch(this.availableOpenTypes=L,T.preserveFocus&&(T.focus=!1),O.type){case d.EditorOpenType.code:await this.openCodeEditor(w,T);break;case d.EditorOpenType.diff:await this.openDiffEditor(w,T);break;case d.EditorOpenType.mergeEditor:await this.openMergeEditor(w);break;case d.EditorOpenType.component:await this.openCustomEditor(w,O.componentId);break;default:return}this.resolveTabChanged(D,this.currentResource),this._currentOpenType=O,this.notifyBodyChanged(),this.doLayoutEditors(),this.cachedResourcesActiveOpenTypes.set(w.uri.toString(),O)}}resolveTabChanged(w,T){if(w!==T)throw new c.EditorTabChangedError}getLastOpenType(w){return this.cachedResourcesActiveOpenTypes.get(w.uri.toString())}async resolveOpenType(w,T){const D=this.cachedResourcesOpenTypes.get(w.uri.toString())||await this.editorComponentRegistry.resolveEditorComponent(w),I=this.preferenceService.get("workbench.editorAssociations"),O=y(D,this.cachedResourcesActiveOpenTypes.get(w.uri.toString()),w,I,T.forceOpenType);return this.cachedResourcesOpenTypes.set(w.uri.toString(),D),{activeOpenType:O,openTypes:D}}async close(w,{treatAsNotCurrent:T,force:D}={}){const I=this.resources.findIndex(O=>O.uri.toString()===w.toString());if(I!==-1){const O=this.resources[I];if(!D&&!await this.shouldClose(O))return!1;if(this.resources.splice(I,1),this._onDidEditorGroupTabOperation.fire({type:"close",resource:O,index:I}),this.eventBus.fire(new d.EditorGroupCloseEvent({group:this,resource:O})),this.previewURI&&this.previewURI.isEqual(w)&&(this.previewURI=null),O===this.currentResource&&!T){let L;for(;this.resourceOpenHistory.length>0;)if(this.resources.findIndex(R=>R.uri===this.resourceOpenHistory[this.resourceOpenHistory.length-1])!==-1){L=this.resourceOpenHistory.pop();break}else this.resourceOpenHistory.pop();if(L)this.open(L);else{let R=I;for(;R>0&&!this.resources[R];)R--;this.resources[R]?this.open(this.resources[R].uri):this.backToEmpty()}}else this.notifyTabChanged();this.removeResouceFromActiveComponents(O),this.disposeDocumentRef(w)}return this.resources.length===0&&(this.grid.parent&&this.dispose(),this.availableOpenTypes=[]),!0}removeResouceFromActiveComponents(w){this.activeComponents.forEach((T,D)=>{const I=T.indexOf(w);I!==-1&&(T.splice(I,1),this.eventBus.fire(new d.ResoucesOfActiveComponentChangedEvent({component:D,resources:T})))})}async shouldClose(w){const T=this.workbenchEditorService.editorGroups.map(D=>D.resources);if(await this.resourceService.shouldCloseResource(w,T)){let D=0;for(const I of T)for(const O of I)if(O.uri.isEqual(w.uri)&&(D++,D>=2))break;return D<=1&&this.resourceService.disposeResource(w),!0}else return!1}backToEmpty(){const w=this._currentOpenType,T=this._currentResource;this._currentResource=null,this.resetOpenType(),this.notifyTabChanged(),this.notifyBodyChanged(),this._currentOrPreviousFocusedEditor=null,this._onDidEditorFocusChange.fire(),this.eventBus.fire(new d.EditorGroupChangeEvent({group:this,newOpenType:this.currentOpenType,newResource:this.currentResource,oldOpenType:w,oldResource:T}))}async closeAll(){for(const T of this.resources)if(!await this.shouldClose(T))return!1;return this.resources.splice(0,this.resources.length).reverse().forEach((T,D)=>{this.clearResourceOnClose(T),this._onDidEditorGroupTabOperation.fire({type:"close",resource:T,index:D})}),this.activeComponents.clear(),this.workbenchEditorService.editorGroups.length>1&&this.dispose(),this.previewURI=null,this.backToEmpty(),!0}async closeSaved(){const w=this.resources.filter(T=>{const D=this.resourceService.getResourceDecoration(T.uri);if(!D||!D.dirty)return!0});for(const T of w)if(!await this.shouldClose(T))return;for(const T of w)await this.close(T.uri)}async closeToRight(w){const T=this.resources.findIndex(D=>D.uri.toString()===w.toString());if(T!==-1){const D=this.resources.slice(T+1);for(const I of D)if(!await this.shouldClose(I))return;this.resources.splice(T+1),D.reverse().forEach((I,O)=>{this._onDidEditorGroupTabOperation.fire({type:"close",resource:I,index:T+1+(D.length-1-O)})});for(const I of D)this.clearResourceOnClose(I);this.open(w)}}clearResourceOnClose(w){this.eventBus.fire(new d.EditorGroupCloseEvent({group:this,resource:w})),this.removeResouceFromActiveComponents(w)}async closeOthers(w){const T=this.resources.findIndex(D=>D.uri.toString()===w.toString());if(T!==-1){const D=this.resources.filter((O,L)=>L!==T);for(const O of D)if(!await this.shouldClose(O))return;const I=this.resources;this.resources=[this.resources[T]],D.reverse().forEach(O=>{this._onDidEditorGroupTabOperation.fire({type:"close",resource:O,index:I.indexOf(O)})});for(const O of D)this.clearResourceOnClose(O);await this.open(w)}}get currentResource(){return this._currentResource}get currentOpenType(){return this._currentOpenType}async changeOpenType(w){const T=this.availableOpenTypes.find(I=>I.type===w||I.componentId===w);if(!T||!this.currentResource||S(T,this.currentOpenType))return;const D=this.currentOpenType;await this.displayResourceComponent(this.currentResource,{forceOpenType:T}),this.eventBus.fire(new d.EditorGroupChangeEvent({group:this,newOpenType:this.currentOpenType,newResource:this.currentResource,oldOpenType:D,oldResource:this.currentResource}))}async dropUri(w,T,D,I){if(T!==d.DragOverPosition.CENTER)await this.split((0,s.getSplitActionFromDragDrop)(T),w,{preview:!1,focus:!0});else if(!I)await this.open(w,{preview:!1,focus:!0});else{const O=this.resources.indexOf(I);if(O===-1)await this.open(w,{preview:!1,focus:!0});else{const L=this.resources.findIndex(R=>R.uri.toString()===w.toString());if(L===-1)await this.open(w,{index:O,preview:!1});else{const R=this.resources[L];L>O?(this.resources.splice(L,1),this.resources.splice(O,0,R),this._onDidEditorGroupTabOperation.fire({type:"move",resource:R,oldIndex:L,index:O}),await this.open(w,{preview:!1})):L<O&&(this.resources.splice(O+1,0,R),this.resources.splice(L,1),this._onDidEditorGroupTabOperation.fire({type:"move",resource:R,oldIndex:L,index:O}),await this.open(w,{preview:!1}))}}}D&&(D!==this?await D.close(w):T!==d.DragOverPosition.CENTER&&await this.close(w))}gainFocus(){this.workbenchEditorService.setCurrentGroup(this)}focus(){this.gainFocus(),this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.codeEditor.focus(),this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.diffEditor.focus()}dispose(){var w;(w=this.grid)===null||w===void 0||w.dispose(),this.workbenchEditorService.removeGroup(this),super.dispose(),this.codeEditor&&this.codeEditor.dispose(),this.diffEditor&&this.diffEditor.dispose(),this.toDispose.forEach(T=>T.dispose()),this.eventBus.fire(new d.EditorGroupDisposeEvent({group:this}))}getState(){const w=this.resources.filter(f).map(T=>T.uri.toString());return{uris:w,current:this.currentResource&&f(this.currentResource)?this.currentResource.uri.toString():void 0,previewIndex:this.previewURI?w.indexOf(this.previewURI.toString()):-1}}isCodeEditorMode(){return!!this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code}isDiffEditorMode(){return!!this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff}activeEditorIsDirty(){return this.hasDirty()&&this.workbenchEditorService.currentEditorGroup===this}isComponentMode(){return!!this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.component}async restoreState(w){this._restoringState=!0,this.previewURI=w.uris[w.previewIndex]?new E.URI(w.uris[w.previewIndex]):null,await Promise.all(w.uris.map(async D=>{await this.doOpen(new E.URI(D),{disableNavigate:!0,backend:!0,preview:!1,deletedPolicy:"skip"})}));let T;w.current?T=new E.URI(w.current):w.uris.length>0&&(T=new E.URI(w.uris[w.uris.length-1])),T&&(await this.open(T,{deletedPolicy:"skip"})||this.resources[0]&&await this.open(this.resources[0].uri)),this._restoringState=!1,this.notifyTabChanged()}async saveAll(w,T){for(const D of this.resources)!w&&D.uri.scheme===E.Schemes.untitled||await this.saveResource(D,T)}async saveResource(w,T=s.SaveReason.Manual){if(await this.saveByOpenType(w,T))return;const D=this.documentModelManager.getModelReference(w.uri);D&&(await D.instance.save(void 0,T),D.dispose())}async saveByOpenType(w,T){const D=this.cachedResourcesActiveOpenTypes.get(w.uri.toString());if(D&&D.saveResource)try{return await D.saveResource(w,T),!0}catch(I){this.logger.error(I)}return!1}async saveCurrent(w=s.SaveReason.Manual){const T=this.currentResource;if(T&&!await this.saveByOpenType(T,w)&&this.currentEditor)return this.currentEditor.save()}hasDirty(){for(const w of this.resources){const T=this.documentModelManager.getModelDescription(w.uri);if(T&&T.dirty)return!0}return!1}calcDirtyCount(w=new Set){let T=0;for(const D of this.resources){const I=this.documentModelManager.getModelDescription(D.uri,"calc-dirty-count");w.has(D.uri.toString())||(w.add(D.uri.toString()),I&&I.dirty&&(T+=1))}return T}componentUndo(){const w=this.currentOpenType;w?.undo&&w.undo(this.currentResource)}componentRedo(){const w=this.currentOpenType;w?.redo&&w.redo(this.currentResource)}toJSON(){return{name:this.name}}};t.EditorGroup=b,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.EditorCollectionService)],b.prototype,"collectionService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.ResourceService)],b.prototype,"resourceService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",d.EditorComponentRegistry)],b.prototype,"editorComponentRegistry",void 0),n.__decorate([(0,r.Autowired)(s.WorkbenchEditorService),n.__metadata("design:type",a)],b.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(g.IEditorDocumentModelService),n.__metadata("design:type",Object)],b.prototype,"documentModelManager",void 0),n.__decorate([(0,r.Autowired)(E.CommandService),n.__metadata("design:type",Object)],b.prototype,"commands",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],b.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.RecentFilesManager),n.__metadata("design:type",o.RecentFilesManager)],b.prototype,"recentFilesManager",void 0),n.__decorate([(0,r.Autowired)(v.IMessageService),n.__metadata("design:type",Object)],b.prototype,"messageService",void 0),n.__decorate([(0,r.Autowired)(E.IReporterService),n.__metadata("design:type",Object)],b.prototype,"reporterService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],b.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(o.IOpenerService),n.__metadata("design:type",Object)],b.prototype,"openerService",void 0),n.__decorate([(0,r.Autowired)(E.ILogger),n.__metadata("design:type",Object)],b.prototype,"logger",void 0),n.__decorate([(0,E.OnEvent)(s.ResourceDecorationChangeEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[s.ResourceDecorationChangeEvent]),n.__metadata("design:returntype",void 0)],b.prototype,"onResourceDecorationChangeEvent",null),n.__decorate([(0,E.OnEvent)(d.ResourceOpenTypeChangedEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.ResourceOpenTypeChangedEvent]),n.__metadata("design:returntype",void 0)],b.prototype,"oResourceOpenTypeChangedEvent",null),n.__decorate([(0,E.OnEvent)(d.RegisterEditorComponentEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",Promise)],b.prototype,"onRegisterEditorComponentEvent",null),t.EditorGroup=b=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Number])],b);function y(A,w,T,D,I){if(I)return A.find(O=>S(O,I))||A[0];if(w)return A.find(O=>S(O,w))||A[0];if(D){const O=A.find(L=>{const R=Object.keys(D).find(B=>(0,E.match)(B,T.uri.path.toString().toLowerCase())||(0,E.match)(B,T.uri.path.base.toLowerCase())),M=R&&D[R];if(!M)return!1;const k=`${E.CUSTOM_EDITOR_SCHEME}-${M}`;return L.componentId===k});if(O)return O}return A[0]}function S(A,w){return A.type===w.type&&(A.type!==d.EditorOpenType.component||A.componentId===w.componentId)}},94180:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TabbarLeftExtraContentId=t.TabbarRightExtraContentId=void 0,t.TabbarRightExtraContentId="tabbar-right-extra-content",t.TabbarLeftExtraContentId="tabbar-left-extra-content"},93107:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IDocPersistentCacheProvider=void 0,t.isDocContentCache=e,t.isDocChangesCache=n,t.parseCacheValueFrom=r,t.IDocPersistentCacheProvider=Symbol("IDocPersistentCacheProvider");function e(o){return o.hasOwnProperty("content")}function n(o){return o.hasOwnProperty("changeMatrix")}function r(o){const l=o.text,m=o.range.startLineNumber,E=o.range.startColumn,p=o.range.endLineNumber,v=o.range.endColumn;return[l,m,E,p,v]}},55113:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AUTO_SAVE_MODE=t.SaveReason=t.Direction=t.EditorGroupSplitAction=t.DragOverPosition=t.EditorOpenType=t.IEditorPriority=t.OverviewRulerLane=t.WorkbenchEditorService=t.DidApplyEditorDecorationFromProvider=t.DidChangeEditorGroupUriEvent=t.CollectionEditorsUpdateEvent=t.EditorCollectionService=t.EditorType=t.ShowLightbulbIconMode=void 0,t.getSimpleEditorOptions=y,t.isTextEditorViewState=S;const n=e(85608),r=e(76003),o=e(43718);var l=e(20868);Object.defineProperty(t,"ShowLightbulbIconMode",{enumerable:!0,get:function(){return l.ShowLightbulbIconMode}});var m;(function(A){A[A.CODE=0]="CODE",A[A.ORIGINAL_DIFF=1]="ORIGINAL_DIFF",A[A.MODIFIED_DIFF=2]="MODIFIED_DIFF",A.MERGE_EDITOR_DIFF="MERGE_EDITOR_DIFF"})(m||(t.EditorType=m={}));let E=class{};t.EditorCollectionService=E,t.EditorCollectionService=E=n.__decorate([(0,r.Injectable)()],E);class p extends o.BasicEvent{}t.CollectionEditorsUpdateEvent=p;class v extends o.BasicEvent{}t.DidChangeEditorGroupUriEvent=v;class s extends o.BasicEvent{}t.DidApplyEditorDecorationFromProvider=s;class g{}t.WorkbenchEditorService=g;var c;(function(A){A[A.Left=1]="Left",A[A.Center=2]="Center",A[A.Right=4]="Right",A[A.Full=7]="Full"})(c||(t.OverviewRulerLane=c={}));var h;(function(A){A.builtin="builtin",A.option="option",A.exclusive="exclusive",A.default="default"})(h||(t.IEditorPriority=h={}));var d;(function(A){A.code="code",A.diff="diff",A.mergeEditor="mergeEditor",A.component="component"})(d||(t.EditorOpenType=d={}));var u;(function(A){A.LEFT="left",A.RIGHT="right",A.TOP="top",A.BOTTOM="bottom",A.CENTER="center"})(u||(t.DragOverPosition=u={}));var _;(function(A){A[A.Top=1]="Top",A[A.Bottom=2]="Bottom",A[A.Left=3]="Left",A[A.Right=4]="Right"})(_||(t.EditorGroupSplitAction=_={}));var f;(function(A){A.UP="up",A.DOWN="down",A.LEFT="left",A.RIGHT="right"})(f||(t.Direction=f={}));var a;(function(A){A[A.Manual=1]="Manual",A[A.AfterDelay=2]="AfterDelay",A[A.FocusOut=3]="FocusOut"})(a||(t.SaveReason=a={}));var b;(function(A){A.OFF="off",A.AFTER_DELAY="afterDelay",A.EDITOR_FOCUS_CHANGE="editorFocusChange",A.WINDOWS_LOST_FOCUS="windowLostFocus"})(b||(t.AUTO_SAVE_MODE=b={}));function y(){return{fontSize:12,fontWeight:"normal",lineHeight:0,wordWrap:"on",overviewRulerLanes:0,glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,hideCursorInOverviewRuler:!0,selectionHighlight:!1,scrollbar:{horizontal:"hidden"},lineDecorationsWidth:0,overviewRulerBorder:!1,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",minimap:{enabled:!1},guides:{highlightActiveIndentation:!1,indentation:!1,bracketPairs:!1}}}function S(A){const w=A;if(!w)return!1;const T=w;if(T.modified)return S(T.modified);const D=w;return!!(D.contributionsState&&D.viewState&&Array.isArray(D.cursorState))}},23418:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(94180),t),n.__exportStar(e(93107),t),n.__exportStar(e(55113),t),n.__exportStar(e(23950),t),n.__exportStar(e(27693),t),n.__exportStar(e(46225),t),n.__exportStar(e(4308),t),n.__exportStar(e(39467),t)},27693:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ILanguageStatusService=void 0,t.ILanguageStatusService=Symbol("ILanguageStatusService")},23950:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticTag=t.DiagnosticSeverity=t.ILanguageService=void 0,t.asSeverity=l,t.asRelatedInformations=m,t.asRelatedInformation=E,t.asMonacoDiagnostics=p,t.asMonacoDiagnostic=v;const n=e(43718);t.ILanguageService=Symbol("ILanguageService");var r;(function(s){s[s.Error=1]="Error",s[s.Warning=2]="Warning",s[s.Information=3]="Information",s[s.Hint=4]="Hint"})(r||(t.DiagnosticSeverity=r={}));var o;(function(s){s[s.Unnecessary=1]="Unnecessary",s[s.Deprecated=2]="Deprecated"})(o||(t.DiagnosticTag=o={}));function l(s){return s===1?n.MarkerSeverity.Error:s===2?n.MarkerSeverity.Warning:s===3?n.MarkerSeverity.Info:n.MarkerSeverity.Hint}function m(s){if(s)return s.map(g=>E(g))}function E(s){return{resource:n.Uri.parse(s.location.uri),startLineNumber:s.location.range.start.line+1,startColumn:s.location.range.start.character+1,endLineNumber:s.location.range.end.line+1,endColumn:s.location.range.end.character+1,message:s.message}}function p(s){if(s)return s.map(g=>v(g))}function v(s){return{code:typeof s.code=="number"?s.code.toString():typeof s.code=="object"?{value:s.code.value.toString(),target:s.code.target}:s.code,severity:l(s.severity),message:s.message,source:s.source,startLineNumber:s.range.start.line+1,startColumn:s.range.start.character+1,endLineNumber:s.range.end.line+1,endColumn:s.range.end.character+1,relatedInformation:m(s.relatedInformation),tags:s.tags}}},46225:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notebookCellScheme=t.INotebookService=t.CellKind=t.NotebookCellsChangeType=void 0;var e;(function(r){r[r.ModelChange=1]="ModelChange",r[r.Move=2]="Move",r[r.ChangeCellLanguage=5]="ChangeCellLanguage",r[r.Initialize=6]="Initialize",r[r.ChangeCellMetadata=7]="ChangeCellMetadata",r[r.Output=8]="Output",r[r.OutputItem=9]="OutputItem",r[r.ChangeCellContent=10]="ChangeCellContent",r[r.ChangeDocumentMetadata=11]="ChangeDocumentMetadata",r[r.ChangeCellInternalMetadata=12]="ChangeCellInternalMetadata",r[r.ChangeCellMime=13]="ChangeCellMime",r[r.Unknown=100]="Unknown"})(e||(t.NotebookCellsChangeType=e={}));var n;(function(r){r[r.Markup=1]="Markup",r[r.Code=2]="Code"})(n||(t.CellKind=n={})),t.INotebookService=Symbol("INotebookService"),t.notebookCellScheme="vscode-notebook-cell"},4308:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskSaveResult=t.DIFF_SCHEME=t.ResourceDecorationNeedChangeEvent=t.ResourceDecorationChangeEvent=t.ResourceRemoveEvent=t.ResourceDidUpdateEvent=t.ResourceNeedUpdateEvent=t.ResourceService=void 0,t.isDiffResource=v;const n=e(43718);class r{}t.ResourceService=r;class o extends n.BasicEvent{}t.ResourceNeedUpdateEvent=o;class l extends n.BasicEvent{}t.ResourceDidUpdateEvent=l;class m extends n.BasicEvent{}t.ResourceRemoveEvent=m;class E extends n.BasicEvent{}t.ResourceDecorationChangeEvent=E;class p extends n.BasicEvent{}t.ResourceDecorationNeedChangeEvent=p,t.DIFF_SCHEME="diff";function v(g){return g.uri.scheme===t.DIFF_SCHEME}var s;(function(g){g[g.REVERT=1]="REVERT",g[g.SAVE=2]="SAVE",g[g.CANCEL=3]="CANCEL"})(s||(t.AskSaveResult=s={}))},39467:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSplitActionFromDragDrop=r;const n=e(55113);function r(o){return{[n.DragOverPosition.LEFT]:n.EditorGroupSplitAction.Left,[n.DragOverPosition.RIGHT]:n.EditorGroupSplitAction.Right,[n.DragOverPosition.BOTTOM]:n.EditorGroupSplitAction.Bottom,[n.DragOverPosition.TOP]:n.EditorGroupSplitAction.Top}[o]}},54414:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(23418),t)},32595:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExplorerContribution=t.EXPLORER_CONTAINER_ID=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(30144);Object.defineProperty(t,"EXPLORER_CONTAINER_ID",{enumerable:!0,get:function(){return l.EXPLORER_CONTAINER_ID}});const m=e(21634),E=e(68456),p=e(43718);let v=class{registerComponent(g){g.register("@opensumi/ide-explorer",[],{iconClass:(0,o.getIcon)("explorer"),title:(0,o.localize)("explorer.title"),priority:10,containerId:l.EXPLORER_CONTAINER_ID,activateKeyBinding:"ctrlcmd+shift+e"})}onStart(){this.extensionsSchemaService.appendExtensionPoint(["browserViews","properties"],{extensionPoint:l.EXPLORER_CONTAINER_ID,frameworkKind:["opensumi"],jsonSchema:{...m.browserViews.properties,description:(0,o.formatLocalize)("sumiContributes.browserViews.location.custom",(0,o.localize)("explorer.title"))}})}};t.ExplorerContribution=v,n.__decorate([(0,r.Autowired)(p.IExtensionsSchemaService),n.__metadata("design:type",Object)],v.prototype,"extensionsSchemaService",void 0),t.ExplorerContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution,E.ComponentContribution)],v)},59027:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExplorerModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(32595);let m=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[l.ExplorerContribution]}};t.ExplorerModule=m,t.ExplorerModule=m=n.__decorate([(0,r.Injectable)()],m)},18531:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExpressFileServerContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(32242),m=e(90242);let E=class{registerStaticResolver(v){v.registerStaticResourceProvider({scheme:o.Schemes.file,resolveStaticResource:s=>{const g=new o.URI(this.appConfig.staticServicePath||m.EXPRESS_SERVER_PATH),[c,h]=s.codeUri.path.split("?");return g.resolve(`assets${decodeURIComponent(c)}`).withQuery(h)},roots:[this.appConfig.staticServicePath||m.EXPRESS_SERVER_PATH]})}};t.ExpressFileServerContribution=E,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],E.prototype,"appConfig",void 0),t.ExpressFileServerContribution=E=n.__decorate([(0,o.Domain)(l.StaticResourceContribution)],E)},98885:(P,t,e)=>{"use strict";var n;n={value:!0},t.Q=void 0;const r=e(85608),o=e(76003),l=e(41869),m=e(18531);let E=class extends l.BrowserModule{constructor(){super(...arguments),this.providers=[m.ExpressFileServerContribution]}};t.Q=E,t.Q=E=r.__decorate([(0,o.Injectable)()],E)},90242:(P,t,e)=>{"use strict";var n=e(39907);Object.defineProperty(t,"__esModule",{value:!0}),t.ALLOW_MIME=t.EXPRESS_SERVER_PATH=t.EXPRESS_SERVER_PORT=void 0,t.EXPRESS_SERVER_PORT=8e3,t.EXPRESS_SERVER_PATH=n.env.STATIC_SERVER_PATH||`http://127.0.0.1:${t.EXPRESS_SERVER_PORT}/`,t.ALLOW_MIME={gif:"image/gif",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",webp:"image/webp",svg:"image/svg+xml",ttf:"font/ttf",eot:"font/eot",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",js:"application/javascript",css:"text/css",mp4:"video/mp4",ogg:"video/ogg",webm:"video/webm"}},21082:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EXTENSION_SCHEME=t.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID=void 0;const n=e(30144);t.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID=n.EXTENSION_CONTAINER_ID,t.EXTENSION_SCHEME="extension"},6449:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionOverview=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),l=e(68974),m=e(95422),E=e(43718),p=e(93374),v=e(29150),s=n.__importDefault(e(40769));var g;(function(d){d.details="Details",d.changelog="ChangeLog",d.deps="Dependencies"})(g||(g={}));const c=[g.details,g.changelog,g.deps],h=({resource:d})=>{var u,_,f,a,b,y,S,A,w,T,D,I,O,L,R,M,k,B,x,N,j,K,U,X,z;const Q=(0,m.useInjectable)(v.VSXExtensionServiceToken),[G,J]=(0,r.useState)(!0),[Y,H]=(0,r.useState)(((u=d.metadata)===null||u===void 0?void 0:u.state)===v.InstallState.INSTALLED?4:0),[$,Z]=(0,r.useState)(g.details),[re,ce]=(0,r.useState)({}),ge=(0,r.useCallback)(ie=>{const se=c[ie];se&&Z(se)},[]),Ae=(0,r.useCallback)(async()=>{var ie;const se=await Q.getRemoteRawExtension((ie=d.metadata)===null||ie===void 0?void 0:ie.extensionId);if(se){const me=["readme","changelog"].map(Ce=>{var Ee,xe;const Ye=(Ee=se.files)===null||Ee===void 0?void 0:Ee[Ce];return Ye?fetch(Ye).then(Ue=>Ue.text()):(xe=se[Ce])!==null&&xe!==void 0?xe:""}),[ye,_e]=await Promise.all(me);ce({readme:ye,changelog:_e,downloadCount:se.downloadCount})}J(!1)},[d]),te=(0,r.useCallback)(async()=>{var ie;const se=await Q.getLocalExtension((ie=d.metadata)===null||ie===void 0?void 0:ie.extensionId);se&&(H(1),Q.install(se).finally(()=>{H(4)}))},[d]),Pe=(0,r.useCallback)(async()=>{var ie;const se=await Q.getLocalExtension((ie=d.metadata)===null||ie===void 0?void 0:ie.extensionId);se&&(H(2),Q.uninstall(se).finally(()=>{H(3)}))},[d]);(0,r.useEffect)(()=>{Ae()},[d]);const Te=(0,r.useMemo)(()=>{var ie,se,me;const ye=[];if(((ie=d.metadata)===null||ie===void 0?void 0:ie.state)!==v.InstallState.NOT_INSTALLED)if(Y!==3)ye.push(r.default.createElement(o.Button,{size:"small",key:"uninstall",onClick:Pe,disabled:Y===2},(0,E.localize)(Y===2?"marketplace.extension.uninstalling":"marketplace.extension.uninstall")));else return ye.push(r.default.createElement(o.Button,{size:"small",key:"uninstalled",disabled:!0},(0,E.localize)("marketplace.extension.uninstalled"))),ye;return((se=d.metadata)===null||se===void 0?void 0:se.state)===v.InstallState.NOT_INSTALLED?Y===4?ye.push(r.default.createElement(o.Button,{size:"small",key:"installed",disabled:!0},(0,E.localize)("marketplace.extension.installed"))):ye.push(r.default.createElement(o.Button,{size:"small",key:"install",onClick:te,disabled:Y!==0},(0,E.localize)(Y===1?"marketplace.extension.installing":"marketplace.extension.install"))):((me=d.metadata)===null||me===void 0?void 0:me.state)===v.InstallState.SHOULD_UPDATE?Y===4?ye.push(r.default.createElement(o.Button,{size:"small",key:"installed",disabled:!0},(0,E.localize)("marketplace.extension.installed"))):ye.push(r.default.createElement(o.Button,{size:"small",key:"update",onClick:te,disabled:Y!==0},(0,E.localize)(Y===1?"marketplace.extension.updating":"marketplace.extension.update"))):ye.push(r.default.createElement(o.Button,{size:"small",key:"installed",disabled:!0},(0,E.localize)("marketplace.extension.installed"))),ye},[d,Y]);return r.default.createElement("div",{className:s.default.extension_overview_container},r.default.createElement(l.Progress,{loading:G}),r.default.createElement("div",{className:s.default.extension_overview_header},!((_=d.metadata)===null||_===void 0)&&_.iconUrl?r.default.createElement("img",{src:(f=d.metadata)===null||f===void 0?void 0:f.iconUrl,alt:(0,E.replaceLocalizePlaceholder)((a=d.metadata)===null||a===void 0?void 0:a.displayName,(b=d.metadata)===null||b===void 0?void 0:b.extensionId)}):r.default.createElement("div",{className:s.default.default_icon},r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("extension")})),r.default.createElement("div",{className:s.default.extension_detail},r.default.createElement("div",{className:s.default.extension_name},r.default.createElement("h1",null,r.default.createElement("a",{href:`${(y=d.metadata)===null||y===void 0?void 0:y.openVSXRegistry}/extension/${(S=d.metadata)===null||S===void 0?void 0:S.namespace.toLowerCase()}/${(A=d.metadata)===null||A===void 0?void 0:A.name.toLowerCase()}`,target:"_blank",rel:"noopener noreferrer"},(0,E.replaceLocalizePlaceholder)((w=d.metadata)===null||w===void 0?void 0:w.displayName,(T=d.metadata)===null||T===void 0?void 0:T.extensionId)||((D=d.metadata)===null||D===void 0?void 0:D.name))),r.default.createElement("span",{className:s.default.extension_id},((I=d.metadata)===null||I===void 0?void 0:I.namespace.toLowerCase())+"."+((O=d.metadata)===null||O===void 0?void 0:O.name.toLowerCase()))),r.default.createElement("div",{className:s.default.manifest},r.default.createElement("span",null,r.default.createElement("a",{href:(L=d.metadata)===null||L===void 0?void 0:L.namespaceUrl,target:"_blank",rel:"noopener noreferrer"},(R=d.metadata)===null||R===void 0?void 0:R.namespace)),r.default.createElement("span",null,r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("download")}),((M=d.metadata)===null||M===void 0?void 0:M.downloadCount)||re.downloadCount),((k=d.metadata)===null||k===void 0?void 0:k.averageRating)&&r.default.createElement("span",null,(B=d.metadata)===null||B===void 0?void 0:B.averageRating),((x=d.metadata)===null||x===void 0?void 0:x.repository)&&r.default.createElement("span",null,r.default.createElement("a",{href:(N=d.metadata)===null||N===void 0?void 0:N.repository,target:"blank"},"Repository")),((j=d.metadata)===null||j===void 0?void 0:j.license)&&r.default.createElement("span",null,r.default.createElement("a",{href:(K=d.metadata)===null||K===void 0?void 0:K.files.license,target:"blank"},"License")),r.default.createElement("span",null,"v",(U=d.metadata)===null||U===void 0?void 0:U.version)),r.default.createElement("div",{className:s.default.description},(0,E.replaceLocalizePlaceholder)((X=d.metadata)===null||X===void 0?void 0:X.description,(z=d.metadata)===null||z===void 0?void 0:z.extensionId)),r.default.createElement("div",{className:s.default.buttons},Te))),r.default.createElement("div",{className:s.default.extension_overview_body},r.default.createElement(o.Tabs,{className:s.default.tabs,value:$,onChange:ge,tabs:[g.details,g.changelog]}),r.default.createElement("div",{className:s.default.extension_content},$===g.details&&re.readme&&r.default.createElement(p.Markdown,{content:re.readme}),$===g.changelog&&re.changelog&&r.default.createElement(p.Markdown,{content:re.changelog}))))};t.ExtensionOverview=h},87791:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Extension=t.ExtensionViewType=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),l=e(41869),m=e(43718),E=e(29150),p=n.__importDefault(e(90425));var v;(function(s){s[s.MARKETPLACE=0]="MARKETPLACE",s[s.INSTALLED=1]="INSTALLED"})(v||(t.ExtensionViewType=v={})),t.Extension=r.default.memo(({extension:s,onInstall:g,onClick:c,type:h,installedExtensions:d,openVSXRegistry:u})=>{const _=(0,l.useDesignStyles)(p.default.extension_item,"extension_item"),[f,a]=(0,r.useState)(),b=d?.find(I=>I.namespace===s.namespace&&I.name===s.name),y=!!(h===v.INSTALLED||b),S=y&&h===v.MARKETPLACE&&b?.version!==s.version,[A,w]=(0,r.useState)(y),T=(0,r.useCallback)(I=>{I.stopPropagation(),a(!0),g(s).then(()=>{a(!1),w(!0)})},[s]),D=(0,r.useCallback)(()=>{c(s,A?S?E.InstallState.SHOULD_UPDATE:E.InstallState.INSTALLED:E.InstallState.NOT_INSTALLED)},[s]);return r.default.createElement("div",{className:_,onClick:D},s.iconUrl?r.default.createElement("img",{className:p.default.icon,src:s.iconUrl,alt:(0,m.replaceLocalizePlaceholder)(s.displayName,`${s.publisher}.${s.name}`)}):r.default.createElement("div",{className:p.default.default_icon},r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("extension")})),r.default.createElement("div",{className:p.default.extension_detail},r.default.createElement("div",{className:p.default.base_info},r.default.createElement("span",{className:p.default.display_name},(0,m.replaceLocalizePlaceholder)(s.displayName,`${s.publisher}.${s.name}`)||s.name),r.default.createElement("span",{className:p.default.version},s.version),!A&&r.default.createElement("span",{className:p.default.download_count},r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("download")}),s.downloadCount)),r.default.createElement("span",{className:p.default.description},(0,m.replaceLocalizePlaceholder)(s.description,`${s.publisher}.${s.name}`)),r.default.createElement("div",{className:p.default.footer},r.default.createElement("span",{className:p.default.namespace},s.namespace),h===v.MARKETPLACE&&(y?S?r.default.createElement(o.Button,{type:"primary",size:"small",onClick:T,disabled:f},(0,m.localize)(f?"marketplace.extension.updating":"marketplace.extension.update")):r.default.createElement("span",{className:p.default.state_text},(0,m.localize)("marketplace.extension.installed")):r.default.createElement(o.Button,{type:"primary",size:"small",onClick:T,disabled:f},(0,m.localize)(f?"marketplace.extension.installing":"marketplace.extension.install"))),h===v.INSTALLED&&r.default.createElement(o.Button,{type:"primary",size:"small",onClick:T,disabled:!0},(0,m.localize)("marketplace.extension.installed")))))})},38105:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenVsxExtensionManagerModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(29150),m=e(70274),E=e(67761);let p=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[m.VSXExtensionContribution,{token:l.VSXExtensionServiceToken,useClass:E.VSXExtensionService}],this.backServices=[{servicePath:l.VSXExtensionServicePath}]}};t.OpenVsxExtensionManagerModule=p,t.OpenVsxExtensionManagerModule=p=n.__decorate([(0,r.Injectable)()],p)},70274:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VSXExtensionContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(57517),E=e(63067),p=e(52416),v=e(29150),s=e(21082),g=e(6449),c=e(73689);let h=class{initialize(){}onDidRender(){const u=this.mainLayoutService.getTabbarHandler(s.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID);u&&(u.isActivated()?this.vsxExtensionService.getOpenVSXRegistry().then(()=>{this.vsxExtensionService.search("")}):u.onActivate(async()=>{!this.vsxExtensionService.openVSXRegistry&&await this.vsxExtensionService.getOpenVSXRegistry(),this.vsxExtensionService.search("")}))}registerResource(u){u.registerResourceProvider({scheme:s.EXTENSION_SCHEME,provideResource:async _=>{const{extensionId:f,state:a}=_.getParsedQuery(),b=await this.vsxExtensionService.getLocalExtension(f),y=this.iconService.fromIcon("",b?.iconUrl,p.IconType.Background);return{uri:_,metadata:{...b,extensionId:f,state:a,openVSXRegistry:this.vsxExtensionService.openVSXRegistry},icon:y||(0,o.getIcon)("extension"),name:(0,l.replaceLocalizePlaceholder)(b?.displayName,f)||""}}})}registerEditorComponent(u){const _=`${s.EXTENSION_SCHEME}_detail`;u.registerEditorComponent({component:g.ExtensionOverview,uid:_,scheme:s.EXTENSION_SCHEME}),u.registerEditorComponentResolver(s.EXTENSION_SCHEME,(f,a,b)=>{b?.([{type:m.EditorOpenType.component,componentId:_}])})}registerComponent(u){u.register("@opensumi/ide-extension-manager",[],{iconClass:(0,o.getIcon)("extension"),title:(0,l.localize)("marketplace.extension.container"),priority:5,containerId:s.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID,component:c.VSXExtensionView,activateKeyBinding:"ctrlcmd+shift+x"})}};t.VSXExtensionContribution=h,n.__decorate([(0,r.Autowired)(E.IMainLayoutService),n.__metadata("design:type",Object)],h.prototype,"mainLayoutService",void 0),n.__decorate([(0,r.Autowired)(v.VSXExtensionServiceToken),n.__metadata("design:type",Object)],h.prototype,"vsxExtensionService",void 0),n.__decorate([(0,r.Autowired)(p.IIconService),n.__metadata("design:type",Object)],h.prototype,"iconService",void 0),t.VSXExtensionContribution=h=n.__decorate([(0,l.Domain)(o.ClientAppContribution,E.MainLayoutContribution,o.ComponentContribution,m.BrowserEditorContribution)],h)},67761:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VSXExtensionService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57517),m=e(98453),E=e(71354),p=e(28423),v=e(52416),s=e(12456),g=e(29150);let c=class extends o.Disposable{get extensions(){return this.extensionsObservable.get()}get installedExtensions(){return this.installedExtensionsObservable.get()}get openVSXRegistry(){return this.openVSXRegistryObservable.get()}constructor(){super(),this.extensionsObservable=(0,p.observableValue)(this,[]),this.installedExtensionsObservable=(0,p.observableValue)(this,[]),this.openVSXRegistryObservable=(0,p.observableValue)(this,""),this.tasks=new Map,this.getInstalledExtensions(),this.disposables.push(this.extensionInstanceService.onDidChange(()=>{this.getInstalledExtensions(),this.search(this.searchValue)}))}updateStatusBar(){if(this.tasks.size===0){this.installStatus&&(this.installStatus.dispose(),this.installStatus=void 0);return}const d="sumi-upload-file-status";if(this.tasks.size===1){const u=(0,o.localize)("marketplace.extension.installing"),_={text:u,alignment:o.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.installStatus=this.statusBarService.addElement(d,_)}}async install(d){var u,_;const f=this.getExtensionId(d);if(this.tasks.has(f)||!d.downloadUrl)return;const a=this.backService.install({id:f,name:(u=d.name)!==null&&u!==void 0?u:"-",url:d.downloadUrl,version:(_=d.version)!==null&&_!==void 0?_:"-"});return this.tasks.set(f,a),this.updateStatusBar(),a.then(async b=>{if(this.tasks.delete(f),this.updateStatusBar(),await this.extensionManagementService.postChangedExtension(!1,b),this.themeService.getAvailableThemeInfos().some(w=>w.extensionId===d.originId)){this.commandService.executeCommand(s.THEME_TOGGLE_COMMAND.id,{extensionId:d.originId});return}if(this.iconService.getAvailableThemeInfos().some(w=>w.extensionId===d.originId)){this.commandService.executeCommand(s.ICON_THEME_TOGGLE_COMMAND.id,{extensionId:d.originId});return}if(this.productIconService.getAvailableThemeInfos().some(w=>w.extensionId===d.originId)){this.commandService.executeCommand(s.PRODUCT_ICON_THEME_TOGGLE_COMMAND.id,{extensionId:d.originId});return}})}async uninstall(d){d&&d.path&&await this.extensionManagementService.postUninstallExtension(d.path)}async disable(d){d&&d.path&&this.extensionManagementService.postDisableExtension(d.path)}async enable(d){d&&d.path&&this.extensionManagementService.postEnableExtension(d.path)}getExtensionId(d){var u,_,f;return(u=d?.extensionId)!==null&&u!==void 0?u:((_=d?.namespace)===null||_===void 0?void 0:_.toLowerCase())+"."+((f=d?.name)===null||f===void 0?void 0:f.toLowerCase())}async getLocalExtension(d){return d?this.extensions.find(_=>this.getExtensionId(_)===d)||this.installedExtensions.find(_=>this.getExtensionId(_)===d):void 0}async getRemoteRawExtension(d){if(!d)return;const u={extensionId:d},_=await this.backService.getExtension(u);if(_&&_.extensions&&_.extensions.length>=1)return Object.assign({},_.extensions[0])}async getOpenVSXRegistry(){const d=await this.backService.getOpenVSXRegistry();(0,p.transaction)(u=>{this.openVSXRegistryObservable.set(d,u)})}async openExtensionEditor(d,u){this.workbenchEditorService.open(new o.URI(`extension://?extensionId=${d}&state=${u}`),{preview:!0})}async search(d){const u={query:d,size:50,sortBy:"downloadCount"};this.searchValue=d;const _=await this.backService.search(u);_.extensions&&(0,p.transaction)(f=>{this.extensionsObservable.set(_.extensions.filter(a=>!this.installedExtensions.find(b=>this.getExtensionId(b)===this.getExtensionId(a))).map(a=>({...a,publisher:a.namespace,iconUrl:a.files.icon,downloadUrl:a.files.download,readme:a.files.readme})),f)})}async searchInstalledExtensions(d){(0,p.transaction)(u=>{const _=this.installedExtensions;this.installedExtensionsObservable.set(_.sort((f,a)=>{const b=(0,o.fuzzyScore)(d,d.toLowerCase(),0,f.name,f.name.toLowerCase(),0,!0),y=(0,o.fuzzyScore)(d,d.toLowerCase(),0,a.name,a.name.toLowerCase(),0,!0);return b?y?y[0]-b[0]:-1:1}),u)})}getInstalledExtensions(){const d=this.extensionInstanceService.getExtensionInstances().map(u=>{const _=u.extensionId;return{namespace:_&&_.includes(".")?_.split(".")[0]:u.packageJSON.publisher,name:u.packageJSON.name,id:u.extensionId,version:u.packageJSON.version,displayName:u.packageJSON.displayName,description:u.packageJSON.description,publisher:u.packageJSON.publisher,iconUrl:u.packageJSON.icon&&u.extensionLocation.toString()+`/${u.packageJSON.icon}`,path:u.path,realpath:u.realPath}});(0,p.transaction)(u=>{this.installedExtensionsObservable.set(d,u)})}};t.VSXExtensionService=c,n.__decorate([(0,r.Autowired)(g.VSXExtensionServicePath),n.__metadata("design:type",Object)],c.prototype,"backService",void 0),n.__decorate([(0,r.Autowired)(l.WorkbenchEditorService),n.__metadata("design:type",l.WorkbenchEditorService)],c.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(E.AbstractExtInstanceManagementService),n.__metadata("design:type",E.AbstractExtInstanceManagementService)],c.prototype,"extensionInstanceService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",m.ExtensionManagementService)],c.prototype,"extensionManagementService",void 0),n.__decorate([(0,r.Autowired)(v.IThemeService),n.__metadata("design:type",Object)],c.prototype,"themeService",void 0),n.__decorate([(0,r.Autowired)(v.IIconService),n.__metadata("design:type",Object)],c.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(v.IProductIconService),n.__metadata("design:type",Object)],c.prototype,"productIconService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],c.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.IStatusBarService),n.__metadata("design:type",Object)],c.prototype,"statusBarService",void 0),n.__decorate([(0,o.pMemoize)(h=>h),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[String]),n.__metadata("design:returntype",Promise)],c.prototype,"search",null),t.VSXExtensionService=c=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],c)},73689:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VSXExtensionView=void 0;const n=e(85608),r=n.__importDefault(e(12784)),o=n.__importStar(e(14041)),l=e(14041),m=e(97267),E=e(41869),p=e(68974),v=e(43718),s=e(5567),g=e(29150),c=e(21082),h=e(87791),d=n.__importDefault(e(68143)),u=[g.TabActiveKey.MARKETPLACE,g.TabActiveKey.INSTALLED],_=()=>{const[f,a]=(0,l.useState)(g.TabActiveKey.MARKETPLACE),[b,y]=(0,l.useState)(!1),S=(0,E.useInjectable)(g.VSXExtensionServiceToken),A=(0,E.useAutorun)(S.extensionsObservable),w=(0,E.useAutorun)(S.installedExtensionsObservable),T=(0,E.useAutorun)(S.openVSXRegistryObservable),D=(0,r.default)(R=>{y(!0);let M;f===g.TabActiveKey.MARKETPLACE?M=S.search(R):M=S.searchInstalledExtensions(R),typeof M=="object"&&M.then&&M.then(()=>{y(!1)})},500),I=(0,l.useCallback)(R=>S.install(R),[]),O=(0,l.useCallback)((R,M)=>{const k=S.getExtensionId(R);S.openExtensionEditor(k,M)},[]),L=(0,l.useCallback)(R=>{const M=u[R];M&&a(M)},[]);return o.createElement("div",{className:d.default.panel},o.createElement(m.Tabs,{mini:!0,className:d.default.tabs,value:u.indexOf(f),onChange:L,tabs:[(0,v.localize)("marketplace.panel.tab.marketplace"),(0,v.localize)("marketplace.tab.installed")]}),o.createElement("div",{style:{padding:"8px"}},o.createElement(s.AutoFocusedInput,{containerId:c.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID,placeholder:(0,v.localize)("marketplace.panel.tab.placeholder.search"),value:"",onChange:R=>D(R.target.value)})),f===g.TabActiveKey.MARKETPLACE&&o.createElement("div",{className:d.default.extensions_view},o.createElement(p.Progress,{loading:b}),A.map((R,M)=>o.createElement(h.Extension,{key:`${M}:${R.namespace}-${R.name}`,onClick:O,onInstall:I,extension:R,type:h.ExtensionViewType.MARKETPLACE,installedExtensions:w,openVSXRegistry:T}))),f===g.TabActiveKey.INSTALLED&&o.createElement("div",{className:d.default.extensions_view},w.map((R,M)=>o.createElement(h.Extension,{key:`${M}:${R.namespace}-${R.name}`,onClick:O,onInstall:I,extension:R,type:h.ExtensionViewType.INSTALLED,openVSXRegistry:T}))))};t.VSXExtensionView=_},29150:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IOpenvsxMarketplaceService=t.VSXExtensionServicePath=t.VSXExtensionServiceToken=t.VSXExtension=t.InstallState=t.TabActiveKey=t.EnableScope=void 0;var e;(function(l){l.GLOBAL="GLOBAL",l.WORKSPACE="WORKSPACE"})(e||(t.EnableScope=e={}));var n;(function(l){l.MARKETPLACE="marketplace",l.INSTALLED="installed"})(n||(t.TabActiveKey=n={}));var r;(function(l){l.INSTALLED="INSTALLED",l.NOT_INSTALLED="NOT_INSTALLED",l.SHOULD_UPDATE="SHOULD_UPDATE"})(r||(t.InstallState=r={}));class o{}t.VSXExtension=o,o.KEYS=new Set(["version","iconUrl","publisher","name","displayName","description","averageRating","downloadCount","downloadUrl","readmeUrl","licenseUrl","repository","license","readme","preview","namespaceAccess","publishedBy"]),t.VSXExtensionServiceToken=Symbol("VSXExtensionSerivceToken"),t.VSXExtensionServicePath="VSXExtensionServicePath",t.IOpenvsxMarketplaceService=Symbol("IOpenvsxMarketplaceService")},53599:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStorageContribution=t.ExtensionStorageModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(93584),m=e(7446),E=e(16132),p=e(10207),v=e(19227);let s=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[{token:l.IExtensionStorageService,useClass:p.ExtensionStorageService},{token:l.IExtensionStoragePathServer,useClass:E.ExtensionStoragePathServer},{token:l.IExtensionStorageServer,useClass:m.ExtensionStorageServer},g]}};t.ExtensionStorageModule=s,t.ExtensionStorageModule=s=n.__decorate([(0,o.Domain)(v.name)],s);let g=class{onReconnect(){this.extensionStorageService.reConnectInit()}};t.ExtensionStorageContribution=g,n.__decorate([(0,r.Autowired)(l.IExtensionStorageService),n.__metadata("design:type",Object)],g.prototype,"extensionStorageService",void 0),t.ExtensionStorageContribution=g=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],g),n.__exportStar(e(10207),t)},16132:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStoragePathServer=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(96405),E=e(14951),p=e(73344),v=e(51500),{Path:s}=l.path;let g=class{constructor(){this.windowsDataFolders=[l.StoragePaths.WINDOWS_APP_DATA_DIR,l.StoragePaths.WINDOWS_ROAMING_DIR],this.deferredWorkspaceStoragePath=new l.Deferred,this.deferredStoragePath=new l.Deferred,this.storagePathInitialized=!1}get workspaceSuffixName(){return this.appConfig.workspaceSuffixName||v.DEFAULT_WORKSPACE_SUFFIX_NAME}async provideHostLogPath(){const h=await this.getLogsDirPath();if(!h)throw new Error("Unable to get parent log directory");const d=h,u=l.URI.file(d).toString();return await this.fileSystem.access(u)||await this.fileSystem.createFolder(u),new l.URI(h)}async provideHostStoragePath(h,d,u){const _=await this.getWorkspaceStorageDirPath(u);if(!_)throw new Error("Unable to get parent storage directory");await this.fileSystem.access(l.URI.file(_).toString())||await this.fileSystem.createFolder(l.URI.file(_).toString());const f=await this.buildWorkspaceId(h,d,u),a=new s(_).join(f).toString();await this.fileSystem.access(l.URI.file(a).toString())||await this.fileSystem.createFolder(l.URI.file(a).toString());const b=new l.URI(a);return this.storagePathInitialized||(this.deferredWorkspaceStoragePath.resolve(b.path.toString()),this.deferredStoragePath.resolve(_),this.storagePathInitialized=!0),this.cachedStoragePath=b}async getLastWorkspaceStoragePath(){var h;return this.storagePathInitialized?(h=this.cachedStoragePath)===null||h===void 0?void 0:h.path.toString():this.deferredWorkspaceStoragePath.promise}async getLastStoragePath(){return this.deferredStoragePath.promise}doHash(h){return this.hashCalculateService.calculate(h)}async buildWorkspaceId(h,d,u){const _=await this.getUserHomeDir(),f=y=>y.resolve(u||v.WORKSPACE_USER_STORAGE_FOLDER_NAME).resolve(`${v.UNTITLED_WORKSPACE}.${this.workspaceSuffixName}`).withScheme(l.Schemes.file),a=y=>y.resolve(u||v.WORKSPACE_USER_STORAGE_FOLDER_NAME).resolve(`${v.UNTITLED_WORKSPACE}`).withScheme(l.Schemes.file);if(!h){const y=a(new l.URI(_));return this.doHash(y.toString())}if(f(new l.URI(_)).toString()===h.uri){const y=d.map(S=>S.uri).sort().join(",");return this.doHash(y)}else{const y=new l.URI(h.uri);return this.doHash(y.toString())}}async getLogsDirPath(){const h=await this.loggerManager.getLogFolder();return new s(h).join(l.StoragePaths.EXTENSIONS_LOGS_DIR).toString()}async getWorkspaceStorageDirPath(h){const d=await this.getWorkspaceDataDirPath(h);return new s(d).join(l.StoragePaths.EXTENSIONS_WORKSPACE_STORAGE_DIR).toString()}async getWorkspaceDataDirPath(h){const d=await this.getUserHomeDir(),u=h;return new s(d).join(...l.isWindows?this.windowsDataFolders:[""],u).toString()}async getUserHomeDir(){const h=await this.fileSystem.getCurrentUserHome();if(!h)throw new Error("Unable to get user home directory");return await this.fileSystem.getFsPath(h.uri)}};t.ExtensionStoragePathServer=g,n.__decorate([(0,r.Autowired)(E.IFileServiceClient),n.__metadata("design:type",Object)],g.prototype,"fileSystem",void 0),n.__decorate([(0,r.Autowired)(p.ILoggerManagerClient),n.__metadata("design:type",Object)],g.prototype,"loggerManager",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],g.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(m.IHashCalculateService),n.__metadata("design:type",Object)],g.prototype,"hashCalculateService",void 0),t.ExtensionStoragePathServer=g=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],g)},7446:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStorageServer=void 0;const r=e(85608),o=e(76003),l=e(43718),m=e(14951),E=e(93584),{Path:p}=l.path;let v=n=class{constructor(){this.deferredWorkspaceDataDirPath=new l.Deferred,this.storageThrottler=new l.Throttler,this.storageTasks={},this.storageExistPromises=new Map}async init(g,c,h){return this.storageDelayer=new l.ThrottledDelayer(n.DEFAULT_FLUSH_DELAY),await this.setupDirectories(g,c,h||E.DEFAULT_EXTENSION_STORAGE_DIR_NAME)}async asAccess(g,c){if(c)return await this.fileSystem.access(g);if(!this.storageExistPromises.has(g)){const h=this.fileSystem.access(g);this.storageExistPromises.set(g,h)}return await this.storageExistPromises.get(g)}async setupDirectories(g,c,h){const d=await this.extensionStoragePathsServer.getWorkspaceDataDirPath(h),u=l.URI.file(d).toString();await this.fileSystem.access(u)||await this.fileSystem.createFolder(u),this.workspaceDataDirPath=d,this.globalDataPath=new p(this.workspaceDataDirPath).join(l.StoragePaths.EXTENSIONS_GLOBAL_STORAGE_DIR).toString();const _=l.URI.file(this.globalDataPath).toString();await this.fileSystem.access(_)||await this.fileSystem.createFolder(_),this.deferredWorkspaceDataDirPath.resolve(this.workspaceDataDirPath);const f=await this.extensionStoragePathsServer.provideHostLogPath(),a=await this.extensionStoragePathsServer.provideHostStoragePath(g,c,h);return{logUri:f.codeUri,storageUri:a.codeUri,globalStorageUri:l.Uri.file(this.globalDataPath)}}async resolveStorageTask(g){const c=Object.keys(g);for(const h of c){const d=await this.readFromFile(h);for(const{key:u,value:_}of g[h])_===void 0||(0,l.isEmptyObject)(_)?delete d[u]:d[u]=_;await this.writeToFile(h,d)}}doSet(){const g={...this.storageTasks};return this.storageTasks={},this.resolveStorageTask(g)}async set(g,c,h){const d=await this.getDataPath(h);if(!d)throw new Error("Cannot save data: no opened workspace");return this.storageTasks[d]||(this.storageTasks[d]=[]),this.storageTasks[d].push({key:g,value:c}),this.storageDelayer.trigger(()=>this.storageThrottler.queue(this.doSet.bind(this)))}async get(g,c){const h=await this.getDataPath(c);return h?(await this.readFromFile(h))[g]:{}}async getAll(g){const c=await this.getDataPath(g);return c?await this.readFromFile(c):{}}async getDataPath(g){if(this.workspaceDataDirPath===void 0&&await this.deferredWorkspaceDataDirPath.promise,g)return new p(this.globalDataPath).join("global-state.json").toString();{const c=await this.extensionStoragePathsServer.getLastWorkspaceStoragePath();return c?new p(c).join("workspace-state.json").toString():void 0}}async readFromFile(g){const c=l.URI.file(g);if(!await this.asAccess(c.toString(),!0))return{};try{const{content:d}=await this.fileSystem.readFile(c.toString());return JSON.parse(d.toString())}catch(d){return this.logger.error('Failed to parse data from "',c.toString(),'". Reason:',d),{}}}async writeToFile(g,c){const h=l.URI.file(g);await this.asAccess(h.parent.toString())||await this.fileSystem.createFolder(h.parent.toString());const u=JSON.stringify(c);let _=await this.fileSystem.getFileStat(h.toString());_||(_=await this.fileSystem.createFile(h.toString())),await this.fileSystem.setContent(_,u)}};t.ExtensionStorageServer=v,v.DEFAULT_FLUSH_DELAY=100,r.__decorate([(0,o.Autowired)(E.IExtensionStoragePathServer),r.__metadata("design:type",Object)],v.prototype,"extensionStoragePathsServer",void 0),r.__decorate([(0,o.Autowired)(m.IFileServiceClient),r.__metadata("design:type",Object)],v.prototype,"fileSystem",void 0),r.__decorate([(0,o.Autowired)(l.ILogger),r.__metadata("design:type",Object)],v.prototype,"logger",void 0),t.ExtensionStorageServer=v=n=r.__decorate([(0,o.Injectable)()],v)},10207:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStorageService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(51500),E=e(93584);let p=class{constructor(){this._init=this.init(),this.updateEnvState()}get whenReady(){return this._init}get extensionStoragePath(){return this._extensionStoragePath}async init(){const s=await this.workspaceService.roots,g=this.workspaceService.workspace,c=this.appConfig.extensionStorageDirName||E.DEFAULT_EXTENSION_STORAGE_DIR_NAME;return this._extensionStoragePath=await this.extensionStorageServer.init(g,s,c),this._extensionStoragePath}async updateEnvState(){await this.get(l.firstSessionDateStorageKey,!0)===void 0&&await this.set(l.firstSessionDateStorageKey,{date:new Date().toUTCString()},!0)}set(s,g,c){return this.extensionStorageServer.set(s,g,c)}get(s,g){return this.extensionStorageServer.get(s,g)}getAll(s=!1){return this.extensionStorageServer.getAll(s)}async reConnectInit(){const s=await this.workspaceService.roots,g=this.workspaceService.workspace,c=this.appConfig.extensionStorageDirName||E.DEFAULT_EXTENSION_STORAGE_DIR_NAME;return this._extensionStoragePath=await this.extensionStorageServer.init(g,s,c),this._extensionStoragePath}};t.ExtensionStorageService=p,n.__decorate([(0,r.Autowired)(E.IExtensionStorageServer),n.__metadata("design:type",Object)],p.prototype,"extensionStorageServer",void 0),n.__decorate([(0,r.Autowired)(m.IWorkspaceService),n.__metadata("design:type",Object)],p.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],p.prototype,"appConfig",void 0),t.ExtensionStorageService=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},93584:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(85853),t),n.__exportStar(e(56969),t),n.__exportStar(e(23618),t)},85853:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_EXTENSION_STORAGE_DIR_NAME=t.IExtensionStoragePathServer=void 0,t.IExtensionStoragePathServer=Symbol("IExtensionStoragePathServer"),t.DEFAULT_EXTENSION_STORAGE_DIR_NAME=".sumi"},56969:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IExtensionStorageService=t.IExtensionStorageServer=void 0,t.IExtensionStorageServer=Symbol("ExtensionStorageServer"),t.IExtensionStorageService=Symbol("ExtensionStorageService")},23618:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},50492:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(93584),t)},57962:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivationEventServiceImpl=void 0;const n=e(85608),r=n.__importDefault(e(80076)),o=e(76003),l=e(43718);let m=class{constructor(){this.eventListeners=new Map,this.collectTopicData=new l.MultiMap,this.wildCardTopics=new Set,this.activatedEventSet=new Set,this.wildCardTopics.add("workspaceContains")}getTopicsData(p){return this.collectTopicData.get(p)||[]}async fireEvent(p,v=""){this.activatedEventSet.add(JSON.stringify({topic:p,data:v}));let s;if(this.wildCardTopics.has(p)?s=this.eventListeners.get(p):this.eventListeners.has(p)?s=this.eventListeners.get(p):s=this.eventListeners.get(p+":"+v),s){const g=await Promise.allSettled(s.map(c=>this.tryRun(p,v,c)));for(const c of g)c.status==="rejected"&&this.logger.error(`fire event ${p}:${v} error: ${c.reason}`)}}addWildCardTopic(p){return this.wildCardTopics.add(p),{dispose:()=>{this.wildCardTopics.delete(p)}}}onEvent(p,v){const s=p.indexOf(":");let g,c;return s===-1?(g=p,c=""):(g=p.substr(0,s),c=p.substr(s+1)),this.addListener(g,{topic:g,data:c,execute:v})}addListener(p,v){if(this.collectTopicData.set(v.topic,v.data),this.wildCardTopics.has(p))return this.eventListeners.has(p)||this.eventListeners.set(p,[]),this.eventListeners.get(p).push(v),{dispose:()=>{const s=this.eventListeners.get(p).indexOf(v);s!==-1&&this.eventListeners.get(p).splice(s,1)}};{const s=p+":"+v.data;return this.eventListeners.has(s)||this.eventListeners.set(s,[]),this.eventListeners.get(s).push(v),{dispose:()=>{const g=this.eventListeners.get(s).indexOf(v);g!==-1&&this.eventListeners.get(s).splice(g,1)}}}}async tryRun(p,v,s){this.wildCardTopics.has(p)?(0,r.default)(s.data)(v)&&await s.execute():await s.execute()}};t.ActivationEventServiceImpl=m,n.__decorate([(0,o.Autowired)(l.ILogger),n.__metadata("design:type",Object)],m.prototype,"logger",void 0),t.ActivationEventServiceImpl=m=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],m)},63056:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionNoExportsView=t.ExtensionLoadingView=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),l=e(68974),m=n.__importDefault(e(17267)),E=({style:v})=>r.default.createElement("div",{style:v||{},className:m.default.kt_extension_view},r.default.createElement(l.Progress,{loading:!0}));t.ExtensionLoadingView=E;const p=(v,s)=>r.default.createElement("div",{className:m.default.kt_extension_no_exports_view},(0,o.formatLocalize)("extension.no.view.found",v,s));t.ExtensionNoExportsView=p},56405:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PortalRoot=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),l=e(41869),m=e(87420),E=e(25600),p=v=>{var s;const[g,c]=o.default.useState(null),h=(0,l.useInjectable)(E.AbstractViewExtProcessService),d=(0,l.useInjectable)(m.IThemeService);o.default.useEffect(()=>{const _=new l.DisposableCollection;return d.getCurrentTheme().then(f=>c(f.type)),_.push(d.onThemeChange(f=>{f.type&&f.type!==g&&c(f.type)})),_.dispose.bind(_)},[]);const u=v.original;return o.default.createElement(u,{...v.otherProps,className:(0,r.default)((s=v.otherProps)===null||s===void 0?void 0:s.className,(0,m.getThemeTypeSelector)(g)),getContainer:()=>h.getPortalShadowRoot(v.extensionId)})};t.PortalRoot=p},82443:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TREE_VIEW_NODE_HEIGHT=t.TreeViewNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(97267),m=e(41869),E=e(25918),p=e(93899),v=e(95422),s=e(69589),g=e(42912),c=n.__importDefault(e(50790)),h=({item:d,onClick:u,onChange:_,onContextMenu:f,itemType:a,leftPadding:b=8,onTwistierClick:y,decorations:S,defaultLeftPadding:A=8,treeViewId:w,decorationService:T,draggable:D,onDragStart:I,onDragEnter:O,onDragLeave:L,onDragOver:R,onDrop:M})=>{const k=(0,v.useInjectable)(g.IIconService),B=(0,m.useDesignStyles)(c.default.expansion_toggle,"expansion_toggle"),x=(0,m.useDesignStyles)(c.default.tree_view_node,"tree_view_node"),[N,j]=(0,o.useState)(d.uri&&T.getDecoration(d.uri,!1));(0,o.useEffect)(()=>{const Ce=T.onDidChangeDecorations(Ee=>{d.uri&&Ee.affectsResource(d.uri)&&j(T.getDecoration(d.uri,!1))});return()=>{Ce.dispose()}},[]);const K=(0,v.useInjectable)(g.IThemeService),U=(0,o.useCallback)(Ce=>{(a===l.TreeNodeType.TreeNode||a===l.TreeNodeType.CompositeTreeNode)&&u(Ce,d,a)},[d,a,u]),X=(0,o.useCallback)(Ce=>{(a===l.TreeNodeType.TreeNode||a===l.TreeNodeType.CompositeTreeNode)&&(y?y(Ce,d,a):u(Ce,d,a))},[d,a,y,u]),z=(0,o.useCallback)(Ce=>{Ce.nativeEvent.which===0||!f||(a===l.TreeNodeType.TreeNode||a===l.TreeNodeType.CompositeTreeNode)&&f(Ce,d,a)},[d,a,f]),Q=(0,o.useCallback)(Ce=>{I&&I(Ce,d)},[d,I]),G=(0,o.useCallback)(Ce=>{O&&O(Ce,d)},[d,O]),J=(0,o.useCallback)(Ce=>{L&&L(Ce,d)},[d,L]),Y=(0,o.useCallback)(Ce=>{R&&R(Ce,d)},[d,R]),H=(0,o.useCallback)(Ce=>{M&&M(Ce,d)},[d,M]),$=(0,o.useCallback)(Ce=>{_(d),Ce.stopPropagation()},[d,_]),Z=a===l.TreeNodeType.CompositeTreeNode,re=Z?`${A+(d.depth||0)*(b||0)}px`:`${A+(d.depth||0)*(b||0)+8}px`,ce={height:t.TREE_VIEW_NODE_HEIGHT,lineHeight:`${t.TREE_VIEW_NODE_HEIGHT}px`,paddingLeft:re},ge=(Ce,Ee)=>S&&S?.classlist.indexOf(c.default.mod_loading)>-1?o.default.createElement(l.Loading,null):o.default.createElement("div",{onClick:Ee,className:(0,r.default)(c.default.tree_view_node_segment,B,(0,m.getIcon)("arrow-right"),{[`${c.default.mod_collapsed}`]:!Ce.expanded})}),Ae=Ce=>o.default.createElement("div",{className:(0,r.default)(c.default.file_icon,Ce.icon),style:{maxHeight:t.TREE_VIEW_NODE_HEIGHT}}),te=Ce=>{var Ee;return Ce.checkboxInfo===void 0?null:o.default.createElement(l.CheckBox,{"data-node-id":Ce.treeItemId,readOnly:!0,onChange:xe=>$(xe),checked:!!Ce.checkboxInfo.checked,id:Ce.treeItemId,role:(Ee=Ce.checkboxInfo.accessibilityInformation)===null||Ee===void 0?void 0:Ee.role,title:Ce.checkboxInfo.tooltip})},Pe=Ce=>{const Ee=()=>{if(Ce.highlights){let xe=[],Ye=0;const Ue=Ce.highlights.sort((Qe,we)=>Qe[0]-we[0]);return xe=Ue.map((Qe,we)=>{const[le,Se]=Qe,Oe=Ce.displayName.slice(Ye,le);Ye=Se;const Fe=Ce.displayName.slice(le,Se),We=[o.default.createElement("span",{key:`line_begin_${we}_${Oe}`},Oe),o.default.createElement("span",{className:c.default.highlight,key:`line_hightlight_${we}_${Fe}`},Fe)];if(we===Ue.length-1){const Ve=Ce.displayName.slice(Se);We.push(o.default.createElement("span",{key:`line_end_${we}_${Ve}`},Ve))}return We}),xe}else return Ce.displayName};return o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_segment,c.default.tree_view_node_displayname,Ce.strikethrough&&c.default.strikethrough)},Ee())},Te=()=>o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_segment,c.default.tree_view_node_tail)},ie()),ie=()=>{if(d.actions.length>0)return o.default.createElement("div",{className:c.default.tree_view_actions},o.default.createElement(E.TitleActionList,{className:c.default.inlineMenu,context:[{treeViewId:w,treeItemId:d.treeItemId}],nav:d.actions,menuId:p.MenuId.ViewItemContext}))},se=Ce=>{if(Z)return ge(Ce,X)},me=()=>d.tooltip||d.name,ye=Ce=>o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_segment_grow,c.default.tree_view_node_description)},!Ce.name&&!Ce.description?"\u2014\u2014":Ce.description),_e=()=>{if(!N)return null;const Ce=N.badge||"",Ee=N.color,xe=Ee&&K.getColor({id:Ee});return o.default.createElement("div",{className:c.default.tree_view_node_tail,style:{color:xe}},(0,s.transformLabelWithCodicon)(Ce.slice(),{},k.fromString.bind(k)))};return o.default.createElement("div",{key:d.id,onClick:U,onContextMenu:z,onDragStart:Q,onDragOver:Y,onDragEnter:G,onDragLeave:J,onDrop:H,title:me(),className:(0,r.default)(x,S?S.classlist:null),"data-id":d.id,style:ce,draggable:D},o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_content)},se(d),te(d),Ae(d),o.default.createElement("div",{className:c.default.tree_view_node_overflow_wrap},Pe(d),ye(d)),Te(),_e()))};t.TreeViewNode=h,t.TREE_VIEW_NODE_HEIGHT=22},81302:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionTabBarTreeView=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),l=e(41869),m=e(68974),E=e(41893),p=e(24429),v=e(72260),s=e(82443),g=n.__importDefault(e(17267)),c=({viewState:u,model:_,dataProvider:f,treeViewId:a})=>{const b=(0,l.useInjectable)(v.IMainLayoutService),y=(0,l.useInjectable)(E.IDecorationsService),S=(0,r.useMemo)(()=>b.getViewAccordionService(a),[]),A=(0,r.useMemo)(()=>{const Q=S?.getViewState(a);return Q?!Q.collapsed&&!Q.hidden:!1},[S]),{height:w}=u,{canSelectMany:T}=_.treeViewOptions||{},D=(0,r.useRef)(null),I=(0,r.useCallback)(Q=>{_.handleTreeHandler({...Q,getModel:()=>_.treeModel,hasDirectFocus:()=>D.current===document.activeElement})},[_]),O=(0,r.useCallback)((Q,G)=>{Q.stopPropagation();const{toggleDirectory:J}=_;J(G)},[_]),L=(0,r.useCallback)(Q=>R(Q)?!1:Q.shiftKey,[]),R=(0,r.useCallback)(Q=>{const{metaKey:G,ctrlKey:J}=Q;return l.isOSX&&G||J},[]),M=(0,r.useCallback)((Q,G,J)=>{Q.stopPropagation();const{handleItemClick:Y,handleItemToggleClick:H,handleItemRangeClick:$}=_;if(!G)return;const Z=L(event),re=R(event);T?Z?$(G,J):re?H(G,J):Y(G,J):Y(G,J)},[T,_]),k=(0,r.useCallback)(Q=>{const{handleCheckBoxChange:G}=_;Q&&G(Q)},[_]),B=(0,r.useCallback)((Q,G)=>{const{handleContextMenu:J}=_;J(Q,G)},[_]),x=Q=>{const{handleContextMenu:G}=_;G(Q)},N=(0,r.useCallback)(()=>{const{enactiveNodeDecoration:Q}=_;Q()},[_]),j=(0,r.useCallback)((Q,G)=>{const{handleDragStart:J}=_;J(Q,G)},[_]),K=(0,r.useCallback)((Q,G)=>{const{handleDragOver:J}=_;J(Q,G)},[_]),U=(0,r.useCallback)((Q,G)=>{const{handleDragEnter:J}=_;J(Q,G)},[_]),X=(0,r.useCallback)((Q,G)=>{const{handleDrop:J}=_;J(Q,G)},[_]),z=(0,r.useCallback)((Q,G)=>{const{handleDragLeave:J}=_;J(Q,G)},[_]);return(0,r.useEffect)(()=>{var Q;const G=()=>{_.handleTreeBlur()};return(Q=D.current)===null||Q===void 0||Q.addEventListener("blur",G,!0),()=>{var J;(J=D.current)===null||J===void 0||J.removeEventListener("blur",G,!0)}},[D.current]),r.default.createElement("div",{className:g.default.kt_extension_view,tabIndex:-1,ref:D,onContextMenu:x,onClick:N,"data-tree-view-id":a},r.default.createElement(d,{height:w,isVisible:A,handleTreeReady:I,handleItemClicked:M,handleCheckBoxChange:k,handleTwistierClick:O,handleContextMenu:B,handleDragStart:j,handleDragOver:K,handleDragEnter:U,handleDragLeave:z,handleDrop:X,draggable:_.draggable,treeViewId:a,model:_,dataProvider:f,decorationService:y}))};t.ExtensionTabBarTreeView=c;function h(u,_){return u.isVisible===_.isVisible&&u.model===_.model&&u.treeViewId===_.treeViewId&&u.height===_.height}const d=(0,r.memo)(({model:u,treeViewId:_,height:f,isVisible:a,dataProvider:b,handleTreeReady:y,handleItemClicked:S,handleCheckBoxChange:A,handleTwistierClick:w,handleContextMenu:T,handleDragStart:D,handleDragOver:I,handleDragEnter:O,handleDragLeave:L,handleDrop:R,draggable:M,decorationService:k})=>{const[B,x]=(0,r.useState)(!1),[N,j]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let U=!1;return(async()=>(await u.whenReady,u.treeModel&&a&&await u.treeModel.ensureReady,U||x(!0)))(),()=>{U=!0,u&&u.removeNodeDecoration()}},[u,a]),(0,r.useEffect)(()=>{const U=b.onDidChangeEmpty(()=>{b.isTreeEmpty!==N&&j(b.isTreeEmpty)});return()=>U.dispose()},[]);const K=(0,r.useCallback)(U=>r.default.createElement(s.TreeViewNode,{item:U.item,itemType:U.itemType,decorations:u.decorations.getDecorations(U.item),onClick:S,onChange:A,onTwistierClick:w,onContextMenu:T,onDragStart:D,onDragOver:I,onDragEnter:O,onDragLeave:L,onDrop:R,defaultLeftPadding:8,leftPadding:8,treeViewId:_,draggable:M,decorationService:k}),[u.treeModel]);if(B){if(N)return r.default.createElement(p.WelcomeView,{viewId:_});if(u.treeModel)return r.default.createElement(o.RecycleTree,{height:f,itemHeight:s.TREE_VIEW_NODE_HEIGHT,onReady:y,model:u.treeModel},K)}else return r.default.createElement(m.Progress,{loading:!0});return null},h);d.displayName="ExtensionsTreeView"},88341:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionWebviewView=t.WebviewViewShouldShowEvent=void 0;const r=e(85608).__importDefault(e(14041)),o=e(41869),l=e(99220);class m extends o.BasicEvent{}t.WebviewViewShouldShowEvent=m;const E=({viewId:p})=>{const v=r.default.useRef(null),s=(0,o.useInjectable)(o.IEventBus),g=(0,o.useInjectable)(l.ExtensionService);return r.default.useEffect(()=>{const c=new o.CancellationTokenSource,h=new o.Disposable({dispose:()=>c.cancel()});return g.eagerExtensionsActivated.promise.then(()=>{c.token.isCancellationRequested||v.current&&s.fire(new m({viewType:p,container:v.current,title:"",cancellationToken:c.token,disposer:h}))}),()=>{h.dispose()}},[]),r.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative"},className:"webview-view-component",ref:v})};t.ExtensionWebviewView=E},17428:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(81302),t),n.__exportStar(e(63056),t)},21167:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WalkthroughsEditorView=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(97267),m=e(41869),E=e(93374),p=e(52416),v=e(99220),s=e(17441),g=n.__importDefault(e(42076)),c=({resource:{uri:_}})=>{const f=(0,m.useInjectable)(s.WalkthroughsService),a=(0,m.useInjectable)(m.IContextKeyService),{query:b,authority:y}=_,[S,A]=(0,o.useState)(),[w,T]=(0,o.useState)();(0,o.useEffect)(()=>{S&&S.steps.length>0&&(w||T(S.steps[0].id))},[S,w]),(0,o.useEffect)(()=>{b&&A(f.getWalkthrough(b))},[b,S]);const D=(0,o.useCallback)(()=>{var I;return S&&((I=S.steps.find(O=>O.id===w))===null||I===void 0?void 0:I.media)},[w,S]);return o.default.createElement("div",{className:g.default.getting_started_container},o.default.createElement("div",{className:g.default.getting_started_detailsContent},o.default.createElement("div",{className:g.default.category_container},o.default.createElement("div",{className:g.default.category_icon},S&&S.icon.type==="image"&&o.default.createElement("img",{src:S.icon.path})),o.default.createElement("div",{className:g.default.category_description_container},o.default.createElement("h2",{className:g.default.category_title},S?.title),o.default.createElement("div",{className:g.default.category_description},S?.description))),o.default.createElement("div",{className:g.default.steps_container},o.default.createElement("div",{className:g.default.getting_started_detail_container},o.default.createElement("div",{className:g.default.step_list_container},S?S.steps.filter(I=>a.match(I.when)).map(I=>o.default.createElement(h,{key:I.id,step:I,isExpanded:I.id===w,onSelected:T})):null))),o.default.createElement("div",{className:g.default.getting_started_media},w&&o.default.createElement(d,{media:D(),extensionId:y,stepId:w}))))};t.WalkthroughsEditorView=c;const h=({step:_,isExpanded:f,onSelected:a})=>{const b=(0,m.useInjectable)(m.IOpenerService),y=(0,m.useInjectable)(s.WalkthroughsService),S=(0,m.useInjectable)(p.IIconService),[A,w]=(0,o.useState)(!1),{description:T}=_;(0,o.useEffect)(()=>{const R=y.onDidProgressStep(M=>{const{id:k,done:B}=M;k===_.id&&B&&w(B)});return()=>R.dispose()},[]);const D=(0,o.useCallback)(()=>{w(!A),y.progressByEvent(v.CompletionEventsType.stepSelected+":"+_.id)},[A,_.id]),I=(0,o.useCallback)(R=>{const{href:M}=R;b.open(M),/^http(s)?:\/\//.test(M)&&y.progressByEvent(v.CompletionEventsType.onLink+":"+M)},[]),O=(0,o.useCallback)(()=>{if(T.length===0)return null;const R=[];return T.map((M,k)=>{if(M.nodes.length===1&&typeof M.nodes[0]!="string"){const B=M.nodes[0];R.push(o.default.createElement("div",{key:k.toString()+R.length,title:B.title},o.default.createElement(l.Button,{onClick:()=>I(B)},(0,m.transformLabelWithCodicon)(B.label,{},S.fromString.bind(S)))))}else{const B=M.nodes.map((x,N)=>typeof x=="string"?x:o.default.createElement("a",{key:x.label+"#"+N,title:x.title,onClick:()=>I(x)},x.label));R.push(o.default.createElement("p",{key:k.toString()+R.length.toString()+B.length.toString()},B))}}),o.default.createElement("div",{className:g.default.step_description_container},o.default.createElement(o.default.Fragment,null,R))},[T]),L=(0,o.useCallback)(()=>(0,m.transformLabelWithCodicon)(_.title,{},S.fromString.bind(S)),[_.title]);return o.default.createElement("div",{className:(0,r.default)(g.default.getting_started_step,f&&g.default.expanded),onClick:()=>a(_.id)},o.default.createElement("div",{className:g.default.checkbox},o.default.createElement(l.CheckBox,{id:_.id,onChange:D,checked:A})),o.default.createElement("div",{className:g.default.step_container},o.default.createElement("h3",{className:g.default.step_title},L()),f&&O()))},d=({media:_,extensionId:f,stepId:a})=>{const b=(0,m.useInjectable)(p.IThemeService),y=(0,m.useInjectable)(s.WalkthroughsService),[S,A]=(0,o.useState)(""),[w,T]=(0,o.useState)(""),D=(0,o.useCallback)(async I=>_?.type==="image"?"":I?(await y.getFileContent(f,I)).toString():"",[_]);if((0,o.useEffect)(()=>{const I=y.getStepsByExtension(a);I&&(_&&_.type==="svg"&&I.media.svg&&D(I.media.svg).then(A),_&&_.type==="markdown"&&I.media.markdown&&D(I.media.markdown).then(T))},[_,a]),!_)return null;if(_.type==="image"){const I=b.getCurrentThemeSync().type,O=_.path[I].toString(!0).replace(/ /g,"%20");return o.default.createElement(o.default.Fragment,null,o.default.createElement("img",{alt:_.altText,srcSet:O.toLowerCase().endsWith(".svg")?O:O+" 1.5x"}))}return _.type==="svg"?o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:g.default.media_svg_container,dangerouslySetInnerHTML:{__html:S}})):_.type==="markdown"?o.default.createElement(o.default.Fragment,null,o.default.createElement(u,{content:w,media:_})):null},u=({content:_,media:f})=>{const a=(0,m.useInjectable)(m.IOpenerService);if(f.type!=="markdown")return null;const b=(0,o.useCallback)(()=>f.base.resolve("/").toString(),[f,_]);return o.default.createElement(E.Markdown,{content:_,options:{baseUrl:b()},onLinkClick:y=>a.open(y)})}},87444:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtCommandManagementImpl=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class extends o.Disposable{constructor(){super(...arguments),this.commandEnvRegistry=new Map,this.proxyCommandExecutorRegistry=new Map}dispose(){this.commandEnvRegistry.clear(),this.proxyCommandExecutorRegistry.clear()}registerProxyCommandExecutor(E,p){this.proxyCommandExecutorRegistry.set(E,p)}async executeExtensionCommand(E,p,v){const s=this.proxyCommandExecutorRegistry.get(E);if(!s)throw new Error('Proxy command executor "'+E+'" is not existed');return s.$executeExtensionCommand(p,...v)}registerExtensionCommandEnv(E,p="node"){return this.commandEnvRegistry.set(E,p),{dispose:()=>{this.commandEnvRegistry.delete(E)}}}getExtensionCommandEnv(E){return this.commandEnvRegistry.get(E)}};t.ExtCommandManagementImpl=l,t.ExtCommandManagementImpl=l=n.__decorate([(0,r.Injectable)()],l)},49413:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtInstanceManagementService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(99220),E=e(42734);let p=class extends o.Disposable{constructor(){super(),this.onDidChangeEmitter=new l.Emitter,this.extensionMap=new Map,this._whenReady=this.init()}async init(){this.workspaceStorage=await this.storageProvider(o.STORAGE_NAMESPACE.EXTENSIONS),this.globalStorage=await this.storageProvider(o.STORAGE_NAMESPACE.GLOBAL_EXTENSIONS)}get whenReady(){return this._whenReady}get onDidChange(){return this.onDidChangeEmitter.event}dispose(){this.disposeExtensionInstances()}getExtensionInstances(){return Array.from(this.extensionMap.values())}disposeExtensionInstances(){for(const s of this.extensionMap.values())s.dispose();this.extensionMap=new Map}disposeExtensionInstancesByPath(s){s.forEach(g=>{this.extensionMap.has(g)&&this.extensionMap.get(g).dispose()})}resetExtensionInstances(){for(const s of this.extensionMap.values())s.reset()}getExtensionInstanceByPath(s){return this.extensionMap.get(s)}getExtensionInstanceByExtId(s){for(const g of this.extensionMap.values())if(g.id===s)return g}deleteExtensionInstanceByPath(s){this.extensionMap.delete(s),this.onDidChangeEmitter.fire()}addExtensionInstance(s){this.extensionMap.set(s.path,s),this.onDidChangeEmitter.fire()}async checkExtensionEnable(s){await this.whenReady;const g=this.globalStorage.get(s.extensionId,m.EXTENSION_ENABLE.ENABLE);return this.workspaceStorage.get(s.extensionId,g)===m.EXTENSION_ENABLE.ENABLE}async createExtensionInstance(s,g,c){const h=typeof s=="string"?await this.extensionNodeClient.getExtension(s,(0,l.getLanguageId)(),{}):s;if(h)return this.injector.get(E.Extension,[h,await this.checkExtensionEnable(h),g||(this.appConfig.extensionDir?h.realPath.startsWith(this.appConfig.extensionDir):!1),!!c])}checkIsBuiltin(s){const g=this.getExtensionCandidateByPath(s.realPath);return(this.appConfig.extensionDir?s.realPath.startsWith(this.appConfig.extensionDir):!1)||(g?g.isBuiltin:!1)}checkIsDevelopment(s){const g=this.getExtensionCandidateByPath(s.realPath);return!!g?.isDevelopment}getExtensionCandidateByPath(s){return this.appConfig.extensionCandidate&&this.appConfig.extensionCandidate.find(g=>g.path===s)}};t.ExtInstanceManagementService=p,n.__decorate([(0,r.Autowired)(o.StorageProvider),n.__metadata("design:type",Function)],p.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],p.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.ExtensionNodeServiceServerPath),n.__metadata("design:type",Object)],p.prototype,"extensionNodeClient",void 0),t.ExtInstanceManagementService=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},98453:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionManagementService=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(14951),m=e(99220),E=e(82389),p=e(71354),v=e(35321);let s=class extends o.WithEventBus{async getExtensionProps(c,h){const d=await this.extensionNodeClient.getExtension(c,(0,o.getLanguageId)(),h);if(d){const u=this.getExtensionByPath(c);if(u)return{...u.toJSON(),extraMetadata:d.extraMetadata}}}getExtensionByPath(c){return this.extInstanceManagementService.getExtensionInstances().find(h=>c===h.path)}getExtensionByExtId(c){return this.extInstanceManagementService.getExtensionInstances().find(h=>c===h.id)}async postChangedExtension(c,h,d){const{upgrade:u,extensionPath:_,oldExtensionPath:f,isBuiltin:a}=typeof c=="boolean"?{upgrade:c,extensionPath:h,oldExtensionPath:d,isBuiltin:!1}:c,b=this.extInstanceManagementService.getExtensionInstanceByPath(_);if(b){this.logger.warn(`Extension ${b.id} already exists, skip activate`);return}const y=await this.extInstanceManagementService.createExtensionInstance(_,!!a);if(y)return u&&this.disableExtension(f),await this.enableExtension(y)}async postEnableExtension(c){const h=await this.extInstanceManagementService.getExtensionInstanceByPath(c);if(h)return await this.enableExtension(h)}async postDisableExtension(c){return this.disableExtension(c)}async postUninstallExtension(c){return this.uninstallExtension(c)}getAllExtensionJson(){return this.extInstanceManagementService.getExtensionInstances().map(c=>c.toJSON())}disableExtension(c){const h=this.extInstanceManagementService.getExtensionInstanceByPath(c);h&&(h.disable(),this.extInstanceManagementService.deleteExtensionInstanceByPath(c))}async enableExtension(c){this.extInstanceManagementService.addExtensionInstance(c),c.enable(),await c.initialize(),this.eventBus.fire(new p.ExtensionDidEnabledEvent(c.toJSON())),this.sumiContributesService.register(c.id,c.packageJSON.sumiContributes||{}),this.contributesService.register(c.id,c.contributes),this.sumiContributesService.initialize(),this.contributesService.initialize()}async removeExtension(c){try{return await this.fileService.delete(o.URI.file(c).toString()),!0}catch(h){return this.logger.error(h),!1}}async uninstallExtension(c){const h=this.extInstanceManagementService.getExtensionInstanceByPath(c);h&&(h.dispose(),this.extInstanceManagementService.deleteExtensionInstanceByPath(c)),await this.removeExtension(c),this.eventBus.fire(new p.ExtensionDidUninstalledEvent)}};t.ExtensionManagementService=s,n.__decorate([(0,r.Autowired)(p.AbstractExtInstanceManagementService),n.__metadata("design:type",p.AbstractExtInstanceManagementService)],s.prototype,"extInstanceManagementService",void 0),n.__decorate([(0,r.Autowired)(m.ExtensionNodeServiceServerPath),n.__metadata("design:type",Object)],s.prototype,"extensionNodeClient",void 0),n.__decorate([(0,r.Autowired)(v.VSCodeContributesServiceToken),n.__metadata("design:type",v.VSCodeContributesService)],s.prototype,"contributesService",void 0),n.__decorate([(0,r.Autowired)(E.SumiContributionsServiceToken),n.__metadata("design:type",E.SumiContributionsService)],s.prototype,"sumiContributesService",void 0),n.__decorate([(0,r.Autowired)(l.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fileService",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],s.prototype,"logger",void 0),t.ExtensionManagementService=s=n.__decorate([(0,r.Injectable)()],s)},20670:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeExtProcessService=void 0;const n=e(85608),r=e(76003),o=e(8919),l=e(18740),m=e(41869),E=e(99220),p=e(72464),v=e(46147),s=e(37846),g=e(28949),c=e(51072),h=e(17802);let d=class{constructor(){this._apiFactoryDisposables=new m.DisposableStore,this.ready=new m.Deferred,this._extHostUpdated=new m.Deferred,this.extensions=[]}disposeApiFactory(){this._apiFactoryDisposables.clear()}async disposeProcess(){this.disposeApiFactory(),await this.extensionNodeClient.disposeClientExtProcess(this.clientId,!1)}async activate(){return await this.createExtProcess(),this.protocol&&(this.ready.resolve(),await this.createBrowserMainThreadAPI(),await(await this.getProxy()).$updateExtHostData(),this._extHostUpdated.resolve()),this.protocol}async activeExtension(_,f){!this.appConfig.noExtHost&&!f&&(await this._extHostUpdated.promise,await(await this.getProxy()).$activateExtension(_.id))}async updateExtensionData(_){if(this.extensions=_,this.protocol){const f=await this.getProxy();await f.$updateExtHostData(),f.$fireChangeEvent()}}getExtension(_){return this.extensions.find(f=>f.id===_)}async $activateExtension(_){const f=this.extensions.find(a=>a.path===_);f&&await f.activate()}async $getExtensions(){return this.extensions.map(_=>_.toJSON())}async getProxy(){return await this.ready.promise,this.protocol.getProxy(v.ExtHostAPIIdentifier.ExtHostExtensionService)}async createBrowserMainThreadAPI(){const _=(0,h.initSharedAPIProxy)(this.protocol,this.injector);this._apiFactoryDisposables.add(_),this._apiFactoryDisposables.add((0,m.toDisposable)((0,c.initNodeThreadAPIProxy)(this.protocol,this.injector,this))),this._apiFactoryDisposables.add((0,m.toDisposable)((0,g.createSumiAPIFactory)(this.protocol,this.injector))),this._apiFactoryDisposables.add(this.createExternalSumiAPIFactory()),await _.setup()}getSpawnOptions(){return{}}createExternalSumiAPIFactory(){const _=new m.Disposable,f=this.mainThreadExtenderContributionProvider.getContributions();for(const b of f)b.registerMainThreadExtender(this.mainThreadExtenderService);const a=this.mainThreadExtenderService.getMainThreadExtenders();for(const b of a){const y=this.injector.get(b.serviceClass,[this.protocol]);this.protocol.set(b.identifier,y),_.addDispose(y)}return _}async getActivatedExtensions(){return await(await this.getProxy()).$getActivatedExtensions()}get clientId(){return this.applicationService.clientId}async createExtProcess(){await this.extensionNodeClient.createProcess(this.clientId,{enableDebugExtensionHost:this.appConfig.enableDebugExtensionHost,inspectExtensionHost:this.appConfig.inspectExtensionHost,extensionConnectOption:this.appConfig.extensionConnectOption,extHostSpawnOptions:this.getSpawnOptions()}),await this.initExtProtocol()}async initExtProtocol(){var _,f;this.channel&&this.channel.dispose(),this.protocol&&((f=(_=this.protocol).dispose)===null||f===void 0||f.call(_)),this.channel=await this.channelHandler.openChannel(E.CONNECTION_HANDLE_BETWEEN_EXTENSION_AND_MAIN_THREAD),this.connection=this.channel.createConnection(),this.protocol=new o.SumiConnectionMultiplexer(this.connection,{timeout:this.appConfig.rpcMessageTimeout,name:"node-ext-host",io:(0,o.createExtMessageIO)(s.knownProtocols)})}};t.NodeExtProcessService=d,n.__decorate([(0,r.Autowired)(m.AppConfig),n.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],d.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(E.ExtensionNodeServiceServerPath),n.__metadata("design:type",Object)],d.prototype,"extensionNodeClient",void 0),n.__decorate([(0,r.Autowired)(m.IApplicationService),n.__metadata("design:type",Object)],d.prototype,"applicationService",void 0),n.__decorate([(0,r.Autowired)(l.WSChannelHandler),n.__metadata("design:type",l.WSChannelHandler)],d.prototype,"channelHandler",void 0),n.__decorate([(0,r.Autowired)(p.IMainThreadExtenderService),n.__metadata("design:type",Object)],d.prototype,"mainThreadExtenderService",void 0),n.__decorate([(0,r.Autowired)(p.MainThreadExtenderContribution),n.__metadata("design:type",Object)],d.prototype,"mainThreadExtenderContributionProvider",void 0),t.NodeExtProcessService=d=n.__decorate([(0,r.Injectable)()],d)},90731:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ViewExtProcessService=void 0;const r=e(85608),o=e(76003),l=e(65973),m=e(8919),E=e(41869),p=e(40827),v=e(43718),s=e(61656),g=e(99220),c=e(25600),h=e(17428),d=e(54107),u=e(9438),_=e(8403),f=e(31738),{Path:a,posix:b}=E.path,y="load";let S=n=class extends v.Disposable{constructor(){super(...arguments),this.debugLogger=(0,v.getDebugLogger)(),this.extensions=[],this.activatedViewExtensionMap=new Map,this.portalShadowRootMap=new Map,this.shadowRootBodyMap=new Map}getExtension(w){return this.extensions.find(T=>T.id===w)}async initExtension(w){this.extensions=w}async getActivatedExtensions(){return[]}getProxy(){}async $activateExtension(w){}async $getExtensions(){return this.extensions.map(w=>w.toJSON())}async disposeProcess(){}activate(){const w=this.requireInterceptorContributionProvider.getContributions();for(const T of w)T.registerRequireInterceptor(this.requireInterceptorService);this.extendExtensionErrorStackTrace()}extendExtensionErrorStackTrace(){Error.stackTraceLimit=100,Error.prepareStackTrace=(w,T)=>{let D,I=`Error: ${w.message}`;for(const O of T)if(I+=`
28345
+ `}async provideEditorDocumentModelContent(d,u){return""}isReadonly(d){return!1}isAlwaysDirty(d){return!0}disposeEvenDirty(d){return!0}closeAutoSave(d){return!0}async saveDocumentModel(d,u,_,f,a,b=!1){const{name:y}=d.getParsedQuery(),S=d.path.toString()!=="/"?l.path.dirname(d.path.toString()):this.appConfig.workspaceDir,A=await this.commandService.tryExecuteCommand("file.save",{showNameInput:!0,defaultFileName:y||d.displayName,defaultUri:l.URI.file(l.isWindows?S.replaceAll("\\","/"):S)});return A&&(await this.editorDocumentModelService.saveEditorDocumentModel(A,u,_,f,a,b),await this.workbenchEditorService.open(A,{preview:!1,focus:!0,replace:!0,forceClose:!0})),{state:l.SaveTaskResponseState.SUCCESS}}onDidDisposeModel(){}};t.UntitledSchemeDocumentProvider=g,r.__decorate([(0,o.Autowired)(v.IEditorDocumentModelService),r.__metadata("design:type",Object)],g.prototype,"editorDocumentModelService",void 0),r.__decorate([(0,o.Autowired)(p.WorkbenchEditorService),r.__metadata("design:type",p.WorkbenchEditorService)],g.prototype,"workbenchEditorService",void 0),r.__decorate([(0,o.Autowired)(l.CommandService),r.__metadata("design:type",Object)],g.prototype,"commandService",void 0),r.__decorate([(0,o.Autowired)(l.AppConfig),r.__metadata("design:type",Object)],g.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(l.IApplicationService),r.__metadata("design:type",Object)],g.prototype,"applicationService",void 0),r.__decorate([(0,o.Autowired)(s),r.__metadata("design:type",s)],g.prototype,"untitledIndex",void 0),r.__decorate([(0,o.Autowired)(l.PreferenceService),r.__metadata("design:type",Object)],g.prototype,"preferenceService",void 0),t.UntitledSchemeDocumentProvider=g=r.__decorate([(0,o.Injectable)()],g);let c=class extends l.WithEventBus{constructor(){super(...arguments),this.scheme=l.Schemes.untitled}provideResource(d){const{name:u}=d.getParsedQuery();return{name:u||d.displayName,uri:d,icon:"",metadata:null}}async shouldCloseResourceWithoutConfirm(d){const u=this.documentModelService.getModelDescription(d.uri,"close-resource-check");return!!(u&&u.dirty)}async close(d,u){const _=this.documentModelService.getModelReference(d.uri,"close-resource-check");if(!_)return!1;if(u===p.AskSaveResult.SAVE){const f=await _.instance.save();return _.dispose(),f}else return u===p.AskSaveResult.REVERT?(await _.instance.revert(),_.dispose(),!0):!u||u===p.AskSaveResult.CANCEL?(_.dispose(),!1):(_.dispose(),!0)}async shouldCloseResource(d){const u=this.documentModelService.getModelDescription(d.uri,"close-resource-check");if(!u||!u.dirty)return!0;const _={[(0,l.localize)("file.prompt.dontSave","Don't Save")]:p.AskSaveResult.REVERT,[(0,l.localize)("file.prompt.save","Save")]:p.AskSaveResult.SAVE,[(0,l.localize)("file.prompt.cancel","Cancel")]:p.AskSaveResult.CANCEL},f=await this.dialogService.open({message:(0,l.formatLocalize)("saveChangesMessage",d.name),type:l.MessageType.Info,buttons:Object.keys(_)});return await this.close(d,_[f])}};t.UntitledSchemeResourceProvider=c,r.__decorate([(0,o.Autowired)(m.IDialogService),r.__metadata("design:type",Object)],c.prototype,"dialogService",void 0),r.__decorate([(0,o.Autowired)(v.IEditorDocumentModelService),r.__metadata("design:type",Object)],c.prototype,"documentModelService",void 0),t.UntitledSchemeResourceProvider=c=r.__decorate([(0,o.Injectable)()],c)},33835:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeEditor=void 0;const r=e(85608).__importDefault(e(14041)),o=e(41869),l=e(23418),m=e(96689),E=p=>{const v=r.default.useRef(),s=(0,o.useInjectable)(l.EditorCollectionService),g=(0,o.useInjectable)(m.IEditorDocumentModelService),[c,h]=r.default.useState(void 0),[d,u]=r.default.useState(void 0),[_,f]=r.default.useState(void 0),[a,b]=r.default.useState(void 0);let y=!1;return r.default.useEffect(()=>{if(v.current){c&&c.dispose();const S=s.createCodeEditor(v.current,{automaticLayout:!0,...p.options});h(S),d&&S.open(d)}return()=>{y=!0,c&&c.dispose(),d&&d.dispose()}},[v.current]),p&&c&&p.editorRef&&p.editorRef(c),_&&a!==_&&(b(_),g.createModelReference(new o.URI(_),"editor-react-component").then(S=>{d&&d.dispose(),!y&&S.instance.uri.toString()===_?u(S):S.dispose()})),d&&c&&c.currentDocumentModel!==d.instance&&c.open(d),p.uri&&p.uri.toString()!==_&&f(p.uri.toString()),r.default.createElement("div",{ref:S=>S&&(v.current=S),...p})};t.CodeEditor=E},50674:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useUpdateOnGroupTabChange=r;const n=e(41869);function r(o){return(0,n.useUpdateOnEvent)(o.onDidEditorGroupTabChanged,[o])}},6670:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorSuggestWidgetContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(76835);let E=class{contribute(v){const s=new o.DisposableCollection,g=v.monacoEditor.getContribution(m.SuggestController.ID);if(g&&g.widget&&g.widget.value){const c=g.widget.value;s.push(c.onDidSelect(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidSelect",data:h}))})),s.push(c.onDidHide(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidHide",data:h}))})),s.push(c.onDidShow(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidShow",data:h}))})),s.push(c.onDidFocus(h=>{this.eventBus.fire(new o.SuggestEvent({eventType:"onDidFocus",data:h}))})),c&&c._setDetailsVisible&&c._setDetailsVisible(this.preferenceService.get("editor.suggest.details.visible",!0))}return s}};t.EditorSuggestWidgetContribution=E,n.__decorate([(0,r.Autowired)(l.IEventBus),n.__metadata("design:type",Object)],E.prototype,"eventBus",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],E.prototype,"preferenceService",void 0),t.EditorSuggestWidgetContribution=E=n.__decorate([(0,r.Injectable)()],E)},67903:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorTopPaddingContribution=void 0;class e{contribute(r){return r.monacoEditor.onDidChangeModel(()=>{r.monacoEditor.changeViewZones(o=>{o.addZone({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:0})})})}}t.EditorTopPaddingContribution=e},51553:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditorGroup=t.WorkbenchEditorServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(91830),m=e(75524),E=e(43718),p=n.__importStar(e(20868)),v=e(72665),s=e(23418),g=e(96689),c=e(76759),h=e(47049),d=e(82196),u=e(17878),_=10,f=A=>!!(A.supportsRevive&&!A.deleted);let a=class extends E.WithEventBus{constructor(){super(),this.editorGroups=[],this._onDidEditorGroupsChanged=new E.Emitter,this.onDidEditorGroupsChanged=this._onDidEditorGroupsChanged.event,this._sortedEditorGroups=[],this._onActiveResourceChange=new E.Emitter,this.onActiveResourceChange=this._onActiveResourceChange.event,this._onActiveEditorUriChange=new E.Emitter,this.onActiveEditorUriChange=this._onActiveEditorUriChange.event,this._onCursorChange=new E.Emitter,this.onCursorChange=this._onCursorChange.event,this._onDidCurrentEditorGroupChanged=new E.Emitter,this.onDidCurrentEditorGroupChanged=this._onDidCurrentEditorGroupChanged.event,this._restoring=!0,this.contributionsReady=new E.Deferred,this.untitledCloseIndex=[],this.gridReady=!1,this._onDidGridReady=new E.Emitter,this.onDidGridReady=this._onDidGridReady.event,this.editorGroupIdGen=0,this.untitledIndex.update(),this.initialize()}setEditorContextKeyService(w){this.editorContextKeyService=w}setCurrentGroup(w){var T;if(w){if(this._currentEditorGroup===w)return;this._currentEditorGroup=w,this._onActiveResourceChange.fire(w.currentResource),this.eventBus.fire(new d.EditorActiveResourceStateChangedEvent({resource:w.currentResource,openType:w.currentOpenType,editorUri:(T=this.currentEditor)===null||T===void 0?void 0:T.currentUri})),this._onDidCurrentEditorGroupChanged.fire(this._currentEditorGroup)}}onEditorGroupChangeEvent(w){var T;w.payload.group===this.currentEditorGroup&&this.eventBus.fire(new d.EditorActiveResourceStateChangedEvent({resource:w.payload.newResource,openType:w.payload.newOpenType,editorUri:(T=this.currentEditor)===null||T===void 0?void 0:T.currentUri}))}getAllOpenedUris(){const w=[];for(const T of this.editorGroups)for(const D of T.resources)w.findIndex(O=>O.isEqual(D.uri))===-1&&w.push(D.uri);return w}async getAllOpenedDocuments(){const w=[];for(const T of this.editorGroups)for(const D of T.resources){if(D.uri.scheme!=="file")continue;if(w.findIndex(O=>O.uri.isEqual(D.uri))===-1){const O=await T.getDocumentModelRef(D.uri);O&&w.push(O.instance)}}return w}async saveAll(w,T){for(const D of this.editorGroups)await D.saveAll(w,T)}hasDirty(){for(const w of this.editorGroups)if(w.hasDirty())return!0;return!1}calcDirtyCount(){const w=new Set;return this.editorGroups.reduce((T,D)=>T+D.calcDirtyCount(w),0)}createEditorGroup(){const w=this.injector.get(b,[this.generateRandomEditorGroupName(),this.editorGroupIdGen++]);this.editorGroups.push(w);const T=new E.Disposable(w.onDidEditorGroupBodyChanged(()=>{w===this.currentEditorGroup&&(!w.currentOpenType&&w.currentResource||this._onActiveResourceChange.fire(w.currentResource))}),w.onDidEditorFocusChange(()=>{var I;w===this.currentEditorGroup&&(!w.currentOpenType&&w.currentResource||this._onActiveEditorUriChange.fire((I=w.currentOrPreviousFocusedEditor)===null||I===void 0?void 0:I.currentUri))}));w.addDispose({dispose:()=>{T.dispose()}});const D=w.onDidEditorGroupTabChanged(()=>{this.saveOpenedResourceState()});return w.addDispose({dispose:()=>{D.dispose()}}),w.onCurrentEditorCursorChange(I=>{this._currentEditorGroup===w&&this._onCursorChange.fire(I)}),w}generateRandomEditorGroupName(){let w=(0,E.makeRandomHexString)(5);for(;this.editorGroups.findIndex(T=>T.name===w)!==-1;)w=(0,E.makeRandomHexString)(5);return w}initialize(){return this.initializing||(this.initializing=this.doInitialize()),this.initializing}async doInitialize(){this.openedResourceState=await this.initializeState(),await this.contributionsReady.promise,await this.restoreState(),this._currentEditorGroup=this.editorGroups[0]}async initializeState(){return await this.getStorage(E.STORAGE_NAMESPACE.WORKBENCH)}get currentEditor(){return this.currentEditorGroup&&this.currentEditorGroup.currentEditor}get currentCodeEditor(){return this.currentEditorGroup.currentCodeEditor}get currentEditorGroup(){return this._currentEditorGroup}get currentOrPreviousFocusedEditor(){return this.currentEditorGroup&&this.currentEditorGroup.currentOrPreviousFocusedEditor}async open(w,T){await this.initialize();let D=this.currentEditorGroup,I;if(T&&typeof T.groupIndex<"u"?I=T.groupIndex:T&&T.relativeGroupIndex&&(I=this.currentEditorGroup.index+T.relativeGroupIndex),typeof I=="number"&&I>=0){if(I>=this.editorGroups.length)return D.open(w,Object.assign({},T,{split:s.EditorGroupSplitAction.Right}));D=this.sortedEditorGroups[I]||this.currentEditorGroup}return D.open(w,T)}async openUris(w){await this.initialize(),await this.currentEditorGroup.openUris(w)}getEditorGroup(w){return this.editorGroups.find(T=>T.name===w)}get currentResource(){return this.currentEditorGroup?this.currentEditorGroup.currentResource:null}removeGroup(w){const T=this.editorGroups.findIndex(D=>D===w);if(T!==-1){if(this.editorGroups.length===1)return;this.editorGroups.splice(T,1),this.currentEditorGroup===w&&this.setCurrentGroup(this.editorGroups[0]);for(let D=T;D<this.editorGroups.length;D++)this.eventBus.fire(new d.EditorGroupIndexChangedEvent({group:this.editorGroups[D],index:D}))}}async saveOpenedResourceState(){if(this._restoring)return;const w=this.topGrid.serialize();await this.openedResourceState.set("grid",w)}prepareContextKeyService(){const w=D=>{let I=null;const O=this.documentModelManager.getModelDescription(D,"resourceContextKey");return O&&(I=O.languageId),I},T=new l.ResourceContextKey(this.editorContextKeyService,D=>{const I=w(D);return I||w(D)});this.onActiveResourceChange(D=>{this.currentEditor&&this.currentEditor.currentUri?T.set(this.currentEditor.currentUri):D?T.set(D.uri):T.reset()}),this.currentEditor&&this.currentEditor.currentUri?T.set(this.currentEditor.currentUri):this.currentResource?T.set(this.currentResource.uri):T.reset()}onDomCreated(w){this.editorContextKeyService&&this.editorContextKeyService.attachToDomNode(w)}notifyGroupChanged(){this._sortedEditorGroups=void 0,this._onDidEditorGroupsChanged.fire()}async restoreState(){let w={editorGroup:{uris:[],previewIndex:-1}};this.appConfig.disableRestoreEditorGroupState||(w=this.openedResourceState.get("grid",w)),this.topGrid=new h.EditorGrid,this.addDispose(this.topGrid),this.addDispose(this.topGrid.onDidGridAndDesendantStateChange(()=>{this._sortedEditorGroups=void 0,this._onDidEditorGroupsChanged.fire()}));const T=[],D=this.topGrid.deserialize(w,()=>this.createEditorGroup(),T).then(()=>{this.topGrid.children.length===0&&!this.topGrid.editorGroup&&this.topGrid.setEditorGroup(this.createEditorGroup()),this.gridReady=!0,this._onDidGridReady.fire(),this.notifyGroupChanged()});return Promise.all(T).then(()=>{this._restoring=!1;for(const I of this.contributions.getContributions())I.onDidRestoreState&&I.onDidRestoreState()}),D}async closeAll(w,T){for(const D of this.editorGroups.slice(0))w?await D.close(w,{force:T}):await D.closeAll()}async closeAllOnlyConfirmOnce(){const w=[];for(const k of this.editorGroups)for(const B of k.resources)w.push(B);const D=(await Promise.all(w.map(async k=>({shouldClose:await this.resourceService.shouldCloseResourceWithoutConfirm(k),resource:k})))).filter(k=>k.shouldClose);if(D.length===0)return!1;const I={[(0,E.localize)("file.prompt.dontSave","Don't Save")]:d.AskSaveResult.REVERT,[(0,E.localize)("file.prompt.save","Save")]:d.AskSaveResult.SAVE,[(0,E.localize)("file.prompt.cancel","Cancel")]:d.AskSaveResult.CANCEL};let L=D.slice(0,_).map(k=>k.resource.name).join("\u3001");D.length>_&&(D.length-_===1?L+=(0,E.localize)("file.prompt.more.one"):L+=(0,E.formatLocalize)("file.prompt.more.number",D.length-_));const R=await this.dialogService.open({message:(0,o.toMarkdown)((0,E.formatLocalize)("saveNFilesChangesMessage",D.length,L),this.openner),type:E.MessageType.Info,buttons:Object.keys(I)}),M=I[R];return M===d.AskSaveResult.SAVE?(await Promise.all(D.map(k=>{var B,x;return(x=(B=this.resourceService).close)===null||x===void 0?void 0:x.call(B,k.resource,d.AskSaveResult.SAVE)})),!1):M===d.AskSaveResult.REVERT?(await Promise.all(D.map(k=>{var B,x;return(x=(B=this.resourceService).close)===null||x===void 0?void 0:x.call(B,k.resource,d.AskSaveResult.REVERT)})),!1):!0}async close(w,T){return this.closeAll(w,T)}get sortedEditorGroups(){return this._sortedEditorGroups||(this._sortedEditorGroups=[],this.topGrid.sortEditorGroups(this._sortedEditorGroups)),this._sortedEditorGroups}handleOnCloseUntitledResource(w){if(w.payload.resource.uri.scheme===E.Schemes.untitled){const{index:T}=w.payload.resource.uri.getParsedQuery();this.untitledCloseIndex.push(parseInt(T,10)),this.untitledCloseIndex.sort((D,I)=>D-I)}}createUntitledURI(){const w=this.untitledCloseIndex.shift()||this.untitledIndex.id;return new E.URI().withScheme(E.Schemes.untitled).withQuery(`name=${u.UntitledDocumentIdCounter.UNTITLED_FILE_NAME_PREFIX}${w}&index=${w}`)}createUntitledResource(w={uri:this.createUntitledURI()}){return this.open(w.uri,{preview:!1,focus:!0,...w.resourceOpenOptions})}};t.WorkbenchEditorServiceImpl=a,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],a.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(s.ResourceService),n.__metadata("design:type",s.ResourceService)],a.prototype,"resourceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],a.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(E.StorageProvider),n.__metadata("design:type",Function)],a.prototype,"getStorage",void 0),n.__decorate([(0,r.Autowired)(v.IDialogService),n.__metadata("design:type",Object)],a.prototype,"dialogService",void 0),n.__decorate([(0,r.Autowired)(o.IOpenerService),n.__metadata("design:type",Object)],a.prototype,"openner",void 0),n.__decorate([(0,r.Autowired)(d.BrowserEditorContribution),n.__metadata("design:type",Object)],a.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(g.IEditorDocumentModelService),n.__metadata("design:type",Object)],a.prototype,"documentModelManager",void 0),n.__decorate([(0,r.Autowired)(u.UntitledDocumentIdCounter),n.__metadata("design:type",u.UntitledDocumentIdCounter)],a.prototype,"untitledIndex",void 0),n.__decorate([(0,E.OnEvent)(d.EditorGroupChangeEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.EditorGroupChangeEvent]),n.__metadata("design:returntype",void 0)],a.prototype,"onEditorGroupChangeEvent",null),n.__decorate([(0,E.OnEvent)(d.EditorGroupCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.EditorGroupCloseEvent]),n.__metadata("design:returntype",void 0)],a.prototype,"handleOnCloseUntitledResource",null),t.WorkbenchEditorServiceImpl=a=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],a);let b=class extends E.WithEventBus{constructor(w,T){super(),this.name=w,this.groupId=T,this.openingPromise=new Map,this._onDidEditorFocusChange=this.registerDispose(new E.Emitter),this.onDidEditorFocusChange=this._onDidEditorFocusChange.event,this._onDidEditorGroupTabChanged=new E.Emitter,this.onDidEditorGroupTabChanged=this._onDidEditorGroupTabChanged.event,this._onDidEditorGroupTabOperation=new E.Emitter,this.onDidEditorGroupTabOperation=this._onDidEditorGroupTabOperation.event,this._onDidEditorGroupBodyChanged=new E.Emitter,this.onDidEditorGroupBodyChanged=this._onDidEditorGroupBodyChanged.event,this._onDidEditorGroupContentLoading=new E.Emitter,this.onDidEditorGroupContentLoading=this._onDidEditorGroupContentLoading.event,this.previewURI=null,this.resources=[],this.resourceStatus=new Map,this.cachedResourcesActiveOpenTypes=new Map,this.cachedResourcesOpenTypes=new Map,this.availableOpenTypes=[],this.activeComponents=new Map,this.activateComponentsProps=new Map,this.holdDocumentModelRefs=new Map,this.toDispose=[],this._prevDomHeight=0,this._prevDomWidth=0,this._onCurrentEditorCursorChange=new E.Emitter,this.onCurrentEditorCursorChange=this._onCurrentEditorCursorChange.event,this.resourceOpenHistory=[],this._domNode=null,this._diffEditorDomNode=null,this._diffEditorDomNodeAttached=!1,this._mergeEditorDomNode=null,this._mergeEditorDomNodeAttached=!1,this.codeEditorReady=new E.ReadyEvent,this.diffEditorReady=new E.ReadyEvent,this.diffEditorDomReady=new E.ReadyEvent,this.mergeEditorReady=new E.ReadyEvent,this.mergeEditorDomReady=new E.ReadyEvent,this._restoringState=!1,this.eventBus.onDirective(o.ResizeEvent.createDirective((0,o.getSlotLocation)("@opensumi/ide-editor",this.config.layoutConfig)),()=>{this.doLayoutEditors()}),this.eventBus.on(d.GridResizeEvent,D=>{D.payload.gridId===this.grid.uid&&this.doLayoutEditors()}),this.eventBus.on(d.EditorComponentDisposeEvent,D=>{this.activeComponents.delete(D.payload),this.activateComponentsProps.delete(D.payload)}),this.listenToExplorerAutoRevealConfig()}listenToExplorerAutoRevealConfig(){this.explorerAutoRevealConfig=!!this.preferenceService.get("explorer.autoReveal"),this.disposables.push(this.preferenceService.onPreferenceChanged(w=>{w.preferenceName==="explorer.autoReveal"&&(this.explorerAutoRevealConfig=w.newValue)}))}attachDiffEditorDom(w){this._diffEditorDomNodeAttached||(this._diffEditorDomNode=w,this.diffEditorDomReady.ready(),this._diffEditorDomNodeAttached=!0)}attachMergeEditorDom(w){this._mergeEditorDomNodeAttached||(this._mergeEditorDomNode=w,this.mergeEditorDomReady.ready(),this._mergeEditorDomNodeAttached=!0)}attachToDom(w){this._domNode=w,w&&(this.contextKeyService.attachToDomNode(w),this.layoutEditors())}layoutEditors(){o.fastdom.measure(()=>{if(this._domNode){const w=this._domNode.offsetWidth,T=this._domNode.offsetHeight;(w!==this._prevDomWidth||T!==this._prevDomHeight)&&this.doLayoutEditors(),this._prevDomWidth=w,this._prevDomHeight=T}})}_layoutEditorWorker(){if(this.currentOpenType)switch(this.currentOpenType.type){case d.EditorOpenType.code:this.codeEditor&&this.codeEditor.layout();break;case d.EditorOpenType.diff:this.diffEditor&&this.diffEditor.layout();break;default:break}}doLayoutEditors(){this._measure&&this._measure.dispose(),this._measure=o.fastdom.mutate(()=>{this._layoutEditorWorker()})}setContextKeys(){var w;if(!this._resourceContext){const T=D=>{let I=null;const O=this.documentModelManager.getModelDescription(D,"resourceContextKey");return O&&(I=O.languageId),I};this._resourceContext=new l.ResourceContextKey(this.contextKeyService,D=>T(D)),this._diffResourceContextKey=new l.ResourceContextKey(this.contextKeyService,D=>T(D),"diffResource"),this._editorLangIDContextKey=this.contextKeyService.createKey("editorLangId",""),this._isInDiffEditorContextKey=this.contextKeyService.createKey("isInDiffEditor",!1),this._isInDiffRightEditorContextKey=this.contextKeyService.createKey("isInDiffRightEditor",!1),this._isInEditorComponentContextKey=this.contextKeyService.createKey("inEditorComponent",!1)}this.currentOrPreviousFocusedEditor&&this.currentOrPreviousFocusedEditor.currentUri?(this._resourceContext.set(this.currentOrPreviousFocusedEditor.currentUri),this.currentOrPreviousFocusedEditor.currentDocumentModel&&this._editorLangIDContextKey.set(this.currentOrPreviousFocusedEditor.currentDocumentModel.languageId)):this.currentEditor&&this.currentEditor.currentUri?(this._resourceContext.set(this.currentEditor.currentUri),this.currentEditor.currentDocumentModel&&this._editorLangIDContextKey.set(this.currentEditor.currentDocumentModel.languageId)):(this.currentResource?this._resourceContext.set(this.currentResource.uri):this._resourceContext.reset(),this._editorLangIDContextKey.reset()),this._isInDiffEditorContextKey.set(this.isDiffEditorMode()),this._isInDiffRightEditorContextKey.set(this.isDiffEditorMode()),this._isInEditorComponentContextKey.set(this.isComponentMode()),this.isDiffEditorMode()&&this._diffResourceContextKey.set((w=this.currentResource)===null||w===void 0?void 0:w.uri),this.updateContextKeyWhenDiffEditorChangesFocus()}updateContextKeyWhenDiffEditorChangesFocus(){if(this.updateContextKeyWhenEditorChangesFocusDisposer||!this.diffEditor)return;const w=()=>{this.currentFocusedEditor||(this.setContextKeys(),this._onDidEditorFocusChange.fire())};this.updateContextKeyWhenEditorChangesFocusDisposer=new E.Disposable(this.diffEditor.modifiedEditor.onFocus(()=>{this._currentOrPreviousFocusedEditor=this.diffEditor.modifiedEditor,this.setContextKeys(),this._onDidEditorFocusChange.fire()}),this.diffEditor.originalEditor.onFocus(()=>{this._currentOrPreviousFocusedEditor=this.diffEditor.originalEditor,this.setContextKeys(),this._onDidEditorFocusChange.fire()}),this.codeEditor.onFocus(()=>{this.codeEditor.currentUri&&this.locateInFileTree(this.codeEditor.currentUri),this._currentOrPreviousFocusedEditor=this.codeEditor,this.setContextKeys(),this._onDidEditorFocusChange.fire()}),this.codeEditor.onBlur(w),this.diffEditor.originalEditor.onBlur(w),this.diffEditor.modifiedEditor.onBlur(w)),this.addDispose(this.updateContextKeyWhenEditorChangesFocusDisposer)}get contextKeyService(){return this._contextKeyService||(this._contextKeyService=this.workbenchEditorService.editorContextKeyService.createScoped()),this._contextKeyService}get index(){return this.workbenchEditorService.sortedEditorGroups.indexOf(this)}onResourceDecorationChangeEvent(w){w.payload.decoration.dirty&&this.previewURI&&this.previewURI.isEqual(w.payload.uri)&&this.pinPreviewed(),this.resources.find(D=>D.uri.isEqual(w.payload.uri))&&this.notifyTabChanged()}resetOpenType(){this._currentOpenType=null}oResourceOpenTypeChangedEvent(w){const T=w.payload;this.cachedResourcesOpenTypes.has(T.toString())&&this.cachedResourcesOpenTypes.delete(T.toString()),this.currentResource&&this.currentResource.uri.isEqual(T)&&(this.resetOpenType(),this.notifyBodyChanged(),this.displayResourceComponent(this.currentResource,{}))}async onRegisterEditorComponentEvent(){if(this.currentResource){const w=this.currentResource,T=await this.editorComponentRegistry.resolveEditorComponent(w);this.currentResource===w&&(this.availableOpenTypes=T,this.cachedResourcesOpenTypes.set(w.uri.toString(),T))}}pinPreviewed(w){const T=this.previewURI;w===void 0?this.previewURI=null:this.previewURI&&this.previewURI.isEqual(w)&&(this.previewURI=null),T!==this.previewURI&&this.notifyTabChanged()}notifyTabChanged(){this._restoringState||this._onDidEditorGroupTabChanged.fire()}notifyBodyChanged(){this._onDidEditorGroupBodyChanged.fire()}notifyTabLoading(w){this._onDidEditorGroupContentLoading.fire(w)}get currentEditor(){return this.currentOpenType?this.currentOpenType.type===d.EditorOpenType.code?this.codeEditor:this.currentOpenType.type===d.EditorOpenType.diff?this.diffEditor.modifiedEditor:null:null}get currentOrPreviousFocusedEditor(){return this._currentOrPreviousFocusedEditor||this.currentEditor}get currentFocusedEditor(){if(this.currentOpenType){if(this.currentOpenType.type===d.EditorOpenType.code){if(this.codeEditor.monacoEditor.hasWidgetFocus())return this.codeEditor}else if(this.currentOpenType.type===d.EditorOpenType.diff){if(this.diffEditor.modifiedEditor.monacoEditor.hasTextFocus())return this.diffEditor.modifiedEditor;if(this.diffEditor.originalEditor.monacoEditor.hasTextFocus())return this.diffEditor.originalEditor;if(this.diffEditor.modifiedEditor.monacoEditor.hasWidgetFocus())return this.diffEditor.modifiedEditor;if(this.diffEditor.originalEditor.monacoEditor.hasWidgetFocus())return this.diffEditor.originalEditor}}return null}get currentCodeEditor(){return this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code?this.codeEditor:null}createEditor(w){this.codeEditor=this.collectionService.createCodeEditor(w,{},{[o.ServiceNames.CONTEXT_KEY_SERVICE]:this.contextKeyService.contextKeyService}),setTimeout(()=>{this.doLayoutEditors()}),this.addDispose(this.codeEditor.onRefOpen(()=>{this.doLayoutEditors()})),this.toDispose.push(this.codeEditor.onCursorPositionChanged(T=>{this._onCurrentEditorCursorChange.fire(T)})),this.toDispose.push(this.codeEditor.onSelectionsChanged(T=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.eventBus.fire(new d.EditorSelectionChangeEvent({group:this,resource:this.currentResource,selections:T.selections,source:T.source,editorUri:this.codeEditor.currentUri}))})),this.toDispose.push(this.codeEditor.onVisibleRangesChanged(T=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.eventBus.fire(new d.EditorVisibleChangeEvent({group:this,resource:this.currentResource,visibleRanges:T,editorUri:this.codeEditor.currentUri}))})),this.toDispose.push(this.codeEditor.onConfigurationChanged(()=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.eventBus.fire(new d.EditorConfigurationChangedEvent({group:this,resource:this.currentResource,editorUri:this.codeEditor.currentUri}))})),this.eventBus.fire(new d.CodeEditorDidVisibleEvent({groupName:this.name,type:d.EditorOpenType.code,editorId:this.codeEditor.getId()})),this.codeEditorReady.ready()}createMergeEditor(w){this.mergeEditor=this.collectionService.createMergeEditor(w,{},{[o.ServiceNames.CONTEXT_KEY_SERVICE]:this.contextKeyService.contextKeyService}),this.mergeEditorReady.ready()}createDiffEditor(w){this.diffEditor=this.collectionService.createDiffEditor(w,{},{[o.ServiceNames.CONTEXT_KEY_SERVICE]:this.contextKeyService.contextKeyService}),setTimeout(()=>{this.doLayoutEditors()}),this.diffEditor.onRefOpen(()=>{this.doLayoutEditors()}),this.addDiffEditorEventListeners(this.diffEditor.originalEditor,"original"),this.addDiffEditorEventListeners(this.diffEditor.modifiedEditor,"modified"),this.eventBus.fire(new d.CodeEditorDidVisibleEvent({groupName:this.name,type:d.EditorOpenType.diff,editorId:this.diffEditor.modifiedEditor.getId()})),this.eventBus.fire(new d.CodeEditorDidVisibleEvent({groupName:this.name,type:d.EditorOpenType.diff,editorId:this.diffEditor.originalEditor.getId()})),this.diffEditorReady.ready()}addDiffEditorEventListeners(w,T){this.toDispose.push(w.onSelectionsChanged(D=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.eventBus.fire(new d.EditorSelectionChangeEvent({group:this,resource:this.currentResource,selections:D.selections,source:D.source,editorUri:E.URI.from(w.monacoEditor.getModel().uri),side:T}))})),this.toDispose.push(w.onVisibleRangesChanged(D=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.eventBus.fire(new d.EditorVisibleChangeEvent({group:this,resource:this.currentResource,visibleRanges:D,editorUri:w.currentUri}))})),this.toDispose.push(w.onConfigurationChanged(()=>{this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.eventBus.fire(new d.EditorConfigurationChangedEvent({group:this,resource:this.currentResource,editorUri:w.currentUri}))}))}async split(w,T,D){var I,O,L;const R=this.workbenchEditorService.createEditorGroup(),M=w===s.EditorGroupSplitAction.Left||w===s.EditorGroupSplitAction.Right?h.SplitDirection.Horizontal:h.SplitDirection.Vertical,k=w===s.EditorGroupSplitAction.Left||w===s.EditorGroupSplitAction.Top;if(this.grid.split(M,R,k),D&&!D.scrollTop&&(D.scrollTop=(I=this.currentEditor)===null||I===void 0?void 0:I.monacoEditor.getScrollTop()),D&&!D.scrollLeft&&(D.scrollLeft=(O=this.currentEditor)===null||O===void 0?void 0:O.monacoEditor.getScrollLeft()),D&&!D?.range){const B=(L=this.currentCodeEditor)===null||L===void 0?void 0:L.monacoEditor.getSelection();B&&(D.range=new p.Range(B.startLineNumber,B.startColumn,B.endLineNumber,B.endColumn))}return R.open(T,{...D,preview:!1,revealRangeInCenter:!1})}async open(w,T={}){if(w.scheme===E.Schemes.file&&this.recentFilesManager.setMostRecentlyOpenedFile(w.withoutFragment().toString()),T&&T.split)return this.split(T.split,w,Object.assign({},T,{split:void 0,preview:!1}));if(!this.openingPromise.has(w.toString())){const I=this.doOpen(w,T);this.openingPromise.set(w.toString(),I),I.then(()=>{this.openingPromise.delete(w.toString())},()=>{this.openingPromise.delete(w.toString())})}return this.preferenceService.get("editor.previewMode")&&((0,E.isUndefinedOrNull)(T.preview)?!0:T.preview)||this.openingPromise.get(w.toString()).then(()=>{this.pinPreviewed(w)}),this.openingPromise.get(w.toString())}async pin(w){return this.pinPreviewed(w)}getPreventScrollOption(w={}){var T;return(T=w.preventScroll)!==null&&T!==void 0?T:this.preferenceService.get("editor.preventScrollAfterFocused")}async doOpen(w,T={}){var D,I,O;if(!this.resourceService.handlesUri(w))return this.openerService.open(w),!1;let L;try{const R=this.preferenceService.get("editor.previewMode")&&((0,E.isUndefinedOrNull)(T.preview)?!0:T.preview);if(this.currentResource&&this.currentResource.uri.isEqual(w)&&(!T.forceOpenType||T.forceOpenType.type===((D=this.currentOpenType)===null||D===void 0?void 0:D.type))){if(T.focus&&this.currentEditor){const M=this.getPreventScrollOption(T);(I=this._domNode)===null||I===void 0||I.focus({preventScroll:M}),this.currentEditor.monacoEditor.focus()}return T.range&&this.currentEditor&&(this.currentEditor.monacoEditor.setSelection(T.range),setTimeout(()=>{var M;(M=this.currentEditor)===null||M===void 0||M.monacoEditor.revealRangeInCenter(T.range,0)},0)),this.locationInTree(T,w),this.notifyTabChanged(),{group:this,resource:this.currentResource}}else{const M=this._currentOpenType,k=this._currentResource;let B=null,x=this.resources.find(K=>K.uri.toString()===w.toString());if(!x){if(x=await this.resourceService.getResource(w),!x)throw new Error("This uri cannot be opened!: "+w);if(x.deleted){if(T.deletedPolicy==="fail")throw new Error("resource deleted "+w);if(T.deletedPolicy==="skip")return!1}T&&T.label&&(x.name=T.label),T&&(0,E.isDefined)(T.supportsRevive)&&(x.supportsRevive=T.supportsRevive);let K=null;if(T&&T.index!==void 0&&T.index<this.resources.length)K=this.resources[T.index],this.resources.splice(T.index,0,x),B={type:"open",resource:x,index:T.index};else if(this.currentResource){const U=this.resources.indexOf(this.currentResource);this.resources.splice(U+1,0,x),B={type:"open",resource:x,index:U+1},K=this.currentResource}else this.resources.push(x),B={type:"open",resource:x,index:this.resources.length-1};R&&(this.previewURI&&await this.close(this.previewURI,{treatAsNotCurrent:!0,force:T.forceClose}),this.previewURI=x.uri),T.replace&&K&&await this.close(K.uri,{treatAsNotCurrent:!0,force:T.forceClose})}if(T.backend)return this.notifyTabChanged(),!1;if(k&&this.resourceOpenHistory[this.resourceOpenHistory.length-1]!==k.uri){this.resourceOpenHistory.push(k.uri);const K=(O=this.currentCodeEditor)===null||O===void 0?void 0:O.getSelections();K&&K.length>0&&this.recentFilesManager.updateMostRecentlyOpenedFile(k.uri.toString(),{lineNumber:K[0].selectionStartLineNumber,column:K[0].selectionStartColumn})}this._currentOpenType=null,this._currentResource=x;const N=this.reporterService.time(E.REPORT_NAME.EDITOR_REACTIVE);L=new E.Deferred,this.resourceStatus.set(x,L.promise);const j=setTimeout(()=>{this.notifyTabLoading(x)},60);this.notifyTabChanged(),this.notifyBodyChanged();try{await this.displayResourceComponent(x,T)}finally{B&&this._onDidEditorGroupTabOperation.fire(B)}return this._currentOrPreviousFocusedEditor=this.currentEditor,clearTimeout(j),L.resolve(),N.timeEnd(x.uri.toString()),this._onDidEditorFocusChange.fire(),this.setContextKeys(),this.eventBus.fire(new d.EditorGroupOpenEvent({group:this,resource:x})),this.locationInTree(T,w),this.eventBus.fire(new d.EditorGroupChangeEvent({group:this,newOpenType:this.currentOpenType,newResource:this.currentResource,oldOpenType:M,oldResource:k})),{group:this,resource:x}}}catch(R){return(0,E.getDebugLogger)().error(R),L&&L.reject(),(0,c.isEditorError)(R,c.EditorTabChangedError)||this.messageService.error((0,E.formatLocalize)("editor.failToOpen",w.displayName,R.message),[],!0),!1}}locationInTree(w,T){w?.backend||(w?.disableNavigate||this.locateInFileTree(T),w.disableNavigateOnOpendEditor||this.locateInOpenedEditor(T))}locateInFileTree(w){this.explorerAutoRevealConfig&&this.commands.tryExecuteCommand(o.FILE_COMMANDS.LOCATION.id,w)}locateInOpenedEditor(w){this.explorerAutoRevealConfig&&this.commands.tryExecuteCommand(o.OPEN_EDITORS_COMMANDS.LOCATION.id,w)}async openUris(w){for(const T of w)await this.open(T)}async getDocumentModelRef(w){const T=w.toString();return this.holdDocumentModelRefs.has(T)||this.holdDocumentModelRefs.set(T,await this.documentModelManager.createModelReference(w,"editor-group-"+this.name)),this.holdDocumentModelRefs.get(T)}disposeDocumentRef(w){if(w.scheme==="diff"){const T=w.getParsedQuery();this.doDisposeDocRef(new E.URI(T.original)),this.doDisposeDocRef(new E.URI(T.modified))}else w.scheme==="mergeEditor"?this.mergeEditor&&this.mergeEditor.dispose():this.doDisposeDocRef(w)}doDisposeDocRef(w){const T=w.toString();this.holdDocumentModelRefs.has(T)&&(this.holdDocumentModelRefs.get(T).dispose(),this.holdDocumentModelRefs.delete(T))}async openCodeEditor(w,T){this.resolveTabChanged(w,this.currentResource),await this.codeEditorReady.onceReady(async()=>{var D;const I=await this.getDocumentModelRef(w.uri);if(await this.codeEditor.open(I),T.range){const O=new p.Range(T.range.startLineNumber,T.range.startColumn,T.range.endLineNumber,T.range.endColumn);this.codeEditor.monacoEditor.setSelection(O),T.revealRangeInCenter&&setTimeout(()=>{this.codeEditor.monacoEditor.revealRangeInCenter(O,1)})}if(queueMicrotask(()=>{T.scrollTop&&this.codeEditor.monacoEditor.setScrollTop(T.scrollTop),T.scrollLeft&&this.codeEditor.monacoEditor.setScrollLeft(T.scrollLeft)}),T.focus){const O=this.getPreventScrollOption(T);(D=this._domNode)===null||D===void 0||D.focus({preventScroll:O});const L=this.eventBus.on(d.CodeEditorDidVisibleEvent,R=>{var M;if(R.payload.groupName===this.name&&R.payload.type===d.EditorOpenType.code){if(L.dispose(),this.disposed||this!==this.workbenchEditorService.currentEditorGroup)return;if(this.currentEditor===this.codeEditor&&(!((M=this.codeEditor.currentUri)===null||M===void 0)&&M.isEqual(w.uri)))try{this.codeEditor.focus()}catch{}}})}I.instance.dirty&&this.pinPreviewed(w.uri)})}async openDiffEditor(w,T){this.diffEditor||await this.diffEditorDomReady.onceReady(()=>{var L;const R=document.createElement("div");(L=this._diffEditorDomNode)===null||L===void 0||L.appendChild(R),this.createDiffEditor(R)});const D=w,[I,O]=await Promise.all([this.getDocumentModelRef(D.metadata.original),this.getDocumentModelRef(D.metadata.modified)]);await this.diffEditorReady.onceReady(async()=>{var L;if(!(!I||!O)&&(await this.diffEditor.compare(I,O,T,w.uri),T.focus)){const R=this.getPreventScrollOption(T);(L=this._domNode)===null||L===void 0||L.focus({preventScroll:R});const M=this.eventBus.on(d.CodeEditorDidVisibleEvent,k=>{if(k.payload.groupName===this.name&&k.payload.type===d.EditorOpenType.diff){if(M.dispose(),this.disposed||this!==this.workbenchEditorService.currentEditorGroup)return;if(this.currentEditor===this.diffEditor.modifiedEditor)try{this.diffEditor.focus()}catch{}}})}})}async openMergeEditor(w){const{metadata:T}=w;if(!T)return;this.mergeEditor||await this.mergeEditorDomReady.onceReady(()=>{var j;const K=document.createElement("div");(j=this._mergeEditorDomNode)===null||j===void 0||j.appendChild(K),this.createMergeEditor(K)});const{ancestor:D,input1:I,input2:O,output:L}=T,R=m.MergeEditorInputData.from(I),M=m.MergeEditorInputData.from(O),[k,B,x,N]=await Promise.all([this.getDocumentModelRef(E.URI.parse(D)),this.getDocumentModelRef(R.uri),this.getDocumentModelRef(E.URI.parse(L)),this.getDocumentModelRef(M.uri)]);await this.mergeEditorReady.onceReady(async()=>{await this.mergeEditor.open({ancestor:{uri:E.URI.parse(T.ancestor),textModel:k.instance.getMonacoModel(),baseContent:k.instance.baseContent||""},input1:R.setTextModel(B.instance.getMonacoModel()),input2:M.setTextModel(N.instance.getMonacoModel()),output:{uri:E.URI.parse(T.output),textModel:x.instance.getMonacoModel()}})})}async openCustomEditor(w,T){const D=this.editorComponentRegistry.getEditorComponent(T),I=this.editorComponentRegistry.getEditorInitialProps(T);if(D){if(this.activateComponentsProps.set(D,I),D.renderMode===d.EditorComponentRenderMode.ONE_PER_RESOURCE){const O=this.activeComponents.get(D)||[];O.findIndex(R=>R.uri.toString()===w.uri.toString())===-1&&O.push(w),this.activeComponents.set(D,O)}else if(D.renderMode===d.EditorComponentRenderMode.ONE_PER_GROUP)this.activeComponents.set(D,[w]);else if(D.renderMode===d.EditorComponentRenderMode.ONE_PER_WORKBENCH){const O=[];this.workbenchEditorService.editorGroups.forEach(L=>{if(L===this)return;const R=L.resources.find(M=>M.uri.isEqual(w.uri));R&&O.push(L.close(R.uri))}),await Promise.all(O).catch((0,E.getDebugLogger)().error),this.activeComponents.set(D,[w])}}else throw new Error("Cannot find Editor Component with id: "+T);this._onCurrentEditorCursorChange.fire({position:null,selectionLength:0})}async displayResourceComponent(w,T){T.revealRangeInCenter===void 0&&(T.revealRangeInCenter=!0);const D=w,I=await this.resolveOpenType(w,T);if(I){const{activeOpenType:O,openTypes:L}=I;switch(this.availableOpenTypes=L,T.preserveFocus&&(T.focus=!1),O.type){case d.EditorOpenType.code:await this.openCodeEditor(w,T);break;case d.EditorOpenType.diff:await this.openDiffEditor(w,T);break;case d.EditorOpenType.mergeEditor:await this.openMergeEditor(w);break;case d.EditorOpenType.component:await this.openCustomEditor(w,O.componentId);break;default:return}this.resolveTabChanged(D,this.currentResource),this._currentOpenType=O,this.notifyBodyChanged(),this.doLayoutEditors(),this.cachedResourcesActiveOpenTypes.set(w.uri.toString(),O)}}resolveTabChanged(w,T){if(w!==T)throw new c.EditorTabChangedError}getLastOpenType(w){return this.cachedResourcesActiveOpenTypes.get(w.uri.toString())}async resolveOpenType(w,T){const D=this.cachedResourcesOpenTypes.get(w.uri.toString())||await this.editorComponentRegistry.resolveEditorComponent(w),I=this.preferenceService.get("workbench.editorAssociations"),O=y(D,this.cachedResourcesActiveOpenTypes.get(w.uri.toString()),w,I,T.forceOpenType);return this.cachedResourcesOpenTypes.set(w.uri.toString(),D),{activeOpenType:O,openTypes:D}}async close(w,{treatAsNotCurrent:T,force:D}={}){const I=this.resources.findIndex(O=>O.uri.toString()===w.toString());if(I!==-1){const O=this.resources[I];if(!D&&!await this.shouldClose(O))return!1;if(this.resources.splice(I,1),this._onDidEditorGroupTabOperation.fire({type:"close",resource:O,index:I}),this.eventBus.fire(new d.EditorGroupCloseEvent({group:this,resource:O})),this.previewURI&&this.previewURI.isEqual(w)&&(this.previewURI=null),O===this.currentResource&&!T){let L;for(;this.resourceOpenHistory.length>0;)if(this.resources.findIndex(R=>R.uri===this.resourceOpenHistory[this.resourceOpenHistory.length-1])!==-1){L=this.resourceOpenHistory.pop();break}else this.resourceOpenHistory.pop();if(L)this.open(L);else{let R=I;for(;R>0&&!this.resources[R];)R--;this.resources[R]?this.open(this.resources[R].uri):this.backToEmpty()}}else this.notifyTabChanged();this.removeResouceFromActiveComponents(O),this.disposeDocumentRef(w)}return this.resources.length===0&&(this.grid.parent&&this.dispose(),this.availableOpenTypes=[]),!0}removeResouceFromActiveComponents(w){this.activeComponents.forEach((T,D)=>{const I=T.indexOf(w);I!==-1&&(T.splice(I,1),this.eventBus.fire(new d.ResoucesOfActiveComponentChangedEvent({component:D,resources:T})))})}async shouldClose(w){const T=this.workbenchEditorService.editorGroups.map(D=>D.resources);if(await this.resourceService.shouldCloseResource(w,T)){let D=0;for(const I of T)for(const O of I)if(O.uri.isEqual(w.uri)&&(D++,D>=2))break;return D<=1&&this.resourceService.disposeResource(w),!0}else return!1}backToEmpty(){const w=this._currentOpenType,T=this._currentResource;this._currentResource=null,this.resetOpenType(),this.notifyTabChanged(),this.notifyBodyChanged(),this._currentOrPreviousFocusedEditor=null,this._onDidEditorFocusChange.fire(),this.eventBus.fire(new d.EditorGroupChangeEvent({group:this,newOpenType:this.currentOpenType,newResource:this.currentResource,oldOpenType:w,oldResource:T}))}async closeAll(){for(const T of this.resources)if(!await this.shouldClose(T))return!1;return this.resources.splice(0,this.resources.length).reverse().forEach((T,D)=>{this.clearResourceOnClose(T),this._onDidEditorGroupTabOperation.fire({type:"close",resource:T,index:D})}),this.activeComponents.clear(),this.workbenchEditorService.editorGroups.length>1&&this.dispose(),this.previewURI=null,this.backToEmpty(),!0}async closeSaved(){const w=this.resources.filter(T=>{const D=this.resourceService.getResourceDecoration(T.uri);if(!D||!D.dirty)return!0});for(const T of w)if(!await this.shouldClose(T))return;for(const T of w)await this.close(T.uri)}async closeToRight(w){const T=this.resources.findIndex(D=>D.uri.toString()===w.toString());if(T!==-1){const D=this.resources.slice(T+1);for(const I of D)if(!await this.shouldClose(I))return;this.resources.splice(T+1),D.reverse().forEach((I,O)=>{this._onDidEditorGroupTabOperation.fire({type:"close",resource:I,index:T+1+(D.length-1-O)})});for(const I of D)this.clearResourceOnClose(I);this.open(w)}}clearResourceOnClose(w){this.eventBus.fire(new d.EditorGroupCloseEvent({group:this,resource:w})),this.removeResouceFromActiveComponents(w)}async closeOthers(w){const T=this.resources.findIndex(D=>D.uri.toString()===w.toString());if(T!==-1){const D=this.resources.filter((O,L)=>L!==T);for(const O of D)if(!await this.shouldClose(O))return;const I=this.resources;this.resources=[this.resources[T]],D.reverse().forEach(O=>{this._onDidEditorGroupTabOperation.fire({type:"close",resource:O,index:I.indexOf(O)})});for(const O of D)this.clearResourceOnClose(O);await this.open(w)}}get currentResource(){return this._currentResource}get currentOpenType(){return this._currentOpenType}async changeOpenType(w){const T=this.availableOpenTypes.find(I=>I.type===w||I.componentId===w);if(!T||!this.currentResource||S(T,this.currentOpenType))return;const D=this.currentOpenType;await this.displayResourceComponent(this.currentResource,{forceOpenType:T}),this.eventBus.fire(new d.EditorGroupChangeEvent({group:this,newOpenType:this.currentOpenType,newResource:this.currentResource,oldOpenType:D,oldResource:this.currentResource}))}async dropUri(w,T,D,I){if(T!==d.DragOverPosition.CENTER)await this.split((0,s.getSplitActionFromDragDrop)(T),w,{preview:!1,focus:!0});else if(!I)await this.open(w,{preview:!1,focus:!0});else{const O=this.resources.indexOf(I);if(O===-1)await this.open(w,{preview:!1,focus:!0});else{const L=this.resources.findIndex(R=>R.uri.toString()===w.toString());if(L===-1)await this.open(w,{index:O,preview:!1});else{const R=this.resources[L];L>O?(this.resources.splice(L,1),this.resources.splice(O,0,R),this._onDidEditorGroupTabOperation.fire({type:"move",resource:R,oldIndex:L,index:O}),await this.open(w,{preview:!1})):L<O&&(this.resources.splice(O+1,0,R),this.resources.splice(L,1),this._onDidEditorGroupTabOperation.fire({type:"move",resource:R,oldIndex:L,index:O}),await this.open(w,{preview:!1}))}}}D&&(D!==this?await D.close(w):T!==d.DragOverPosition.CENTER&&await this.close(w))}gainFocus(){this.workbenchEditorService.setCurrentGroup(this)}focus(){this.gainFocus(),this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code&&this.codeEditor.focus(),this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff&&this.diffEditor.focus()}dispose(){var w;(w=this.grid)===null||w===void 0||w.dispose(),this.workbenchEditorService.removeGroup(this),super.dispose(),this.codeEditor&&this.codeEditor.dispose(),this.diffEditor&&this.diffEditor.dispose(),this.toDispose.forEach(T=>T.dispose()),this.eventBus.fire(new d.EditorGroupDisposeEvent({group:this}))}getState(){const w=this.resources.filter(f).map(T=>T.uri.toString());return{uris:w,current:this.currentResource&&f(this.currentResource)?this.currentResource.uri.toString():void 0,previewIndex:this.previewURI?w.indexOf(this.previewURI.toString()):-1}}isCodeEditorMode(){return!!this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.code}isDiffEditorMode(){return!!this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.diff}isComponentMode(){return!!this.currentOpenType&&this.currentOpenType.type===d.EditorOpenType.component}async restoreState(w){this._restoringState=!0,this.previewURI=w.uris[w.previewIndex]?new E.URI(w.uris[w.previewIndex]):null,await Promise.all(w.uris.map(async D=>{await this.doOpen(new E.URI(D),{disableNavigate:!0,backend:!0,preview:!1,deletedPolicy:"skip"})}));let T;w.current?T=new E.URI(w.current):w.uris.length>0&&(T=new E.URI(w.uris[w.uris.length-1])),T&&(await this.open(T,{deletedPolicy:"skip"})||this.resources[0]&&await this.open(this.resources[0].uri)),this._restoringState=!1,this.notifyTabChanged()}async saveAll(w,T){for(const D of this.resources)!w&&D.uri.scheme===E.Schemes.untitled||await this.saveResource(D,T)}async saveResource(w,T=s.SaveReason.Manual){if(await this.saveByOpenType(w,T))return;const D=this.documentModelManager.getModelReference(w.uri);D&&(await D.instance.save(void 0,T),D.dispose())}async saveByOpenType(w,T){const D=this.cachedResourcesActiveOpenTypes.get(w.uri.toString());if(D&&D.saveResource)try{return await D.saveResource(w,T),!0}catch(I){this.logger.error(I)}return!1}async saveCurrent(w=s.SaveReason.Manual){const T=this.currentResource;if(T&&!await this.saveByOpenType(T,w)&&this.currentEditor)return this.currentEditor.save()}hasDirty(){for(const w of this.resources){const T=this.documentModelManager.getModelDescription(w.uri);if(T&&T.dirty)return!0}return!1}calcDirtyCount(w=new Set){let T=0;for(const D of this.resources){const I=this.documentModelManager.getModelDescription(D.uri,"calc-dirty-count");w.has(D.uri.toString())||(w.add(D.uri.toString()),I&&I.dirty&&(T+=1))}return T}componentUndo(){const w=this.currentOpenType;w?.undo&&w.undo(this.currentResource)}componentRedo(){const w=this.currentOpenType;w?.redo&&w.redo(this.currentResource)}toJSON(){return{name:this.name}}};t.EditorGroup=b,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.EditorCollectionService)],b.prototype,"collectionService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.ResourceService)],b.prototype,"resourceService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",d.EditorComponentRegistry)],b.prototype,"editorComponentRegistry",void 0),n.__decorate([(0,r.Autowired)(s.WorkbenchEditorService),n.__metadata("design:type",a)],b.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(g.IEditorDocumentModelService),n.__metadata("design:type",Object)],b.prototype,"documentModelManager",void 0),n.__decorate([(0,r.Autowired)(E.CommandService),n.__metadata("design:type",Object)],b.prototype,"commands",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],b.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.RecentFilesManager),n.__metadata("design:type",o.RecentFilesManager)],b.prototype,"recentFilesManager",void 0),n.__decorate([(0,r.Autowired)(v.IMessageService),n.__metadata("design:type",Object)],b.prototype,"messageService",void 0),n.__decorate([(0,r.Autowired)(E.IReporterService),n.__metadata("design:type",Object)],b.prototype,"reporterService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],b.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(o.IOpenerService),n.__metadata("design:type",Object)],b.prototype,"openerService",void 0),n.__decorate([(0,r.Autowired)(E.ILogger),n.__metadata("design:type",Object)],b.prototype,"logger",void 0),n.__decorate([(0,E.OnEvent)(s.ResourceDecorationChangeEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[s.ResourceDecorationChangeEvent]),n.__metadata("design:returntype",void 0)],b.prototype,"onResourceDecorationChangeEvent",null),n.__decorate([(0,E.OnEvent)(d.ResourceOpenTypeChangedEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[d.ResourceOpenTypeChangedEvent]),n.__metadata("design:returntype",void 0)],b.prototype,"oResourceOpenTypeChangedEvent",null),n.__decorate([(0,E.OnEvent)(d.RegisterEditorComponentEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",Promise)],b.prototype,"onRegisterEditorComponentEvent",null),t.EditorGroup=b=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Number])],b);function y(A,w,T,D,I){if(I)return A.find(O=>S(O,I))||A[0];if(w)return A.find(O=>S(O,w))||A[0];if(D){const O=A.find(L=>{const R=Object.keys(D).find(B=>(0,E.match)(B,T.uri.path.toString().toLowerCase())||(0,E.match)(B,T.uri.path.base.toLowerCase())),M=R&&D[R];if(!M)return!1;const k=`${E.CUSTOM_EDITOR_SCHEME}-${M}`;return L.componentId===k});if(O)return O}return A[0]}function S(A,w){return A.type===w.type&&(A.type!==d.EditorOpenType.component||A.componentId===w.componentId)}},94180:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TabbarLeftExtraContentId=t.TabbarRightExtraContentId=void 0,t.TabbarRightExtraContentId="tabbar-right-extra-content",t.TabbarLeftExtraContentId="tabbar-left-extra-content"},93107:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IDocPersistentCacheProvider=void 0,t.isDocContentCache=e,t.isDocChangesCache=n,t.parseCacheValueFrom=r,t.IDocPersistentCacheProvider=Symbol("IDocPersistentCacheProvider");function e(o){return o.hasOwnProperty("content")}function n(o){return o.hasOwnProperty("changeMatrix")}function r(o){const l=o.text,m=o.range.startLineNumber,E=o.range.startColumn,p=o.range.endLineNumber,v=o.range.endColumn;return[l,m,E,p,v]}},55113:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AUTO_SAVE_MODE=t.SaveReason=t.Direction=t.EditorGroupSplitAction=t.DragOverPosition=t.EditorOpenType=t.IEditorPriority=t.OverviewRulerLane=t.WorkbenchEditorService=t.DidApplyEditorDecorationFromProvider=t.DidChangeEditorGroupUriEvent=t.CollectionEditorsUpdateEvent=t.EditorCollectionService=t.EditorType=t.ShowLightbulbIconMode=void 0,t.getSimpleEditorOptions=y,t.isTextEditorViewState=S;const n=e(85608),r=e(76003),o=e(43718);var l=e(20868);Object.defineProperty(t,"ShowLightbulbIconMode",{enumerable:!0,get:function(){return l.ShowLightbulbIconMode}});var m;(function(A){A[A.CODE=0]="CODE",A[A.ORIGINAL_DIFF=1]="ORIGINAL_DIFF",A[A.MODIFIED_DIFF=2]="MODIFIED_DIFF",A.MERGE_EDITOR_DIFF="MERGE_EDITOR_DIFF"})(m||(t.EditorType=m={}));let E=class{};t.EditorCollectionService=E,t.EditorCollectionService=E=n.__decorate([(0,r.Injectable)()],E);class p extends o.BasicEvent{}t.CollectionEditorsUpdateEvent=p;class v extends o.BasicEvent{}t.DidChangeEditorGroupUriEvent=v;class s extends o.BasicEvent{}t.DidApplyEditorDecorationFromProvider=s;class g{}t.WorkbenchEditorService=g;var c;(function(A){A[A.Left=1]="Left",A[A.Center=2]="Center",A[A.Right=4]="Right",A[A.Full=7]="Full"})(c||(t.OverviewRulerLane=c={}));var h;(function(A){A.builtin="builtin",A.option="option",A.exclusive="exclusive",A.default="default"})(h||(t.IEditorPriority=h={}));var d;(function(A){A.code="code",A.diff="diff",A.mergeEditor="mergeEditor",A.component="component"})(d||(t.EditorOpenType=d={}));var u;(function(A){A.LEFT="left",A.RIGHT="right",A.TOP="top",A.BOTTOM="bottom",A.CENTER="center"})(u||(t.DragOverPosition=u={}));var _;(function(A){A[A.Top=1]="Top",A[A.Bottom=2]="Bottom",A[A.Left=3]="Left",A[A.Right=4]="Right"})(_||(t.EditorGroupSplitAction=_={}));var f;(function(A){A.UP="up",A.DOWN="down",A.LEFT="left",A.RIGHT="right"})(f||(t.Direction=f={}));var a;(function(A){A[A.Manual=1]="Manual",A[A.AfterDelay=2]="AfterDelay",A[A.FocusOut=3]="FocusOut"})(a||(t.SaveReason=a={}));var b;(function(A){A.OFF="off",A.AFTER_DELAY="afterDelay",A.EDITOR_FOCUS_CHANGE="editorFocusChange",A.WINDOWS_LOST_FOCUS="windowLostFocus"})(b||(t.AUTO_SAVE_MODE=b={}));function y(){return{fontSize:12,fontWeight:"normal",lineHeight:0,wordWrap:"on",overviewRulerLanes:0,glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,hideCursorInOverviewRuler:!0,selectionHighlight:!1,scrollbar:{horizontal:"hidden"},lineDecorationsWidth:0,overviewRulerBorder:!1,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",minimap:{enabled:!1},guides:{highlightActiveIndentation:!1,indentation:!1,bracketPairs:!1}}}function S(A){const w=A;if(!w)return!1;const T=w;if(T.modified)return S(T.modified);const D=w;return!!(D.contributionsState&&D.viewState&&Array.isArray(D.cursorState))}},23418:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(94180),t),n.__exportStar(e(93107),t),n.__exportStar(e(55113),t),n.__exportStar(e(23950),t),n.__exportStar(e(27693),t),n.__exportStar(e(46225),t),n.__exportStar(e(4308),t),n.__exportStar(e(39467),t)},27693:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ILanguageStatusService=void 0,t.ILanguageStatusService=Symbol("ILanguageStatusService")},23950:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticTag=t.DiagnosticSeverity=t.ILanguageService=void 0,t.asSeverity=l,t.asRelatedInformations=m,t.asRelatedInformation=E,t.asMonacoDiagnostics=p,t.asMonacoDiagnostic=v;const n=e(43718);t.ILanguageService=Symbol("ILanguageService");var r;(function(s){s[s.Error=1]="Error",s[s.Warning=2]="Warning",s[s.Information=3]="Information",s[s.Hint=4]="Hint"})(r||(t.DiagnosticSeverity=r={}));var o;(function(s){s[s.Unnecessary=1]="Unnecessary",s[s.Deprecated=2]="Deprecated"})(o||(t.DiagnosticTag=o={}));function l(s){return s===1?n.MarkerSeverity.Error:s===2?n.MarkerSeverity.Warning:s===3?n.MarkerSeverity.Info:n.MarkerSeverity.Hint}function m(s){if(s)return s.map(g=>E(g))}function E(s){return{resource:n.Uri.parse(s.location.uri),startLineNumber:s.location.range.start.line+1,startColumn:s.location.range.start.character+1,endLineNumber:s.location.range.end.line+1,endColumn:s.location.range.end.character+1,message:s.message}}function p(s){if(s)return s.map(g=>v(g))}function v(s){return{code:typeof s.code=="number"?s.code.toString():typeof s.code=="object"?{value:s.code.value.toString(),target:s.code.target}:s.code,severity:l(s.severity),message:s.message,source:s.source,startLineNumber:s.range.start.line+1,startColumn:s.range.start.character+1,endLineNumber:s.range.end.line+1,endColumn:s.range.end.character+1,relatedInformation:m(s.relatedInformation),tags:s.tags}}},46225:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notebookCellScheme=t.INotebookService=t.CellKind=t.NotebookCellsChangeType=void 0;var e;(function(r){r[r.ModelChange=1]="ModelChange",r[r.Move=2]="Move",r[r.ChangeCellLanguage=5]="ChangeCellLanguage",r[r.Initialize=6]="Initialize",r[r.ChangeCellMetadata=7]="ChangeCellMetadata",r[r.Output=8]="Output",r[r.OutputItem=9]="OutputItem",r[r.ChangeCellContent=10]="ChangeCellContent",r[r.ChangeDocumentMetadata=11]="ChangeDocumentMetadata",r[r.ChangeCellInternalMetadata=12]="ChangeCellInternalMetadata",r[r.ChangeCellMime=13]="ChangeCellMime",r[r.Unknown=100]="Unknown"})(e||(t.NotebookCellsChangeType=e={}));var n;(function(r){r[r.Markup=1]="Markup",r[r.Code=2]="Code"})(n||(t.CellKind=n={})),t.INotebookService=Symbol("INotebookService"),t.notebookCellScheme="vscode-notebook-cell"},4308:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskSaveResult=t.DIFF_SCHEME=t.ResourceDecorationNeedChangeEvent=t.ResourceDecorationChangeEvent=t.ResourceRemoveEvent=t.ResourceDidUpdateEvent=t.ResourceNeedUpdateEvent=t.ResourceService=void 0,t.isDiffResource=v;const n=e(43718);class r{}t.ResourceService=r;class o extends n.BasicEvent{}t.ResourceNeedUpdateEvent=o;class l extends n.BasicEvent{}t.ResourceDidUpdateEvent=l;class m extends n.BasicEvent{}t.ResourceRemoveEvent=m;class E extends n.BasicEvent{}t.ResourceDecorationChangeEvent=E;class p extends n.BasicEvent{}t.ResourceDecorationNeedChangeEvent=p,t.DIFF_SCHEME="diff";function v(g){return g.uri.scheme===t.DIFF_SCHEME}var s;(function(g){g[g.REVERT=1]="REVERT",g[g.SAVE=2]="SAVE",g[g.CANCEL=3]="CANCEL"})(s||(t.AskSaveResult=s={}))},39467:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSplitActionFromDragDrop=r;const n=e(55113);function r(o){return{[n.DragOverPosition.LEFT]:n.EditorGroupSplitAction.Left,[n.DragOverPosition.RIGHT]:n.EditorGroupSplitAction.Right,[n.DragOverPosition.BOTTOM]:n.EditorGroupSplitAction.Bottom,[n.DragOverPosition.TOP]:n.EditorGroupSplitAction.Top}[o]}},54414:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(23418),t)},32595:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExplorerContribution=t.EXPLORER_CONTAINER_ID=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(30144);Object.defineProperty(t,"EXPLORER_CONTAINER_ID",{enumerable:!0,get:function(){return l.EXPLORER_CONTAINER_ID}});const m=e(21634),E=e(68456),p=e(43718);let v=class{registerComponent(g){g.register("@opensumi/ide-explorer",[],{iconClass:(0,o.getIcon)("explorer"),title:(0,o.localize)("explorer.title"),priority:10,containerId:l.EXPLORER_CONTAINER_ID,activateKeyBinding:"ctrlcmd+shift+e"})}onStart(){this.extensionsSchemaService.appendExtensionPoint(["browserViews","properties"],{extensionPoint:l.EXPLORER_CONTAINER_ID,frameworkKind:["opensumi"],jsonSchema:{...m.browserViews.properties,description:(0,o.formatLocalize)("sumiContributes.browserViews.location.custom",(0,o.localize)("explorer.title"))}})}};t.ExplorerContribution=v,n.__decorate([(0,r.Autowired)(p.IExtensionsSchemaService),n.__metadata("design:type",Object)],v.prototype,"extensionsSchemaService",void 0),t.ExplorerContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution,E.ComponentContribution)],v)},59027:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExplorerModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(32595);let m=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[l.ExplorerContribution]}};t.ExplorerModule=m,t.ExplorerModule=m=n.__decorate([(0,r.Injectable)()],m)},18531:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExpressFileServerContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(32242),m=e(90242);let E=class{registerStaticResolver(v){v.registerStaticResourceProvider({scheme:o.Schemes.file,resolveStaticResource:s=>{const g=new o.URI(this.appConfig.staticServicePath||m.EXPRESS_SERVER_PATH),[c,h]=s.codeUri.path.split("?");return g.resolve(`assets${decodeURIComponent(c)}`).withQuery(h)},roots:[this.appConfig.staticServicePath||m.EXPRESS_SERVER_PATH]})}};t.ExpressFileServerContribution=E,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],E.prototype,"appConfig",void 0),t.ExpressFileServerContribution=E=n.__decorate([(0,o.Domain)(l.StaticResourceContribution)],E)},98885:(P,t,e)=>{"use strict";var n;n={value:!0},t.Q=void 0;const r=e(85608),o=e(76003),l=e(41869),m=e(18531);let E=class extends l.BrowserModule{constructor(){super(...arguments),this.providers=[m.ExpressFileServerContribution]}};t.Q=E,t.Q=E=r.__decorate([(0,o.Injectable)()],E)},90242:(P,t,e)=>{"use strict";var n=e(39907);Object.defineProperty(t,"__esModule",{value:!0}),t.ALLOW_MIME=t.EXPRESS_SERVER_PATH=t.EXPRESS_SERVER_PORT=void 0,t.EXPRESS_SERVER_PORT=8e3,t.EXPRESS_SERVER_PATH=n.env.STATIC_SERVER_PATH||`http://127.0.0.1:${t.EXPRESS_SERVER_PORT}/`,t.ALLOW_MIME={gif:"image/gif",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",webp:"image/webp",svg:"image/svg+xml",ttf:"font/ttf",eot:"font/eot",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",js:"application/javascript",css:"text/css",mp4:"video/mp4",ogg:"video/ogg",webm:"video/webm"}},21082:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EXTENSION_SCHEME=t.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID=void 0;const n=e(30144);t.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID=n.EXTENSION_CONTAINER_ID,t.EXTENSION_SCHEME="extension"},6449:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionOverview=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),l=e(68974),m=e(95422),E=e(43718),p=e(93374),v=e(29150),s=n.__importDefault(e(40769));var g;(function(d){d.details="Details",d.changelog="ChangeLog",d.deps="Dependencies"})(g||(g={}));const c=[g.details,g.changelog,g.deps],h=({resource:d})=>{var u,_,f,a,b,y,S,A,w,T,D,I,O,L,R,M,k,B,x,N,j,K,U,X,z;const Q=(0,m.useInjectable)(v.VSXExtensionServiceToken),[G,J]=(0,r.useState)(!0),[Y,H]=(0,r.useState)(((u=d.metadata)===null||u===void 0?void 0:u.state)===v.InstallState.INSTALLED?4:0),[$,Z]=(0,r.useState)(g.details),[re,ce]=(0,r.useState)({}),ge=(0,r.useCallback)(ie=>{const se=c[ie];se&&Z(se)},[]),Ae=(0,r.useCallback)(async()=>{var ie;const se=await Q.getRemoteRawExtension((ie=d.metadata)===null||ie===void 0?void 0:ie.extensionId);if(se){const me=["readme","changelog"].map(Ce=>{var Ee,xe;const Ye=(Ee=se.files)===null||Ee===void 0?void 0:Ee[Ce];return Ye?fetch(Ye).then(Ue=>Ue.text()):(xe=se[Ce])!==null&&xe!==void 0?xe:""}),[ye,_e]=await Promise.all(me);ce({readme:ye,changelog:_e,downloadCount:se.downloadCount})}J(!1)},[d]),te=(0,r.useCallback)(async()=>{var ie;const se=await Q.getLocalExtension((ie=d.metadata)===null||ie===void 0?void 0:ie.extensionId);se&&(H(1),Q.install(se).finally(()=>{H(4)}))},[d]),Pe=(0,r.useCallback)(async()=>{var ie;const se=await Q.getLocalExtension((ie=d.metadata)===null||ie===void 0?void 0:ie.extensionId);se&&(H(2),Q.uninstall(se).finally(()=>{H(3)}))},[d]);(0,r.useEffect)(()=>{Ae()},[d]);const Te=(0,r.useMemo)(()=>{var ie,se,me;const ye=[];if(((ie=d.metadata)===null||ie===void 0?void 0:ie.state)!==v.InstallState.NOT_INSTALLED)if(Y!==3)ye.push(r.default.createElement(o.Button,{size:"small",key:"uninstall",onClick:Pe,disabled:Y===2},(0,E.localize)(Y===2?"marketplace.extension.uninstalling":"marketplace.extension.uninstall")));else return ye.push(r.default.createElement(o.Button,{size:"small",key:"uninstalled",disabled:!0},(0,E.localize)("marketplace.extension.uninstalled"))),ye;return((se=d.metadata)===null||se===void 0?void 0:se.state)===v.InstallState.NOT_INSTALLED?Y===4?ye.push(r.default.createElement(o.Button,{size:"small",key:"installed",disabled:!0},(0,E.localize)("marketplace.extension.installed"))):ye.push(r.default.createElement(o.Button,{size:"small",key:"install",onClick:te,disabled:Y!==0},(0,E.localize)(Y===1?"marketplace.extension.installing":"marketplace.extension.install"))):((me=d.metadata)===null||me===void 0?void 0:me.state)===v.InstallState.SHOULD_UPDATE?Y===4?ye.push(r.default.createElement(o.Button,{size:"small",key:"installed",disabled:!0},(0,E.localize)("marketplace.extension.installed"))):ye.push(r.default.createElement(o.Button,{size:"small",key:"update",onClick:te,disabled:Y!==0},(0,E.localize)(Y===1?"marketplace.extension.updating":"marketplace.extension.update"))):ye.push(r.default.createElement(o.Button,{size:"small",key:"installed",disabled:!0},(0,E.localize)("marketplace.extension.installed"))),ye},[d,Y]);return r.default.createElement("div",{className:s.default.extension_overview_container},r.default.createElement(l.Progress,{loading:G}),r.default.createElement("div",{className:s.default.extension_overview_header},!((_=d.metadata)===null||_===void 0)&&_.iconUrl?r.default.createElement("img",{src:(f=d.metadata)===null||f===void 0?void 0:f.iconUrl,alt:(0,E.replaceLocalizePlaceholder)((a=d.metadata)===null||a===void 0?void 0:a.displayName,(b=d.metadata)===null||b===void 0?void 0:b.extensionId)}):r.default.createElement("div",{className:s.default.default_icon},r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("extension")})),r.default.createElement("div",{className:s.default.extension_detail},r.default.createElement("div",{className:s.default.extension_name},r.default.createElement("h1",null,r.default.createElement("a",{href:`${(y=d.metadata)===null||y===void 0?void 0:y.openVSXRegistry}/extension/${(S=d.metadata)===null||S===void 0?void 0:S.namespace.toLowerCase()}/${(A=d.metadata)===null||A===void 0?void 0:A.name.toLowerCase()}`,target:"_blank",rel:"noopener noreferrer"},(0,E.replaceLocalizePlaceholder)((w=d.metadata)===null||w===void 0?void 0:w.displayName,(T=d.metadata)===null||T===void 0?void 0:T.extensionId)||((D=d.metadata)===null||D===void 0?void 0:D.name))),r.default.createElement("span",{className:s.default.extension_id},((I=d.metadata)===null||I===void 0?void 0:I.namespace.toLowerCase())+"."+((O=d.metadata)===null||O===void 0?void 0:O.name.toLowerCase()))),r.default.createElement("div",{className:s.default.manifest},r.default.createElement("span",null,r.default.createElement("a",{href:(L=d.metadata)===null||L===void 0?void 0:L.namespaceUrl,target:"_blank",rel:"noopener noreferrer"},(R=d.metadata)===null||R===void 0?void 0:R.namespace)),r.default.createElement("span",null,r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("download")}),((M=d.metadata)===null||M===void 0?void 0:M.downloadCount)||re.downloadCount),((k=d.metadata)===null||k===void 0?void 0:k.averageRating)&&r.default.createElement("span",null,(B=d.metadata)===null||B===void 0?void 0:B.averageRating),((x=d.metadata)===null||x===void 0?void 0:x.repository)&&r.default.createElement("span",null,r.default.createElement("a",{href:(N=d.metadata)===null||N===void 0?void 0:N.repository,target:"blank"},"Repository")),((j=d.metadata)===null||j===void 0?void 0:j.license)&&r.default.createElement("span",null,r.default.createElement("a",{href:(K=d.metadata)===null||K===void 0?void 0:K.files.license,target:"blank"},"License")),r.default.createElement("span",null,"v",(U=d.metadata)===null||U===void 0?void 0:U.version)),r.default.createElement("div",{className:s.default.description},(0,E.replaceLocalizePlaceholder)((X=d.metadata)===null||X===void 0?void 0:X.description,(z=d.metadata)===null||z===void 0?void 0:z.extensionId)),r.default.createElement("div",{className:s.default.buttons},Te))),r.default.createElement("div",{className:s.default.extension_overview_body},r.default.createElement(o.Tabs,{className:s.default.tabs,value:$,onChange:ge,tabs:[g.details,g.changelog]}),r.default.createElement("div",{className:s.default.extension_content},$===g.details&&re.readme&&r.default.createElement(p.Markdown,{content:re.readme}),$===g.changelog&&re.changelog&&r.default.createElement(p.Markdown,{content:re.changelog}))))};t.ExtensionOverview=h},87791:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Extension=t.ExtensionViewType=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),l=e(41869),m=e(43718),E=e(29150),p=n.__importDefault(e(90425));var v;(function(s){s[s.MARKETPLACE=0]="MARKETPLACE",s[s.INSTALLED=1]="INSTALLED"})(v||(t.ExtensionViewType=v={})),t.Extension=r.default.memo(({extension:s,onInstall:g,onClick:c,type:h,installedExtensions:d,openVSXRegistry:u})=>{const _=(0,l.useDesignStyles)(p.default.extension_item,"extension_item"),[f,a]=(0,r.useState)(),b=d?.find(I=>I.namespace===s.namespace&&I.name===s.name),y=!!(h===v.INSTALLED||b),S=y&&h===v.MARKETPLACE&&b?.version!==s.version,[A,w]=(0,r.useState)(y),T=(0,r.useCallback)(I=>{I.stopPropagation(),a(!0),g(s).then(()=>{a(!1),w(!0)})},[s]),D=(0,r.useCallback)(()=>{c(s,A?S?E.InstallState.SHOULD_UPDATE:E.InstallState.INSTALLED:E.InstallState.NOT_INSTALLED)},[s]);return r.default.createElement("div",{className:_,onClick:D},s.iconUrl?r.default.createElement("img",{className:p.default.icon,src:s.iconUrl,alt:(0,m.replaceLocalizePlaceholder)(s.displayName,`${s.publisher}.${s.name}`)}):r.default.createElement("div",{className:p.default.default_icon},r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("extension")})),r.default.createElement("div",{className:p.default.extension_detail},r.default.createElement("div",{className:p.default.base_info},r.default.createElement("span",{className:p.default.display_name},(0,m.replaceLocalizePlaceholder)(s.displayName,`${s.publisher}.${s.name}`)||s.name),r.default.createElement("span",{className:p.default.version},s.version),!A&&r.default.createElement("span",{className:p.default.download_count},r.default.createElement(o.Icon,{iconClass:(0,o.getIcon)("download")}),s.downloadCount)),r.default.createElement("span",{className:p.default.description},(0,m.replaceLocalizePlaceholder)(s.description,`${s.publisher}.${s.name}`)),r.default.createElement("div",{className:p.default.footer},r.default.createElement("span",{className:p.default.namespace},s.namespace),h===v.MARKETPLACE&&(y?S?r.default.createElement(o.Button,{type:"primary",size:"small",onClick:T,disabled:f},(0,m.localize)(f?"marketplace.extension.updating":"marketplace.extension.update")):r.default.createElement("span",{className:p.default.state_text},(0,m.localize)("marketplace.extension.installed")):r.default.createElement(o.Button,{type:"primary",size:"small",onClick:T,disabled:f},(0,m.localize)(f?"marketplace.extension.installing":"marketplace.extension.install"))),h===v.INSTALLED&&r.default.createElement(o.Button,{type:"primary",size:"small",onClick:T,disabled:!0},(0,m.localize)("marketplace.extension.installed")))))})},38105:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenVsxExtensionManagerModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(29150),m=e(70274),E=e(67761);let p=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[m.VSXExtensionContribution,{token:l.VSXExtensionServiceToken,useClass:E.VSXExtensionService}],this.backServices=[{servicePath:l.VSXExtensionServicePath}]}};t.OpenVsxExtensionManagerModule=p,t.OpenVsxExtensionManagerModule=p=n.__decorate([(0,r.Injectable)()],p)},70274:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VSXExtensionContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(57517),E=e(63067),p=e(52416),v=e(29150),s=e(21082),g=e(6449),c=e(73689);let h=class{initialize(){}onDidRender(){const u=this.mainLayoutService.getTabbarHandler(s.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID);u&&(u.isActivated()?this.vsxExtensionService.getOpenVSXRegistry().then(()=>{this.vsxExtensionService.search("")}):u.onActivate(async()=>{!this.vsxExtensionService.openVSXRegistry&&await this.vsxExtensionService.getOpenVSXRegistry(),this.vsxExtensionService.search("")}))}registerResource(u){u.registerResourceProvider({scheme:s.EXTENSION_SCHEME,provideResource:async _=>{const{extensionId:f,state:a}=_.getParsedQuery(),b=await this.vsxExtensionService.getLocalExtension(f),y=this.iconService.fromIcon("",b?.iconUrl,p.IconType.Background);return{uri:_,metadata:{...b,extensionId:f,state:a,openVSXRegistry:this.vsxExtensionService.openVSXRegistry},icon:y||(0,o.getIcon)("extension"),name:(0,l.replaceLocalizePlaceholder)(b?.displayName,f)||""}}})}registerEditorComponent(u){const _=`${s.EXTENSION_SCHEME}_detail`;u.registerEditorComponent({component:g.ExtensionOverview,uid:_,scheme:s.EXTENSION_SCHEME}),u.registerEditorComponentResolver(s.EXTENSION_SCHEME,(f,a,b)=>{b?.([{type:m.EditorOpenType.component,componentId:_}])})}registerComponent(u){u.register("@opensumi/ide-extension-manager",[],{iconClass:(0,o.getIcon)("extension"),title:(0,l.localize)("marketplace.extension.container"),priority:5,containerId:s.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID,component:c.VSXExtensionView,activateKeyBinding:"ctrlcmd+shift+x"})}};t.VSXExtensionContribution=h,n.__decorate([(0,r.Autowired)(E.IMainLayoutService),n.__metadata("design:type",Object)],h.prototype,"mainLayoutService",void 0),n.__decorate([(0,r.Autowired)(v.VSXExtensionServiceToken),n.__metadata("design:type",Object)],h.prototype,"vsxExtensionService",void 0),n.__decorate([(0,r.Autowired)(p.IIconService),n.__metadata("design:type",Object)],h.prototype,"iconService",void 0),t.VSXExtensionContribution=h=n.__decorate([(0,l.Domain)(o.ClientAppContribution,E.MainLayoutContribution,o.ComponentContribution,m.BrowserEditorContribution)],h)},67761:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VSXExtensionService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57517),m=e(98453),E=e(71354),p=e(28423),v=e(52416),s=e(12456),g=e(29150);let c=class extends o.Disposable{get extensions(){return this.extensionsObservable.get()}get installedExtensions(){return this.installedExtensionsObservable.get()}get openVSXRegistry(){return this.openVSXRegistryObservable.get()}constructor(){super(),this.extensionsObservable=(0,p.observableValue)(this,[]),this.installedExtensionsObservable=(0,p.observableValue)(this,[]),this.openVSXRegistryObservable=(0,p.observableValue)(this,""),this.tasks=new Map,this.getInstalledExtensions(),this.disposables.push(this.extensionInstanceService.onDidChange(()=>{this.getInstalledExtensions(),this.search(this.searchValue)}))}updateStatusBar(){if(this.tasks.size===0){this.installStatus&&(this.installStatus.dispose(),this.installStatus=void 0);return}const d="sumi-upload-file-status";if(this.tasks.size===1){const u=(0,o.localize)("marketplace.extension.installing"),_={text:u,alignment:o.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.installStatus=this.statusBarService.addElement(d,_)}}async install(d){var u,_;const f=this.getExtensionId(d);if(this.tasks.has(f)||!d.downloadUrl)return;const a=this.backService.install({id:f,name:(u=d.name)!==null&&u!==void 0?u:"-",url:d.downloadUrl,version:(_=d.version)!==null&&_!==void 0?_:"-"});return this.tasks.set(f,a),this.updateStatusBar(),a.then(async b=>{if(this.tasks.delete(f),this.updateStatusBar(),await this.extensionManagementService.postChangedExtension(!1,b),this.themeService.getAvailableThemeInfos().some(w=>w.extensionId===d.originId)){this.commandService.executeCommand(s.THEME_TOGGLE_COMMAND.id,{extensionId:d.originId});return}if(this.iconService.getAvailableThemeInfos().some(w=>w.extensionId===d.originId)){this.commandService.executeCommand(s.ICON_THEME_TOGGLE_COMMAND.id,{extensionId:d.originId});return}if(this.productIconService.getAvailableThemeInfos().some(w=>w.extensionId===d.originId)){this.commandService.executeCommand(s.PRODUCT_ICON_THEME_TOGGLE_COMMAND.id,{extensionId:d.originId});return}})}async uninstall(d){d&&d.path&&await this.extensionManagementService.postUninstallExtension(d.path)}async disable(d){d&&d.path&&this.extensionManagementService.postDisableExtension(d.path)}async enable(d){d&&d.path&&this.extensionManagementService.postEnableExtension(d.path)}getExtensionId(d){var u,_,f;return(u=d?.extensionId)!==null&&u!==void 0?u:((_=d?.namespace)===null||_===void 0?void 0:_.toLowerCase())+"."+((f=d?.name)===null||f===void 0?void 0:f.toLowerCase())}async getLocalExtension(d){return d?this.extensions.find(_=>this.getExtensionId(_)===d)||this.installedExtensions.find(_=>this.getExtensionId(_)===d):void 0}async getRemoteRawExtension(d){if(!d)return;const u={extensionId:d},_=await this.backService.getExtension(u);if(_&&_.extensions&&_.extensions.length>=1)return Object.assign({},_.extensions[0])}async getOpenVSXRegistry(){const d=await this.backService.getOpenVSXRegistry();(0,p.transaction)(u=>{this.openVSXRegistryObservable.set(d,u)})}async openExtensionEditor(d,u){this.workbenchEditorService.open(new o.URI(`extension://?extensionId=${d}&state=${u}`),{preview:!0})}async search(d){const u={query:d,size:50,sortBy:"downloadCount"};this.searchValue=d;const _=await this.backService.search(u);_.extensions&&(0,p.transaction)(f=>{this.extensionsObservable.set(_.extensions.filter(a=>!this.installedExtensions.find(b=>this.getExtensionId(b)===this.getExtensionId(a))).map(a=>({...a,publisher:a.namespace,iconUrl:a.files.icon,downloadUrl:a.files.download,readme:a.files.readme})),f)})}async searchInstalledExtensions(d){(0,p.transaction)(u=>{const _=this.installedExtensions;this.installedExtensionsObservable.set(_.sort((f,a)=>{const b=(0,o.fuzzyScore)(d,d.toLowerCase(),0,f.name,f.name.toLowerCase(),0,!0),y=(0,o.fuzzyScore)(d,d.toLowerCase(),0,a.name,a.name.toLowerCase(),0,!0);return b?y?y[0]-b[0]:-1:1}),u)})}getInstalledExtensions(){const d=this.extensionInstanceService.getExtensionInstances().map(u=>{const _=u.extensionId;return{namespace:_&&_.includes(".")?_.split(".")[0]:u.packageJSON.publisher,name:u.packageJSON.name,id:u.extensionId,version:u.packageJSON.version,displayName:u.packageJSON.displayName,description:u.packageJSON.description,publisher:u.packageJSON.publisher,iconUrl:u.packageJSON.icon&&u.extensionLocation.toString()+`/${u.packageJSON.icon}`,path:u.path,realpath:u.realPath}});(0,p.transaction)(u=>{this.installedExtensionsObservable.set(d,u)})}};t.VSXExtensionService=c,n.__decorate([(0,r.Autowired)(g.VSXExtensionServicePath),n.__metadata("design:type",Object)],c.prototype,"backService",void 0),n.__decorate([(0,r.Autowired)(l.WorkbenchEditorService),n.__metadata("design:type",l.WorkbenchEditorService)],c.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(E.AbstractExtInstanceManagementService),n.__metadata("design:type",E.AbstractExtInstanceManagementService)],c.prototype,"extensionInstanceService",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",m.ExtensionManagementService)],c.prototype,"extensionManagementService",void 0),n.__decorate([(0,r.Autowired)(v.IThemeService),n.__metadata("design:type",Object)],c.prototype,"themeService",void 0),n.__decorate([(0,r.Autowired)(v.IIconService),n.__metadata("design:type",Object)],c.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(v.IProductIconService),n.__metadata("design:type",Object)],c.prototype,"productIconService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],c.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.IStatusBarService),n.__metadata("design:type",Object)],c.prototype,"statusBarService",void 0),n.__decorate([(0,o.pMemoize)(h=>h),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[String]),n.__metadata("design:returntype",Promise)],c.prototype,"search",null),t.VSXExtensionService=c=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],c)},73689:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VSXExtensionView=void 0;const n=e(85608),r=n.__importDefault(e(12784)),o=n.__importStar(e(14041)),l=e(14041),m=e(97267),E=e(41869),p=e(68974),v=e(43718),s=e(5567),g=e(29150),c=e(21082),h=e(87791),d=n.__importDefault(e(68143)),u=[g.TabActiveKey.MARKETPLACE,g.TabActiveKey.INSTALLED],_=()=>{const[f,a]=(0,l.useState)(g.TabActiveKey.MARKETPLACE),[b,y]=(0,l.useState)(!1),S=(0,E.useInjectable)(g.VSXExtensionServiceToken),A=(0,E.useAutorun)(S.extensionsObservable),w=(0,E.useAutorun)(S.installedExtensionsObservable),T=(0,E.useAutorun)(S.openVSXRegistryObservable),D=(0,r.default)(R=>{y(!0);let M;f===g.TabActiveKey.MARKETPLACE?M=S.search(R):M=S.searchInstalledExtensions(R),typeof M=="object"&&M.then&&M.then(()=>{y(!1)})},500),I=(0,l.useCallback)(R=>S.install(R),[]),O=(0,l.useCallback)((R,M)=>{const k=S.getExtensionId(R);S.openExtensionEditor(k,M)},[]),L=(0,l.useCallback)(R=>{const M=u[R];M&&a(M)},[]);return o.createElement("div",{className:d.default.panel},o.createElement(m.Tabs,{mini:!0,className:d.default.tabs,value:u.indexOf(f),onChange:L,tabs:[(0,v.localize)("marketplace.panel.tab.marketplace"),(0,v.localize)("marketplace.tab.installed")]}),o.createElement("div",{style:{padding:"8px"}},o.createElement(s.AutoFocusedInput,{containerId:c.OPEN_VSX_EXTENSION_MANAGER_CONTAINER_ID,placeholder:(0,v.localize)("marketplace.panel.tab.placeholder.search"),value:"",onChange:R=>D(R.target.value)})),f===g.TabActiveKey.MARKETPLACE&&o.createElement("div",{className:d.default.extensions_view},o.createElement(p.Progress,{loading:b}),A.map((R,M)=>o.createElement(h.Extension,{key:`${M}:${R.namespace}-${R.name}`,onClick:O,onInstall:I,extension:R,type:h.ExtensionViewType.MARKETPLACE,installedExtensions:w,openVSXRegistry:T}))),f===g.TabActiveKey.INSTALLED&&o.createElement("div",{className:d.default.extensions_view},w.map((R,M)=>o.createElement(h.Extension,{key:`${M}:${R.namespace}-${R.name}`,onClick:O,onInstall:I,extension:R,type:h.ExtensionViewType.INSTALLED,openVSXRegistry:T}))))};t.VSXExtensionView=_},29150:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IOpenvsxMarketplaceService=t.VSXExtensionServicePath=t.VSXExtensionServiceToken=t.VSXExtension=t.InstallState=t.TabActiveKey=t.EnableScope=void 0;var e;(function(l){l.GLOBAL="GLOBAL",l.WORKSPACE="WORKSPACE"})(e||(t.EnableScope=e={}));var n;(function(l){l.MARKETPLACE="marketplace",l.INSTALLED="installed"})(n||(t.TabActiveKey=n={}));var r;(function(l){l.INSTALLED="INSTALLED",l.NOT_INSTALLED="NOT_INSTALLED",l.SHOULD_UPDATE="SHOULD_UPDATE"})(r||(t.InstallState=r={}));class o{}t.VSXExtension=o,o.KEYS=new Set(["version","iconUrl","publisher","name","displayName","description","averageRating","downloadCount","downloadUrl","readmeUrl","licenseUrl","repository","license","readme","preview","namespaceAccess","publishedBy"]),t.VSXExtensionServiceToken=Symbol("VSXExtensionSerivceToken"),t.VSXExtensionServicePath="VSXExtensionServicePath",t.IOpenvsxMarketplaceService=Symbol("IOpenvsxMarketplaceService")},53599:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStorageContribution=t.ExtensionStorageModule=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(93584),m=e(7446),E=e(16132),p=e(10207),v=e(19227);let s=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[{token:l.IExtensionStorageService,useClass:p.ExtensionStorageService},{token:l.IExtensionStoragePathServer,useClass:E.ExtensionStoragePathServer},{token:l.IExtensionStorageServer,useClass:m.ExtensionStorageServer},g]}};t.ExtensionStorageModule=s,t.ExtensionStorageModule=s=n.__decorate([(0,o.Domain)(v.name)],s);let g=class{onReconnect(){this.extensionStorageService.reConnectInit()}};t.ExtensionStorageContribution=g,n.__decorate([(0,r.Autowired)(l.IExtensionStorageService),n.__metadata("design:type",Object)],g.prototype,"extensionStorageService",void 0),t.ExtensionStorageContribution=g=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],g),n.__exportStar(e(10207),t)},16132:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStoragePathServer=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(96405),E=e(14951),p=e(73344),v=e(51500),{Path:s}=l.path;let g=class{constructor(){this.windowsDataFolders=[l.StoragePaths.WINDOWS_APP_DATA_DIR,l.StoragePaths.WINDOWS_ROAMING_DIR],this.deferredWorkspaceStoragePath=new l.Deferred,this.deferredStoragePath=new l.Deferred,this.storagePathInitialized=!1}get workspaceSuffixName(){return this.appConfig.workspaceSuffixName||v.DEFAULT_WORKSPACE_SUFFIX_NAME}async provideHostLogPath(){const h=await this.getLogsDirPath();if(!h)throw new Error("Unable to get parent log directory");const d=h,u=l.URI.file(d).toString();return await this.fileSystem.access(u)||await this.fileSystem.createFolder(u),new l.URI(h)}async provideHostStoragePath(h,d,u){const _=await this.getWorkspaceStorageDirPath(u);if(!_)throw new Error("Unable to get parent storage directory");await this.fileSystem.access(l.URI.file(_).toString())||await this.fileSystem.createFolder(l.URI.file(_).toString());const f=await this.buildWorkspaceId(h,d,u),a=new s(_).join(f).toString();await this.fileSystem.access(l.URI.file(a).toString())||await this.fileSystem.createFolder(l.URI.file(a).toString());const b=new l.URI(a);return this.storagePathInitialized||(this.deferredWorkspaceStoragePath.resolve(b.path.toString()),this.deferredStoragePath.resolve(_),this.storagePathInitialized=!0),this.cachedStoragePath=b}async getLastWorkspaceStoragePath(){var h;return this.storagePathInitialized?(h=this.cachedStoragePath)===null||h===void 0?void 0:h.path.toString():this.deferredWorkspaceStoragePath.promise}async getLastStoragePath(){return this.deferredStoragePath.promise}doHash(h){return this.hashCalculateService.calculate(h)}async buildWorkspaceId(h,d,u){const _=await this.getUserHomeDir(),f=y=>y.resolve(u||v.WORKSPACE_USER_STORAGE_FOLDER_NAME).resolve(`${v.UNTITLED_WORKSPACE}.${this.workspaceSuffixName}`).withScheme(l.Schemes.file),a=y=>y.resolve(u||v.WORKSPACE_USER_STORAGE_FOLDER_NAME).resolve(`${v.UNTITLED_WORKSPACE}`).withScheme(l.Schemes.file);if(!h){const y=a(new l.URI(_));return this.doHash(y.toString())}if(f(new l.URI(_)).toString()===h.uri){const y=d.map(S=>S.uri).sort().join(",");return this.doHash(y)}else{const y=new l.URI(h.uri);return this.doHash(y.toString())}}async getLogsDirPath(){const h=await this.loggerManager.getLogFolder();return new s(h).join(l.StoragePaths.EXTENSIONS_LOGS_DIR).toString()}async getWorkspaceStorageDirPath(h){const d=await this.getWorkspaceDataDirPath(h);return new s(d).join(l.StoragePaths.EXTENSIONS_WORKSPACE_STORAGE_DIR).toString()}async getWorkspaceDataDirPath(h){const d=await this.getUserHomeDir(),u=h;return new s(d).join(...l.isWindows?this.windowsDataFolders:[""],u).toString()}async getUserHomeDir(){const h=await this.fileSystem.getCurrentUserHome();if(!h)throw new Error("Unable to get user home directory");return await this.fileSystem.getFsPath(h.uri)}};t.ExtensionStoragePathServer=g,n.__decorate([(0,r.Autowired)(E.IFileServiceClient),n.__metadata("design:type",Object)],g.prototype,"fileSystem",void 0),n.__decorate([(0,r.Autowired)(p.ILoggerManagerClient),n.__metadata("design:type",Object)],g.prototype,"loggerManager",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],g.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(m.IHashCalculateService),n.__metadata("design:type",Object)],g.prototype,"hashCalculateService",void 0),t.ExtensionStoragePathServer=g=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],g)},7446:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStorageServer=void 0;const r=e(85608),o=e(76003),l=e(43718),m=e(14951),E=e(93584),{Path:p}=l.path;let v=n=class{constructor(){this.deferredWorkspaceDataDirPath=new l.Deferred,this.storageThrottler=new l.Throttler,this.storageTasks={},this.storageExistPromises=new Map}async init(g,c,h){return this.storageDelayer=new l.ThrottledDelayer(n.DEFAULT_FLUSH_DELAY),await this.setupDirectories(g,c,h||E.DEFAULT_EXTENSION_STORAGE_DIR_NAME)}async asAccess(g,c){if(c)return await this.fileSystem.access(g);if(!this.storageExistPromises.has(g)){const h=this.fileSystem.access(g);this.storageExistPromises.set(g,h)}return await this.storageExistPromises.get(g)}async setupDirectories(g,c,h){const d=await this.extensionStoragePathsServer.getWorkspaceDataDirPath(h),u=l.URI.file(d).toString();await this.fileSystem.access(u)||await this.fileSystem.createFolder(u),this.workspaceDataDirPath=d,this.globalDataPath=new p(this.workspaceDataDirPath).join(l.StoragePaths.EXTENSIONS_GLOBAL_STORAGE_DIR).toString();const _=l.URI.file(this.globalDataPath).toString();await this.fileSystem.access(_)||await this.fileSystem.createFolder(_),this.deferredWorkspaceDataDirPath.resolve(this.workspaceDataDirPath);const f=await this.extensionStoragePathsServer.provideHostLogPath(),a=await this.extensionStoragePathsServer.provideHostStoragePath(g,c,h);return{logUri:f.codeUri,storageUri:a.codeUri,globalStorageUri:l.Uri.file(this.globalDataPath)}}async resolveStorageTask(g){const c=Object.keys(g);for(const h of c){const d=await this.readFromFile(h);for(const{key:u,value:_}of g[h])_===void 0||(0,l.isEmptyObject)(_)?delete d[u]:d[u]=_;await this.writeToFile(h,d)}}doSet(){const g={...this.storageTasks};return this.storageTasks={},this.resolveStorageTask(g)}async set(g,c,h){const d=await this.getDataPath(h);if(!d)throw new Error("Cannot save data: no opened workspace");return this.storageTasks[d]||(this.storageTasks[d]=[]),this.storageTasks[d].push({key:g,value:c}),this.storageDelayer.trigger(()=>this.storageThrottler.queue(this.doSet.bind(this)))}async get(g,c){const h=await this.getDataPath(c);return h?(await this.readFromFile(h))[g]:{}}async getAll(g){const c=await this.getDataPath(g);return c?await this.readFromFile(c):{}}async getDataPath(g){if(this.workspaceDataDirPath===void 0&&await this.deferredWorkspaceDataDirPath.promise,g)return new p(this.globalDataPath).join("global-state.json").toString();{const c=await this.extensionStoragePathsServer.getLastWorkspaceStoragePath();return c?new p(c).join("workspace-state.json").toString():void 0}}async readFromFile(g){const c=l.URI.file(g);if(!await this.asAccess(c.toString(),!0))return{};try{const{content:d}=await this.fileSystem.readFile(c.toString());return JSON.parse(d.toString())}catch(d){return this.logger.error('Failed to parse data from "',c.toString(),'". Reason:',d),{}}}async writeToFile(g,c){const h=l.URI.file(g);await this.asAccess(h.parent.toString())||await this.fileSystem.createFolder(h.parent.toString());const u=JSON.stringify(c);let _=await this.fileSystem.getFileStat(h.toString());_||(_=await this.fileSystem.createFile(h.toString())),await this.fileSystem.setContent(_,u)}};t.ExtensionStorageServer=v,v.DEFAULT_FLUSH_DELAY=100,r.__decorate([(0,o.Autowired)(E.IExtensionStoragePathServer),r.__metadata("design:type",Object)],v.prototype,"extensionStoragePathsServer",void 0),r.__decorate([(0,o.Autowired)(m.IFileServiceClient),r.__metadata("design:type",Object)],v.prototype,"fileSystem",void 0),r.__decorate([(0,o.Autowired)(l.ILogger),r.__metadata("design:type",Object)],v.prototype,"logger",void 0),t.ExtensionStorageServer=v=n=r.__decorate([(0,o.Injectable)()],v)},10207:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionStorageService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(51500),E=e(93584);let p=class{constructor(){this._init=this.init(),this.updateEnvState()}get whenReady(){return this._init}get extensionStoragePath(){return this._extensionStoragePath}async init(){const s=await this.workspaceService.roots,g=this.workspaceService.workspace,c=this.appConfig.extensionStorageDirName||E.DEFAULT_EXTENSION_STORAGE_DIR_NAME;return this._extensionStoragePath=await this.extensionStorageServer.init(g,s,c),this._extensionStoragePath}async updateEnvState(){await this.get(l.firstSessionDateStorageKey,!0)===void 0&&await this.set(l.firstSessionDateStorageKey,{date:new Date().toUTCString()},!0)}set(s,g,c){return this.extensionStorageServer.set(s,g,c)}get(s,g){return this.extensionStorageServer.get(s,g)}getAll(s=!1){return this.extensionStorageServer.getAll(s)}async reConnectInit(){const s=await this.workspaceService.roots,g=this.workspaceService.workspace,c=this.appConfig.extensionStorageDirName||E.DEFAULT_EXTENSION_STORAGE_DIR_NAME;return this._extensionStoragePath=await this.extensionStorageServer.init(g,s,c),this._extensionStoragePath}};t.ExtensionStorageService=p,n.__decorate([(0,r.Autowired)(E.IExtensionStorageServer),n.__metadata("design:type",Object)],p.prototype,"extensionStorageServer",void 0),n.__decorate([(0,r.Autowired)(m.IWorkspaceService),n.__metadata("design:type",Object)],p.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],p.prototype,"appConfig",void 0),t.ExtensionStorageService=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},93584:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(85853),t),n.__exportStar(e(56969),t),n.__exportStar(e(23618),t)},85853:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_EXTENSION_STORAGE_DIR_NAME=t.IExtensionStoragePathServer=void 0,t.IExtensionStoragePathServer=Symbol("IExtensionStoragePathServer"),t.DEFAULT_EXTENSION_STORAGE_DIR_NAME=".sumi"},56969:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IExtensionStorageService=t.IExtensionStorageServer=void 0,t.IExtensionStorageServer=Symbol("ExtensionStorageServer"),t.IExtensionStorageService=Symbol("ExtensionStorageService")},23618:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},50492:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(93584),t)},57962:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivationEventServiceImpl=void 0;const n=e(85608),r=n.__importDefault(e(80076)),o=e(76003),l=e(43718);let m=class{constructor(){this.eventListeners=new Map,this.collectTopicData=new l.MultiMap,this.wildCardTopics=new Set,this.activatedEventSet=new Set,this.wildCardTopics.add("workspaceContains")}getTopicsData(p){return this.collectTopicData.get(p)||[]}async fireEvent(p,v=""){this.activatedEventSet.add(JSON.stringify({topic:p,data:v}));let s;if(this.wildCardTopics.has(p)?s=this.eventListeners.get(p):this.eventListeners.has(p)?s=this.eventListeners.get(p):s=this.eventListeners.get(p+":"+v),s){const g=await Promise.allSettled(s.map(c=>this.tryRun(p,v,c)));for(const c of g)c.status==="rejected"&&this.logger.error(`fire event ${p}:${v} error: ${c.reason}`)}}addWildCardTopic(p){return this.wildCardTopics.add(p),{dispose:()=>{this.wildCardTopics.delete(p)}}}onEvent(p,v){const s=p.indexOf(":");let g,c;return s===-1?(g=p,c=""):(g=p.substr(0,s),c=p.substr(s+1)),this.addListener(g,{topic:g,data:c,execute:v})}addListener(p,v){if(this.collectTopicData.set(v.topic,v.data),this.wildCardTopics.has(p))return this.eventListeners.has(p)||this.eventListeners.set(p,[]),this.eventListeners.get(p).push(v),{dispose:()=>{const s=this.eventListeners.get(p).indexOf(v);s!==-1&&this.eventListeners.get(p).splice(s,1)}};{const s=p+":"+v.data;return this.eventListeners.has(s)||this.eventListeners.set(s,[]),this.eventListeners.get(s).push(v),{dispose:()=>{const g=this.eventListeners.get(s).indexOf(v);g!==-1&&this.eventListeners.get(s).splice(g,1)}}}}async tryRun(p,v,s){this.wildCardTopics.has(p)?(0,r.default)(s.data)(v)&&await s.execute():await s.execute()}};t.ActivationEventServiceImpl=m,n.__decorate([(0,o.Autowired)(l.ILogger),n.__metadata("design:type",Object)],m.prototype,"logger",void 0),t.ActivationEventServiceImpl=m=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],m)},63056:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionNoExportsView=t.ExtensionLoadingView=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),l=e(68974),m=n.__importDefault(e(17267)),E=({style:v})=>r.default.createElement("div",{style:v||{},className:m.default.kt_extension_view},r.default.createElement(l.Progress,{loading:!0}));t.ExtensionLoadingView=E;const p=(v,s)=>r.default.createElement("div",{className:m.default.kt_extension_no_exports_view},(0,o.formatLocalize)("extension.no.view.found",v,s));t.ExtensionNoExportsView=p},56405:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PortalRoot=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),l=e(41869),m=e(87420),E=e(25600),p=v=>{var s;const[g,c]=o.default.useState(null),h=(0,l.useInjectable)(E.AbstractViewExtProcessService),d=(0,l.useInjectable)(m.IThemeService);o.default.useEffect(()=>{const _=new l.DisposableCollection;return d.getCurrentTheme().then(f=>c(f.type)),_.push(d.onThemeChange(f=>{f.type&&f.type!==g&&c(f.type)})),_.dispose.bind(_)},[]);const u=v.original;return o.default.createElement(u,{...v.otherProps,className:(0,r.default)((s=v.otherProps)===null||s===void 0?void 0:s.className,(0,m.getThemeTypeSelector)(g)),getContainer:()=>h.getPortalShadowRoot(v.extensionId)})};t.PortalRoot=p},82443:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TREE_VIEW_NODE_HEIGHT=t.TreeViewNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(97267),m=e(41869),E=e(25918),p=e(93899),v=e(95422),s=e(69589),g=e(42912),c=n.__importDefault(e(50790)),h=({item:d,onClick:u,onChange:_,onContextMenu:f,itemType:a,leftPadding:b=8,onTwistierClick:y,decorations:S,defaultLeftPadding:A=8,treeViewId:w,decorationService:T,draggable:D,onDragStart:I,onDragEnter:O,onDragLeave:L,onDragOver:R,onDrop:M})=>{const k=(0,v.useInjectable)(g.IIconService),B=(0,m.useDesignStyles)(c.default.expansion_toggle,"expansion_toggle"),x=(0,m.useDesignStyles)(c.default.tree_view_node,"tree_view_node"),[N,j]=(0,o.useState)(d.uri&&T.getDecoration(d.uri,!1));(0,o.useEffect)(()=>{const Ce=T.onDidChangeDecorations(Ee=>{d.uri&&Ee.affectsResource(d.uri)&&j(T.getDecoration(d.uri,!1))});return()=>{Ce.dispose()}},[]);const K=(0,v.useInjectable)(g.IThemeService),U=(0,o.useCallback)(Ce=>{(a===l.TreeNodeType.TreeNode||a===l.TreeNodeType.CompositeTreeNode)&&u(Ce,d,a)},[d,a,u]),X=(0,o.useCallback)(Ce=>{(a===l.TreeNodeType.TreeNode||a===l.TreeNodeType.CompositeTreeNode)&&(y?y(Ce,d,a):u(Ce,d,a))},[d,a,y,u]),z=(0,o.useCallback)(Ce=>{Ce.nativeEvent.which===0||!f||(a===l.TreeNodeType.TreeNode||a===l.TreeNodeType.CompositeTreeNode)&&f(Ce,d,a)},[d,a,f]),Q=(0,o.useCallback)(Ce=>{I&&I(Ce,d)},[d,I]),G=(0,o.useCallback)(Ce=>{O&&O(Ce,d)},[d,O]),J=(0,o.useCallback)(Ce=>{L&&L(Ce,d)},[d,L]),Y=(0,o.useCallback)(Ce=>{R&&R(Ce,d)},[d,R]),H=(0,o.useCallback)(Ce=>{M&&M(Ce,d)},[d,M]),$=(0,o.useCallback)(Ce=>{_(d),Ce.stopPropagation()},[d,_]),Z=a===l.TreeNodeType.CompositeTreeNode,re=Z?`${A+(d.depth||0)*(b||0)}px`:`${A+(d.depth||0)*(b||0)+8}px`,ce={height:t.TREE_VIEW_NODE_HEIGHT,lineHeight:`${t.TREE_VIEW_NODE_HEIGHT}px`,paddingLeft:re},ge=(Ce,Ee)=>S&&S?.classlist.indexOf(c.default.mod_loading)>-1?o.default.createElement(l.Loading,null):o.default.createElement("div",{onClick:Ee,className:(0,r.default)(c.default.tree_view_node_segment,B,(0,m.getIcon)("arrow-right"),{[`${c.default.mod_collapsed}`]:!Ce.expanded})}),Ae=Ce=>o.default.createElement("div",{className:(0,r.default)(c.default.file_icon,Ce.icon),style:{maxHeight:t.TREE_VIEW_NODE_HEIGHT}}),te=Ce=>{var Ee;return Ce.checkboxInfo===void 0?null:o.default.createElement(l.CheckBox,{"data-node-id":Ce.treeItemId,readOnly:!0,onChange:xe=>$(xe),checked:!!Ce.checkboxInfo.checked,id:Ce.treeItemId,role:(Ee=Ce.checkboxInfo.accessibilityInformation)===null||Ee===void 0?void 0:Ee.role,title:Ce.checkboxInfo.tooltip})},Pe=Ce=>{const Ee=()=>{if(Ce.highlights){let xe=[],Ye=0;const Ue=Ce.highlights.sort((Qe,we)=>Qe[0]-we[0]);return xe=Ue.map((Qe,we)=>{const[le,Se]=Qe,Oe=Ce.displayName.slice(Ye,le);Ye=Se;const Fe=Ce.displayName.slice(le,Se),We=[o.default.createElement("span",{key:`line_begin_${we}_${Oe}`},Oe),o.default.createElement("span",{className:c.default.highlight,key:`line_hightlight_${we}_${Fe}`},Fe)];if(we===Ue.length-1){const Ve=Ce.displayName.slice(Se);We.push(o.default.createElement("span",{key:`line_end_${we}_${Ve}`},Ve))}return We}),xe}else return Ce.displayName};return o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_segment,c.default.tree_view_node_displayname,Ce.strikethrough&&c.default.strikethrough)},Ee())},Te=()=>o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_segment,c.default.tree_view_node_tail)},ie()),ie=()=>{if(d.actions.length>0)return o.default.createElement("div",{className:c.default.tree_view_actions},o.default.createElement(E.TitleActionList,{className:c.default.inlineMenu,context:[{treeViewId:w,treeItemId:d.treeItemId}],nav:d.actions,menuId:p.MenuId.ViewItemContext}))},se=Ce=>{if(Z)return ge(Ce,X)},me=()=>d.tooltip||d.name,ye=Ce=>o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_segment_grow,c.default.tree_view_node_description)},!Ce.name&&!Ce.description?"\u2014\u2014":Ce.description),_e=()=>{if(!N)return null;const Ce=N.badge||"",Ee=N.color,xe=Ee&&K.getColor({id:Ee});return o.default.createElement("div",{className:c.default.tree_view_node_tail,style:{color:xe}},(0,s.transformLabelWithCodicon)(Ce.slice(),{},k.fromString.bind(k)))};return o.default.createElement("div",{key:d.id,onClick:U,onContextMenu:z,onDragStart:Q,onDragOver:Y,onDragEnter:G,onDragLeave:J,onDrop:H,title:me(),className:(0,r.default)(x,S?S.classlist:null),"data-id":d.id,style:ce,draggable:D},o.default.createElement("div",{className:(0,r.default)(c.default.tree_view_node_content)},se(d),te(d),Ae(d),o.default.createElement("div",{className:c.default.tree_view_node_overflow_wrap},Pe(d),ye(d)),Te(),_e()))};t.TreeViewNode=h,t.TREE_VIEW_NODE_HEIGHT=22},81302:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionTabBarTreeView=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),l=e(41869),m=e(68974),E=e(41893),p=e(24429),v=e(72260),s=e(82443),g=n.__importDefault(e(17267)),c=({viewState:u,model:_,dataProvider:f,treeViewId:a})=>{const b=(0,l.useInjectable)(v.IMainLayoutService),y=(0,l.useInjectable)(E.IDecorationsService),S=(0,r.useMemo)(()=>b.getViewAccordionService(a),[]),A=(0,r.useMemo)(()=>{const Q=S?.getViewState(a);return Q?!Q.collapsed&&!Q.hidden:!1},[S]),{height:w}=u,{canSelectMany:T}=_.treeViewOptions||{},D=(0,r.useRef)(null),I=(0,r.useCallback)(Q=>{_.handleTreeHandler({...Q,getModel:()=>_.treeModel,hasDirectFocus:()=>D.current===document.activeElement})},[_]),O=(0,r.useCallback)((Q,G)=>{Q.stopPropagation();const{toggleDirectory:J}=_;J(G)},[_]),L=(0,r.useCallback)(Q=>R(Q)?!1:Q.shiftKey,[]),R=(0,r.useCallback)(Q=>{const{metaKey:G,ctrlKey:J}=Q;return l.isOSX&&G||J},[]),M=(0,r.useCallback)((Q,G,J)=>{Q.stopPropagation();const{handleItemClick:Y,handleItemToggleClick:H,handleItemRangeClick:$}=_;if(!G)return;const Z=L(event),re=R(event);T?Z?$(G,J):re?H(G,J):Y(G,J):Y(G,J)},[T,_]),k=(0,r.useCallback)(Q=>{const{handleCheckBoxChange:G}=_;Q&&G(Q)},[_]),B=(0,r.useCallback)((Q,G)=>{const{handleContextMenu:J}=_;J(Q,G)},[_]),x=Q=>{const{handleContextMenu:G}=_;G(Q)},N=(0,r.useCallback)(()=>{const{enactiveNodeDecoration:Q}=_;Q()},[_]),j=(0,r.useCallback)((Q,G)=>{const{handleDragStart:J}=_;J(Q,G)},[_]),K=(0,r.useCallback)((Q,G)=>{const{handleDragOver:J}=_;J(Q,G)},[_]),U=(0,r.useCallback)((Q,G)=>{const{handleDragEnter:J}=_;J(Q,G)},[_]),X=(0,r.useCallback)((Q,G)=>{const{handleDrop:J}=_;J(Q,G)},[_]),z=(0,r.useCallback)((Q,G)=>{const{handleDragLeave:J}=_;J(Q,G)},[_]);return(0,r.useEffect)(()=>{var Q;const G=()=>{_.handleTreeBlur()};return(Q=D.current)===null||Q===void 0||Q.addEventListener("blur",G,!0),()=>{var J;(J=D.current)===null||J===void 0||J.removeEventListener("blur",G,!0)}},[D.current]),r.default.createElement("div",{className:g.default.kt_extension_view,tabIndex:-1,ref:D,onContextMenu:x,onClick:N,"data-tree-view-id":a},r.default.createElement(d,{height:w,isVisible:A,handleTreeReady:I,handleItemClicked:M,handleCheckBoxChange:k,handleTwistierClick:O,handleContextMenu:B,handleDragStart:j,handleDragOver:K,handleDragEnter:U,handleDragLeave:z,handleDrop:X,draggable:_.draggable,treeViewId:a,model:_,dataProvider:f,decorationService:y}))};t.ExtensionTabBarTreeView=c;function h(u,_){return u.isVisible===_.isVisible&&u.model===_.model&&u.treeViewId===_.treeViewId&&u.height===_.height}const d=(0,r.memo)(({model:u,treeViewId:_,height:f,isVisible:a,dataProvider:b,handleTreeReady:y,handleItemClicked:S,handleCheckBoxChange:A,handleTwistierClick:w,handleContextMenu:T,handleDragStart:D,handleDragOver:I,handleDragEnter:O,handleDragLeave:L,handleDrop:R,draggable:M,decorationService:k})=>{const[B,x]=(0,r.useState)(!1),[N,j]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let U=!1;return(async()=>(await u.whenReady,u.treeModel&&a&&await u.treeModel.ensureReady,U||x(!0)))(),()=>{U=!0,u&&u.removeNodeDecoration()}},[u,a]),(0,r.useEffect)(()=>{const U=b.onDidChangeEmpty(()=>{b.isTreeEmpty!==N&&j(b.isTreeEmpty)});return()=>U.dispose()},[]);const K=(0,r.useCallback)(U=>r.default.createElement(s.TreeViewNode,{item:U.item,itemType:U.itemType,decorations:u.decorations.getDecorations(U.item),onClick:S,onChange:A,onTwistierClick:w,onContextMenu:T,onDragStart:D,onDragOver:I,onDragEnter:O,onDragLeave:L,onDrop:R,defaultLeftPadding:8,leftPadding:8,treeViewId:_,draggable:M,decorationService:k}),[u.treeModel]);if(B){if(N)return r.default.createElement(p.WelcomeView,{viewId:_});if(u.treeModel)return r.default.createElement(o.RecycleTree,{height:f,itemHeight:s.TREE_VIEW_NODE_HEIGHT,onReady:y,model:u.treeModel},K)}else return r.default.createElement(m.Progress,{loading:!0});return null},h);d.displayName="ExtensionsTreeView"},88341:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionWebviewView=t.WebviewViewShouldShowEvent=void 0;const r=e(85608).__importDefault(e(14041)),o=e(41869),l=e(99220);class m extends o.BasicEvent{}t.WebviewViewShouldShowEvent=m;const E=({viewId:p})=>{const v=r.default.useRef(null),s=(0,o.useInjectable)(o.IEventBus),g=(0,o.useInjectable)(l.ExtensionService);return r.default.useEffect(()=>{const c=new o.CancellationTokenSource,h=new o.Disposable({dispose:()=>c.cancel()});return g.eagerExtensionsActivated.promise.then(()=>{c.token.isCancellationRequested||v.current&&s.fire(new m({viewType:p,container:v.current,title:"",cancellationToken:c.token,disposer:h}))}),()=>{h.dispose()}},[]),r.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative"},className:"webview-view-component",ref:v})};t.ExtensionWebviewView=E},17428:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(81302),t),n.__exportStar(e(63056),t)},21167:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WalkthroughsEditorView=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(97267),m=e(41869),E=e(93374),p=e(52416),v=e(99220),s=e(17441),g=n.__importDefault(e(42076)),c=({resource:{uri:_}})=>{const f=(0,m.useInjectable)(s.WalkthroughsService),a=(0,m.useInjectable)(m.IContextKeyService),{query:b,authority:y}=_,[S,A]=(0,o.useState)(),[w,T]=(0,o.useState)();(0,o.useEffect)(()=>{S&&S.steps.length>0&&(w||T(S.steps[0].id))},[S,w]),(0,o.useEffect)(()=>{b&&A(f.getWalkthrough(b))},[b,S]);const D=(0,o.useCallback)(()=>{var I;return S&&((I=S.steps.find(O=>O.id===w))===null||I===void 0?void 0:I.media)},[w,S]);return o.default.createElement("div",{className:g.default.getting_started_container},o.default.createElement("div",{className:g.default.getting_started_detailsContent},o.default.createElement("div",{className:g.default.category_container},o.default.createElement("div",{className:g.default.category_icon},S&&S.icon.type==="image"&&o.default.createElement("img",{src:S.icon.path})),o.default.createElement("div",{className:g.default.category_description_container},o.default.createElement("h2",{className:g.default.category_title},S?.title),o.default.createElement("div",{className:g.default.category_description},S?.description))),o.default.createElement("div",{className:g.default.steps_container},o.default.createElement("div",{className:g.default.getting_started_detail_container},o.default.createElement("div",{className:g.default.step_list_container},S?S.steps.filter(I=>a.match(I.when)).map(I=>o.default.createElement(h,{key:I.id,step:I,isExpanded:I.id===w,onSelected:T})):null))),o.default.createElement("div",{className:g.default.getting_started_media},w&&o.default.createElement(d,{media:D(),extensionId:y,stepId:w}))))};t.WalkthroughsEditorView=c;const h=({step:_,isExpanded:f,onSelected:a})=>{const b=(0,m.useInjectable)(m.IOpenerService),y=(0,m.useInjectable)(s.WalkthroughsService),S=(0,m.useInjectable)(p.IIconService),[A,w]=(0,o.useState)(!1),{description:T}=_;(0,o.useEffect)(()=>{const R=y.onDidProgressStep(M=>{const{id:k,done:B}=M;k===_.id&&B&&w(B)});return()=>R.dispose()},[]);const D=(0,o.useCallback)(()=>{w(!A),y.progressByEvent(v.CompletionEventsType.stepSelected+":"+_.id)},[A,_.id]),I=(0,o.useCallback)(R=>{const{href:M}=R;b.open(M),/^http(s)?:\/\//.test(M)&&y.progressByEvent(v.CompletionEventsType.onLink+":"+M)},[]),O=(0,o.useCallback)(()=>{if(T.length===0)return null;const R=[];return T.map((M,k)=>{if(M.nodes.length===1&&typeof M.nodes[0]!="string"){const B=M.nodes[0];R.push(o.default.createElement("div",{key:k.toString()+R.length,title:B.title},o.default.createElement(l.Button,{onClick:()=>I(B)},(0,m.transformLabelWithCodicon)(B.label,{},S.fromString.bind(S)))))}else{const B=M.nodes.map((x,N)=>typeof x=="string"?x:o.default.createElement("a",{key:x.label+"#"+N,title:x.title,onClick:()=>I(x)},x.label));R.push(o.default.createElement("p",{key:k.toString()+R.length.toString()+B.length.toString()},B))}}),o.default.createElement("div",{className:g.default.step_description_container},o.default.createElement(o.default.Fragment,null,R))},[T]),L=(0,o.useCallback)(()=>(0,m.transformLabelWithCodicon)(_.title,{},S.fromString.bind(S)),[_.title]);return o.default.createElement("div",{className:(0,r.default)(g.default.getting_started_step,f&&g.default.expanded),onClick:()=>a(_.id)},o.default.createElement("div",{className:g.default.checkbox},o.default.createElement(l.CheckBox,{id:_.id,onChange:D,checked:A})),o.default.createElement("div",{className:g.default.step_container},o.default.createElement("h3",{className:g.default.step_title},L()),f&&O()))},d=({media:_,extensionId:f,stepId:a})=>{const b=(0,m.useInjectable)(p.IThemeService),y=(0,m.useInjectable)(s.WalkthroughsService),[S,A]=(0,o.useState)(""),[w,T]=(0,o.useState)(""),D=(0,o.useCallback)(async I=>_?.type==="image"?"":I?(await y.getFileContent(f,I)).toString():"",[_]);if((0,o.useEffect)(()=>{const I=y.getStepsByExtension(a);I&&(_&&_.type==="svg"&&I.media.svg&&D(I.media.svg).then(A),_&&_.type==="markdown"&&I.media.markdown&&D(I.media.markdown).then(T))},[_,a]),!_)return null;if(_.type==="image"){const I=b.getCurrentThemeSync().type,O=_.path[I].toString(!0).replace(/ /g,"%20");return o.default.createElement(o.default.Fragment,null,o.default.createElement("img",{alt:_.altText,srcSet:O.toLowerCase().endsWith(".svg")?O:O+" 1.5x"}))}return _.type==="svg"?o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:g.default.media_svg_container,dangerouslySetInnerHTML:{__html:S}})):_.type==="markdown"?o.default.createElement(o.default.Fragment,null,o.default.createElement(u,{content:w,media:_})):null},u=({content:_,media:f})=>{const a=(0,m.useInjectable)(m.IOpenerService);if(f.type!=="markdown")return null;const b=(0,o.useCallback)(()=>f.base.resolve("/").toString(),[f,_]);return o.default.createElement(E.Markdown,{content:_,options:{baseUrl:b()},onLinkClick:y=>a.open(y)})}},87444:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtCommandManagementImpl=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class extends o.Disposable{constructor(){super(...arguments),this.commandEnvRegistry=new Map,this.proxyCommandExecutorRegistry=new Map}dispose(){this.commandEnvRegistry.clear(),this.proxyCommandExecutorRegistry.clear()}registerProxyCommandExecutor(E,p){this.proxyCommandExecutorRegistry.set(E,p)}async executeExtensionCommand(E,p,v){const s=this.proxyCommandExecutorRegistry.get(E);if(!s)throw new Error('Proxy command executor "'+E+'" is not existed');return s.$executeExtensionCommand(p,...v)}registerExtensionCommandEnv(E,p="node"){return this.commandEnvRegistry.set(E,p),{dispose:()=>{this.commandEnvRegistry.delete(E)}}}getExtensionCommandEnv(E){return this.commandEnvRegistry.get(E)}};t.ExtCommandManagementImpl=l,t.ExtCommandManagementImpl=l=n.__decorate([(0,r.Injectable)()],l)},49413:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtInstanceManagementService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(43718),m=e(99220),E=e(42734);let p=class extends o.Disposable{constructor(){super(),this.onDidChangeEmitter=new l.Emitter,this.extensionMap=new Map,this._whenReady=this.init()}async init(){this.workspaceStorage=await this.storageProvider(o.STORAGE_NAMESPACE.EXTENSIONS),this.globalStorage=await this.storageProvider(o.STORAGE_NAMESPACE.GLOBAL_EXTENSIONS)}get whenReady(){return this._whenReady}get onDidChange(){return this.onDidChangeEmitter.event}dispose(){this.disposeExtensionInstances()}getExtensionInstances(){return Array.from(this.extensionMap.values())}disposeExtensionInstances(){for(const s of this.extensionMap.values())s.dispose();this.extensionMap=new Map}disposeExtensionInstancesByPath(s){s.forEach(g=>{this.extensionMap.has(g)&&this.extensionMap.get(g).dispose()})}resetExtensionInstances(){for(const s of this.extensionMap.values())s.reset()}getExtensionInstanceByPath(s){return this.extensionMap.get(s)}getExtensionInstanceByExtId(s){for(const g of this.extensionMap.values())if(g.id===s)return g}deleteExtensionInstanceByPath(s){this.extensionMap.delete(s),this.onDidChangeEmitter.fire()}addExtensionInstance(s){this.extensionMap.set(s.path,s),this.onDidChangeEmitter.fire()}async checkExtensionEnable(s){await this.whenReady;const g=this.globalStorage.get(s.extensionId,m.EXTENSION_ENABLE.ENABLE);return this.workspaceStorage.get(s.extensionId,g)===m.EXTENSION_ENABLE.ENABLE}async createExtensionInstance(s,g,c){const h=typeof s=="string"?await this.extensionNodeClient.getExtension(s,(0,l.getLanguageId)(),{}):s;if(h)return this.injector.get(E.Extension,[h,await this.checkExtensionEnable(h),g||(this.appConfig.extensionDir?h.realPath.startsWith(this.appConfig.extensionDir):!1),!!c])}checkIsBuiltin(s){const g=this.getExtensionCandidateByPath(s.realPath);return(this.appConfig.extensionDir?s.realPath.startsWith(this.appConfig.extensionDir):!1)||(g?g.isBuiltin:!1)}checkIsDevelopment(s){const g=this.getExtensionCandidateByPath(s.realPath);return!!g?.isDevelopment}getExtensionCandidateByPath(s){return this.appConfig.extensionCandidate&&this.appConfig.extensionCandidate.find(g=>g.path===s)}};t.ExtInstanceManagementService=p,n.__decorate([(0,r.Autowired)(o.StorageProvider),n.__metadata("design:type",Function)],p.prototype,"storageProvider",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],p.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.ExtensionNodeServiceServerPath),n.__metadata("design:type",Object)],p.prototype,"extensionNodeClient",void 0),t.ExtInstanceManagementService=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},98453:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionManagementService=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(14951),m=e(99220),E=e(82389),p=e(71354),v=e(35321);let s=class extends o.WithEventBus{async getExtensionProps(c,h){const d=await this.extensionNodeClient.getExtension(c,(0,o.getLanguageId)(),h);if(d){const u=this.getExtensionByPath(c);if(u)return{...u.toJSON(),extraMetadata:d.extraMetadata}}}getExtensionByPath(c){return this.extInstanceManagementService.getExtensionInstances().find(h=>c===h.path)}getExtensionByExtId(c){return this.extInstanceManagementService.getExtensionInstances().find(h=>c===h.id)}async postChangedExtension(c,h,d){const{upgrade:u,extensionPath:_,oldExtensionPath:f,isBuiltin:a}=typeof c=="boolean"?{upgrade:c,extensionPath:h,oldExtensionPath:d,isBuiltin:!1}:c,b=this.extInstanceManagementService.getExtensionInstanceByPath(_);if(b){this.logger.warn(`Extension ${b.id} already exists, skip activate`);return}const y=await this.extInstanceManagementService.createExtensionInstance(_,!!a);if(y)return u&&this.disableExtension(f),await this.enableExtension(y)}async postEnableExtension(c){const h=await this.extInstanceManagementService.getExtensionInstanceByPath(c);if(h)return await this.enableExtension(h)}async postDisableExtension(c){return this.disableExtension(c)}async postUninstallExtension(c){return this.uninstallExtension(c)}getAllExtensionJson(){return this.extInstanceManagementService.getExtensionInstances().map(c=>c.toJSON())}disableExtension(c){const h=this.extInstanceManagementService.getExtensionInstanceByPath(c);h&&(h.disable(),this.extInstanceManagementService.deleteExtensionInstanceByPath(c))}async enableExtension(c){this.extInstanceManagementService.addExtensionInstance(c),c.enable(),await c.initialize(),this.eventBus.fire(new p.ExtensionDidEnabledEvent(c.toJSON())),this.sumiContributesService.register(c.id,c.packageJSON.sumiContributes||{}),this.contributesService.register(c.id,c.contributes),this.sumiContributesService.initialize(),this.contributesService.initialize()}async removeExtension(c){try{return await this.fileService.delete(o.URI.file(c).toString()),!0}catch(h){return this.logger.error(h),!1}}async uninstallExtension(c){const h=this.extInstanceManagementService.getExtensionInstanceByPath(c);h&&(h.dispose(),this.extInstanceManagementService.deleteExtensionInstanceByPath(c)),await this.removeExtension(c),this.eventBus.fire(new p.ExtensionDidUninstalledEvent)}};t.ExtensionManagementService=s,n.__decorate([(0,r.Autowired)(p.AbstractExtInstanceManagementService),n.__metadata("design:type",p.AbstractExtInstanceManagementService)],s.prototype,"extInstanceManagementService",void 0),n.__decorate([(0,r.Autowired)(m.ExtensionNodeServiceServerPath),n.__metadata("design:type",Object)],s.prototype,"extensionNodeClient",void 0),n.__decorate([(0,r.Autowired)(v.VSCodeContributesServiceToken),n.__metadata("design:type",v.VSCodeContributesService)],s.prototype,"contributesService",void 0),n.__decorate([(0,r.Autowired)(E.SumiContributionsServiceToken),n.__metadata("design:type",E.SumiContributionsService)],s.prototype,"sumiContributesService",void 0),n.__decorate([(0,r.Autowired)(l.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fileService",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],s.prototype,"logger",void 0),t.ExtensionManagementService=s=n.__decorate([(0,r.Injectable)()],s)},20670:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeExtProcessService=void 0;const n=e(85608),r=e(76003),o=e(8919),l=e(18740),m=e(41869),E=e(99220),p=e(72464),v=e(46147),s=e(37846),g=e(28949),c=e(51072),h=e(17802);let d=class{constructor(){this._apiFactoryDisposables=new m.DisposableStore,this.ready=new m.Deferred,this._extHostUpdated=new m.Deferred,this.extensions=[]}disposeApiFactory(){this._apiFactoryDisposables.clear()}async disposeProcess(){this.disposeApiFactory(),await this.extensionNodeClient.disposeClientExtProcess(this.clientId,!1)}async activate(){return await this.createExtProcess(),this.protocol&&(this.ready.resolve(),await this.createBrowserMainThreadAPI(),await(await this.getProxy()).$updateExtHostData(),this._extHostUpdated.resolve()),this.protocol}async activeExtension(_,f){!this.appConfig.noExtHost&&!f&&(await this._extHostUpdated.promise,await(await this.getProxy()).$activateExtension(_.id))}async updateExtensionData(_){if(this.extensions=_,this.protocol){const f=await this.getProxy();await f.$updateExtHostData(),f.$fireChangeEvent()}}getExtension(_){return this.extensions.find(f=>f.id===_)}async $activateExtension(_){const f=this.extensions.find(a=>a.path===_);f&&await f.activate()}async $getExtensions(){return this.extensions.map(_=>_.toJSON())}async getProxy(){return await this.ready.promise,this.protocol.getProxy(v.ExtHostAPIIdentifier.ExtHostExtensionService)}async createBrowserMainThreadAPI(){const _=(0,h.initSharedAPIProxy)(this.protocol,this.injector);this._apiFactoryDisposables.add(_),this._apiFactoryDisposables.add((0,m.toDisposable)((0,c.initNodeThreadAPIProxy)(this.protocol,this.injector,this))),this._apiFactoryDisposables.add((0,m.toDisposable)((0,g.createSumiAPIFactory)(this.protocol,this.injector))),this._apiFactoryDisposables.add(this.createExternalSumiAPIFactory()),await _.setup()}getSpawnOptions(){return{}}createExternalSumiAPIFactory(){const _=new m.Disposable,f=this.mainThreadExtenderContributionProvider.getContributions();for(const b of f)b.registerMainThreadExtender(this.mainThreadExtenderService);const a=this.mainThreadExtenderService.getMainThreadExtenders();for(const b of a){const y=this.injector.get(b.serviceClass,[this.protocol]);this.protocol.set(b.identifier,y),_.addDispose(y)}return _}async getActivatedExtensions(){return await(await this.getProxy()).$getActivatedExtensions()}get clientId(){return this.applicationService.clientId}async createExtProcess(){await this.extensionNodeClient.createProcess(this.clientId,{enableDebugExtensionHost:this.appConfig.enableDebugExtensionHost,inspectExtensionHost:this.appConfig.inspectExtensionHost,extensionConnectOption:this.appConfig.extensionConnectOption,extHostSpawnOptions:this.getSpawnOptions()}),await this.initExtProtocol()}async initExtProtocol(){var _,f;this.channel&&this.channel.dispose(),this.protocol&&((f=(_=this.protocol).dispose)===null||f===void 0||f.call(_)),this.channel=await this.channelHandler.openChannel(E.CONNECTION_HANDLE_BETWEEN_EXTENSION_AND_MAIN_THREAD),this.connection=this.channel.createConnection(),this.protocol=new o.SumiConnectionMultiplexer(this.connection,{timeout:this.appConfig.rpcMessageTimeout,name:"node-ext-host",io:(0,o.createExtMessageIO)(s.knownProtocols)})}};t.NodeExtProcessService=d,n.__decorate([(0,r.Autowired)(m.AppConfig),n.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],d.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(E.ExtensionNodeServiceServerPath),n.__metadata("design:type",Object)],d.prototype,"extensionNodeClient",void 0),n.__decorate([(0,r.Autowired)(m.IApplicationService),n.__metadata("design:type",Object)],d.prototype,"applicationService",void 0),n.__decorate([(0,r.Autowired)(l.WSChannelHandler),n.__metadata("design:type",l.WSChannelHandler)],d.prototype,"channelHandler",void 0),n.__decorate([(0,r.Autowired)(p.IMainThreadExtenderService),n.__metadata("design:type",Object)],d.prototype,"mainThreadExtenderService",void 0),n.__decorate([(0,r.Autowired)(p.MainThreadExtenderContribution),n.__metadata("design:type",Object)],d.prototype,"mainThreadExtenderContributionProvider",void 0),t.NodeExtProcessService=d=n.__decorate([(0,r.Injectable)()],d)},90731:(P,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ViewExtProcessService=void 0;const r=e(85608),o=e(76003),l=e(65973),m=e(8919),E=e(41869),p=e(40827),v=e(43718),s=e(61656),g=e(99220),c=e(25600),h=e(17428),d=e(54107),u=e(9438),_=e(8403),f=e(31738),{Path:a,posix:b}=E.path,y="load";let S=n=class extends v.Disposable{constructor(){super(...arguments),this.debugLogger=(0,v.getDebugLogger)(),this.extensions=[],this.activatedViewExtensionMap=new Map,this.portalShadowRootMap=new Map,this.shadowRootBodyMap=new Map}getExtension(w){return this.extensions.find(T=>T.id===w)}async initExtension(w){this.extensions=w}async getActivatedExtensions(){return[]}getProxy(){}async $activateExtension(w){}async $getExtensions(){return this.extensions.map(w=>w.toJSON())}async disposeProcess(){}activate(){const w=this.requireInterceptorContributionProvider.getContributions();for(const T of w)T.registerRequireInterceptor(this.requireInterceptorService);this.extendExtensionErrorStackTrace()}extendExtensionErrorStackTrace(){Error.stackTraceLimit=100,Error.prepareStackTrace=(w,T)=>{let D,I=`Error: ${w.message}`;for(const O of T)if(I+=`
28345
28346
  at ${O.toString()}`,!D&&O.isEval()){const L=O.getEvalOrigin(),R=this.getExtension.apply(this,[L]);if(R){D=R;const M=O.getColumnNumber(),k=O.getLineNumber();I=`
28346
28347
  at ${D.name} (${D.workerScriptPath}:${k}:${M})`+I}}if(D){const O=`${D&&D.name} - ${w.name||"Error"}: ${w.message||""}${I}`;return this.debugLogger.log("get error",O),this.reportRuntimeError(w,D,O),O}return w.stack}}reportRuntimeError(w,T,D){var I;w&&w.message&&this.reporterService.point(v.REPORT_NAME.RUNTIME_ERROR_EXTENSION,T.id,{stackTraceMessage:D,error:w.message,version:(I=T.packageJSON)===null||I===void 0?void 0:I.version})}getRegisterViewKind(w){return n.tabBarLocation.includes(w)?"replace":"add"}async activeExtension(w,T){var D;const{extendConfig:I,packageJSON:O,contributes:L}=w;if(!((D=I?.browser)===null||D===void 0)&&D.main){(0,l.warning)(!1,"[Deprecated warning]: kaitian.js is deprecated, please use `package.json#sumiContributes` instead"),await this.activateExtensionByDeprecatedExtendConfig(w);return}O.sumiContributes&&L?.browserMain&&await this.activeExtensionContributes(w)}async activeExtensionContributes(w){var T;const{contributes:D}=w,I=new E.URI(w.extensionLocation.with({path:b.join(w.extensionLocation.path,D.browserMain)})),{moduleExports:O,proxiedHead:L}=await this.getExtensionModuleExports(I.toString(),w);if(D.browserViews){const{browserViews:M}=D;this.appConfig.useExperimentalShadowDom&&this.registerPortalShadowRoot(w.id);const k=Object.keys(M).reduce((B,x)=>(B[x]={type:this.getRegisterViewKind(x),view:M[x].view.map(({id:N,titleComponentId:j,title:K,...U})=>({...U,title:(0,v.replaceLocalizePlaceholder)(K,w.id),id:N,component:this.getModuleExportsComponent(O,w,N,L),titleComponent:j&&this.getModuleExportsComponent(O,w,j,L)}))},B),{});this.registerBrowserComponent(k,w)}if(D.toolbar&&(!((T=D.toolbar)===null||T===void 0)&&T.actions)){for(const M of D.toolbar.actions)if(M.type==="button"&&M.popoverComponent){const k=O[M.popoverComponent];if(!k){this.logger.error(`Can not find CustomPopover from extension ${w.id}, id: ${M.popoverComponent}`);continue}if(this.appConfig.useExperimentalShadowDom){const B=x=>(0,_.getShadowRoot)(k,w,x,M.popoverComponent,L,this.appConfig.componentCDNType,this.appConfig.extensionBrowserStyleSheet);this.toolbarPopoverRegistry.registerComponent(`${w.id}:${M.popoverComponent}`,B)}else this.toolbarPopoverRegistry.registerComponent(`${w.id}:${M.popoverComponent}`,k)}}const R=M=>{if(D.scm&&D.scm.additional){const{input:k}=D.scm.additional;if(!k)return;const{addonBefore:B,addonAfter:x}=k,N=(j,K)=>{j.forEach(U=>{const X=O[U];if(X||this.logger.error(`Can not find ${K} from extension ${w.id}, id: ${X}`),this.appConfig.useExperimentalShadowDom){const z=Q=>(0,_.getShadowRoot)(X,w,Q,j,L,this.appConfig.componentCDNType,this.appConfig.extensionBrowserStyleSheet);M.input.appendProps({[K]:z})}else M.input.appendProps({[K]:X})})};B&&N(B,"addonBefore"),x&&N(x,"addonAfter")}};this.addDispose(this.scmService.onDidAddRepository(M=>{R(M)})),this.scmService.repositories.forEach(M=>{R(M)})}async activateExtensionByDeprecatedExtendConfig(w){const{extendConfig:T}=w;this.logger.verbose(`register view by Deprecated config ${w.id}`);const D=await this.staticResourceService.resolveStaticResource(E.URI.file(new a(w.path).join(T.browser.main).toString()));try{const I=w;if(this.appConfig.useExperimentalShadowDom){this.registerPortalShadowRoot(w.id);const{moduleExports:O,proxiedHead:L}=await this.loadBrowserModuleUseInterceptor(D.toString(),w,!0);this.registerBrowserComponent(this.normalizeDeprecatedViewsConfig(O,w,L),I)}else{const{moduleExports:O}=await this.loadBrowserModule(D.toString(),w,!0);this.registerBrowserComponent(this.normalizeDeprecatedViewsConfig(O,w),I)}}catch(I){I.errorCode===y?this.logger.error(`[Extension-Host] failed to load ${w.name} - browser module, path:
28347
28348