@opensumi/cli-engine 3.7.1-next-1736417771.0 → 3.7.1-next-1736420958.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.
- package/lib/browser/browser.js +1 -1
- package/package.json +10 -10
package/lib/browser/browser.js
CHANGED
|
@@ -28294,7 +28294,7 @@ ${S.slice(1).join(`
|
|
|
28294
28294
|
`).slice(d.startPosition.row);return`${f[0].slice(d.startPosition.column)}${f.length>1?`
|
|
28295
28295
|
${f.slice(1).join(`
|
|
28296
28296
|
`)}`:""}`}}return c.text}findTypeIdentifier(c){let h=c;for(;h;){if(h.type==="type_identifier")return h.text;const u=h.child(1);if(!u)break;h=u}return""}async extractImportPaths(c){var h;const u=[],d=await this.parser.parse(c),v=d?.rootNode,f=[],a=[];if(v)for(let b=0;b<v?.childCount;b++){const y=v.child(b);if(y?.type==="import_statement")f.push(y);else if(y?.type==="type_annotation"){const S=y.child(1);S&&a.push(S.text)}else if(y?.type==="lexical_declaration"){const S=this.findTypeIdentifier(y);S&&a.push(S)}}for(const b of f)if(a.some(y=>b.text.includes(y))){let y=(h=b.child(3))===null||h===void 0?void 0:h.text;(y?.includes("'")||y?.includes('"'))&&(y=y.slice(1,-1)),y&&u.push(y)}return u}async extractInterfaceOrTypeCode(c){var h;const u=[];if(this.language==="typescript"){await this.parserLoaded.promise;const d=(h=this.parser)===null||h===void 0?void 0:h.parse(c),v=d?.rootNode;if(v)for(let f=0;f<v?.childCount;f++){const a=v.child(f);if(a?.type==="export_statement"){const b=a.child(1);(b?.type==="interface_declaration"||b?.type==="type_alias_declaration")&&u.push(b.text)}else(a?.type==="interface_declaration"||a?.type==="type_alias_declaration")&&u.push(a.text)}}return u}async findSyntaxErrorCount(c){var h;await this.parserLoaded.promise;const u=(h=this.parser)===null||h===void 0?void 0:h.parse(c),d=u?.rootNode;if(!d)return 0;let v=0;const f=a=>{(a.type==="function_declaration"||a.type==="class_declaration"||a.type==="variable_declarator"||a.type==="statement_block"||a.type==="expression_statement")&&(a.hasError||a.isMissing||a.type==="ERROR")&&v++;for(let y=0;y<a.childCount;y++){const S=a.child(y);S&&f(S)}};return f(d),v}async findNearestCodeBlockWithPosition(c,h){const u=await this.parser.parse(c);if(u){const{rootNode:d}=u,v=d.namedDescendantForIndex(h),f=this.findContainingCodeBlockWithPosition(v,h);if(!f)return null;let b=c.split(`
|
|
28297
|
-
`).slice(0,f.startPosition.row).reduce((y,S)=>y+S.length,0);return b+=f.startPosition.row,b+=f.startPosition.column,{codeBlock:f.text,range:{start:{line:f.startPosition.row,character:0},end:{line:f.endPosition.row,character:1/0}},offset:b,type:f.startPosition.row===f.endPosition.row?m.NearestCodeBlockType.Line:m.NearestCodeBlockType.Block}}return null}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=s,n.__decorate([(0,o.Autowired)(_.WasmModuleManager),n.__metadata("design:type",_.WasmModuleManager)],s.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(p.TreeSitterLanguageFacts),n.__metadata("design:type",p.TreeSitterLanguageFacts)],s.prototype,"languageFacts",void 0),t.LanguageParser=s=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],s)},85679:(L,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 _=l.parserNameMap[p];if(_)return this.pool.has(_)||this.pool.set(_,this.injector.get(o.LanguageParser,[_])),this.pool.get(_)}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:(L,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:(L,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:(L,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),_=e(96436),s=e(2349),g=e(78542),c=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,l.JavaLanguageFacts,m.JavaScriptLanguageFacts,E.JavaScriptReactLanguageFacts,p.PythonLanguageFacts,_.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(d=>{const v=new d;this.langs.set(v.name,v)})}isCodeBlock(d,v){const f=this.langs.get(d);return f&&f.isCodeBlock?f.isCodeBlock(v):!1}isFunctionCodeBlock(d,v){const f=this.langs.get(d);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(v):!1}provideFunctionInfo(d,v){const f=this.langs.get(d);return f&&f.provideFunctionInfo?f.provideFunctionInfo(v):null}getCodeBlockTypes(d){const v=this.langs.get(d);return v?v.provideCodeBlocks():c}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(L,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:(L,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,_,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:((_=g.firstChild)===null||_===void 0?void 0:_.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:(L,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:(L,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:(L,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:(L,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:(L,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:(L,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:(L,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 _=await this.rendererRuntime.provideResourceUri(l.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(_)}constructor(){this.resolvedResourceUriDeferred=new m.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const _=await this.resolvedResourceUriDeferred.promise,s=m.path.join(_,"tree-sitter.wasm");return this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(_){if(!this.cachedRuntime.has(_)){const s=new m.Deferred;this.cachedRuntime.set(_,s);const g=await this.resolvedResourceUriDeferred.promise,c=m.path.join(g,`tree-sitter-${_}.wasm`);fetch(c).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(_).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:(L,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),_=e(11090),s=e(63067),g=e(46245),c=e(66368),h=e(19951),u=e(752),d=e(19413),v=n.__importDefault(e(87708)),f=()=>{const{side:T}=o.default.useContext(h.TabbarConfig),w=(0,l.useInjectable)(u.TabbarServiceFactory)(T);return(0,o.useEffect)(()=>{w.setIsLatter(!0)},[w]),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:T,components:w})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"left-to-right",id:v.default.ai_chat_panel,className:(0,r.default)(T,`${d.AI_CHAT_VIEW_ID}-slot`),components:w,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:v.default.ai_chat_view_container}})});t.AIChatTabRenderer=a;const b=({className:T,components:w})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"right-to-left",id:v.default.ai_chat_panel,className:(0,r.default)(T,`${d.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:w,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:v.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=b;const y=({className:T,components:w})=>o.default.createElement(_.DesignLeftTabRenderer,{className:T,components:w,tabbarView:S});t.AILeftTabRenderer=y;const S=()=>{const T=(0,l.useInjectable)(s.IMainLayoutService),w=(0,l.useInjectable)(u.TabbarServiceFactory)(l.SlotLocation.right),D=(0,l.useAutorun)(w.currentContainerId),I=o.default.useMemo(()=>T.getExtraMenu(),[T]),[O]=(0,l.useContextMenus)(I),P=(0,o.useCallback)(({renderContainers:R})=>{const M=w.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,w,D)))},[D,w]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:P,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:v.default.extra_bottom_icon_container},O.length>=0?O.map(R=>o.default.createElement(m.EnhanceIconWithCtxMenu,{key:R.id,id:R.id,wrapperClassName:v.default.extra_bottom_icon,iconClass:R.icon,menuNodes:R.children,skew:{x:-8,y:-4}})):null)})},A=({className:T,components:w})=>{const D=(0,l.useInjectable)(u.TabbarServiceFactory)(l.SlotLocation.right),I=(0,l.useInjectable)(E.DesignLayoutConfig),O=(0,o.useCallback)(()=>{D.updateCurrentContainerId("")},[]),P=(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:v.default.right_slot_container_wrap},o.default.createElement("div",{className:v.default.header},o.default.createElement("span",{className:v.default.title},B&&B.title),o.default.createElement("div",{className:v.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:v.default.container},x))})},[]),R=(0,o.useMemo)(()=>I.useMergeRightWithLeftPanel?v.default.right_tab_renderer:"",[I]);return o.default.createElement(_.DesignRightTabRenderer,{components:w,className:R,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:P})})};t.AIRightTabRenderer=A},82983:(L,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)),_=()=>{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=_},53617:(L,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:u}=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)(u)&&this.setGroup(u)}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 u=g.addDecoration(h.range,h.options);c.push(this.createDecorations({id:u,editorDecoration:h,codeEditor:this.codeEditor,isHidden:h.isHidden,group:h.group,deltaData:{dispose:()=>this.delete(u),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:(L,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),_=this.messageMap.size,s={...E,id:p,order:_,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 _=this.messageMap.get(E);this.messageMap.set(E,{..._,content:p.content})}};t.MsgHistoryManager=l,t.MsgHistoryManager=l=n.__decorate([(0,r.Injectable)({multiple:!1})],l)},3841:(L,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:(L,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:(L,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:(L,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),_=(s,g,c,h)=>{const u=h.get(m.EditorOption.disableMonospaceOptimizations),d=h.get(m.EditorOption.stopRenderingLineAfter),v="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 w=0,D=c.length;w<D;w++){const I=c[w],O=I.content;S.appendString('<div class="view-line'),S.appendString('" style="top:'),S.appendString(String(w*y)),S.appendString('px;width:1000000px;">');const P=o.isBasicASCII(O),R=o.containsRTL(O);(0,p.renderViewLine)(new p.RenderLineInput(b.isMonospace&&!u,b.canUseHalfwidthRightwardsArrow,O,!1,P,R,0,I.lineTokens,I.decorations,g,0,b.spaceWidth,b.middotWidth,b.wsmiddotWidth,d,v,f,a!==m.EditorFontLigatures.OFF,null),S),S.appendString("</div>")}S.appendString("</div>"),(0,l.applyFontInfo)(s,b);const A=S.build(),T=t.ttPolicy?t.ttPolicy.createHTML(A):A;s.innerHTML=T};t.renderLines=_,t.ttPolicy=(0,r.createTrustedTypesPolicy)("editorGhostText",{createHTML:s=>s})},90614:(L,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:_})=>{const s=(0,r.useMemo)(()=>[{icon:"check",text:(0,m.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>_(E.EResultKind.ACCEPT)},{icon:"discard",text:(0,m.localize)("aiNative.operate.discard.title"),onClick:()=>_(E.EResultKind.DISCARD)},{icon:"afresh",text:(0,m.localize)("aiNative.operate.afresh.title"),onClick:()=>_(E.EResultKind.REGENERATE)}],[_]);return r.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},r.default.createElement(l.AIInlineResult,{iconItems:s}))};t.InlineResultAction=p},40111:(L,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:_=>{p+=_.content;const s=this.calculateCodeBlocks(p);E.updateMessage(s),this._onData.fire(E)},onEnd:()=>{this._onEnd.fire()},onError:_=>{n.AbortError.is(_)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(_))}})}}t.InlineChatController=l},51221:(L,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),_=e(77633),s=e(38890),g=e(40111),c=e(31031),h=e(26664);class u extends E.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new r.Disposable,this.aiInlineChatOperationDisposable=new r.Disposable,this.inlineChatInUsing=!1}static get(v){return v.getContribution(u.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 v=!1;this.featureDisposable.addDispose(this.monacoEditor.onMouseDown(a=>{const y=a.target.detail;v=!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?v=!1:v=!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||!v||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(this.monacoEditor)})),this.featureDisposable}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(v=>{v?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}showInlineContentWidget(v,f){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(h.AIInlineContentWidget,[v]),this.aiInlineContentWidget.show({selection:f})}async showInlineChat(v){if(this.contextKeyService.getContextValue(o.CONTEXT_IN_DEBUG_MODE_KEY)||!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const a=v.getSelection();!a||a.isEmpty()||(this.showInlineContentWidget(v,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 T=this.getCrossSelection(v);if(!T)return;const w=()=>{const D=S.providerDiffPreviewStrategy?S.providerDiffPreviewStrategy:S.providePreviewStrategy;if(D)return D.bind(this,v,this.token)};this.runAction({monacoEditor:v,crossSelection:T,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,v,this.token):void 0,providerPreview:w(),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()(v,b),A=this.getCrossSelection(v);A&&this.runAction({monacoEditor:v,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===_.ERunStrategy.EXECUTE?y.execute.bind(this,v,b,this.token):void 0,providerPreview:y.providePreviewStrategy&&S===_.ERunStrategy.PREVIEW?y.providePreviewStrategy.bind(this,v,b,this.token):void 0,extraData:{actionSource:r.ActionSourceEnum.InlineChatInput,actionType:S}})})))}getCrossSelection(v){const f=v.getSelection();if(!f){this.logger.error("No selection found, aborting inline chat action.");return}return f.setStartPosition(f.startLineNumber,1).setEndPosition(f.endLineNumber,v.getModel().getLineMaxColumn(f.endLineNumber))}convertInlineChatStatus(v,f){if(!this.aiInlineContentWidget)return;const{relationId:a,message:b,startTime:y,isRetry:S,isStop:A}=f;let T;v===c.EInlineChatStatus.DONE&&(T=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(v)),this.aiReporter.end(a,{message:b,success:v!==c.EInlineChatStatus.ERROR,replytime:Date.now()-y,isStop:A,isRetry:S,code:T,actionType:f?.actionType,actionSource:f?.actionSource})}visibleDiffWidget(v){const{monacoEditor:f,options:a,reportInfo:b}=v,{chatResponse:y}=a,{relationId:S,startTime:A,isRetry:T,actionType:w,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:T,actionSource:D,actionType:w})}),y.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:"abort",startTime:A,isRetry:T,isStop:!0,actionSource:D,actionType:w})}),y.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:T,actionSource:D,actionType:w})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||r.CancelResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:y.message||"",startTime:A,isRetry:T,isStop:!0,actionSource:D,actionType:w});return}if(r.ErrorResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:y.message||"",startTime:A,isRetry:T,actionSource:D,actionType:w});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:T,actionSource:D,actionType:w})}this.inlineDiffController.showPreviewerByStream(f,a).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(v,f){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(v,f):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(v){if(!this.aiInlineContentWidget)return;const{monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:S,actionType:A,actionSource:T}=v,w=f.getModel();this.inlineDiffController.destroyPreviewer(w.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:T,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:T,actionType:A}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:f,options:{crossSelection:b,chatResponse:I},reportInfo:{relationId:y,startTime:D,isRetry:S,actionType:A,actionSource:T}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(O=>{const P=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:P,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:P,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:P,originCode:R,actionType:r.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:!0,actionSource:T,actionType:A}))}),this.aiInlineChatService.onThumbs(O=>{this.aiReporter.end(y,{isLike:O})}),this.inlineDiffController.onMaxLineCount(O=>{requestAnimationFrame(()=>{if(b.endLineNumber===w.getLineCount()){const P=f.getOption(m.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(P*O+12)}})})])}async runAction(v){const{monacoEditor:f,crossSelection:a,reporterFn:b,execute:y,providerPreview:S,extraData:A}=v;if(y&&(await y(),this.disposeAllWidget()),S){const T=b();await this.handleDiffPreviewStrategy({monacoEditor:f,strategy:S,crossSelection:a,relationId:T,isRetry:!1,actionSource:A?.actionSource,actionType:A?.actionType})}}}t.InlineChatEditorController=u,u.ID="editor.contrib.ai.inline.chat"},2281:(L,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),_=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,u){this.actionsMap.set(h,u)}collectActions(h){const{id:u}=h;return this.actionsMap.has(u)?(this.logger.warn(`InlineChatFeatureRegistry: id ${u} already exists`),!1):((0,E.isUndefined)(h.renderType)&&(h.renderType="button"),(0,E.isUndefined)(h.order)&&(h.order=0),this.actionsMap.set(u,h),!0)}removeCollectedActions(h){this.actionsMap.delete(h.id),this.codeActionService.deleteCodeActionById(h.id)}getInteractiveInputId(){return s.ID}registerEditorInlineChat(h,u){return this.collectActions(h)&&(this.editorHandlerMap.set(h.id,u),this.codeActionService.registerCodeAction(h)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterEditorInlineChat(h){return this.removeCollectedActions(h)}registerTerminalInlineChat(h,u){return this.collectActions(h)&&((0,E.isUndefined)(u.triggerRules)&&(u.triggerRules="selection"),this.terminalHandlerMap.set(h.id,u)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterTerminalInlineChat(h){return this.removeCollectedActions(h)}registerInteractiveInput(h,u){this.interactiveInputModel.setHandler(u),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||_.ERunStrategy.EXECUTE);const d=()=>{const v=String(this.getSequenceKeyString());if(v){const f={id:s.ID,name:`Chat(${v.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:v})=>v.includes(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>d())),d(),{dispose:()=>{this.interactiveInputModel.dispose()}}}getSequenceKeyString(){var h;const d=(h=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return d?this.keybindingRegistry.acceleratorForSequence(d,"+"):""}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}getEditorActionButtons(){const h=Array.from(this.editorHandlerMap.keys()).filter(u=>{const d=this.actionsMap.get(u);return d&&d.renderType==="button"}).map(u=>this.actionsMap.get(u)).sort((u,d)=>u.order-d.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 u=this.actionsMap.get(h);return u&&u.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:(L,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(){const p=this._interactiveInputVisible;return this._interactiveInputVisible=!1,p}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:(L,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),_=e(43718),s=n.__importStar(e(20868)),g=e(62663),c=e(52659),h=e(77659),u=e(90614),d=e(2281),v=n.__importDefault(e(26899)),f=e(31031),a=y=>{const{onClickActions:S,onClose:A,onInteractiveInputSend:T,onLayoutChange:w,onChatStatus:D,onResultClick:I}=y,O=(0,l.useInjectable)(l.IAIInlineChatService),P=(0,l.useInjectable)(_.InlineChatFeatureRegistryToken),[R,M]=(0,r.useState)(f.EInlineChatStatus.READY),[k,B]=(0,r.useState)(O.interactiveInputVisible);(0,r.useEffect)(()=>{const $=new _.Disposable;return $.addDispose(D(H=>M(H))),$.addDispose(O.onInteractiveInputVisible(H=>{B(H)})),()=>{$.dispose()}},[D,O]),(0,r.useEffect)(()=>{R===f.EInlineChatStatus.ERROR&&A?.()},[A]);const x=(0,r.useMemo)(()=>R===f.EInlineChatStatus.THINKING,[R]),N=(0,r.useMemo)(()=>R===f.EInlineChatStatus.DONE,[R]),j=(0,r.useMemo)(()=>R===f.EInlineChatStatus.ERROR,[R]),K=(0,r.useMemo)(()=>P.getEditorActionButtons(),[P]),U=(0,r.useCallback)($=>{S?.($)},[S]),Q=(0,r.useCallback)(()=>{A?.()},[A]),z=(0,r.useCallback)($=>{T?.($)},[T]),G=(0,r.useMemo)(()=>P.getEditorActionMenus().map($=>new p.MenuNode({id:`ai.menu.operation.${$.id}`,label:$.name,className:v.default.more_operation_menu_item,execute:()=>{U($.id)}})),[P]),Y=(0,r.useMemo)(()=>k?r.default.createElement(E.InteractiveInput,{autoFocus:!0,onHeightChange:$=>w($),size:"small",placeholder:(0,_.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:x,onSend:z}):null,[x,k]),Z=(0,r.useCallback)(()=>K.length===0&&G.length===0||j?null:N?r.default.createElement(u.InlineResultAction,{onResultClick:I}):r.default.createElement(m.AIAction,{operationList:K,moreOperation:G,onClickItem:U,onClose:Q,loading:x,loadingShowOperation:k,customOperationRender:Y}),[K,G,Y,I,R,k]);return r.default.createElement("div",{className:v.default.inline_chat_controller_box},Z())};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 _.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onInteractiveInputValue=new _.Emitter,this.onInteractiveInputValue=this._onInteractiveInputValue.event,this._onStatusChange=new _.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new _.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,_.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 _.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 T=this.computePosition(A);return T||null}safeGetLineLastNonWhitespaceColumn(S){const A=this.editor.getModel();S<1&&(S=1);const T=A.getLineCount();return S>T&&(S=T),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(),T=S.getEndPosition(),D=this.editor.getModel().getLineCount(),I=Math.max(1,T.lineNumber-1),O=Math.min(D,T.lineNumber+1),P=A.with(I,1),R=T.with(O,this.safeGetLineLastNonWhitespaceColumn(O));if(D===1)return this.toBelowPosition(O,this.safeGetLineLastNonWhitespaceColumn(O));if(R.lineNumber===1&&T.lineNumber!==A.lineNumber)return this.computePosition(s.Selection.fromPositions(P,R));const M=this.safeGetLineLastNonWhitespaceColumn(I),k=this.safeGetLineLastNonWhitespaceColumn(O),B=this.safeGetLineLastNonWhitespaceColumn(T.lineNumber);return k>B&&k>M?this.computePosition(s.Selection.fromPositions(R,P)):this.computePosition(s.Selection.fromPositions(P,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){const A=S.getStartPosition(),T=S.getEndPosition();let w=S.getPosition();const I=this.editor.getModel().getLineCount();if(A.lineNumber===T.lineNumber)return this.recheckSelection(S);T.lineNumber-A.lineNumber===1&&(w=T);const O=this.safeGetLineLastNonWhitespaceColumn(w.lineNumber);let P=w.lineNumber,R="below";if(w.equals(A)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(w.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(w.lineNumber-2))<=O)return this.toAbovePosition(w.lineNumber,O);for(let B=A.lineNumber;B<=T.lineNumber;B++){if(this.isProtrudeAbove(B)){P=B,R="above";break}if(this.isProtrudeBelow(B)){P=B,R="below";break}}}else if(w.equals(T)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(w.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(w.lineNumber+2))<=O)return this.toBelowPosition(w.lineNumber,O);for(let B=Math.min(I,T.lineNumber+1);B>=A.lineNumber;B--){if(this.isProtrudeBelow(B)){P=B,R="below";break}if(this.isProtrudeAbove(B)){P=B,R="above";break}}}const M=this.safeGetLineLastNonWhitespaceColumn(P)+1;return R==="below"?this.toBelowPosition(P,M):this.toAbovePosition(P,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)(_.InlineChatFeatureRegistryToken),n.__metadata("design:type",d.InlineChatFeatureRegistry)],b.prototype,"inlineChatFeatureRegistry",void 0),t.AIInlineContentWidget=b=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],b)},15989:(L,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:(L,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),_=e(43255),s=e(74547),g=e(11827),c=e(9491),h=e(31031),u=e(33062),d=e(37679);let v=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:T,insertSpaces:w}=this.model.getOptions(),D=this.model.getEOL(),I=(0,c.getSpaceCnt)(A,T);let O=(0,c.generateIndent)(I,T,w);const P=y.split(D),R=P[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 P.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=v,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],v.prototype,"injector",void 0),t.BaseInlineDiffPreviewer=v=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],v);let f=n=class extends v{createNode(){const y=this.injector.get(d.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:T}=y,w=this.formatIndentation(T),D=(S=this.node)===null||S===void 0?void 0:S.getModifiedModel(),I=D.getEOL()===`\r
|
|
28297
|
+
`).slice(0,f.startPosition.row).reduce((y,S)=>y+S.length,0);return b+=f.startPosition.row,b+=f.startPosition.column,{codeBlock:f.text,range:{start:{line:f.startPosition.row,character:0},end:{line:f.endPosition.row,character:1/0}},offset:b,type:f.startPosition.row===f.endPosition.row?m.NearestCodeBlockType.Line:m.NearestCodeBlockType.Block}}return null}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=s,n.__decorate([(0,o.Autowired)(_.WasmModuleManager),n.__metadata("design:type",_.WasmModuleManager)],s.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(p.TreeSitterLanguageFacts),n.__metadata("design:type",p.TreeSitterLanguageFacts)],s.prototype,"languageFacts",void 0),t.LanguageParser=s=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],s)},85679:(L,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 _=l.parserNameMap[p];if(_)return this.pool.has(_)||this.pool.set(_,this.injector.get(o.LanguageParser,[_])),this.pool.get(_)}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:(L,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:(L,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:(L,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),_=e(96436),s=e(2349),g=e(78542),c=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,l.JavaLanguageFacts,m.JavaScriptLanguageFacts,E.JavaScriptReactLanguageFacts,p.PythonLanguageFacts,_.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(d=>{const v=new d;this.langs.set(v.name,v)})}isCodeBlock(d,v){const f=this.langs.get(d);return f&&f.isCodeBlock?f.isCodeBlock(v):!1}isFunctionCodeBlock(d,v){const f=this.langs.get(d);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(v):!1}provideFunctionInfo(d,v){const f=this.langs.get(d);return f&&f.provideFunctionInfo?f.provideFunctionInfo(v):null}getCodeBlockTypes(d){const v=this.langs.get(d);return v?v.provideCodeBlocks():c}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(L,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:(L,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,_,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:((_=g.firstChild)===null||_===void 0?void 0:_.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:(L,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:(L,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:(L,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:(L,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:(L,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:(L,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:(L,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 _=await this.rendererRuntime.provideResourceUri(l.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(_)}constructor(){this.resolvedResourceUriDeferred=new m.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const _=await this.resolvedResourceUriDeferred.promise;let s;return _.endsWith("/")?s=`${_}tree-sitter.wasm`:s=`${_}/tree-sitter.wasm`,this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(_){if(!this.cachedRuntime.has(_)){const s=new m.Deferred;this.cachedRuntime.set(_,s);const g=await this.resolvedResourceUriDeferred.promise;let c;g.endsWith("/")?c=`${g}tree-sitter-${_}.wasm`:c=`${g}/tree-sitter-${_}.wasm`,fetch(c).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(_).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:(L,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),_=e(11090),s=e(63067),g=e(46245),c=e(66368),h=e(19951),u=e(752),d=e(19413),v=n.__importDefault(e(87708)),f=()=>{const{side:T}=o.default.useContext(h.TabbarConfig),w=(0,l.useInjectable)(u.TabbarServiceFactory)(T);return(0,o.useEffect)(()=>{w.setIsLatter(!0)},[w]),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:T,components:w})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"left-to-right",id:v.default.ai_chat_panel,className:(0,r.default)(T,`${d.AI_CHAT_VIEW_ID}-slot`),components:w,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:v.default.ai_chat_view_container}})});t.AIChatTabRenderer=a;const b=({className:T,components:w})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"right-to-left",id:v.default.ai_chat_panel,className:(0,r.default)(T,`${d.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:w,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:v.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=b;const y=({className:T,components:w})=>o.default.createElement(_.DesignLeftTabRenderer,{className:T,components:w,tabbarView:S});t.AILeftTabRenderer=y;const S=()=>{const T=(0,l.useInjectable)(s.IMainLayoutService),w=(0,l.useInjectable)(u.TabbarServiceFactory)(l.SlotLocation.right),D=(0,l.useAutorun)(w.currentContainerId),I=o.default.useMemo(()=>T.getExtraMenu(),[T]),[O]=(0,l.useContextMenus)(I),P=(0,o.useCallback)(({renderContainers:R})=>{const M=w.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,w,D)))},[D,w]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:P,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:v.default.extra_bottom_icon_container},O.length>=0?O.map(R=>o.default.createElement(m.EnhanceIconWithCtxMenu,{key:R.id,id:R.id,wrapperClassName:v.default.extra_bottom_icon,iconClass:R.icon,menuNodes:R.children,skew:{x:-8,y:-4}})):null)})},A=({className:T,components:w})=>{const D=(0,l.useInjectable)(u.TabbarServiceFactory)(l.SlotLocation.right),I=(0,l.useInjectable)(E.DesignLayoutConfig),O=(0,o.useCallback)(()=>{D.updateCurrentContainerId("")},[]),P=(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:v.default.right_slot_container_wrap},o.default.createElement("div",{className:v.default.header},o.default.createElement("span",{className:v.default.title},B&&B.title),o.default.createElement("div",{className:v.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:v.default.container},x))})},[]),R=(0,o.useMemo)(()=>I.useMergeRightWithLeftPanel?v.default.right_tab_renderer:"",[I]);return o.default.createElement(_.DesignRightTabRenderer,{components:w,className:R,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:P})})};t.AIRightTabRenderer=A},82983:(L,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)),_=()=>{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=_},53617:(L,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:u}=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)(u)&&this.setGroup(u)}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 u=g.addDecoration(h.range,h.options);c.push(this.createDecorations({id:u,editorDecoration:h,codeEditor:this.codeEditor,isHidden:h.isHidden,group:h.group,deltaData:{dispose:()=>this.delete(u),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:(L,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),_=this.messageMap.size,s={...E,id:p,order:_,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 _=this.messageMap.get(E);this.messageMap.set(E,{..._,content:p.content})}};t.MsgHistoryManager=l,t.MsgHistoryManager=l=n.__decorate([(0,r.Injectable)({multiple:!1})],l)},3841:(L,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:(L,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:(L,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:(L,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),_=(s,g,c,h)=>{const u=h.get(m.EditorOption.disableMonospaceOptimizations),d=h.get(m.EditorOption.stopRenderingLineAfter),v="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 w=0,D=c.length;w<D;w++){const I=c[w],O=I.content;S.appendString('<div class="view-line'),S.appendString('" style="top:'),S.appendString(String(w*y)),S.appendString('px;width:1000000px;">');const P=o.isBasicASCII(O),R=o.containsRTL(O);(0,p.renderViewLine)(new p.RenderLineInput(b.isMonospace&&!u,b.canUseHalfwidthRightwardsArrow,O,!1,P,R,0,I.lineTokens,I.decorations,g,0,b.spaceWidth,b.middotWidth,b.wsmiddotWidth,d,v,f,a!==m.EditorFontLigatures.OFF,null),S),S.appendString("</div>")}S.appendString("</div>"),(0,l.applyFontInfo)(s,b);const A=S.build(),T=t.ttPolicy?t.ttPolicy.createHTML(A):A;s.innerHTML=T};t.renderLines=_,t.ttPolicy=(0,r.createTrustedTypesPolicy)("editorGhostText",{createHTML:s=>s})},90614:(L,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:_})=>{const s=(0,r.useMemo)(()=>[{icon:"check",text:(0,m.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>_(E.EResultKind.ACCEPT)},{icon:"discard",text:(0,m.localize)("aiNative.operate.discard.title"),onClick:()=>_(E.EResultKind.DISCARD)},{icon:"afresh",text:(0,m.localize)("aiNative.operate.afresh.title"),onClick:()=>_(E.EResultKind.REGENERATE)}],[_]);return r.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},r.default.createElement(l.AIInlineResult,{iconItems:s}))};t.InlineResultAction=p},40111:(L,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:_=>{p+=_.content;const s=this.calculateCodeBlocks(p);E.updateMessage(s),this._onData.fire(E)},onEnd:()=>{this._onEnd.fire()},onError:_=>{n.AbortError.is(_)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(_))}})}}t.InlineChatController=l},51221:(L,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),_=e(77633),s=e(38890),g=e(40111),c=e(31031),h=e(26664);class u extends E.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new r.Disposable,this.aiInlineChatOperationDisposable=new r.Disposable,this.inlineChatInUsing=!1}static get(v){return v.getContribution(u.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 v=!1;this.featureDisposable.addDispose(this.monacoEditor.onMouseDown(a=>{const y=a.target.detail;v=!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?v=!1:v=!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||!v||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(this.monacoEditor)})),this.featureDisposable}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(v=>{v?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}showInlineContentWidget(v,f){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(h.AIInlineContentWidget,[v]),this.aiInlineContentWidget.show({selection:f})}async showInlineChat(v){if(this.contextKeyService.getContextValue(o.CONTEXT_IN_DEBUG_MODE_KEY)||!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const a=v.getSelection();!a||a.isEmpty()||(this.showInlineContentWidget(v,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 T=this.getCrossSelection(v);if(!T)return;const w=()=>{const D=S.providerDiffPreviewStrategy?S.providerDiffPreviewStrategy:S.providePreviewStrategy;if(D)return D.bind(this,v,this.token)};this.runAction({monacoEditor:v,crossSelection:T,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,v,this.token):void 0,providerPreview:w(),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()(v,b),A=this.getCrossSelection(v);A&&this.runAction({monacoEditor:v,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===_.ERunStrategy.EXECUTE?y.execute.bind(this,v,b,this.token):void 0,providerPreview:y.providePreviewStrategy&&S===_.ERunStrategy.PREVIEW?y.providePreviewStrategy.bind(this,v,b,this.token):void 0,extraData:{actionSource:r.ActionSourceEnum.InlineChatInput,actionType:S}})})))}getCrossSelection(v){const f=v.getSelection();if(!f){this.logger.error("No selection found, aborting inline chat action.");return}return f.setStartPosition(f.startLineNumber,1).setEndPosition(f.endLineNumber,v.getModel().getLineMaxColumn(f.endLineNumber))}convertInlineChatStatus(v,f){if(!this.aiInlineContentWidget)return;const{relationId:a,message:b,startTime:y,isRetry:S,isStop:A}=f;let T;v===c.EInlineChatStatus.DONE&&(T=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(v)),this.aiReporter.end(a,{message:b,success:v!==c.EInlineChatStatus.ERROR,replytime:Date.now()-y,isStop:A,isRetry:S,code:T,actionType:f?.actionType,actionSource:f?.actionSource})}visibleDiffWidget(v){const{monacoEditor:f,options:a,reportInfo:b}=v,{chatResponse:y}=a,{relationId:S,startTime:A,isRetry:T,actionType:w,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:T,actionSource:D,actionType:w})}),y.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:"abort",startTime:A,isRetry:T,isStop:!0,actionSource:D,actionType:w})}),y.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:T,actionSource:D,actionType:w})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||r.CancelResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:y.message||"",startTime:A,isRetry:T,isStop:!0,actionSource:D,actionType:w});return}if(r.ErrorResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:y.message||"",startTime:A,isRetry:T,actionSource:D,actionType:w});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:T,actionSource:D,actionType:w})}this.inlineDiffController.showPreviewerByStream(f,a).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(v,f){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(v,f):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(v){if(!this.aiInlineContentWidget)return;const{monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:S,actionType:A,actionSource:T}=v,w=f.getModel();this.inlineDiffController.destroyPreviewer(w.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:T,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:T,actionType:A}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:f,options:{crossSelection:b,chatResponse:I},reportInfo:{relationId:y,startTime:D,isRetry:S,actionType:A,actionSource:T}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(O=>{const P=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:P,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:P,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:P,originCode:R,actionType:r.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:!0,actionSource:T,actionType:A}))}),this.aiInlineChatService.onThumbs(O=>{this.aiReporter.end(y,{isLike:O})}),this.inlineDiffController.onMaxLineCount(O=>{requestAnimationFrame(()=>{if(b.endLineNumber===w.getLineCount()){const P=f.getOption(m.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(P*O+12)}})})])}async runAction(v){const{monacoEditor:f,crossSelection:a,reporterFn:b,execute:y,providerPreview:S,extraData:A}=v;if(y&&(await y(),this.disposeAllWidget()),S){const T=b();await this.handleDiffPreviewStrategy({monacoEditor:f,strategy:S,crossSelection:a,relationId:T,isRetry:!1,actionSource:A?.actionSource,actionType:A?.actionType})}}}t.InlineChatEditorController=u,u.ID="editor.contrib.ai.inline.chat"},2281:(L,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),_=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,u){this.actionsMap.set(h,u)}collectActions(h){const{id:u}=h;return this.actionsMap.has(u)?(this.logger.warn(`InlineChatFeatureRegistry: id ${u} already exists`),!1):((0,E.isUndefined)(h.renderType)&&(h.renderType="button"),(0,E.isUndefined)(h.order)&&(h.order=0),this.actionsMap.set(u,h),!0)}removeCollectedActions(h){this.actionsMap.delete(h.id),this.codeActionService.deleteCodeActionById(h.id)}getInteractiveInputId(){return s.ID}registerEditorInlineChat(h,u){return this.collectActions(h)&&(this.editorHandlerMap.set(h.id,u),this.codeActionService.registerCodeAction(h)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterEditorInlineChat(h){return this.removeCollectedActions(h)}registerTerminalInlineChat(h,u){return this.collectActions(h)&&((0,E.isUndefined)(u.triggerRules)&&(u.triggerRules="selection"),this.terminalHandlerMap.set(h.id,u)),{dispose:()=>{this.removeCollectedActions(h)}}}unregisterTerminalInlineChat(h){return this.removeCollectedActions(h)}registerInteractiveInput(h,u){this.interactiveInputModel.setHandler(u),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||_.ERunStrategy.EXECUTE);const d=()=>{const v=String(this.getSequenceKeyString());if(v){const f={id:s.ID,name:`Chat(${v.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:v})=>v.includes(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>d())),d(),{dispose:()=>{this.interactiveInputModel.dispose()}}}getSequenceKeyString(){var h;const d=(h=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return d?this.keybindingRegistry.acceleratorForSequence(d,"+"):""}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}getEditorActionButtons(){const h=Array.from(this.editorHandlerMap.keys()).filter(u=>{const d=this.actionsMap.get(u);return d&&d.renderType==="button"}).map(u=>this.actionsMap.get(u)).sort((u,d)=>u.order-d.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 u=this.actionsMap.get(h);return u&&u.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:(L,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(){const p=this._interactiveInputVisible;return this._interactiveInputVisible=!1,p}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:(L,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),_=e(43718),s=n.__importStar(e(20868)),g=e(62663),c=e(52659),h=e(77659),u=e(90614),d=e(2281),v=n.__importDefault(e(26899)),f=e(31031),a=y=>{const{onClickActions:S,onClose:A,onInteractiveInputSend:T,onLayoutChange:w,onChatStatus:D,onResultClick:I}=y,O=(0,l.useInjectable)(l.IAIInlineChatService),P=(0,l.useInjectable)(_.InlineChatFeatureRegistryToken),[R,M]=(0,r.useState)(f.EInlineChatStatus.READY),[k,B]=(0,r.useState)(O.interactiveInputVisible);(0,r.useEffect)(()=>{const $=new _.Disposable;return $.addDispose(D(H=>M(H))),$.addDispose(O.onInteractiveInputVisible(H=>{B(H)})),()=>{$.dispose()}},[D,O]),(0,r.useEffect)(()=>{R===f.EInlineChatStatus.ERROR&&A?.()},[A]);const x=(0,r.useMemo)(()=>R===f.EInlineChatStatus.THINKING,[R]),N=(0,r.useMemo)(()=>R===f.EInlineChatStatus.DONE,[R]),j=(0,r.useMemo)(()=>R===f.EInlineChatStatus.ERROR,[R]),K=(0,r.useMemo)(()=>P.getEditorActionButtons(),[P]),U=(0,r.useCallback)($=>{S?.($)},[S]),Q=(0,r.useCallback)(()=>{A?.()},[A]),z=(0,r.useCallback)($=>{T?.($)},[T]),G=(0,r.useMemo)(()=>P.getEditorActionMenus().map($=>new p.MenuNode({id:`ai.menu.operation.${$.id}`,label:$.name,className:v.default.more_operation_menu_item,execute:()=>{U($.id)}})),[P]),Y=(0,r.useMemo)(()=>k?r.default.createElement(E.InteractiveInput,{autoFocus:!0,onHeightChange:$=>w($),size:"small",placeholder:(0,_.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:x,onSend:z}):null,[x,k]),Z=(0,r.useCallback)(()=>K.length===0&&G.length===0||j?null:N?r.default.createElement(u.InlineResultAction,{onResultClick:I}):r.default.createElement(m.AIAction,{operationList:K,moreOperation:G,onClickItem:U,onClose:Q,loading:x,loadingShowOperation:k,customOperationRender:Y}),[K,G,Y,I,R,k]);return r.default.createElement("div",{className:v.default.inline_chat_controller_box},Z())};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 _.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onInteractiveInputValue=new _.Emitter,this.onInteractiveInputValue=this._onInteractiveInputValue.event,this._onStatusChange=new _.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new _.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,_.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 _.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 T=this.computePosition(A);return T||null}safeGetLineLastNonWhitespaceColumn(S){const A=this.editor.getModel();S<1&&(S=1);const T=A.getLineCount();return S>T&&(S=T),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(),T=S.getEndPosition(),D=this.editor.getModel().getLineCount(),I=Math.max(1,T.lineNumber-1),O=Math.min(D,T.lineNumber+1),P=A.with(I,1),R=T.with(O,this.safeGetLineLastNonWhitespaceColumn(O));if(D===1)return this.toBelowPosition(O,this.safeGetLineLastNonWhitespaceColumn(O));if(R.lineNumber===1&&T.lineNumber!==A.lineNumber)return this.computePosition(s.Selection.fromPositions(P,R));const M=this.safeGetLineLastNonWhitespaceColumn(I),k=this.safeGetLineLastNonWhitespaceColumn(O),B=this.safeGetLineLastNonWhitespaceColumn(T.lineNumber);return k>B&&k>M?this.computePosition(s.Selection.fromPositions(R,P)):this.computePosition(s.Selection.fromPositions(P,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){const A=S.getStartPosition(),T=S.getEndPosition();let w=S.getPosition();const I=this.editor.getModel().getLineCount();if(A.lineNumber===T.lineNumber)return this.recheckSelection(S);T.lineNumber-A.lineNumber===1&&(w=T);const O=this.safeGetLineLastNonWhitespaceColumn(w.lineNumber);let P=w.lineNumber,R="below";if(w.equals(A)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(w.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(w.lineNumber-2))<=O)return this.toAbovePosition(w.lineNumber,O);for(let B=A.lineNumber;B<=T.lineNumber;B++){if(this.isProtrudeAbove(B)){P=B,R="above";break}if(this.isProtrudeBelow(B)){P=B,R="below";break}}}else if(w.equals(T)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(w.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(w.lineNumber+2))<=O)return this.toBelowPosition(w.lineNumber,O);for(let B=Math.min(I,T.lineNumber+1);B>=A.lineNumber;B--){if(this.isProtrudeBelow(B)){P=B,R="below";break}if(this.isProtrudeAbove(B)){P=B,R="above";break}}}const M=this.safeGetLineLastNonWhitespaceColumn(P)+1;return R==="below"?this.toBelowPosition(P,M):this.toAbovePosition(P,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)(_.InlineChatFeatureRegistryToken),n.__metadata("design:type",d.InlineChatFeatureRegistry)],b.prototype,"inlineChatFeatureRegistry",void 0),t.AIInlineContentWidget=b=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],b)},15989:(L,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:(L,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),_=e(43255),s=e(74547),g=e(11827),c=e(9491),h=e(31031),u=e(33062),d=e(37679);let v=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:T,insertSpaces:w}=this.model.getOptions(),D=this.model.getEOL(),I=(0,c.getSpaceCnt)(A,T);let O=(0,c.generateIndent)(I,T,w);const P=y.split(D),R=P[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 P.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=v,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],v.prototype,"injector",void 0),t.BaseInlineDiffPreviewer=v=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],v);let f=n=class extends v{createNode(){const y=this.injector.get(d.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:T}=y,w=this.formatIndentation(T),D=(S=this.node)===null||S===void 0?void 0:S.getModifiedModel(),I=D.getEOL()===`\r
|
|
28298
28298
|
`?_.DefaultEndOfLine.CRLF:_.DefaultEndOfLine.LF,{textBuffer:O,disposable:P}=(0,s.createTextBuffer)(w,I),R=g.ModelService._computeEdits(D,O);D.pushEditOperations([],R,()=>[]),P.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 v{listenNode(y){y.addDispose(y.onDidEditChange(()=>this.layout())),y.addDispose(y.onPartialEditWidgetListChange(A=>{var T;A.every(w=>w.isHidden)&&(this.dispose(),(T=this.inlineContentWidget)===null||T===void 0||T.dispose())}));const S=y.onDispose(()=>{this.dispose(),S.dispose()});this.addDispose(y)}createNode(){const y=this.injector.get(u.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(u.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 T=this.getPosition();if(T&&this.inlineContentWidget){const w=(S=this.node)===null||S===void 0?void 0:S.livePreviewDiffDecorationModel.getRemovedWidgets();if(w?.length){const D=T.lineNumber,I=w[0];if(I&&((A=I.getLastPosition())===null||A===void 0?void 0:A.lineNumber)<=D){const P=this.inlineContentWidget.getLineHeight(),R=I.height;this.inlineContentWidget.setOffsetTop(-P*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(u.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 T=(S=this.node)===null||S===void 0?void 0:S.recompute(u.EComputerMode.legacy,this.formatIndentation(y));T&&((A=this.node)===null||A===void 0||A.finallyRender(T))}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:(L,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)),_=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},u=r.default.memo(v=>{const{range:f,onMaxLineCount:a,editor:b,onReady:y}=v,S=(0,E.useInjectable)(E.MonacoService),A=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!f)return;const T=b.getModel();if(!T)return;const w=T.getValueInRange(f),D=S.createDiffEditor(A.current,{...h,lineDecorationsWidth:b.getLayoutInfo().decorationsWidth,lineNumbersMinChars:b.getOption(p.editor.EditorOption.lineNumbersMinChars)}),I=g.StandaloneServices.get(_.IModelService),O={languageId:T.getLanguageId(),onDidChange:E.Event.None},P=I.createModel(w,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:P,modified:R}),D.revealLine(f.startLineNumber,p.editor.ScrollType.Immediate);const M=()=>{if(a){const k=P.getLineCount(),B=R.getLineCount();a(Math.max(k,B)+1)}};return y&&y({getModifiedModel:()=>R,getOriginModel:()=>P,layout:M}),M(),()=>{D&&D.dispose()}},[f,b]),r.default.createElement("div",{ref:A,className:c.default.diff_editor_widget})});let d=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(u,{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=d,n.__decorate([(0,m.Autowired)(E.AppConfig),n.__metadata("design:type",Object)],d.prototype,"configContext",void 0),t.InlineDiffWidget=d=n.__decorate([(0,m.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],d)},38890:(L,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 _ 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(_.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 d=this.previewer.onDispose(()=>{this.destroyPreviewer(),d.dispose()})}}registerInlineDiffFeature(g){const c=g.getModel();this.featureDisposable.addDispose(g.onWillChangeModel(h=>{if(!h.oldModelUrl)return;const u=h.oldModelUrl.toString();this.storeState(u),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:u}=c,d=new r.Disposable,v=this.createDiffPreviewer(g,h,c.previewerOptions),f=()=>{v.layout(),d.dispose()};return d.addDispose(v.onReady(()=>{if(E.InlineChatController.is(u)){const a=u;d.addDispose([a.onData(b=>{r.ReplyResponse.is(b)&&v.onData(b)}),a.onError(b=>{v.onError(b),f()}),a.onAbort(()=>{v.onAbort(),f()}),a.onEnd(()=>{v.onEnd(),f()})]),a.listen()}else v.setValue(u.message),f()})),v.layout(),v}createDiffPreviewer(g,c,h){const u=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineDiffPreviewMode,m.EInlineDiffPreviewMode.inlineLive);return this.destroyPreviewer(),u===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=_,_.ID="editor.contrib.ai.inline.diff"},51347:(L,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:(L,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),_=e(52416),s=e(75189),g="inline_hint_description",c="inline_hint_description_key";let h=class extends m.Disposable{constructor(d){super(),this.monacoEditor=d,this.colorRegister=(0,_.getColorRegistry)(),p.StandaloneServices.get(s.ICodeEditorService).registerDecorationType(g,c,{isWholeLine:!0}),this.addDispose(m.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(g,c,[])}))}getSequenceKeyString(d="+"){var v;const a=(v=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||v===void 0?void 0:v.resolved;return a?this.keybindingRegistry.acceleratorForSequence(a,d):""}async show(d){var v;const f=(0,m.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString("")),a=await this.themeService.getCurrentTheme(),b=this.colorRegister.resolveDefaultColor(_.inputPlaceholderForeground,a);this.monacoEditor.setDecorationsByType(g,c,[{range:E.Range.fromPositions(d),renderOptions:{after:{contentText:f,opacity:"0.5",color:(v=b?.toString())!==null&&v!==void 0?v:"",padding:"0 0 0 12px",width:"max-content",fontFamily:"-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif"}}}])}};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)(_.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:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintController=void 0;const n=e(85608),r=n.__importDefault(e(97331)),o=e(43718),l=n.__importStar(e(20868)),m=e(77659),E=e(99906),p=e(71863),_=e(74353),s=e(19520),g=e(53182);class c extends E.BaseAIMonacoEditorController{static get(u){return u.getContribution(c.ID)}get inlineCompletionsService(){return this.injector.get(p.AICompletionsService)}get inlineInputChatService(){return this.injector.get(_.InlineInputChatService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(u){const d=new o.Disposable,v=this.injector.get(m.AINativeContextKey,[u.contextKeyService]),f=()=>{d.dispose()},a=y=>{var S;const A=u.getModel();if(!A||this.inlineCompletionsService.isVisibleCompletion)return;if(!A.getLineDecorations(y.lineNumber).some(D=>D.options.description===s.InlineInputPreviewDecorationID)){const D=this.injector.get(g.InlineHintLineDecoration,[u]),I=(S=u.getModel())===null||S===void 0?void 0:S.getLineContent(y.lineNumber);I?.trim()||D.show(y),this.inlineInputChatService.setCurrentVisiblePosition(y),v.inlineHintWidgetIsVisible.set(!0),d.addDispose(D.onDispose(()=>{v.inlineHintWidgetIsVisible.set(!1)})),d.addDispose(D)}},b=(0,r.default)(async y=>{f(),a(y)},100);return this.featureDisposable.addDispose(u.onDidChangeCursorPosition(y=>{b(y.position)})),this.featureDisposable.addDispose(u.onDidChangeModelContent(y=>{var S,A;b(new l.Position((S=y.changes[0])===null||S===void 0?void 0:S.range.endLineNumber,(A=y.changes[0])===null||A===void 0?void 0:A.range.endColumn))})),this.featureDisposable.addDispose(u.onDidFocusEditorWidget(()=>{const y=u.getPosition();y&&(f(),a(y))})),this.featureDisposable.addDispose(u.onDidBlurEditorWidget(()=>{f()})),this.featureDisposable.addDispose(this.inlineCompletionsService.onVisibleCompletion(y=>{y&&f()})),this.featureDisposable.addDispose(d),this.featureDisposable}}t.InlineHintController=c,c.ID="editor.contrib.ai.inline.hint"},32213:(L,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),_=e(31031),s=e(26664),g=n.__importDefault(e(13185)),c=e(74353),h=d=>{const{onClose:v,onInteractiveInputSend:f,onLayoutChange:a,onChatStatus:b,onResultClick:y}=d,[S,A]=(0,r.useState)(_.EInlineChatStatus.READY);(0,r.useEffect)(()=>{const P=new m.Disposable;return P.addDispose(b(R=>A(R))),()=>{P.dispose()}},[b]);const T=(0,r.useMemo)(()=>S===_.EInlineChatStatus.THINKING,[S]),w=(0,r.useMemo)(()=>S===_.EInlineChatStatus.DONE,[S]),D=(0,r.useMemo)(()=>S===_.EInlineChatStatus.ERROR,[S]),I=(0,r.useCallback)(()=>{v?.()},[v]),O=(0,r.useCallback)(P=>{f?.(P)},[f]);return D?null:w?r.default.createElement(p.InlineResultAction,{onResultClick:y}):r.default.createElement(l.AIAction,{loadingShowOperation:!0,onClose:I,loading:T,customOperationRender:r.default.createElement(l.InteractiveInput,{autoFocus:!0,onHeightChange:P=>a(P),size:"small",placeholder:(0,m.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:T,onSend:O})})};let u=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:v=>{this.launchChatStatus(_.EInlineChatStatus.THINKING),this._onInteractiveInputValue.fire(v)},onResultClick:v=>{this._onResultClick.fire(v)}}))}};t.InlineInputChatWidget=u,n.__decorate([(0,o.Autowired)(c.InlineInputChatService),n.__metadata("design:type",c.InlineInputChatService)],u.prototype,"inlineInputChatService",void 0),t.InlineInputChatWidget=u=n.__decorate([(0,o.Injectable)({multiple:!0})],u)},89060:(L,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(41869),m=e(43718),E=r.__importStar(e(20868)),p=e(2261),_=e(52451),s=e(74547),g=e(77659),c=e(99906),h=e(85679),u=e(77633),d=e(40111),v=e(31031),f=e(19520),a=e(32213),b=r.__importDefault(e(13185)),y=e(74353);let S=n=class extends c.BaseAIMonacoEditorController{static get(T){return T.getContribution(n.ID)}get inlineInputChatService(){return this.injector.get(y.InlineInputChatService)}get inlineChatFeatureRegistry(){return this.injector.get(m.InlineChatFeatureRegistryToken)}get languageParserService(){return this.injector.get(h.LanguageParserService)}get inlineChatService(){return this.injector.get(l.IAIInlineChatService)}mount(){return this.registerInlineInputFeature(this.monacoEditor)}async doRequestReadable(T,w,D,I,O,P){const R=this.inlineChatFeatureRegistry.getInteractiveInputHandler(),M=D.getModel();if(!R||!M)return;w.launchChatStatus(v.EInlineChatStatus.THINKING);const k=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(D,T);if(k===u.ERunStrategy.EXECUTE&&R.execute){R.execute(D,T,this.token),w.launchChatStatus(v.EInlineChatStatus.DONE),P();return}if(k===u.ERunStrategy.PREVIEW&&R.providePreviewStrategy){const B=await R.providePreviewStrategy(D,T,this.token);if(m.CancelResponse.is(B)){w.launchChatStatus(v.EInlineChatStatus.READY),P();return}if(d.InlineChatController.is(B)){const x=B;let N;const j=this.registerDispose(new m.RunOnceScheduler(()=>{const K=O.getRange(0);K&&N&&M.pushEditOperations(null,[p.EditOperation.replace(K,N)],()=>null)},16*12.5));I.addDispose([x.onData(async K=>{m.ReplyResponse.is(K)&&(N=K.message,j.isScheduled()||j.schedule())}),x.onError(K=>{w.launchChatStatus(v.EInlineChatStatus.ERROR)}),x.onAbort(()=>{w.launchChatStatus(v.EInlineChatStatus.READY)}),x.onEnd(()=>{M.pushStackElement(),w.launchChatStatus(v.EInlineChatStatus.DONE)})]),x.listen()}}}registerInlineInputFeature(T){const w=new m.Disposable,D=this.injector.get(g.AINativeContextKey,[T.contextKeyService]),I=()=>{w.dispose()};this.featureDisposable.addDispose(this.inlineInputChatService.onInteractiveInputVisibleInPosition(P=>{I(),P?O(P,T):setTimeout(()=>{T.focus()},0)}));const O=async(P,R)=>{var M;this.featureDisposable.addDispose(R.onWillChangeModel(()=>{I()}));const k=R.getModel();if(!k||!R.hasTextFocus())return;const x=R.getSelection();if(x&&x.startLineNumber!==x.endLineNumber)return;const N=this.injector.get(a.InlineInputChatWidget,[R]),j=R.createDecorationsCollection();if(!!(!((M=R.getModel())===null||M===void 0)&&M.getLineContent(P.lineNumber).trim())){const z=R.getPosition(),G=R.getModel(),Y=G?.getOffsetAt(z),Z=G?.getLanguageId(),$=this.languageParserService.createParser(Z),H=await $?.findNearestCodeBlockWithPosition(G?.getValue()||"",Y);if(H){const X=new E.Selection(H.range.start.line+1,H.range.start.character,H.range.end.line+1,H.range.end.character);R.setSelection(X)}else R.setSelection(new E.Selection(P.lineNumber,1,P.lineNumber,1/0));this.inlineChatService.launchInputVisible(!0);return}j.append([{range:E.Range.fromPositions(P),options:s.ModelDecorationOptions.register({description:f.InlineInputPreviewDecorationID,isWholeLine:!0,className:b.default.input_decoration_readable_container,inlineClassName:b.default.inline_chat_inserted_range})}]);const U=j.getRange(0);let Q;U&&(Q=_.LineRange.fromRange(U),N.show({position:U.getStartPosition()})),D.inlineInputWidgetIsVisible.set(!0),w.addDispose(N.onDispose(()=>{this.cancelToken(),j.clear(),D.inlineInputWidgetIsVisible.set(!1)})),w.addDispose(N.onResultClick(async z=>{const G=()=>{const Y=j.getRange(0);k.pushStackElement(),k.pushEditOperations(null,[p.EditOperation.delete(Y)],()=>null),k.pushStackElement()};switch(z){case v.EResultKind.ACCEPT:I();break;case v.EResultKind.DISCARD:G(),I();break;case v.EResultKind.REGENERATE:G(),await this.doRequestReadable(N.interactiveInputValue,N,R,w,j,I);break;default:break}})),w.addDispose(m.Event.debounce(j.onDidChange.bind(j),()=>{},m.FRAME_THREE)(()=>{if(!j.getRange(0))return;const z=j.getRange(0),G=_.LineRange.fromRange(z);Q.equals(G)||(N.setOptions({position:z.getStartPosition()}),N.layoutContentWidget()),Q=G})),w.addDispose(N.onInteractiveInputValue(async z=>{await this.doRequestReadable(z,N,R,w,j,I)})),w.addDispose(N)};return this.featureDisposable.addDispose(w),this.featureDisposable}};t.InlineInputController=S,S.ID="editor.contrib.ai.inline.input",t.InlineInputController=S=n=r.__decorate([(0,o.Injectable)()],S)},74353:(L,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:(L,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),_=e(10438),s=e(30861),g=e(46739),c=(u,d,v=m.InfiniteTimeout.instance)=>{if(!u.length||!d.length)return m.DiffAlgorithmResult.trivial(u,d);const f=new _.Array2D(2*u.length+1,d.length+1),a=new _.Array2D(2*u.length+1,d.length+1);for(let D=0;D<=d.length;D++)f.set(0,D,D),a.set(0,D,D>0);for(let D=0;D<=2*u.length;D++)f.set(D,0,Math.floor((D+1)/2)),a.set(D,0,!1);for(let D=1;D<=d.length;D++)for(let I=1;I<=2*u.length;I++){if(!v.isValid())return m.DiffAlgorithmResult.trivialTimedOut(u,d);if(I%2===0){const O=f.get(I,D-1)+1,P=f.get(I-1,D),R=O<P;f.set(I,D,R?O:P),a.set(I,D,R)}else{const O=f.get(I-1,D)+.4,P=u.getElement(Math.floor(I/2))===d.getElement(D-1)?f.get(I-1,D-1):Number.MAX_VALUE,R=P<O;f.set(I,D,R?P:O),a.set(I,D,R)}}let b=Number.MAX_VALUE,y=-1;for(let D=0;D<=2*u.length;D++){const I=f.get(D,d.length);I<b&&(b=I,y=D)}const S=[];let A=y,T=d.length;A<=2*u.length-2&&S.push(new m.SequenceDiff(new o.OffsetRange(Math.floor((A+1)/2),u.length),new o.OffsetRange(T,T)));let w;for(;A>=0&&T>=0;)a.get(A,T)?(A%2===0?w===void 0&&(w={originalLineIndex:Math.floor(A/2),modifiedLineIndex:T}):(w!==void 0&&((w.originalLineIndex!==Math.floor(A/2)+1||w.modifiedLineIndex!==T)&&S.push(new m.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,w.originalLineIndex),new o.OffsetRange(T,w.modifiedLineIndex))),w=void 0),A-=1),T-=1):(w=w||{originalLineIndex:Math.floor((A+1)/2),modifiedLineIndex:T},A-=1);return w!==void 0&&((w.originalLineIndex!==Math.floor(A/2)+1||w.modifiedLineIndex!==T)&&S.push(new m.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,w.originalLineIndex),new o.OffsetRange(T,w.modifiedLineIndex))),w=void 0),S.reverse(),new m.DiffAlgorithmResult(S,!1)};class h extends E.DefaultLinesDiffComputer{computeDiff(d,v,f){if(d.length<=1&&(0,n.equals)(d,v,(M,k)=>M===k))return new s.LinesDiff([],[],!1);if(d.length===1&&d[0].length===0||v.length===1&&v[0].length===0)return new s.LinesDiff([new g.DetailedLineRangeMapping(new r.LineRange(1,d.length+1),new r.LineRange(1,v.length+1),[new g.RangeMapping(new l.Range(1,1,d.length,d[d.length-1].length+1),new l.Range(1,1,v.length,v[v.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=d.length*v.length<1e6&&f.onlyCareAboutPrefixOfOriginalLines,A=d.map(M=>y(S?M:M.trim())),T=v.map(M=>y(S?M:M.trim())),w=new p.LineSequence(A,d),D=new p.LineSequence(T,v),I=d.every(M=>M.trim().length===0);let O;S?I?O=m.DiffAlgorithmResult.trivial(w,D):O=c(w,D,a):w.length+D.length<1700?O=this.dynamicProgrammingDiffing.compute(w,D,a,(M,k)=>d[M]===v[k]?v[k].length===0?.1:1+Math.log(1+v[k].length):.99):O=this.myersDiffingAlgorithm.compute(w,D,a);const P=O.diffs,R=O.hitTimeout;if(S){const M=P.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(d,v,f)}}t.InlineStreamDiffComputer=h},33062:(L,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),_=e(46739),s=e(87822),g=e(25539),c=e(76755),h=e(80715);var u;(function(f){f.legacy="legacy",f.default="default"})(u||(t.EComputerMode=u={}));const d=new c.InlineStreamDiffComputer;let v=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((T,w)=>{const D=y.lineNumber+w;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:T}=a;this.setPreviewerOptions(T),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(`
|
|
28299
28299
|
`)}get onPartialEditWidgetListChange(){return this.livePreviewDiffDecorationModel.onPartialEditWidgetListChange}computeDiff(a,b,y=u.default){const S=(y===u.default?d:p.linesDiffComputers.getLegacy()).computeDiff(a,b,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1,onlyCareAboutPrefixOfOriginalLines:!0});let A=S.changes;S.hitTimeout&&(A=[new _.DetailedLineRangeMapping(new E.LineRange(1,a.length+1),new E.LineRange(1,b.length+1),void 0)]);const T=[];let w=[];for(const P of A)if(P.modified.endLineNumberExclusive===b.length+1&&y===u.default){if(w=a.slice(P.original.startLineNumber-1,P.original.endLineNumberExclusive-1),P.modified.isEmpty)continue;T.push({removedTextLines:[],removedLinesOriginalRange:new E.LineRange(P.original.startLineNumber,P.original.startLineNumber),addedRange:P.modified,relativeInnerChanges:void 0})}else T.push({removedTextLines:a.slice(P.original.startLineNumber-1,P.original.endLineNumberExclusive-1),removedLinesOriginalRange:P.original,addedRange:P.modified,relativeInnerChanges:P.innerChanges?P.innerChanges.map(R=>({originalRange:R.originalRange.delta(-P.original.startLineNumber+1),modifiedRange:R.modifiedRange.delta(-P.modified.startLineNumber+1)})):void 0});const D=[...b,...w];let I=0,O=new E.LineRange(1,1);return w.length>0&&(I=b.length+1,O=new E.LineRange(b.length+1,b.length+1+w.length)),{changes:T,newFullRangeTextLines:D,activeLine:I,pendingRange:O}}calculateAddedDecorationCollectionState(a){const b=this.getZone();return a.changes.map(S=>{const A=S.addedRange,T={lineNumber:b.startLineNumber+A.startLineNumber-1,column:1},w={lineNumber:b.startLineNumber+A.endLineNumberExclusive-2,column:1};return{startPosition:T,endPosition:w,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 T of b){const{removedTextLines:w,removedLinesOriginalRange:D,addedRange:I}=T;w.length>0&&A.push({position:{column:1,lineNumber:y.startLineNumber+D.startLineNumber-2-S},textLines:w.map((O,P)=>({text:O,lineTokens:this.rawOriginalTextLinesTokens[D.startLineNumber-1+P]}))}),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(),T=this.getZone(),w=T.startLineNumber<T.endLineNumberExclusive?new l.Range(T.startLineNumber,1,T.endLineNumberExclusive-1,this.originalModel.getLineMaxColumn(T.endLineNumberExclusive-1)):new l.Range(T.startLineNumber,1,T.startLineNumber,1),D=this.originalModel.getValueInRange(w).split(A),I=p.linesDiffComputers.getDefault().computeDiff(D,y,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1}),O=[];if(I.hitTimeout){let P=y.join(A);w.isEmpty()&&(P+=A);const R={range:w,text:P,forceMoveMarkers:!1};O.push(R)}else for(const P of I.changes){let R=y.slice(P.modified.startLineNumber-1,P.modified.endLineNumberExclusive-1).join(A),M;P.original.isEmpty?(M=new l.Range(w.startLineNumber+P.original.startLineNumber-1,1,w.startLineNumber+P.original.startLineNumber-1,1),R+=A):P.modified.isEmpty?(M=new l.Range(w.startLineNumber+P.original.startLineNumber-1,1,w.startLineNumber+P.original.endLineNumberExclusive-1,1),R=null):M=new l.Range(w.startLineNumber+P.original.startLineNumber-1,1,w.startLineNumber+P.original.endLineNumberExclusive-2,this.originalModel.getLineMaxColumn(w.startLineNumber+P.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(T.startLineNumber,T.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=u.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=v,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],v.prototype,"injector",void 0),t.InlineStreamDiffHandler=v=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],v)},22169:(L,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:(L,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:(L,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),_=e(57925),s=e(43718),g=e(52659),c=e(90052),h=e(31324),u=e(34819),d=e(24522),v=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:T,onAccept:w,onDiscard:D,editor:I}=A,[O,P]=l.default.useState(0),R=(0,l.useCallback)(()=>{w?.()},[w]),M=(0,l.useCallback)(()=>{D?.()},[D]);return(0,p.useDisposable)(()=>I.onDidScrollChange(k=>{const{scrollLeftChanged:B,scrollLeft:x}=k;B&&P(x)}),[I]),l.default.createElement("div",{className:(0,o.default)("kt-inline-diff-accept-partial-widget-container",v.default.inline_diff_accept_partial_widget_container),style:{marginLeft:O}},l.default.createElement("div",{className:v.default.content},l.default.createElement("span",{className:(0,o.default)(v.default.accept_btn,v.default.btn),onClick:R},(0,s.localize)("aiNative.inline.diff.accept"),l.default.createElement("span",null,T.acceptSequence)),l.default.createElement("span",{className:(0,o.default)(v.default.discard_btn,v.default.btn),onClick:M},(0,s.localize)("aiNative.inline.diff.reject"),l.default.createElement("span",null,T.discardSequence))))};let b=n=class extends g.ReactInlineContentWidget{constructor(T,w){super(T),this.editor=T,this.editWidgetOptions=w,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 T=this.keybindingRegistry.getKeybindingsForCommand(_.AI_INLINE_DIFF_PARTIAL_EDIT.id);if(T=T.sort((w,D)=>D.args-w.args),!(!T||T.length!==2&&T.some(w=>(0,s.isUndefined)(w.resolved))))return{acceptSequence:this.keybindingRegistry.acceleratorForSequence(T[0].resolved,"")[0],discardSequence:this.keybindingRegistry.acceleratorForSequence(T[1].resolved,"")[0]}}renderView(){var T;if(!((T=this.editWidgetOptions)===null||T===void 0)&&T.hideAcceptPartialEditWidget)return;const w=this.getSequenceKeyStrings();if(w)return l.default.createElement(a,{keyStrings:w,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 v.default.accept_partial_edit_widget_id}recordDecorationId(T){this._decorationId=T}getDecorationId(){return this._decorationId}resume(){this.status="pending",this.addedLinesCount=0,this.deletedLinesCount=0,super.resume()}setGroup(T){this._group=T}get isPending(){return this.status==="pending"}accept(T,w){this.status="accept",this.addedLinesCount=T,this.deletedLinesCount=w,super.hide()}get isAccepted(){return this.status==="accept"}discard(T,w){this.status="discard",this.addedLinesCount=T,this.deletedLinesCount=w,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:T})=>{const w=l.default.useRef(null),[D,I]=l.default.useState(0),[O,P]=l.default.useState(0);return(0,l.useEffect)(()=>{A&&w&&w.current&&w.current.appendChild(A)},[A,w]),(0,p.useDisposable)(()=>T.onDidScrollChange(R=>{const{scrollLeftChanged:M,scrollLeft:k}=R;M&&I(k)}),[T]),(0,p.useDisposable)(()=>(P(T.getOption(h.EditorOption.layoutInfo).contentLeft),T.onDidChangeConfiguration(R=>{R.hasChanged(h.EditorOption.layoutInfo)&&P(T.getOption(h.EditorOption.layoutInfo).contentLeft)})),[T]),l.default.createElement("div",{className:v.default.inline_diff_remove_zone_fixed_box,style:{marginLeft:O+"px"}},l.default.createElement("div",{className:v.default.inline_diff_remove_zone,ref:w,style:{marginLeft:-D+"px"}}))};class S extends u.ZoneWidget{get isHidden(){return this._hidden}get group(){return this._group}constructor(T,w,D){super(T,D),this.textLines=w,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 P=I.getRange(0);P&&(this._recordPosition=P.getStartPosition())}))}setGroup(T){this._group=T}_fillContainer(T){T.classList.add(v.default.inline_diff_remove_zone_widget_container),this.root=m.default.createRoot(T)}getRemovedTextLines(){return this.textLines.map(T=>T.text)}get height(){return this.textLines.length}getLastPosition(){return this.position||this._recordPosition}hide(){this._hidden=!0,super.hide()}resume(){const T=this.getLastPosition();T&&this.show(T,this.height)}show(T,w){this._hidden=!1,super.show(T,w)}revealRange(){}create(){super.create(),this.mountRender()}mountRender(){const T=document.createElement("div");(0,d.renderLines)(T,this.editor.getOption(h.EditorOption.tabIndex),this.textLines.map(({text:w,lineTokens:D})=>({content:w,decorations:[],lineTokens:D})),this.editor.getOptions()),this.root.render(l.default.createElement(y,{dom:T,editor:this.editor}))}dispose(){this.root.unmount(),super.dispose()}}t.RemovedZoneWidget=S},80715:(L,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),_=e(2261),s=e(74547),g=e(25539),c=e(77659),h=e(53617),u=e(15989),d=r.__importDefault(e(71749)),v=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 T=this.monacoEditor.getPosition(),w=this.partialEditWidgetList.filter(D=>!D.isHidden).sort((D,I)=>{var O,P,R,M;const k=((P=(O=D.getPosition())===null||O===void 0?void 0:O.position)===null||P===void 0?void 0:P.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(T.lineNumber-k),N=Math.abs(T.lineNumber-B);return x-N});w.length>0&&this.handlePartialEditAction(A?a.EPartialEdit.accept:a.EPartialEdit.discard,w[0])})),this.addedRangeDec=new h.EnhanceDecorationsCollection(this.monacoEditor),this.addDispose(this.addedRangeDec.onDidDecorationsChange(A=>{this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.get()&&this.partialEditWidgetList.forEach(w=>{const D=A.find(I=>w.getDecorationId()===I.id);if(D){const I=D.getRange();w.setOptions({position:{lineNumber:I.startLineNumber,column:1}}),w.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:T,zone:w,editStackSnapshot:D,partialEditWidgetList:I}=S;this.updateZone(w),this.addedRangeDec.set(A),this.clearRemovedWidgets(),T.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 P=this.undoRedoService.getElements(O);P.future.concat(P.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,T){const w=new E.Position(S,1),D=A.length,I=new a.RemovedZoneWidget(this.monacoEditor,A,{...T,showInHiddenAreas:!0,showFrame:!1,showArrow:!1});I.create(),this.removedZoneWidgets.push(I),T.isHidden?I.hide():I.show(w,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:d.default.inline_diff_current,zIndex:l.StackingLevel.Workbench})}])}doDiscardPartialWidget(S,A,T){let w=null,D=0,I=0;if(A&&A.length>0){const O=A.getRange();w=_.EditOperation.delete(E.Range.lift({startLineNumber:O.startLineNumber,startColumn:O.startColumn,endLineNumber:O.endLineNumber+1,endColumn:1})),D=A.length,A.hide()}if(T){const O=T.getLastPosition(),P=this.model.getEOL(),R=T.getRemovedTextLines();I=R.length;const M=R.join(P)+P;w?w=_.EditOperation.replace(E.Range.lift(w.range),M):w=_.EditOperation.insert(O.delta(1),M),T.hide()}return S.discard(D,I),w}handlePartialEditAction(S,A,T=!0,w=!1){const D=A.getPosition().position,I=this.aiReporter.getRelationId(),O=this.model,P=this.removedZoneWidgets.find($=>$.getLastPosition().lineNumber===Math.max(1,D.lineNumber-1)),R=this.addedRangeDec.getDecorationByLineNumber(D.lineNumber),M=R?.length||0,k=P?.height||0,B=new g.UndoRedoGroup;A.setGroup(B),P?.setGroup(B),R?.setGroup(B);const x=$=>$.partialEditWidgetList.find(H=>H.group===B),N=$=>$.removedZoneWidgets.find(H=>H.group===B),j=$=>$.addedRangeDec.getDecorationByGroup(B);let K;const U=P?.getRemovedTextLines().join(`
|
|
28300
28300
|
`)||"",Q=R?.getRange();Q&&(K=O.getValueInRange({...Q,endColumn:O.getLineMaxColumn(Q.endLineNumber)}));const z=$=>{w&&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($);H?.hide();const X=j($);X?.hide();const J=x($);return this.doDiscardPartialWidget(J,X,H)},G=$=>{w&&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($);H?.accept(M,k);const X=N($);X?.hide();const J=j($);J?.hide()},Y=$=>{const H=x($);H?.resume();const X=N($);X?.resume();const J=j($);J?.resume()};switch(S){case a.EPartialEdit.accept:if(G(this),T){const $=this.createEditStackElement(B);$.attachModel(this),$.registerUndo(H=>{Y(H)}),$.registerRedo(H=>{G(H)})}break;case a.EPartialEdit.discard:{const $=z(this);if($){if(T){const H=this.createEditStackElement(B);H.attachModel(this),H.registerUndo(X=>{Y(X)}),H.registerRedo(X=>{z(X)})}O.pushStackElement(),O.pushEditOperations(null,[$],()=>null,B),O.pushStackElement()}}break;default:break}const Z={uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter($=>$.isHidden).length,currentPartialEdit:{addedLinesCount:M,deletedLinesCount:k,type:S},...this.getTotalCodeInfo()};this.monacoEditor.focus(),this.inlineDiffService.firePartialEdit(Z),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,T){const w=I(S),D={added:0,deleted:0,changed:0};return S.forEach((O,P)=>{if(O.status==="pending"){const R=A[P],M=T[P],k=R?.length||0,B=M?.height||0;D.added+=k,D.deleted+=B,D.changed+=Math.max(k,B)}}),{totalAddedLinesCount:w.added,totalDeletedLinesCount:w.deleted,totalChangedLinesCount:w.changed,unresolvedAddedLinesCount:D.added,unresolvedDeletedLinesCount:D.deleted,unresolvedChangedLinesCount:D.changed};function I(O){const P={added:0,deleted:0,changed:0};return O.forEach(R=>{const M=R.addedLinesCount,k=R.deletedLinesCount;P.added+=M,P.deleted+=k,P.changed+=Math.max(M,k)}),P}}getTotalCodeInfo(){const S=this.partialEditWidgetList,A=this.addedRangeDec.getDecorations(),T=this.removedZoneWidgets;return n.computeCodeInfo(S,A,T)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(S=>{var A,T;const w=(T=(A=S.getPosition())===null||A===void 0?void 0:A.position)===null||T===void 0?void 0:T.lineNumber;if(w){const D=this.addedRangeDec.getDecorationByLineNumber(w);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 T=A.onDispose(()=>{const w=A.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(D=>D.getId()!==w),T.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 T=A.startPosition,w=A.endPosition,D=A.len;let I=E.Range.fromPositions(T,w),O=d.default.inline_diff_added_range+" ";return D===0&&(I=E.Range.fromPositions(T),O+=d.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:T,position:w})=>{this.showRemovedWidgetByLineNumber(w.lineNumber,T,{})})};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:d.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)(v.InlineStreamDiffService),r.__metadata("design:type",v.InlineStreamDiffService)],b.prototype,"inlineStreamDiffService",void 0),r.__decorate([(0,o.Autowired)(u.InlineDiffService),r.__metadata("design:type",u.InlineDiffService)],b.prototype,"inlineDiffService",void 0),t.LivePreviewDiffDecorationModel=b=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],b)},19520:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputPreviewDecorationID=void 0,t.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(L,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:(L,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)),_=e(52659),s=e(90052),g=e(77714),c=e(2261),h=e(87822),u=e(90626),d=n.__importDefault(e(32518)),v={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),T=(0,o.useRef)(null),w=(0,o.useRef)(null),[D,I]=(0,o.useState)(null),[O,P]=(0,o.useState)(0),[R,M]=(0,o.useState)(null),k=(0,o.useCallback)((j,K,U)=>{const Q=y.getModel().getEOL();let z=K.startLineNumber,G=K.startColumn;const Y=j.getModel();j.changeDecorations(ce=>{if(j){Y.getAllDecorations().map(fe=>fe.id).forEach(fe=>ce.removeDecoration(fe));for(const fe of U){if(fe.removed)continue;const Ae=fe.value.split(Q);for(let te=0;te<Ae.length;te++){const Le=Ae[te];te!==0&&(z++,G=1),fe.added&&ce.addDecoration(new p.Range(z,G,z,G+Le.length),{description:t.REWRITE_DECORATION_INLINE_ADD,className:d.default.ghost_text_decoration_inline_add}),G+=Le.length}}}});const Z=j.getOption(p.editor.EditorOption.lineHeight);j?.setScrollTop(Math.max(K.startLineNumber-1,0)*Z);const $=z-K.startLineNumber,H=j.getOption(p.editor.EditorOption.fontInfo).spaceWidth,X=j.getOption(p.editor.EditorOption.layoutInfo).contentLeft;let J=0;const re=Y.getOptions().tabSize;Array.from({length:$+1},(ce,fe)=>K.startLineNumber+fe).forEach(ce=>{const fe=Y.getLineContent(ce);let Ae=0;for(const te of fe)te===g.space?Ae+=re:Ae+=1,J=Math.max(J,Ae)}),I({width:J*H+X*2,height:Z*($+1)})},[D,y]);(0,o.useEffect)(()=>{if(y.getModel())return S&&S({getVirtualEditor:()=>R,renderVirtualEditor:(K,U,Q)=>B(K,U,Q),renderTextLineThrough:K=>x(K),layout:K=>N(K)}),()=>{R&&R.dispose(),w.current&&(0,E.runWhenIdle)(()=>{var K;(K=w.current)===null||K===void 0||K.unmount(),w.current=null})}},[y,S,R]);const B=(0,o.useCallback)((j,K,U)=>{if(!T.current)return;const Q=y.getModel();if(!Q)return;let z=R;if(!z){z=A.createCodeEditor(T.current,v);const G=u.StandaloneServices.get(h.IModelService),Y={languageId:Q.getLanguageId(),onDidChange:E.Event.None},Z=G.createModel("",Y);z.setModel(Z),M(z)}z.setValue(j),k(z,K,U)},[T,R]),x=(0,o.useCallback)(j=>{if(!T.current)return;R&&(R.dispose(),M(null));const K=({changes:U})=>{const Q=y.getOption(p.editor.EditorOption.lineHeight),z=y.getOption(p.editor.EditorOption.fontInfo).spaceWidth,G=(Z,$=d.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,r.default)(d.default.space_span,$),style:{width:`${z*Z}px`}},g.space.repeat(Z)),Y=(Z,$)=>o.default.createElement("span",{className:(0,r.default)(d.default.text_span,$)},Z);return o.default.createElement(o.default.Fragment,null,U.map((Z,$)=>{let H=!0,X="",J=0;const re=[];for(const ce of Z){const{value:fe,added:Ae,removed:te}=ce;if(te)X+=fe;else{H=!1,J+=fe.length;const Le=fe.length-fe.trimStart().length,Te=fe.length-fe.trimEnd().length,oe=fe.trim();re.push(G(Le)),oe&&(re.push(Y(oe,Ae?d.default.ghost_text_decoration_inline_add:d.default.ghost_text_decoration)),re.push(G(Te)))}}if(H){const ce=X.length-X.trimStart().length,fe=X.length-X.trimEnd().length,Ae=X.trim();re.push(G(ce,d.default.ghost_text_decoration_remove)),Ae&&(re.push(Y(Ae,d.default.ghost_text_decoration_inline_remove)),re.push(G(fe,d.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:$,className:d.default.deletions_code_line,style:{height:`${Q}px`}},re)}))};w.current&&(w.current.unmount(),w.current=null),w.current=l.default.createRoot(T.current),w.current.render(o.default.createElement(o.default.Fragment,null,j.map((U,Q)=>o.default.createElement(K,{key:Q,changes:U.changes}))))},[y,T,R,w]),N=(0,o.useCallback)(j=>{const K=y.getOption(p.editor.EditorOption.fontInfo).spaceWidth;let U=0;for(let Q=j.startLineNumber;Q<=j.endLineNumber;Q++){const z=y.getModel().getLineMaxColumn(Q);U=Math.max(U,z)}P(U*K+10)},[y]);return o.default.createElement("div",{className:d.default.rewrite_widget_container,style:{width:D?.width,height:D?.height,marginLeft:O}},o.default.createElement("div",{className:d.default.virtual_editor_container,ref:T}))});let a=class extends _.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:(L,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")},69820:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NearestCodeBlockType=void 0;var e;(function(n){n.Block="block",n.Line="line"})(e||(t.NearestCodeBlockType=e={}))},98864:(L,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(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/cli-engine",
|
|
3
|
-
"version": "3.7.1-next-
|
|
3
|
+
"version": "3.7.1-next-1736420958.0",
|
|
4
4
|
"description": "Integration engine runtime for opensumi-cli and opensumi extension",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@koa/cors": "^5.0.0",
|
|
28
28
|
"@opensumi/di": "^1.8.0",
|
|
29
|
-
"@opensumi/ide-core-browser": "3.7.1-next-
|
|
30
|
-
"@opensumi/ide-core-common": "3.7.1-next-
|
|
31
|
-
"@opensumi/ide-core-node": "3.7.1-next-
|
|
32
|
-
"@opensumi/ide-express-file-server": "3.7.1-next-
|
|
33
|
-
"@opensumi/ide-extension": "3.7.1-next-
|
|
34
|
-
"@opensumi/ide-i18n": "3.7.1-next-
|
|
35
|
-
"@opensumi/ide-main-layout": "3.7.1-next-
|
|
36
|
-
"@opensumi/ide-startup": "3.7.1-next-
|
|
29
|
+
"@opensumi/ide-core-browser": "3.7.1-next-1736420958.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.7.1-next-1736420958.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.7.1-next-1736420958.0",
|
|
32
|
+
"@opensumi/ide-express-file-server": "3.7.1-next-1736420958.0",
|
|
33
|
+
"@opensumi/ide-extension": "3.7.1-next-1736420958.0",
|
|
34
|
+
"@opensumi/ide-i18n": "3.7.1-next-1736420958.0",
|
|
35
|
+
"@opensumi/ide-main-layout": "3.7.1-next-1736420958.0",
|
|
36
|
+
"@opensumi/ide-startup": "3.7.1-next-1736420958.0",
|
|
37
37
|
"chalk": "^4.1.2",
|
|
38
38
|
"ejs": "^3.1.7",
|
|
39
39
|
"ip": "^1.1.8",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"webpack": "^5.90.0",
|
|
73
73
|
"webpack-cli": "^5.1.4"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "6b174974d4a6c58151ad9e509710b43e38e02ee8"
|
|
76
76
|
}
|