@opensumi/cli-engine 3.8.3-next-1745295840.0 → 3.8.3-next-1745309832.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 +4 -6
- package/package.json +10 -10
package/lib/browser/browser.js
CHANGED
|
@@ -9646,7 +9646,6 @@ html li {
|
|
|
9646
9646
|
cursor: pointer;
|
|
9647
9647
|
}
|
|
9648
9648
|
.SrjNIcBLAirYGWxSenBx .Wublmqkh9UZFEQSYx8wA .nXTIF2y4Ins9M1UqPgC_ {
|
|
9649
|
-
margin-left: 2px;
|
|
9650
9649
|
cursor: pointer;
|
|
9651
9650
|
}
|
|
9652
9651
|
.SrjNIcBLAirYGWxSenBx .Wublmqkh9UZFEQSYx8wA .kt-popover-title {
|
|
@@ -9747,7 +9746,7 @@ html li {
|
|
|
9747
9746
|
.SrjNIcBLAirYGWxSenBx svg path {
|
|
9748
9747
|
fill: var(--foreground);
|
|
9749
9748
|
}
|
|
9750
|
-
`,"",{version:3,sources:["webpack://./../../packages/ai-native/lib/browser/components/chat-history.module.less"],names:[],mappings:"AAAA;EACE,aAAa;EACb,mBAAmB;EACnB,8BAA8B;EAC9B,eAAe;EACf,mBAAmB;EACnB,+BAA+B;EAC/B,uBAAuB;EACvB,mBAAmB;AACrB;AACA;EACE,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,qBAAqB;EACrB,mBAAmB;AACrB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,
|
|
9749
|
+
`,"",{version:3,sources:["webpack://./../../packages/ai-native/lib/browser/components/chat-history.module.less"],names:[],mappings:"AAAA;EACE,aAAa;EACb,mBAAmB;EACnB,8BAA8B;EAC9B,eAAe;EACf,mBAAmB;EACnB,+BAA+B;EAC/B,uBAAuB;EACvB,mBAAmB;AACrB;AACA;EACE,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,qBAAqB;EACrB,mBAAmB;AACrB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,kBAAkB;AACpB;AACA;EACE,0CAA0C;EAC1C,+BAA+B;AACjC;AACA;EACE,6CAA6C;AAC/C;AACA;EACE,UAAU;AACZ;AACA;EACE,YAAY;AACd;AACA;EACE,+BAA+B;EAC/B,0CAA0C;EAC1C,kBAAkB;EAClB,kBAAkB;EAClB,4CAA4C;AAC9C;AACA;EACE,+BAA+B;EAC/B,eAAe;AACjB;AACA;EACE,8BAA8B;EAC9B,mCAAmC;EACnC,qCAAqC;EACrC,gBAAgB;EAChB,YAAY;EACZ,eAAe;EACf,kBAAkB;AACpB;AACA;EACE,+CAA+C;AACjD;AACA;EACE,yCAAyC;EACzC,YAAY;AACd;AACA;EACE,WAAW;EACX,kBAAkB;AACpB;AACA;EACE,cAAc;EACd,iBAAiB;EACjB,YAAY;EACZ,eAAe;EACf,eAAe;AACjB;AACA;EACE,YAAY;EACZ,iBAAiB;AACnB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,8BAA8B;EAC9B,eAAe;EACf,YAAY;EACZ,eAAe;EACf,kBAAkB;AACpB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,WAAW;EACX,eAAe;EACf,YAAY;AACd;AACA;EACE,gBAAgB;EAChB,uBAAuB;EACvB,qBAAqB;EACrB,mBAAmB;AACrB;AACA;EACE,aAAa;AACf;AACA;EACE,2CAA2C;AAC7C;AACA;EACE,2CAA2C;AAC7C;AACA;EACE,cAAc;AAChB;AACA;EACE,4BAA4B;AAC9B;AACA;EACE,uBAAuB;AACzB",sourcesContent:[`.chat_history_header {
|
|
9751
9750
|
display: flex;
|
|
9752
9751
|
align-items: center;
|
|
9753
9752
|
justify-content: space-between;
|
|
@@ -9779,7 +9778,6 @@ html li {
|
|
|
9779
9778
|
cursor: pointer;
|
|
9780
9779
|
}
|
|
9781
9780
|
.chat_history_header .chat_history_header_actions .chat_history_header_actions_new {
|
|
9782
|
-
margin-left: 2px;
|
|
9783
9781
|
cursor: pointer;
|
|
9784
9782
|
}
|
|
9785
9783
|
.chat_history_header .chat_history_header_actions :global .kt-popover-title {
|
|
@@ -31273,7 +31271,7 @@ Use the appropriate tools to fulfill the USER\u2019s request, ensuring all requi
|
|
|
31273
31271
|
The user's OS is ${(0,p.getOperatingSystemName)()}. The absolute path of the user's workspace is ${this.appConfig.workspaceDir}.
|
|
31274
31272
|
</user_info>`},invoke:async(f,l,b,y)=>{this.chatDeferred=new p.Deferred;const{message:A,command:S}=f;let w=A;if(S){const D=this.chatFeatureRegistry.getSlashCommandHandler(S);if(D&&D.providerPrompt){const I=this.monacoCommandRegistry.getActiveCodeEditor();w=await D.providerPrompt(A,I)}}const T=await this.aiBackService.requestStream(w,{requestId:f.requestId,sessionId:f.sessionId,history:b,images:f.images,...this.getRequestOptions()},y);return(0,s.listenReadable)(T,{onData:D=>{l(D)},onEnd:()=>{this.chatDeferred.resolve()},onError:D=>{this.messageService.error(D.message),this.aiReporter.end(f.sessionId+"_"+f.requestId,{message:D.message,success:!1,command:S})}}),await this.chatDeferred.promise,{}},provideSlashCommands:async f=>this.chatFeatureRegistry.getAllSlashCommand().map(l=>({...l,name:l.name,description:l.description||""})),provideChatWelcomeMessage:async f=>{}})),queueMicrotask(()=>{this.chatAgentService.updateAgent(n.AGENT_ID,{})})}};t.ChatProxyService=d,d.AGENT_ID="Default_Chat_Agent",r.__decorate([(0,o.Autowired)(g.IChatAgentService),r.__metadata("design:type",Object)],d.prototype,"chatAgentService",void 0),r.__decorate([(0,o.Autowired)(p.AIBackSerivcePath),r.__metadata("design:type",Object)],d.prototype,"aiBackService",void 0),r.__decorate([(0,o.Autowired)(p.ChatFeatureRegistryToken),r.__metadata("design:type",u.ChatFeatureRegistry)],d.prototype,"chatFeatureRegistry",void 0),r.__decorate([(0,o.Autowired)(m.MonacoCommandRegistry),r.__metadata("design:type",m.MonacoCommandRegistry)],d.prototype,"monacoCommandRegistry",void 0),r.__decorate([(0,o.Autowired)(p.ChatServiceToken),r.__metadata("design:type",h.ChatService)],d.prototype,"aiChatService",void 0),r.__decorate([(0,o.Autowired)(p.IAIReporter),r.__metadata("design:type",Object)],d.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(p.ChatAgentViewServiceToken),r.__metadata("design:type",Object)],d.prototype,"chatAgentViewService",void 0),r.__decorate([(0,o.Autowired)(c.PreferenceService),r.__metadata("design:type",Object)],d.prototype,"preferenceService",void 0),r.__decorate([(0,o.Autowired)(p.IApplicationService),r.__metadata("design:type",Object)],d.prototype,"applicationService",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],d.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(c.AppConfig),r.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),t.ChatProxyService=d=n=r.__decorate([(0,o.Injectable)()],d)},29770:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatService=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(63067),p=e(19413),v=e(59347);let m=class extends o.Disposable{constructor(){super(),this._onChatMessageLaunch=new o.Emitter,this.onChatMessageLaunch=this._onChatMessageLaunch.event,this._onChatReplyMessageLaunch=new o.Emitter,this.onChatReplyMessageLaunch=this._onChatReplyMessageLaunch.event,this._onChatMessageListLaunch=new o.Emitter,this.onChatMessageListLaunch=this._onChatMessageListLaunch.event,this._onScrollToBottom=new o.Emitter,this.onScrollToBottom=this._onScrollToBottom.event}showChatView(){this.mainLayoutService.toggleSlot(p.AI_CHAT_VIEW_ID,!0)}sendMessage(s){this.showChatView(),this._onChatMessageLaunch.fire(s)}clearHistoryMessages(){var s;(s=this.chatInternalService.sessionModel)===null||s===void 0||s.history.clearMessages()}sendReplyMessage(s){typeof s=="string"?this._onChatReplyMessageLaunch.fire({kind:"content",content:s}):this._onChatReplyMessageLaunch.fire(s)}sendMessageList(s){this._onChatMessageListLaunch.fire(s)}scrollToBottom(){this._onScrollToBottom.fire()}};t.ChatService=m,n.__decorate([(0,r.Autowired)(p.IChatInternalService),n.__metadata("design:type",v.ChatInternalService)],m.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(c.IMainLayoutService),n.__metadata("design:type",Object)],m.prototype,"mainLayoutService",void 0),t.ChatService=m=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],m)},11735:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(19413),p=e(42033),v=e(51081);let m=class extends o.Disposable{constructor(){super(...arguments),this.logger=(0,o.getDebugLogger)(),this.slashCommandsMap=new Map,this.slashCommandsHandlerMap=new Map,this._onDidWelcomeMessageChange=new o.Emitter,this.onDidWelcomeMessageChange=this._onDidWelcomeMessageChange.event}registerImageUploadProvider(s){this.imageUploadProvider=s}getImageUploadProvider(){return this.imageUploadProvider}dispose(){super.dispose(),this.slashCommandsMap.clear(),this.slashCommandsHandlerMap.clear()}registerWelcome(s,g){this.chatWelcomeMessageModel=new p.ChatWelcomeMessageModel(s,g),this._onDidWelcomeMessageChange.fire()}registerSlashCommand(s,g){const{name:a}=s;if(this.slashCommandsMap.has(a)){this.logger.warn(`ChatFeatureRegistry: commands name ${a} already exists`);return}this.slashCommandsMap.set(a,new p.ChatSlashCommandItemModel(s,a,v.ChatProxyService.AGENT_ID)),this.slashCommandsHandlerMap.set(a,g)}getSlashCommandHandler(s){return this.slashCommandsHandlerMap.get(s)}getSlashCommand(s){return this.slashCommandsMap.get(s)}getSlashCommandHandlerBySlashName(s){const g=this.getAllSlashCommand().find(a=>a.nameWithSlash===s);if(g)return this.getSlashCommandHandler(g.name)}getSlashCommandBySlashName(s){const g=this.getAllSlashCommand().find(a=>a.nameWithSlash===s);if(g)return this.getSlashCommand(g.name)}getAllSlashCommand(){return Array.from(this.slashCommandsMap.values())}getAllShortcutSlashCommand(){return this.getAllSlashCommand().filter(s=>s.isShortcut===!0)}parseSlashCommand(s){if(s.startsWith(c.SLASH_SYMBOL)){const g=this.getAllSlashCommand();for(const a of g){const{nameWithSlash:h}=a;if(s.startsWith(h))return{value:s.slice(h.length),nameWithSlash:h}}}return{value:s,nameWithSlash:""}}};t.ChatFeatureRegistry=m,t.ChatFeatureRegistry=m=n.__decorate([(0,r.Injectable)()],m)},59347:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInternalService=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(43718),v=e(19413),m=e(61282);let _=class extends p.Disposable{constructor(){super(...arguments),this._onChangeRequestId=new p.Emitter,this.onChangeRequestId=this._onChangeRequestId.event,this._onChangeSession=new p.Emitter,this.onChangeSession=this._onChangeSession.event,this._onCancelRequest=new p.Emitter,this.onCancelRequest=this._onCancelRequest.event,this._onWillClearSession=new p.Emitter,this.onWillClearSession=this._onWillClearSession.event,this._onRegenerateRequest=new p.Emitter,this.onRegenerateRequest=this._onRegenerateRequest.event,n.set(this,void 0)}get latestRequestId(){return this._latestRequestId}get sessionModel(){return r.__classPrivateFieldGet(this,n,"f")}init(){this.chatManagerService.onStorageInit(()=>{const g=this.chatManagerService.getSessions();g.length>0?this.activateSession(g[g.length-1].sessionId):this.createSessionModel()})}setLatestRequestId(g){this._latestRequestId=g,this._onChangeRequestId.fire(g)}createRequest(g,a,h,u){return this.chatManagerService.createRequest(r.__classPrivateFieldGet(this,n,"f").sessionId,g,a,u,h)}sendRequest(g,a=!1){const h=this.chatManagerService.sendRequest(r.__classPrivateFieldGet(this,n,"f").sessionId,g,a);return a&&this._onRegenerateRequest.fire(),h}cancelRequest(){this.chatManagerService.cancelRequest(r.__classPrivateFieldGet(this,n,"f").sessionId),this._onCancelRequest.fire()}createSessionModel(){r.__classPrivateFieldSet(this,n,this.chatManagerService.startSession(),"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}clearSessionModel(g){g=g||r.__classPrivateFieldGet(this,n,"f").sessionId,this._onWillClearSession.fire(g),this.chatManagerService.clearSession(g),g===r.__classPrivateFieldGet(this,n,"f").sessionId&&r.__classPrivateFieldSet(this,n,this.chatManagerService.startSession(),"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}getSessions(){return this.chatManagerService.getSessions()}getSession(g){return this.chatManagerService.getSession(g)}activateSession(g){const a=this.chatManagerService.getSession(g);if(!a)throw new Error(`There is no session with session id ${g}`);r.__classPrivateFieldSet(this,n,a,"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}dispose(){var g;(g=r.__classPrivateFieldGet(this,n,"f"))===null||g===void 0||g.dispose(),super.dispose()}};t.ChatInternalService=_,n=new WeakMap,r.__decorate([(0,o.Autowired)(p.AIBackSerivcePath),r.__metadata("design:type",Object)],_.prototype,"aiBackService",void 0),r.__decorate([(0,o.Autowired)(c.PreferenceService),r.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),r.__decorate([(0,o.Autowired)(v.IChatManagerService),r.__metadata("design:type",m.ChatManagerService)],_.prototype,"chatManagerService",void 0),t.ChatInternalService=_=r.__decorate([(0,o.Injectable)()],_)},70394:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatRenderRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718);let c=class extends o.Disposable{registerWelcomeRender(v){this.chatWelcomeRender=v}registerAIRoleRender(v){this.chatAIRoleRender=v}registerUserRoleRender(v){this.chatUserRoleRender=v}registerThinkingRender(v){this.chatThinkingRender=v}registerInputRender(v){this.chatInputRender=v}registerThinkingResultRender(v){this.chatThinkingResultRender=v}registerChatViewHeaderRender(v){this.chatViewHeaderRender=v}};t.ChatRenderRegistry=c,t.ChatRenderRegistry=c=n.__decorate([(0,r.Injectable)()],c)},76154:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatView=void 0,t.DefaultChatViewHeader=j;const n=e(85608),r=n.__importStar(e(14041)),o=e(68392),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(54414),s=e(63067),g=e(72665);e(41937);const a=e(51500),h=e(19413),u=e(46044),d=e(98864),E=e(87785),f=e(25834),l=n.__importDefault(e(90103)),b=e(57987),y=e(56474),A=e(49601),S=e(92635),w=e(29039),T=e(78048),D=e(86556),I=e(73974),O=e(77633),M=e(42033),R=e(51081),P=n.__importDefault(e(77256)),k="chat_scroll",F=100,L=W=>W.map(U=>{var Q;const V=((Q=U.applyResult)===null||Q===void 0?void 0:Q.diff.split(`
|
|
31275
31273
|
`).reduce(([$,Y],H)=>(H.startsWith("-")?$+=1:H.startsWith("+")&&(Y+=1),[$,Y]),[0,0]))||[];return{path:U.relativePath,additions:V[1],deletions:V[0],status:U.status}}).reduce((U,Q)=>{const V=U.find($=>$.path===Q.path);return V?(V.additions+=Q.additions,V.deletions+=Q.deletions,V.status=Q.status):U.push(Q),U},[]),B=()=>{const W=(0,c.useInjectable)(h.IChatInternalService),U=(0,c.useInjectable)(m.ChatServiceToken),Q=(0,c.useInjectable)(m.IAIReporter),V=(0,c.useInjectable)(h.IChatAgentService),$=(0,c.useInjectable)(m.ChatFeatureRegistryToken),Y=(0,c.useInjectable)(m.ChatRenderRegistryToken),H=(0,c.useInjectable)(O.TokenMCPServerRegistry),z=(0,c.useInjectable)(c.AINativeConfigService),K=(0,c.useInjectable)(u.LLMContextServiceToken),Z=(0,c.useInjectable)(s.IMainLayoutService),X=W.sessionModel.history,ie=r.useRef(null),oe=r.useRef(!0),le=r.useRef(null),pe=(0,c.useInjectable)(_.WorkbenchEditorService),q=(0,c.useInjectable)(c.AppConfig),Ee=(0,c.useInjectable)(I.BaseApplyService),_e=(0,c.useInjectable)(c.LabelService),ne=(0,c.useInjectable)(a.IWorkspaceService),ge=(0,c.useInjectable)(m.CommandService),[we,Pe]=r.useState([]),[Ae,Te]=r.useState(W.sessionModel.modelId),[be,me]=r.useState(L(Ee.getSessionCodeBlocks())),[xe,Re]=r.useReducer((We,je)=>{switch(je.type){case"add":return[...We,...je.payload||[]];case"clear":return[];case"init":return Array.isArray(je.payload)?je.payload:[];default:return We}},[]),[Ne,fe]=r.useState(!1),[re,he]=r.useState(""),[Oe,De]=r.useState(""),[Fe,Ge]=r.useState(""),[Ve,gt]=r.useState(null);r.useEffect(()=>{Te(W.sessionModel.modelId)},[Ne,W.sessionModel]),r.useEffect(()=>{const We=new m.Disposable,je=()=>{const Ze=L(Ee.getSessionCodeBlocks());me(Ze)};return We.addDispose(W.onChangeSession(je)),We.addDispose(Ee.onCodeBlockUpdate(je)),()=>We.dispose()},[]),r.useEffect(()=>{const We=$.getAllShortcutSlashCommand(),je=V.onDidChangeAgents(()=>{const Ze=V.getCommands().filter(Qt=>Qt.isShortcut).map(Qt=>new M.ChatSlashCommandItemModel({icon:"",name:`${Qt.name} `,description:Qt.description,isShortcut:Qt.isShortcut},Qt.name,Qt.agentId));Pe(We.concat(Ze))});return Pe(We),()=>je.dispose()},[$,V]),(0,c.useUpdateOnEvent)(W.onChangeSession);const rt=r.useMemo(()=>Y.chatInputRender?Y.chatInputRender:z.capabilities.supportsMCP?A.ChatMentionInput:b.ChatInput,[Y.chatInputRender]),Mt=r.useMemo(()=>(0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:"",text:r.createElement(D.WelcomeMessage,null)}),[]),lt=r.useCallback(We=>{We.deltaY<0?oe.current=!1:oe.current=!0},[oe]);r.useEffect(()=>{if(ie.current)return ie.current.addEventListener("wheel",lt),()=>{var We;(We=ie.current)===null||We===void 0||We.removeEventListener("wheel",lt)}},[oe]);const yt=r.useCallback(()=>{if(ie&&ie.current&&oe.current){const We=ie.current.lastElementChild;We&&We.scrollIntoView({behavior:"smooth",block:"end"}),ie.current.scrollHeight>ie.current.clientHeight&&ie.current.classList.add(k)}},[ie,oe]),ot=r.useCallback(We=>{Re(We),requestAnimationFrame(()=>{yt()})},[Re,yt]);r.useEffect(()=>{ot({type:"init",payload:[Mt]})},[]),r.useEffect(()=>{const We=new m.Disposable;return We.addDispose(U.onScrollToBottom(()=>{requestAnimationFrame(()=>{})})),We.addDispose(U.onChatMessageLaunch(async je=>{var Ze;if(je.immediate!==!1){if(Ne)return;await pi(je.message,je.images,je.agentId,je.command)}else je.agentId&&he(je.agentId),je.command&&Ge(je.command),(Ze=le?.current)===null||Ze===void 0||Ze.setInputValue(je.message)})),We.addDispose(U.onChatReplyMessageLaunch(je=>{if(je.kind==="content"){const Ze=Q.start(m.AIServiceType.CustomReply,{message:je.content,sessionId:W.sessionModel.sessionId});X.addAssistantMessage({content:je.content,relationId:Ze}),Ut({chunk:je.content,relationId:Ze})}else{const Ze=Q.start(m.AIServiceType.CustomReply,{message:"component#"+je.component,sessionId:W.sessionModel.sessionId});X.addAssistantMessage({componentId:je.component,componentValue:je.value,content:"",relationId:Ze}),_n({chunk:je,relationId:Ze})}})),We.addDispose(U.onChatMessageListLaunch(je=>{const Ze=[];je.forEach(Qt=>{const{role:vn}=Qt,ni=Q.start(m.AIServiceType.Chat,{message:"",sessionId:W.sessionModel.sessionId});if(vn==="assistant"){const si=Qt;Ze.push((0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:ni,text:r.createElement(S.ChatNotify,{requestId:ni,chunk:si})},P.default.chat_notify))}if(vn==="user"){const{message:si}=Qt,Mi=R.ChatProxyService.AGENT_ID,Di=Y.chatUserRoleRender,Ui=Mi===R.ChatProxyService.AGENT_ID?"":Mi;Ze.push((0,T.createMessageByUser)({id:(0,m.uuid)(6),relationId:ni,text:Di?r.createElement(Di,{content:si,agentId:Ui}):r.createElement(f.CodeBlockWrapperInput,{relationId:ni,text:si,agentId:Ui,command:Fe,labelService:_e,workspaceService:ne,commandService:ge})},P.default.chat_message_code))}}),ot({type:"add",payload:Ze}),setTimeout(yt,0)})),()=>We.dispose()},[U,Y.chatAIRoleRender,X]),r.useEffect(()=>{const We=new m.Disposable;return We.addDispose(V.onDidSendMessage(je=>{const Ze=je,Qt=Q.start(m.AIServiceType.Agent,{message:""}),vn=(0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:Qt,text:r.createElement(S.ChatNotify,{requestId:W.latestRequestId,chunk:Ze})},P.default.chat_notify);ot({type:"add",payload:[vn]})})),We.addDispose(V.onDidChangeAgents(async()=>{const je=V.getDefaultAgentId();De(je??"")})),()=>We.dispose()},[V,X,W]);const st=r.useCallback(async We=>{const{userMessage:je,relationId:Ze,requestId:Qt,render:vn,startTime:ni,command:si,agentId:Mi}=We;X.addAssistantMessage({type:"component",content:""});const Di=(0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:Ze,className:P.default.chat_with_more_actions,text:r.createElement(w.SlashCustomRender,{userMessage:je,startTime:ni,relationId:Ze,requestId:Qt,renderContent:vn,command:si,agentId:Mi})});ot({type:"add",payload:[Di]})},[ie,X]),ct=r.useCallback(async We=>{const je=Y.chatUserRoleRender,{message:Ze,images:Qt,agentId:vn,relationId:ni,command:si}=We,Mi=vn===R.ChatProxyService.AGENT_ID?"":vn,Di=(0,T.createMessageByUser)({id:(0,m.uuid)(6),relationId:ni,text:je?r.createElement(je,{content:Ze,images:Qt,agentId:Mi,command:si}):r.createElement(f.CodeBlockWrapperInput,{labelService:_e,relationId:ni,text:Ze,images:Qt,agentId:Mi,command:si,workspaceService:ne,commandService:ge})},P.default.chat_message_code);ot({type:"add",payload:[Di]})},[Y,Y.chatUserRoleRender,X,yt]),At=r.useCallback(async We=>{const{message:je,agentId:Ze,request:Qt,relationId:vn,command:ni,startTime:si,msgId:Mi}=We,Di=Ze===R.ChatProxyService.AGENT_ID?"":Ze;if(Ze===R.ChatProxyService.AGENT_ID&&ni){const Wn=$.getSlashCommandHandler(ni);if(Wn&&Wn.providerRender)return fe(!1),st({userMessage:je,render:Wn.providerRender,relationId:vn,requestId:Qt.requestId,startTime:si,agentId:Ze,command:ni})}const Ui=(0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:vn,className:P.default.chat_with_more_actions,text:r.createElement(S.ChatReply,{relationId:vn,request:Qt,startTime:si,agentId:Di,command:ni,onDidChange:()=>{yt()},history:X,onDone:()=>{fe(!1)},onRegenerate:()=>{Qt&&W.sendRequest(Qt,!0)},msgId:Mi})});ot({type:"add",payload:[Ui]})},[Y,X,yt]),Ut=r.useCallback(We=>{const{chunk:je,relationId:Ze}=We;let Qt=r.createElement(y.ChatMarkdown,{markdown:je,fillInIncompleteTokens:!0,agentId:re,command:Fe});if(Y.chatAIRoleRender){const ni=Y.chatAIRoleRender;Qt=r.createElement(ni,{content:je})}const vn=(0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:Ze,text:Qt,className:P.default.chat_with_more_actions});ot({type:"add",payload:[vn]})},[Y,X,yt]),_n=r.useCallback(We=>{const{chunk:je,relationId:Ze}=We,Qt=(0,T.createMessageByAI)({id:(0,m.uuid)(6),relationId:Ze,text:r.createElement(S.ChatNotify,{requestId:Ze,chunk:je})},P.default.chat_notify);ot({type:"add",payload:[Qt]})},[Y,X,yt]),Fn=r.useCallback(async We=>{const{message:je,images:Ze,agentId:Qt,command:vn,reportExtra:ni}=We,{actionType:si,actionSource:Mi}=ni||{},Di=W.createRequest(je,Qt,Ze,vn);if(!Di)return;fe(!0),W.setLatestRequestId(Di.requestId);const Ui=Date.now(),Wn=R.ChatProxyService.AGENT_ID===Qt?m.AIServiceType.Chat:m.AIServiceType.Agent,Sn=Q.start(vn||Wn,{agentId:Qt,userMessage:je,actionType:si,actionSource:Mi,sessionId:W.sessionModel.sessionId},600*1e3);X.addUserMessage({content:je,images:Ze||[],agentId:Qt,agentCommand:vn,relationId:Sn}),await ct({relationId:Sn,message:je,images:Ze,command:vn,agentId:Qt}),W.sendRequest(Di);const ii=X.addAssistantMessage({content:"",relationId:Sn,requestId:Di.requestId,replyStartTime:Ui});H.activeMessageInfo={messageId:ii,sessionId:W.sessionModel.sessionId},await At({startTime:Ui,relationId:Sn,message:je,agentId:Qt,command:vn,request:Di,msgId:ii})},[Y,Y.chatUserRoleRender,X,yt,Ne]),pi=r.useCallback(async(We,je,Ze,Qt)=>{var vn,ni;const si={actionSource:m.ActionSourceEnum.Chat,actionType:m.ActionTypeEnum.Send};Ze=Ze||R.ChatProxyService.AGENT_ID;let Mi=We;const Di=/\{\{@file:(.*?)\}\}/g,Ui=We.match(Di);let Wn=!1;if(Ui)for(const Ii of Ui){const ji=Ii.replace(/\{\{@file:(.*?)\}\}/,"$1");ji&&!Wn&&(Wn=!0,K.cleanFileContext());const Ai=new m.URI(ji);K.addFileToContext(Ai,void 0,!0);const dn=((vn=await ne.asRelativePath(Ai))===null||vn===void 0?void 0:vn.path)||Ai.displayName;Mi=Mi.replace(Ii,`\`<attached_file>${dn}\``)}const Sn=/\{\{@folder:(.*?)\}\}/g,ii=Mi.match(Sn);if(ii)for(const Ii of ii){const ji=Ii.replace(/\{\{@folder:(.*?)\}\}/,"$1"),Ai=new m.URI(ji);K.addFolderToContext(Ai);const dn=((ni=await ne.asRelativePath(Ai))===null||ni===void 0?void 0:ni.path)||Ai.displayName;Mi=Mi.replace(Ii,`\`<attached_folder>${dn}\``)}return Fn({message:Mi,images:je,agentId:Ze,command:Qt,reportExtra:si})},[Fn]),kn=r.useCallback(()=>{W.clearSessionModel(),U.clearHistoryMessages(),cn()},[xe]),cn=r.useCallback(()=>{var We;(We=ie?.current)===null||We===void 0||We.classList.remove(k),ot({type:"init",payload:[Mt]})},[xe]),zn=We=>{Ne||(gt(We.nameWithSlash),he(We.agentId),Ge(We.command))},mn=r.useCallback(()=>{Z.toggleSlot(h.AI_CHAT_VIEW_ID)},[Z]),Ht=Y.chatViewHeaderRender||j,pt=r.useCallback(async We=>{for(const je of X.getMessages()){if(We.isCancellationRequested)return;if(je.role===1)await ct({relationId:je.relationId,message:je.content,agentId:je.agentId,command:je.agentCommand,images:je.images});else if(je.role===2&&je.requestId){const Ze=W.sessionModel.getRequest(je.requestId);Ze&&!Ze.response.isComplete&&fe(!0),await At({msgId:je.id,relationId:je.relationId,message:je.content,agentId:je.agentId,command:je.agentCommand,startTime:je.replyStartTime,request:Ze})}else je.role===2&&je.content?await Ut({relationId:je.relationId,chunk:je.content}):je.role===2&&je.componentId&&await _n({relationId:je.relationId,chunk:{kind:"component",component:je.componentId,value:je.componentValue}})}},[At]);return r.useEffect(()=>{cn();const We=new m.CancellationTokenSource;return fe(!1),pt(We.token),()=>{We.cancel()}},[W.sessionModel]),r.createElement("div",{id:P.default.ai_chat_view},r.createElement("div",{className:P.default.header_container},r.createElement(Ht,{handleClear:kn,handleCloseChatView:mn})),r.createElement("div",{className:P.default.body_container},r.createElement("div",{className:P.default.left_bar,id:"ai_chat_left_container"},r.createElement("div",{className:P.default.chat_container,ref:ie},r.createElement(o.MessageList,{className:P.default.message_list,lockable:!0,toBottomHeight:"100%",dataSource:xe})),W.sessionModel.slicedMessageCount?r.createElement("div",{className:P.default.chat_tips_text},r.createElement("div",{className:P.default.chat_tips_container},(0,m.formatLocalize)("aiNative.chat.ai.assistant.limit.message",W.sessionModel.slicedMessageCount))):null,r.createElement("div",{className:P.default.chat_input_wrap},r.createElement("div",{className:P.default.header_operate},r.createElement("div",{className:P.default.header_operate_left},we.map(We=>r.createElement(p.Popover,{id:`ai-chat-shortcut-${We.name}`,key:`ai-chat-shortcut-${We.name}`,title:We.tooltip||We.name},r.createElement("div",{className:P.default.tag,onClick:()=>zn(We)},We.name))))),be.length>0&&r.createElement(E.FileListDisplay,{files:be,onFileClick:We=>{pe.open(m.URI.file(m.path.join(q.workspaceDir,We)))},onRejectAll:()=>{Ee.processAll("reject")},onAcceptAll:()=>{Ee.processAll("accept")}}),r.createElement(rt,{onSend:pi,disabled:Ne,enableOptions:!0,theme:Ve,setTheme:gt,agentId:re,setAgentId:he,defaultAgentId:Oe,command:Fe,setCommand:Ge,ref:le,disableModelSelector:Ae!==void 0||Ne,sessionModelId:Ae})))))};t.AIChatView=B;function j({handleClear:W,handleCloseChatView:U}){const Q=(0,c.useInjectable)(h.IChatInternalService),V=(0,c.useInjectable)(g.IMessageService),[$,Y]=r.useState([]),[H,z]=r.useState(""),K=r.useCallback(()=>{if(Q.sessionModel.history.getMessages().length>0)try{Q.createSessionModel()}catch(ie){V.error(ie.message)}},[Q]),Z=r.useCallback(ie=>{Q.activateSession(ie.id)},[Q]),X=r.useCallback(ie=>{Q.clearSessionModel(ie.id)},[Q]);return r.useEffect(()=>{const ie=()=>{const q=Q.sessionModel.history.getMessages().findLast(Ee=>Ee.role===1);z(q?(0,d.cleanAttachedTextWrapper)(q.content).slice(0,F):""),Y(Q.getSessions().map(Ee=>{const ne=Ee.history.getMessages(),ge=ne.length>0?(0,d.cleanAttachedTextWrapper)(ne[0].content).slice(0,F):"",we=ne.length>0&&ne[ne.length-1].replyStartTime||0;return{id:Ee.sessionId,title:ge,updatedAt:we,loading:!1}}))};ie();const oe=new m.DisposableCollection,le=new Set;return oe.push(Q.onChangeSession(pe=>{ie(),!le.has(pe)&&(le.add(pe),oe.push(Q.sessionModel.history.onMessageChange(()=>{ie()})))})),oe.push(Q.sessionModel.history.onMessageChange(()=>{ie()})),()=>{oe.dispose()}},[Q]),r.createElement("div",{className:P.default.header},r.createElement(l.default,{className:P.default.chat_history,currentId:Q.sessionModel.sessionId,title:H||(0,m.localize)("aiNative.chat.ai.assistant.name"),historyList:$,onNewChat:K,onHistoryItemSelect:Z,onHistoryItemDelete:X,onHistoryItemChange:()=>{}}),r.createElement(p.Popover,{overlayClassName:P.default.popover_icon,id:"ai-chat-header-clear",title:(0,m.localize)("aiNative.operate.clear.title")},r.createElement(v.EnhanceIcon,{wrapperClassName:P.default.action_btn,className:(0,c.getIcon)("clear"),onClick:W,tabIndex:0,role:"button",ariaLabel:(0,m.localize)("aiNative.operate.clear.title")})),r.createElement(p.Popover,{overlayClassName:P.default.popover_icon,id:"ai-chat-header-close",position:p.PopoverPosition.left,title:(0,m.localize)("aiNative.operate.close.title")},r.createElement(v.EnhanceIcon,{wrapperClassName:P.default.action_btn,className:(0,c.getIcon)("window-close"),onClick:U,tabIndex:0,role:"button",ariaLabel:(0,m.localize)("aiNative.operate.close.title")})))}},21967:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApplyStatus=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(97267),c=n.__importDefault(e(6960)),p=({status:v,error:m})=>{const _=()=>{switch(v){case"generating":return r.default.createElement(o.Loading,null);case"pending":return r.default.createElement(o.Popover,{title:"Pending",id:"edit-file-tool-status-pending"},r.default.createElement(o.Icon,{iconClass:"codicon codicon-circle-large"}));case"success":return r.default.createElement(o.Popover,{title:"Success",id:"edit-file-tool-status-success"},r.default.createElement(o.Icon,{iconClass:"codicon codicon-pass"}));case"failed":return r.default.createElement(o.Popover,{title:`Failed (${m||"Unknown error"})`,id:"edit-file-tool-status-failed"},r.default.createElement(o.Icon,{iconClass:"codicon codicon-error"}));case"cancelled":return r.default.createElement(o.Popover,{title:"Cancelled",id:"edit-file-tool-status-cancelled"},r.default.createElement(o.Icon,{iconClass:"codicon codicon-circle-slash",style:{color:"var(--input-placeholderForeground)"}}));default:return null}};return r.default.createElement("span",{className:c.default.status},_())};t.ApplyStatus=p},87785:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileListDisplay=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(21967),v=n.__importDefault(e(80919)),m=_=>{const{files:s,onFileClick:g,onRejectAll:a,onAcceptAll:h}=_,[u,d]=(0,r.useState)(!0),E=(0,c.useInjectable)(c.LabelService),f=(0,r.useMemo)(()=>s.map(S=>{const w=c.URI.parse(S.path),T=E.getIcon(w);return r.default.createElement("span",{className:T})}),[s]),l=s.length,b=s.reduce((S,w)=>({additions:S.additions+w.additions,deletions:S.deletions+w.deletions}),{additions:0,deletions:0}),y=()=>{d(!u)},A=(S,w)=>{const T=[];return S>0&&T.push(r.default.createElement("span",{key:"add",className:v.default.additions},"+",S)),w>0&&(T.length>0&&T.push(" "),T.push(r.default.createElement("span",{key:"del",className:v.default.deletions},"-",w))),T.length===0&&T.push(r.default.createElement("span",{key:"no-change",className:v.default.noChange},"No changes")),T};return r.default.createElement("div",{className:v.default.container},r.default.createElement("div",{className:v.default.header,onClick:y},r.default.createElement("span",{className:v.default.title},r.default.createElement("button",{className:v.default.toggleButton},u?r.default.createElement(o.Icon,{icon:"down"}):r.default.createElement(o.Icon,{icon:"right"})),"Changed Files (",l,") ",A(b.additions,b.deletions)),s.some(S=>S.status==="pending")&&r.default.createElement("div",{className:v.default.actions},r.default.createElement(o.Button,{type:"link",size:"small",onClick:S=>{S.stopPropagation(),a()}},"Reject"),r.default.createElement(o.Button,{size:"small",onClick:S=>{S.stopPropagation(),h()}},"Accept"))),r.default.createElement("ul",{className:`${v.default.fileList} ${u?"":v.default.collapsed}`},s.map((S,w)=>r.default.createElement("li",{key:w,className:v.default.fileItem,onClick:()=>g(S.path)},r.default.createElement("span",{className:v.default.fileIcon},f[w]||"\u{1F4C4}"),r.default.createElement("div",{className:v.default.fileInfo},r.default.createElement("div",{className:v.default.filePath},S.path),r.default.createElement("div",{className:v.default.fileStats},A(S.additions,S.deletions)),r.default.createElement(p.ApplyStatus,{status:S.status}))))))};t.FileListDisplay=m},25834:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeBlockWrapperInput=t.CodeBlockWrapper=t.CodeEditorWithHighlight=void 0;const n=e(85608),r=n.__importDefault(e(56005)),o=n.__importStar(e(14041)),c=n.__importDefault(e(10580)),p=e(46541),v=e(41869),m=e(81878),_=e(89195),s=e(43718),g=e(71624),a=e(9447),h=e(52416),u=n.__importDefault(e(6960)),d=e(83933),E=e(44692);e(38191);const f=A=>{const{input:S,language:w,relationId:T,agentId:D,command:I,hideInsert:O}=A,M=o.default.useRef(null),R=(0,v.useInjectable)(a.MonacoCommandRegistry),P=(0,v.useInjectable)(v.IClipboardService),k=(0,v.useInjectable)(h.IThemeService),F=(0,v.useInjectable)(s.IAIReporter),[L,B]=(0,o.useState)(!1),j=(0,o.useMemo)(()=>(0,v.uuid)(12),[M,M.current]);(0,o.useEffect)(()=>{const Q=Y=>{Y.type==="dark"||Y.type==="hcDark"?e.e(622).then(e.bind(e,51622)):(Y.type==="light"||Y.type==="hcLight")&&e.e(412).then(e.bind(e,50412))},V=k.onThemeChange(Y=>{Q(Y)}),$=k.getCurrentThemeSync();return Q($),()=>V.dispose()},[]);const W=(0,o.useCallback)(async()=>{B(!0),await P.writeText(S),F.end(T,{copy:!0,code:S,language:w,agentId:D,command:I,actionSource:s.ActionSourceEnum.Chat,actionType:s.ActionTypeEnum.ChatCopyCode}),(0,s.runWhenIdle)(()=>{B(!1)},1e3)},[P,S,T]),U=(0,o.useCallback)(()=>{const Q=R.getActiveCodeEditor();if(Q){const V=Q.getSelection();V&&((0,g.insertSnippetWithMonacoEditor)(Q,S,[V],{undoStopBefore:!1,undoStopAfter:!1}),F.end(T,{insert:!0,code:S,language:w,agentId:D,command:I,actionSource:s.ActionSourceEnum.Chat,actionType:s.ActionTypeEnum.ChatInsertCode}))}},[R]);return o.default.createElement("div",{className:u.default.monaco_wrapper},o.default.createElement("div",{className:u.default.action_toolbar},!O&&o.default.createElement(m.Popover,{id:`ai-chat-inser-${j}`,title:(0,s.localize)("aiNative.chat.code.insert")},o.default.createElement(_.EnhanceIcon,{className:(0,v.getIcon)("insert"),onClick:()=>U(),tabIndex:0,role:"button",ariaLabel:(0,s.localize)("aiNative.chat.code.insert")})),o.default.createElement(m.Popover,{id:`ai-chat-copy-${j}`,title:(0,s.localize)(L?"aiNative.chat.code.copy.success":"aiNative.chat.code.copy")},o.default.createElement(_.EnhanceIcon,{className:(0,v.getIcon)("copy"),onClick:()=>W(),tabIndex:0,role:"button",ariaLabel:(0,s.localize)("aiNative.chat.code.copy")}))),o.default.createElement(c.default,{language:w,ref:M,className:u.default.editor},S))};t.CodeEditorWithHighlight=f;const l=({content:A="",relationId:S,renderText:w,agentId:T="",command:D="",labelService:I,commandService:O,workspaceService:M})=>{const R=/`([^`]+)`/g,P=/```([^]+?)```/g,k=/```([^]+)?/g,F=/<attached_file>(.*)/g,L=/<attached_folder>(.*)/g,B=(0,o.useCallback)(async(Q,V)=>{const $=await M?.roots;let Y;if($)for(const H of $){Y=new s.URI(H.uri).resolve(Q);try{await O?.executeCommand(v.FILE_COMMANDS.REVEAL_IN_EXPLORER.id,Y),V===E.MentionType.FILE&&await O?.executeCommand(v.EDITOR_COMMANDS.OPEN_RESOURCE.id,Y);break}catch{continue}}},[O,M]),j=(Q,V=!1,$)=>o.default.createElement("span",{className:u.default.attachment,key:$,onClick:()=>B(Q,V?E.MentionType.FOLDER:E.MentionType.FILE)},o.default.createElement(m.Icon,{iconClass:V?(0,v.getIcon)("folder"):I?.getIcon(new s.URI(Q||"file"))}),o.default.createElement("span",{className:u.default.attachment_text},Q)),W=Q=>{const V=Q.split(`
|
|
31276
|
-
`)[0].trim().toLowerCase(),$=d.highLightLanguageSupport.find(Y=>Y===V)||"plaintext";return Q=Q.replace(/.*?\n/,""),Q=Q.trim(),o.default.createElement("div",{className:u.default.code_block},o.default.createElement("div",{className:u.default.code_language},(0,r.default)($)),o.default.createElement(t.CodeEditorWithHighlight,{input:Q,language:V,relationId:S,agentId:T,command:D}))},U=(0,o.useMemo)(()=>{const Q=A.split(P),V=[];return Q.map(($,Y)=>{Y%2===0?$.split(R).map((H,z)=>{if(z%2===0){if(H.includes("```")){const K=H.split(k).filter(Boolean);if(K.length===2){V.push(K[0]),V.push(W(K[1]));return}}w?V.push(w(H)):V.push(H)}else{const K=H,Z=[...H.matchAll(F)],X=[...H.matchAll(L)];if(Z.length||X.length){let ie=0;const oe=[],le=(pe,q)=>{pe.forEach((Ee,_e)=>{if(Ee.index!==void 0){const ne=K.slice(ie,Ee.index);ne&&oe.push(o.default.createElement("span",{key:`${z}-${_e}-${q?"folder":"file"}`},ne)),oe.push(j(Ee[1],q,`${z}-tag-${_e}-${q?"folder":"file"}`)),ie=Ee.index+Ee[0].length}})};le(Z,!1),le(X,!0),oe.push(K.slice(ie)),V.push(...oe)}else V.push(o.default.createElement("span",{className:u.default.code_inline,key:z},H))}}):V.push(W($))}),V},[A,w]);return o.default.createElement(o.default.Fragment,null,U)},b=({text:A,renderText:S,relationId:w,agentId:T,labelService:D,commandService:I,workspaceService:O})=>o.default.createElement("div",{className:u.default.ai_chat_code_wrapper},o.default.createElement("div",{className:u.default.render_text},o.default.createElement(l,{content:A,labelService:D,renderText:S,relationId:w,agentId:T,commandService:I,workspaceService:O})));t.CodeBlockWrapper=b;const y=({text:A,images:S,relationId:w,agentId:T,command:D,labelService:I,workspaceService:O,commandService:M})=>{const R=(0,v.useInjectable)(s.ChatFeatureRegistryToken),[P,k]=(0,o.useState)(""),[F,L]=(0,o.useState)(A);return o.default.useEffect(()=>{const{value:B,nameWithSlash:j}=R.parseSlashCommand(A);if(j){k(j),L(B);return}else L(A)},[A,R]),o.default.createElement("div",{className:u.default.ai_chat_code_wrapper},S?.map(B=>o.default.createElement("div",{className:u.default.image_wrapper},o.default.createElement(p.Image,{src:B}))),o.default.createElement("div",{className:u.default.render_text},P&&o.default.createElement("div",{className:u.default.tag_wrapper},o.default.createElement("span",{className:u.default.tag},P)),T&&o.default.createElement("div",{className:u.default.tag,style:{marginRight:4}},"@",T),D&&o.default.createElement("div",{className:u.default.tag},"/ ",D),o.default.createElement(l,{content:F,labelService:I,relationId:w,agentId:T,command:D,workspaceService:O,commandService:M})))};t.CodeBlockWrapperInput=y},90103:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(89195),m=n.__importDefault(e(35553)),_=100,s=(0,o.memo)(({title:g,historyList:a,currentId:h,onNewChat:u,onHistoryItemSelect:d,onHistoryItemChange:E,onHistoryItemDelete:f,className:l})=>{const[b,y]=(0,o.useState)(null),[A,S]=(0,o.useState)(""),w=(0,o.useRef)(null),T=(0,o.useCallback)(W=>{S(W.target.value)},[A]),D=(0,o.useCallback)(W=>{d(W),S("")},[d,A]),I=(0,o.useCallback)(W=>{y({[W.id]:!0})},[b]),O=(0,o.useCallback)((W,U)=>{y({[W.id]:!1}),E(W,U)},[E,b]),M=(0,o.useCallback)(W=>{y({[W.id]:!1})},[b]),R=(0,o.useCallback)(()=>{u()},[u]);(0,o.useEffect)(()=>{var W;b&&((W=w.current)===null||W===void 0||W.focus({cursor:"end"}))},[b]);const P=(0,o.useCallback)(W=>{f(W)},[f]),k=(0,o.useCallback)(W=>{if(W<60*60*1e3){const Q=Math.floor(W/6e4);return Q===0?"Just now":`${Q}m ago`}else{if(W<24*60*60*1e3)return`${Math.floor(W/36e5)}h ago`;if(W<7*24*60*60*1e3)return`${Math.floor(W/864e5)}d ago`;if(W<30*24*60*60*1e3)return`${Math.floor(W/6048e5)}w ago`;if(W<365*24*60*60*1e3)return`${Math.floor(W/2592e6)}mo ago`}return`${Math.floor(W/(365*24*60*60*1e3))}y ago`},[]),F=(0,o.useCallback)(W=>{const U=new Date,Q=[];return W.forEach(V=>{const $=new Date(V.updatedAt),Y=U.getTime()-$.getTime(),H=k(Y),z=Q.find(K=>K.key===H);z?z.items.push(V):Q.push({key:H,items:[V]})}),Q},[k]),L=(0,o.useCallback)(W=>o.default.createElement("div",{key:W.id,className:(0,r.default)(m.default.chat_history_item,W.id===h?m.default.chat_history_item_selected:""),onClick:()=>D(W)},o.default.createElement("div",{className:m.default.chat_history_item_content},W.loading?o.default.createElement(c.Loading,null):o.default.createElement(c.Icon,{icon:"message",style:{width:"16px",height:"16px",marginRight:4}}),b?.[W.id]?o.default.createElement(c.Input,{className:m.default.chat_history_item_title,defaultValue:W.title,ref:w,onPressEnter:U=>{O(W,U.target.value)},onBlur:()=>M(W)}):o.default.createElement("span",{id:`chat-history-item-title-${W.id}`,className:m.default.chat_history_item_title},W.title)),o.default.createElement("div",{className:m.default.chat_history_item_actions},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default.chat_history_item_actions_delete,(0,c.getIcon)("delete")),onClick:U=>{U.preventDefault(),U.stopPropagation(),P(W)},ariaLabel:(0,p.localize)("aiNative.operate.chatHistory.delete")}))),[b,D,O,M,I,P,h,w]),B=(0,o.useCallback)(()=>{const W=a.slice(0,_).filter(Q=>Q.title&&Q.title.includes(A)),U=F(W);return o.default.createElement("div",null,o.default.createElement(c.Input,{placeholder:(0,p.localize)("aiNative.operate.chatHistory.searchPlaceholder"),className:m.default.chat_history_search,value:A,onChange:T}),o.default.createElement("div",{className:m.default.chat_history_list},U.map(Q=>o.default.createElement("div",{key:Q.key,style:{padding:"4px"}},o.default.createElement("div",{className:m.default.chat_history_time},Q.key),Q.items.map(L)))))},[a,A,F,T,L]),j=(0,o.useCallback)(W=>W.parentElement,[]);return o.default.createElement("div",{className:(0,r.default)(m.default.chat_history_header,l)},o.default.createElement("div",{className:m.default.chat_history_header_title},o.default.createElement("span",null,g)),o.default.createElement("div",{className:m.default.chat_history_header_actions},o.default.createElement(c.Popover,{id:"chat-history-header-actions-history",content:B(),trigger:c.PopoverTriggerType.click,position:c.PopoverPosition.bottomRight,title:(0,p.localize)("aiNative.operate.chatHistory.title"),getPopupContainer:j},o.default.createElement("div",{className:m.default.chat_history_header_actions_history,title:(0,p.localize)("aiNative.operate.chatHistory.title")},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default.chat_history_header_actions_history,"codicon codicon-history")}))),o.default.createElement(c.Popover,{id:"ai-chat-header-close",position:c.PopoverPosition.top,title:(0,p.localize)("aiNative.operate.newChat.title")},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default.chat_history_header_actions_new,(0,c.getIcon)("plus")),onClick:R}))))});t.default=s},57987:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInput=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(83913),_=e(43718),s=e(92323),g=e(9447),a=e(72665),h=e(19413),u=e(42033),d=e(51081),E=e(27397),f=e(30703),l=n.__importDefault(e(6960)),b=8,y=68,A=({icon:D,name:I,description:O,agentId:M,command:R,selectedAgentId:P})=>{const k=(0,o.useMemo)(()=>!P&&M&&M!==d.ChatProxyService.AGENT_ID&&R?o.default.createElement("span",{className:l.default.agent_label},"@",M):null,[]);return o.default.createElement("div",{className:l.default.block},D&&o.default.createElement(v.EnhanceIcon,{className:D}),I&&o.default.createElement("span",{className:l.default.name},I),O&&o.default.createElement("span",{className:l.default.text},O),k)},S=({onClick:D,bottom:I,trigger:O,agentId:M})=>{const R=(0,c.useInjectable)(h.IChatAgentService),P=(0,c.useInjectable)(_.ChatAgentViewServiceToken),k=(0,o.useMemo)(()=>O===h.AT_SIGN_SYMBOL?P.getRenderAgents().map(L=>new u.ChatSlashCommandItemModel({icon:"",name:`${h.AT_SIGN_SYMBOL}${L.id} `,description:L.metadata.description},"",L.id)):R.getCommands().map(L=>new u.ChatSlashCommandItemModel({icon:"",name:`${h.SLASH_SYMBOL} ${L.name} `,description:L.description},L.name,L.agentId)).filter(L=>!M||L.agentId===M),[O,R]),F=(0,o.useCallback)((L,B,j)=>{D&&D(L||"",B,j)},[D]);return k.length===0?null:o.default.createElement("div",{className:l.default.instruction_options_container,style:{bottom:I+"px"}},o.default.createElement("div",{className:l.default.options},o.default.createElement("ul",null,k.map(({icon:L,name:B,nameWithSlash:j,description:W,agentId:U,command:Q})=>o.default.createElement("li",{key:`${U||""}-${B}`,onMouseDown:()=>F(j,U,Q)},o.default.createElement(A,{icon:L,name:B,description:W,agentId:U,command:Q,selectedAgentId:M}))))))},w=({themeBlock:D})=>o.default.createElement("div",{className:l.default.theme_container},o.default.createElement("div",{className:l.default.theme_block},D)),T=({agentId:D,command:I})=>o.default.createElement("div",{className:l.default.theme_container},D!==d.ChatProxyService.AGENT_ID&&o.default.createElement("div",{className:l.default.theme_block,style:{marginRight:4}},"@",D),I&&o.default.createElement("div",{className:l.default.theme_block},h.SLASH_SYMBOL," ",I));t.ChatInput=o.default.forwardRef((D,I)=>{const{onSend:O,onValueChange:M,enableOptions:R=!1,disabled:P=!1,defaultHeight:k=32,autoFocus:F,setTheme:L,theme:B,setAgentId:j,agentId:W,defaultAgentId:U,setCommand:Q,command:V,sendBtnClassName:$}=D,Y=W||U,H=(0,o.useRef)(null),z=(0,o.useRef)(null),[K,Z]=(0,o.useState)(D.value||""),[X,ie]=(0,o.useState)(!1),[oe,le]=(0,o.useState)(k),[pe,q]=(0,o.useState)(!1),[Ee,_e]=(0,o.useState)(!1),[ne,ge]=(0,o.useState)(!1),[we,Pe]=(0,o.useState)((0,_.localize)("aiNative.chat.input.placeholder.default")),Ae=(0,c.useInjectable)(h.IChatInternalService),Te=(0,c.useInjectable)(a.IDialogService),be=(0,c.useInjectable)(c.AINativeConfigService),me=(0,c.useInjectable)(h.TokenMCPServerProxyService),xe=(0,c.useInjectable)(g.MonacoCommandRegistry),Re=(0,c.useInjectable)(h.IChatAgentService),Ne=(0,c.useInjectable)(_.ChatFeatureRegistryToken),fe=(0,c.useInjectable)(s.CommandService),re=(0,c.useLatest)(Y),he=o.default.useCallback(()=>{fe.executeCommand(E.OPEN_MCP_CONFIG_COMMAND.id)},[fe]),Oe=o.default.useCallback(async()=>{const st=await me.getAllMCPTools();Te.open({message:o.default.createElement(f.MCPToolsDialog,{tools:st}),type:_.MessageType.Empty,buttons:[(0,_.localize)("dialog.file.close")]})},[me,Te]);(0,o.useImperativeHandle)(I,()=>({setInputValue:st=>{Z(st),(0,_.runWhenIdle)(()=>{var ct;(ct=H.current)===null||ct===void 0||ct.focus()},120)}})),(0,o.useEffect)(()=>{D.value!==K&&Z(D.value||"")},[D.value]),(0,o.useEffect)(()=>{var st;(st=H.current)===null||st===void 0||st.focus();const ct=(0,_.localize)("aiNative.chat.input.placeholder.default"),At=Ne.getSlashCommandHandler(V);if(At&&At.providerInputPlaceholder){const Ut=xe.getActiveCodeEditor(),_n=At.providerInputPlaceholder(K,Ut);Pe(_n||ct)}else Pe(ct)},[Ne,V]),(0,o.useEffect)(()=>{Ve(B||"",Y,V)},[B,Y,V]),(0,o.useEffect)(()=>{var st;H&&F&&((st=H.current)===null||st===void 0||st.focus())},[H,F,D.value]),(0,o.useEffect)(()=>{if(R&&((K===h.SLASH_SYMBOL||K===h.AT_SIGN_SYMBOL&&Re.getAgents().length>0)&&!ne?ie(!0):ie(!1)),K.startsWith(h.SLASH_SYMBOL)){const{value:st,nameWithSlash:ct}=Ne.parseSlashCommand(K);if(ct){const At=Ne.getSlashCommandBySlashName(ct);Z(st),L(ct),At&&(j(At.agentId),Q(At.command));return}}if(Re.getAgents().length){const st=Re.parseMessage(K,re.current);(st.agentId||st.command)&&(L(""),Z(st.message),st.agentId&&j(st.agentId),st.command&&Q(st.command))}},[H,K,R,Ne]),(0,o.useEffect)(()=>{K||(le(k),_e(!1),ge(!1))},[K]);const De=(0,o.useCallback)(st=>{Z(st),M&&M(st)},[]),Fe=(0,o.useCallback)(()=>{Ae.cancelRequest()},[]),Ge=(0,o.useCallback)(async()=>{if(P)return;const st=(ct=K)=>{O(ct,[],Y,V),Z(""),L(""),j(""),Q("")};if(V){const ct=Ne.getSlashCommandHandler(V);if(ct&&ct.execute){const At=xe.getActiveCodeEditor();await ct.execute(K,Ut=>st(Ut),At);return}}st()},[O,K,Y,V,Ne]),Ve=(0,o.useCallback)((st,ct,At)=>{if(ct){if(ie(!1),L(""),j(ct),Q(At||""),H?.current){const Ut=H.current.value;(Ut===h.AT_SIGN_SYMBOL||At&&Ut===h.SLASH_SYMBOL)&&Z(""),(0,_.runWhenIdle)(()=>H.current.focus())}}else if(st){ie(!1),j(""),Q("");const Ut=Ne.getSlashCommandBySlashName(st);if(L(Ut?Ut.nameWithSlash:""),H&&H.current){const _n=H.current.value;_n.length===1&&_n.startsWith(h.SLASH_SYMBOL)&&Z(""),(0,_.runWhenIdle)(()=>H.current.focus())}}},[H,Ne]),gt=(0,o.useMemo)(()=>{const st=b+oe;return ne&&ie(!1),st},[oe]),rt=st=>{var ct,At;if(st.key==="Backspace"&&((ct=H.current)===null||ct===void 0?void 0:ct.selectionEnd)===0&&((At=H.current)===null||At===void 0?void 0:At.selectionStart)===0){if(L(""),Y===d.ChatProxyService.AGENT_ID){Q(""),j("");return}Y&&(V?Q(""):j(""))}},Mt=(0,o.useCallback)(st=>{le(st),st>y?_e(!0):_e(!1)},[]),lt=(0,o.useCallback)(()=>{q(!1),ie(!1)},[H]),yt=(0,o.useCallback)(()=>{q(!0)},[H]),ot=(0,o.useCallback)(()=>{const st=ne;if(ge(!st),st)le(k),_e(!1);else{const At=document.querySelector("#ai_chat_left_container").clientHeight-68-(B?32:0)-16;le(At)}},[ne]);return o.default.createElement("div",{className:(0,r.default)(l.default.chat_input_container,pe?l.default.active:null)},X&&o.default.createElement("div",{ref:z},o.default.createElement(S,{onClick:Ve,bottom:gt,trigger:K,agentId:Y})),B&&o.default.createElement(w,{themeBlock:B}),Y&&o.default.createElement(T,{agentId:Y,command:V}),Ee&&o.default.createElement("div",{className:l.default.expand_icon,onClick:()=>ot()},o.default.createElement(p.Popover,{id:"ai_chat_input_expand",title:(0,_.localize)(ne?"aiNative.chat.expand.unfullscreen":"aiNative.chat.expand.fullescreen")},o.default.createElement(p.Icon,{className:(0,r.default)(ne?(0,p.getIcon)("unfullscreen"):(0,p.getIcon)("fullescreen"))}))),o.default.createElement(m.InteractiveInput,{ref:H,placeholder:we,value:K,onKeyDown:rt,onBlur:lt,onFocus:yt,onValueChange:De,disabled:P,className:l.default.input_wrapper,onSend:Ge,onStop:Fe,sendBtnClassName:$,onHeightChange:Mt,height:oe,popoverPosition:p.PopoverPosition.left}),o.default.createElement("div",{className:l.default.chat_input_footer},be.capabilities.supportsMCP&&o.default.createElement("div",{className:l.default.mcp_desc},o.default.createElement(p.Popover,{overlayClassName:l.default.popover_icon,id:"ai-chat-header-mcp-server",position:p.PopoverPosition.left,title:"MCP Server"},o.default.createElement(v.EnhanceIcon,{wrapperClassName:l.default.action_btn,className:"codicon codicon-radio-tower",onClick:he,tabIndex:0,role:"button",ariaLabel:"MCP Server"})),o.default.createElement(p.Popover,{overlayClassName:l.default.popover_icon,id:"ai-chat-header-tools",position:p.PopoverPosition.left,title:(0,_.localize)("aiNative.operate.tools.title")},o.default.createElement(v.EnhanceIcon,{wrapperClassName:l.default.action_btn,className:(0,p.getIcon)("menubar-tool"),onClick:Oe,tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.operate.tools.title")})))))})},56474:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMarkdown=void 0,t.postProcessCodeBlockLanguageId=a,t.fillInIncompleteTokens=h;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(13719),p=e(84605),v=e(41869),m=e(90684),_=e(25834),s=n.__importDefault(e(6960)),g=I=>{const O=(0,o.useRef)(null),M=(0,v.useInjectable)(v.AppConfig),[R,P]=(0,o.useState)(),[k,F]=(0,o.useState)();return(0,o.useEffect)(()=>{var L,B;if(!O.current)return;const W=typeof I.markdown=="string"?new m.MarkdownString(I.markdown):I.markdown,U=new c.MarkdownReactRenderer;U.code=(z,K)=>{const Z=a(K);return o.default.createElement("div",{className:s.default.code},o.default.createElement(v.ConfigProvider,{value:M},o.default.createElement("div",{className:s.default.code_block},o.default.createElement("div",{className:(0,r.default)(s.default.code_language,"language-badge")},Z),o.default.createElement(_.CodeEditorWithHighlight,{input:z,language:Z,relationId:I.relationId||"",agentId:I.agentId,command:I.command,hideInsert:I.hideInsert}))))},U.codespan=z=>o.default.createElement("code",{className:s.default.code_inline},z);const Q=new c.MarkdownReactParser({renderer:U}),V=(L=I.markedOptions)!==null&&L!==void 0?L:{};V.renderer=Q;let $=(B=W.value)!==null&&B!==void 0?B:"";$.length>1e5&&($=`${$.slice(0,1e5)}\u2026`);let Y,H;if(I.fillInIncompleteTokens){const z={...p.marked.defaults,...V},K=p.marked.lexer($,z),Z=h(K);Y=p.marked.parser(Z,z),H=Z}else{const z=p.marked.lexer($,p.marked.defaults);Y=p.marked.parser(z,V),H=z}F(H),P(Q)},[I.markdown]),o.default.createElement("div",{className:(0,r.default)(s.default.markdown_container,I.className),ref:O,tabIndex:0},k&&R&&R.parse(k))};t.ChatMarkdown=g;function a(I){if(!I)return"";const O=I.split(/[\s+|:|,|\{|\?]/,1);return O.length?O[0]:I}function h(I){let O,M;for(O=0;O<I.length;O++){const R=I[O];if(R.type==="paragraph"&&R.raw.match(/(\n|^)```/)){M=u(I.slice(O));break}if(R.type==="paragraph"&&R.raw.match(/(\n|^)\|/)){M=w(I.slice(O));break}if(R.type==="paragraph"&&O===I.length-1){const P=D(R);if(P){M=[P];break}}}if(M){const R=[...I.slice(0,O),...M];return R.links=I.links,R}return I}function u(I){const O=T(I);return p.marked.lexer(O+"\n```")}function d(I){return S(I,"`")}function E(I){return S(I,"*")}function f(I){return S(I,"_")}function l(I){return S(I,")")}function b(I){return S(I,"](about:blank)")}function y(I){return S(I,"**")}function A(I){return S(I,"__")}function S(I,O){const M=T(Array.isArray(I)?I:[I]);return p.marked.lexer(M+O)[0]}function w(I){const O=T(I),M=O.split(`
|
|
31274
|
+
`)[0].trim().toLowerCase(),$=d.highLightLanguageSupport.find(Y=>Y===V)||"plaintext";return Q=Q.replace(/.*?\n/,""),Q=Q.trim(),o.default.createElement("div",{className:u.default.code_block},o.default.createElement("div",{className:u.default.code_language},(0,r.default)($)),o.default.createElement(t.CodeEditorWithHighlight,{input:Q,language:V,relationId:S,agentId:T,command:D}))},U=(0,o.useMemo)(()=>{const Q=A.split(P),V=[];return Q.map(($,Y)=>{Y%2===0?$.split(R).map((H,z)=>{if(z%2===0){if(H.includes("```")){const K=H.split(k).filter(Boolean);if(K.length===2){V.push(K[0]),V.push(W(K[1]));return}}w?V.push(w(H)):V.push(H)}else{const K=H,Z=[...H.matchAll(F)],X=[...H.matchAll(L)];if(Z.length||X.length){let ie=0;const oe=[],le=(pe,q)=>{pe.forEach((Ee,_e)=>{if(Ee.index!==void 0){const ne=K.slice(ie,Ee.index);ne&&oe.push(o.default.createElement("span",{key:`${z}-${_e}-${q?"folder":"file"}`},ne)),oe.push(j(Ee[1],q,`${z}-tag-${_e}-${q?"folder":"file"}`)),ie=Ee.index+Ee[0].length}})};le(Z,!1),le(X,!0),oe.push(K.slice(ie)),V.push(...oe)}else V.push(o.default.createElement("span",{className:u.default.code_inline,key:z},H))}}):V.push(W($))}),V},[A,w]);return o.default.createElement(o.default.Fragment,null,U)},b=({text:A,renderText:S,relationId:w,agentId:T,labelService:D,commandService:I,workspaceService:O})=>o.default.createElement("div",{className:u.default.ai_chat_code_wrapper},o.default.createElement("div",{className:u.default.render_text},o.default.createElement(l,{content:A,labelService:D,renderText:S,relationId:w,agentId:T,commandService:I,workspaceService:O})));t.CodeBlockWrapper=b;const y=({text:A,images:S,relationId:w,agentId:T,command:D,labelService:I,workspaceService:O,commandService:M})=>{const R=(0,v.useInjectable)(s.ChatFeatureRegistryToken),[P,k]=(0,o.useState)(""),[F,L]=(0,o.useState)(A);return o.default.useEffect(()=>{const{value:B,nameWithSlash:j}=R.parseSlashCommand(A);if(j){k(j),L(B);return}else L(A)},[A,R]),o.default.createElement("div",{className:u.default.ai_chat_code_wrapper},S?.map(B=>o.default.createElement("div",{className:u.default.image_wrapper},o.default.createElement(p.Image,{src:B}))),o.default.createElement("div",{className:u.default.render_text},P&&o.default.createElement("div",{className:u.default.tag_wrapper},o.default.createElement("span",{className:u.default.tag},P)),T&&o.default.createElement("div",{className:u.default.tag,style:{marginRight:4}},"@",T),D&&o.default.createElement("div",{className:u.default.tag},"/ ",D),o.default.createElement(l,{content:F,labelService:I,relationId:w,agentId:T,command:D,workspaceService:O,commandService:M})))};t.CodeBlockWrapperInput=y},90103:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(89195),m=n.__importDefault(e(35553)),_=100,s=(0,o.memo)(({title:g,historyList:a,currentId:h,onNewChat:u,onHistoryItemSelect:d,onHistoryItemChange:E,onHistoryItemDelete:f,className:l})=>{const[b,y]=(0,o.useState)(null),[A,S]=(0,o.useState)(""),w=(0,o.useRef)(null),T=(0,o.useCallback)(W=>{S(W.target.value)},[A]),D=(0,o.useCallback)(W=>{d(W),S("")},[d,A]),I=(0,o.useCallback)(W=>{y({[W.id]:!0})},[b]),O=(0,o.useCallback)((W,U)=>{y({[W.id]:!1}),E(W,U)},[E,b]),M=(0,o.useCallback)(W=>{y({[W.id]:!1})},[b]),R=(0,o.useCallback)(()=>{u()},[u]);(0,o.useEffect)(()=>{var W;b&&((W=w.current)===null||W===void 0||W.focus({cursor:"end"}))},[b]);const P=(0,o.useCallback)(W=>{f(W)},[f]),k=(0,o.useCallback)(W=>{if(W<60*60*1e3){const Q=Math.floor(W/6e4);return Q===0?"Just now":`${Q}m ago`}else{if(W<24*60*60*1e3)return`${Math.floor(W/36e5)}h ago`;if(W<7*24*60*60*1e3)return`${Math.floor(W/864e5)}d ago`;if(W<30*24*60*60*1e3)return`${Math.floor(W/6048e5)}w ago`;if(W<365*24*60*60*1e3)return`${Math.floor(W/2592e6)}mo ago`}return`${Math.floor(W/(365*24*60*60*1e3))}y ago`},[]),F=(0,o.useCallback)(W=>{const U=new Date,Q=[];return W.forEach(V=>{const $=new Date(V.updatedAt),Y=U.getTime()-$.getTime(),H=k(Y),z=Q.find(K=>K.key===H);z?z.items.push(V):Q.push({key:H,items:[V]})}),Q},[k]),L=(0,o.useCallback)(W=>o.default.createElement("div",{key:W.id,className:(0,r.default)(m.default.chat_history_item,W.id===h?m.default.chat_history_item_selected:""),onClick:()=>D(W)},o.default.createElement("div",{className:m.default.chat_history_item_content},W.loading?o.default.createElement(c.Loading,null):o.default.createElement(c.Icon,{icon:"message",style:{width:"16px",height:"16px",marginRight:4}}),b?.[W.id]?o.default.createElement(c.Input,{className:m.default.chat_history_item_title,defaultValue:W.title,ref:w,onPressEnter:U=>{O(W,U.target.value)},onBlur:()=>M(W)}):o.default.createElement("span",{id:`chat-history-item-title-${W.id}`,className:m.default.chat_history_item_title},W.title)),o.default.createElement("div",{className:m.default.chat_history_item_actions},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default.chat_history_item_actions_delete,(0,c.getIcon)("delete")),onClick:U=>{U.preventDefault(),U.stopPropagation(),P(W)},ariaLabel:(0,p.localize)("aiNative.operate.chatHistory.delete")}))),[b,D,O,M,I,P,h,w]),B=(0,o.useCallback)(()=>{const W=a.slice(0,_).filter(Q=>Q.title&&Q.title.includes(A)),U=F(W);return o.default.createElement("div",null,o.default.createElement(c.Input,{placeholder:(0,p.localize)("aiNative.operate.chatHistory.searchPlaceholder"),className:m.default.chat_history_search,value:A,onChange:T}),o.default.createElement("div",{className:m.default.chat_history_list},U.map(Q=>o.default.createElement("div",{key:Q.key,style:{padding:"4px"}},o.default.createElement("div",{className:m.default.chat_history_time},Q.key),Q.items.map(L)))))},[a,A,F,T,L]),j=(0,o.useCallback)(W=>W.parentElement,[]);return o.default.createElement("div",{className:(0,r.default)(m.default.chat_history_header,l)},o.default.createElement("div",{className:m.default.chat_history_header_title},o.default.createElement("span",null,g)),o.default.createElement("div",{className:m.default.chat_history_header_actions},o.default.createElement(c.Popover,{id:"chat-history-header-actions-history",content:B(),trigger:c.PopoverTriggerType.click,position:c.PopoverPosition.bottomRight,title:(0,p.localize)("aiNative.operate.chatHistory.title"),getPopupContainer:j},o.default.createElement("div",{className:m.default.chat_history_header_actions_history,title:(0,p.localize)("aiNative.operate.chatHistory.title")},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default.chat_history_header_actions_history,"codicon codicon-history")}))),o.default.createElement(c.Popover,{id:"ai-chat-header-new",position:c.PopoverPosition.top,title:(0,p.localize)("aiNative.operate.newChat.title")},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default.chat_history_header_actions_new,(0,c.getIcon)("plus")),onClick:R}))))});t.default=s},57987:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInput=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(83913),_=e(43718),s=e(92323),g=e(9447),a=e(72665),h=e(19413),u=e(42033),d=e(51081),E=e(27397),f=e(30703),l=n.__importDefault(e(6960)),b=8,y=68,A=({icon:D,name:I,description:O,agentId:M,command:R,selectedAgentId:P})=>{const k=(0,o.useMemo)(()=>!P&&M&&M!==d.ChatProxyService.AGENT_ID&&R?o.default.createElement("span",{className:l.default.agent_label},"@",M):null,[]);return o.default.createElement("div",{className:l.default.block},D&&o.default.createElement(v.EnhanceIcon,{className:D}),I&&o.default.createElement("span",{className:l.default.name},I),O&&o.default.createElement("span",{className:l.default.text},O),k)},S=({onClick:D,bottom:I,trigger:O,agentId:M})=>{const R=(0,c.useInjectable)(h.IChatAgentService),P=(0,c.useInjectable)(_.ChatAgentViewServiceToken),k=(0,o.useMemo)(()=>O===h.AT_SIGN_SYMBOL?P.getRenderAgents().map(L=>new u.ChatSlashCommandItemModel({icon:"",name:`${h.AT_SIGN_SYMBOL}${L.id} `,description:L.metadata.description},"",L.id)):R.getCommands().map(L=>new u.ChatSlashCommandItemModel({icon:"",name:`${h.SLASH_SYMBOL} ${L.name} `,description:L.description},L.name,L.agentId)).filter(L=>!M||L.agentId===M),[O,R]),F=(0,o.useCallback)((L,B,j)=>{D&&D(L||"",B,j)},[D]);return k.length===0?null:o.default.createElement("div",{className:l.default.instruction_options_container,style:{bottom:I+"px"}},o.default.createElement("div",{className:l.default.options},o.default.createElement("ul",null,k.map(({icon:L,name:B,nameWithSlash:j,description:W,agentId:U,command:Q})=>o.default.createElement("li",{key:`${U||""}-${B}`,onMouseDown:()=>F(j,U,Q)},o.default.createElement(A,{icon:L,name:B,description:W,agentId:U,command:Q,selectedAgentId:M}))))))},w=({themeBlock:D})=>o.default.createElement("div",{className:l.default.theme_container},o.default.createElement("div",{className:l.default.theme_block},D)),T=({agentId:D,command:I})=>o.default.createElement("div",{className:l.default.theme_container},D!==d.ChatProxyService.AGENT_ID&&o.default.createElement("div",{className:l.default.theme_block,style:{marginRight:4}},"@",D),I&&o.default.createElement("div",{className:l.default.theme_block},h.SLASH_SYMBOL," ",I));t.ChatInput=o.default.forwardRef((D,I)=>{const{onSend:O,onValueChange:M,enableOptions:R=!1,disabled:P=!1,defaultHeight:k=32,autoFocus:F,setTheme:L,theme:B,setAgentId:j,agentId:W,defaultAgentId:U,setCommand:Q,command:V,sendBtnClassName:$}=D,Y=W||U,H=(0,o.useRef)(null),z=(0,o.useRef)(null),[K,Z]=(0,o.useState)(D.value||""),[X,ie]=(0,o.useState)(!1),[oe,le]=(0,o.useState)(k),[pe,q]=(0,o.useState)(!1),[Ee,_e]=(0,o.useState)(!1),[ne,ge]=(0,o.useState)(!1),[we,Pe]=(0,o.useState)((0,_.localize)("aiNative.chat.input.placeholder.default")),Ae=(0,c.useInjectable)(h.IChatInternalService),Te=(0,c.useInjectable)(a.IDialogService),be=(0,c.useInjectable)(c.AINativeConfigService),me=(0,c.useInjectable)(h.TokenMCPServerProxyService),xe=(0,c.useInjectable)(g.MonacoCommandRegistry),Re=(0,c.useInjectable)(h.IChatAgentService),Ne=(0,c.useInjectable)(_.ChatFeatureRegistryToken),fe=(0,c.useInjectable)(s.CommandService),re=(0,c.useLatest)(Y),he=o.default.useCallback(()=>{fe.executeCommand(E.OPEN_MCP_CONFIG_COMMAND.id)},[fe]),Oe=o.default.useCallback(async()=>{const st=await me.getAllMCPTools();Te.open({message:o.default.createElement(f.MCPToolsDialog,{tools:st}),type:_.MessageType.Empty,buttons:[(0,_.localize)("dialog.file.close")]})},[me,Te]);(0,o.useImperativeHandle)(I,()=>({setInputValue:st=>{Z(st),(0,_.runWhenIdle)(()=>{var ct;(ct=H.current)===null||ct===void 0||ct.focus()},120)}})),(0,o.useEffect)(()=>{D.value!==K&&Z(D.value||"")},[D.value]),(0,o.useEffect)(()=>{var st;(st=H.current)===null||st===void 0||st.focus();const ct=(0,_.localize)("aiNative.chat.input.placeholder.default"),At=Ne.getSlashCommandHandler(V);if(At&&At.providerInputPlaceholder){const Ut=xe.getActiveCodeEditor(),_n=At.providerInputPlaceholder(K,Ut);Pe(_n||ct)}else Pe(ct)},[Ne,V]),(0,o.useEffect)(()=>{Ve(B||"",Y,V)},[B,Y,V]),(0,o.useEffect)(()=>{var st;H&&F&&((st=H.current)===null||st===void 0||st.focus())},[H,F,D.value]),(0,o.useEffect)(()=>{if(R&&((K===h.SLASH_SYMBOL||K===h.AT_SIGN_SYMBOL&&Re.getAgents().length>0)&&!ne?ie(!0):ie(!1)),K.startsWith(h.SLASH_SYMBOL)){const{value:st,nameWithSlash:ct}=Ne.parseSlashCommand(K);if(ct){const At=Ne.getSlashCommandBySlashName(ct);Z(st),L(ct),At&&(j(At.agentId),Q(At.command));return}}if(Re.getAgents().length){const st=Re.parseMessage(K,re.current);(st.agentId||st.command)&&(L(""),Z(st.message),st.agentId&&j(st.agentId),st.command&&Q(st.command))}},[H,K,R,Ne]),(0,o.useEffect)(()=>{K||(le(k),_e(!1),ge(!1))},[K]);const De=(0,o.useCallback)(st=>{Z(st),M&&M(st)},[]),Fe=(0,o.useCallback)(()=>{Ae.cancelRequest()},[]),Ge=(0,o.useCallback)(async()=>{if(P)return;const st=(ct=K)=>{O(ct,[],Y,V),Z(""),L(""),j(""),Q("")};if(V){const ct=Ne.getSlashCommandHandler(V);if(ct&&ct.execute){const At=xe.getActiveCodeEditor();await ct.execute(K,Ut=>st(Ut),At);return}}st()},[O,K,Y,V,Ne]),Ve=(0,o.useCallback)((st,ct,At)=>{if(ct){if(ie(!1),L(""),j(ct),Q(At||""),H?.current){const Ut=H.current.value;(Ut===h.AT_SIGN_SYMBOL||At&&Ut===h.SLASH_SYMBOL)&&Z(""),(0,_.runWhenIdle)(()=>H.current.focus())}}else if(st){ie(!1),j(""),Q("");const Ut=Ne.getSlashCommandBySlashName(st);if(L(Ut?Ut.nameWithSlash:""),H&&H.current){const _n=H.current.value;_n.length===1&&_n.startsWith(h.SLASH_SYMBOL)&&Z(""),(0,_.runWhenIdle)(()=>H.current.focus())}}},[H,Ne]),gt=(0,o.useMemo)(()=>{const st=b+oe;return ne&&ie(!1),st},[oe]),rt=st=>{var ct,At;if(st.key==="Backspace"&&((ct=H.current)===null||ct===void 0?void 0:ct.selectionEnd)===0&&((At=H.current)===null||At===void 0?void 0:At.selectionStart)===0){if(L(""),Y===d.ChatProxyService.AGENT_ID){Q(""),j("");return}Y&&(V?Q(""):j(""))}},Mt=(0,o.useCallback)(st=>{le(st),st>y?_e(!0):_e(!1)},[]),lt=(0,o.useCallback)(()=>{q(!1),ie(!1)},[H]),yt=(0,o.useCallback)(()=>{q(!0)},[H]),ot=(0,o.useCallback)(()=>{const st=ne;if(ge(!st),st)le(k),_e(!1);else{const At=document.querySelector("#ai_chat_left_container").clientHeight-68-(B?32:0)-16;le(At)}},[ne]);return o.default.createElement("div",{className:(0,r.default)(l.default.chat_input_container,pe?l.default.active:null)},X&&o.default.createElement("div",{ref:z},o.default.createElement(S,{onClick:Ve,bottom:gt,trigger:K,agentId:Y})),B&&o.default.createElement(w,{themeBlock:B}),Y&&o.default.createElement(T,{agentId:Y,command:V}),Ee&&o.default.createElement("div",{className:l.default.expand_icon,onClick:()=>ot()},o.default.createElement(p.Popover,{id:"ai_chat_input_expand",title:(0,_.localize)(ne?"aiNative.chat.expand.unfullscreen":"aiNative.chat.expand.fullescreen")},o.default.createElement(p.Icon,{className:(0,r.default)(ne?(0,p.getIcon)("unfullscreen"):(0,p.getIcon)("fullescreen"))}))),o.default.createElement(m.InteractiveInput,{ref:H,placeholder:we,value:K,onKeyDown:rt,onBlur:lt,onFocus:yt,onValueChange:De,disabled:P,className:l.default.input_wrapper,onSend:Ge,onStop:Fe,sendBtnClassName:$,onHeightChange:Mt,height:oe,popoverPosition:p.PopoverPosition.left}),o.default.createElement("div",{className:l.default.chat_input_footer},be.capabilities.supportsMCP&&o.default.createElement("div",{className:l.default.mcp_desc},o.default.createElement(p.Popover,{overlayClassName:l.default.popover_icon,id:"ai-chat-header-mcp-server",position:p.PopoverPosition.left,title:"MCP Server"},o.default.createElement(v.EnhanceIcon,{wrapperClassName:l.default.action_btn,className:"codicon codicon-radio-tower",onClick:he,tabIndex:0,role:"button",ariaLabel:"MCP Server"})),o.default.createElement(p.Popover,{overlayClassName:l.default.popover_icon,id:"ai-chat-header-tools",position:p.PopoverPosition.left,title:(0,_.localize)("aiNative.operate.tools.title")},o.default.createElement(v.EnhanceIcon,{wrapperClassName:l.default.action_btn,className:(0,p.getIcon)("menubar-tool"),onClick:Oe,tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.operate.tools.title")})))))})},56474:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMarkdown=void 0,t.postProcessCodeBlockLanguageId=a,t.fillInIncompleteTokens=h;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(13719),p=e(84605),v=e(41869),m=e(90684),_=e(25834),s=n.__importDefault(e(6960)),g=I=>{const O=(0,o.useRef)(null),M=(0,v.useInjectable)(v.AppConfig),[R,P]=(0,o.useState)(),[k,F]=(0,o.useState)();return(0,o.useEffect)(()=>{var L,B;if(!O.current)return;const W=typeof I.markdown=="string"?new m.MarkdownString(I.markdown):I.markdown,U=new c.MarkdownReactRenderer;U.code=(z,K)=>{const Z=a(K);return o.default.createElement("div",{className:s.default.code},o.default.createElement(v.ConfigProvider,{value:M},o.default.createElement("div",{className:s.default.code_block},o.default.createElement("div",{className:(0,r.default)(s.default.code_language,"language-badge")},Z),o.default.createElement(_.CodeEditorWithHighlight,{input:z,language:Z,relationId:I.relationId||"",agentId:I.agentId,command:I.command,hideInsert:I.hideInsert}))))},U.codespan=z=>o.default.createElement("code",{className:s.default.code_inline},z);const Q=new c.MarkdownReactParser({renderer:U}),V=(L=I.markedOptions)!==null&&L!==void 0?L:{};V.renderer=Q;let $=(B=W.value)!==null&&B!==void 0?B:"";$.length>1e5&&($=`${$.slice(0,1e5)}\u2026`);let Y,H;if(I.fillInIncompleteTokens){const z={...p.marked.defaults,...V},K=p.marked.lexer($,z),Z=h(K);Y=p.marked.parser(Z,z),H=Z}else{const z=p.marked.lexer($,p.marked.defaults);Y=p.marked.parser(z,V),H=z}F(H),P(Q)},[I.markdown]),o.default.createElement("div",{className:(0,r.default)(s.default.markdown_container,I.className),ref:O,tabIndex:0},k&&R&&R.parse(k))};t.ChatMarkdown=g;function a(I){if(!I)return"";const O=I.split(/[\s+|:|,|\{|\?]/,1);return O.length?O[0]:I}function h(I){let O,M;for(O=0;O<I.length;O++){const R=I[O];if(R.type==="paragraph"&&R.raw.match(/(\n|^)```/)){M=u(I.slice(O));break}if(R.type==="paragraph"&&R.raw.match(/(\n|^)\|/)){M=w(I.slice(O));break}if(R.type==="paragraph"&&O===I.length-1){const P=D(R);if(P){M=[P];break}}}if(M){const R=[...I.slice(0,O),...M];return R.links=I.links,R}return I}function u(I){const O=T(I);return p.marked.lexer(O+"\n```")}function d(I){return S(I,"`")}function E(I){return S(I,"*")}function f(I){return S(I,"_")}function l(I){return S(I,")")}function b(I){return S(I,"](about:blank)")}function y(I){return S(I,"**")}function A(I){return S(I,"__")}function S(I,O){const M=T(Array.isArray(I)?I:[I]);return p.marked.lexer(M+O)[0]}function w(I){const O=T(I),M=O.split(`
|
|
31277
31275
|
`);let R=0,P=!1;for(let k=0;k<M.length;k++){const F=M[k].trim();if(typeof R>"u"&&F.match(/^\s*\|/)){const L=F.match(/(\|[^\|]+)(?=\||$)/g);L&&(R=L.length)}else if(typeof R=="number")if(F.match(/^\s*\|/)&&k===M.length-1)P=!0;else return}if(R>0){const k=P?M.slice(0,-1).join(`
|
|
31278
31276
|
`):O,F=!!k.match(/\|\s*$/),L=k+(F?"":"|")+`
|
|
31279
31277
|
|${" --- |".repeat(R)}`;return p.marked.lexer(L)}}function T(I){return I.reduce((O,M)=>O+M.raw,"")}function D(I){for(const{type:O,raw:M}of I.tokens){if(O!=="text")continue;const R=M.split(`
|
|
@@ -31630,7 +31628,7 @@ Tokenizing line: ${O}`);for(let W=0;W<B.tokens.length;W++){const U=B.tokens[W];j
|
|
|
31630
31628
|
|
|
31631
31629
|
`),this}appendMarkdown(s){return this.value+=s,this}appendCodeblock(s,g){return this.value+="\n```",this.value+=s,this.value+=`
|
|
31632
31630
|
`,this.value+=g,this.value+="\n```\n",this}}t.MarkdownString=p;function v(_){return _ instanceof p?!0:_&&typeof _=="object"?typeof _.value=="string"&&(typeof _.isTrusted=="boolean"||_.isTrusted===void 0)&&(typeof _.supportThemeIcons=="boolean"||_.supportThemeIcons===void 0):!1}function m(_){const s=[],g=_.split("|").map(h=>h.trim());_=g[0];const a=g[1];if(a){const h=/height=(\d+)/.exec(a),u=/width=(\d+)/.exec(a),d=h?h[1]:"",E=u?u[1]:"",f=isFinite(parseInt(E,10)),l=isFinite(parseInt(d,10));f&&s.push(`width="${E}"`),l&&s.push(`height="${d}"`)}return{href:_,dimensions:s}}},53886:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(84811),t),n.__exportStar(e(38677),t),n.__exportStar(e(32112),t),n.__exportStar(e(58063),t),n.__exportStar(e(3484),t),n.__exportStar(e(84569),t),n.__exportStar(e(92771),t),n.__exportStar(e(87330),t),n.__exportStar(e(37070),t),n.__exportStar(e(32504),t),n.__exportStar(e(78941),t),n.__exportStar(e(69403),t)},32112:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},69403:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerLane=void 0;var e;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=4]="Right",n[n.Full=7]="Full"})(e||(t.OverviewRulerLane=e={}))},58063:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3484:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},92771:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},51418:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},73294:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},50288:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},37846:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.knownProtocols=void 0;const n=e(11431),r=e(46147);t.knownProtocols=new Map,t.knownProtocols.set(r.ExtHostAPIIdentifier.ExtHostDocuments,n.ExtensionDocumentProtocol)},35250:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectIdentifier=void 0;var e;(function(n){n.name="$ident";function r(c,p){return Object.defineProperty(c,n.name,{value:p,enumerable:!0}),c}n.mixin=r;function o(c){return c[n.name]}n.of=o})(e||(t.ObjectIdentifier=e={}))},16363:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},70858:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isLittleEndian=p,t.encodeSemanticTokensDto=v,t.decodeSemanticTokensDto=_;function e(s){for(let g=0,a=s.length;g<a;g+=4){const h=s[g+0],u=s[g+1],d=s[g+2],E=s[g+3];s[g+0]=E,s[g+1]=d,s[g+2]=u,s[g+3]=h}}function n(s){const g=new Uint8Array(s.buffer,s.byteOffset,s.length*4);return p()||e(g),g}function r(s){const g=s;if(p()||e(g),g.byteOffset%4===0)return new Uint32Array(g.buffer,g.byteOffset,g.length/4);{const a=new Uint8Array(g.byteLength);return a.set(g),new Uint32Array(a.buffer,a.byteOffset,a.length/4)}}let o=!0,c=!1;function p(){if(!c){c=!0;const s=new Uint8Array(2);s[0]=1,s[1]=2,o=new Uint16Array(s.buffer)[0]===513}return o}function v(s){const g=new Uint32Array(m(s));let a=0;if(g[a++]=s.id,s.type==="full")g[a++]=1,g[a++]=s.data.length,g.set(s.data,a),a+=s.data.length;else{g[a++]=2,g[a++]=s.deltas.length;for(const h of s.deltas)g[a++]=h.start,g[a++]=h.deleteCount,h.data?(g[a++]=h.data.length,g.set(h.data,a),a+=h.data.length):g[a++]=0}return n(g)}function m(s){let g=0;if(g+=2,s.type==="full")g+=1+s.data.length;else{g+=1,g+=3*s.deltas.length;for(const a of s.deltas)a.data&&(g+=a.data.length)}return g}function _(s){const g=r(s);let a=0;const h=g[a++];if(g[a++]===1){const f=g[a++],l=g.subarray(a,a+f);return a+=f,{id:h,type:"full",data:l}}const d=g[a++],E=[];for(let f=0;f<d;f++){const l=g[a++],b=g[a++],y=g[a++];let A;y>0&&(A=g.subarray(a,a+y),a+=y),E[f]={start:l,deleteCount:b,data:A}}return{id:h,type:"delta",deltas:E}}},29490:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},89225:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startsWith=e,t.endsWith=n,t.isLowerAsciiLetter=r,t.isUpperAsciiLetter=o,t.equalsIgnoreCase=p,t.escapeRegExpCharacters=m,t.startsWithIgnoreCase=_;function e(s,g){if(s.length<g.length)return!1;if(s===g)return!0;for(let a=0;a<g.length;a++)if(s[a]!==g[a])return!1;return!0}function n(s,g){const a=s.length-g.length;return a>0?s.indexOf(g,a)===a:a===0?s===g:!1}function r(s){return s>=97&&s<=122}function o(s){return s>=65&&s<=90}function c(s){return r(s)||o(s)}function p(s,g){const a=s?s.length:0,h=g?g.length:0;return a!==h?!1:v(s,g)}function v(s,g,a=s.length){if(typeof s!="string"||typeof g!="string")return!1;for(let h=0;h<a;h++){const u=s.charCodeAt(h),d=g.charCodeAt(h);if(u!==d){if(c(u)&&c(d)){const E=Math.abs(u-d);if(E!==0&&E!==32)return!1}else if(String.fromCharCode(u).toLowerCase()!==String.fromCharCode(d).toLowerCase())return!1}}return!0}function m(s){return s.replace(/[-\\{}*+?|^$.[\]()#]/g,"\\$&")}function _(s,g){const a=g.length;return g.length>s.length?!1:v(s,g,a)}},54741:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskFilterDTO=void 0;var e;(function(n){function r(c){return c}n.from=r;function o(c){if(c)return Object.assign(Object.create(null),c)}n.to=o})(e||(t.TaskFilterDTO=e={}))},25535:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},54056:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TestItemRootImpl=t.TestItemImpl=t.MixedTestItemController=t.InvalidTestItemError=t.DuplicateTestItemError=t.diffTestItems=t.getPrivateApiFor=t.createPrivateApiFor=void 0;const e=new WeakMap,n=(E,f)=>{const l={controllerId:f};return e.set(E,l),l};t.createPrivateApiFor=n;const r=E=>e.get(E);t.getPrivateApiFor=r;const o=(E,f,l,b)=>{let y=l;return{enumerable:!0,configurable:!1,get(){return y},set(A){var S;if(!b(y,A)){const w=y;y=A,(S=E.listener)===null||S===void 0||S.call(E,{op:3,key:f,value:A,previous:w})}}}},c=(E,f)=>E===f,p={range:(E,f)=>E===f?!0:!E||!f?!1:E.isEqual(f),label:c,description:c,sortText:c,busy:c,error:c,canResolveChildren:c,tags:(E,f)=>!(E.length!==f.length||E.some(l=>!f.find(b=>l.id===b.id)))},v=Object.keys(p),m=(E,f)=>({range:o(E,"range",void 0,p.range),label:o(E,"label",f,p.label),description:o(E,"description",void 0,p.description),sortText:o(E,"sortText",void 0,p.sortText),canResolveChildren:o(E,"canResolveChildren",!1,p.canResolveChildren),busy:o(E,"busy",!1,p.busy),error:o(E,"error",void 0,p.error),tags:o(E,"tags",[],p.tags)}),_=(E,f)=>{const l=new Map;for(const b of v){const y=p[b];y(E[b],f[b])||l.set(b,f[b])}return l};t.diffTestItems=_;class s extends Error{constructor(f){super(`Attempted to insert a duplicate test item ID ${f}`)}}t.DuplicateTestItemError=s;class g extends Error{constructor(f){super(`TestItem with ID "${f}" is invalid. Make sure to create it from the createTestItem method.`)}}t.InvalidTestItemError=g;class a extends Error{constructor(f,l,b){super(`TestItem with ID "${f}" is from controller "${l}" and cannot be added as a child of an item from controller "${b}".`)}}t.MixedTestItemController=a;const h=E=>{const f=(0,t.getPrivateApiFor)(E);let l=new Map;return{get size(){return l.size},forEach(b,y){for(const A of l.values())b.call(y,A,this)},replace(b){var y;const A=new Map,S=new Set(l.keys()),w={op:4,ops:[]};for(const T of b){if(!(T instanceof u))throw new g(T.id);const D=(0,t.getPrivateApiFor)(T).controllerId;if(D!==f.controllerId)throw new a(T.id,D,f.controllerId);if(A.has(T.id))throw new s(T.id);A.set(T.id,T),S.delete(T.id),w.ops.push({op:0,item:T})}for(const T of S.keys())w.ops.push({op:1,id:T});(y=f.listener)===null||y===void 0||y.call(f,w),l=A},add(b){var y;if(!(b instanceof u))throw new g(b.id);l.set(b.id,b),(y=f.listener)===null||y===void 0||y.call(f,{op:0,item:b})},delete(b){var y;l.delete(b)&&((y=f.listener)===null||y===void 0||y.call(f,{op:1,id:b}))},get(b){return l.get(b)},toJSON(){return Array.from(l.values())},[Symbol.iterator](){return l.values()}}};class u{constructor(f,l,b,y){if(l.includes("\0"))throw new Error(`Test IDs may not include the ${JSON.stringify(l)} symbol`);const A=(0,t.createPrivateApiFor)(this,f);Object.defineProperties(this,{id:{value:l,enumerable:!0,writable:!1},uri:{value:y,enumerable:!0,writable:!1},parent:{enumerable:!1,get(){return A.parent instanceof d?void 0:A.parent}},children:{value:h(this),enumerable:!0,writable:!1},...m(A,b)})}invalidateResults(){var f,l;(l=(f=(0,t.getPrivateApiFor)(this)).listener)===null||l===void 0||l.call(f,{op:2})}}t.TestItemImpl=u;class d extends u{constructor(f,l){super(f,f,l,void 0)}}t.TestItemRootImpl=d},82086:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4809:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},86162:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeviewsService=t.ITreeViewsService=t.TreeViewSelection=t.TreeViewItem=t.TreeItemCheckboxState=void 0;var e;(function(c){c[c.Unchecked=0]="Unchecked",c[c.Checked=1]="Checked"})(e||(t.TreeItemCheckboxState=e={}));class n{}t.TreeViewItem=n;var r;(function(c){function p(v){return!!v&&typeof v=="object"&&"treeViewId"in v&&"treeItemId"in v}c.is=p})(r||(t.TreeViewSelection=r={})),t.ITreeViewsService=Symbol("ITreeViewsService");class o{constructor(){this._dragOperations=new Map,this._renderedElements=new Map}removeDragOperationTransfer(p){if(p&&this._dragOperations.has(p)){const v=this._dragOperations.get(p);return this._dragOperations.delete(p),v}}addDragOperationTransfer(p,v){this._dragOperations.set(p,v)}getRenderedTreeElement(p){if(this._renderedElements.has(p))return this._renderedElements.get(p)}addRenderedTreeItemElement(p,v){this._renderedElements.set(p,v)}removeRenderedTreeItemElement(p){this._renderedElements.has(p)&&this._renderedElements.delete(p)}}t.TreeviewsService=o},64945:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},43710:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObject=o,t.mixin=c,t.illegalArgument=p,t.isLocationArray=v,t.isDefinitionLinkArray=m,t.reviveRegExp=_,t.reviveIndentationRule=s,t.reviveOnEnterRule=g,t.reviveOnEnterRules=a,t.serializeEnterRules=h,t.serializeRegExp=u,t.serializeIndentation=d,t.serializeAutoClosingPairs=E;const r=e(85608).__importStar(e(51328));function o(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)&&!(f instanceof RegExp)&&!(f instanceof Date)}function c(f,l,b=!0){return o(f)?(o(l)&&Object.keys(l).forEach(y=>{y in f?b&&(o(f[y])&&o(l[y])?c(f[y],l[y],b):f[y]=l[y]):f[y]=l[y]}),f):l}function p(f){return f?new Error(`Illegal argument: ${f}`):new Error("Illegal argument")}function v(f){return Array.isArray(f)&&f.length>0&&f[0]instanceof r.Location}function m(f){return Array.isArray(f)&&f.length>0&&f[0].hasOwnProperty("targetUri")&&f[0].hasOwnProperty("targetRange")}function _(f){if(!(typeof f>"u"||f===null))return new RegExp(f.pattern,f.flags)}function s(f){if(!(typeof f>"u"||f===null))return{increaseIndentPattern:_(f.increaseIndentPattern),decreaseIndentPattern:_(f.decreaseIndentPattern),indentNextLinePattern:_(f.indentNextLinePattern),unIndentedLinePattern:_(f.unIndentedLinePattern)}}function g(f){return{beforeText:_(f.beforeText),afterText:_(f.afterText),action:f.action,previousLineText:_(f.previousLineText)}}function a(f){if(!(typeof f>"u"||f===null))return f.map(g)}function h(f){if(!(typeof f>"u"||f===null))return f.map(l=>({action:l.action,beforeText:u(l.beforeText),afterText:u(l.afterText),previousLineText:u(l.previousLineText)}))}function u(f){if(!(typeof f>"u"||f===null))return{pattern:f.source,flags:(f.global?"g":"")+(f.ignoreCase?"i":"")+(f.multiline?"m":"")}}function d(f){if(!(typeof f>"u"||f===null))return{increaseIndentPattern:u(f.increaseIndentPattern),decreaseIndentPattern:u(f.decreaseIndentPattern),indentNextLinePattern:u(f.indentNextLinePattern),unIndentedLinePattern:u(f.unIndentedLinePattern)}}function E(f){if(f)return f.map(l=>({open:l.open,close:l.close,notIn:l.notIn?l.notIn.map(b=>r.SyntaxTokenType.toString(b)):void 0}))}},96833:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},98116:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebviewViewResolverRegistrationRemovalEvent=t.WebviewViewResolverRegistrationEvent=void 0;const n=e(43718);class r extends n.BasicEvent{}t.WebviewViewResolverRegistrationEvent=r;class o extends n.BasicEvent{}t.WebviewViewResolverRegistrationRemovalEvent=o},55467:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},92622:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigurationTarget=void 0,t.reviveWorkspaceEditDto=o;const n=e(43718);var r;(function(c){c[c.Global=1]="Global",c[c.Workspace=2]="Workspace",c[c.WorkspaceFolder=3]="WorkspaceFolder"})(r||(t.ConfigurationTarget=r={}));function o(c){if(c&&c.edits)for(const p of c.edits)if(typeof p.resource=="object")p.resource=n.URI.from(p.resource),p.options={openDirtyInEditor:!0},p.textEdit=p.textEdit,p.versionId=p.versionId;else{const v=p;v.newResource=p.newResource?n.URI.from(p.newResource):void 0,v.oldResource=p.oldResource?n.URI.from(p.oldResource):void 0,v.options={...v.options,showInEditor:!1}}return c}},57646:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryEditorComponent=void 0;const r=e(85608).__importDefault(e(14041)),o=e(76003),c=e(41869),p=e(37406),v=e(57517),m=e(88819),_=s=>{const g=s.resource.uri.codeUri.fsPath,a=(0,c.useInjectable)(o.INJECTOR_TOKEN),h=(0,c.useInjectable)(c.AppConfig),u=(0,c.useInjectable)(v.WorkbenchEditorService),d=(0,c.useInjectable)(c.IEventBus),E=()=>{const l=u.currentResource;l&&(l.metadata={...l.metadata,skipPreventBinary:!0},d.fire(new v.ResourceOpenTypeChangedEvent(l.uri)))},f=[{label:(0,c.localize)("editor.file.prevent.stillOpen"),onClick:()=>E()}];return h.isElectronRenderer&&f.push({label:(0,c.localize)("editor.openExternal"),onClick:()=>a.get(p.IElectronMainUIService).openPath(g)}),r.default.createElement(m.PreventComponent,{description:(0,c.localize)("editor.cannotOpenBinary"),actions:f})};t.BinaryEditorComponent=_},60387:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WalkThroughSnippetSchemeDocumentProvider=t.VscodeSchemeDocumentProvider=t.FileSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(96405),p=e(68692),v=e(14951),m=e(80449);let _=class extends p.BaseFileSystemEditorDocumentProvider{handlesUri(h){return h.scheme===o.Schemes.file?20:-1}handlesScheme(){return!1}provideEncoding(h){return super.provideEncoding(h)}preferLanguageForUri(h){if(["settings.json"].includes(h.path.base))return"jsonc"}async saveDocumentModel(h,u,d,E,f,l=!1,b=`
|
|
31633
|
-
`,y){const A=this.hashCalculateService.calculate(d);return u.length>m.FILE_SAVE_BY_CHANGE_THRESHOLD?await this.fileSchemeDocClient.saveByChange(h.toString(),{baseMd5:A,changes:E,eol:b},f,l,y):await this.fileSchemeDocClient.saveByContent(h.toString(),{baseMd5:A,content:u},f,l,y)}async provideEditorDocumentModelContentMd5(h,u){return this.fileSchemeDocClient.getMd5(h.toString(),u)}};t.FileSchemeDocumentProvider=_,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],_.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IFileSchemeDocClient),n.__metadata("design:type",Object)],_.prototype,"fileSchemeDocClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(c.IHashCalculateService),n.__metadata("design:type",Object)],_.prototype,"hashCalculateService",void 0),t.FileSchemeDocumentProvider=_=n.__decorate([(0,r.Injectable)()],_);let s=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event,this.listeners={}}isReadonly(h){return!0}handlesScheme(h){return h==="vscode"}async provideEditorDocumentModelContent(h,u){return this.getSchemaContent(h)}getSchemaContent(h){const u=h.toString(),d=this.jsonRegistry.getSchemaContributions().schemas[u];if(d){const E=JSON.stringify(d);if(!this.listeners[u]){const f=o.Disposable.create(()=>{this.jsonRegistry.onDidChangeSchema(l=>{l===u&&this._onDidChangeContent.fire(h)})});this.listeners[u]=f}return E}return"{}"}onDidDisposeModel(h){h.toString()&&(this.listeners[h.toString()].dispose(),delete this.listeners[h.toString()])}};t.VscodeSchemeDocumentProvider=s,n.__decorate([(0,r.Autowired)(o.ISchemaStore),n.__metadata("design:type",Object)],s.prototype,"schemaStore",void 0),n.__decorate([(0,r.Autowired)(o.IJSONSchemaRegistry),n.__metadata("design:type",Object)],s.prototype,"jsonRegistry",void 0),t.VscodeSchemeDocumentProvider=s=n.__decorate([(0,r.Injectable)()],s);let g=class{constructor(){this.documentContentMaps=new Map,this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(h){return h===o.Schemes.walkThroughSnippet}provideEditorDocumentModelContent(h,u){return this.documentContentMaps.has(h.toString())||this.documentContentMaps.set(h.toString(),""),this.documentContentMaps.get(h.toString())}isReadonly(){return!1}preferLanguageForUri(){return"plaintext"}};t.WalkThroughSnippetSchemeDocumentProvider=g,t.WalkThroughSnippetSchemeDocumentProvider=g=n.__decorate([(0,r.Injectable)()],g)},41352:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeDocClientService=void 0;const n=e(85608),r=e(76003),o=e(80449);let c=class{saveByChange(v,m,_,s,g){return this.fileDocBackendService.$saveByChange(v,m,_,s,g)}saveByContent(v,m,_,s,g){return this.fileDocBackendService.$saveByContent(v,m,_,s,g)}getMd5(v,m){return this.fileDocBackendService.$getMd5(v,m)}};t.FileSchemeDocClientService=c,n.__decorate([(0,r.Autowired)(o.FileSchemeDocNodeServicePath),n.__metadata("design:type",Object)],c.prototype,"fileDocBackendService",void 0),t.FileSchemeDocClientService=c=n.__decorate([(0,r.Injectable)()],c)},17276:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemEditorComponentContribution=t.FileSystemEditorResourceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26542),p=e(57517),v=e(17878),m=e(42933),_=e(57646),s=e(60387),g=e(88819),a=e(99025),h="video-preview",u="image-preview",d="external-file",E="large-file-prevent";let f=class{registerResource(y){y.registerResourceProvider(this.untitledResourceProvider)}registerEditorDocumentModelContentProvider(y){y.registerEditorDocumentModelContentProvider(this.fileSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.vscodeSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.walkThroughSnippetSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.untitledSchemeDocumentProvider)}};t.FileSystemEditorResourceContribution=f,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.FileSchemeDocumentProvider)],f.prototype,"fileSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.VscodeSchemeDocumentProvider)],f.prototype,"vscodeSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.WalkThroughSnippetSchemeDocumentProvider)],f.prototype,"walkThroughSnippetSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeResourceProvider)],f.prototype,"untitledResourceProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeDocumentProvider)],f.prototype,"untitledSchemeDocumentProvider",void 0),t.FileSystemEditorResourceContribution=f=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution)],f);let l=class{constructor(){this.cachedFileType=new o.LRUMap(200,100),this.fileServiceClient.onFilesChanged(y=>{y.forEach(A=>{this.cachedFileType.delete(A.uri.toString())})})}registerEditorComponent(y){y.registerEditorComponent({component:a.ImagePreview,uid:u,scheme:o.Schemes.file}),y.registerEditorComponent({component:a.VideoPreview,uid:h,scheme:o.Schemes.file}),y.registerEditorComponent({component:_.BinaryEditorComponent,uid:d,scheme:o.Schemes.file}),y.registerEditorComponent({component:g.LargeFilePrevent,uid:E,scheme:o.Schemes.file}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,(A,S)=>{S.length===0&&S.push({type:p.EditorOpenType.component,componentId:d})}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,async(A,S)=>{const w=await this.getFileType(A.uri.toString());switch(w){case"image":{S.push({type:p.EditorOpenType.component,componentId:u});break}case"video":{S.push({type:p.EditorOpenType.component,componentId:h});break}case"binary":case"text":{const{metadata:T,uri:D}=A,I=T||{};if(w==="binary"&&!I.skipPreventBinary)break;const O=await this.fileServiceClient.getFileStat(D.toString());await this.preference.ready;const M=this.preference.getValid("editor.largeFile",4*1024*1024*1024);O&&(O.size||0)>M&&!I.skipPreventTooLarge?S.push({type:p.EditorOpenType.component,componentId:E}):S.push({type:p.EditorOpenType.code,title:(0,o.localize)("editorOpenType.code")});break}}}),y.registerEditorComponentResolver(o.Schemes.untitled,(A,S,w)=>{w([{type:p.EditorOpenType.code,priority:"default"}])})}async getFileType(y){return this.cachedFileType.has(y)||((0,c.getLanguageIdFromMonaco)(new o.URI(y))?this.cachedFileType.set(y,"text"):this.cachedFileType.set(y,await this.getRealFileType(y))),this.cachedFileType.get(y)}async getRealFileType(y){try{return await this.fileServiceClient.getFileType(y)}catch{return"text"}}};t.FileSystemEditorComponentContribution=l,n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],l.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],l.prototype,"preference",void 0),t.FileSystemEditorComponentContribution=l=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution),n.__metadata("design:paramtypes",[])],l)},52568:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(80449),p=e(41352),v=e(17276);let m=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[v.FileSystemEditorResourceContribution,v.FileSystemEditorComponentContribution,{token:c.IFileSchemeDocClient,useClass:p.FileSchemeDocClientService}],this.backServices=[{servicePath:c.FileSchemeDocNodeServicePath}]}};t.FileSchemeModule=m,t.FileSchemeModule=m=n.__decorate([(0,r.Injectable)()],m)},88819:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LargeFilePrevent=t.PreventComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(41869),p=e(81878),v=e(54414),m=e(82196),_=n.__importDefault(e(19996)),s=a=>o.default.createElement("div",{className:_.default["error-page"]},o.default.createElement("div",{className:(0,r.default)(_.default.icon,(0,c.getExternalIcon)("warning"))}),o.default.createElement("div",{className:_.default.description},a.description),o.default.createElement("div",{className:_.default["actions-wrapper"]},a.actions.map((h,u)=>o.default.createElement(p.Button,{key:u,onClick:()=>h.onClick(),className:_.default["action-button"]},h.label))));t.PreventComponent=s;const g=()=>{const a=(0,c.useInjectable)(v.WorkbenchEditorService),h=(0,c.useInjectable)(c.IEventBus),u=()=>{const d=a.currentResource;d&&(d.metadata={...d.metadata,skipPreventTooLarge:!0},h.fire(new m.ResourceOpenTypeChangedEvent(d.uri)))};return o.default.createElement(t.PreventComponent,{description:(0,c.localize)("editor.largeFile.prevent"),actions:[{label:(0,c.localize)("editor.file.prevent.stillOpen"),onClick:()=>u()}]})};t.LargeFilePrevent=g},99025:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImagePreview=t.VideoPreview=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(40827),p=n.__importDefault(e(19996)),v=_=>{const s=(0,o.useInjectable)(c.StaticResourceService);return{src:r.default.useMemo(()=>s.resolveStaticResource(_.uri).toString(),[_])}};t.VideoPreview=(0,r.memo)(_=>{const{src:s}=v(_.resource);return r.default.createElement("div",{className:p.default.kt_video_preview},r.default.createElement("video",{playsInline:!0,controls:!0,className:p.default.kt_video,src:s}))});const m=_=>{const s=r.default.useRef(),g=r.default.useRef(),{src:a}=v(_.resource);return r.default.useEffect(()=>{const h=new o.Disposable;return s.current&&(s.current.src=a),()=>{h.dispose()}},[_.resource]),r.default.createElement("div",{className:p.default.kt_image_preview},r.default.createElement("div",{ref:g},r.default.createElement("img",{ref:h=>h&&(s.current=h)})))};t.ImagePreview=m},80449:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeType=t.FileSchemeDocNodeServicePath=t.IFileSchemeDocNodeService=t.IFileSchemeDocClient=t.FILE_SAVE_BY_CHANGE_THRESHOLD=t.FILE_ON_DISK_SCHEME=void 0,t.FILE_ON_DISK_SCHEME="fileOnDisk",t.FILE_SAVE_BY_CHANGE_THRESHOLD=1e5,t.IFileSchemeDocClient=Symbol("IFileSchemeDocClient"),t.IFileSchemeDocNodeService=Symbol("FileSchemeDocNodeService"),t.FileSchemeDocNodeServicePath="FileSchemeDocNodeService";var e;(function(n){n[n.ADDED=1]="ADDED",n[n.REMOVED=2]="REMOVED"})(e||(t.ChangeType=e={}))},15625:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IFileSearchService=t.FileSearchServicePath=void 0,t.FileSearchServicePath="FileSearchServicePath",t.IFileSearchService=Symbol("FileSearchService")},84660:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(15625),t)},47720:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(84660),t)},2156:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClient=t.BrowserFileSystemRegistryImpl=void 0;const n=e(85608),r=e(32852),o=e(76003),c=e(41869),p=e(43718),v=e(37406),m=e(8170),_=e(41682),s=e(42933),g=e(81952);let a=class{constructor(){this.providers=new Map}registerFileSystemProvider(d){const E=d.scheme;return this.providers.set(E,d),{dispose:()=>{this.providers.delete(E)}}}};t.BrowserFileSystemRegistryImpl=a,t.BrowserFileSystemRegistryImpl=a=n.__decorate([(0,o.Injectable)()],a);let h=class{get clientId(){return this.applicationService.clientId}constructor(){this.watcherWithSchemaMap=new Map,this.watcherDisposerMap=new Map,this.onFileChangedEmitter=new c.Emitter,this.onFileProviderChangedEmitter=new c.Emitter,this._onFilesChanged=new c.Emitter,this.onFilesChanged=this._onFilesChanged.event,this._onFileProviderChanged=new c.Emitter,this.onFileProviderChanged=this._onFileProviderChanged.event,this._onDidChangeFileSystemProviderRegistrations=new c.Emitter,this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event,this._onWillActivateFileSystemProvider=new c.Emitter,this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event,this._onDidChangeFileSystemProviderCapabilities=new c.Emitter,this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event,this.filesExcludesMatcherList=[],this.watcherId=0,this.toDisposable=new c.DisposableCollection,this.watchFileExcludes=[],this.watchFileExcludesMatcherList=[],this.filesExcludes=[],this.workspaceRoots=[],this._providerChanged=new Set,this.fsProviders=new Map,this.userHomeDeferred=new c.Deferred,this.options={encoding:"utf8",overwrite:!1,recursive:!0,moveToTrash:!0},this.uriWatcherMap=new Map,this.toDisposable.push(this.onDidChangeFileSystemProviderRegistrations(d=>{d.added&&d.scheme===p.Schemes.file&&this.doGetCurrentUserHome()}))}async initialize(){const d=await this.getProvider(p.Schemes.file);d.initialize&&await d.initialize(this.clientId,this.appConfig.recursiveWatcherBackend)}async doGetCurrentUserHome(){const E=(await this.getProvider(p.Schemes.file)).getCurrentUserHome();this.userHomeDeferred.resolve(E)}handlesScheme(d){return this.registry.providers.has(d)||this.fsProviders.has(d)}dispose(){return this.toDisposable.dispose()}async resolveContent(d,E){const f=this.convertUri(d),b=await(await this.getProvider(f.scheme)).readFile(f.codeUri),y=b.data||b;return{content:c.BinaryBuffer.wrap(Uint8Array.from(y)).toString(E?.encoding)}}async readFile(d){const E=this.convertUri(d),l=await(await this.getProvider(E.scheme)).readFile(E.codeUri),b=l.data||l;return{content:c.BinaryBuffer.wrap(Uint8Array.from(b))}}async readFileStream(d){const E=this.convertUri(d);return await(await this.getProvider(E.scheme)).readFileStream(E.codeUri)}async getFileStat(d,E=!0){const f=this.convertUri(d),l=await this.getProvider(f.scheme);try{const b=await l.stat(f.codeUri);if(!b)throw s.FileSystemError.FileNotFound(f.codeUri.toString(),"File not found.");return this.filterStat(b,E)}catch(b){if(s.FileSystemError.FileNotFound.is(b))return}}async setContent(d,E,f){const l=this.convertUri(d.uri),b=await this.getProvider(l.scheme),y=await b.stat(l.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!await this.isInSync(d,y))throw this.createOutOfSyncError(d);return await b.writeFile(l.codeUri,typeof E=="string"?c.BinaryBuffer.fromString(E).buffer:E,{create:!1,overwrite:!0,encoding:f?.encoding}),await b.stat(l.codeUri)}async updateContent(d,E,f){const l=this.convertUri(d.uri),b=await this.getProvider(l.scheme),y=await b.stat(l.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!this.checkInSync(d,y))throw this.createOutOfSyncError(d);if(E.length===0)return y;const A=await b.readFile(l.codeUri),S=this.applyContentChanges(c.BinaryBuffer.wrap(A).toString(f?.encoding),E);await b.writeFile(l.codeUri,c.BinaryBuffer.fromString(S).buffer,{create:!1,overwrite:!0,encoding:f?.encoding});const w=await b.stat(l.codeUri);if(!w)throw s.FileSystemError.FileNotFound(l.codeUri.toString(),"File not found.");return w}async createFile(d,E){const f=this.convertUri(d),l=await this.getProvider(f.scheme),b=c.BinaryBuffer.fromString(E?.content||"").buffer;let y=await l.writeFile(f.codeUri,b,{create:!0,overwrite:E&&E.overwrite||!1,encoding:E?.encoding});return y=y||await l.stat(f.codeUri),y}async createFolder(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme),l=await f.createDirectory(E.codeUri);return l||await f.stat(E.codeUri)}async move(d,E,f){const l=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(l.scheme),A=await y.rename(l.codeUri,b.codeUri,{overwrite:!!(f&&f.overwrite)});return A||await y.stat(b.codeUri)}async copy(d,E,f){const l=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(l.scheme),A=await this.doGetOverwrite(f);if(!(0,s.containsExtraFileMethod)(y,"copy"))throw this.getErrorProvideNotSupport(l.scheme,"copy");const S=await y.copy(l.codeUri,b.codeUri,{overwrite:!!A});return S||await y.stat(b.codeUri)}async getFsPath(d){if(d.startsWith("file:/"))return c.FileUri.fsPath(d)}fireFilesChange(d){const E=d.changes.map(f=>({uri:f.uri,type:f.type}));this._onFilesChanged.fire(E),this.eventBus.fire(new c.FilesChangeEvent(E))}async watchFileChanges(d,E){const l=(this.appConfig.pollingWatcherDirectories||[]).some(I=>d.path.toString().startsWith(I)),b=this.convertUri(d.toString());let y=0;const A=await this.getProvider(b.scheme),S=this.watcherWithSchemaMap.get(b.scheme)||[];let w;this.uriWatcherMap.has(b.toString())&&(w=this.uriWatcherMap.get(b.toString()),w.dispose()),w?y=w.watchId:y=this.watcherId++;const T=await A.watch(b.codeUri,{excludes:E,pollingWatch:l});this.watcherDisposerMap.set(y,{dispose:async()=>{const I=this.uriWatcherMap.get(b.toString());await Promise.all([A.unwatch&&A.unwatch(T),I&&I.dispose()]),this.uriWatcherMap.delete(b.toString())}}),S.push(y),this.watcherWithSchemaMap.set(b.scheme,S);const D=new g.FileSystemWatcher({fileServiceClient:this,watchId:y,uri:d});return this.uriWatcherMap.set(b.toString(),D),D}async setWatchFileExcludes(d){return await(await this.getProvider(p.Schemes.file)).setWatchFileExcludes(d)}async getWatchFileExcludes(){return await(await this.getProvider(p.Schemes.file)).getWatchFileExcludes()}async setFilesExcludes(d,E){this.filesExcludes=d,this.filesExcludesMatcherList=[],E&&this.setWorkspaceRoots(E),this.updateExcludeMatcher()}async setWorkspaceRoots(d){this.workspaceRoots=d,this.updateExcludeMatcher()}async unwatchFileChanges(d){const E=this.watcherDisposerMap.get(d);if(!(!E||!E.dispose))return this.watcherDisposerMap.delete(d),E.dispose()}async delete(d,E){if(this.appConfig.isElectronRenderer&&E?.moveToTrash!==!1){const b=new c.URI(d);if(b.scheme===p.Schemes.file)return this.injector.get(v.IElectronMainUIService).moveToTrash(b.codeUri.fsPath)}const f=this.convertUri(d),l=await this.getProvider(f.scheme);await l.stat(f.codeUri),await l.delete(f.codeUri,{recursive:!0,moveToTrash:await this.doGetMoveToTrash(E)})}async getEncoding(d){return"utf8"}listCapabilities(){return _.Iterable.map(this.fsProviders,([d,E])=>({scheme:d,capabilities:E.capabilities}))}registerProvider(d,E){if(this.fsProviders.has(d))throw new Error(`The file system provider for \`${d}\` already registered`);const f=[];this.fsProviders.set(d,E),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:d,provider:E}),f.push({dispose:()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:d,provider:E}),this.fsProviders.delete(d),this._providerChanged.add(d)}}),E.onDidChangeFile&&f.push(E.onDidChangeFile(b=>this.fireFilesChange({changes:b}))),this.toDisposable.push(E.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:E,scheme:d}))),f.push({dispose:async()=>{const b=[];(this.watcherWithSchemaMap.get(d)||[]).forEach(y=>b.push(this.unwatchFileChanges(y))),await Promise.all(b)}}),this._providerChanged.add(d),this.onFileProviderChangedEmitter.fire(Array.from(this._providerChanged)),this.toDisposable.pushAll(f);const l=new c.DisposableCollection;return l.pushAll(f),this._onFileProviderChanged.fire(Array.from(this._providerChanged)),l}async access(d,E=s.FileAccess.Constants.F_OK){const f=this.convertUri(d),l=await this.getProvider(f.scheme);if(!(0,s.containsExtraFileMethod)(l,"access")){if(E===s.FileAccess.Constants.F_OK)try{return!!await l.stat(f.codeUri)}catch{return!1}throw this.getErrorProvideNotSupport(f.scheme,"access")}return await l.access(f.codeUri,E)}async getFileType(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme);if(!(0,s.containsExtraFileMethod)(f,"getFileType"))throw this.getErrorProvideNotSupport(E.scheme,"getFileType");return await f.getFileType(d)}async getCurrentUserHome(){return this.userHomeDeferred.promise}getErrorProvideNotSupport(d,E){return`Scheme ${d} not support this function: ${E}.`}convertUri(d){const E=new c.URI(d);if(!E.scheme)throw new Error(`Unsupported convert Uri with non-scheme Uri: ${d}`);return E}updateExcludeMatcher(){this.filesExcludes.forEach(d=>{this.workspaceRoots.length>0?this.workspaceRoots.forEach(E=>{const l=new c.URI(E).resolve(d).path.toString();this.filesExcludesMatcherList.push((0,c.parseGlob)(l))}):this.filesExcludesMatcherList.push((0,c.parseGlob)(d))})}async shouldWaitProvider(d){const E=await this._onWillActivateFileSystemProvider.fireAndAwait({scheme:d}),{result:f}=E[0];if(f&&f.includes(d)){const l=await c.Event.toPromise(c.Event.filter(this.onFileProviderChanged,b=>b.includes(d)));if(!(0,p.isUndefined)(l))return!0}return!1}async getProvider(d){this._providerChanged.has(d)&&(await this.eventBus.fireAndAwait(new c.ExtensionActivateEvent({topic:"onFileSystem",data:d}),{timeout:3e3}),this._providerChanged.delete(d));const E=this.fsProviders.get(d);if(!E)throw new Error(`Not find ${d} provider.`);return E}async isReadonly(d){try{const E=new c.URI(d);return!!(await(await this.getProvider(E.scheme)).stat(this.convertUri(d).codeUri)).readonly}catch{return!1}}isExclude(d){const E=new c.URI(d);return this.filesExcludesMatcherList.some(f=>f(E.path.toString()))}filterStat(d,E=!0){if(d&&!this.isExclude(d.uri))return d.children&&E&&(d.children=this.filterStatChildren(d.children)),d}filterStatChildren(d){const E=[];return d.forEach(f=>{if(this.isExclude(f.uri))return!1;const l=this.filterStat(f);l&&E.push(l)}),E}applyContentChanges(d,E){let f=r.TextDocument.create("","",1,d);for(const l of E){let b=l.text;if(l.range){const y=f.offsetAt(l.range.start),A=f.offsetAt(l.range.end);b=f.getText().substr(0,y)+l.text+f.getText().substr(A)}f=r.TextDocument.create(f.uri,f.languageId,f.version,b)}return f.getText()}async isInSync(d,E){return!!this.checkInSync(d,E)}checkInSync(d,E){return E.lastModification===d.lastModification&&E.size===d.size}createOutOfSyncError(d){return s.FileSystemError.FileIsOutOfSync(d.uri)}async doGetEncoding(d){return d&&typeof d.encoding<"u"?d.encoding:this.options.encoding}async doGetOverwrite(d){return d&&typeof d.overwrite<"u"?d.overwrite:this.options.overwrite}async doGetRecursive(d){return d&&typeof d.recursive<"u"?d.recursive:this.options.recursive}async doGetMoveToTrash(d){return d&&typeof d.moveToTrash<"u"?d.moveToTrash:this.options.moveToTrash}async reconnect(){var d;const E=await this.getProvider(p.Schemes.file);E.initialize&&await E.initialize(this.clientId,this.appConfig.recursiveWatcherBackend);const f=Array.from(this.uriWatcherMap.keys());for(const l of f)try{const b=new c.URI(l);this.uriWatcherMap.get(l)&&await this.watchFileChanges(b)}catch(b){(d=this.logger)===null||d===void 0||d.error("Error reconnecting watcher for:",l,b)}}};t.FileServiceClient=h,n.__decorate([(0,o.Autowired)(s.IBrowserFileSystemRegistry),n.__metadata("design:type",a)],h.prototype,"registry",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(p.IEventBus),n.__metadata("design:type",Object)],h.prototype,"eventBus",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(m.IApplicationService),n.__metadata("design:type",Object)],h.prototype,"applicationService",void 0),n.__decorate([(0,o.Autowired)(p.ILogger),n.__metadata("design:type",Object)],h.prototype,"logger",void 0),t.FileServiceClient=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},69037:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(2156);let v=class{constructor(){this._disposables=new o.DisposableStore,this._disposables.add(this.fileSystem.registerProvider(o.Schemes.file,this.diskFileServiceProvider))}async initialize(){const _=this.contributionProvider.getContributions();await Promise.all(_.map(async s=>{s.registerProvider&&await s.registerProvider(this.fileSystem)})),await Promise.all(_.map(async s=>{s.onFileServiceReady&&await s.onFileServiceReady()})),this.fileSystem.initialize&&await this.fileSystem.initialize()}onReconnect(){this.fileServiceClient.reconnect().catch(_=>this.logger.error("Failed to reconnect watchers:",_))}dispose(){this._disposables.dispose()}};t.FileServiceContribution=v,n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",p.FileServiceClient)],v.prototype,"fileSystem",void 0),n.__decorate([(0,r.Autowired)(c.IDiskFileProvider),n.__metadata("design:type",Object)],v.prototype,"diskFileServiceProvider",void 0),n.__decorate([(0,r.Autowired)(o.FsProviderContribution),n.__metadata("design:type",Object)],v.prototype,"contributionProvider",void 0),n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",Object)],v.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],v.prototype,"logger",void 0),t.FileServiceContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution),n.__metadata("design:paramtypes",[])],v)},60476:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFsProviderClient=t.CoreFileServiceProviderClient=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(42933);class p{constructor(){this.onDidChangeFileEmitter=new o.Emitter,this.onDidChangeFile=this.onDidChangeFileEmitter.event}watch(_,s){return this.fileServiceProvider.watch(_,s)}unwatch(_){return this.fileServiceProvider.unwatch&&this.fileServiceProvider.unwatch(_)}async stat(_){return await this.fileServiceProvider.stat(_)}readDirectory(_){return this.fileServiceProvider.readDirectory(_)}createDirectory(_){return this.fileServiceProvider.createDirectory(_)}async readFile(_,s){return s&&(0,o.getDebugLogger)("fileService.fsProvider").warn("encoding option for fsProvider.readFile is deprecated"),await this.fileServiceProvider.readFile(_)}readFileStream(_){if(this.fileServiceProvider.readFileStream)return this.fileServiceProvider.readFileStream(_);throw new Error("readFileStream not supported")}writeFile(_,s,g){return this.fileServiceProvider.writeFile(_,Array.from(s),g)}delete(_,s){return this.fileServiceProvider.delete(_,s)}rename(_,s,g){return this.fileServiceProvider.rename(_,s,g)}}t.CoreFileServiceProviderClient=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0);let v=class extends p{constructor(){super(...arguments),this.onDidChangeCapabilities=o.Event.None}get capabilities(){return this._capabilities||(this._capabilities=12318,o.isLinux&&(this._capabilities|=1024)),this._capabilities}async initialize(_,s){var g,a;if(!((g=this.fileServiceProvider)===null||g===void 0)&&g.initialize)try{await((a=this.fileServiceProvider)===null||a===void 0?void 0:a.initialize(_,s))}catch(h){(0,o.getDebugLogger)("fileService.fsProvider").error("initialize error",h)}}setWatchFileExcludes(_){return this.fileServiceProvider.setWatchFileExcludes(_)}getWatchFileExcludes(){return this.fileServiceProvider.getWatchFileExcludes()}onDidFilesChanged(_){const s=_.changes.map(g=>({uri:g.uri,type:g.type}));this.onDidChangeFileEmitter.fire(s)}copy(_,s,g){return this.fileServiceProvider.copy(_,s,g)}access(_,s){return this.fileServiceProvider.access(_,s)}getCurrentUserHome(){return this.fileServiceProvider.getCurrentUserHome()}getFileType(_){return this.fileServiceProvider.getFileType(_)}};t.DiskFsProviderClient=v,n.__decorate([(0,r.Autowired)(c.DiskFileServicePath),n.__metadata("design:type",Object)],v.prototype,"fileServiceProvider",void 0),n.__decorate([(0,o.debounce)(100),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Array]),n.__metadata("design:returntype",void 0)],v.prototype,"setWatchFileExcludes",null),t.DiskFsProviderClient=v=n.__decorate([(0,r.Injectable)()],v)},96708:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClientModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(70671),v=e(2156),m=e(69037),_=e(60476),s=e(23188);let g=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[{token:c.IFileServiceClient,useClass:v.FileServiceClient},{token:c.IBrowserFileSystemRegistry,useClass:v.BrowserFileSystemRegistryImpl},{token:c.IDiskFileProvider,useClass:_.DiskFsProviderClient},{token:c.IShadowFileProvider,useClass:s.ShadowFileSystemProvider},m.FileServiceContribution],this.backServices=[{servicePath:c.DiskFileServicePath,clientToken:c.IDiskFileProvider,protocol:p.DiskFileServiceProtocol}]}};t.FileServiceClientModule=g,t.FileServiceClientModule=g=n.__decorate([(0,r.Injectable)()],g)},23188:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShadowFileSystemProvider=void 0;const n=e(85608),r=e(76003),o=e(41869);let c=class{constructor(){this.capabilities=2048,this.onDidChangeCapabilities=o.Event.None,this.readonly=!0,this.shadowFiles=new Map,this.fileChangeEmitter=new o.Emitter,this.onDidChangeFile=this.fileChangeEmitter.event}unwatch(v){throw new Error("Method not implemented.")}readFileStream(v){throw new Error("Method not implemented.")}watch(v,m){throw new Error("Method not implemented.")}stat(v){return Promise.resolve({uri:v.toString(),lastModification:0})}readDirectory(v){throw new Error("Method not implemented.")}createDirectory(v){throw new Error("Method not implemented.")}readFile(v){return this.shadowFiles.get(v.toString())||o.BinaryBuffer.fromString("no available").buffer}writeFile(v,m,_){this.shadowFiles.set(v.toString(),m)}delete(v,m){throw new Error("Method not implemented.")}rename(v,m,_){throw new Error("Method not implemented.")}copy(v,m,_){throw new Error("Method not implemented.")}exists(v){throw new Error("Method not implemented.")}access(v,m){throw new Error("Method not implemented.")}};t.ShadowFileSystemProvider=c,t.ShadowFileSystemProvider=c=n.__decorate([(0,r.Injectable)()],c)},81952:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemWatcher=void 0;const n=e(43718);function r(c,p){return c.filter(v=>!!v.uri.startsWith(p))}class o{constructor(p){this.toDispose=new n.DisposableCollection,this.changeEmitter=new n.Emitter,this.toDispose.push(this.changeEmitter),this.fileServiceClient=p.fileServiceClient,this.watchId=p.watchId,this.uri=p.uri,this.fileServiceClient.onFilesChanged(v=>{const m=r(v,this.uri.toString());m&&m.length>0&&this.changeEmitter.fire(m)})}get onFilesChanged(){return this.changeEmitter.event}dispose(){return Promise.all([this.toDispose.dispose(),this.fileServiceClient.unwatchFileChanges(this.watchId)])}isDisposed(){return this.toDispose.disposed}}t.FileSystemWatcher=o},91813:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EXT_LIST_TEXT=t.EXT_LIST_IMAGE=t.EXT_LIST_VIDEO=void 0,t.getFileTypeByExt=e,t.EXT_LIST_VIDEO=new Set(["mp4","webm","mkv","mov","mts","flv","avi","wmv"]),t.EXT_LIST_IMAGE=new Set(["png","gif","jpg","jpeg","svg","bmp","avif","cr2","cr3","dng","flif","heic","icns","jxl","jpm","jpx","nef","raf","rw2","tif","orf","webp","apng"]),t.EXT_LIST_TEXT=new Set(["xml"]);function e(n){let r="text";return n&&(t.EXT_LIST_IMAGE.has(n)?r="image":t.EXT_LIST_VIDEO.has(n)?r="video":t.EXT_LIST_TEXT.has(n)?r="text":r="binary"),r}},79929:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IBrowserFileSystemRegistry=t.IFileServiceClient=void 0;const n=e(43718);t.IFileServiceClient=n.IFileServiceClient,t.IBrowserFileSystemRegistry=Symbol("IBrowserFileSystemRegistry")},49818:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemError=t.FileOperationError=t.FileSystemProviderError=t.FileSystemProviderErrorCode=t.FileAccess=t.IFileService=t.IShadowFileProvider=t.IDiskFileProvider=t.FileStat=t.FileType=void 0,t.createFileSystemProviderError=_,t.markAsFileSystemProviderError=s,t.containsExtraFileMethod=a,t.notEmpty=h,t.isErrnoException=u,t.handleError=d;const n=e(85608),r=e(43718);var o=e(31036);Object.defineProperty(t,"FileType",{enumerable:!0,get:function(){return o.FileType}}),Object.defineProperty(t,"FileStat",{enumerable:!0,get:function(){return o.FileStat}}),n.__exportStar(e(11854),t),t.IDiskFileProvider=Symbol("IDiskFileProvider"),t.IShadowFileProvider=Symbol("IShadowFileProvider"),t.IFileService=Symbol("IFileService");var c;(function(E){let f;(function(l){l.F_OK=0,l.R_OK=4,l.W_OK=2,l.X_OK=1})(f=E.Constants||(E.Constants={}))})(c||(t.FileAccess=c={}));var p;(function(E){E.FileExists="EntryExists",E.FileNotFound="EntryNotFound",E.FileNotADirectory="EntryNotADirectory",E.FileIsADirectory="EntryIsADirectory",E.FileIsOutOfSync="FileIsOutOfSync",E.FileExceedsMemoryLimit="EntryExceedsMemoryLimit",E.FileTooLarge="EntryTooLarge",E.FileWriteLocked="EntryWriteLocked",E.NoPermissions="NoPermissions",E.Unavailable="Unavailable",E.Unknown="Unknown"})(p||(t.FileSystemProviderErrorCode=p={}));class v extends Error{static declare(f,l){return Object.assign((...b)=>_(l(...b),f),{is:b=>{var y;return(y=b.stack)===null||y===void 0?void 0:y.startsWith(f)}})}constructor(f,l){super(f),this.code=l}is(f){return this.name===f.name}}t.FileSystemProviderError=v;class m extends Error{constructor(f,l,b){super(f),this.fileOperationResult=l,this.options=b}static isFileOperationError(f){return f instanceof Error&&!(0,r.isUndefinedOrNull)(f.fileOperationResult)}}t.FileOperationError=m;function _(E,f){const l=new v(E.toString(),f);return s(l,f),l}function s(E,f){return E.name=f?`${f} (FileSystemError)`:"FileSystemError",E}var g;(function(E){E.FileNotFound=v.declare(p.FileNotFound,(f,l)=>`${l?l+" ":""} '${f}' is not found.`),E.FileExists=v.declare(p.FileExists,(f,l)=>`${l?l+" ":""}'${f}' already exists.`),E.FileNotADirectory=v.declare(p.FileNotADirectory,(f,l)=>`${l?l+" ":""}'${f}' is not a directory.`),E.FileIsADirectory=v.declare(p.FileIsADirectory,(f,l)=>`${l?l+" ":""}'${f}' is a directory.`),E.FileIsOutOfSync=v.declare(p.FileIsOutOfSync,(f,l)=>`${l?l+" ":""}'${f}' is out of sync.`),E.FileExceedsMemoryLimit=v.declare(p.FileExceedsMemoryLimit,(f,l)=>`${l?l+" ":""}'${f}' is exceeds memory limit.`),E.FileTooLarge=v.declare(p.FileTooLarge,(f,l)=>`${l?l+" ":""}'${f}' is too large.`),E.FileWriteLocked=v.declare(p.FileWriteLocked,(f,l)=>`${l?l+" ":""}'${f}' is locked.`),E.FileIsNoPermissions=v.declare(p.NoPermissions,(f,l)=>`${l?l+" ":""}'${f}' is no permissions.`),E.Unavailable=v.declare(p.Unavailable,(f,l)=>`${l?l+" ":""}'${f}' is unavailable.`),E.Unknown=v.declare(p.Unknown,(f,l)=>`${l?l+" ":""}'${f}' is unkonw.`)})(g||(t.FileSystemError=g={}));function a(E,f){return(0,r.hasProperty)(E,f)&&(0,r.isFunction)(E[f])}function h(E){return E!==void 0}function u(E){return E.code!==void 0&&E.errno!==void 0}function d(E){var f,l,b,y,A;if(u(E))switch(E.code){case"EEXIST":throw g.FileExists(r.Uri.file((f=E.path)!==null&&f!==void 0?f:""));case"EPERM":case"EACCESS":throw g.FileIsNoPermissions(r.Uri.file((l=E.path)!==null&&l!==void 0?l:""));case"ENOENT":throw g.FileNotFound(r.Uri.file((b=E.path)!==null&&b!==void 0?b:""));case"ENOTDIR":throw g.FileNotADirectory(r.Uri.file((y=E.path)!==null&&y!==void 0?y:""));case"EISDIR":throw g.FileIsADirectory(r.Uri.file((A=E.path)!==null&&A!==void 0?A:""))}throw E}},42933:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(79929),t),n.__exportStar(e(49818),t),n.__exportStar(e(28217),t),n.__exportStar(e(91813),t),n.__exportStar(e(50295),t)},70671:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFileServiceProtocol=void 0;const n=e(26387),r=e(52890),o=e(50295);t.DiskFileServiceProtocol={name:o.DiskFileServicePath,methods:[{method:"readFile",request:[{name:"uri",type:r.UriComponentsProto}],response:{type:n.Type.binary()}}]}},50295:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileExtServicePath=t.FileWatcherServicePath=t.ShadowFileServicePath=t.DiskFileServicePath=t.FileServicePath=void 0,t.FileServicePath="FileService",t.DiskFileServicePath="DiskFileService",t.ShadowFileServicePath="ShadowFileService",t.FileWatcherServicePath="FileWatcherService",t.FileExtServicePath="FileExtServicePath"},28217:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WatcherProcessManagerProxy=t.WatcherServiceProxy=t.WATCHER_INIT_DATA_KEY=t.SUMI_WATCHER_PROCESS_SOCK_KEY=t.INsfw=void 0;const n=e(86058);var r;(function(o){let c;(function(p){p[p.CREATED=0]="CREATED",p[p.DELETED=1]="DELETED",p[p.MODIFIED=2]="MODIFIED",p[p.RENAMED=3]="RENAMED"})(c=o.actions||(o.actions={}))})(r||(t.INsfw=r={})),t.SUMI_WATCHER_PROCESS_SOCK_KEY="sumi-watcher-process-sock",t.WATCHER_INIT_DATA_KEY="sumi-watcher-init-data",t.WatcherServiceProxy=new n.ProxyIdentifier("WatcherHostServiceImpl"),t.WatcherProcessManagerProxy=new n.ProxyIdentifier("WatcherProcessManagerProxy")},14951:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(42933),t)},57942:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(26542),m=e(6250),_=e(2812),s=r.__importDefault(e(89200)),g=e(9018);let a=n=class{static createContainer(u,d){return u.createChild([{token:m.IFileDialogTreeService,useValue:d},{token:m.IFileDialogModel,useClass:n}])}static createModel(u,d){return n.createContainer(u,d).get(m.IFileDialogModel)}constructor(){this.selectedDecoration=new c.Decoration(s.default.mod_selected),this.focusedDecoration=new c.Decoration(s.default.mod_focused),this.loadingDecoration=new c.Decoration(s.default.mod_loading),this.cutDecoration=new c.Decoration(s.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.clearFileSelectedDecoration=()=>{this._selectedFiles.forEach(u=>{this.selectedDecoration.removeTarget(u)}),this._selectedFiles=[],this.onDidSelectedFileChangeEmitter.fire([])},this.activeFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles=[u],this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.selectFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this._selectedFiles=[u],this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.activeFileFocusedDecoration=(u,d=!1)=>{u!==this.treeModel.root&&(this.focusedFile!==u&&(d?(this.preContextMenuFocusedFile?(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile)):this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.preContextMenuFocusedFile=u):this.focusedFile&&(this.preContextMenuFocusedFile=null,this.focusedDecoration.removeTarget(this.focusedFile)),u&&(this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles.push(u),this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)))),this.treeModel.dispatchChange())},this.activeFileSelectedDecoration=u=>{this._selectedFiles.indexOf(u)>-1||(this._selectedFiles.push(u),this.selectedDecoration.addTarget(u),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(d=>d.uri)),this.treeModel.dispatchChange())},this.activeFileDecorationByRange=(u,d)=>{for(this.clearFileSelectedDecoration(),this.preContextMenuFocusedFile=null;u<=d;u++){const E=this.treeModel.root.getTreeNodeAtIndex(u);E&&(this._selectedFiles.push(E),this.selectedDecoration.addTarget(E))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)),this.treeModel.dispatchChange()},this.enactiveFileDecoration=()=>{this.focusedFile&&(this.focusedDecoration.removeTarget(this.focusedFile),this.onDidFocusedFileChangeEmitter.fire(),this.treeModel.dispatchChange()),this._focusedFile=void 0},this.toggleDirectory=async u=>{u.expanded?this.fileTreeHandle.collapseNode(u):this.fileTreeHandle.expandNode(u)},this.handleTreeBlur=()=>{this.enactiveFileDecoration()},this.handleTreeFocus=()=>{},this.handleItemRangeClick=(u,d)=>{if(!this.focusedFile)this.handleItemClick(u,d);else if(this.focusedFile&&this.focusedFile!==u){const E=this.treeModel.root.getIndexAtTreeNode(u),f=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);f>E?this.activeFileDecorationByRange(E,f):f<E&&this.activeFileDecorationByRange(f,E)}},this.handleItemToggleClick=(u,d)=>{d!==c.TreeNodeType.CompositeTreeNode&&d!==c.TreeNodeType.TreeNode||(this.selectedFiles.indexOf(u)>-1?this.focusedFile===u?this.enactiveFileDecoration():this.activeFileFocusedDecoration(u):this.activeFileSelectedDecoration(u))},this.handleItemClick=(u,d)=>{this.clickTimes++,(d===c.TreeNodeType.CompositeTreeNode||d===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(u),d===c.TreeNodeType.CompositeTreeNode&&this.corePreferences["workbench.list.openMode"]==="singleClick"&&this.toggleDirectory(u),this.clickTimer&&clearTimeout(this.clickTimer),this.clickTimer=setTimeout(()=>{this.clickTimes>1&&d!==c.TreeNodeType.TreeNode&&this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(u),this.clickTimes=0},200)},this.getDirectoryList=()=>this.fileTreeDialogService.getDirectoryList(),this._whenReady=this.initTreeModel()}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get whenReady(){return this._whenReady}get focusedFile(){return this._focusedFile}get selectedFiles(){return this._selectedFiles}async initTreeModel(){const u=(await this.fileTreeDialogService.resolveChildren())[0];this._treeModel=this.injector.get(_.FileTreeModel,[u]),this.initDecorations(u),this.disposableCollection.push(this._decorations),this.disposableCollection.push(this.labelService.onDidChange(()=>{this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,d=>{this.loadingDecoration.addTarget(d)})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,d=>{this.loadingDecoration.removeTarget(d)}))}async updateTreeModel(u){const d=await this.fileTreeDialogService.resolveRoot(u);if(d&&d.length>0){const E=d[0];this._treeModel=this.injector.get(_.FileTreeModel,[E]),this.clearFileSelectedDecoration(),this.initDecorations(E)}}initDecorations(u){this._decorations&&this._decorations.dispose(),this._decorations=new c.DecorationsManager(u),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}handleTreeHandler(u){this._fileTreeHandle=u}dispose(){this.disposableCollection.dispose()}};t.FileTreeDialogModel=a,a.FILE_TREE_SNAPSHOT_KEY="FILE_TREE_SNAPSHOT",a.DEFAULT_LOCATION_FLUSH_DELAY=500,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],a.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(m.IFileDialogTreeService),r.__metadata("design:type",g.FileTreeDialogService)],a.prototype,"fileTreeDialogService",void 0),r.__decorate([(0,o.Autowired)(v.LabelService),r.__metadata("design:type",v.LabelService)],a.prototype,"labelService",void 0),r.__decorate([(0,o.Autowired)(p.CorePreferences),r.__metadata("design:type",Object)],a.prototype,"corePreferences",void 0),t.FileTreeDialogModel=a=n=r.__decorate([(0,o.Injectable)(),r.__metadata("design:paramtypes",[])],a)},69748:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeDialogNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),_=({item:s,onClick:g,itemType:a,labelService:h,leftPadding:u=8,onTwistierClick:d,decorations:E,defaultLeftPadding:f=8,template:l})=>{const b=a===c.TreeNodeType.RenamePrompt,y=a===c.TreeNodeType.NewPrompt,A=b||y,S=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),w=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),T=W=>{(a===c.TreeNodeType.TreeNode||a===c.TreeNodeType.CompositeTreeNode)&&g(W,s,a)},D=W=>{(a===c.TreeNodeType.TreeNode||a===c.TreeNodeType.CompositeTreeNode)&&(d?d(W,s,a):g(W,s,a))},I=a===c.TreeNodeType.CompositeTreeNode;let O;A?y?O=`${f+(s.parent.depth+1||0)*(u||0)}px`:O=`${f+(s.target.depth||0)*(u||0)}px`:O=I?`${f+(s.depth||0)*(u||0)}px`:`${f+(s.depth||0)*(u||0)+8}px`;const M={height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:O},R=(W,U)=>{if(E&&E?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(A&&W instanceof c.PromptHandle){let Q=!1;if(b?Q=W.target.type===c.TreeNodeType.CompositeTreeNode:Q=W.type===c.TreeNodeType.CompositeTreeNode,Q)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:y||!(b&&W.target.type===c.TreeNodeType.CompositeTreeNode&&W.target.expanded)})})}else return o.default.createElement("div",{onClick:U,className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!W.expanded})})},P=W=>{let U,Q;A&&W instanceof c.PromptHandle?W instanceof c.RenamePromptHandle?(U=W.target.uri.resolve(W.$.value),Q=v.Directory.is(W.target)):(U=W.parent.uri.resolve(W.$.value),Q=W.type===c.TreeNodeType.CompositeTreeNode):(U=W.uri,Q=W.filestat.isDirectory);const V=h.getIcon(U,{isDirectory:Q});return o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,V,{expanded:Q&&W.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},k=W=>l?o.default.createElement(l,null):A&&W instanceof c.PromptHandle?o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(W.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}}))):o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},W.name),F=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},L()),L=()=>null,B=W=>{if(I)return R(W,D);if(A)return R(W,()=>{})},j=()=>s.tooltip||s.name;return o.default.createElement("div",{key:s.id,onClick:T,title:j(),className:(0,r.default)(w,E?E.classlist:null),style:M,draggable:a===c.TreeNodeType.TreeNode||a===c.TreeNodeType.CompositeTreeNode},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},B(s),P(s),o.default.createElement("div",{className:A?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},k(s)),F()))};t.FileTreeDialogNode=_,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},68195:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialogContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(66e3);let p=class{initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.fileDialogViewVisibleContext=c.FileDialogViewVisibleContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileDialogContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileDialogContextKey=p=n.__decorate([(0,r.Injectable)()],p)},9018:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(26542),v=e(54414),m=e(14951),_=e(72665),s=e(51500),g=e(6250),a=e(57781),h=e(97738),u=e(68195);let d=class extends o.Tree{constructor(f){super(),this._whenReady=this.resolveWorkspaceRoot(f)}get whenReady(){return this._whenReady}async resolveWorkspaceRoot(f){if(f){const l=new c.URI(f).withScheme(c.Schemes.file),b=await this.fileTreeAPI.resolveFileStat(l);b&&(this.workspaceRoot=b)}}async resolveChildren(f){if(f){if(f.uri){const{children:l}=await this.fileTreeAPI.resolveChildren(this,f.uri.toString(),f);return l}}else{this.workspaceRoot||(this.workspaceRoot=(await this.workspaceService.roots)[0]);const{children:l}=await this.fileTreeAPI.resolveChildren(this,this.workspaceRoot);return this.root=l[0],l}return[]}async resolveRoot(f){let l;/^file:\/\//.test(f)&&(l=new c.URI(f)),l=c.URI.file(f);const b=await this.fileTreeAPI.resolveFileStat(l);if(b){const{children:y}=await this.fileTreeAPI.resolveChildren(this,b);return this.root=y[0],y}}getDirectoryList(){const f=[];if(!this.root)return f;let l=new c.URI(this.workspaceRoot.uri);if(l&&l.parent)for(;l.parent;){const b=l.codeUri.fsPath;if(f.indexOf(b)>=0)break;f.push(b),l=l.parent}else f.push(l.codeUri.fsPath.toString());return f}sortComparator(f,l){return f.constructor===l.constructor?f.name.startsWith(".")&&!l.name.startsWith(".")?1:!f.name.startsWith(".")&&l.name.startsWith(".")?-1:f.name.localeCompare(l.name,"kn",{numeric:!0}):f.type===o.TreeNodeType.CompositeTreeNode?-1:l.type===o.TreeNodeType.CompositeTreeNode?1:0}initContextKey(f){f&&this.fileDialogContextKey.initScopedContext(f)}get contextKey(){return this.fileDialogContextKey}async saveAs(f){const{oldFilePath:l,newFilePath:b}=f;if(!l||!b)throw new Error("oldFilePath and newFilePath are required");await this.createFile(f);try{const y=c.URI.file(f.newFilePath),A={preview:!1,focus:!0,replace:!0,forceClose:!0,disableNavigate:!1};await this.workbenchEditorService.open(y,A),await this.fileTreeModelService.clearFileSelectedDecoration();const S=this.fileTreeService.getNodeByPathOrUri(y);S&&await this.fileTreeModelService.activeFileDecoration(S)}catch(y){throw new Error(`Failed to open saveAs file: ${y.message}`)}}async createFile(f){try{const{oldFilePath:l,newFilePath:b}=f;if(!await this.fileServiceClient.getFileStat(l))throw new Error(`Source file not found: ${l}`);const{content:A}=await this.fileServiceClient.readFile(l);await this.fileServiceClient.createFile(b,{content:A.toString(),encoding:"utf8",overwrite:!0})}catch(l){throw new Error(`Failed to create file: ${l.message}`)}}renderCustomMsg(){return null}async getDefaultFilePath(f,l){return l}dispose(){super.dispose()}};t.FileTreeDialogService=d,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],d.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.LabelService),n.__metadata("design:type",p.LabelService)],d.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileDialogContextKey),n.__metadata("design:type",u.FileDialogContextKey)],d.prototype,"fileDialogContextKey",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],d.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],d.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(_.IDialogService),n.__metadata("design:type",Object)],d.prototype,"dialogService",void 0),n.__decorate([(0,r.Autowired)(h.FileTreeModelService),n.__metadata("design:type",h.FileTreeModelService)],d.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(g.IFileTreeService),n.__metadata("design:type",a.FileTreeService)],d.prototype,"fileTreeService",void 0),t.FileTreeDialogService=d=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[String])],d)},51888:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialog=t.FILE_TREE_DIALOG_HEIGHT=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(68974),v=e(72665),m=e(69748),_=n.__importDefault(e(13294));t.FILE_TREE_DIALOG_HEIGHT=22;const s=({options:g,model:a,isOpenDialog:h,fileService:u})=>{const d=(0,c.useInjectable)(v.IDialogService),E=(0,r.useRef)(null),[f,l]=(0,r.useState)(g.defaultFileName||""),[b,y]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[w,T]=(0,r.useState)([]),D=(0,r.useRef)(g.defaultFileName||"");(0,r.useEffect)(()=>{var ie;return a&&(y(!1),R(),(ie=u.contextKey.fileDialogViewVisibleContext)===null||ie===void 0||ie.set(!0)),()=>{a.dispose()}},[a]),(0,r.useEffect)(()=>{g.defaultFileName&&(l(g.defaultFileName||""),D.current=g.defaultFileName||"")},[g]),(0,r.useEffect)(()=>{if(b){const ie=a.getDirectoryList();T(ie)}},[b]);const I=(0,r.useCallback)(()=>{const ie=a.selectedFiles.map(oe=>oe.uri.path.toString());if(D.current&&g.showNameInput&&(ie?.length===1||g.defaultUri)){const oe=ie?.length===1?ie[0]:g.defaultUri.path.toString();g?.saveAs&&u.saveAs({oldFilePath:c.path.join(oe,g?.defaultFileName||""),newFilePath:c.path.join(oe,D.current)}),d.hide([c.path.join(oe,D.current)])}else ie.length>0?d.hide(ie):A?d.hide([A]):g.defaultUri?d.hide([g.defaultUri.path.toString()]):a.treeModel&&a.treeModel.root?d.hide([a.treeModel.root.uri.path.toString()]):d.hide([]);y(!1),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d,a,g,A]),O=async ie=>{let oe=ie.treeModel.root.uri.codeUri.fsPath;return u.getDefaultFilePath&&(oe=await u.getDefaultFilePath(ie,oe)),oe},M=(0,r.useCallback)(()=>{y(!1),d.hide(),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d]),R=(0,r.useCallback)(async()=>{await a.whenReady,await a.treeModel.ensureReady;const ie=await O(a);S(ie),y(!0)},[a,A,b]),P=!h,k=(0,r.useCallback)(ie=>{a.handleTreeHandler({...ie,getModel:()=>a.treeModel})},[a]),F=(0,r.useCallback)((ie,oe)=>{ie.stopPropagation();const{toggleDirectory:le}=a;le(oe)},[a]),L=(0,r.useCallback)(ie=>B(ie)?!1:ie.shiftKey,[]),B=(0,r.useCallback)(ie=>{const{metaKey:oe,ctrlKey:le}=ie;return c.isMacintosh&&oe||le},[]),j=(0,r.useCallback)((ie,oe,le)=>{var pe;ie.stopPropagation();const{handleItemClick:q,handleItemToggleClick:Ee,handleItemRangeClick:_e}=a;if(!oe)return;const ne=L(event),ge=B(event);if(ne&&!P&&g.canSelectMany)_e(oe,le);else if(ge&&!P&&g.canSelectMany)Ee(oe,le);else if(P)le===o.TreeNodeType.CompositeTreeNode&&q(oe,le);else if(g.canSelectFiles&&le===o.TreeNodeType.TreeNode){const we=new Set(Object.values((pe=g.filters)!==null&&pe!==void 0?pe:{}).flat().map(Pe=>`.${Pe}`));if(we.size>0){const Pe=c.URI.parse(oe.filestat.uri).path.ext;we.has(Pe)&&q(oe,le)}else q(oe,le)}else g.canSelectFolders&&le===o.TreeNodeType.CompositeTreeNode&&q(oe,le)},[a,P,g]),W=(0,r.useCallback)(async ie=>{y(!1),S(ie),await a.updateTreeModel(ie),y(!0)},[a,b,A]),U=(0,r.useCallback)(async ie=>{y(!1),S(ie),await a.updateTreeModel(ie),y(!0)},[a,b,A,w]),Q=(0,r.useCallback)(()=>u.renderCustomMsg?u.renderCustomMsg():null,[u.renderCustomMsg]),V=(0,r.useCallback)(ie=>r.default.createElement(m.FileTreeDialogNode,{item:ie.item,itemType:ie.itemType,labelService:a.labelService,decorations:a.decorations.getDecorations(ie.item),onClick:j,onTwistierClick:F,defaultLeftPadding:8,leftPadding:8}),[a.treeModel]),$=(0,r.useCallback)(()=>{if(b){if(a.treeModel)return r.default.createElement(o.RecycleTree,{height:300,itemHeight:t.FILE_TREE_DIALOG_HEIGHT,onReady:k,model:a.treeModel},V)}else return r.default.createElement(p.Progress,{loading:!0})},[b,a]),Y=(0,r.useMemo)(()=>u.showFilePathSearch!==!1,[u.showFilePathSearch]),H=(0,r.useCallback)(()=>{if(w.length>0)return r.default.createElement(o.Select,{onChange:W,onSearchChange:U,className:_.default.select_control,size:"large",searchPlaceholder:A,value:A,showSearch:Y},w.map((ie,oe)=>r.default.createElement(o.Option,{value:ie,key:`${oe} - ${ie}`},ie)))},[w,A]),z=(0,r.useCallback)(ie=>{const{key:oe}=c.KeyCode.createKeyCode(ie),le=ie.shiftKey||ie.metaKey||ie.altKey||ie.ctrlKey;oe&&c.Key.ENTER.keyCode===oe.keyCode&&!le&&I()},[I]);(0,r.useEffect)(()=>{var ie;return E.current&&(u.initContextKey(E.current),u.contextKey.fileDialogViewVisibleContext.set(!0),(ie=E.current)===null||ie===void 0||ie.addEventListener("keyup",z)),()=>{var oe;(oe=E.current)===null||oe===void 0||oe.removeEventListener("keyup",z)}},[]);const K=(0,r.useMemo)(()=>r.default.createElement(r.default.Fragment,null,Q(),r.default.createElement("div",{className:_.default.file_dialog_directory},H()),r.default.createElement("div",{className:_.default.file_dialog_content},$())),[H,$]),Z=(0,r.useMemo)(()=>r.default.createElement("div",{className:_.default.file_dialog_buttons},r.default.createElement(o.Button,{onClick:M,type:"ghost",className:_.default.button},(0,c.localize)("dialog.file.close")),r.default.createElement(o.Button,{onClick:I,type:"primary",className:_.default.button,disabled:P&&g.showNameInput&&f.length===0},h&&g.openLabel||(0,c.localize)("dialog.file.ok"))),[M,I,P,h,f,g]),X=(0,r.useCallback)(ie=>{l(ie.target.value),D.current=ie.target.value},[f]);return r.default.createElement("div",{className:_.default.file_dialog_wrapper,ref:E},r.default.createElement("div",{className:_.default.file_dialog_directory_title},h?g.title||(0,c.localize)("dialog.file.openLabel"):g.saveLabel||(0,c.localize)("dialog.file.saveLabel")),K,!h&&g.showNameInput&&r.default.createElement("div",{className:_.default.file_dialog_file_container},r.default.createElement("span",{className:_.default.file_dialog_file_name},(0,c.localize)("dialog.file.name"),": "),r.default.createElement(o.Input,{size:"small",value:f,autoFocus:!0,selection:{start:0,end:f.indexOf(".")||f.length},onChange:X})),Z)};t.FileDialog=s},89508:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowDialogServiceImpl=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),c=e(41869),p=e(37406),v=e(14951),m=e(72665),_=e(57942),s=n.__importDefault(e(13294)),g=e(9018),a=e(51888);let h=class{constructor(){this.idx=1,this._whenReady=this.init()}async init(){this.recentGlobalStorage=await this.storageProvider(c.STORAGE_NAMESPACE.GLOBAL_RECENT_DATA);const d=await this.recentGlobalStorage.get("RECENT_DIALOG_DEFAULT_URI");if(d)this._defaultUri=new c.URI(d);else{const E=await this.fileServiceClient.getCurrentUserHome();this._defaultUri=new c.URI(E.uri)}}get defaultUri(){return this._defaultUri}get whenReady(){return this._whenReady}async updateRecentDefaultUri(d){this.recentGlobalStorage.set("RECENT_DIALOG_DEFAULT_URI",d.toString()),this._defaultUri=d}async showOpenDialog(d={}){this.dialogService.reset(),await this.whenReady;const E={canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1};if(this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const f=this.injector.get(p.IElectronMainUIService),l=[];d.canSelectFiles&&l.push("openFile"),d.canSelectFolders&&l.push("openDirectory"),d.canSelectMany&&l.push("multiSelections"),c.isMacintosh&&l.push("treatPackageAsDirectory","createDirectory");const b=d.defaultUri||this.defaultUri,y=await f.showOpenDialog(c.electronEnv.currentWindowId,{defaultPath:b.codeUri.fsPath,title:d.title,buttonLabel:d.openLabel,properties:l});if(y&&y.length>0){const A=y.map(S=>c.URI.file(S));return this.updateRecentDefaultUri(A[0].parent),A}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let f;d.defaultUri?f=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):f=this.injector.get(g.FileTreeDialogService),await f.whenReady;const l=_.FileTreeDialogModel.createModel(this.injector,f),b=await this.dialogService.open({message:r.default.createElement(a.FileDialog,{key:this.idx++,fileService:f,model:l,options:{...E,...d},isOpenDialog:!0}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),b&&b.length>0){const y=b.map(A=>c.URI.file(A));return this.updateRecentDefaultUri(y[0].parent),y}else return}}async showSaveDialog(d={}){if(await this.whenReady,this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const E=d.defaultUri||this.defaultUri,l=await this.injector.get(p.IElectronMainUIService).showSaveDialog(c.electronEnv.currentWindowId,{defaultPath:E.resolve(d.defaultFileName||"").codeUri.fsPath,title:d.saveLabel,message:d.saveLabel});if(l){const b=c.URI.file(l);return this.updateRecentDefaultUri(b.parent),b}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let E;d.defaultUri?E=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):E=this.injector.get(g.FileTreeDialogService),await E.whenReady;const f=_.FileTreeDialogModel.createModel(this.injector,E),l=await this.dialogService.open({message:r.default.createElement(a.FileDialog,{key:this.idx++,fileService:E,model:f,options:d,isOpenDialog:!1}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),l&&l.length>0){const b=c.URI.file(l[0]);return this.updateRecentDefaultUri(b.parent),b}else return}}};t.WindowDialogServiceImpl=h,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(m.IDialogService),n.__metadata("design:type",Object)],h.prototype,"dialogService",void 0),n.__decorate([(0,o.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],h.prototype,"fileServiceClient",void 0),n.__decorate([(0,o.Autowired)(c.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),t.WindowDialogServiceImpl=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},88014:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413);let p=class{constructor(){this.explorerResourceIsFolder=c.ExplorerResourceIsFolderContext.bind(this.globalContextKeyService),this.explorerViewletVisibleContext=c.ExplorerViewletVisibleContext.bind(this.globalContextKeyService)}initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.explorerFocused=c.ExplorerFocusedContext.bind(this._contextKeyService),this.explorerResourceCut=c.ExplorerResourceCut.bind(this._contextKeyService),this.filesExplorerFocused=c.FilesExplorerFocusedContext.bind(this._contextKeyService),this.filesExplorerInputFocused=c.FilesExplorerInputFocusedContext.bind(this._contextKeyService),this.filesExplorerFilteredContext=c.FilesExplorerFilteredContext.bind(this._contextKeyService),this.explorerCompressedFocusContext=c.ExplorerCompressedFocusContext.bind(this._contextKeyService),this.explorerCompressedFirstFocusContext=c.ExplorerCompressedFirstFocusContext.bind(this._contextKeyService),this.explorerCompressedLastFocusContext=c.ExplorerCompressedLastFocusContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileContextKey=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},40439:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413),p=e(93899),v=e(68969),m=e(98295),_=e(41893),s=e(54414),g=e(32595),a=e(63067),h=e(58296),u=e(72665),d=e(55121),E=e(51500),f=e(6250),l=e(69959),b=e(56384),y=e(57781),A=e(97738),S=e(4446);let w=class{constructor(){this._disposables=new o.DisposableStore,this.isRendered=!1,this.deleteThrottler=new o.Throttler,this.willDeleteUris=[]}initialize(){this.workspaceService.initFileServiceExclude().then(async()=>{await this.fileTreeService.init(),this.fileTreeModelService.initTreeModel()}),this.progressService.registerProgressIndicator(g.EXPLORER_CONTAINER_ID)}async onStart(){this.viewsRegistry.registerViewWelcomeContent(f.RESOURCE_VIEW_ID,{content:(0,o.formatLocalize)("welcome-view.noFolderHelp",o.FILE_COMMANDS.OPEN_FOLDER.id),group:h.ViewContentGroups.Open,order:1}),this.mainLayoutService.collectViewComponent({id:f.RESOURCE_VIEW_ID,name:this.getWorkspaceTitle(),weight:3,priority:9,collapsed:!1,component:b.FileTree},g.EXPLORER_CONTAINER_ID),this._disposables.add(this.workspaceService.onWorkspaceLocationChanged(()=>{const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&D.updateViewTitle(f.RESOURCE_VIEW_ID,this.getWorkspaceTitle())}))}onDidStart(){const D=this.injector.get(S.SymlinkDecorationsProvider,[this.fileTreeService]);this.decorationService.registerDecorationsProvider(D)}onDidRender(){this.isRendered=!0;const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&(this.fileTreeModelService.whenReady.then(()=>{this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(D.isActivated())}),D.onActivate(()=>{this.fileTreeModelService.performLocationOnHandleShow(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!0)}),D.onInActivate(()=>{this.fileTreeModelService.handleTreeBlur(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!1)}))}getWorkspaceTitle(){let D=(0,o.localize)("file.empty.defaultTitle");const I=this.workspaceService.workspace;return I&&(D=new o.URI(I.uri).displayName,!I.isDirectory&&D.endsWith(`.${this.workspaceService.workspaceSuffixName}`)&&(D=D.slice(0,D.lastIndexOf(".")),D===E.UNTITLED_WORKSPACE))?(0,o.localize)("file.workspace.defaultTip"):D}revealFile(D){if(D)if(this.isRendered){const I=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!I||!I.isVisible||I.isCollapsed(f.RESOURCE_VIEW_ID)?this.fileTreeModelService.locationOnShow(D):this.fileTreeModelService.location(D)}else this.fileTreeModelService.locationOnShow(D)}registerMenus(D){D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new")},order:1,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new")},order:2,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.removeFolderFromWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_RESOURCES.id,label:(0,o.localize)("file.open")},order:1,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TO_THE_SIDE.id,label:(0,o.localize)("file.open.side")},order:2,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TYPE_WITH.id,label:(0,o.localize)("file.open.type")},order:3,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH.id,label:(0,o.localize)("file.filetree.openTerminalWithPath")},when:"workbench.panel.terminal",order:4,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.SEARCH_ON_FOLDER.id,label:(0,o.localize)("file.search.folder")},order:1,group:"2_search"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.DELETE_FILE.id,label:(0,o.localize)("file.delete")},order:1,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.RENAME_FILE.id,label:(0,o.localize)("file.rename")},order:3,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COMPARE_SELECTED.id,label:(0,o.localize)("file.compare")},order:2,group:"3_compare"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_FILE.id,label:(0,o.localize)("file.copy.file")},order:1,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.CUT_FILE.id,label:(0,o.localize)("file.cut.file")},order:2,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.PASTE_FILE.id,label:(0,o.localize)("file.paste.file")},order:3,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_PATH.id,label:(0,o.localize)("file.copy.path")},group:"6_copypath"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_RELATIVE_PATH.id,label:(0,o.localize)("file.copy.relativepath")},group:"6_copypath"})}registerCommands(D){const I=()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()};D.registerCommand(o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH,{execute:M=>{let R=M;if(!R)return;const P=this.fileTreeService.getNodeByPathOrUri(R);P&&!P.filestat.isDirectory&&(R=P.uri.parent),this.commandService.executeCommand(o.TERMINAL_COMMANDS.OPEN_WITH_PATH.id,R)}}),D.registerCommand(o.FILE_COMMANDS.SEARCH_ON_FOLDER,{execute:async M=>{var R;let P=M;if(P||(this.fileTreeModelService.focusedFile?P=this.fileTreeModelService.focusedFile.uri:this.fileTreeModelService.selectedFiles.length>0&&(P=(R=this.fileTreeModelService.selectedFiles[0])===null||R===void 0?void 0:R.uri)),!P)return;let k;if(this.fileTreeService.isMultipleWorkspace)for(const F of await this.workspaceService.roots){const L=new o.URI(F.uri);if(L.isEqualOrParent(P)){k=`./${L.relative(P).toString()}`;break}}else if(this.workspaceService.workspace){const F=new o.URI(this.workspaceService.workspace.uri);F.isEqualOrParent(P)&&(k=`./${F.relative(P).toString()}`)}this.commandService.executeCommand(o.SEARCH_COMMANDS.OPEN_SEARCH.id,{includeValue:k+"/"})},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.LOCATION,{execute:M=>{M?this.revealFile(M):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0&&this.revealFile(this.fileTreeModelService.selectedFiles[0].uri)}}),D.registerCommand(o.FILE_COMMANDS.LOCATION_WITH_EDITOR,{execute:()=>{var M,R,P;((R=(M=this.workbenchEditorService.currentEditor)===null||M===void 0?void 0:M.currentUri)===null||R===void 0?void 0:R.scheme)===o.Schemes.file&&this.revealFile((P=this.workbenchEditorService.currentEditor)===null||P===void 0?void 0:P.currentUri)}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE_ALL,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||this.fileTreeModelService.collapseAll()}}),D.registerCommand(o.FILE_COMMANDS.REFRESH_ALL,{execute:async()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||await this.fileTreeService.refresh()}}),D.registerCommand(o.FILE_COMMANDS.DELETE_FILE,{execute:(M,R)=>{if(I(),R?this.willDeleteUris=this.willDeleteUris.concat(R):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0?this.willDeleteUris=this.willDeleteUris.concat(this.fileTreeModelService.selectedFiles.map(P=>P.uri)):this.fileTreeModelService.focusedFile&&this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri),this.willDeleteUris.length!==0)return this.deleteThrottler.queue(this.doDelete.bind(this))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.RENAME_FILE,{execute:M=>{if(I(),!M)if(this.fileTreeModelService.contextMenuFile)M=this.fileTreeModelService.contextMenuFile.uri;else if(this.fileTreeModelService.focusedFile)M=this.fileTreeModelService.focusedFile.uri;else return;this.fileTreeModelService.renamePrompt(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.NEW_FILE,{execute:async M=>{var R;if(I(),M)this.fileTreeModelService.newFilePrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((R=this.workspaceService.workspace)===null||R===void 0?void 0:R.uri),this.fileTreeModelService.newFilePrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.NEW_FOLDER,{execute:async M=>{var R;if(I(),M)this.fileTreeModelService.newDirectoryPrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((R=this.workspaceService.workspace)===null||R===void 0?void 0:R.uri),this.fileTreeModelService.newDirectoryPrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.COMPARE_SELECTED,{execute:(M,R)=>{if(R&&R.length){const P=this.workbenchEditorService.currentEditor;P&&P.currentUri&&this.fileTreeService.compare(R[0],P.currentUri)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_RESOURCES,{execute:M=>{this.fileTreeService.openAndFixedFile(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_TO_THE_SIDE,{execute:M=>{this.fileTreeService.openToTheSide(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)});const O=(M,R)=>{const{availableOpenTypes:P,currentOpenType:k}=this.workbenchEditorService.currentEditorGroup;if(!(P&&M&&k))return{items:[],selectIndex:-1};const F=this.preferenceService.get("workbench.editorAssociations"),L=[],B=(Q,V)=>V.type===s.EditorOpenType.code?Q.type===s.EditorOpenType.code:V.type===s.EditorOpenType.component&&Q.type===s.EditorOpenType.component?Q.componentId===V.componentId:!1,j=(Q,V)=>(Q?Q+=(0,o.localize)("file.open.type.detail.and")+V:Q=V,Q);let W,U;if(F){const Q=Object.keys(F).find(V=>(0,o.match)(V,M.path.toString().toLowerCase())||(0,o.match)(V,M.path.base.toLowerCase()));W=Q&&F[Q]}return P.forEach((Q,V)=>{var $;const Y={label:Q.title||Q.componentId||Q.type,detail:Q.title,run:H=>R(H,Q)};B(k,Q)&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.active")),U=V),W&&(!(($=Q.componentId)===null||$===void 0)&&$.endsWith(W))&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.default"))),L.push(new o.QuickOpenItem(Y))}),{items:L,selectIndex:U}};D.registerCommand(o.FILE_COMMANDS.OPEN_TYPE_WITH,{execute:M=>{const R=(L,B)=>{var j,W;return L===o.Mode.OPEN?((j=this.workbenchEditorService.currentEditorGroup)===null||j===void 0||j.changeOpenType((W=B.componentId)!==null&&W!==void 0?W:B.type),!0):!1},{items:P,selectIndex:k}=O(M,R);if(P.length===0||typeof k>"u")return;const F=L=>{this.quickOpenService.open({onType:(B,j)=>j(L)},{fuzzyMatchLabel:!0,ignoreFocusOut:!1,placeholder:(0,o.formatLocalize)("file.open.type.placeholder",M.path.base),selectIndex:()=>k})};P.push(new o.QuickOpenItem({label:(0,o.formatLocalize)("file.open.type.preference.default",`*${M.path.ext}`),showBorder:!0,run:L=>{if(L===o.Mode.OPEN){const B=(U,Q)=>{var V,$,Y;if(U===o.Mode.OPEN){const H="workbench.editorAssociations",z=this.preferenceService.resolve(H).scope,K=this.preferenceService.get(H);return this.preferenceService.set(H,{...K||{},[`*${M.path.ext}`]:(V=Q.componentId)!==null&&V!==void 0?V:Q.type},z),($=this.workbenchEditorService.currentEditorGroup)===null||$===void 0||$.changeOpenType((Y=Q.componentId)!==null&&Y!==void 0?Y:Q.type),!0}return!1},{items:j,selectIndex:W}=O(M,B);if(j.length===0||typeof W>"u")return!0;F(j)}return!1}})),F(P)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.COPY_PATH,{execute:async M=>{if(!M)return;let P=M.path.toString();if(M.scheme===s.DIFF_SCHEME){const F=M.getParsedQuery();P=new o.URI(F.modified).path.toString()}let k=decodeURIComponent(P);await this.appService.backendOS===o.OperatingSystem.Windows&&(k=k.slice(1)),await this.clipboardService.writeText(k)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_RELATIVE_PATH,{execute:async M=>{if(!M)return;if(M.scheme===s.DIFF_SCHEME){const k=M.getParsedQuery();M=new o.URI(k.modified).withScheme("file")}const R=this.fileTreeService.getNodeByPathOrUri(M);if(R&&R.filestat.isInSymbolicDirectory)return await this.clipboardService.writeText(R.path.split(d.Path.separator).slice(2).join(d.Path.separator));let P;if(this.fileTreeService.isMultipleWorkspace)for(const k of await this.workspaceService.roots){if(P=new o.URI(k.uri),P.isEqual(M))return await this.clipboardService.writeText("./");if(P.isEqualOrParent(M))return await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))}else if(this.workspaceService.workspace)return P=new o.URI(this.workspaceService.workspace.uri),P.isEqual(M)?await this.clipboardService.writeText("./"):await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_FILE,{execute:(M,R)=>{if(R&&R.length)this.fileTreeModelService.copyFile(R);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.copyFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.SELECT_CURRENT_NODE,{execute:(M,R)=>{if(R&&R.length)this.fileTreeModelService.selectChildNode(R);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.selectChildNode(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.CUT_FILE,{execute:(M,R)=>{if(R&&R.length)this.fileTreeModelService.cutFile(R);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.cutFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.PASTE_FILE,{execute:M=>{if(I(),M)this.fileTreeModelService.pasteFile(M);else if(this.fileTreeModelService.focusedFile){let R;this.fileTreeModelService.activeUri?R=this.fileTreeModelService.activeUri:R=this.fileTreeModelService.focusedFile.uri,this.fileTreeModelService.pasteFile(R)}},isEnabled:()=>this.fileTreeModelService.pasteStore&&this.fileTreeModelService.pasteStore.type!==f.PasteTypes.NONE||this.appConfig.isElectronRenderer}),D.registerCommand(o.FILE_COMMANDS.VSCODE_OPEN_FOLDER,{execute:(M,R)=>{const P=this.injector.get(o.IWindowService),k={newWindow:!0};return typeof R=="boolean"?k.newWindow=R:k.newWindow=typeof R?.forceNewWindow=="boolean"?R.forceNewWindow:!0,M?P.openWorkspace(M,k):this.commandService.executeCommand(o.FILE_COMMANDS.OPEN_FOLDER.id,k)},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FOLDER,{execute:M=>{const R=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),properties:["openDirectory"]}).then(k=>{k&&k.length>0&&R.openWorkspace(o.URI.file(k[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),canSelectFiles:!1,canSelectFolders:!0}).then(k=>{var F;k&&k.length>0&&this.injector.get(E.IWorkspaceService).open(k[0],{preserveWindow:(F=M?.newWindow)!==null&&F!==void 0?F:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_WORKSPACE,{execute:M=>{if(!this.preferenceService.get("application.supportsOpenWorkspace"))return;const P=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),properties:["openFile"],filters:[{name:(0,o.localize)("workspace.openWorkspaceTitle"),extensions:[this.workspaceService.workspaceSuffixName]}]}).then(F=>{F&&F.length>0&&P.openWorkspace(o.URI.file(F[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,filters:{workspace:[this.workspaceService.workspaceSuffixName]}}).then(F=>{var L;F&&F.length>0&&this.injector.get(E.IWorkspaceService).open(F[0],{preserveWindow:(L=M?.newWindow)!==null&&L!==void 0?L:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenWorkspace");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.REVEAL_IN_EXPLORER,{execute:M=>{var R;let P=M instanceof o.URI?M:M?.uri;const k=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);k&&!k.isVisible&&(k.activate(),setTimeout(()=>{k.setCollapsed(f.RESOURCE_VIEW_ID,!1)},200)),!P&&(!((R=this.workbenchEditorService.currentEditor)===null||R===void 0)&&R.currentUri)&&(P=this.workbenchEditorService.currentEditor.currentUri),P&&this.revealFile(o.URI.parse(P.toString()))}}),D.registerCommand(o.FILE_COMMANDS.FOCUS_FILES,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);M&&M.activate()}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FILE,{execute:M=>this.windowDialogService.showOpenDialog(M)}),D.registerCommand(o.FILE_COMMANDS.SAVE_FILE,{execute:M=>this.windowDialogService.showSaveDialog(M)}),D.registerCommand(o.FILE_COMMANDS.FILTER_TOGGLE,{execute:()=>this.fileTreeService.toggleFilterMode()}),D.registerCommand(o.FILE_COMMANDS.FILTER_OPEN,{execute:()=>{if(!this.fileTreeService.filterMode)return this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.FILTER_CLOSE,{execute:()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.NEXT,{execute:()=>{this.fileTreeModelService.moveToNext()}}),D.registerCommand(o.FILE_COMMANDS.PREV,{execute:()=>{this.fileTreeModelService.moveToPrev()}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE,{execute:()=>{this.fileTreeModelService.collapseCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.EXPAND,{execute:()=>{this.fileTreeModelService.expandCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.TOGGLE_OR_OPEN,{execute:()=>{this.fileTreeModelService.toggleOrOpenCurrentFile()}}),D.registerCommand(o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER,{execute:async(M,R)=>{if(I(),!R.length||!this.workspaceService.isMultiRootWorkspaceOpened)return;const P=await this.workspaceService.roots,k=R.filter(F=>P.find(L=>L.uri===F.toString()));k.length>0&&await this.workspaceService.removeRoots(k)},isVisible:()=>this.workspaceService.isMultiRootWorkspaceOpened&&!!this.fileTreeModelService.contextMenuFile&&!!this.workspaceService.tryGetRoots().find(M=>{var R;return M.uri===((R=this.fileTreeModelService.contextMenuFile)===null||R===void 0?void 0:R.uri.toString())})})}registerKeybindings(D){D.registerKeybinding({command:o.FILE_COMMANDS.COPY_FILE.id,keybinding:"ctrlcmd+c",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PASTE_FILE.id,keybinding:"ctrlcmd+v",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.CUT_FILE.id,keybinding:"ctrlcmd+x",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.SELECT_CURRENT_NODE.id,keybinding:"ctrlcmd+a",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.RENAME_FILE.id,keybinding:"enter",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.DELETE_FILE.id,keybinding:"ctrlcmd+backspace",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_OPEN.id,keybinding:"ctrlcmd+f",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_CLOSE.id,keybinding:"esc",when:`${c.FilesExplorerFocusedContext.raw} && ${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.NEXT.id,keybinding:"down",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PREV.id,keybinding:"up",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.EXPAND.id,keybinding:"right",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.COLLAPSE.id,keybinding:"left",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.TOGGLE_OR_OPEN.id,keybinding:"space",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`})}registerToolbarItems(D){D.registerItem({id:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,command:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,label:(0,o.localize)("file.location"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !config.explorer.autoReveal && !${c.FilesExplorerFilteredContext.raw}`,order:0}),D.registerItem({id:o.FILE_COMMANDS.NEW_FILE.id,command:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:1}),D.registerItem({id:o.FILE_COMMANDS.NEW_FOLDER.id,command:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:2}),D.registerItem({id:o.FILE_COMMANDS.FILTER_TOGGLE.id,command:o.FILE_COMMANDS.FILTER_TOGGLE.id,label:(0,o.localize)("file.filetree.filter"),viewId:f.RESOURCE_VIEW_ID,toggledWhen:`${c.FilesExplorerFilteredContext.raw}`,order:3}),D.registerItem({id:o.FILE_COMMANDS.REFRESH_ALL.id,command:o.FILE_COMMANDS.REFRESH_ALL.id,label:(0,o.localize)("file.refresh"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:4}),D.registerItem({id:o.FILE_COMMANDS.COLLAPSE_ALL.id,command:o.FILE_COMMANDS.COLLAPSE_ALL.id,label:(0,o.localize)("file.collapse"),viewId:f.RESOURCE_VIEW_ID,order:5}),D.registerItem({id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,command:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace"),viewId:f.RESOURCE_VIEW_ID,order:0,group:"file_explore_workspace",when:"config.workspace.supportMultiRootWorkspace"})}doDelete(){const D=this.willDeleteUris.slice();return this.willDeleteUris=[],this.fileTreeModelService.deleteFileByUris(D)}dispose(){this._disposables.dispose()}};t.FileTreeContribution=w,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],w.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(f.IFileTreeService),n.__metadata("design:type",y.FileTreeService)],w.prototype,"fileTreeService",void 0),n.__decorate([(0,r.Autowired)(a.IMainLayoutService),n.__metadata("design:type",Object)],w.prototype,"mainLayoutService",void 0),n.__decorate([(0,r.Autowired)(v.IProgressService),n.__metadata("design:type",Object)],w.prototype,"progressService",void 0),n.__decorate([(0,r.Autowired)(E.IWorkspaceService),n.__metadata("design:type",Object)],w.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(A.FileTreeModelService),n.__metadata("design:type",A.FileTreeModelService)],w.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(_.IDecorationsService),n.__metadata("design:type",_.IDecorationsService)],w.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(s.WorkbenchEditorService),n.__metadata("design:type",s.WorkbenchEditorService)],w.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],w.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(u.IWindowDialogService),n.__metadata("design:type",Object)],w.prototype,"windowDialogService",void 0),n.__decorate([(0,r.Autowired)(o.IClipboardService),n.__metadata("design:type",Object)],w.prototype,"clipboardService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],w.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.QuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(a.IViewsRegistry),n.__metadata("design:type",Object)],w.prototype,"viewsRegistry",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],w.prototype,"appService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],w.prototype,"appConfig",void 0),t.FileTreeContribution=w=n.__decorate([(0,m.Domain)(p.MenuContribution,o.CommandContribution,o.KeybindingContribution,o.TabBarToolbarContribution,o.ClientAppContribution,a.MainLayoutContribution)],w)},2812:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(69959),m=e(93239);let _=n=class extends c.TreeModel{constructor(g){super(),this.flushDispatchChangeDelayer=new p.ThrottledDelayer(n.DEFAULT_FLUSH_DELAY),this.init(g)}init(g){this.root=g,this.root.watcher.on(c.TreeNodeEvent.BranchDidUpdate,this.doDispatchChange.bind(this)),this.decorationService.onDidChange(this.doDispatchChange.bind(this))}doDispatchChange(){this.flushDispatchChangeDelayer.isTriggered()||this.flushDispatchChangeDelayer.cancel(),this.flushDispatchChangeDelayer.trigger(async()=>{this.dispatchChange()})}};t.FileTreeModel=_,_.DEFAULT_FLUSH_DELAY=100,r.__decorate([(0,o.Autowired)(m.FileTreeDecorationService),r.__metadata("design:type",m.FileTreeDecorationService)],_.prototype,"decorationService",void 0),t.FileTreeModel=_=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[v.Directory])],_)},46377:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),{Path:_}=p.path,s=({item:g,onClick:a,onDoubleClick:h,onContextMenu:u,dndService:d,itemType:E,decorationService:f,labelService:l,leftPadding:b=8,onTwistierClick:y,decorations:A,defaultLeftPadding:S=8,template:w,hasFolderIcons:T,hasFileIcons:D,hidesExplorerArrows:I,hasPrompt:O,iconService:M})=>{const[R,P]=o.default.useState(-1),k=E===c.TreeNodeType.RenamePrompt,F=E===c.TreeNodeType.NewPrompt,L=k||F,B=!L&&g.name.indexOf(_.separator)>=0,j=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),W=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),U=L?null:f.getDecoration(g.uri,v.Directory.is(g)),Q=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),a(Pe,g,E))},V=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),h(Pe,g,E))},$=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(y?y(Pe,g,E):a(Pe,g,E))},Y=o.default.useCallback(Pe=>{Pe.nativeEvent.which!==0&&(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&u(Pe,g,E)},[u,g]),H=o.default.useCallback(Pe=>{const{handleDragStart:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),z=o.default.useCallback(Pe=>{const{handleDragLeave:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),K=o.default.useCallback(Pe=>{const{handleDragEnter:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),Z=o.default.useCallback(Pe=>{const{handleDrop:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),X=o.default.useCallback(Pe=>{const{handleDragOver:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]);let ie=E===c.TreeNodeType.CompositeTreeNode,oe;L?F?(ie=g.type===c.TreeNodeType.CompositeTreeNode,oe=`${S+(g.parent.depth+1||0)*(b||0)+(ie?0:T?I?0:20:0)}px`):(ie=g.target.type===c.TreeNodeType.CompositeTreeNode,oe=`${S+(g.target.depth||0)*(b||0)+(ie?0:T?I?0:20:0)}px`):oe=`${S+(g.depth||0)*(b||0)+(ie?0:T?I?0:20:0)}px`;const le={color:U?U.color:"",height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:oe,opacity:O&&!L?".6":"1"},pe=(Pe,Ae)=>{if(A&&A?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(L&&Pe instanceof c.PromptHandle){let Te=!1;if(k?Te=Pe.target.type===c.TreeNodeType.CompositeTreeNode:Te=Pe.type===c.TreeNodeType.CompositeTreeNode,Te)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:F||!(k&&Pe.target.type===c.TreeNodeType.CompositeTreeNode&&Pe.target.expanded)})})}else return o.default.createElement("div",{onClick:Ae,className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!Pe.expanded})})},q=Pe=>{let Ae,Te;L&&Pe instanceof c.PromptHandle?Pe instanceof c.RenamePromptHandle?(Ae=Pe.target.uri.resolve(Pe.$.value),Te=v.Directory.is(Pe.target)):(Ae=Pe.parent.uri.resolve(Pe.$.value),Te=Pe.type===c.TreeNodeType.CompositeTreeNode):(Ae=Pe.uri,Te=Pe.filestat.isDirectory);const be=l.getIcon(Ae,{isDirectory:Te,isOpenedDirectory:Te&&Pe.expanded});return Te&&!T||!Te&&!D?null:o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,be,{expanded:Te&&Pe.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},Ee=Pe=>{if(w)return o.default.createElement(w,null);if(L&&Pe instanceof c.PromptHandle)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(Pe.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}})));if(B){const Ae=Pe.displayName.split(_.separator),Te=Ae.map((be,me)=>{const xe=Ae.slice(0,me+1).join(_.separator),Re=Fe=>{Fe.stopPropagation(),P(me);const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));a(Fe,g,E,Ge)},Ne=Fe=>{Fe.stopPropagation(),P(me);const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));u(Fe,g,E,Ge)},fe=Fe=>{Fe.stopPropagation(),Fe.preventDefault(),R!==me&&(P(me),d.handleDragOver(Fe,g))},re=Fe=>{Fe.stopPropagation(),Fe.preventDefault(),P(-1)},he=Fe=>{Fe.stopPropagation(),R!==me&&P(me);const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));d.handleDragStart(Fe,g,Ge)},Oe=Fe=>{const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));d.handleDrop(Fe,g,Ge)},De=(0,r.default)(R===me&&m.default.active,m.default.compact_name);return o.default.createElement("span",{key:xe},o.default.createElement("a",{className:De,draggable:!0,onContextMenu:Ne,onDragStart:he,onDragOver:fe,onDragLeave:re,onDrop:Oe,onClick:Re},be),me!==Ae.length-1?o.default.createElement("span",{className:m.default.compact_name_separator},_.separator):null)});return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},Te)}return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},l.getName(Pe.uri)||Pe.displayName)},_e=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},ne()),ne=()=>U?o.default.createElement("div",{className:m.default.file_tree_node_status},(0,p.transformLabelWithCodicon)(U.badge.slice(),{color:"inherit"},M.fromString.bind(M))):null,ge=Pe=>{if(I)return null;if(ie)return pe(Pe,$);if(L)return pe(Pe,()=>{})},we=()=>{let Pe=g.tooltip;return U&&U.badge&&(Pe+=` \u2022 ${U.tooltip}`),Pe};return o.default.createElement("div",{key:g.id,onClick:Q,onDoubleClick:V,onContextMenu:Y,onDragStart:H,onDragOver:X,onDragEnter:K,onDragLeave:z,onDrop:Z,title:we(),className:(0,r.default)(W,A?A.classlist:null),style:le,draggable:E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode,"data-id":g.id},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},ge(g),q(g),o.default.createElement("div",{className:L?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},Ee(g)),_e()))};t.FileTreeNode=s,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},56384:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTree=t.FILE_TREE_FILTER_DELAY=t.FILTER_AREA_HEIGHT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(68974),m=e(24429),_=e(87420),s=e(6250),g=e(46377),a=n.__importDefault(e(2613)),h=e(97738);t.FILTER_AREA_HEIGHT=30,t.FILE_TREE_FILTER_DELAY=500;const u=(0,c.RecycleTreeFilterDecorator)(c.RecycleTree),d=({viewState:f})=>{const[l,b]=(0,o.useState)(!1),[y,A]=(0,o.useState)(!0),[S,w]=(0,o.useState)(!1),[T,D]=(0,o.useState)(!1),[I,O]=(0,o.useState)(),M=(0,o.useRef)(null),R=(0,o.useRef)(new p.DisposableCollection),{height:P}=f,k=(0,p.useInjectable)(s.IFileTreeService),{iconService:F,locationToCurrentFile:L,filterMode:B,indent:j,baseIndent:W}=k,U=(0,p.useInjectable)(h.FileTreeModelService),[Q,V]=(0,o.useState)({indent:j,baseIndent:W}),[$,Y]=(0,o.useState)(B),[H,z]=(0,o.useState)(F.currentTheme||{hasFolderIcons:!0,hasFileIcons:!0,hidesExplorerArrows:!0}),K=(0,o.useCallback)(xe=>Z(xe)?!1:xe.shiftKey,[]),Z=(0,o.useCallback)(xe=>{const{metaKey:Re,ctrlKey:Ne}=xe;return p.isOSX&&Re||Ne},[]),X=(0,o.useCallback)((xe,Re,Ne,fe)=>{xe.stopPropagation();const{handleItemClick:re,handleItemToggleClick:he,handleItemRangeClick:Oe}=U;if(!Re)return;const De=K(xe),Fe=Z(xe);De?Oe(Re,Ne):Fe?he(Re,Ne):re(Re,Ne,fe)},[]),ie=(0,o.useCallback)((xe,Re,Ne)=>{xe.stopPropagation();const{handleItemDoubleClick:fe}=U;Re&&fe(Re,Ne)},[]),oe=(0,o.useCallback)((xe,Re)=>{xe.stopPropagation();const{toggleDirectory:Ne}=U;Ne(Re)},[]);(0,o.useEffect)(()=>{l&&U.onFileTreeModelChange(async xe=>{A(!0),xe&&(await xe.ensureReady,M.current&&k.initContextKey(M.current)),O(xe),A(!1)})},[l,M.current,k]),(0,o.useEffect)(()=>{var xe,Re,Ne;const fe=new p.CancellationTokenSource;return q(fe.token),(xe=R.current)===null||xe===void 0||xe.push(F.onThemeChange(re=>{z(re)})),(Re=R.current)===null||Re===void 0||Re.push(k.onTreeIndentChange(({indent:re,baseIndent:he})=>{V({indent:re,baseIndent:he})})),(Ne=R.current)===null||Ne===void 0||Ne.push(k.onFilterModeChange(re=>{Y(re)})),()=>{var re;fe.cancel(),(re=R.current)===null||re===void 0||re.dispose()}},[]);const le=(0,o.useCallback)((xe,Re)=>{let Ne;if(xe&&Re)for(Ne=xe.parentNode;Ne;){if(Re===Ne)return!0;Ne=Ne.parentNode}return!1},[]),pe=(0,o.useCallback)(xe=>{le(xe.relatedTarget,M.current)||!xe.relatedTarget||(w(!1),U.handleTreeBlur())},[M.current]);(0,o.useEffect)(()=>{$||(U.fileTreeHandle&&U.fileTreeHandle.clearFilter(),U.selectedFiles.length===1&&U.location(U.selectedFiles[0].uri))},[$]),(0,o.useEffect)(()=>{const xe=new p.DisposableCollection;return I&&(xe.push(U.onDidFocusedFileChange(Re=>{Re?Re.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Re||S&&w(!S)})),xe.push(U.onDidContextMenuFileChange(Re=>{Re?Re.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Re||S&&w(!S)}))),()=>{xe.dispose()}},[I,S]);const q=(0,o.useCallback)(async xe=>{var Re;if(await U.whenReady,!xe.isCancellationRequested){if(U.treeModel){if(await U.treeModel.ensureReady,O(U.treeModel),xe.isCancellationRequested)return;M.current&&k.initContextKey(M.current)}A(!1),!((Re=R.current)===null||Re===void 0)&&Re.disposed||b(!0)}},[U,R.current]),Ee=(0,o.useCallback)(xe=>{U.handleTreeHandler({...xe,getModel:()=>U.treeModel,hasDirectFocus:()=>M.current===document.activeElement})},[M.current,I]),_e=(0,o.useCallback)(()=>{const{handleItemClick:xe}=U;xe()},[]),ne=(0,o.useCallback)(()=>{U.handleDblClick()},[]),ge=(0,o.useCallback)(()=>{const{handleTreeFocus:xe}=U;xe()},[]),we=(0,o.useCallback)(xe=>{const{handleContextMenu:Re}=U;Re(xe)},[]),Pe=(0,o.useCallback)(xe=>{xe.stopPropagation(),xe.preventDefault()},[]),Ae=(0,o.useCallback)(xe=>{xe.preventDefault(),D(!0)},[]),Te=(0,o.useCallback)(()=>{D(!1)},[]),be=(0,o.useCallback)(xe=>{const{handleDrop:Re}=U.dndService;D(!1),Re(xe)},[]),me=(0,o.useCallback)((xe,Re,Ne,fe)=>{const{handleContextMenu:re}=U;re(xe,Re,fe)},[]);return o.default.createElement("div",{className:(0,r.default)(a.default.file_tree,T&&a.default.outer_drag_over,S&&a.default.outer_active),tabIndex:-1,ref:M,onClick:_e,onDoubleClick:ne,onFocus:ge,onBlur:pe,onContextMenu:we,draggable:!0,onDragStart:Pe,onDragLeave:Te,onDragOver:Ae,onDrop:be},o.default.createElement(E,{isLoading:y,isReady:l,height:P,model:I,iconTheme:H,treeIndent:Q,filterMode:$,locationToCurrentFile:L,onTreeReady:Ee,onContextMenu:me,onItemClick:X,onItemDoubleClick:ie,onTwistierClick:oe}))};t.FileTree=d;const E=(0,o.memo)(({isReady:f,isLoading:l,height:b,model:y,filterMode:A,treeIndent:S,iconTheme:w,onTreeReady:T,onItemClick:D,onItemDoubleClick:I,onContextMenu:O,onTwistierClick:M})=>{const R=(0,p.useInjectable)(s.IFileTreeService),P=(0,p.useInjectable)(_.IIconService),{decorationService:k,labelService:F,locationToCurrentFile:L}=R,B=(0,p.useInjectable)(h.FileTreeModelService),j=(0,o.useCallback)(W=>o.default.createElement(g.FileTreeNode,{item:W.item,itemType:W.itemType,template:W.template,decorationService:k,labelService:F,iconService:P,dndService:B.dndService,decorations:B.decorations.getDecorations(W.item),onClick:D,onDoubleClick:I,onTwistierClick:M,onContextMenu:O,defaultLeftPadding:S.baseIndent,leftPadding:S.indent,hasPrompt:W.hasPrompt,hasFolderIcons:w.hasFolderIcons,hasFileIcons:w.hasFileIcons,hidesExplorerArrows:w.hidesExplorerArrows}),[y,S,w]);return f?l?o.default.createElement(v.Progress,{loading:!0}):y?o.default.createElement(u,{height:b,itemHeight:g.FILE_TREE_NODE_HEIGHT,onReady:T,model:y,filterEnabled:A,filterAfterClear:L,filterAutoFocus:!0,leaveBottomBlank:!0},j):o.default.createElement(m.WelcomeView,{viewId:s.FILE_EXPLORER_WELCOME_ID}):o.default.createElement(v.Progress,{loading:!0})});E.displayName="FileTreeView"},57781:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(18193),v=e(26542),m=e(42933),_=e(52416),s=e(51500),g=e(6250),a=e(69959),h=e(88014),u=e(93239),{Path:d}=c.path;let E=class extends o.Tree{constructor(){super(...arguments),this._fileServiceWatchers=new Map,this._symbolicFiles=new Map,this._changeEventDispatchQueue=new Set,this._readyToWatch=!1,this._watchRootsQueue=[],this.effectedNodes=[],this.onWorkspaceChangeEmitter=new c.Emitter,this.onTreeIndentChangeEmitter=new c.Emitter,this.onFilterModeChangeEmitter=new c.Emitter,this.onNodeRefreshedEmitter=new c.Emitter,this._filterMode=!1,this._refreshable=!0,this.refreshEffectNode=()=>{const l=this.effectedNodes.slice(0);if(this.effectedNodes=[],l.find(y=>a.Directory.isRoot(y)))this.refresh();else for(const y of l)this.refresh(y)},this.flushEventQueue=async()=>{if(!this._changeEventDispatchQueue||this._changeEventDispatchQueue.size===0)return;const l=Array.from(this._changeEventDispatchQueue),b=this.sortPaths(l);(!this.refreshCancelToken||this.refreshCancelToken.token.isCancellationRequested)&&(this.refreshCancelToken=new c.CancellationTokenSource);const y=(0,c.pSeries)(b.map(A=>async()=>{a.Directory.is(A.node)&&await A.node.refresh(this.refreshCancelToken)}));return this._changeEventDispatchQueue.clear(),await y},this.locationToCurrentFile=()=>{this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}}get onNodeRefreshed(){return this.onNodeRefreshedEmitter.event}get refreshable(){return this._refreshable}get filterMode(){return this._filterMode}get baseIndent(){return this._baseIndent}get indent(){return this._indent}get onWorkspaceChange(){return this.onWorkspaceChangeEmitter.event}get onTreeIndentChange(){return this.onTreeIndentChangeEmitter.event}get onFilterModeChange(){return this.onFilterModeChangeEmitter.event}get isCompactMode(){return this._isCompactMode}get contextKey(){return this.fileContextKey}async init(){this._roots=await this.workspaceService.roots,await this.preferenceService.ready,this._baseIndent=this.preferenceService.getValid("explorer.fileTree.baseIndent",8),this._indent=this.preferenceService.getValid("explorer.fileTree.indent",8),this._isCompactMode=this.preferenceService.getValid("explorer.compactFolders",!0),this.toDispose.push(this.workspaceService.onWorkspaceChanged(l=>{this._roots=l;const b=new c.URI(l[0].uri),y=new a.Directory(this,void 0,b,b.displayName,l[0],this.fileTreeAPI.getReadableTooltip(b));this.root=y,this.onWorkspaceChangeEmitter.fire(y),this.refresh()})),this.toDispose.push(this.workspaceService.onWorkspaceFileExcludeChanged(()=>{this.refresh()})),this.toDispose.push(c.Disposable.create(()=>{var l;(l=this._root)===null||l===void 0||l.dispose(),this._roots=null})),this.toDispose.push(this.corePreferences.onPreferenceChanged(l=>{l.preferenceName==="explorer.fileTree.baseIndent"?(this._baseIndent=l.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):l.preferenceName==="explorer.fileTree.indent"?(this._indent=l.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):l.preferenceName==="explorer.compactFolders"&&(this._isCompactMode=l.newValue,this.refresh())}))}initContextKey(l){this.fileContextKey.initScopedContext(l)}startWatchFileEvent(){return this._readyToWatch=!0,Promise.all(this._watchRootsQueue.map(l=>this.watchFilesChange(l)))}async resolveChildren(l){var b,y,A,S;let w=[];if(l){if(a.Directory.isRoot(l)&&this.isMultipleWorkspace){const T=await this.workspaceService.roots;for(const D of T){const I=this.fileTreeAPI.toNode(this,D,l,this.workspaceService.getWorkspaceName(new c.URI(D.uri)));this.watchFilesChange(new c.URI(D.uri)),w=w.concat(I),(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)}return w}if(l.uri){const T=await this.fileTreeAPI.resolveChildren(this,l.uri.toString(),l,this.isCompactMode&&!a.Directory.isRoot(l));w=T.children,w.forEach(I=>{(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)});const D=T.filestat;if(D&&this.isCompactMode&&!a.Directory.isRoot(l)){const I=new c.URI(D.uri),O=l.parent;if(l&&O){let M=l.name;if(l.filestat.isSymbolicLink){const R=(y=new c.URI(l.filestat.realUri).relative(I))===null||y===void 0?void 0:y.toString();R&&(M=R,M=[l.uri.displayName].concat(M.split(d.separator)).join(d.separator))}else O.filestat.isSymbolicLink?M=(A=new c.URI(O.filestat.realUri).relative(I))===null||A===void 0?void 0:A.toString():M=(S=O.uri.relative(I))===null||S===void 0?void 0:S.toString();M&&M!==l.name&&l.updateMetaData({name:M,uri:I,tooltip:this.fileTreeAPI.getReadableTooltip(I),fileStat:D})}}return w}}else if(this._roots||(this._roots=await this.workspaceService.roots),this.isMultipleWorkspace){const T=new c.URI((b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri);let D=T.displayName;D=D.slice(0,D.lastIndexOf("."));const I={...this.workspaceService.workspace,isDirectory:!0},O=new a.Directory(this,void 0,T,D,I,this.fileTreeAPI.getReadableTooltip(T));return this.root=O,[O]}else if(this._roots.length>0)return w=await(await this.fileTreeAPI.resolveChildren(this,this._roots[0])).children,w.forEach(T=>{const D=this.workspaceService.getWorkspaceName(T.uri);D&&D!==T.name&&T.updateMetaData({name:D}),(T.filestat.isSymbolicLink||T.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(T.filestat.uri,T)}),this.watchFilesChange(new c.URI(this._roots[0].uri)),this.root=w[0],w;return[]}async watchFilesChange(l){if(!this._readyToWatch){this._watchRootsQueue.push(l);return}const b=await this.fileServiceClient.watchFileChanges(l);this.toDispose.push(b),this.toDispose.push(b.onFilesChanged(y=>{this.onFilesChanged(y)})),this._fileServiceWatchers.set(l.toString(),b)}updateRefreshable(l){var b;l!==this.refreshable&&(this._refreshable=l,this._refreshable?this.doHandleQueueChange():(b=this.refreshCancelToken)===null||b===void 0||b.cancel())}isContentFile(l){return!!l&&"filestat"in l&&!l.filestat.isDirectory}isFileContentChanged(l){return l.type===m.FileChangeType.UPDATED&&this.isContentFile(this.getNodeByPathOrUri(l.uri))}getAffectedChanges(l){const b=[];for(const y of l)this.isFileContentChanged(y)||b.push(y);return b}isRootAffected(l){return this._roots?l.some(b=>b.type>m.FileChangeType.UPDATED&&this._roots&&this._roots.find(y=>b.uri.indexOf(y.uri)>=0)):!1}async onFilesChanged(l){const b=await this.getAffectedNodes(this.getAffectedChanges(l));return b.length>0?this.effectedNodes=this.effectedNodes.concat(b):!(b.length>0)&&this.isRootAffected(l)&&this.effectedNodes.push(this.root),this.refreshEffectNode()}async getFileTreeNodePathByUri(l){var b,y,A,S,w,T;if(!l)return;let D;if(this.isMultipleWorkspace){if(this._roots||(this._roots=await this.workspaceService.roots),D=(S=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(l)))===null||S===void 0?void 0:S.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(l))return new d(((w=this.root)===null||w===void 0?void 0:w.path)||"/").join(I.displayName).join(((T=I.relative(l))===null||T===void 0?void 0:T.toString())||"").toString()}}else if(D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(l))return new d(((y=this.root)===null||y===void 0?void 0:y.path)||"").join(((A=I.relative(l))===null||A===void 0?void 0:A.toString())||"").toString()}}async moveNodeByPath(l,b,y,A,S=o.TreeNodeType.TreeNode){const w=new d(l.path).join(y).toString(),T=new d(b.path).join(A).toString();if(w&&T&&T!==w){const D=l.moveNode(w,T);return D&&a.File.is(D)&&(D.updateMetaData({uri:b.uri.resolve(A),fileStat:{...b.filestat,uri:b.uri.resolve(A).toString(),isDirectory:S!==o.TreeNodeType.TreeNode},tooltip:this.fileTreeAPI.getReadableTooltip(b.uri.resolve(A))}),a.Directory.is(D)&&this.updateChildren(D)),D}}async updateChildren(l){const b=l.children;if(!(!b||b.length===0)){for(const y of b)if(a.File.is(y)){const A=l.uri.resolve(y.uri.displayName);y.updateMetaData({uri:A,fileStat:{...y.filestat,uri:A.toString(),isDirectory:!!a.Directory.is(y)},tooltip:this.fileTreeAPI.getReadableTooltip(A)}),a.Directory.is(y)&&this.updateChildren(y)}}}async addNode(l,b,y){let A,S;const w=d.splitPath(b);if(w.length>1){let D=l.uri;for(const I of w)D=D.resolve(I);!this.isCompactMode||a.Directory.isRoot(l)?S=w[0]:y===o.TreeNodeType.CompositeTreeNode?S=b:S=w.slice(0,w.length-1).join(d.separator)}else S=b;A={uri:l.uri.resolve(S).toString(),isDirectory:y===o.TreeNodeType.CompositeTreeNode||w.length>1,isSymbolicLink:!1,lastModification:new Date().getTime()};const T=await this.fileTreeAPI.toNode(this,A,l,S);return T&&l.addNode(T),T}async deleteAffectedNodeByPath(l,b){var y,A;const S=this.getNodeByPathOrUri(l);S&&S.parent&&(this.isCompactMode&&!b?((y=S.parent.children)===null||y===void 0?void 0:y.length)===2?this.refresh((A=S.parent)===null||A===void 0?void 0:A.parent):this.refresh(S.parent):S.parent.removeNode(S.path))}async deleteAffectedNodes(l,b=[]){const y=[];for(const A of l){const S=this.getNodeByPathOrUri(A);S&&a.File.is(S)&&y.push(S)}for(const A of y)!A?.parent||this._changeEventDispatchQueue.has(A?.parent.path)||await this.deleteAffectedNodeByPath(A.path);return b.filter(A=>A.type!==m.FileChangeType.DELETED)}async getAffectedNodes(l){const b=[];for(const y of l){const A=new c.URI(y.uri),S=this.getNodeByPathOrUri(A.parent);S&&b.push(S)}return b}isFileURI(l){return/^file:\/\//.test(l)}getNodeByPathOrUri(l){var b,y,A,S;let w,T;if(typeof l!="string"?(T=l,l=l.toString()):this.isFileURI(l)?T=new c.URI(l):!this.isFileURI(l)&&typeof l=="string"&&(w=l),this.isFileURI(l)&&T){if(this._symbolicFiles.has(T?.toString()))return this._symbolicFiles.get(T.toString());let D;if(this.isMultipleWorkspace?this._roots&&(D=(y=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(T)))===null||y===void 0?void 0:y.uri):D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,this.root&&D){const I=new c.URI(D);if(I.isEqualOrParent(T)){const O=I.relative(T);O&&(this.isMultipleWorkspace?w=new d(this.root.path).join(I.displayName).join(O.toString()).toString():w=new d(this.root.path).join(O.toString()).toString())}}}if(w){const D=(A=this.root)===null||A===void 0?void 0:A.getTreeNodeByPath(w);if(!D){let I;const O=w.split(d.separator);for(;O.length>=1;){O.pop();const M=O.join(d.separator);if(I=(S=this.root)===null||S===void 0?void 0:S.getTreeNodeByPath(M),I)break}if(I&&a.Directory.is(I)){for(const M of I.children||[])if(M.path.includes(w))return M}}return D}}sortComparator(l,b){return l.constructor===b.constructor?l.name.localeCompare(b.name,"en",{numeric:!0}):l.type===o.TreeNodeType.CompositeTreeNode?-1:b.type===o.TreeNodeType.CompositeTreeNode?1:0}get contextMenuContextKeyService(){return this.fileContextKey?this.fileContextKey.service:this.contextKeyService}get isMultipleWorkspace(){return!!this.workspaceService.workspace&&!this.workspaceService.workspace.isDirectory}getDisplayName(l){return this.workspaceService.getWorkspaceName(l)}async refresh(l=this.root){if(l)return a.Directory.is(l)||a.File.is(l)&&l.parent&&(l=l.parent),this._changeEventDispatchQueue.add(l.path),this.doHandleQueueChange()}async doHandleQueueChange(){if(this.refreshable)try{await this.flushEventQueue()}catch(l){this.logger.error("flush file change event queue error:",l)}finally{this.onNodeRefreshedEmitter.fire()}}sortPaths(l){const y=l.slice().map(S=>({node:this.getNodeByPathOrUri(S),path:S})).filter(S=>S&&!!S.node);l.length>1&&y.sort((S,w)=>{var T,D;const I=((T=S.node)===null||T===void 0?void 0:T.depth)||0,O=((D=w.node)===null||D===void 0?void 0:D.depth)||0;return I-O});const A=[];for(let S=y.length-1;S>=0;S--){const w=y[S];let T=!1;for(let D=0;D<S;D++){const I=y[D];a.Directory.is(I)&&w.node.path.startsWith(I.node.path)&&(T=!0)}T||A.push(w)}return A}openFile(l){const b=this.preferenceService.get("editor.previewMode");this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,preview:b})}openAndFixedFile(l){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,preview:!1,focus:!0})}openToTheSide(l){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,split:4})}compare(l,b){this.commandService.executeCommand(c.EDITOR_COMMANDS.COMPARE.id,{original:l,modified:b})}toggleFilterMode(){var l;this._filterMode=!this.filterMode,this.onFilterModeChangeEmitter.fire(this.filterMode),(l=this.fileContextKey)===null||l===void 0||l.filesExplorerFilteredContext.set(this.filterMode),this.filterMode===!1&&this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}};t.FileTreeService=E,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],E.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],E.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(c.IContextKeyService),n.__metadata("design:type",Object)],E.prototype,"contextKeyService",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.CorePreferences),n.__metadata("design:type",Object)],E.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],E.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(v.LabelService),n.__metadata("design:type",v.LabelService)],E.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileTreeDecorationService),n.__metadata("design:type",u.FileTreeDecorationService)],E.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],E.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(_.IIconService),n.__metadata("design:type",Object)],E.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(c.ILogger),n.__metadata("design:type",Object)],E.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(h.FileContextKey),n.__metadata("design:type",h.FileContextKey)],E.prototype,"fileContextKey",void 0),t.FileTreeService=E=n.__decorate([(0,r.Injectable)()],E)},83709:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeNextModule=void 0;const n=e(85608),r=e(41869),o=e(72665),c=e(41103),p=e(6250),v=e(89508),m=e(40439),_=e(57781),s=e(88808),g=e(93239),a=e(97738),h=e(24861);let u=class extends r.BrowserModule{constructor(){super(...arguments),this.providers=[{token:p.IFileTreeAPI,useClass:s.FileTreeAPI},{token:g.FileTreeDecorationService,useClass:g.FileTreeDecorationService},{token:p.IFileTreeService,useClass:_.FileTreeService},{token:a.FileTreeModelService,useClass:a.FileTreeModelService},{token:o.IWindowDialogService,useClass:v.WindowDialogServiceImpl},m.FileTreeContribution]}};t.FileTreeNextModule=u,t.FileTreeNextModule=u=n.__decorate([(0,r.Domain)(h.name),(0,r.ModuleDependencies)([c.WorkspaceModule])],u)},88808:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeAPI=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(42933),v=e(72665),m=e(26199),_=e(69959);let s=class{constructor(){this.onDidResolveChildrenEmitter=new c.Emitter,this.onDidResolveChildren=this.onDidResolveChildrenEmitter.event}async resolveChildren(a,h,u,d){var E;let f;if(!this.userhomePath){const l=await this.fileServiceClient.getCurrentUserHome();l&&(this.userhomePath=new c.URI(l.uri))}if(typeof h=="string"?f=await this.fileServiceClient.getFileStat(h):f=await this.fileServiceClient.getFileStat(h.uri),f){if(this.onDidResolveChildrenEmitter.fire(f.uri.toString()),((E=f.children)===null||E===void 0?void 0:E.length)===1&&f.children[0].isDirectory&&d)return await this.resolveChildren(a,f.children[0].uri,u,d);{const l={...f,isInSymbolicDirectory:u?.filestat.isSymbolicLink||u?.filestat.isInSymbolicDirectory};return{children:this.toNodes(a,l,u),filestat:l}}}else return{children:[],filestat:null}}async resolveNodeByPath(a,h,u){const d=await this.fileServiceClient.getFileStat(h);if(d)return this.toNode(a,d,u)}async resolveFileStat(a){return await this.fileServiceClient.getFileStat(a.toString())}toNodes(a,h,u){if(u){if(h.children)return h.children.map(d=>this.toNode(a,d,u))}else return[this.toNode(a,h,u)];return[]}toNode(a,h,u,d){var E;const f=new c.URI(h.uri),l=d||f.displayName;let b;return h.isInSymbolicDirectory=(E=u?.filestat.isSymbolicLink)!==null&&E!==void 0?E:u?.filestat.isInSymbolicDirectory,h.isDirectory?b=new _.Directory(a,u,f,l,h,this.getReadableTooltip(f)):b=new _.File(a,u,f,l,h,this.getReadableTooltip(f)),b}async mvFiles(a,h){const u=[];for(const f of a)if(f.url.isEqualOrParent(h))return;const d=a.sort((f,l)=>f.toString().length-l.toString().length),E=[];for(const f of d)E.length>0&&E.find(l=>l.url.isEqualOrParent(f.url))||E.push(f);if(this.corePreferences["explorer.confirmMove"]){const f=(0,c.localize)("file.confirm.move.ok"),l=(0,c.localize)("file.confirm.move.cancel");if(await this.dialogService.warning((0,c.formatLocalize)("file.confirm.move",`[ ${E.map(y=>y.url.displayName).join(",")} ]`,h.displayName),[l,f])!==f)return}for(const f of E){const l=await this.mv(f.url,h.resolve(f.url.displayName),f.isDirectory);l&&u.push(l)}return u}async mv(a,h,u=!1){try{await this.workspaceEditService.apply({edits:[{newResource:h,oldResource:a,options:{isDirectory:u,overwrite:!0}}]})}catch(d){return d.message}}async createFile(a,h){try{await this.workspaceEditService.apply({edits:[{newResource:a,options:{content:h}}]})}catch(u){return u.message}this.commandService.executeCommand(o.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,focus:!0})}async createDirectory(a){try{await this.workspaceEditService.apply({edits:[{newResource:a,options:{isDirectory:!0}}]})}catch(h){return h.message}}async delete(a){try{await this.workspaceEditService.apply({edits:[{oldResource:a,options:{}}]});return}catch(h){return h.message}}async copyFile(a,h){let u=1,d;try{d=await this.fileServiceClient.access(h.toString())}catch(E){return E.message}for(;d;){const E=h.displayName.replace(/\Wcopy\W\d+/,""),f=c.path.extname(E),b=`${c.path.basename(E,f)} copy ${u}${f}`;h=h.parent.resolve(b),u++;try{d=await this.fileServiceClient.access(h.toString())}catch{return}}try{return await this.fileServiceClient.copy(a.toString(),h.toString())}catch(E){return E.message}}getReadableTooltip(a){const h=a.toString(),u=this.userhomePath&&this.userhomePath.toString();return this.userhomePath&&this.userhomePath.isEqualOrParent(a)?decodeURIComponent(h.replace(u,"~")):decodeURIComponent(a.withScheme("").toString())}};t.FileTreeAPI=s,n.__decorate([(0,r.Autowired)(p.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IWorkspaceEditService),n.__metadata("design:type",Object)],s.prototype,"workspaceEditService",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],s.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.CorePreferences),n.__metadata("design:type",Object)],s.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(v.IDialogService),n.__metadata("design:type",Object)],s.prototype,"dialogService",void 0),t.FileTreeAPI=s=n.__decorate([(0,r.Injectable)()],s)},93239:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDecorationService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(41893),p=e(52416);let v=class{constructor(){this.disposeCollection=new o.DisposableCollection,this.onDidChangeEmitter=new o.Emitter,this.cacheDecorations=new Map,this.disposeCollection.pushAll([this.decorationsService.onDidChangeDecorations(_=>{var s,g,a;const h=(g=(s=_._data)===null||s===void 0?void 0:s._iter)===null||g===void 0?void 0:g._value;if(h){const u=new o.URI(h),d=this.getDecoration(u);this.cacheDecorations.has(h)?((a=this.cacheDecorations.get(h))===null||a===void 0?void 0:a.tooltip)!==d?.tooltip&&this.onDidChangeEmitter.fire():(this.cacheDecorations.set(h,d),this.onDidChangeEmitter.fire())}}),this.themeService.onThemeChange(()=>{this.onDidChangeEmitter.fire()})])}get onDidChange(){return this.onDidChangeEmitter.event}getDecoration(_,s=!1){_ instanceof o.URI&&(_=o.Uri.parse(_.toString()));const g=this.decorationsService.getDecoration(_,s);return g?{...g,color:this.themeService.getColor({id:g.color})}:{color:"",tooltip:"",badge:""}}dispose(){this.disposeCollection.dispose()}};t.FileTreeDecorationService=v,n.__decorate([(0,r.Autowired)(c.IDecorationsService),n.__metadata("design:type",c.IDecorationsService)],v.prototype,"decorationsService",void 0),n.__decorate([(0,r.Autowired)(p.IThemeService),n.__metadata("design:type",Object)],v.prototype,"themeService",void 0),t.FileTreeDecorationService=v=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],v)},30577:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DragAndDropService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(53622),m=e(14951),_=e(72665),s=e(51500),g=e(6250),a=e(69959),h=r.__importDefault(e(89200)),u=r.__importDefault(e(2613)),d=e(57781),E=e(97738);let f=n=class extends p.WithEventBus{constructor(b){super(),this.model=b,this.toCancelNodeExpansion=new p.DisposableCollection,this.beingDraggedDec=new c.Decoration(h.default.mod_dragging),this.draggedOverDec=new c.Decoration(h.default.mod_dragover),this.beingDraggedNodes=[],this.dragOverTrigger=new p.ThrottledDelayer(n.MS_TILL_DRAGGED_OVER_EXPANDS),this.handleDragStart=(y,A,S)=>{y.stopPropagation();const w=O=>{this.handleDragEnd(O,A)};y.currentTarget.addEventListener("dragend",w,!1);let T=this.model.selectedFiles,D=!1;for(const O of T)O&&O.id===A.id&&(D=!0);D||(T=[A]),this.beingDraggedNodes=T,this.beingDraggedActiveUri=S;const I=T.find(O=>!a.Directory.is(O));if(I&&y.dataTransfer.setData("uri",I.uri.toString()),y.dataTransfer.setData("beingDraggedNodes",JSON.stringify(this.beingDraggedNodes.map(O=>O.uri.toString()))),I){const O=I;O.uri.scheme==="file"&&y.dataTransfer.setData("DownloadURL",`application/octet-stream:${O.displayName}:data:application/octet-stream;base64,${(0,p.encodeBase64)(p.BinaryBuffer.fromString(O.filestat.uri))}`)}if(T.forEach(O=>{this.beingDraggedDec.addTarget(O,c.TargetMatchMode.Self)}),y.dataTransfer){let O;T.length===1?O=S?S.displayName:typeof A.name=="string"?A.name:"":O=String(T.length);const M=document.createElement("div");M.className=u.default.file_tree_drag_image,M.textContent=O,document.body.appendChild(M),y.dataTransfer.setDragImage(M,-10,-10),setTimeout(()=>document.body.removeChild(M),0)}},this.handleDragEnter=(y,A)=>{y.stopPropagation(),y.preventDefault()},this.handleDragLeave=(y,A)=>{y.preventDefault(),y.stopPropagation(),this.toCancelNodeExpansion.dispose(),this.potentialParent&&(this.draggedOverDec.removeTarget(this.potentialParent),this.model.treeModel.dispatchChange())},this.handleDragOver=(y,A)=>{if(y.preventDefault(),y.stopPropagation(),!this.toCancelNodeExpansion.disposed||this.beingDraggedNodes.indexOf(A)>=0)return;this.draggedOverNode=A;const S=a.Directory.is(A)&&A.expanded?A:A.parent;(this.potentialParent!==S||!this.draggedOverDec.hasTarget(S))&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=S,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren),this.model.treeModel.dispatchChange()),this.potentialParent!==A&&a.Directory.is(A)&&(this.dragOverTrigger.trigger(async()=>{A.expanded?(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren)):(await A.setExpanded(!0),this.draggedOverNode===A&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren))),this.model.treeModel.dispatchChange()}),this.toCancelNodeExpansion.push(p.Disposable.create(()=>{this.dragOverTrigger.isTriggered()||this.dragOverTrigger.cancel()})))},this.handleDrop=async(y,A,S)=>{var w,T;this.eventBus.fire(new v.FileTreeDropEvent({event:y.nativeEvent,targetDir:S?S.codeUri.path:A&&A instanceof a.File?(w=A.parent)===null||w===void 0?void 0:w.uri.codeUri.path:A?A.uri.codeUri.path:new p.URI((T=this.workspaceService.workspace)===null||T===void 0?void 0:T.uri).codeUri.path}));try{y.preventDefault(),y.stopPropagation(),y.dataTransfer.dropEffect="copy";let D;const I=!!this.beingDraggedActiveUri;this.fileTreeService.isCompactMode&&S&&!A?.uri.isEqual(S)?D=null:A?D=a.Directory.is(A)?A:A.parent:D=this.root;let O;if(this.beingDraggedActiveUri){const M=this.fileTreeService.getNodeByPathOrUri(this.beingDraggedActiveUri);O=[new a.Directory(this.fileTreeService,M?.parent,this.beingDraggedActiveUri,this.beingDraggedActiveUri.displayName,{uri:this.beingDraggedActiveUri.toString(),isDirectory:!0,lastModification:new Date().getTime()},this.beingDraggedActiveUri.displayName)]}else if(O=this.beingDraggedNodes,!O||O.length===0)try{const M=JSON.parse(y.dataTransfer.getData("beingDraggedNodes"));M&&M.length!==0&&(O=M.map(R=>this.fileTreeService.getNodeByPathOrUri(new p.URI(R))).filter(Boolean),O.length||(O=await Promise.all(M.map(async R=>{const P=new p.URI(R);let k;const F=await this.filesystem.getFileStat(P.toString());return F?.isDirectory?k=new a.Directory(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName):k=new a.File(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName),k}))))}catch{}if(O.length>0){const M=S||D&&D.uri,R=O.filter(P=>P&&P.parent&&(this.beingDraggedActiveUri?!P.parent.uri.isEqual(M):!0));if(R.length>0){const P=await this.fileTreeAPI.mvFiles(R.map(k=>({url:k.uri,isDirectory:k.filestat.isDirectory})),M);if(P&&P.length>0)P.forEach(k=>{this.messageService.error(k)});else if(P){if(D)if(this.fileTreeService.isCompactMode&&I){for(const k of R)this.fileTreeService.refresh(k.parent);this.fileTreeService.refresh(D)}else for(const k of R){const F=D.uri.resolve(k.name);this.fileTreeService.moveNodeByPath(k.parent,D,k.name,k.name,k.type),k.updateMetaData({name:F.displayName,fileStat:{...k.filestat,uri:F.toString()},uri:F,tooltip:this.fileTreeAPI.getReadableTooltip(F)}),a.Directory.is(k)&&this.fileTreeService.refresh(k)}else if(A){if(this.fileTreeService.isCompactMode&&I)for(const k of R)this.fileTreeService.refresh(k.parent);else for(const k of R)this.fileTreeService.deleteAffectedNodeByPath(k.path);this.fileTreeService.refresh(A.parent)}}else return}}A&&this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(M=>{this.beingDraggedDec.removeTarget(M)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()}catch(D){this.logger.error(D)}},this.handleDragEnd=(y,A)=>{this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(S=>{this.beingDraggedDec.removeTarget(S)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()},this.model.decorations.addDecoration(this.beingDraggedDec),this.model.decorations.addDecoration(this.draggedOverDec)}get root(){return this.model.treeModel.root}};t.DragAndDropService=f,f.MS_TILL_DRAGGED_OVER_EXPANDS=500,r.__decorate([(0,o.Autowired)(g.IFileTreeAPI),r.__metadata("design:type",Object)],f.prototype,"fileTreeAPI",void 0),r.__decorate([(0,o.Autowired)(p.ILogger),r.__metadata("design:type",Object)],f.prototype,"logger",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],f.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(g.IFileTreeService),r.__metadata("design:type",d.FileTreeService)],f.prototype,"fileTreeService",void 0),r.__decorate([(0,o.Autowired)(m.IFileServiceClient),r.__metadata("design:type",Object)],f.prototype,"filesystem",void 0),r.__decorate([(0,o.Autowired)(s.IWorkspaceService),r.__metadata("design:type",Object)],f.prototype,"workspaceService",void 0),t.DragAndDropService=f=n=r.__decorate([(0,o.Injectable)(),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[E.FileTreeModelService])],f)},97738:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModelService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(91830),m=e(93899),_=e(26542),s=e(54414),g=e(14951),a=e(63067),h=e(53576),u=e(72665),d=e(6250),E=e(69959),f=e(2812),l=e(46377),b=r.__importDefault(e(89200)),y=e(57781),A=e(30577),{Path:S,isValidBasename:w}=p.path,{coalesce:T}=p.arrays,{trim:D,rtrim:I}=p.strings;let O=n=class{constructor(){this._isDisposed=!1,this._whenReady=new p.Deferred,this.selectedDecoration=new c.Decoration(b.default.mod_selected),this.focusedDecoration=new c.Decoration(b.default.mod_focused),this.contextMenuDecoration=new c.Decoration(b.default.mod_actived),this.loadingDecoration=new c.Decoration(b.default.mod_loading),this.cutDecoration=new c.Decoration(b.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this._isMultiSelected=!1,this.refreshedActionDelayer=new p.ThrottledDelayer(n.DEFAULT_REFRESHED_ACTION_DELAY),this.labelChangedDelayer=new p.ThrottledDelayer(n.DEFAULT_LABEL_CHANGED_DELAY),this.locationThrottler=new p.Throttler,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidContextMenuFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.onFileTreeModelChangeEmitter=new p.Emitter,this._initTreeModelReady=!1,this.clearFileSelectedDecoration=()=>{this.selectedDecoration.clearAppliedTarget(),this._selectedFiles=[]},this.activeFileDecoration=(R,P=!0)=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),R&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(R),this.focusedDecoration.addTarget(R),this.focusedFile=R,this.selectedFiles=[R],P&&this.treeModel.dispatchChange())},this.selectFileDecoration=(R,P=!0)=>{R!==this.treeModel.root&&(this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),R&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(R),this._selectedFiles=[R],P&&this.treeModel.dispatchChange()))},this.activateFileActivedDecoration=R=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuDecoration.addTarget(R),this.contextMenuFile=R,this.treeModel.dispatchChange()},this.activateFileFocusedDecoration=R=>{this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedDecoration.addTarget(R),this.focusedFile=R,this.treeModel.dispatchChange()},this.activeFileFocusedDecoration=(R,P=!1)=>{R!==this.treeModel.root&&(this.focusedFile!==R&&(P?(this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile=R):this.focusedFile&&(this.contextMenuFile=void 0,this.focusedDecoration.clearAppliedTarget()),R&&(this._selectedFiles.indexOf(R)<0&&(this.selectedDecoration.addTarget(R),this._selectedFiles.push(R),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri))),this.focusedDecoration.addTarget(R),this.focusedFile=R)),this.treeModel.dispatchChange())},this.toggleFileSelectedDecoration=R=>{const P=this._selectedFiles.indexOf(R);P>-1?(this.focusedFile===R&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this._selectedFiles.splice(P,1),this.selectedDecoration.clearAppliedTarget()):(this._selectedFiles.push(R),this.selectedDecoration.addTarget(R),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.focusedFile=R,this.focusedDecoration.addTarget(R)),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.activeFileDecorationByRange=(R,P)=>{for(this.clearFileSelectedDecoration(),this.contextMenuFile=void 0;R<=P;R++){const k=this.treeModel.root.getTreeNodeAtIndex(R);k&&(this._selectedFiles.push(k),this.selectedDecoration.addTarget(k))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.deactivateFileDecoration=()=>{var R;this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuFile&&this.contextMenuDecoration.removeTarget(this.contextMenuFile),(R=this.treeModel)===null||R===void 0||R.dispatchChange()},this.toggleDirectory=async R=>{R.expanded?this.fileTreeHandle.collapseNode(R):this.fileTreeHandle.expandNode(R)},this.handleDblClick=()=>{this.commandService.executeCommand(p.FILE_COMMANDS.NEW_FILE.id)},this.handleContextMenu=(R,P,k)=>{var F;R.stopPropagation(),R.preventDefault();let L,B;P?(B=P,this._isMultiSelected?this.selectedFiles.indexOf(B)>=0?L=this.selectedFiles:L=[B]:L=[B]):(L=[this.treeModel.root],B=this.treeModel.root),this.activateFileActivedDecoration(B),this.setFileTreeContextKey(B),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null);const j=this.contextMenuService.createMenu({id:m.MenuId.ExplorerContext,contextKeyService:this.fileTreeService.contextMenuContextKeyService}),W=j.getMergedMenuNodes();j.dispose(),this.updateExplorerCompressedContextKey(B,k);const{x:U,y:Q}=R.nativeEvent;this.ctxMenuRenderer.show({anchor:{x:U,y:Q},menuNodes:W,args:k?[k,[k]]:[B.uri,L.map(V=>V.uri)]})},this.handleTreeBlur=()=>{var R,P,k;this._isDisposed||((P=(R=this.contextKey)===null||R===void 0?void 0:R.filesExplorerFocused)===null||P===void 0||P.set(!1),this.deactivateFileDecoration(),(k=this.contextKey)===null||k===void 0||k.explorerResourceIsFolder.set(!1))},this.handleTreeFocus=()=>{var R,P;(P=(R=this.contextKey)===null||R===void 0?void 0:R.filesExplorerFocused)===null||P===void 0||P.set(!0)},this.handleItemRangeClick=(R,P)=>{if(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),!this.focusedFile)this.handleItemClick(R,P);else if(this.focusedFile&&this.focusedFile!==R){this._isMultiSelected=!0;const k=this.treeModel.root.getIndexAtTreeNode(R),F=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);F>k?this.activeFileDecorationByRange(k,F):F<k&&this.activeFileDecorationByRange(F,k)}},this.handleItemToggleClick=(R,P)=>{this._isMultiSelected=!0,!(P!==c.TreeNodeType.CompositeTreeNode&&P!==c.TreeNodeType.TreeNode)&&(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),this.toggleFileSelectedDecoration(R))},this.handleItemClick=(R,P=this.fileTreeService.isMultipleWorkspace?c.TreeNodeType.TreeNode:c.TreeNodeType.CompositeTreeNode,k)=>{var F,L,B,j;if(this.treeModel&&(R||(R=this.treeModel.root),this.updateExplorerCompressedContextKey(R,k),this._isMultiSelected=!1,(P===c.TreeNodeType.CompositeTreeNode||P===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(R),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null,(L=this.contextKey)===null||L===void 0||L.explorerResourceIsFolder.set(P===c.TreeNodeType.CompositeTreeNode)),this.corePreferences["workbench.list.openMode"]==="singleClick")){if(P===c.TreeNodeType.CompositeTreeNode){if((B=this.contextKey)===null||B===void 0||B.explorerResourceIsFolder.set(!0),R===this.treeModel.root)return;this.toggleDirectory(R)}else if(P===c.TreeNodeType.TreeNode){if((j=this.contextKey)===null||j===void 0||j.explorerResourceIsFolder.set(!1),R===this.treeModel.root)return;this.fileTreeService.openFile(R.uri),this.mainlayoutService.bottomExpanded&&this.commandService.executeCommand(h.RETRACT_BOTTOM_PANEL.id)}}},this.handleItemDoubleClick=(R,P)=>{P===c.TreeNodeType.TreeNode?this.fileTreeService.openAndFixedFile(R.uri):this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(R)},this.validateFileName=(R,P)=>{var k;if(P=this.getWellFormedFileName(P),!P||P.length===0||/^\s+$/.test(P))return{message:(0,p.localize)("validate.tree.emptyFileNameError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]==="/"||P[0]==="\\")return{message:(0,p.localize)("validate.tree.fileNameStartsWithSlashError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]===" "||P[P.length-1]===" ")return{message:(0,p.localize)("validate.tree.fileNameFollowOrStartWithSpaceWarning"),type:c.PROMPT_VALIDATE_TYPE.WARNING,value:P};let F;if(R.target){const B=R.target;if(P===B.name)return null;F=B.parent}else F=R.parent;return F&&!(R instanceof c.RenamePromptHandle&&R.target.displayName.indexOf(S.separator)>0)&&((k=F.children)===null||k===void 0?void 0:k.find(W=>W.name===P))?{message:(0,p.formatLocalize)("validate.tree.fileNameExistsError",P),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:T(P.split(/[\\/]/)).some(B=>!w(B))?{message:(0,p.formatLocalize)("validate.tree.invalidFileNameError",this.trimLongName(P)),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:null},this.proxyPrompt=R=>{let P=!1;const k=async V=>{const $=await this.fileTreeService.getNodeByPathOrUri(V);$&&(E.Directory.is($)?this.selectFileDecoration($):this.location($.uri))},F=async V=>{var $,Y,H;if(this.validateMessage=void 0,R instanceof c.RenamePromptHandle){const z=R.target,K=R.target.displayName.split(S.separator),Z=z.name.indexOf(S.separator)>0;if(Z&&this.activeUri&&!R.target.uri.toString().includes(this.activeUri.toString()))return!1;const X=this.activeUri?K.length-R.target.uri.toString().replace(this.activeUri.toString(),"").split(S.separator).length:-1,ie=X===-1?[]:K.slice(0,X).concat(V);let oe=z.uri,le=z.parent.uri.resolve(V);if(Z&&(($=this.activeUri)===null||$===void 0?void 0:$.displayName)===V||!Z&&V===z.name)return!0;R.addAddonAfter("loading_indicator"),Z&&ie.length>0&&E.Directory.is(z.parent)&&(oe=z.parent.uri.resolve(K.slice(0,X+1).join(S.separator)),le=z.parent.uri.resolve(ie.concat().join(S.separator)));const pe=await this.fileTreeAPI.mv(oe,le,z.type===c.TreeNodeType.CompositeTreeNode);if(pe)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:pe,value:V},this.fileTreeService.updateRefreshable(!0),R.addValidateMessage(this.validateMessage),!1;if(this.fileTreeService.updateRefreshable(!1),R.removeAddonAfter(),!Z&&z.parent){const q=await this.fileTreeService.moveNodeByPath(z.parent,z.parent,z.name,V,z.type);q&&this.selectFileDecoration(q,!1),this.fileTreeService.updateRefreshable(!0)}else if(E.Directory.is(z)&&!E.Directory.isRoot(z)){z.updateMetaData({name:ie.concat(K.slice(X+1)).join(S.separator),uri:le,fileStat:{...z.filestat,uri:le.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(le)}),this.treeModel.dispatchChange();let q;E.Directory.is(z.parent)&&(!((Y=z.parent.children)===null||Y===void 0)&&Y.find(Ee=>z.path.indexOf(Ee.path)>=0))?q=this.fileTreeService.refresh(z.parent):q=this.fileTreeService.refresh(z),q.then(()=>{k(le)})}R.removeAddonAfter()}else if(R instanceof c.NewPromptHandle){const z=R.parent,K=z.uri.resolve(V);let Z;if(R.addAddonAfter("loading_indicator"),this.fileTreeService.updateRefreshable(!0),R.type===c.TreeNodeType.CompositeTreeNode?Z=await this.fileTreeAPI.createDirectory(K):Z=await this.fileTreeAPI.createFile(K),R.removeAddonAfter(),Z)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:Z,value:V},this.fileTreeService.updateRefreshable(!1),R.addValidateMessage(this.validateMessage),!1;if(V.includes(S.separator)&&this.fileTreeService.refresh(z).then(()=>{k(z.uri.resolve(V))}),this.fileTreeService.isCompactMode)if(R.type===c.TreeNodeType.CompositeTreeNode)if((!z.children||z.children.length===0)&&!E.Directory.isRoot(z)){const ie=z.uri.resolve(V),oe=[z.name].concat(V).join(S.separator);z.updateMetaData({name:oe,uri:ie,fileStat:{...z.filestat,uri:ie.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(ie)}),k(ie)}else await this.fileTreeService.addNode(z,V,R.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,R.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,R.type),k(z.uri.resolve(V))}return(H=this.contextKey)===null||H===void 0||H.filesExplorerInputFocused.set(!1),!0},L=async V=>{var $,Y,H,z;if(this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;if(P)return!1;if(!V){($=this.contextKey)===null||$===void 0||$.explorerCompressedFocusContext.set(!1),(Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFirstFocusContext.set(!1),(H=this.contextKey)===null||H===void 0||H.explorerCompressedLastFocusContext.set(!1),this.fileTreeService.isCompactMode&&R instanceof c.NewPromptHandle&&this.fileTreeService.refresh(R.parent);return}return(z=this.contextKey)===null||z===void 0||z.filesExplorerInputFocused.set(!1),await F(V),!0},B=async V=>{if(P=!0,this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return!1;if(V.trim()===""||this.validateMessage&&this.validateMessage.type!==c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;const $=await F(V);return P=!1,!!$},j=async()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!0)},W=()=>{var V;this.fileTreeService.updateRefreshable(!0),(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.contextMenuFile&&this.selectFileDecoration(this.contextMenuFile,!0)},U=()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.fileTreeService.isCompactMode&&R instanceof c.NewPromptHandle&&this.fileTreeService.refresh(R.parent)},Q=V=>{const $=this.validateFileName(R,V);$?(this.validateMessage=$,R.addValidateMessage($)):!$&&this.validateMessage&&this.validateMessage.value!==V&&(this.validateMessage=void 0,R.removeValidateMessage())};R.destroyed||(this.fileTreeService.updateRefreshable(!1),R.onChange(Q),R.onCommit(B),R.onBlur(L),R.onFocus(j),R.onDestroy(W),R.onCancel(U))},this.copyFile=async R=>{var P;this.pasteStore&&this.pasteStore.type===d.PasteTypes.CUT&&(this._pasteStore.files.forEach(F=>{F&&this.cutDecoration.removeTarget(F)}),(P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!1)),this.treeModel.dispatchChange();const k=[];for(const F of R){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.COPY},this.clipboardService.writeResources(R)},this.pasteFile=async R=>{var P,k;let F=!1,L=this.fileTreeService.getNodeByPathOrUri(R.toString());if(!L)return;let B=this.pasteStore,j=!1;if(!B){const W=await this.clipboardService.readResources();if(!W||!W.length)return;B={files:[],type:d.PasteTypes.COPY,crossFiles:W},j=!0}if(B){if(E.Directory.is(L)||(F=!0,L=L.parent),j){const W=(0,p.localize)("file.confirm.paste.ok"),U=(0,p.localize)("file.confirm.paste.cancel");if(await this.dialogService.warning((0,p.formatLocalize)("file.confirm.paste",`[ ${(P=B.crossFiles)===null||P===void 0?void 0:P.map(V=>V.displayName).join(",")} ]`,E.Directory.isRoot(L)?L.uri.displayName:L.displayName),[U,W])!==W)return}if(B.type===d.PasteTypes.CUT){for(const U of B.files)U&&this.cutDecoration.removeTarget(U),L.expanded||await L.setExpanded(!0);const W=await this.fileTreeAPI.mvFiles(B.crossFiles?B.crossFiles.map(U=>{var Q;return{url:U,isDirectory:((Q=this.fileTreeService.getNodeByPathOrUri(U))===null||Q===void 0?void 0:Q.filestat.isDirectory)||!1}}):B.files.map(U=>({url:U.uri,isDirectory:U.filestat.isDirectory})),L.uri);W&&W.length>0&&(W.forEach(U=>{this.messageService.error(U)}),this.fileTreeService.refresh()),(k=this.contextKey)===null||k===void 0||k.explorerResourceCut.set(!1),this.treeModel.dispatchChange(),this._pasteStore={files:[],type:d.PasteTypes.NONE,crossFiles:void 0}}else if(B.type===d.PasteTypes.COPY){const W=B.crossFiles?B.crossFiles:B.files.map(U=>U.uri);for(const U of W){L.uri.isEqual(U)&&!F&&(L=L.parent);const Q=L.uri.resolve(U.displayName);L.expanded||await L.setExpanded(!0);const V=await this.fileTreeAPI.copyFile(U,Q);if(V)if(V.uri){const $=new p.URI(V.uri),Y=await this.filesystem.getFileStat(U.toString());this.fileTreeService.addNode(L,$.displayName,Y?.isDirectory?c.TreeNodeType.CompositeTreeNode:c.TreeNodeType.TreeNode)}else this.messageService.error(`Error when copy file: ${U.toString()}, ${V}`)}}}},this.cutFile=async R=>{var P;R.length>0&&((P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!0)),this._pasteStore&&this._pasteStore.type===d.PasteTypes.CUT&&this._pasteStore.files.forEach(F=>{this.cutDecoration.removeTarget(F)});const k=[];for(const F of R){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.CUT};for(const F of k)F&&this.cutDecoration.addTarget(F);this.treeModel.dispatchChange()},this.location=async R=>{if(await this.whenReady,!this.fileTreeService.filterMode)return this._fileToLocation=R,this.locationThrottler.queue(this.doLocation)},this.doLocation=async()=>{if(!this._fileToLocation)return;const R=this._fileToLocation;let P;if(typeof R=="string"?P=R:P=await this.fileTreeService.getFileTreeNodePathByUri(R),P){if(!this.fileTreeHandle)return;const k=await this.fileTreeHandle.ensureVisible(P,"center",!0);k&&this.selectFileDecoration(k)}this._fileToLocation=void 0},this.locationOnShow=R=>{this._nextLocationTarget=R},this.performLocationOnHandleShow=async()=>{this._nextLocationTarget&&(await this.location(this._nextLocationTarget),this._nextLocationTarget=void 0)}}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidContextMenuFileChange(){return this.onDidContextMenuFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get onFileTreeModelChange(){return this.onFileTreeModelChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get dndService(){return this._dndService}get whenReady(){return this._whenReady.promise}get focusedFile(){return this._focusedFile}set focusedFile(R){this.onDidFocusedFileChangeEmitter.fire(R?R.uri:void 0),this._focusedFile=R}get contextMenuFile(){return this._contextMenuFile}set contextMenuFile(R){this.onDidContextMenuFileChangeEmitter.fire(R?R.uri:void 0),this._contextMenuFile=R}get selectedFiles(){return this._selectedFiles}set selectedFiles(R){this.onDidSelectedFileChangeEmitter.fire(R?R.map(P=>P.uri):[]),this._selectedFiles=R}get activeUri(){return this._activeUri}get pasteStore(){return this._pasteStore}get explorerStorage(){return this._explorerStorage}get currentRelativeUriContextKey(){return this._currentRelativeUriContextKey||(this._currentRelativeUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextRelativeUri","")),this._currentRelativeUriContextKey}get currentContextUriContextKey(){return this._currentContextUriContextKey||(this._currentContextUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextUri","")),this._currentContextUriContextKey}get contextMenuResourceContext(){return this._contextMenuResourceContext||(this._contextMenuResourceContext=new v.ResourceContextKey(this.fileTreeService.contextMenuContextKeyService)),this._contextMenuResourceContext}get contextKey(){return this.fileTreeService.contextKey}get initTreeModelReady(){return this._initTreeModelReady}async initTreeModel(){this._initTreeModelReady=!1;const R=(await this.fileTreeService.resolveChildren())[0];if(!R){this._whenReady.resolve();return}this._treeModel=this.injector.get(f.FileTreeModel,[R]),this.initDecorations(R),this._dndService=this.injector.get(A.DragAndDropService,[this]),this.treeStateWatcher=this._treeModel.getTreeStateWatcher(!0),this.disposableCollection.push(this.fileTreeService.onNodeRefreshed(()=>{this.initTreeModelReady&&(this.refreshedActionDelayer.isTriggered()||this.refreshedActionDelayer.cancel(),this.refreshedActionDelayer.trigger(async()=>{if(this.selectedFiles.length===0){const k=this.editorService.currentEditor;k&&k.currentUri&&this.location(k.currentUri)}this.fileTreeService.isCompactMode||(this._activeUri=null)}))})),this.disposableCollection.push(this.fileTreeService.onWorkspaceChange(()=>{this.disposableCollection.dispose(),this.initTreeModel()})),this.disposableCollection.push(this.labelService.onDidChange(async()=>{this.initTreeModelReady&&(this.labelChangedDelayer.isTriggered()||this.labelChangedDelayer.cancel(),this.labelChangedDelayer.trigger(async()=>{this.fileTreeService.refresh()}))})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,k=>{this.loadingDecoration.addTarget(k),this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,k=>{this.loadingDecoration.clearAppliedTarget(),this.treeModel.dispatchChange()})),this._explorerStorage=await this.storageProvider(p.STORAGE_NAMESPACE.EXPLORER);const P=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);P&&await this.loadFileTreeSnapshot(P),this.disposableCollection.push(this.treeStateWatcher.onDidChange(()=>{if(!this._initTreeModelReady)return;const k=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),F=this.treeStateWatcher.snapshot();this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...k,...F})})),this.fileTreeService.startWatchFileEvent(),this.onFileTreeModelChangeEmitter.fire(this._treeModel),this._whenReady.resolve(),this._initTreeModelReady=!0}initDecorations(R){this._decorations=new c.DecorationsManager(R),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.contextMenuDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}setFileTreeContextKey(R){var P;this.currentContextUriContextKey.set(R.uri.toString()),this.currentRelativeUriContextKey.set((this.treeModel.root.uri.relative(R.uri)||"").toString()),this.contextMenuResourceContext.set(R.uri),(P=this.contextKey)===null||P===void 0||P.explorerResourceIsFolder.set(R&&R.type===c.TreeNodeType.CompositeTreeNode)}async loadFileTreeSnapshot(R){await this._treeModel.loadTreeState(R)}updateExplorerCompressedContextKey(R,P){var k,F,L,B,j,W,U,Q,V,$,Y,H,z,K,Z,X;if(R&&P){(k=this.contextKey)===null||k===void 0||k.explorerCompressedFocusContext.set(!0);const ie=new S(R.name);ie.name===P.displayName?((F=this.contextKey)===null||F===void 0||F.explorerCompressedLastFocusContext.set(!0),(L=this.contextKey)===null||L===void 0||L.explorerCompressedFirstFocusContext.set(!1)):ie.root&&ie.root.name===P.displayName?((B=this.contextKey)===null||B===void 0||B.explorerCompressedLastFocusContext.set(!1),(j=this.contextKey)===null||j===void 0||j.explorerCompressedFirstFocusContext.set(!0)):((W=this.contextKey)===null||W===void 0||W.explorerCompressedLastFocusContext.set(!1),(U=this.contextKey)===null||U===void 0||U.explorerCompressedFirstFocusContext.set(!1))}else R?R.name.indexOf(S.separator)>0?((Q=this.contextKey)===null||Q===void 0||Q.explorerCompressedFocusContext.set(!0),(V=this.contextKey)===null||V===void 0||V.explorerCompressedFirstFocusContext.set(!1),($=this.contextKey)===null||$===void 0||$.explorerCompressedLastFocusContext.set(!0)):((Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFocusContext.set(!1),(H=this.contextKey)===null||H===void 0||H.explorerCompressedFirstFocusContext.set(!1),(z=this.contextKey)===null||z===void 0||z.explorerCompressedLastFocusContext.set(!1)):((K=this.contextKey)===null||K===void 0||K.explorerCompressedFocusContext.set(!1),(Z=this.contextKey)===null||Z===void 0||Z.explorerCompressedFirstFocusContext.set(!1),(X=this.contextKey)===null||X===void 0||X.explorerCompressedLastFocusContext.set(!1))}handleTreeHandler(R){this._fileTreeHandle=R}toggleOrOpenCurrentFile(){let R;this.focusedFile?R=this.focusedFile:this.contextMenuFile&&(R=this.contextMenuFile),R&&(this.activeFileDecoration(R),E.Directory.is(R)?this.toggleDirectory(R):this.fileTreeService.openFile(R.uri))}moveToNext(){let R;if(this.focusedFile?R=this.focusedFile:this.contextMenuFile&&(R=this.contextMenuFile),!R)return;const k=this.treeModel.root.getIndexAtTreeNode(R)+1,F=this.treeModel.root.getTreeNodeAtIndex(k),L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=(k+1)*l.FILE_TREE_NODE_HEIGHT-(L.scrollPosition||0),{height:j}=this.fileTreeHandle.getCurrentSize();F&&(this.activateFileFocusedDecoration(F),B>j&&this.fileTreeHandle.ensureVisible(F,"end"))}moveToPrev(){let R;if(this.focusedFile?R=this.focusedFile:this.contextMenuFile&&(R=this.contextMenuFile),!R)return;const P=this.treeModel.root.getIndexAtTreeNode(R);if(P===0)return;const k=P-1,F=this.treeModel.root.getTreeNodeAtIndex(k);if(!F)return;const L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=k*l.FILE_TREE_NODE_HEIGHT;this.activateFileFocusedDecoration(F),(L.scrollPosition||0)>B&&this.fileTreeHandle.ensureVisible(F,"start")}async collapseCurrentFile(){let R;this.focusedFile?(R=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(R=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(R);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(R));let k;if(E.Directory.is(R)&&R.expanded)k=R;else if(R)E.Directory.isRoot(R.parent)?k=R:k=R.parent;else return;this.focusedFile=k,k&&k.expanded&&(await this.fileTreeHandle.collapseNode(k),this.activeFileFocusedDecoration(k,!0))}async expandCurrentFile(){let R;this.focusedFile?(R=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(R=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(R);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(R)),this.focusedFile=R,E.Directory.is(R)&&(R.expanded||await this.fileTreeHandle.expandNode(R))}async collapseAll(){await this.treeModel.root.collapsedAll();const R=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);R&&this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...R,expandedDirectories:{atSurface:[],buried:[]}})}async deleteFileByUris(R){var P;if(R.length===0)return;if(this.corePreferences["explorer.confirmDelete"]){const B=this.applicationService.backendOS===p.OperatingSystem.Linux,j=B?(0,p.localize)("file.confirm.delete.ok"):(0,p.localize)("file.confirm.moveToTrash.ok"),W=(0,p.localize)("file.confirm.delete.cancel"),U=10;let Q=R.slice(0,U).map($=>$.displayName).join(`
|
|
31631
|
+
`,y){const A=this.hashCalculateService.calculate(d);return u.length>m.FILE_SAVE_BY_CHANGE_THRESHOLD?await this.fileSchemeDocClient.saveByChange(h.toString(),{baseMd5:A,changes:E,eol:b},f,l,y):await this.fileSchemeDocClient.saveByContent(h.toString(),{baseMd5:A,content:u},f,l,y)}async provideEditorDocumentModelContentMd5(h,u){return this.fileSchemeDocClient.getMd5(h.toString(),u)}};t.FileSchemeDocumentProvider=_,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],_.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IFileSchemeDocClient),n.__metadata("design:type",Object)],_.prototype,"fileSchemeDocClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(c.IHashCalculateService),n.__metadata("design:type",Object)],_.prototype,"hashCalculateService",void 0),t.FileSchemeDocumentProvider=_=n.__decorate([(0,r.Injectable)()],_);let s=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event,this.listeners={}}isReadonly(h){return!0}handlesScheme(h){return h==="vscode"}async provideEditorDocumentModelContent(h,u){return this.getSchemaContent(h)}getSchemaContent(h){const u=h.toString(),d=this.jsonRegistry.getSchemaContributions().schemas[u];if(d){const E=JSON.stringify(d);if(!this.listeners[u]){const f=o.Disposable.create(()=>{this.jsonRegistry.onDidChangeSchema(l=>{l===u&&this._onDidChangeContent.fire(h)})});this.listeners[u]=f}return E}return"{}"}onDidDisposeModel(h){h.toString()&&(this.listeners[h.toString()].dispose(),delete this.listeners[h.toString()])}};t.VscodeSchemeDocumentProvider=s,n.__decorate([(0,r.Autowired)(o.ISchemaStore),n.__metadata("design:type",Object)],s.prototype,"schemaStore",void 0),n.__decorate([(0,r.Autowired)(o.IJSONSchemaRegistry),n.__metadata("design:type",Object)],s.prototype,"jsonRegistry",void 0),t.VscodeSchemeDocumentProvider=s=n.__decorate([(0,r.Injectable)()],s);let g=class{constructor(){this.documentContentMaps=new Map,this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(h){return h===o.Schemes.walkThroughSnippet}provideEditorDocumentModelContent(h,u){return this.documentContentMaps.has(h.toString())||this.documentContentMaps.set(h.toString(),""),this.documentContentMaps.get(h.toString())}isReadonly(){return!1}preferLanguageForUri(){return"plaintext"}};t.WalkThroughSnippetSchemeDocumentProvider=g,t.WalkThroughSnippetSchemeDocumentProvider=g=n.__decorate([(0,r.Injectable)()],g)},41352:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeDocClientService=void 0;const n=e(85608),r=e(76003),o=e(80449);let c=class{saveByChange(v,m,_,s,g){return this.fileDocBackendService.$saveByChange(v,m,_,s,g)}saveByContent(v,m,_,s,g){return this.fileDocBackendService.$saveByContent(v,m,_,s,g)}getMd5(v,m){return this.fileDocBackendService.$getMd5(v,m)}};t.FileSchemeDocClientService=c,n.__decorate([(0,r.Autowired)(o.FileSchemeDocNodeServicePath),n.__metadata("design:type",Object)],c.prototype,"fileDocBackendService",void 0),t.FileSchemeDocClientService=c=n.__decorate([(0,r.Injectable)()],c)},17276:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemEditorComponentContribution=t.FileSystemEditorResourceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26542),p=e(57517),v=e(17878),m=e(42933),_=e(57646),s=e(60387),g=e(88819),a=e(99025),h="video-preview",u="image-preview",d="external-file",E="large-file-prevent";let f=class{registerResource(y){y.registerResourceProvider(this.untitledResourceProvider)}registerEditorDocumentModelContentProvider(y){y.registerEditorDocumentModelContentProvider(this.fileSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.vscodeSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.walkThroughSnippetSchemeDocumentProvider),y.registerEditorDocumentModelContentProvider(this.untitledSchemeDocumentProvider)}};t.FileSystemEditorResourceContribution=f,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.FileSchemeDocumentProvider)],f.prototype,"fileSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.VscodeSchemeDocumentProvider)],f.prototype,"vscodeSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",s.WalkThroughSnippetSchemeDocumentProvider)],f.prototype,"walkThroughSnippetSchemeDocumentProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeResourceProvider)],f.prototype,"untitledResourceProvider",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",v.UntitledSchemeDocumentProvider)],f.prototype,"untitledSchemeDocumentProvider",void 0),t.FileSystemEditorResourceContribution=f=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution)],f);let l=class{constructor(){this.cachedFileType=new o.LRUMap(200,100),this.fileServiceClient.onFilesChanged(y=>{y.forEach(A=>{this.cachedFileType.delete(A.uri.toString())})})}registerEditorComponent(y){y.registerEditorComponent({component:a.ImagePreview,uid:u,scheme:o.Schemes.file}),y.registerEditorComponent({component:a.VideoPreview,uid:h,scheme:o.Schemes.file}),y.registerEditorComponent({component:_.BinaryEditorComponent,uid:d,scheme:o.Schemes.file}),y.registerEditorComponent({component:g.LargeFilePrevent,uid:E,scheme:o.Schemes.file}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,(A,S)=>{S.length===0&&S.push({type:p.EditorOpenType.component,componentId:d})}),y.registerEditorComponentResolver(A=>A===o.Schemes.file||this.fileServiceClient.handlesScheme(A)?10:-1,async(A,S)=>{const w=await this.getFileType(A.uri.toString());switch(w){case"image":{S.push({type:p.EditorOpenType.component,componentId:u});break}case"video":{S.push({type:p.EditorOpenType.component,componentId:h});break}case"binary":case"text":{const{metadata:T,uri:D}=A,I=T||{};if(w==="binary"&&!I.skipPreventBinary)break;const O=await this.fileServiceClient.getFileStat(D.toString());await this.preference.ready;const M=this.preference.getValid("editor.largeFile",4*1024*1024*1024);O&&(O.size||0)>M&&!I.skipPreventTooLarge?S.push({type:p.EditorOpenType.component,componentId:E}):S.push({type:p.EditorOpenType.code,title:(0,o.localize)("editorOpenType.code")});break}}}),y.registerEditorComponentResolver(o.Schemes.untitled,(A,S,w)=>{w([{type:p.EditorOpenType.code,priority:"default"}])})}async getFileType(y){return this.cachedFileType.has(y)||((0,c.getLanguageIdFromMonaco)(new o.URI(y))?this.cachedFileType.set(y,"text"):this.cachedFileType.set(y,await this.getRealFileType(y))),this.cachedFileType.get(y)}async getRealFileType(y){try{return await this.fileServiceClient.getFileType(y)}catch{return"text"}}};t.FileSystemEditorComponentContribution=l,n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],l.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],l.prototype,"preference",void 0),t.FileSystemEditorComponentContribution=l=n.__decorate([(0,o.Domain)(p.BrowserEditorContribution),n.__metadata("design:paramtypes",[])],l)},52568:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSchemeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(80449),p=e(41352),v=e(17276);let m=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[v.FileSystemEditorResourceContribution,v.FileSystemEditorComponentContribution,{token:c.IFileSchemeDocClient,useClass:p.FileSchemeDocClientService}],this.backServices=[{servicePath:c.FileSchemeDocNodeServicePath}]}};t.FileSchemeModule=m,t.FileSchemeModule=m=n.__decorate([(0,r.Injectable)()],m)},88819:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LargeFilePrevent=t.PreventComponent=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(41869),p=e(81878),v=e(54414),m=e(82196),_=n.__importDefault(e(19996)),s=a=>o.default.createElement("div",{className:_.default["error-page"]},o.default.createElement("div",{className:(0,r.default)(_.default.icon,(0,c.getExternalIcon)("warning"))}),o.default.createElement("div",{className:_.default.description},a.description),o.default.createElement("div",{className:_.default["actions-wrapper"]},a.actions.map((h,u)=>o.default.createElement(p.Button,{key:u,onClick:()=>h.onClick(),className:_.default["action-button"]},h.label))));t.PreventComponent=s;const g=()=>{const a=(0,c.useInjectable)(v.WorkbenchEditorService),h=(0,c.useInjectable)(c.IEventBus),u=()=>{const d=a.currentResource;d&&(d.metadata={...d.metadata,skipPreventTooLarge:!0},h.fire(new m.ResourceOpenTypeChangedEvent(d.uri)))};return o.default.createElement(t.PreventComponent,{description:(0,c.localize)("editor.largeFile.prevent"),actions:[{label:(0,c.localize)("editor.file.prevent.stillOpen"),onClick:()=>u()}]})};t.LargeFilePrevent=g},99025:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImagePreview=t.VideoPreview=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(40827),p=n.__importDefault(e(19996)),v=_=>{const s=(0,o.useInjectable)(c.StaticResourceService);return{src:r.default.useMemo(()=>s.resolveStaticResource(_.uri).toString(),[_])}};t.VideoPreview=(0,r.memo)(_=>{const{src:s}=v(_.resource);return r.default.createElement("div",{className:p.default.kt_video_preview},r.default.createElement("video",{playsInline:!0,controls:!0,className:p.default.kt_video,src:s}))});const m=_=>{const s=r.default.useRef(),g=r.default.useRef(),{src:a}=v(_.resource);return r.default.useEffect(()=>{const h=new o.Disposable;return s.current&&(s.current.src=a),()=>{h.dispose()}},[_.resource]),r.default.createElement("div",{className:p.default.kt_image_preview},r.default.createElement("div",{ref:g},r.default.createElement("img",{ref:h=>h&&(s.current=h)})))};t.ImagePreview=m},80449:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeType=t.FileSchemeDocNodeServicePath=t.IFileSchemeDocNodeService=t.IFileSchemeDocClient=t.FILE_SAVE_BY_CHANGE_THRESHOLD=t.FILE_ON_DISK_SCHEME=void 0,t.FILE_ON_DISK_SCHEME="fileOnDisk",t.FILE_SAVE_BY_CHANGE_THRESHOLD=1e5,t.IFileSchemeDocClient=Symbol("IFileSchemeDocClient"),t.IFileSchemeDocNodeService=Symbol("FileSchemeDocNodeService"),t.FileSchemeDocNodeServicePath="FileSchemeDocNodeService";var e;(function(n){n[n.ADDED=1]="ADDED",n[n.REMOVED=2]="REMOVED"})(e||(t.ChangeType=e={}))},15625:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IFileSearchService=t.FileSearchServicePath=void 0,t.FileSearchServicePath="FileSearchServicePath",t.IFileSearchService=Symbol("FileSearchService")},84660:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(15625),t)},47720:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(84660),t)},2156:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClient=t.BrowserFileSystemRegistryImpl=void 0;const n=e(85608),r=e(32852),o=e(76003),c=e(41869),p=e(43718),v=e(37406),m=e(8170),_=e(41682),s=e(42933),g=e(81952);let a=class{constructor(){this.providers=new Map}registerFileSystemProvider(d){const E=d.scheme;return this.providers.set(E,d),{dispose:()=>{this.providers.delete(E)}}}};t.BrowserFileSystemRegistryImpl=a,t.BrowserFileSystemRegistryImpl=a=n.__decorate([(0,o.Injectable)()],a);let h=class{get clientId(){return this.applicationService.clientId}constructor(){this.watcherWithSchemaMap=new Map,this.watcherDisposerMap=new Map,this.onFileChangedEmitter=new c.Emitter,this.onFileProviderChangedEmitter=new c.Emitter,this._onFilesChanged=new c.Emitter,this.onFilesChanged=this._onFilesChanged.event,this._onFileProviderChanged=new c.Emitter,this.onFileProviderChanged=this._onFileProviderChanged.event,this._onDidChangeFileSystemProviderRegistrations=new c.Emitter,this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event,this._onWillActivateFileSystemProvider=new c.Emitter,this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event,this._onDidChangeFileSystemProviderCapabilities=new c.Emitter,this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event,this.filesExcludesMatcherList=[],this.watcherId=0,this.toDisposable=new c.DisposableCollection,this.watchFileExcludes=[],this.watchFileExcludesMatcherList=[],this.filesExcludes=[],this.workspaceRoots=[],this._providerChanged=new Set,this.fsProviders=new Map,this.userHomeDeferred=new c.Deferred,this.options={encoding:"utf8",overwrite:!1,recursive:!0,moveToTrash:!0},this.uriWatcherMap=new Map,this.toDisposable.push(this.onDidChangeFileSystemProviderRegistrations(d=>{d.added&&d.scheme===p.Schemes.file&&this.doGetCurrentUserHome()}))}async initialize(){const d=await this.getProvider(p.Schemes.file);d.initialize&&await d.initialize(this.clientId,this.appConfig.recursiveWatcherBackend)}async doGetCurrentUserHome(){const E=(await this.getProvider(p.Schemes.file)).getCurrentUserHome();this.userHomeDeferred.resolve(E)}handlesScheme(d){return this.registry.providers.has(d)||this.fsProviders.has(d)}dispose(){return this.toDisposable.dispose()}async resolveContent(d,E){const f=this.convertUri(d),b=await(await this.getProvider(f.scheme)).readFile(f.codeUri),y=b.data||b;return{content:c.BinaryBuffer.wrap(Uint8Array.from(y)).toString(E?.encoding)}}async readFile(d){const E=this.convertUri(d),l=await(await this.getProvider(E.scheme)).readFile(E.codeUri),b=l.data||l;return{content:c.BinaryBuffer.wrap(Uint8Array.from(b))}}async readFileStream(d){const E=this.convertUri(d);return await(await this.getProvider(E.scheme)).readFileStream(E.codeUri)}async getFileStat(d,E=!0){const f=this.convertUri(d),l=await this.getProvider(f.scheme);try{const b=await l.stat(f.codeUri);if(!b)throw s.FileSystemError.FileNotFound(f.codeUri.toString(),"File not found.");return this.filterStat(b,E)}catch(b){if(s.FileSystemError.FileNotFound.is(b))return}}async setContent(d,E,f){const l=this.convertUri(d.uri),b=await this.getProvider(l.scheme),y=await b.stat(l.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!await this.isInSync(d,y))throw this.createOutOfSyncError(d);return await b.writeFile(l.codeUri,typeof E=="string"?c.BinaryBuffer.fromString(E).buffer:E,{create:!1,overwrite:!0,encoding:f?.encoding}),await b.stat(l.codeUri)}async updateContent(d,E,f){const l=this.convertUri(d.uri),b=await this.getProvider(l.scheme),y=await b.stat(l.codeUri);if(!y)throw s.FileSystemError.FileNotFound(d.uri,"File not found.");if(y.isDirectory)throw s.FileSystemError.FileIsADirectory(d.uri,"Cannot set the content.");if(!this.checkInSync(d,y))throw this.createOutOfSyncError(d);if(E.length===0)return y;const A=await b.readFile(l.codeUri),S=this.applyContentChanges(c.BinaryBuffer.wrap(A).toString(f?.encoding),E);await b.writeFile(l.codeUri,c.BinaryBuffer.fromString(S).buffer,{create:!1,overwrite:!0,encoding:f?.encoding});const w=await b.stat(l.codeUri);if(!w)throw s.FileSystemError.FileNotFound(l.codeUri.toString(),"File not found.");return w}async createFile(d,E){const f=this.convertUri(d),l=await this.getProvider(f.scheme),b=c.BinaryBuffer.fromString(E?.content||"").buffer;let y=await l.writeFile(f.codeUri,b,{create:!0,overwrite:E&&E.overwrite||!1,encoding:E?.encoding});return y=y||await l.stat(f.codeUri),y}async createFolder(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme),l=await f.createDirectory(E.codeUri);return l||await f.stat(E.codeUri)}async move(d,E,f){const l=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(l.scheme),A=await y.rename(l.codeUri,b.codeUri,{overwrite:!!(f&&f.overwrite)});return A||await y.stat(b.codeUri)}async copy(d,E,f){const l=this.convertUri(d),b=this.convertUri(E),y=await this.getProvider(l.scheme),A=await this.doGetOverwrite(f);if(!(0,s.containsExtraFileMethod)(y,"copy"))throw this.getErrorProvideNotSupport(l.scheme,"copy");const S=await y.copy(l.codeUri,b.codeUri,{overwrite:!!A});return S||await y.stat(b.codeUri)}async getFsPath(d){if(d.startsWith("file:/"))return c.FileUri.fsPath(d)}fireFilesChange(d){const E=d.changes.map(f=>({uri:f.uri,type:f.type}));this._onFilesChanged.fire(E),this.eventBus.fire(new c.FilesChangeEvent(E))}async watchFileChanges(d,E){const l=(this.appConfig.pollingWatcherDirectories||[]).some(I=>d.path.toString().startsWith(I)),b=this.convertUri(d.toString());let y=0;const A=await this.getProvider(b.scheme),S=this.watcherWithSchemaMap.get(b.scheme)||[];let w;if(this.uriWatcherMap.has(b.toString())){const I=this.uriWatcherMap.get(b.toString());w=I?.watcher,w&&await w.dispose()}w?y=w.watchId:y=this.watcherId++;const T=await A.watch(b.codeUri,{excludes:E,pollingWatch:l});this.watcherDisposerMap.set(y,{dispose:async()=>{const I=this.uriWatcherMap.get(b.toString()),O=I?.watcher;await Promise.all([A.unwatch&&A.unwatch(T),O&&O.dispose()]),this.uriWatcherMap.delete(b.toString())}}),S.push(y),this.watcherWithSchemaMap.set(b.scheme,S);const D=new g.FileSystemWatcher({fileServiceClient:this,watchId:y,uri:d});return this.uriWatcherMap.set(b.toString(),{watcher:D,excludes:E}),D}async setWatchFileExcludes(d){return await(await this.getProvider(p.Schemes.file)).setWatchFileExcludes(d)}async getWatchFileExcludes(){return await(await this.getProvider(p.Schemes.file)).getWatchFileExcludes()}async setFilesExcludes(d,E){this.filesExcludes=d,this.filesExcludesMatcherList=[],E&&this.setWorkspaceRoots(E),this.updateExcludeMatcher()}async setWorkspaceRoots(d){this.workspaceRoots=d,this.updateExcludeMatcher()}async unwatchFileChanges(d){const E=this.watcherDisposerMap.get(d);if(!(!E||!E.dispose))return this.watcherDisposerMap.delete(d),E.dispose()}async delete(d,E){if(this.appConfig.isElectronRenderer&&E?.moveToTrash!==!1){const b=new c.URI(d);if(b.scheme===p.Schemes.file)return this.injector.get(v.IElectronMainUIService).moveToTrash(b.codeUri.fsPath)}const f=this.convertUri(d),l=await this.getProvider(f.scheme);await l.stat(f.codeUri),await l.delete(f.codeUri,{recursive:!0,moveToTrash:await this.doGetMoveToTrash(E)})}async getEncoding(d){return"utf8"}listCapabilities(){return _.Iterable.map(this.fsProviders,([d,E])=>({scheme:d,capabilities:E.capabilities}))}registerProvider(d,E){if(this.fsProviders.has(d))throw new Error(`The file system provider for \`${d}\` already registered`);const f=[];this.fsProviders.set(d,E),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:d,provider:E}),f.push({dispose:()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:d,provider:E}),this.fsProviders.delete(d),this._providerChanged.add(d)}}),E.onDidChangeFile&&f.push(E.onDidChangeFile(b=>this.fireFilesChange({changes:b}))),this.toDisposable.push(E.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:E,scheme:d}))),f.push({dispose:async()=>{const b=[];(this.watcherWithSchemaMap.get(d)||[]).forEach(y=>b.push(this.unwatchFileChanges(y))),await Promise.all(b)}}),this._providerChanged.add(d),this.onFileProviderChangedEmitter.fire(Array.from(this._providerChanged)),this.toDisposable.pushAll(f);const l=new c.DisposableCollection;return l.pushAll(f),this._onFileProviderChanged.fire(Array.from(this._providerChanged)),l}async access(d,E=s.FileAccess.Constants.F_OK){const f=this.convertUri(d),l=await this.getProvider(f.scheme);if(!(0,s.containsExtraFileMethod)(l,"access")){if(E===s.FileAccess.Constants.F_OK)try{return!!await l.stat(f.codeUri)}catch{return!1}throw this.getErrorProvideNotSupport(f.scheme,"access")}return await l.access(f.codeUri,E)}async getFileType(d){const E=this.convertUri(d),f=await this.getProvider(E.scheme);if(!(0,s.containsExtraFileMethod)(f,"getFileType"))throw this.getErrorProvideNotSupport(E.scheme,"getFileType");return await f.getFileType(d)}async getCurrentUserHome(){return this.userHomeDeferred.promise}getErrorProvideNotSupport(d,E){return`Scheme ${d} not support this function: ${E}.`}convertUri(d){const E=new c.URI(d);if(!E.scheme)throw new Error(`Unsupported convert Uri with non-scheme Uri: ${d}`);return E}updateExcludeMatcher(){this.filesExcludes.forEach(d=>{this.workspaceRoots.length>0?this.workspaceRoots.forEach(E=>{const l=new c.URI(E).resolve(d).path.toString();this.filesExcludesMatcherList.push((0,c.parseGlob)(l))}):this.filesExcludesMatcherList.push((0,c.parseGlob)(d))})}async shouldWaitProvider(d){const E=await this._onWillActivateFileSystemProvider.fireAndAwait({scheme:d}),{result:f}=E[0];if(f&&f.includes(d)){const l=await c.Event.toPromise(c.Event.filter(this.onFileProviderChanged,b=>b.includes(d)));if(!(0,p.isUndefined)(l))return!0}return!1}async getProvider(d){this._providerChanged.has(d)&&(await this.eventBus.fireAndAwait(new c.ExtensionActivateEvent({topic:"onFileSystem",data:d}),{timeout:3e3}),this._providerChanged.delete(d));const E=this.fsProviders.get(d);if(!E)throw new Error(`Not find ${d} provider.`);return E}async isReadonly(d){try{const E=new c.URI(d);return!!(await(await this.getProvider(E.scheme)).stat(this.convertUri(d).codeUri)).readonly}catch{return!1}}isExclude(d){const E=new c.URI(d);return this.filesExcludesMatcherList.some(f=>f(E.path.toString()))}filterStat(d,E=!0){if(d&&!this.isExclude(d.uri))return d.children&&E&&(d.children=this.filterStatChildren(d.children)),d}filterStatChildren(d){const E=[];return d.forEach(f=>{if(this.isExclude(f.uri))return!1;const l=this.filterStat(f);l&&E.push(l)}),E}applyContentChanges(d,E){let f=r.TextDocument.create("","",1,d);for(const l of E){let b=l.text;if(l.range){const y=f.offsetAt(l.range.start),A=f.offsetAt(l.range.end);b=f.getText().substr(0,y)+l.text+f.getText().substr(A)}f=r.TextDocument.create(f.uri,f.languageId,f.version,b)}return f.getText()}async isInSync(d,E){return!!this.checkInSync(d,E)}checkInSync(d,E){return E.lastModification===d.lastModification&&E.size===d.size}createOutOfSyncError(d){return s.FileSystemError.FileIsOutOfSync(d.uri)}async doGetEncoding(d){return d&&typeof d.encoding<"u"?d.encoding:this.options.encoding}async doGetOverwrite(d){return d&&typeof d.overwrite<"u"?d.overwrite:this.options.overwrite}async doGetRecursive(d){return d&&typeof d.recursive<"u"?d.recursive:this.options.recursive}async doGetMoveToTrash(d){return d&&typeof d.moveToTrash<"u"?d.moveToTrash:this.options.moveToTrash}async reconnect(){const d=await this.getProvider(p.Schemes.file);d.initialize&&await d.initialize(this.clientId,this.appConfig.recursiveWatcherBackend);const f=Array.from(this.uriWatcherMap.keys()).map(async l=>{var b;try{const y=new c.URI(l),A=this.uriWatcherMap.get(l);A?.watcher&&await this.watchFileChanges(y,A.excludes)}catch(y){(b=this.logger)===null||b===void 0||b.error("Error reconnecting watcher for:",l,y)}});await Promise.allSettled(f)}};t.FileServiceClient=h,n.__decorate([(0,o.Autowired)(s.IBrowserFileSystemRegistry),n.__metadata("design:type",a)],h.prototype,"registry",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(p.IEventBus),n.__metadata("design:type",Object)],h.prototype,"eventBus",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(m.IApplicationService),n.__metadata("design:type",Object)],h.prototype,"applicationService",void 0),n.__decorate([(0,o.Autowired)(p.ILogger),n.__metadata("design:type",Object)],h.prototype,"logger",void 0),t.FileServiceClient=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},69037:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(2156);let v=class{constructor(){this._disposables=new o.DisposableStore,this._disposables.add(this.fileSystem.registerProvider(o.Schemes.file,this.diskFileServiceProvider))}async initialize(){const _=this.contributionProvider.getContributions();await Promise.all(_.map(async s=>{s.registerProvider&&await s.registerProvider(this.fileSystem)})),await Promise.all(_.map(async s=>{s.onFileServiceReady&&await s.onFileServiceReady()})),this.fileSystem.initialize&&await this.fileSystem.initialize()}onReconnect(){this.fileServiceClient.reconnect().catch(_=>this.logger.error("Failed to reconnect watchers:",_))}dispose(){this._disposables.dispose()}};t.FileServiceContribution=v,n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",p.FileServiceClient)],v.prototype,"fileSystem",void 0),n.__decorate([(0,r.Autowired)(c.IDiskFileProvider),n.__metadata("design:type",Object)],v.prototype,"diskFileServiceProvider",void 0),n.__decorate([(0,r.Autowired)(o.FsProviderContribution),n.__metadata("design:type",Object)],v.prototype,"contributionProvider",void 0),n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",Object)],v.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],v.prototype,"logger",void 0),t.FileServiceContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution),n.__metadata("design:paramtypes",[])],v)},60476:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFsProviderClient=t.CoreFileServiceProviderClient=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(42933);class p{constructor(){this.onDidChangeFileEmitter=new o.Emitter,this.onDidChangeFile=this.onDidChangeFileEmitter.event}watch(_,s){return this.fileServiceProvider.watch(_,s)}unwatch(_){return this.fileServiceProvider.unwatch&&this.fileServiceProvider.unwatch(_)}async stat(_){return await this.fileServiceProvider.stat(_)}readDirectory(_){return this.fileServiceProvider.readDirectory(_)}createDirectory(_){return this.fileServiceProvider.createDirectory(_)}async readFile(_,s){return s&&(0,o.getDebugLogger)("fileService.fsProvider").warn("encoding option for fsProvider.readFile is deprecated"),await this.fileServiceProvider.readFile(_)}readFileStream(_){if(this.fileServiceProvider.readFileStream)return this.fileServiceProvider.readFileStream(_);throw new Error("readFileStream not supported")}writeFile(_,s,g){return this.fileServiceProvider.writeFile(_,Array.from(s),g)}delete(_,s){return this.fileServiceProvider.delete(_,s)}rename(_,s,g){return this.fileServiceProvider.rename(_,s,g)}}t.CoreFileServiceProviderClient=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0);let v=class extends p{constructor(){super(...arguments),this.onDidChangeCapabilities=o.Event.None}get capabilities(){return this._capabilities||(this._capabilities=12318,o.isLinux&&(this._capabilities|=1024)),this._capabilities}async initialize(_,s){var g,a;if(!((g=this.fileServiceProvider)===null||g===void 0)&&g.initialize)try{await((a=this.fileServiceProvider)===null||a===void 0?void 0:a.initialize(_,s))}catch(h){(0,o.getDebugLogger)("fileService.fsProvider").error("initialize error",h)}}setWatchFileExcludes(_){return this.fileServiceProvider.setWatchFileExcludes(_)}getWatchFileExcludes(){return this.fileServiceProvider.getWatchFileExcludes()}onDidFilesChanged(_){const s=_.changes.map(g=>({uri:g.uri,type:g.type}));this.onDidChangeFileEmitter.fire(s)}copy(_,s,g){return this.fileServiceProvider.copy(_,s,g)}access(_,s){return this.fileServiceProvider.access(_,s)}getCurrentUserHome(){return this.fileServiceProvider.getCurrentUserHome()}getFileType(_){return this.fileServiceProvider.getFileType(_)}};t.DiskFsProviderClient=v,n.__decorate([(0,r.Autowired)(c.DiskFileServicePath),n.__metadata("design:type",Object)],v.prototype,"fileServiceProvider",void 0),n.__decorate([(0,o.debounce)(100),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Array]),n.__metadata("design:returntype",void 0)],v.prototype,"setWatchFileExcludes",null),t.DiskFsProviderClient=v=n.__decorate([(0,r.Injectable)()],v)},96708:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileServiceClientModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(42933),p=e(70671),v=e(2156),m=e(69037),_=e(60476),s=e(23188);let g=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[{token:c.IFileServiceClient,useClass:v.FileServiceClient},{token:c.IBrowserFileSystemRegistry,useClass:v.BrowserFileSystemRegistryImpl},{token:c.IDiskFileProvider,useClass:_.DiskFsProviderClient},{token:c.IShadowFileProvider,useClass:s.ShadowFileSystemProvider},m.FileServiceContribution],this.backServices=[{servicePath:c.DiskFileServicePath,clientToken:c.IDiskFileProvider,protocol:p.DiskFileServiceProtocol}]}};t.FileServiceClientModule=g,t.FileServiceClientModule=g=n.__decorate([(0,r.Injectable)()],g)},23188:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShadowFileSystemProvider=void 0;const n=e(85608),r=e(76003),o=e(41869);let c=class{constructor(){this.capabilities=2048,this.onDidChangeCapabilities=o.Event.None,this.readonly=!0,this.shadowFiles=new Map,this.fileChangeEmitter=new o.Emitter,this.onDidChangeFile=this.fileChangeEmitter.event}unwatch(v){throw new Error("Method not implemented.")}readFileStream(v){throw new Error("Method not implemented.")}watch(v,m){throw new Error("Method not implemented.")}stat(v){return Promise.resolve({uri:v.toString(),lastModification:0})}readDirectory(v){throw new Error("Method not implemented.")}createDirectory(v){throw new Error("Method not implemented.")}readFile(v){return this.shadowFiles.get(v.toString())||o.BinaryBuffer.fromString("no available").buffer}writeFile(v,m,_){this.shadowFiles.set(v.toString(),m)}delete(v,m){throw new Error("Method not implemented.")}rename(v,m,_){throw new Error("Method not implemented.")}copy(v,m,_){throw new Error("Method not implemented.")}exists(v){throw new Error("Method not implemented.")}access(v,m){throw new Error("Method not implemented.")}};t.ShadowFileSystemProvider=c,t.ShadowFileSystemProvider=c=n.__decorate([(0,r.Injectable)()],c)},81952:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemWatcher=void 0;const n=e(43718);function r(c,p){return c.filter(v=>!!v.uri.startsWith(p))}class o{constructor(p){this.toDispose=new n.DisposableCollection,this.changeEmitter=new n.Emitter,this.toDispose.push(this.changeEmitter),this.fileServiceClient=p.fileServiceClient,this.watchId=p.watchId,this.uri=p.uri,this.fileServiceClient.onFilesChanged(v=>{const m=r(v,this.uri.toString());m&&m.length>0&&this.changeEmitter.fire(m)})}get onFilesChanged(){return this.changeEmitter.event}dispose(){return Promise.all([this.toDispose.dispose(),this.fileServiceClient.unwatchFileChanges(this.watchId)])}isDisposed(){return this.toDispose.disposed}}t.FileSystemWatcher=o},91813:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EXT_LIST_TEXT=t.EXT_LIST_IMAGE=t.EXT_LIST_VIDEO=void 0,t.getFileTypeByExt=e,t.EXT_LIST_VIDEO=new Set(["mp4","webm","mkv","mov","mts","flv","avi","wmv"]),t.EXT_LIST_IMAGE=new Set(["png","gif","jpg","jpeg","svg","bmp","avif","cr2","cr3","dng","flif","heic","icns","jxl","jpm","jpx","nef","raf","rw2","tif","orf","webp","apng"]),t.EXT_LIST_TEXT=new Set(["xml"]);function e(n){let r="text";return n&&(t.EXT_LIST_IMAGE.has(n)?r="image":t.EXT_LIST_VIDEO.has(n)?r="video":t.EXT_LIST_TEXT.has(n)?r="text":r="binary"),r}},79929:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IBrowserFileSystemRegistry=t.IFileServiceClient=void 0;const n=e(43718);t.IFileServiceClient=n.IFileServiceClient,t.IBrowserFileSystemRegistry=Symbol("IBrowserFileSystemRegistry")},49818:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSystemError=t.FileOperationError=t.FileSystemProviderError=t.FileSystemProviderErrorCode=t.FileAccess=t.IFileService=t.IShadowFileProvider=t.IDiskFileProvider=t.FileStat=t.FileType=void 0,t.createFileSystemProviderError=_,t.markAsFileSystemProviderError=s,t.containsExtraFileMethod=a,t.notEmpty=h,t.isErrnoException=u,t.handleError=d;const n=e(85608),r=e(43718);var o=e(31036);Object.defineProperty(t,"FileType",{enumerable:!0,get:function(){return o.FileType}}),Object.defineProperty(t,"FileStat",{enumerable:!0,get:function(){return o.FileStat}}),n.__exportStar(e(11854),t),t.IDiskFileProvider=Symbol("IDiskFileProvider"),t.IShadowFileProvider=Symbol("IShadowFileProvider"),t.IFileService=Symbol("IFileService");var c;(function(E){let f;(function(l){l.F_OK=0,l.R_OK=4,l.W_OK=2,l.X_OK=1})(f=E.Constants||(E.Constants={}))})(c||(t.FileAccess=c={}));var p;(function(E){E.FileExists="EntryExists",E.FileNotFound="EntryNotFound",E.FileNotADirectory="EntryNotADirectory",E.FileIsADirectory="EntryIsADirectory",E.FileIsOutOfSync="FileIsOutOfSync",E.FileExceedsMemoryLimit="EntryExceedsMemoryLimit",E.FileTooLarge="EntryTooLarge",E.FileWriteLocked="EntryWriteLocked",E.NoPermissions="NoPermissions",E.Unavailable="Unavailable",E.Unknown="Unknown"})(p||(t.FileSystemProviderErrorCode=p={}));class v extends Error{static declare(f,l){return Object.assign((...b)=>_(l(...b),f),{is:b=>{var y;return(y=b.stack)===null||y===void 0?void 0:y.startsWith(f)}})}constructor(f,l){super(f),this.code=l}is(f){return this.name===f.name}}t.FileSystemProviderError=v;class m extends Error{constructor(f,l,b){super(f),this.fileOperationResult=l,this.options=b}static isFileOperationError(f){return f instanceof Error&&!(0,r.isUndefinedOrNull)(f.fileOperationResult)}}t.FileOperationError=m;function _(E,f){const l=new v(E.toString(),f);return s(l,f),l}function s(E,f){return E.name=f?`${f} (FileSystemError)`:"FileSystemError",E}var g;(function(E){E.FileNotFound=v.declare(p.FileNotFound,(f,l)=>`${l?l+" ":""} '${f}' is not found.`),E.FileExists=v.declare(p.FileExists,(f,l)=>`${l?l+" ":""}'${f}' already exists.`),E.FileNotADirectory=v.declare(p.FileNotADirectory,(f,l)=>`${l?l+" ":""}'${f}' is not a directory.`),E.FileIsADirectory=v.declare(p.FileIsADirectory,(f,l)=>`${l?l+" ":""}'${f}' is a directory.`),E.FileIsOutOfSync=v.declare(p.FileIsOutOfSync,(f,l)=>`${l?l+" ":""}'${f}' is out of sync.`),E.FileExceedsMemoryLimit=v.declare(p.FileExceedsMemoryLimit,(f,l)=>`${l?l+" ":""}'${f}' is exceeds memory limit.`),E.FileTooLarge=v.declare(p.FileTooLarge,(f,l)=>`${l?l+" ":""}'${f}' is too large.`),E.FileWriteLocked=v.declare(p.FileWriteLocked,(f,l)=>`${l?l+" ":""}'${f}' is locked.`),E.FileIsNoPermissions=v.declare(p.NoPermissions,(f,l)=>`${l?l+" ":""}'${f}' is no permissions.`),E.Unavailable=v.declare(p.Unavailable,(f,l)=>`${l?l+" ":""}'${f}' is unavailable.`),E.Unknown=v.declare(p.Unknown,(f,l)=>`${l?l+" ":""}'${f}' is unkonw.`)})(g||(t.FileSystemError=g={}));function a(E,f){return(0,r.hasProperty)(E,f)&&(0,r.isFunction)(E[f])}function h(E){return E!==void 0}function u(E){return E.code!==void 0&&E.errno!==void 0}function d(E){var f,l,b,y,A;if(u(E))switch(E.code){case"EEXIST":throw g.FileExists(r.Uri.file((f=E.path)!==null&&f!==void 0?f:""));case"EPERM":case"EACCESS":throw g.FileIsNoPermissions(r.Uri.file((l=E.path)!==null&&l!==void 0?l:""));case"ENOENT":throw g.FileNotFound(r.Uri.file((b=E.path)!==null&&b!==void 0?b:""));case"ENOTDIR":throw g.FileNotADirectory(r.Uri.file((y=E.path)!==null&&y!==void 0?y:""));case"EISDIR":throw g.FileIsADirectory(r.Uri.file((A=E.path)!==null&&A!==void 0?A:""))}throw E}},42933:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(79929),t),n.__exportStar(e(49818),t),n.__exportStar(e(28217),t),n.__exportStar(e(91813),t),n.__exportStar(e(50295),t)},70671:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiskFileServiceProtocol=void 0;const n=e(26387),r=e(52890),o=e(50295);t.DiskFileServiceProtocol={name:o.DiskFileServicePath,methods:[{method:"readFile",request:[{name:"uri",type:r.UriComponentsProto}],response:{type:n.Type.binary()}}]}},50295:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileExtServicePath=t.FileWatcherServicePath=t.ShadowFileServicePath=t.DiskFileServicePath=t.FileServicePath=void 0,t.FileServicePath="FileService",t.DiskFileServicePath="DiskFileService",t.ShadowFileServicePath="ShadowFileService",t.FileWatcherServicePath="FileWatcherService",t.FileExtServicePath="FileExtServicePath"},28217:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WatcherProcessManagerProxy=t.WatcherServiceProxy=t.WATCHER_INIT_DATA_KEY=t.SUMI_WATCHER_PROCESS_SOCK_KEY=t.INsfw=void 0;const n=e(86058);var r;(function(o){let c;(function(p){p[p.CREATED=0]="CREATED",p[p.DELETED=1]="DELETED",p[p.MODIFIED=2]="MODIFIED",p[p.RENAMED=3]="RENAMED"})(c=o.actions||(o.actions={}))})(r||(t.INsfw=r={})),t.SUMI_WATCHER_PROCESS_SOCK_KEY="sumi-watcher-process-sock",t.WATCHER_INIT_DATA_KEY="sumi-watcher-init-data",t.WatcherServiceProxy=new n.ProxyIdentifier("WatcherHostServiceImpl"),t.WatcherProcessManagerProxy=new n.ProxyIdentifier("WatcherProcessManagerProxy")},14951:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),e(85608).__exportStar(e(42933),t)},57942:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(26542),m=e(6250),_=e(2812),s=r.__importDefault(e(89200)),g=e(9018);let a=n=class{static createContainer(u,d){return u.createChild([{token:m.IFileDialogTreeService,useValue:d},{token:m.IFileDialogModel,useClass:n}])}static createModel(u,d){return n.createContainer(u,d).get(m.IFileDialogModel)}constructor(){this.selectedDecoration=new c.Decoration(s.default.mod_selected),this.focusedDecoration=new c.Decoration(s.default.mod_focused),this.loadingDecoration=new c.Decoration(s.default.mod_loading),this.cutDecoration=new c.Decoration(s.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.clearFileSelectedDecoration=()=>{this._selectedFiles.forEach(u=>{this.selectedDecoration.removeTarget(u)}),this._selectedFiles=[],this.onDidSelectedFileChangeEmitter.fire([])},this.activeFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles=[u],this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.selectFileDecoration=(u,d=!0)=>{u!==this.treeModel.root&&(this.preContextMenuFocusedFile&&(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile),this.preContextMenuFocusedFile=null),u&&(this.selectedFiles.length>0&&this.selectedFiles.forEach(E=>{this.selectedDecoration.removeTarget(E)}),this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.selectedDecoration.addTarget(u),this._selectedFiles=[u],this.onDidSelectedFileChangeEmitter.fire([u.uri]),d&&this.treeModel.dispatchChange()))},this.activeFileFocusedDecoration=(u,d=!1)=>{u!==this.treeModel.root&&(this.focusedFile!==u&&(d?(this.preContextMenuFocusedFile?(this.focusedDecoration.removeTarget(this.preContextMenuFocusedFile),this.selectedDecoration.removeTarget(this.preContextMenuFocusedFile)):this.focusedFile&&this.focusedDecoration.removeTarget(this.focusedFile),this.preContextMenuFocusedFile=u):this.focusedFile&&(this.preContextMenuFocusedFile=null,this.focusedDecoration.removeTarget(this.focusedFile)),u&&(this.selectedDecoration.addTarget(u),this.focusedDecoration.addTarget(u),this._focusedFile=u,this._selectedFiles.push(u),this.onDidFocusedFileChangeEmitter.fire(u.uri),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)))),this.treeModel.dispatchChange())},this.activeFileSelectedDecoration=u=>{this._selectedFiles.indexOf(u)>-1||(this._selectedFiles.push(u),this.selectedDecoration.addTarget(u),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(d=>d.uri)),this.treeModel.dispatchChange())},this.activeFileDecorationByRange=(u,d)=>{for(this.clearFileSelectedDecoration(),this.preContextMenuFocusedFile=null;u<=d;u++){const E=this.treeModel.root.getTreeNodeAtIndex(u);E&&(this._selectedFiles.push(E),this.selectedDecoration.addTarget(E))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(E=>E.uri)),this.treeModel.dispatchChange()},this.enactiveFileDecoration=()=>{this.focusedFile&&(this.focusedDecoration.removeTarget(this.focusedFile),this.onDidFocusedFileChangeEmitter.fire(),this.treeModel.dispatchChange()),this._focusedFile=void 0},this.toggleDirectory=async u=>{u.expanded?this.fileTreeHandle.collapseNode(u):this.fileTreeHandle.expandNode(u)},this.handleTreeBlur=()=>{this.enactiveFileDecoration()},this.handleTreeFocus=()=>{},this.handleItemRangeClick=(u,d)=>{if(!this.focusedFile)this.handleItemClick(u,d);else if(this.focusedFile&&this.focusedFile!==u){const E=this.treeModel.root.getIndexAtTreeNode(u),f=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);f>E?this.activeFileDecorationByRange(E,f):f<E&&this.activeFileDecorationByRange(f,E)}},this.handleItemToggleClick=(u,d)=>{d!==c.TreeNodeType.CompositeTreeNode&&d!==c.TreeNodeType.TreeNode||(this.selectedFiles.indexOf(u)>-1?this.focusedFile===u?this.enactiveFileDecoration():this.activeFileFocusedDecoration(u):this.activeFileSelectedDecoration(u))},this.handleItemClick=(u,d)=>{this.clickTimes++,(d===c.TreeNodeType.CompositeTreeNode||d===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(u),d===c.TreeNodeType.CompositeTreeNode&&this.corePreferences["workbench.list.openMode"]==="singleClick"&&this.toggleDirectory(u),this.clickTimer&&clearTimeout(this.clickTimer),this.clickTimer=setTimeout(()=>{this.clickTimes>1&&d!==c.TreeNodeType.TreeNode&&this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(u),this.clickTimes=0},200)},this.getDirectoryList=()=>this.fileTreeDialogService.getDirectoryList(),this._whenReady=this.initTreeModel()}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get whenReady(){return this._whenReady}get focusedFile(){return this._focusedFile}get selectedFiles(){return this._selectedFiles}async initTreeModel(){const u=(await this.fileTreeDialogService.resolveChildren())[0];this._treeModel=this.injector.get(_.FileTreeModel,[u]),this.initDecorations(u),this.disposableCollection.push(this._decorations),this.disposableCollection.push(this.labelService.onDidChange(()=>{this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,d=>{this.loadingDecoration.addTarget(d)})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,d=>{this.loadingDecoration.removeTarget(d)}))}async updateTreeModel(u){const d=await this.fileTreeDialogService.resolveRoot(u);if(d&&d.length>0){const E=d[0];this._treeModel=this.injector.get(_.FileTreeModel,[E]),this.clearFileSelectedDecoration(),this.initDecorations(E)}}initDecorations(u){this._decorations&&this._decorations.dispose(),this._decorations=new c.DecorationsManager(u),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}handleTreeHandler(u){this._fileTreeHandle=u}dispose(){this.disposableCollection.dispose()}};t.FileTreeDialogModel=a,a.FILE_TREE_SNAPSHOT_KEY="FILE_TREE_SNAPSHOT",a.DEFAULT_LOCATION_FLUSH_DELAY=500,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],a.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(m.IFileDialogTreeService),r.__metadata("design:type",g.FileTreeDialogService)],a.prototype,"fileTreeDialogService",void 0),r.__decorate([(0,o.Autowired)(v.LabelService),r.__metadata("design:type",v.LabelService)],a.prototype,"labelService",void 0),r.__decorate([(0,o.Autowired)(p.CorePreferences),r.__metadata("design:type",Object)],a.prototype,"corePreferences",void 0),t.FileTreeDialogModel=a=n=r.__decorate([(0,o.Injectable)(),r.__metadata("design:paramtypes",[])],a)},69748:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeDialogNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),_=({item:s,onClick:g,itemType:a,labelService:h,leftPadding:u=8,onTwistierClick:d,decorations:E,defaultLeftPadding:f=8,template:l})=>{const b=a===c.TreeNodeType.RenamePrompt,y=a===c.TreeNodeType.NewPrompt,A=b||y,S=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),w=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),T=W=>{(a===c.TreeNodeType.TreeNode||a===c.TreeNodeType.CompositeTreeNode)&&g(W,s,a)},D=W=>{(a===c.TreeNodeType.TreeNode||a===c.TreeNodeType.CompositeTreeNode)&&(d?d(W,s,a):g(W,s,a))},I=a===c.TreeNodeType.CompositeTreeNode;let O;A?y?O=`${f+(s.parent.depth+1||0)*(u||0)}px`:O=`${f+(s.target.depth||0)*(u||0)}px`:O=I?`${f+(s.depth||0)*(u||0)}px`:`${f+(s.depth||0)*(u||0)+8}px`;const M={height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:O},R=(W,U)=>{if(E&&E?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(A&&W instanceof c.PromptHandle){let Q=!1;if(b?Q=W.target.type===c.TreeNodeType.CompositeTreeNode:Q=W.type===c.TreeNodeType.CompositeTreeNode,Q)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:y||!(b&&W.target.type===c.TreeNodeType.CompositeTreeNode&&W.target.expanded)})})}else return o.default.createElement("div",{onClick:U,className:(0,r.default)(m.default.file_tree_node_segment,S,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!W.expanded})})},P=W=>{let U,Q;A&&W instanceof c.PromptHandle?W instanceof c.RenamePromptHandle?(U=W.target.uri.resolve(W.$.value),Q=v.Directory.is(W.target)):(U=W.parent.uri.resolve(W.$.value),Q=W.type===c.TreeNodeType.CompositeTreeNode):(U=W.uri,Q=W.filestat.isDirectory);const V=h.getIcon(U,{isDirectory:Q});return o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,V,{expanded:Q&&W.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},k=W=>l?o.default.createElement(l,null):A&&W instanceof c.PromptHandle?o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(W.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}}))):o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},W.name),F=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},L()),L=()=>null,B=W=>{if(I)return R(W,D);if(A)return R(W,()=>{})},j=()=>s.tooltip||s.name;return o.default.createElement("div",{key:s.id,onClick:T,title:j(),className:(0,r.default)(w,E?E.classlist:null),style:M,draggable:a===c.TreeNodeType.TreeNode||a===c.TreeNodeType.CompositeTreeNode},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},B(s),P(s),o.default.createElement("div",{className:A?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},k(s)),F()))};t.FileTreeDialogNode=_,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},68195:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialogContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(66e3);let p=class{initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.fileDialogViewVisibleContext=c.FileDialogViewVisibleContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileDialogContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileDialogContextKey=p=n.__decorate([(0,r.Injectable)()],p)},9018:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDialogService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(26542),v=e(54414),m=e(14951),_=e(72665),s=e(51500),g=e(6250),a=e(57781),h=e(97738),u=e(68195);let d=class extends o.Tree{constructor(f){super(),this._whenReady=this.resolveWorkspaceRoot(f)}get whenReady(){return this._whenReady}async resolveWorkspaceRoot(f){if(f){const l=new c.URI(f).withScheme(c.Schemes.file),b=await this.fileTreeAPI.resolveFileStat(l);b&&(this.workspaceRoot=b)}}async resolveChildren(f){if(f){if(f.uri){const{children:l}=await this.fileTreeAPI.resolveChildren(this,f.uri.toString(),f);return l}}else{this.workspaceRoot||(this.workspaceRoot=(await this.workspaceService.roots)[0]);const{children:l}=await this.fileTreeAPI.resolveChildren(this,this.workspaceRoot);return this.root=l[0],l}return[]}async resolveRoot(f){let l;/^file:\/\//.test(f)&&(l=new c.URI(f)),l=c.URI.file(f);const b=await this.fileTreeAPI.resolveFileStat(l);if(b){const{children:y}=await this.fileTreeAPI.resolveChildren(this,b);return this.root=y[0],y}}getDirectoryList(){const f=[];if(!this.root)return f;let l=new c.URI(this.workspaceRoot.uri);if(l&&l.parent)for(;l.parent;){const b=l.codeUri.fsPath;if(f.indexOf(b)>=0)break;f.push(b),l=l.parent}else f.push(l.codeUri.fsPath.toString());return f}sortComparator(f,l){return f.constructor===l.constructor?f.name.startsWith(".")&&!l.name.startsWith(".")?1:!f.name.startsWith(".")&&l.name.startsWith(".")?-1:f.name.localeCompare(l.name,"kn",{numeric:!0}):f.type===o.TreeNodeType.CompositeTreeNode?-1:l.type===o.TreeNodeType.CompositeTreeNode?1:0}initContextKey(f){f&&this.fileDialogContextKey.initScopedContext(f)}get contextKey(){return this.fileDialogContextKey}async saveAs(f){const{oldFilePath:l,newFilePath:b}=f;if(!l||!b)throw new Error("oldFilePath and newFilePath are required");await this.createFile(f);try{const y=c.URI.file(f.newFilePath),A={preview:!1,focus:!0,replace:!0,forceClose:!0,disableNavigate:!1};await this.workbenchEditorService.open(y,A),await this.fileTreeModelService.clearFileSelectedDecoration();const S=this.fileTreeService.getNodeByPathOrUri(y);S&&await this.fileTreeModelService.activeFileDecoration(S)}catch(y){throw new Error(`Failed to open saveAs file: ${y.message}`)}}async createFile(f){try{const{oldFilePath:l,newFilePath:b}=f;if(!await this.fileServiceClient.getFileStat(l))throw new Error(`Source file not found: ${l}`);const{content:A}=await this.fileServiceClient.readFile(l);await this.fileServiceClient.createFile(b,{content:A.toString(),encoding:"utf8",overwrite:!0})}catch(l){throw new Error(`Failed to create file: ${l.message}`)}}renderCustomMsg(){return null}async getDefaultFilePath(f,l){return l}dispose(){super.dispose()}};t.FileTreeDialogService=d,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],d.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.LabelService),n.__metadata("design:type",p.LabelService)],d.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileDialogContextKey),n.__metadata("design:type",u.FileDialogContextKey)],d.prototype,"fileDialogContextKey",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],d.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(v.WorkbenchEditorService),n.__metadata("design:type",v.WorkbenchEditorService)],d.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(_.IDialogService),n.__metadata("design:type",Object)],d.prototype,"dialogService",void 0),n.__decorate([(0,r.Autowired)(h.FileTreeModelService),n.__metadata("design:type",h.FileTreeModelService)],d.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(g.IFileTreeService),n.__metadata("design:type",a.FileTreeService)],d.prototype,"fileTreeService",void 0),t.FileTreeDialogService=d=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[String])],d)},51888:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDialog=t.FILE_TREE_DIALOG_HEIGHT=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(68974),v=e(72665),m=e(69748),_=n.__importDefault(e(13294));t.FILE_TREE_DIALOG_HEIGHT=22;const s=({options:g,model:a,isOpenDialog:h,fileService:u})=>{const d=(0,c.useInjectable)(v.IDialogService),E=(0,r.useRef)(null),[f,l]=(0,r.useState)(g.defaultFileName||""),[b,y]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[w,T]=(0,r.useState)([]),D=(0,r.useRef)(g.defaultFileName||"");(0,r.useEffect)(()=>{var ie;return a&&(y(!1),R(),(ie=u.contextKey.fileDialogViewVisibleContext)===null||ie===void 0||ie.set(!0)),()=>{a.dispose()}},[a]),(0,r.useEffect)(()=>{g.defaultFileName&&(l(g.defaultFileName||""),D.current=g.defaultFileName||"")},[g]),(0,r.useEffect)(()=>{if(b){const ie=a.getDirectoryList();T(ie)}},[b]);const I=(0,r.useCallback)(()=>{const ie=a.selectedFiles.map(oe=>oe.uri.path.toString());if(D.current&&g.showNameInput&&(ie?.length===1||g.defaultUri)){const oe=ie?.length===1?ie[0]:g.defaultUri.path.toString();g?.saveAs&&u.saveAs({oldFilePath:c.path.join(oe,g?.defaultFileName||""),newFilePath:c.path.join(oe,D.current)}),d.hide([c.path.join(oe,D.current)])}else ie.length>0?d.hide(ie):A?d.hide([A]):g.defaultUri?d.hide([g.defaultUri.path.toString()]):a.treeModel&&a.treeModel.root?d.hide([a.treeModel.root.uri.path.toString()]):d.hide([]);y(!1),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d,a,g,A]),O=async ie=>{let oe=ie.treeModel.root.uri.codeUri.fsPath;return u.getDefaultFilePath&&(oe=await u.getDefaultFilePath(ie,oe)),oe},M=(0,r.useCallback)(()=>{y(!1),d.hide(),u.contextKey.fileDialogViewVisibleContext.set(!1)},[b,d]),R=(0,r.useCallback)(async()=>{await a.whenReady,await a.treeModel.ensureReady;const ie=await O(a);S(ie),y(!0)},[a,A,b]),P=!h,k=(0,r.useCallback)(ie=>{a.handleTreeHandler({...ie,getModel:()=>a.treeModel})},[a]),F=(0,r.useCallback)((ie,oe)=>{ie.stopPropagation();const{toggleDirectory:le}=a;le(oe)},[a]),L=(0,r.useCallback)(ie=>B(ie)?!1:ie.shiftKey,[]),B=(0,r.useCallback)(ie=>{const{metaKey:oe,ctrlKey:le}=ie;return c.isMacintosh&&oe||le},[]),j=(0,r.useCallback)((ie,oe,le)=>{var pe;ie.stopPropagation();const{handleItemClick:q,handleItemToggleClick:Ee,handleItemRangeClick:_e}=a;if(!oe)return;const ne=L(event),ge=B(event);if(ne&&!P&&g.canSelectMany)_e(oe,le);else if(ge&&!P&&g.canSelectMany)Ee(oe,le);else if(P)le===o.TreeNodeType.CompositeTreeNode&&q(oe,le);else if(g.canSelectFiles&&le===o.TreeNodeType.TreeNode){const we=new Set(Object.values((pe=g.filters)!==null&&pe!==void 0?pe:{}).flat().map(Pe=>`.${Pe}`));if(we.size>0){const Pe=c.URI.parse(oe.filestat.uri).path.ext;we.has(Pe)&&q(oe,le)}else q(oe,le)}else g.canSelectFolders&&le===o.TreeNodeType.CompositeTreeNode&&q(oe,le)},[a,P,g]),W=(0,r.useCallback)(async ie=>{y(!1),S(ie),await a.updateTreeModel(ie),y(!0)},[a,b,A]),U=(0,r.useCallback)(async ie=>{y(!1),S(ie),await a.updateTreeModel(ie),y(!0)},[a,b,A,w]),Q=(0,r.useCallback)(()=>u.renderCustomMsg?u.renderCustomMsg():null,[u.renderCustomMsg]),V=(0,r.useCallback)(ie=>r.default.createElement(m.FileTreeDialogNode,{item:ie.item,itemType:ie.itemType,labelService:a.labelService,decorations:a.decorations.getDecorations(ie.item),onClick:j,onTwistierClick:F,defaultLeftPadding:8,leftPadding:8}),[a.treeModel]),$=(0,r.useCallback)(()=>{if(b){if(a.treeModel)return r.default.createElement(o.RecycleTree,{height:300,itemHeight:t.FILE_TREE_DIALOG_HEIGHT,onReady:k,model:a.treeModel},V)}else return r.default.createElement(p.Progress,{loading:!0})},[b,a]),Y=(0,r.useMemo)(()=>u.showFilePathSearch!==!1,[u.showFilePathSearch]),H=(0,r.useCallback)(()=>{if(w.length>0)return r.default.createElement(o.Select,{onChange:W,onSearchChange:U,className:_.default.select_control,size:"large",searchPlaceholder:A,value:A,showSearch:Y},w.map((ie,oe)=>r.default.createElement(o.Option,{value:ie,key:`${oe} - ${ie}`},ie)))},[w,A]),z=(0,r.useCallback)(ie=>{const{key:oe}=c.KeyCode.createKeyCode(ie),le=ie.shiftKey||ie.metaKey||ie.altKey||ie.ctrlKey;oe&&c.Key.ENTER.keyCode===oe.keyCode&&!le&&I()},[I]);(0,r.useEffect)(()=>{var ie;return E.current&&(u.initContextKey(E.current),u.contextKey.fileDialogViewVisibleContext.set(!0),(ie=E.current)===null||ie===void 0||ie.addEventListener("keyup",z)),()=>{var oe;(oe=E.current)===null||oe===void 0||oe.removeEventListener("keyup",z)}},[]);const K=(0,r.useMemo)(()=>r.default.createElement(r.default.Fragment,null,Q(),r.default.createElement("div",{className:_.default.file_dialog_directory},H()),r.default.createElement("div",{className:_.default.file_dialog_content},$())),[H,$]),Z=(0,r.useMemo)(()=>r.default.createElement("div",{className:_.default.file_dialog_buttons},r.default.createElement(o.Button,{onClick:M,type:"ghost",className:_.default.button},(0,c.localize)("dialog.file.close")),r.default.createElement(o.Button,{onClick:I,type:"primary",className:_.default.button,disabled:P&&g.showNameInput&&f.length===0},h&&g.openLabel||(0,c.localize)("dialog.file.ok"))),[M,I,P,h,f,g]),X=(0,r.useCallback)(ie=>{l(ie.target.value),D.current=ie.target.value},[f]);return r.default.createElement("div",{className:_.default.file_dialog_wrapper,ref:E},r.default.createElement("div",{className:_.default.file_dialog_directory_title},h?g.title||(0,c.localize)("dialog.file.openLabel"):g.saveLabel||(0,c.localize)("dialog.file.saveLabel")),K,!h&&g.showNameInput&&r.default.createElement("div",{className:_.default.file_dialog_file_container},r.default.createElement("span",{className:_.default.file_dialog_file_name},(0,c.localize)("dialog.file.name"),": "),r.default.createElement(o.Input,{size:"small",value:f,autoFocus:!0,selection:{start:0,end:f.indexOf(".")||f.length},onChange:X})),Z)};t.FileDialog=s},89508:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowDialogServiceImpl=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),c=e(41869),p=e(37406),v=e(14951),m=e(72665),_=e(57942),s=n.__importDefault(e(13294)),g=e(9018),a=e(51888);let h=class{constructor(){this.idx=1,this._whenReady=this.init()}async init(){this.recentGlobalStorage=await this.storageProvider(c.STORAGE_NAMESPACE.GLOBAL_RECENT_DATA);const d=await this.recentGlobalStorage.get("RECENT_DIALOG_DEFAULT_URI");if(d)this._defaultUri=new c.URI(d);else{const E=await this.fileServiceClient.getCurrentUserHome();this._defaultUri=new c.URI(E.uri)}}get defaultUri(){return this._defaultUri}get whenReady(){return this._whenReady}async updateRecentDefaultUri(d){this.recentGlobalStorage.set("RECENT_DIALOG_DEFAULT_URI",d.toString()),this._defaultUri=d}async showOpenDialog(d={}){this.dialogService.reset(),await this.whenReady;const E={canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1};if(this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const f=this.injector.get(p.IElectronMainUIService),l=[];d.canSelectFiles&&l.push("openFile"),d.canSelectFolders&&l.push("openDirectory"),d.canSelectMany&&l.push("multiSelections"),c.isMacintosh&&l.push("treatPackageAsDirectory","createDirectory");const b=d.defaultUri||this.defaultUri,y=await f.showOpenDialog(c.electronEnv.currentWindowId,{defaultPath:b.codeUri.fsPath,title:d.title,buttonLabel:d.openLabel,properties:l});if(y&&y.length>0){const A=y.map(S=>c.URI.file(S));return this.updateRecentDefaultUri(A[0].parent),A}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let f;d.defaultUri?f=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):f=this.injector.get(g.FileTreeDialogService),await f.whenReady;const l=_.FileTreeDialogModel.createModel(this.injector,f),b=await this.dialogService.open({message:r.default.createElement(a.FileDialog,{key:this.idx++,fileService:f,model:l,options:{...E,...d},isOpenDialog:!0}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),b&&b.length>0){const y=b.map(A=>c.URI.file(A));return this.updateRecentDefaultUri(y[0].parent),y}else return}}async showSaveDialog(d={}){if(await this.whenReady,this.appConfig.isElectronRenderer&&!this.appConfig.isRemote){const E=d.defaultUri||this.defaultUri,l=await this.injector.get(p.IElectronMainUIService).showSaveDialog(c.electronEnv.currentWindowId,{defaultPath:E.resolve(d.defaultFileName||"").codeUri.fsPath,title:d.saveLabel,message:d.saveLabel});if(l){const b=c.URI.file(l);return this.updateRecentDefaultUri(b.parent),b}else return}else{d.defaultUri||(d.defaultUri=this.defaultUri);let E;d.defaultUri?E=this.injector.get(g.FileTreeDialogService,[d.defaultUri.toString()]):E=this.injector.get(g.FileTreeDialogService),await E.whenReady;const f=_.FileTreeDialogModel.createModel(this.injector,E),l=await this.dialogService.open({message:r.default.createElement(a.FileDialog,{key:this.idx++,fileService:E,model:f,options:d,isOpenDialog:!1}),type:c.MessageType.Empty,buttons:[],closable:!0,props:{className:s.default.file_dialog_wrapper}});if(this.dialogService.reset(),l&&l.length>0){const b=c.URI.file(l[0]);return this.updateRecentDefaultUri(b.parent),b}else return}}};t.WindowDialogServiceImpl=h,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],h.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(m.IDialogService),n.__metadata("design:type",Object)],h.prototype,"dialogService",void 0),n.__decorate([(0,o.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],h.prototype,"fileServiceClient",void 0),n.__decorate([(0,o.Autowired)(c.StorageProvider),n.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],h.prototype,"appConfig",void 0),t.WindowDialogServiceImpl=h=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],h)},88014:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413);let p=class{constructor(){this.explorerResourceIsFolder=c.ExplorerResourceIsFolderContext.bind(this.globalContextKeyService),this.explorerViewletVisibleContext=c.ExplorerViewletVisibleContext.bind(this.globalContextKeyService)}initScopedContext(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.explorerFocused=c.ExplorerFocusedContext.bind(this._contextKeyService),this.explorerResourceCut=c.ExplorerResourceCut.bind(this._contextKeyService),this.filesExplorerFocused=c.FilesExplorerFocusedContext.bind(this._contextKeyService),this.filesExplorerInputFocused=c.FilesExplorerInputFocusedContext.bind(this._contextKeyService),this.filesExplorerFilteredContext=c.FilesExplorerFilteredContext.bind(this._contextKeyService),this.explorerCompressedFocusContext=c.ExplorerCompressedFocusContext.bind(this._contextKeyService),this.explorerCompressedFirstFocusContext=c.ExplorerCompressedFirstFocusContext.bind(this._contextKeyService),this.explorerCompressedLastFocusContext=c.ExplorerCompressedLastFocusContext.bind(this._contextKeyService)}get service(){return this._contextKeyService}};t.FileContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.FileContextKey=p=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],p)},40439:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(16413),p=e(93899),v=e(68969),m=e(98295),_=e(41893),s=e(54414),g=e(32595),a=e(63067),h=e(58296),u=e(72665),d=e(55121),E=e(51500),f=e(6250),l=e(69959),b=e(56384),y=e(57781),A=e(97738),S=e(4446);let w=class{constructor(){this._disposables=new o.DisposableStore,this.isRendered=!1,this.deleteThrottler=new o.Throttler,this.willDeleteUris=[]}initialize(){this.workspaceService.initFileServiceExclude().then(async()=>{await this.fileTreeService.init(),this.fileTreeModelService.initTreeModel()}),this.progressService.registerProgressIndicator(g.EXPLORER_CONTAINER_ID)}async onStart(){this.viewsRegistry.registerViewWelcomeContent(f.RESOURCE_VIEW_ID,{content:(0,o.formatLocalize)("welcome-view.noFolderHelp",o.FILE_COMMANDS.OPEN_FOLDER.id),group:h.ViewContentGroups.Open,order:1}),this.mainLayoutService.collectViewComponent({id:f.RESOURCE_VIEW_ID,name:this.getWorkspaceTitle(),weight:3,priority:9,collapsed:!1,component:b.FileTree},g.EXPLORER_CONTAINER_ID),this._disposables.add(this.workspaceService.onWorkspaceLocationChanged(()=>{const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&D.updateViewTitle(f.RESOURCE_VIEW_ID,this.getWorkspaceTitle())}))}onDidStart(){const D=this.injector.get(S.SymlinkDecorationsProvider,[this.fileTreeService]);this.decorationService.registerDecorationsProvider(D)}onDidRender(){this.isRendered=!0;const D=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);D&&(this.fileTreeModelService.whenReady.then(()=>{this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(D.isActivated())}),D.onActivate(()=>{this.fileTreeModelService.performLocationOnHandleShow(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!0)}),D.onInActivate(()=>{this.fileTreeModelService.handleTreeBlur(),this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(!1)}))}getWorkspaceTitle(){let D=(0,o.localize)("file.empty.defaultTitle");const I=this.workspaceService.workspace;return I&&(D=new o.URI(I.uri).displayName,!I.isDirectory&&D.endsWith(`.${this.workspaceService.workspaceSuffixName}`)&&(D=D.slice(0,D.lastIndexOf(".")),D===E.UNTITLED_WORKSPACE))?(0,o.localize)("file.workspace.defaultTip"):D}revealFile(D){if(D)if(this.isRendered){const I=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!I||!I.isVisible||I.isCollapsed(f.RESOURCE_VIEW_ID)?this.fileTreeModelService.locationOnShow(D):this.fileTreeModelService.location(D)}else this.fileTreeModelService.locationOnShow(D)}registerMenus(D){D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new")},order:1,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new")},order:2,group:"0_new"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.removeFolderFromWorkspace")},order:1,group:"0_workspace",when:"config.workspace.supportMultiRootWorkspace"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_RESOURCES.id,label:(0,o.localize)("file.open")},order:1,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TO_THE_SIDE.id,label:(0,o.localize)("file.open.side")},order:2,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TYPE_WITH.id,label:(0,o.localize)("file.open.type")},order:3,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH.id,label:(0,o.localize)("file.filetree.openTerminalWithPath")},when:"workbench.panel.terminal",order:4,group:"1_open"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.SEARCH_ON_FOLDER.id,label:(0,o.localize)("file.search.folder")},order:1,group:"2_search"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.DELETE_FILE.id,label:(0,o.localize)("file.delete")},order:1,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.RENAME_FILE.id,label:(0,o.localize)("file.rename")},order:3,group:"7_modification"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COMPARE_SELECTED.id,label:(0,o.localize)("file.compare")},order:2,group:"3_compare"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_FILE.id,label:(0,o.localize)("file.copy.file")},order:1,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.CUT_FILE.id,label:(0,o.localize)("file.cut.file")},order:2,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.PASTE_FILE.id,label:(0,o.localize)("file.paste.file")},order:3,group:"5_cutcopypaste"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_PATH.id,label:(0,o.localize)("file.copy.path")},group:"6_copypath"}),D.registerMenuItem(p.MenuId.ExplorerContext,{command:{id:o.FILE_COMMANDS.COPY_RELATIVE_PATH.id,label:(0,o.localize)("file.copy.relativepath")},group:"6_copypath"})}registerCommands(D){const I=()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()};D.registerCommand(o.FILE_COMMANDS.OPEN_TERMINAL_WITH_PATH,{execute:M=>{let R=M;if(!R)return;const P=this.fileTreeService.getNodeByPathOrUri(R);P&&!P.filestat.isDirectory&&(R=P.uri.parent),this.commandService.executeCommand(o.TERMINAL_COMMANDS.OPEN_WITH_PATH.id,R)}}),D.registerCommand(o.FILE_COMMANDS.SEARCH_ON_FOLDER,{execute:async M=>{var R;let P=M;if(P||(this.fileTreeModelService.focusedFile?P=this.fileTreeModelService.focusedFile.uri:this.fileTreeModelService.selectedFiles.length>0&&(P=(R=this.fileTreeModelService.selectedFiles[0])===null||R===void 0?void 0:R.uri)),!P)return;let k;if(this.fileTreeService.isMultipleWorkspace)for(const F of await this.workspaceService.roots){const L=new o.URI(F.uri);if(L.isEqualOrParent(P)){k=`./${L.relative(P).toString()}`;break}}else if(this.workspaceService.workspace){const F=new o.URI(this.workspaceService.workspace.uri);F.isEqualOrParent(P)&&(k=`./${F.relative(P).toString()}`)}this.commandService.executeCommand(o.SEARCH_COMMANDS.OPEN_SEARCH.id,{includeValue:k+"/"})},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.LOCATION,{execute:M=>{M?this.revealFile(M):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0&&this.revealFile(this.fileTreeModelService.selectedFiles[0].uri)}}),D.registerCommand(o.FILE_COMMANDS.LOCATION_WITH_EDITOR,{execute:()=>{var M,R,P;((R=(M=this.workbenchEditorService.currentEditor)===null||M===void 0?void 0:M.currentUri)===null||R===void 0?void 0:R.scheme)===o.Schemes.file&&this.revealFile((P=this.workbenchEditorService.currentEditor)===null||P===void 0?void 0:P.currentUri)}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE_ALL,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||this.fileTreeModelService.collapseAll()}}),D.registerCommand(o.FILE_COMMANDS.REFRESH_ALL,{execute:async()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);!M||!M.isVisible||await this.fileTreeService.refresh()}}),D.registerCommand(o.FILE_COMMANDS.DELETE_FILE,{execute:(M,R)=>{if(I(),R?this.willDeleteUris=this.willDeleteUris.concat(R):this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0?this.willDeleteUris=this.willDeleteUris.concat(this.fileTreeModelService.selectedFiles.map(P=>P.uri)):this.fileTreeModelService.focusedFile&&this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri),this.willDeleteUris.length!==0)return this.deleteThrottler.queue(this.doDelete.bind(this))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.RENAME_FILE,{execute:M=>{if(I(),!M)if(this.fileTreeModelService.contextMenuFile)M=this.fileTreeModelService.contextMenuFile.uri;else if(this.fileTreeModelService.focusedFile)M=this.fileTreeModelService.focusedFile.uri;else return;this.fileTreeModelService.renamePrompt(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.NEW_FILE,{execute:async M=>{var R;if(I(),M)this.fileTreeModelService.newFilePrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newFilePrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((R=this.workspaceService.workspace)===null||R===void 0?void 0:R.uri),this.fileTreeModelService.newFilePrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.NEW_FOLDER,{execute:async M=>{var R;if(I(),M)this.fileTreeModelService.newDirectoryPrompt(M);else if(this.fileTreeService.isCompactMode&&this.fileTreeModelService.activeUri)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.activeUri);else if(this.fileTreeModelService.selectedFiles&&this.fileTreeModelService.selectedFiles.length>0)this.fileTreeModelService.newDirectoryPrompt(this.fileTreeModelService.selectedFiles[0].uri);else{let P;this.fileTreeService.isMultipleWorkspace?P=new o.URI((await this.workspaceService.roots)[0].uri):P=new o.URI((R=this.workspaceService.workspace)===null||R===void 0?void 0:R.uri),this.fileTreeModelService.newDirectoryPrompt(P)}}}),D.registerCommand(o.FILE_COMMANDS.COMPARE_SELECTED,{execute:(M,R)=>{if(R&&R.length){const P=this.workbenchEditorService.currentEditor;P&&P.currentUri&&this.fileTreeService.compare(R[0],P.currentUri)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_RESOURCES,{execute:M=>{this.fileTreeService.openAndFixedFile(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.OPEN_TO_THE_SIDE,{execute:M=>{this.fileTreeService.openToTheSide(M)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)});const O=(M,R)=>{const{availableOpenTypes:P,currentOpenType:k}=this.workbenchEditorService.currentEditorGroup;if(!(P&&M&&k))return{items:[],selectIndex:-1};const F=this.preferenceService.get("workbench.editorAssociations"),L=[],B=(Q,V)=>V.type===s.EditorOpenType.code?Q.type===s.EditorOpenType.code:V.type===s.EditorOpenType.component&&Q.type===s.EditorOpenType.component?Q.componentId===V.componentId:!1,j=(Q,V)=>(Q?Q+=(0,o.localize)("file.open.type.detail.and")+V:Q=V,Q);let W,U;if(F){const Q=Object.keys(F).find(V=>(0,o.match)(V,M.path.toString().toLowerCase())||(0,o.match)(V,M.path.base.toLowerCase()));W=Q&&F[Q]}return P.forEach((Q,V)=>{var $;const Y={label:Q.title||Q.componentId||Q.type,detail:Q.title,run:H=>R(H,Q)};B(k,Q)&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.active")),U=V),W&&(!(($=Q.componentId)===null||$===void 0)&&$.endsWith(W))&&(Y.description=j(Y.description,(0,o.localize)("file.open.type.detail.default"))),L.push(new o.QuickOpenItem(Y))}),{items:L,selectIndex:U}};D.registerCommand(o.FILE_COMMANDS.OPEN_TYPE_WITH,{execute:M=>{const R=(L,B)=>{var j,W;return L===o.Mode.OPEN?((j=this.workbenchEditorService.currentEditorGroup)===null||j===void 0||j.changeOpenType((W=B.componentId)!==null&&W!==void 0?W:B.type),!0):!1},{items:P,selectIndex:k}=O(M,R);if(P.length===0||typeof k>"u")return;const F=L=>{this.quickOpenService.open({onType:(B,j)=>j(L)},{fuzzyMatchLabel:!0,ignoreFocusOut:!1,placeholder:(0,o.formatLocalize)("file.open.type.placeholder",M.path.base),selectIndex:()=>k})};P.push(new o.QuickOpenItem({label:(0,o.formatLocalize)("file.open.type.preference.default",`*${M.path.ext}`),showBorder:!0,run:L=>{if(L===o.Mode.OPEN){const B=(U,Q)=>{var V,$,Y;if(U===o.Mode.OPEN){const H="workbench.editorAssociations",z=this.preferenceService.resolve(H).scope,K=this.preferenceService.get(H);return this.preferenceService.set(H,{...K||{},[`*${M.path.ext}`]:(V=Q.componentId)!==null&&V!==void 0?V:Q.type},z),($=this.workbenchEditorService.currentEditorGroup)===null||$===void 0||$.changeOpenType((Y=Q.componentId)!==null&&Y!==void 0?Y:Q.type),!0}return!1},{items:j,selectIndex:W}=O(M,B);if(j.length===0||typeof W>"u")return!0;F(j)}return!1}})),F(P)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!l.Directory.is(this.fileTreeModelService.contextMenuFile)}),D.registerCommand(o.FILE_COMMANDS.COPY_PATH,{execute:async M=>{if(!M)return;let P=M.path.toString();if(M.scheme===s.DIFF_SCHEME){const F=M.getParsedQuery();P=new o.URI(F.modified).path.toString()}let k=decodeURIComponent(P);await this.appService.backendOS===o.OperatingSystem.Windows&&(k=k.slice(1)),await this.clipboardService.writeText(k)},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_RELATIVE_PATH,{execute:async M=>{if(!M)return;if(M.scheme===s.DIFF_SCHEME){const k=M.getParsedQuery();M=new o.URI(k.modified).withScheme("file")}const R=this.fileTreeService.getNodeByPathOrUri(M);if(R&&R.filestat.isInSymbolicDirectory)return await this.clipboardService.writeText(R.path.split(d.Path.separator).slice(2).join(d.Path.separator));let P;if(this.fileTreeService.isMultipleWorkspace)for(const k of await this.workspaceService.roots){if(P=new o.URI(k.uri),P.isEqual(M))return await this.clipboardService.writeText("./");if(P.isEqualOrParent(M))return await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))}else if(this.workspaceService.workspace)return P=new o.URI(this.workspaceService.workspace.uri),P.isEqual(M)?await this.clipboardService.writeText("./"):await this.clipboardService.writeText(decodeURIComponent(P.relative(M).toString()))},isVisible:()=>!!this.fileTreeModelService.contextMenuFile}),D.registerCommand(o.FILE_COMMANDS.COPY_FILE,{execute:(M,R)=>{if(R&&R.length)this.fileTreeModelService.copyFile(R);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.copyFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.SELECT_CURRENT_NODE,{execute:(M,R)=>{if(R&&R.length)this.fileTreeModelService.selectChildNode(R);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.selectChildNode(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.CUT_FILE,{execute:(M,R)=>{if(R&&R.length)this.fileTreeModelService.cutFile(R);else{const P=this.fileTreeModelService.selectedFiles.map(k=>k.uri);P&&P.length&&this.fileTreeModelService.cutFile(P)}},isVisible:()=>!!this.fileTreeModelService.contextMenuFile&&!this.fileTreeModelService.contextMenuFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)||!!this.fileTreeModelService.focusedFile&&!this.fileTreeModelService.focusedFile.uri.isEqual(this.fileTreeModelService.treeModel.root.uri)}),D.registerCommand(o.FILE_COMMANDS.PASTE_FILE,{execute:M=>{if(I(),M)this.fileTreeModelService.pasteFile(M);else if(this.fileTreeModelService.focusedFile){let R;this.fileTreeModelService.activeUri?R=this.fileTreeModelService.activeUri:R=this.fileTreeModelService.focusedFile.uri,this.fileTreeModelService.pasteFile(R)}},isEnabled:()=>this.fileTreeModelService.pasteStore&&this.fileTreeModelService.pasteStore.type!==f.PasteTypes.NONE||this.appConfig.isElectronRenderer}),D.registerCommand(o.FILE_COMMANDS.VSCODE_OPEN_FOLDER,{execute:(M,R)=>{const P=this.injector.get(o.IWindowService),k={newWindow:!0};return typeof R=="boolean"?k.newWindow=R:k.newWindow=typeof R?.forceNewWindow=="boolean"?R.forceNewWindow:!0,M?P.openWorkspace(M,k):this.commandService.executeCommand(o.FILE_COMMANDS.OPEN_FOLDER.id,k)},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FOLDER,{execute:M=>{const R=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),properties:["openDirectory"]}).then(k=>{k&&k.length>0&&R.openWorkspace(o.URI.file(k[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openDirectory"),canSelectFiles:!1,canSelectFolders:!0}).then(k=>{var F;k&&k.length>0&&this.injector.get(E.IWorkspaceService).open(k[0],{preserveWindow:(F=M?.newWindow)!==null&&F!==void 0?F:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenFolder");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.OPEN_WORKSPACE,{execute:M=>{if(!this.preferenceService.get("application.supportsOpenWorkspace"))return;const P=this.injector.get(o.IWindowService);this.appConfig.isElectronRenderer?this.injector.get(o.IElectronNativeDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),properties:["openFile"],filters:[{name:(0,o.localize)("workspace.openWorkspaceTitle"),extensions:[this.workspaceService.workspaceSuffixName]}]}).then(F=>{F&&F.length>0&&P.openWorkspace(o.URI.file(F[0]),M||{newWindow:!0})}):this.injector.get(u.IWindowDialogService).showOpenDialog({title:(0,o.localize)("workspace.openWorkspace"),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,filters:{workspace:[this.workspaceService.workspaceSuffixName]}}).then(F=>{var L;F&&F.length>0&&this.injector.get(E.IWorkspaceService).open(F[0],{preserveWindow:(L=M?.newWindow)!==null&&L!==void 0?L:!1})})},isVisible:()=>{const M=this.preferenceService.get("application.supportsOpenWorkspace");return M??!1}}),D.registerCommand(o.FILE_COMMANDS.REVEAL_IN_EXPLORER,{execute:M=>{var R;let P=M instanceof o.URI?M:M?.uri;const k=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);k&&!k.isVisible&&(k.activate(),setTimeout(()=>{k.setCollapsed(f.RESOURCE_VIEW_ID,!1)},200)),!P&&(!((R=this.workbenchEditorService.currentEditor)===null||R===void 0)&&R.currentUri)&&(P=this.workbenchEditorService.currentEditor.currentUri),P&&this.revealFile(o.URI.parse(P.toString()))}}),D.registerCommand(o.FILE_COMMANDS.FOCUS_FILES,{execute:()=>{const M=this.mainLayoutService.getTabbarHandler(g.EXPLORER_CONTAINER_ID);M&&M.activate()}}),D.registerCommand(o.FILE_COMMANDS.OPEN_FILE,{execute:M=>this.windowDialogService.showOpenDialog(M)}),D.registerCommand(o.FILE_COMMANDS.SAVE_FILE,{execute:M=>this.windowDialogService.showSaveDialog(M)}),D.registerCommand(o.FILE_COMMANDS.FILTER_TOGGLE,{execute:()=>this.fileTreeService.toggleFilterMode()}),D.registerCommand(o.FILE_COMMANDS.FILTER_OPEN,{execute:()=>{if(!this.fileTreeService.filterMode)return this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.FILTER_CLOSE,{execute:()=>{this.fileTreeService.filterMode&&this.fileTreeService.toggleFilterMode()}}),D.registerCommand(o.FILE_COMMANDS.NEXT,{execute:()=>{this.fileTreeModelService.moveToNext()}}),D.registerCommand(o.FILE_COMMANDS.PREV,{execute:()=>{this.fileTreeModelService.moveToPrev()}}),D.registerCommand(o.FILE_COMMANDS.COLLAPSE,{execute:()=>{this.fileTreeModelService.collapseCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.EXPAND,{execute:()=>{this.fileTreeModelService.expandCurrentFile()}}),D.registerCommand(o.FILE_COMMANDS.TOGGLE_OR_OPEN,{execute:()=>{this.fileTreeModelService.toggleOrOpenCurrentFile()}}),D.registerCommand(o.WORKSPACE_COMMANDS.REMOVE_WORKSPACE_FOLDER,{execute:async(M,R)=>{if(I(),!R.length||!this.workspaceService.isMultiRootWorkspaceOpened)return;const P=await this.workspaceService.roots,k=R.filter(F=>P.find(L=>L.uri===F.toString()));k.length>0&&await this.workspaceService.removeRoots(k)},isVisible:()=>this.workspaceService.isMultiRootWorkspaceOpened&&!!this.fileTreeModelService.contextMenuFile&&!!this.workspaceService.tryGetRoots().find(M=>{var R;return M.uri===((R=this.fileTreeModelService.contextMenuFile)===null||R===void 0?void 0:R.uri.toString())})})}registerKeybindings(D){D.registerKeybinding({command:o.FILE_COMMANDS.COPY_FILE.id,keybinding:"ctrlcmd+c",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PASTE_FILE.id,keybinding:"ctrlcmd+v",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.CUT_FILE.id,keybinding:"ctrlcmd+x",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.SELECT_CURRENT_NODE.id,keybinding:"ctrlcmd+a",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.RENAME_FILE.id,keybinding:"enter",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.DELETE_FILE.id,keybinding:"ctrlcmd+backspace",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_OPEN.id,keybinding:"ctrlcmd+f",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.FILTER_CLOSE.id,keybinding:"esc",when:`${c.FilesExplorerFocusedContext.raw} && ${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.NEXT.id,keybinding:"down",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.PREV.id,keybinding:"up",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.EXPAND.id,keybinding:"right",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.COLLAPSE.id,keybinding:"left",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`}),D.registerKeybinding({command:o.FILE_COMMANDS.TOGGLE_OR_OPEN.id,keybinding:"space",when:`${c.FilesExplorerFocusedContext.raw} && !${c.FilesExplorerInputFocusedContext.raw} && !${c.FilesExplorerFilteredContext.raw}`})}registerToolbarItems(D){D.registerItem({id:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,command:o.FILE_COMMANDS.LOCATION_WITH_EDITOR.id,label:(0,o.localize)("file.location"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !config.explorer.autoReveal && !${c.FilesExplorerFilteredContext.raw}`,order:0}),D.registerItem({id:o.FILE_COMMANDS.NEW_FILE.id,command:o.FILE_COMMANDS.NEW_FILE.id,label:(0,o.localize)("file.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:1}),D.registerItem({id:o.FILE_COMMANDS.NEW_FOLDER.id,command:o.FILE_COMMANDS.NEW_FOLDER.id,label:(0,o.localize)("file.folder.new"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:2}),D.registerItem({id:o.FILE_COMMANDS.FILTER_TOGGLE.id,command:o.FILE_COMMANDS.FILTER_TOGGLE.id,label:(0,o.localize)("file.filetree.filter"),viewId:f.RESOURCE_VIEW_ID,toggledWhen:`${c.FilesExplorerFilteredContext.raw}`,order:3}),D.registerItem({id:o.FILE_COMMANDS.REFRESH_ALL.id,command:o.FILE_COMMANDS.REFRESH_ALL.id,label:(0,o.localize)("file.refresh"),viewId:f.RESOURCE_VIEW_ID,when:`view == '${f.RESOURCE_VIEW_ID}' && !${c.FilesExplorerFilteredContext.raw}`,order:4}),D.registerItem({id:o.FILE_COMMANDS.COLLAPSE_ALL.id,command:o.FILE_COMMANDS.COLLAPSE_ALL.id,label:(0,o.localize)("file.collapse"),viewId:f.RESOURCE_VIEW_ID,order:5}),D.registerItem({id:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,command:o.WORKSPACE_COMMANDS.ADD_WORKSPACE_FOLDER.id,label:(0,o.localize)("workspace.addFolderToWorkspace"),viewId:f.RESOURCE_VIEW_ID,order:0,group:"file_explore_workspace",when:"config.workspace.supportMultiRootWorkspace"})}doDelete(){const D=this.willDeleteUris.slice();return this.willDeleteUris=[],this.fileTreeModelService.deleteFileByUris(D)}dispose(){this._disposables.dispose()}};t.FileTreeContribution=w,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],w.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(f.IFileTreeService),n.__metadata("design:type",y.FileTreeService)],w.prototype,"fileTreeService",void 0),n.__decorate([(0,r.Autowired)(a.IMainLayoutService),n.__metadata("design:type",Object)],w.prototype,"mainLayoutService",void 0),n.__decorate([(0,r.Autowired)(v.IProgressService),n.__metadata("design:type",Object)],w.prototype,"progressService",void 0),n.__decorate([(0,r.Autowired)(E.IWorkspaceService),n.__metadata("design:type",Object)],w.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(A.FileTreeModelService),n.__metadata("design:type",A.FileTreeModelService)],w.prototype,"fileTreeModelService",void 0),n.__decorate([(0,r.Autowired)(_.IDecorationsService),n.__metadata("design:type",_.IDecorationsService)],w.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(s.WorkbenchEditorService),n.__metadata("design:type",s.WorkbenchEditorService)],w.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],w.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(u.IWindowDialogService),n.__metadata("design:type",Object)],w.prototype,"windowDialogService",void 0),n.__decorate([(0,r.Autowired)(o.IClipboardService),n.__metadata("design:type",Object)],w.prototype,"clipboardService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],w.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.QuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(a.IViewsRegistry),n.__metadata("design:type",Object)],w.prototype,"viewsRegistry",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],w.prototype,"appService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],w.prototype,"appConfig",void 0),t.FileTreeContribution=w=n.__decorate([(0,m.Domain)(p.MenuContribution,o.CommandContribution,o.KeybindingContribution,o.TabBarToolbarContribution,o.ClientAppContribution,a.MainLayoutContribution)],w)},2812:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModel=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(69959),m=e(93239);let _=n=class extends c.TreeModel{constructor(g){super(),this.flushDispatchChangeDelayer=new p.ThrottledDelayer(n.DEFAULT_FLUSH_DELAY),this.init(g)}init(g){this.root=g,this.root.watcher.on(c.TreeNodeEvent.BranchDidUpdate,this.doDispatchChange.bind(this)),this.decorationService.onDidChange(this.doDispatchChange.bind(this))}doDispatchChange(){this.flushDispatchChangeDelayer.isTriggered()||this.flushDispatchChangeDelayer.cancel(),this.flushDispatchChangeDelayer.trigger(async()=>{this.dispatchChange()})}};t.FileTreeModel=_,_.DEFAULT_FLUSH_DELAY=100,r.__decorate([(0,o.Autowired)(m.FileTreeDecorationService),r.__metadata("design:type",m.FileTreeDecorationService)],_.prototype,"decorationService",void 0),t.FileTreeModel=_=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[v.Directory])],_)},46377:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_TREE_BADGE_LIMIT=t.FILE_TREE_NODE_HEIGHT=t.FileTreeNode=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(69959),m=n.__importDefault(e(89200)),{Path:_}=p.path,s=({item:g,onClick:a,onDoubleClick:h,onContextMenu:u,dndService:d,itemType:E,decorationService:f,labelService:l,leftPadding:b=8,onTwistierClick:y,decorations:A,defaultLeftPadding:S=8,template:w,hasFolderIcons:T,hasFileIcons:D,hidesExplorerArrows:I,hasPrompt:O,iconService:M})=>{const[R,P]=o.default.useState(-1),k=E===c.TreeNodeType.RenamePrompt,F=E===c.TreeNodeType.NewPrompt,L=k||F,B=!L&&g.name.indexOf(_.separator)>=0,j=(0,p.useDesignStyles)(m.default.expansion_toggle,"expansion_toggle"),W=(0,p.useDesignStyles)(m.default.file_tree_node,"file_tree_node"),U=L?null:f.getDecoration(g.uri,v.Directory.is(g)),Q=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),a(Pe,g,E))},V=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(B&&P(g.name.split(_.separator).length-1),h(Pe,g,E))},$=Pe=>{(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&(y?y(Pe,g,E):a(Pe,g,E))},Y=o.default.useCallback(Pe=>{Pe.nativeEvent.which!==0&&(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&u(Pe,g,E)},[u,g]),H=o.default.useCallback(Pe=>{const{handleDragStart:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),z=o.default.useCallback(Pe=>{const{handleDragLeave:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),K=o.default.useCallback(Pe=>{const{handleDragEnter:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),Z=o.default.useCallback(Pe=>{const{handleDrop:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]),X=o.default.useCallback(Pe=>{const{handleDragOver:Ae}=d;(E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode)&&Ae(Pe,g)},[d,g]);let ie=E===c.TreeNodeType.CompositeTreeNode,oe;L?F?(ie=g.type===c.TreeNodeType.CompositeTreeNode,oe=`${S+(g.parent.depth+1||0)*(b||0)+(ie?0:T?I?0:20:0)}px`):(ie=g.target.type===c.TreeNodeType.CompositeTreeNode,oe=`${S+(g.target.depth||0)*(b||0)+(ie?0:T?I?0:20:0)}px`):oe=`${S+(g.depth||0)*(b||0)+(ie?0:T?I?0:20:0)}px`;const le={color:U?U.color:"",height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`,paddingLeft:oe,opacity:O&&!L?".6":"1"},pe=(Pe,Ae)=>{if(A&&A?.classlist.indexOf(m.default.mod_loading)>-1)return o.default.createElement(c.Loading,null);if(L&&Pe instanceof c.PromptHandle){let Te=!1;if(k?Te=Pe.target.type===c.TreeNodeType.CompositeTreeNode:Te=Pe.type===c.TreeNodeType.CompositeTreeNode,Te)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:F||!(k&&Pe.target.type===c.TreeNodeType.CompositeTreeNode&&Pe.target.expanded)})})}else return o.default.createElement("div",{onClick:Ae,className:(0,r.default)(m.default.file_tree_node_segment,j,(0,p.getIcon)("arrow-right"),{[`${m.default.mod_collapsed}`]:!Pe.expanded})})},q=Pe=>{let Ae,Te;L&&Pe instanceof c.PromptHandle?Pe instanceof c.RenamePromptHandle?(Ae=Pe.target.uri.resolve(Pe.$.value),Te=v.Directory.is(Pe.target)):(Ae=Pe.parent.uri.resolve(Pe.$.value),Te=Pe.type===c.TreeNodeType.CompositeTreeNode):(Ae=Pe.uri,Te=Pe.filestat.isDirectory);const be=l.getIcon(Ae,{isDirectory:Te,isOpenedDirectory:Te&&Pe.expanded});return Te&&!T||!Te&&!D?null:o.default.createElement("div",{className:(0,r.default)(m.default.file_icon,be,{expanded:Te&&Pe.expanded}),style:{height:t.FILE_TREE_NODE_HEIGHT,lineHeight:`${t.FILE_TREE_NODE_HEIGHT}px`}})},Ee=Pe=>{if(w)return o.default.createElement(w,null);if(L&&Pe instanceof c.PromptHandle)return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_inputbox)},o.default.createElement("div",{className:(0,r.default)("input-box",m.default.file_tree_node_prompt_box)},o.default.createElement(Pe.ProxiedInput,{wrapperStyle:{height:t.FILE_TREE_NODE_HEIGHT,padding:"0 5px"}})));if(B){const Ae=Pe.displayName.split(_.separator),Te=Ae.map((be,me)=>{const xe=Ae.slice(0,me+1).join(_.separator),Re=Fe=>{Fe.stopPropagation(),P(me);const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));a(Fe,g,E,Ge)},Ne=Fe=>{Fe.stopPropagation(),P(me);const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));u(Fe,g,E,Ge)},fe=Fe=>{Fe.stopPropagation(),Fe.preventDefault(),R!==me&&(P(me),d.handleDragOver(Fe,g))},re=Fe=>{Fe.stopPropagation(),Fe.preventDefault(),P(-1)},he=Fe=>{Fe.stopPropagation(),R!==me&&P(me);const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));d.handleDragStart(Fe,g,Ge)},Oe=Fe=>{const Ge=g.parent.uri.resolve(Ae.slice(0,me+1).join(_.separator));d.handleDrop(Fe,g,Ge)},De=(0,r.default)(R===me&&m.default.active,m.default.compact_name);return o.default.createElement("span",{key:xe},o.default.createElement("a",{className:De,draggable:!0,onContextMenu:Ne,onDragStart:he,onDragOver:fe,onDragLeave:re,onDrop:Oe,onClick:Re},be),me!==Ae.length-1?o.default.createElement("span",{className:m.default.compact_name_separator},_.separator):null)});return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},Te)}return o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_displayname)},l.getName(Pe.uri)||Pe.displayName)},_e=()=>o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_segment,m.default.file_tree_node_tail)},ne()),ne=()=>U?o.default.createElement("div",{className:m.default.file_tree_node_status},(0,p.transformLabelWithCodicon)(U.badge.slice(),{color:"inherit"},M.fromString.bind(M))):null,ge=Pe=>{if(I)return null;if(ie)return pe(Pe,$);if(L)return pe(Pe,()=>{})},we=()=>{let Pe=g.tooltip;return U&&U.badge&&(Pe+=` \u2022 ${U.tooltip}`),Pe};return o.default.createElement("div",{key:g.id,onClick:Q,onDoubleClick:V,onContextMenu:Y,onDragStart:H,onDragOver:X,onDragEnter:K,onDragLeave:z,onDrop:Z,title:we(),className:(0,r.default)(W,A?A.classlist:null),style:le,draggable:E===c.TreeNodeType.TreeNode||E===c.TreeNodeType.CompositeTreeNode,"data-id":g.id},o.default.createElement("div",{className:(0,r.default)(m.default.file_tree_node_content)},ge(g),q(g),o.default.createElement("div",{className:L?m.default.file_tree_node_prompt_wrap:m.default.file_tree_node_overflow_wrap},Ee(g)),_e()))};t.FileTreeNode=s,t.FILE_TREE_NODE_HEIGHT=22,t.FILE_TREE_BADGE_LIMIT=99},56384:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTree=t.FILE_TREE_FILTER_DELAY=t.FILTER_AREA_HEIGHT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(68974),m=e(24429),_=e(87420),s=e(6250),g=e(46377),a=n.__importDefault(e(2613)),h=e(97738);t.FILTER_AREA_HEIGHT=30,t.FILE_TREE_FILTER_DELAY=500;const u=(0,c.RecycleTreeFilterDecorator)(c.RecycleTree),d=({viewState:f})=>{const[l,b]=(0,o.useState)(!1),[y,A]=(0,o.useState)(!0),[S,w]=(0,o.useState)(!1),[T,D]=(0,o.useState)(!1),[I,O]=(0,o.useState)(),M=(0,o.useRef)(null),R=(0,o.useRef)(new p.DisposableCollection),{height:P}=f,k=(0,p.useInjectable)(s.IFileTreeService),{iconService:F,locationToCurrentFile:L,filterMode:B,indent:j,baseIndent:W}=k,U=(0,p.useInjectable)(h.FileTreeModelService),[Q,V]=(0,o.useState)({indent:j,baseIndent:W}),[$,Y]=(0,o.useState)(B),[H,z]=(0,o.useState)(F.currentTheme||{hasFolderIcons:!0,hasFileIcons:!0,hidesExplorerArrows:!0}),K=(0,o.useCallback)(xe=>Z(xe)?!1:xe.shiftKey,[]),Z=(0,o.useCallback)(xe=>{const{metaKey:Re,ctrlKey:Ne}=xe;return p.isOSX&&Re||Ne},[]),X=(0,o.useCallback)((xe,Re,Ne,fe)=>{xe.stopPropagation();const{handleItemClick:re,handleItemToggleClick:he,handleItemRangeClick:Oe}=U;if(!Re)return;const De=K(xe),Fe=Z(xe);De?Oe(Re,Ne):Fe?he(Re,Ne):re(Re,Ne,fe)},[]),ie=(0,o.useCallback)((xe,Re,Ne)=>{xe.stopPropagation();const{handleItemDoubleClick:fe}=U;Re&&fe(Re,Ne)},[]),oe=(0,o.useCallback)((xe,Re)=>{xe.stopPropagation();const{toggleDirectory:Ne}=U;Ne(Re)},[]);(0,o.useEffect)(()=>{l&&U.onFileTreeModelChange(async xe=>{A(!0),xe&&(await xe.ensureReady,M.current&&k.initContextKey(M.current)),O(xe),A(!1)})},[l,M.current,k]),(0,o.useEffect)(()=>{var xe,Re,Ne;const fe=new p.CancellationTokenSource;return q(fe.token),(xe=R.current)===null||xe===void 0||xe.push(F.onThemeChange(re=>{z(re)})),(Re=R.current)===null||Re===void 0||Re.push(k.onTreeIndentChange(({indent:re,baseIndent:he})=>{V({indent:re,baseIndent:he})})),(Ne=R.current)===null||Ne===void 0||Ne.push(k.onFilterModeChange(re=>{Y(re)})),()=>{var re;fe.cancel(),(re=R.current)===null||re===void 0||re.dispose()}},[]);const le=(0,o.useCallback)((xe,Re)=>{let Ne;if(xe&&Re)for(Ne=xe.parentNode;Ne;){if(Re===Ne)return!0;Ne=Ne.parentNode}return!1},[]),pe=(0,o.useCallback)(xe=>{le(xe.relatedTarget,M.current)||!xe.relatedTarget||(w(!1),U.handleTreeBlur())},[M.current]);(0,o.useEffect)(()=>{$||(U.fileTreeHandle&&U.fileTreeHandle.clearFilter(),U.selectedFiles.length===1&&U.location(U.selectedFiles[0].uri))},[$]),(0,o.useEffect)(()=>{const xe=new p.DisposableCollection;return I&&(xe.push(U.onDidFocusedFileChange(Re=>{Re?Re.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Re||S&&w(!S)})),xe.push(U.onDidContextMenuFileChange(Re=>{Re?Re.isEqual((I?.root).uri)?S||w(!S):S&&w(!S):Re||S&&w(!S)}))),()=>{xe.dispose()}},[I,S]);const q=(0,o.useCallback)(async xe=>{var Re;if(await U.whenReady,!xe.isCancellationRequested){if(U.treeModel){if(await U.treeModel.ensureReady,O(U.treeModel),xe.isCancellationRequested)return;M.current&&k.initContextKey(M.current)}A(!1),!((Re=R.current)===null||Re===void 0)&&Re.disposed||b(!0)}},[U,R.current]),Ee=(0,o.useCallback)(xe=>{U.handleTreeHandler({...xe,getModel:()=>U.treeModel,hasDirectFocus:()=>M.current===document.activeElement})},[M.current,I]),_e=(0,o.useCallback)(()=>{const{handleItemClick:xe}=U;xe()},[]),ne=(0,o.useCallback)(()=>{U.handleDblClick()},[]),ge=(0,o.useCallback)(()=>{const{handleTreeFocus:xe}=U;xe()},[]),we=(0,o.useCallback)(xe=>{const{handleContextMenu:Re}=U;Re(xe)},[]),Pe=(0,o.useCallback)(xe=>{xe.stopPropagation(),xe.preventDefault()},[]),Ae=(0,o.useCallback)(xe=>{xe.preventDefault(),D(!0)},[]),Te=(0,o.useCallback)(()=>{D(!1)},[]),be=(0,o.useCallback)(xe=>{const{handleDrop:Re}=U.dndService;D(!1),Re(xe)},[]),me=(0,o.useCallback)((xe,Re,Ne,fe)=>{const{handleContextMenu:re}=U;re(xe,Re,fe)},[]);return o.default.createElement("div",{className:(0,r.default)(a.default.file_tree,T&&a.default.outer_drag_over,S&&a.default.outer_active),tabIndex:-1,ref:M,onClick:_e,onDoubleClick:ne,onFocus:ge,onBlur:pe,onContextMenu:we,draggable:!0,onDragStart:Pe,onDragLeave:Te,onDragOver:Ae,onDrop:be},o.default.createElement(E,{isLoading:y,isReady:l,height:P,model:I,iconTheme:H,treeIndent:Q,filterMode:$,locationToCurrentFile:L,onTreeReady:Ee,onContextMenu:me,onItemClick:X,onItemDoubleClick:ie,onTwistierClick:oe}))};t.FileTree=d;const E=(0,o.memo)(({isReady:f,isLoading:l,height:b,model:y,filterMode:A,treeIndent:S,iconTheme:w,onTreeReady:T,onItemClick:D,onItemDoubleClick:I,onContextMenu:O,onTwistierClick:M})=>{const R=(0,p.useInjectable)(s.IFileTreeService),P=(0,p.useInjectable)(_.IIconService),{decorationService:k,labelService:F,locationToCurrentFile:L}=R,B=(0,p.useInjectable)(h.FileTreeModelService),j=(0,o.useCallback)(W=>o.default.createElement(g.FileTreeNode,{item:W.item,itemType:W.itemType,template:W.template,decorationService:k,labelService:F,iconService:P,dndService:B.dndService,decorations:B.decorations.getDecorations(W.item),onClick:D,onDoubleClick:I,onTwistierClick:M,onContextMenu:O,defaultLeftPadding:S.baseIndent,leftPadding:S.indent,hasPrompt:W.hasPrompt,hasFolderIcons:w.hasFolderIcons,hasFileIcons:w.hasFileIcons,hidesExplorerArrows:w.hidesExplorerArrows}),[y,S,w]);return f?l?o.default.createElement(v.Progress,{loading:!0}):y?o.default.createElement(u,{height:b,itemHeight:g.FILE_TREE_NODE_HEIGHT,onReady:T,model:y,filterEnabled:A,filterAfterClear:L,filterAutoFocus:!0,leaveBottomBlank:!0},j):o.default.createElement(m.WelcomeView,{viewId:s.FILE_EXPLORER_WELCOME_ID}):o.default.createElement(v.Progress,{loading:!0})});E.displayName="FileTreeView"},57781:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeService=void 0;const n=e(85608),r=e(76003),o=e(97267),c=e(41869),p=e(18193),v=e(26542),m=e(42933),_=e(52416),s=e(51500),g=e(6250),a=e(69959),h=e(88014),u=e(93239),{Path:d}=c.path;let E=class extends o.Tree{constructor(){super(...arguments),this._fileServiceWatchers=new Map,this._symbolicFiles=new Map,this._changeEventDispatchQueue=new Set,this._readyToWatch=!1,this._watchRootsQueue=[],this.effectedNodes=[],this.onWorkspaceChangeEmitter=new c.Emitter,this.onTreeIndentChangeEmitter=new c.Emitter,this.onFilterModeChangeEmitter=new c.Emitter,this.onNodeRefreshedEmitter=new c.Emitter,this._filterMode=!1,this._refreshable=!0,this.refreshEffectNode=()=>{const l=this.effectedNodes.slice(0);if(this.effectedNodes=[],l.find(y=>a.Directory.isRoot(y)))this.refresh();else for(const y of l)this.refresh(y)},this.flushEventQueue=async()=>{if(!this._changeEventDispatchQueue||this._changeEventDispatchQueue.size===0)return;const l=Array.from(this._changeEventDispatchQueue),b=this.sortPaths(l);(!this.refreshCancelToken||this.refreshCancelToken.token.isCancellationRequested)&&(this.refreshCancelToken=new c.CancellationTokenSource);const y=(0,c.pSeries)(b.map(A=>async()=>{a.Directory.is(A.node)&&await A.node.refresh(this.refreshCancelToken)}));return this._changeEventDispatchQueue.clear(),await y},this.locationToCurrentFile=()=>{this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}}get onNodeRefreshed(){return this.onNodeRefreshedEmitter.event}get refreshable(){return this._refreshable}get filterMode(){return this._filterMode}get baseIndent(){return this._baseIndent}get indent(){return this._indent}get onWorkspaceChange(){return this.onWorkspaceChangeEmitter.event}get onTreeIndentChange(){return this.onTreeIndentChangeEmitter.event}get onFilterModeChange(){return this.onFilterModeChangeEmitter.event}get isCompactMode(){return this._isCompactMode}get contextKey(){return this.fileContextKey}async init(){this._roots=await this.workspaceService.roots,await this.preferenceService.ready,this._baseIndent=this.preferenceService.getValid("explorer.fileTree.baseIndent",8),this._indent=this.preferenceService.getValid("explorer.fileTree.indent",8),this._isCompactMode=this.preferenceService.getValid("explorer.compactFolders",!0),this.toDispose.push(this.workspaceService.onWorkspaceChanged(l=>{this._roots=l;const b=new c.URI(l[0].uri),y=new a.Directory(this,void 0,b,b.displayName,l[0],this.fileTreeAPI.getReadableTooltip(b));this.root=y,this.onWorkspaceChangeEmitter.fire(y),this.refresh()})),this.toDispose.push(this.workspaceService.onWorkspaceFileExcludeChanged(()=>{this.refresh()})),this.toDispose.push(c.Disposable.create(()=>{var l;(l=this._root)===null||l===void 0||l.dispose(),this._roots=null})),this.toDispose.push(this.corePreferences.onPreferenceChanged(l=>{l.preferenceName==="explorer.fileTree.baseIndent"?(this._baseIndent=l.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):l.preferenceName==="explorer.fileTree.indent"?(this._indent=l.newValue||8,this.onTreeIndentChangeEmitter.fire({indent:this.indent,baseIndent:this.baseIndent})):l.preferenceName==="explorer.compactFolders"&&(this._isCompactMode=l.newValue,this.refresh())}))}initContextKey(l){this.fileContextKey.initScopedContext(l)}startWatchFileEvent(){return this._readyToWatch=!0,Promise.all(this._watchRootsQueue.map(l=>this.watchFilesChange(l)))}async resolveChildren(l){var b,y,A,S;let w=[];if(l){if(a.Directory.isRoot(l)&&this.isMultipleWorkspace){const T=await this.workspaceService.roots;for(const D of T){const I=this.fileTreeAPI.toNode(this,D,l,this.workspaceService.getWorkspaceName(new c.URI(D.uri)));this.watchFilesChange(new c.URI(D.uri)),w=w.concat(I),(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)}return w}if(l.uri){const T=await this.fileTreeAPI.resolveChildren(this,l.uri.toString(),l,this.isCompactMode&&!a.Directory.isRoot(l));w=T.children,w.forEach(I=>{(I.filestat.isSymbolicLink||I.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(I.filestat.uri,I)});const D=T.filestat;if(D&&this.isCompactMode&&!a.Directory.isRoot(l)){const I=new c.URI(D.uri),O=l.parent;if(l&&O){let M=l.name;if(l.filestat.isSymbolicLink){const R=(y=new c.URI(l.filestat.realUri).relative(I))===null||y===void 0?void 0:y.toString();R&&(M=R,M=[l.uri.displayName].concat(M.split(d.separator)).join(d.separator))}else O.filestat.isSymbolicLink?M=(A=new c.URI(O.filestat.realUri).relative(I))===null||A===void 0?void 0:A.toString():M=(S=O.uri.relative(I))===null||S===void 0?void 0:S.toString();M&&M!==l.name&&l.updateMetaData({name:M,uri:I,tooltip:this.fileTreeAPI.getReadableTooltip(I),fileStat:D})}}return w}}else if(this._roots||(this._roots=await this.workspaceService.roots),this.isMultipleWorkspace){const T=new c.URI((b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri);let D=T.displayName;D=D.slice(0,D.lastIndexOf("."));const I={...this.workspaceService.workspace,isDirectory:!0},O=new a.Directory(this,void 0,T,D,I,this.fileTreeAPI.getReadableTooltip(T));return this.root=O,[O]}else if(this._roots.length>0)return w=await(await this.fileTreeAPI.resolveChildren(this,this._roots[0])).children,w.forEach(T=>{const D=this.workspaceService.getWorkspaceName(T.uri);D&&D!==T.name&&T.updateMetaData({name:D}),(T.filestat.isSymbolicLink||T.filestat.isInSymbolicDirectory)&&this._symbolicFiles.set(T.filestat.uri,T)}),this.watchFilesChange(new c.URI(this._roots[0].uri)),this.root=w[0],w;return[]}async watchFilesChange(l){if(!this._readyToWatch){this._watchRootsQueue.push(l);return}const b=await this.fileServiceClient.watchFileChanges(l);this.toDispose.push(b),this.toDispose.push(b.onFilesChanged(y=>{this.onFilesChanged(y)})),this._fileServiceWatchers.set(l.toString(),b)}updateRefreshable(l){var b;l!==this.refreshable&&(this._refreshable=l,this._refreshable?this.doHandleQueueChange():(b=this.refreshCancelToken)===null||b===void 0||b.cancel())}isContentFile(l){return!!l&&"filestat"in l&&!l.filestat.isDirectory}isFileContentChanged(l){return l.type===m.FileChangeType.UPDATED&&this.isContentFile(this.getNodeByPathOrUri(l.uri))}getAffectedChanges(l){const b=[];for(const y of l)this.isFileContentChanged(y)||b.push(y);return b}isRootAffected(l){return this._roots?l.some(b=>b.type>m.FileChangeType.UPDATED&&this._roots&&this._roots.find(y=>b.uri.indexOf(y.uri)>=0)):!1}async onFilesChanged(l){const b=await this.getAffectedNodes(this.getAffectedChanges(l));return b.length>0?this.effectedNodes=this.effectedNodes.concat(b):!(b.length>0)&&this.isRootAffected(l)&&this.effectedNodes.push(this.root),this.refreshEffectNode()}async getFileTreeNodePathByUri(l){var b,y,A,S,w,T;if(!l)return;let D;if(this.isMultipleWorkspace){if(this._roots||(this._roots=await this.workspaceService.roots),D=(S=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(l)))===null||S===void 0?void 0:S.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(l))return new d(((w=this.root)===null||w===void 0?void 0:w.path)||"/").join(I.displayName).join(((T=I.relative(l))===null||T===void 0?void 0:T.toString())||"").toString()}}else if(D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,D){const I=new c.URI(D);if(I.isEqualOrParent(l))return new d(((y=this.root)===null||y===void 0?void 0:y.path)||"").join(((A=I.relative(l))===null||A===void 0?void 0:A.toString())||"").toString()}}async moveNodeByPath(l,b,y,A,S=o.TreeNodeType.TreeNode){const w=new d(l.path).join(y).toString(),T=new d(b.path).join(A).toString();if(w&&T&&T!==w){const D=l.moveNode(w,T);return D&&a.File.is(D)&&(D.updateMetaData({uri:b.uri.resolve(A),fileStat:{...b.filestat,uri:b.uri.resolve(A).toString(),isDirectory:S!==o.TreeNodeType.TreeNode},tooltip:this.fileTreeAPI.getReadableTooltip(b.uri.resolve(A))}),a.Directory.is(D)&&this.updateChildren(D)),D}}async updateChildren(l){const b=l.children;if(!(!b||b.length===0)){for(const y of b)if(a.File.is(y)){const A=l.uri.resolve(y.uri.displayName);y.updateMetaData({uri:A,fileStat:{...y.filestat,uri:A.toString(),isDirectory:!!a.Directory.is(y)},tooltip:this.fileTreeAPI.getReadableTooltip(A)}),a.Directory.is(y)&&this.updateChildren(y)}}}async addNode(l,b,y){let A,S;const w=d.splitPath(b);if(w.length>1){let D=l.uri;for(const I of w)D=D.resolve(I);!this.isCompactMode||a.Directory.isRoot(l)?S=w[0]:y===o.TreeNodeType.CompositeTreeNode?S=b:S=w.slice(0,w.length-1).join(d.separator)}else S=b;A={uri:l.uri.resolve(S).toString(),isDirectory:y===o.TreeNodeType.CompositeTreeNode||w.length>1,isSymbolicLink:!1,lastModification:new Date().getTime()};const T=await this.fileTreeAPI.toNode(this,A,l,S);return T&&l.addNode(T),T}async deleteAffectedNodeByPath(l,b){var y,A;const S=this.getNodeByPathOrUri(l);S&&S.parent&&(this.isCompactMode&&!b?((y=S.parent.children)===null||y===void 0?void 0:y.length)===2?this.refresh((A=S.parent)===null||A===void 0?void 0:A.parent):this.refresh(S.parent):S.parent.removeNode(S.path))}async deleteAffectedNodes(l,b=[]){const y=[];for(const A of l){const S=this.getNodeByPathOrUri(A);S&&a.File.is(S)&&y.push(S)}for(const A of y)!A?.parent||this._changeEventDispatchQueue.has(A?.parent.path)||await this.deleteAffectedNodeByPath(A.path);return b.filter(A=>A.type!==m.FileChangeType.DELETED)}async getAffectedNodes(l){const b=[];for(const y of l){const A=new c.URI(y.uri),S=this.getNodeByPathOrUri(A.parent);S&&b.push(S)}return b}isFileURI(l){return/^file:\/\//.test(l)}getNodeByPathOrUri(l){var b,y,A,S;let w,T;if(typeof l!="string"?(T=l,l=l.toString()):this.isFileURI(l)?T=new c.URI(l):!this.isFileURI(l)&&typeof l=="string"&&(w=l),this.isFileURI(l)&&T){if(this._symbolicFiles.has(T?.toString()))return this._symbolicFiles.get(T.toString());let D;if(this.isMultipleWorkspace?this._roots&&(D=(y=this._roots.find(I=>new c.URI(I.uri).isEqualOrParent(T)))===null||y===void 0?void 0:y.uri):D=(b=this.workspaceService.workspace)===null||b===void 0?void 0:b.uri,this.root&&D){const I=new c.URI(D);if(I.isEqualOrParent(T)){const O=I.relative(T);O&&(this.isMultipleWorkspace?w=new d(this.root.path).join(I.displayName).join(O.toString()).toString():w=new d(this.root.path).join(O.toString()).toString())}}}if(w){const D=(A=this.root)===null||A===void 0?void 0:A.getTreeNodeByPath(w);if(!D){let I;const O=w.split(d.separator);for(;O.length>=1;){O.pop();const M=O.join(d.separator);if(I=(S=this.root)===null||S===void 0?void 0:S.getTreeNodeByPath(M),I)break}if(I&&a.Directory.is(I)){for(const M of I.children||[])if(M.path.includes(w))return M}}return D}}sortComparator(l,b){return l.constructor===b.constructor?l.name.localeCompare(b.name,"en",{numeric:!0}):l.type===o.TreeNodeType.CompositeTreeNode?-1:b.type===o.TreeNodeType.CompositeTreeNode?1:0}get contextMenuContextKeyService(){return this.fileContextKey?this.fileContextKey.service:this.contextKeyService}get isMultipleWorkspace(){return!!this.workspaceService.workspace&&!this.workspaceService.workspace.isDirectory}getDisplayName(l){return this.workspaceService.getWorkspaceName(l)}async refresh(l=this.root){if(l)return a.Directory.is(l)||a.File.is(l)&&l.parent&&(l=l.parent),this._changeEventDispatchQueue.add(l.path),this.doHandleQueueChange()}async doHandleQueueChange(){if(this.refreshable)try{await this.flushEventQueue()}catch(l){this.logger.error("flush file change event queue error:",l)}finally{this.onNodeRefreshedEmitter.fire()}}sortPaths(l){const y=l.slice().map(S=>({node:this.getNodeByPathOrUri(S),path:S})).filter(S=>S&&!!S.node);l.length>1&&y.sort((S,w)=>{var T,D;const I=((T=S.node)===null||T===void 0?void 0:T.depth)||0,O=((D=w.node)===null||D===void 0?void 0:D.depth)||0;return I-O});const A=[];for(let S=y.length-1;S>=0;S--){const w=y[S];let T=!1;for(let D=0;D<S;D++){const I=y[D];a.Directory.is(I)&&w.node.path.startsWith(I.node.path)&&(T=!0)}T||A.push(w)}return A}openFile(l){const b=this.preferenceService.get("editor.previewMode");this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,preview:b})}openAndFixedFile(l){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,preview:!1,focus:!0})}openToTheSide(l){this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,l,{disableNavigate:!0,split:4})}compare(l,b){this.commandService.executeCommand(c.EDITOR_COMMANDS.COMPARE.id,{original:l,modified:b})}toggleFilterMode(){var l;this._filterMode=!this.filterMode,this.onFilterModeChangeEmitter.fire(this.filterMode),(l=this.fileContextKey)===null||l===void 0||l.filesExplorerFilteredContext.set(this.filterMode),this.filterMode===!1&&this.commandService.executeCommand(c.FILE_COMMANDS.LOCATION.id)}};t.FileTreeService=E,n.__decorate([(0,r.Autowired)(g.IFileTreeAPI),n.__metadata("design:type",Object)],E.prototype,"fileTreeAPI",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],E.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(c.IContextKeyService),n.__metadata("design:type",Object)],E.prototype,"contextKeyService",void 0),n.__decorate([(0,r.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(p.CorePreferences),n.__metadata("design:type",Object)],E.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],E.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(v.LabelService),n.__metadata("design:type",v.LabelService)],E.prototype,"labelService",void 0),n.__decorate([(0,r.Autowired)(u.FileTreeDecorationService),n.__metadata("design:type",u.FileTreeDecorationService)],E.prototype,"decorationService",void 0),n.__decorate([(0,r.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],E.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(_.IIconService),n.__metadata("design:type",Object)],E.prototype,"iconService",void 0),n.__decorate([(0,r.Autowired)(c.ILogger),n.__metadata("design:type",Object)],E.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(h.FileContextKey),n.__metadata("design:type",h.FileContextKey)],E.prototype,"fileContextKey",void 0),t.FileTreeService=E=n.__decorate([(0,r.Injectable)()],E)},83709:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeNextModule=void 0;const n=e(85608),r=e(41869),o=e(72665),c=e(41103),p=e(6250),v=e(89508),m=e(40439),_=e(57781),s=e(88808),g=e(93239),a=e(97738),h=e(24861);let u=class extends r.BrowserModule{constructor(){super(...arguments),this.providers=[{token:p.IFileTreeAPI,useClass:s.FileTreeAPI},{token:g.FileTreeDecorationService,useClass:g.FileTreeDecorationService},{token:p.IFileTreeService,useClass:_.FileTreeService},{token:a.FileTreeModelService,useClass:a.FileTreeModelService},{token:o.IWindowDialogService,useClass:v.WindowDialogServiceImpl},m.FileTreeContribution]}};t.FileTreeNextModule=u,t.FileTreeNextModule=u=n.__decorate([(0,r.Domain)(h.name),(0,r.ModuleDependencies)([c.WorkspaceModule])],u)},88808:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeAPI=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(42933),v=e(72665),m=e(26199),_=e(69959);let s=class{constructor(){this.onDidResolveChildrenEmitter=new c.Emitter,this.onDidResolveChildren=this.onDidResolveChildrenEmitter.event}async resolveChildren(a,h,u,d){var E;let f;if(!this.userhomePath){const l=await this.fileServiceClient.getCurrentUserHome();l&&(this.userhomePath=new c.URI(l.uri))}if(typeof h=="string"?f=await this.fileServiceClient.getFileStat(h):f=await this.fileServiceClient.getFileStat(h.uri),f){if(this.onDidResolveChildrenEmitter.fire(f.uri.toString()),((E=f.children)===null||E===void 0?void 0:E.length)===1&&f.children[0].isDirectory&&d)return await this.resolveChildren(a,f.children[0].uri,u,d);{const l={...f,isInSymbolicDirectory:u?.filestat.isSymbolicLink||u?.filestat.isInSymbolicDirectory};return{children:this.toNodes(a,l,u),filestat:l}}}else return{children:[],filestat:null}}async resolveNodeByPath(a,h,u){const d=await this.fileServiceClient.getFileStat(h);if(d)return this.toNode(a,d,u)}async resolveFileStat(a){return await this.fileServiceClient.getFileStat(a.toString())}toNodes(a,h,u){if(u){if(h.children)return h.children.map(d=>this.toNode(a,d,u))}else return[this.toNode(a,h,u)];return[]}toNode(a,h,u,d){var E;const f=new c.URI(h.uri),l=d||f.displayName;let b;return h.isInSymbolicDirectory=(E=u?.filestat.isSymbolicLink)!==null&&E!==void 0?E:u?.filestat.isInSymbolicDirectory,h.isDirectory?b=new _.Directory(a,u,f,l,h,this.getReadableTooltip(f)):b=new _.File(a,u,f,l,h,this.getReadableTooltip(f)),b}async mvFiles(a,h){const u=[];for(const f of a)if(f.url.isEqualOrParent(h))return;const d=a.sort((f,l)=>f.toString().length-l.toString().length),E=[];for(const f of d)E.length>0&&E.find(l=>l.url.isEqualOrParent(f.url))||E.push(f);if(this.corePreferences["explorer.confirmMove"]){const f=(0,c.localize)("file.confirm.move.ok"),l=(0,c.localize)("file.confirm.move.cancel");if(await this.dialogService.warning((0,c.formatLocalize)("file.confirm.move",`[ ${E.map(y=>y.url.displayName).join(",")} ]`,h.displayName),[l,f])!==f)return}for(const f of E){const l=await this.mv(f.url,h.resolve(f.url.displayName),f.isDirectory);l&&u.push(l)}return u}async mv(a,h,u=!1){try{await this.workspaceEditService.apply({edits:[{newResource:h,oldResource:a,options:{isDirectory:u,overwrite:!0}}]})}catch(d){return d.message}}async createFile(a,h){try{await this.workspaceEditService.apply({edits:[{newResource:a,options:{content:h}}]})}catch(u){return u.message}this.commandService.executeCommand(o.EDITOR_COMMANDS.OPEN_RESOURCE.id,a,{disableNavigate:!0,focus:!0})}async createDirectory(a){try{await this.workspaceEditService.apply({edits:[{newResource:a,options:{isDirectory:!0}}]})}catch(h){return h.message}}async delete(a){try{await this.workspaceEditService.apply({edits:[{oldResource:a,options:{}}]});return}catch(h){return h.message}}async copyFile(a,h){let u=1,d;try{d=await this.fileServiceClient.access(h.toString())}catch(E){return E.message}for(;d;){const E=h.displayName.replace(/\Wcopy\W\d+/,""),f=c.path.extname(E),b=`${c.path.basename(E,f)} copy ${u}${f}`;h=h.parent.resolve(b),u++;try{d=await this.fileServiceClient.access(h.toString())}catch{return}}try{return await this.fileServiceClient.copy(a.toString(),h.toString())}catch(E){return E.message}}getReadableTooltip(a){const h=a.toString(),u=this.userhomePath&&this.userhomePath.toString();return this.userhomePath&&this.userhomePath.isEqualOrParent(a)?decodeURIComponent(h.replace(u,"~")):decodeURIComponent(a.withScheme("").toString())}};t.FileTreeAPI=s,n.__decorate([(0,r.Autowired)(p.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fileServiceClient",void 0),n.__decorate([(0,r.Autowired)(m.IWorkspaceEditService),n.__metadata("design:type",Object)],s.prototype,"workspaceEditService",void 0),n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],s.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.CorePreferences),n.__metadata("design:type",Object)],s.prototype,"corePreferences",void 0),n.__decorate([(0,r.Autowired)(v.IDialogService),n.__metadata("design:type",Object)],s.prototype,"dialogService",void 0),t.FileTreeAPI=s=n.__decorate([(0,r.Injectable)()],s)},93239:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeDecorationService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(41893),p=e(52416);let v=class{constructor(){this.disposeCollection=new o.DisposableCollection,this.onDidChangeEmitter=new o.Emitter,this.cacheDecorations=new Map,this.disposeCollection.pushAll([this.decorationsService.onDidChangeDecorations(_=>{var s,g,a;const h=(g=(s=_._data)===null||s===void 0?void 0:s._iter)===null||g===void 0?void 0:g._value;if(h){const u=new o.URI(h),d=this.getDecoration(u);this.cacheDecorations.has(h)?((a=this.cacheDecorations.get(h))===null||a===void 0?void 0:a.tooltip)!==d?.tooltip&&this.onDidChangeEmitter.fire():(this.cacheDecorations.set(h,d),this.onDidChangeEmitter.fire())}}),this.themeService.onThemeChange(()=>{this.onDidChangeEmitter.fire()})])}get onDidChange(){return this.onDidChangeEmitter.event}getDecoration(_,s=!1){_ instanceof o.URI&&(_=o.Uri.parse(_.toString()));const g=this.decorationsService.getDecoration(_,s);return g?{...g,color:this.themeService.getColor({id:g.color})}:{color:"",tooltip:"",badge:""}}dispose(){this.disposeCollection.dispose()}};t.FileTreeDecorationService=v,n.__decorate([(0,r.Autowired)(c.IDecorationsService),n.__metadata("design:type",c.IDecorationsService)],v.prototype,"decorationsService",void 0),n.__decorate([(0,r.Autowired)(p.IThemeService),n.__metadata("design:type",Object)],v.prototype,"themeService",void 0),t.FileTreeDecorationService=v=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],v)},30577:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DragAndDropService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(53622),m=e(14951),_=e(72665),s=e(51500),g=e(6250),a=e(69959),h=r.__importDefault(e(89200)),u=r.__importDefault(e(2613)),d=e(57781),E=e(97738);let f=n=class extends p.WithEventBus{constructor(b){super(),this.model=b,this.toCancelNodeExpansion=new p.DisposableCollection,this.beingDraggedDec=new c.Decoration(h.default.mod_dragging),this.draggedOverDec=new c.Decoration(h.default.mod_dragover),this.beingDraggedNodes=[],this.dragOverTrigger=new p.ThrottledDelayer(n.MS_TILL_DRAGGED_OVER_EXPANDS),this.handleDragStart=(y,A,S)=>{y.stopPropagation();const w=O=>{this.handleDragEnd(O,A)};y.currentTarget.addEventListener("dragend",w,!1);let T=this.model.selectedFiles,D=!1;for(const O of T)O&&O.id===A.id&&(D=!0);D||(T=[A]),this.beingDraggedNodes=T,this.beingDraggedActiveUri=S;const I=T.find(O=>!a.Directory.is(O));if(I&&y.dataTransfer.setData("uri",I.uri.toString()),y.dataTransfer.setData("beingDraggedNodes",JSON.stringify(this.beingDraggedNodes.map(O=>O.uri.toString()))),I){const O=I;O.uri.scheme==="file"&&y.dataTransfer.setData("DownloadURL",`application/octet-stream:${O.displayName}:data:application/octet-stream;base64,${(0,p.encodeBase64)(p.BinaryBuffer.fromString(O.filestat.uri))}`)}if(T.forEach(O=>{this.beingDraggedDec.addTarget(O,c.TargetMatchMode.Self)}),y.dataTransfer){let O;T.length===1?O=S?S.displayName:typeof A.name=="string"?A.name:"":O=String(T.length);const M=document.createElement("div");M.className=u.default.file_tree_drag_image,M.textContent=O,document.body.appendChild(M),y.dataTransfer.setDragImage(M,-10,-10),setTimeout(()=>document.body.removeChild(M),0)}},this.handleDragEnter=(y,A)=>{y.stopPropagation(),y.preventDefault()},this.handleDragLeave=(y,A)=>{y.preventDefault(),y.stopPropagation(),this.toCancelNodeExpansion.dispose(),this.potentialParent&&(this.draggedOverDec.removeTarget(this.potentialParent),this.model.treeModel.dispatchChange())},this.handleDragOver=(y,A)=>{if(y.preventDefault(),y.stopPropagation(),!this.toCancelNodeExpansion.disposed||this.beingDraggedNodes.indexOf(A)>=0)return;this.draggedOverNode=A;const S=a.Directory.is(A)&&A.expanded?A:A.parent;(this.potentialParent!==S||!this.draggedOverDec.hasTarget(S))&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=S,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren),this.model.treeModel.dispatchChange()),this.potentialParent!==A&&a.Directory.is(A)&&(this.dragOverTrigger.trigger(async()=>{A.expanded?(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren)):(await A.setExpanded(!0),this.draggedOverNode===A&&(this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.potentialParent=A,this.draggedOverDec.addTarget(this.potentialParent,c.TargetMatchMode.SelfAndChildren))),this.model.treeModel.dispatchChange()}),this.toCancelNodeExpansion.push(p.Disposable.create(()=>{this.dragOverTrigger.isTriggered()||this.dragOverTrigger.cancel()})))},this.handleDrop=async(y,A,S)=>{var w,T;this.eventBus.fire(new v.FileTreeDropEvent({event:y.nativeEvent,targetDir:S?S.codeUri.path:A&&A instanceof a.File?(w=A.parent)===null||w===void 0?void 0:w.uri.codeUri.path:A?A.uri.codeUri.path:new p.URI((T=this.workspaceService.workspace)===null||T===void 0?void 0:T.uri).codeUri.path}));try{y.preventDefault(),y.stopPropagation(),y.dataTransfer.dropEffect="copy";let D;const I=!!this.beingDraggedActiveUri;this.fileTreeService.isCompactMode&&S&&!A?.uri.isEqual(S)?D=null:A?D=a.Directory.is(A)?A:A.parent:D=this.root;let O;if(this.beingDraggedActiveUri){const M=this.fileTreeService.getNodeByPathOrUri(this.beingDraggedActiveUri);O=[new a.Directory(this.fileTreeService,M?.parent,this.beingDraggedActiveUri,this.beingDraggedActiveUri.displayName,{uri:this.beingDraggedActiveUri.toString(),isDirectory:!0,lastModification:new Date().getTime()},this.beingDraggedActiveUri.displayName)]}else if(O=this.beingDraggedNodes,!O||O.length===0)try{const M=JSON.parse(y.dataTransfer.getData("beingDraggedNodes"));M&&M.length!==0&&(O=M.map(R=>this.fileTreeService.getNodeByPathOrUri(new p.URI(R))).filter(Boolean),O.length||(O=await Promise.all(M.map(async R=>{const P=new p.URI(R);let k;const F=await this.filesystem.getFileStat(P.toString());return F?.isDirectory?k=new a.Directory(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName):k=new a.File(this.fileTreeService,this.root,P,P.displayName,{uri:P.toString(),isDirectory:!0,lastModification:new Date().getTime()},P.displayName),k}))))}catch{}if(O.length>0){const M=S||D&&D.uri,R=O.filter(P=>P&&P.parent&&(this.beingDraggedActiveUri?!P.parent.uri.isEqual(M):!0));if(R.length>0){const P=await this.fileTreeAPI.mvFiles(R.map(k=>({url:k.uri,isDirectory:k.filestat.isDirectory})),M);if(P&&P.length>0)P.forEach(k=>{this.messageService.error(k)});else if(P){if(D)if(this.fileTreeService.isCompactMode&&I){for(const k of R)this.fileTreeService.refresh(k.parent);this.fileTreeService.refresh(D)}else for(const k of R){const F=D.uri.resolve(k.name);this.fileTreeService.moveNodeByPath(k.parent,D,k.name,k.name,k.type),k.updateMetaData({name:F.displayName,fileStat:{...k.filestat,uri:F.toString()},uri:F,tooltip:this.fileTreeAPI.getReadableTooltip(F)}),a.Directory.is(k)&&this.fileTreeService.refresh(k)}else if(A){if(this.fileTreeService.isCompactMode&&I)for(const k of R)this.fileTreeService.refresh(k.parent);else for(const k of R)this.fileTreeService.deleteAffectedNodeByPath(k.path);this.fileTreeService.refresh(A.parent)}}else return}}A&&this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(M=>{this.beingDraggedDec.removeTarget(M)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()}catch(D){this.logger.error(D)}},this.handleDragEnd=(y,A)=>{this.beingDraggedDec.removeTarget(A),this.potentialParent&&this.draggedOverDec.removeTarget(this.potentialParent),this.beingDraggedNodes.forEach(S=>{this.beingDraggedDec.removeTarget(S)}),this.beingDraggedNodes=[],this.beingDraggedActiveUri=void 0,this.potentialParent=null,this.model.treeModel.dispatchChange(),this.toCancelNodeExpansion.disposed||this.toCancelNodeExpansion.dispose()},this.model.decorations.addDecoration(this.beingDraggedDec),this.model.decorations.addDecoration(this.draggedOverDec)}get root(){return this.model.treeModel.root}};t.DragAndDropService=f,f.MS_TILL_DRAGGED_OVER_EXPANDS=500,r.__decorate([(0,o.Autowired)(g.IFileTreeAPI),r.__metadata("design:type",Object)],f.prototype,"fileTreeAPI",void 0),r.__decorate([(0,o.Autowired)(p.ILogger),r.__metadata("design:type",Object)],f.prototype,"logger",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],f.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(g.IFileTreeService),r.__metadata("design:type",d.FileTreeService)],f.prototype,"fileTreeService",void 0),r.__decorate([(0,o.Autowired)(m.IFileServiceClient),r.__metadata("design:type",Object)],f.prototype,"filesystem",void 0),r.__decorate([(0,o.Autowired)(s.IWorkspaceService),r.__metadata("design:type",Object)],f.prototype,"workspaceService",void 0),t.DragAndDropService=f=n=r.__decorate([(0,o.Injectable)(),r.__param(0,(0,o.Optional)()),r.__metadata("design:paramtypes",[E.FileTreeModelService])],f)},97738:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileTreeModelService=void 0;const r=e(85608),o=e(76003),c=e(97267),p=e(41869),v=e(91830),m=e(93899),_=e(26542),s=e(54414),g=e(14951),a=e(63067),h=e(53576),u=e(72665),d=e(6250),E=e(69959),f=e(2812),l=e(46377),b=r.__importDefault(e(89200)),y=e(57781),A=e(30577),{Path:S,isValidBasename:w}=p.path,{coalesce:T}=p.arrays,{trim:D,rtrim:I}=p.strings;let O=n=class{constructor(){this._isDisposed=!1,this._whenReady=new p.Deferred,this.selectedDecoration=new c.Decoration(b.default.mod_selected),this.focusedDecoration=new c.Decoration(b.default.mod_focused),this.contextMenuDecoration=new c.Decoration(b.default.mod_actived),this.loadingDecoration=new c.Decoration(b.default.mod_loading),this.cutDecoration=new c.Decoration(b.default.mod_cut),this._selectedFiles=[],this.disposableCollection=new p.DisposableCollection,this._isMultiSelected=!1,this.refreshedActionDelayer=new p.ThrottledDelayer(n.DEFAULT_REFRESHED_ACTION_DELAY),this.labelChangedDelayer=new p.ThrottledDelayer(n.DEFAULT_LABEL_CHANGED_DELAY),this.locationThrottler=new p.Throttler,this.onDidFocusedFileChangeEmitter=new p.Emitter,this.onDidContextMenuFileChangeEmitter=new p.Emitter,this.onDidSelectedFileChangeEmitter=new p.Emitter,this.onFileTreeModelChangeEmitter=new p.Emitter,this._initTreeModelReady=!1,this.clearFileSelectedDecoration=()=>{this.selectedDecoration.clearAppliedTarget(),this._selectedFiles=[]},this.activeFileDecoration=(R,P=!0)=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),R&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(R),this.focusedDecoration.addTarget(R),this.focusedFile=R,this.selectedFiles=[R],P&&this.treeModel.dispatchChange())},this.selectFileDecoration=(R,P=!0)=>{R!==this.treeModel.root&&(this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),R&&(this.selectedFiles.length>0&&this.selectedDecoration.clearAppliedTarget(),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.selectedDecoration.addTarget(R),this._selectedFiles=[R],P&&this.treeModel.dispatchChange()))},this.activateFileActivedDecoration=R=>{this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuDecoration.addTarget(R),this.contextMenuFile=R,this.treeModel.dispatchChange()},this.activateFileFocusedDecoration=R=>{this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile&&(this.contextMenuDecoration.clearAppliedTarget(),this.contextMenuFile=void 0),this.focusedDecoration.addTarget(R),this.focusedFile=R,this.treeModel.dispatchChange()},this.activeFileFocusedDecoration=(R,P=!1)=>{R!==this.treeModel.root&&(this.focusedFile!==R&&(P?(this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.contextMenuFile=R):this.focusedFile&&(this.contextMenuFile=void 0,this.focusedDecoration.clearAppliedTarget()),R&&(this._selectedFiles.indexOf(R)<0&&(this.selectedDecoration.addTarget(R),this._selectedFiles.push(R),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri))),this.focusedDecoration.addTarget(R),this.focusedFile=R)),this.treeModel.dispatchChange())},this.toggleFileSelectedDecoration=R=>{const P=this._selectedFiles.indexOf(R);P>-1?(this.focusedFile===R&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this._selectedFiles.splice(P,1),this.selectedDecoration.clearAppliedTarget()):(this._selectedFiles.push(R),this.selectedDecoration.addTarget(R),this.focusedFile&&this.focusedDecoration.clearAppliedTarget(),this.focusedFile=R,this.focusedDecoration.addTarget(R)),this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.activeFileDecorationByRange=(R,P)=>{for(this.clearFileSelectedDecoration(),this.contextMenuFile=void 0;R<=P;R++){const k=this.treeModel.root.getTreeNodeAtIndex(R);k&&(this._selectedFiles.push(k),this.selectedDecoration.addTarget(k))}this.onDidSelectedFileChangeEmitter.fire(this._selectedFiles.map(k=>k.uri)),this.treeModel.dispatchChange()},this.deactivateFileDecoration=()=>{var R;this.focusedFile&&(this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0),this.contextMenuFile&&this.contextMenuDecoration.removeTarget(this.contextMenuFile),(R=this.treeModel)===null||R===void 0||R.dispatchChange()},this.toggleDirectory=async R=>{R.expanded?this.fileTreeHandle.collapseNode(R):this.fileTreeHandle.expandNode(R)},this.handleDblClick=()=>{this.commandService.executeCommand(p.FILE_COMMANDS.NEW_FILE.id)},this.handleContextMenu=(R,P,k)=>{var F;R.stopPropagation(),R.preventDefault();let L,B;P?(B=P,this._isMultiSelected?this.selectedFiles.indexOf(B)>=0?L=this.selectedFiles:L=[B]:L=[B]):(L=[this.treeModel.root],B=this.treeModel.root),this.activateFileActivedDecoration(B),this.setFileTreeContextKey(B),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null);const j=this.contextMenuService.createMenu({id:m.MenuId.ExplorerContext,contextKeyService:this.fileTreeService.contextMenuContextKeyService}),W=j.getMergedMenuNodes();j.dispose(),this.updateExplorerCompressedContextKey(B,k);const{x:U,y:Q}=R.nativeEvent;this.ctxMenuRenderer.show({anchor:{x:U,y:Q},menuNodes:W,args:k?[k,[k]]:[B.uri,L.map(V=>V.uri)]})},this.handleTreeBlur=()=>{var R,P,k;this._isDisposed||((P=(R=this.contextKey)===null||R===void 0?void 0:R.filesExplorerFocused)===null||P===void 0||P.set(!1),this.deactivateFileDecoration(),(k=this.contextKey)===null||k===void 0||k.explorerResourceIsFolder.set(!1))},this.handleTreeFocus=()=>{var R,P;(P=(R=this.contextKey)===null||R===void 0?void 0:R.filesExplorerFocused)===null||P===void 0||P.set(!0)},this.handleItemRangeClick=(R,P)=>{if(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),!this.focusedFile)this.handleItemClick(R,P);else if(this.focusedFile&&this.focusedFile!==R){this._isMultiSelected=!0;const k=this.treeModel.root.getIndexAtTreeNode(R),F=this.treeModel.root.getIndexAtTreeNode(this.focusedFile);F>k?this.activeFileDecorationByRange(k,F):F<k&&this.activeFileDecorationByRange(F,k)}},this.handleItemToggleClick=(R,P)=>{this._isMultiSelected=!0,!(P!==c.TreeNodeType.CompositeTreeNode&&P!==c.TreeNodeType.TreeNode)&&(this.selectedFiles.length===1&&E.Directory.isRoot(this.selectedFiles[0])&&this.clearFileSelectedDecoration(),this.toggleFileSelectedDecoration(R))},this.handleItemClick=(R,P=this.fileTreeService.isMultipleWorkspace?c.TreeNodeType.TreeNode:c.TreeNodeType.CompositeTreeNode,k)=>{var F,L,B,j;if(this.treeModel&&(R||(R=this.treeModel.root),this.updateExplorerCompressedContextKey(R,k),this._isMultiSelected=!1,(P===c.TreeNodeType.CompositeTreeNode||P===c.TreeNodeType.TreeNode)&&this.activeFileDecoration(R),this.fileTreeService.isCompactMode&&k?(this._activeUri=k,(F=this.contextKey)===null||F===void 0||F.explorerResourceIsFolder.set(!0)):k||(this._activeUri=null,(L=this.contextKey)===null||L===void 0||L.explorerResourceIsFolder.set(P===c.TreeNodeType.CompositeTreeNode)),this.corePreferences["workbench.list.openMode"]==="singleClick")){if(P===c.TreeNodeType.CompositeTreeNode){if((B=this.contextKey)===null||B===void 0||B.explorerResourceIsFolder.set(!0),R===this.treeModel.root)return;this.toggleDirectory(R)}else if(P===c.TreeNodeType.TreeNode){if((j=this.contextKey)===null||j===void 0||j.explorerResourceIsFolder.set(!1),R===this.treeModel.root)return;this.fileTreeService.openFile(R.uri),this.mainlayoutService.bottomExpanded&&this.commandService.executeCommand(h.RETRACT_BOTTOM_PANEL.id)}}},this.handleItemDoubleClick=(R,P)=>{P===c.TreeNodeType.TreeNode?this.fileTreeService.openAndFixedFile(R.uri):this.corePreferences["workbench.list.openMode"]==="doubleClick"&&this.toggleDirectory(R)},this.validateFileName=(R,P)=>{var k;if(P=this.getWellFormedFileName(P),!P||P.length===0||/^\s+$/.test(P))return{message:(0,p.localize)("validate.tree.emptyFileNameError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]==="/"||P[0]==="\\")return{message:(0,p.localize)("validate.tree.fileNameStartsWithSlashError"),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P};if(P[0]===" "||P[P.length-1]===" ")return{message:(0,p.localize)("validate.tree.fileNameFollowOrStartWithSpaceWarning"),type:c.PROMPT_VALIDATE_TYPE.WARNING,value:P};let F;if(R.target){const B=R.target;if(P===B.name)return null;F=B.parent}else F=R.parent;return F&&!(R instanceof c.RenamePromptHandle&&R.target.displayName.indexOf(S.separator)>0)&&((k=F.children)===null||k===void 0?void 0:k.find(W=>W.name===P))?{message:(0,p.formatLocalize)("validate.tree.fileNameExistsError",P),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:T(P.split(/[\\/]/)).some(B=>!w(B))?{message:(0,p.formatLocalize)("validate.tree.invalidFileNameError",this.trimLongName(P)),type:c.PROMPT_VALIDATE_TYPE.ERROR,value:P}:null},this.proxyPrompt=R=>{let P=!1;const k=async V=>{const $=await this.fileTreeService.getNodeByPathOrUri(V);$&&(E.Directory.is($)?this.selectFileDecoration($):this.location($.uri))},F=async V=>{var $,Y,H;if(this.validateMessage=void 0,R instanceof c.RenamePromptHandle){const z=R.target,K=R.target.displayName.split(S.separator),Z=z.name.indexOf(S.separator)>0;if(Z&&this.activeUri&&!R.target.uri.toString().includes(this.activeUri.toString()))return!1;const X=this.activeUri?K.length-R.target.uri.toString().replace(this.activeUri.toString(),"").split(S.separator).length:-1,ie=X===-1?[]:K.slice(0,X).concat(V);let oe=z.uri,le=z.parent.uri.resolve(V);if(Z&&(($=this.activeUri)===null||$===void 0?void 0:$.displayName)===V||!Z&&V===z.name)return!0;R.addAddonAfter("loading_indicator"),Z&&ie.length>0&&E.Directory.is(z.parent)&&(oe=z.parent.uri.resolve(K.slice(0,X+1).join(S.separator)),le=z.parent.uri.resolve(ie.concat().join(S.separator)));const pe=await this.fileTreeAPI.mv(oe,le,z.type===c.TreeNodeType.CompositeTreeNode);if(pe)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:pe,value:V},this.fileTreeService.updateRefreshable(!0),R.addValidateMessage(this.validateMessage),!1;if(this.fileTreeService.updateRefreshable(!1),R.removeAddonAfter(),!Z&&z.parent){const q=await this.fileTreeService.moveNodeByPath(z.parent,z.parent,z.name,V,z.type);q&&this.selectFileDecoration(q,!1),this.fileTreeService.updateRefreshable(!0)}else if(E.Directory.is(z)&&!E.Directory.isRoot(z)){z.updateMetaData({name:ie.concat(K.slice(X+1)).join(S.separator),uri:le,fileStat:{...z.filestat,uri:le.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(le)}),this.treeModel.dispatchChange();let q;E.Directory.is(z.parent)&&(!((Y=z.parent.children)===null||Y===void 0)&&Y.find(Ee=>z.path.indexOf(Ee.path)>=0))?q=this.fileTreeService.refresh(z.parent):q=this.fileTreeService.refresh(z),q.then(()=>{k(le)})}R.removeAddonAfter()}else if(R instanceof c.NewPromptHandle){const z=R.parent,K=z.uri.resolve(V);let Z;if(R.addAddonAfter("loading_indicator"),this.fileTreeService.updateRefreshable(!0),R.type===c.TreeNodeType.CompositeTreeNode?Z=await this.fileTreeAPI.createDirectory(K):Z=await this.fileTreeAPI.createFile(K),R.removeAddonAfter(),Z)return this.validateMessage={type:c.PROMPT_VALIDATE_TYPE.ERROR,message:Z,value:V},this.fileTreeService.updateRefreshable(!1),R.addValidateMessage(this.validateMessage),!1;if(V.includes(S.separator)&&this.fileTreeService.refresh(z).then(()=>{k(z.uri.resolve(V))}),this.fileTreeService.isCompactMode)if(R.type===c.TreeNodeType.CompositeTreeNode)if((!z.children||z.children.length===0)&&!E.Directory.isRoot(z)){const ie=z.uri.resolve(V),oe=[z.name].concat(V).join(S.separator);z.updateMetaData({name:oe,uri:ie,fileStat:{...z.filestat,uri:ie.toString()},tooltip:this.fileTreeAPI.getReadableTooltip(ie)}),k(ie)}else await this.fileTreeService.addNode(z,V,R.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,R.type),k(z.uri.resolve(V));else await this.fileTreeService.addNode(z,V,R.type),k(z.uri.resolve(V))}return(H=this.contextKey)===null||H===void 0||H.filesExplorerInputFocused.set(!1),!0},L=async V=>{var $,Y,H,z;if(this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;if(P)return!1;if(!V){($=this.contextKey)===null||$===void 0||$.explorerCompressedFocusContext.set(!1),(Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFirstFocusContext.set(!1),(H=this.contextKey)===null||H===void 0||H.explorerCompressedLastFocusContext.set(!1),this.fileTreeService.isCompactMode&&R instanceof c.NewPromptHandle&&this.fileTreeService.refresh(R.parent);return}return(z=this.contextKey)===null||z===void 0||z.filesExplorerInputFocused.set(!1),await F(V),!0},B=async V=>{if(P=!0,this.validateMessage&&this.validateMessage.type===c.PROMPT_VALIDATE_TYPE.ERROR)return!1;if(V.trim()===""||this.validateMessage&&this.validateMessage.type!==c.PROMPT_VALIDATE_TYPE.ERROR)return this.validateMessage=void 0,!0;const $=await F(V);return P=!1,!!$},j=async()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!0)},W=()=>{var V;this.fileTreeService.updateRefreshable(!0),(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.contextMenuFile&&this.selectFileDecoration(this.contextMenuFile,!0)},U=()=>{var V;(V=this.contextKey)===null||V===void 0||V.filesExplorerInputFocused.set(!1),this.fileTreeService.isCompactMode&&R instanceof c.NewPromptHandle&&this.fileTreeService.refresh(R.parent)},Q=V=>{const $=this.validateFileName(R,V);$?(this.validateMessage=$,R.addValidateMessage($)):!$&&this.validateMessage&&this.validateMessage.value!==V&&(this.validateMessage=void 0,R.removeValidateMessage())};R.destroyed||(this.fileTreeService.updateRefreshable(!1),R.onChange(Q),R.onCommit(B),R.onBlur(L),R.onFocus(j),R.onDestroy(W),R.onCancel(U))},this.copyFile=async R=>{var P;this.pasteStore&&this.pasteStore.type===d.PasteTypes.CUT&&(this._pasteStore.files.forEach(F=>{F&&this.cutDecoration.removeTarget(F)}),(P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!1)),this.treeModel.dispatchChange();const k=[];for(const F of R){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.COPY},this.clipboardService.writeResources(R)},this.pasteFile=async R=>{var P,k;let F=!1,L=this.fileTreeService.getNodeByPathOrUri(R.toString());if(!L)return;let B=this.pasteStore,j=!1;if(!B){const W=await this.clipboardService.readResources();if(!W||!W.length)return;B={files:[],type:d.PasteTypes.COPY,crossFiles:W},j=!0}if(B){if(E.Directory.is(L)||(F=!0,L=L.parent),j){const W=(0,p.localize)("file.confirm.paste.ok"),U=(0,p.localize)("file.confirm.paste.cancel");if(await this.dialogService.warning((0,p.formatLocalize)("file.confirm.paste",`[ ${(P=B.crossFiles)===null||P===void 0?void 0:P.map(V=>V.displayName).join(",")} ]`,E.Directory.isRoot(L)?L.uri.displayName:L.displayName),[U,W])!==W)return}if(B.type===d.PasteTypes.CUT){for(const U of B.files)U&&this.cutDecoration.removeTarget(U),L.expanded||await L.setExpanded(!0);const W=await this.fileTreeAPI.mvFiles(B.crossFiles?B.crossFiles.map(U=>{var Q;return{url:U,isDirectory:((Q=this.fileTreeService.getNodeByPathOrUri(U))===null||Q===void 0?void 0:Q.filestat.isDirectory)||!1}}):B.files.map(U=>({url:U.uri,isDirectory:U.filestat.isDirectory})),L.uri);W&&W.length>0&&(W.forEach(U=>{this.messageService.error(U)}),this.fileTreeService.refresh()),(k=this.contextKey)===null||k===void 0||k.explorerResourceCut.set(!1),this.treeModel.dispatchChange(),this._pasteStore={files:[],type:d.PasteTypes.NONE,crossFiles:void 0}}else if(B.type===d.PasteTypes.COPY){const W=B.crossFiles?B.crossFiles:B.files.map(U=>U.uri);for(const U of W){L.uri.isEqual(U)&&!F&&(L=L.parent);const Q=L.uri.resolve(U.displayName);L.expanded||await L.setExpanded(!0);const V=await this.fileTreeAPI.copyFile(U,Q);if(V)if(V.uri){const $=new p.URI(V.uri),Y=await this.filesystem.getFileStat(U.toString());this.fileTreeService.addNode(L,$.displayName,Y?.isDirectory?c.TreeNodeType.CompositeTreeNode:c.TreeNodeType.TreeNode)}else this.messageService.error(`Error when copy file: ${U.toString()}, ${V}`)}}}},this.cutFile=async R=>{var P;R.length>0&&((P=this.contextKey)===null||P===void 0||P.explorerResourceCut.set(!0)),this._pasteStore&&this._pasteStore.type===d.PasteTypes.CUT&&this._pasteStore.files.forEach(F=>{this.cutDecoration.removeTarget(F)});const k=[];for(const F of R){const L=this.fileTreeService.getNodeByPathOrUri(F);L&&k.push(L)}this._pasteStore={files:k,type:d.PasteTypes.CUT};for(const F of k)F&&this.cutDecoration.addTarget(F);this.treeModel.dispatchChange()},this.location=async R=>{if(await this.whenReady,!this.fileTreeService.filterMode)return this._fileToLocation=R,this.locationThrottler.queue(this.doLocation)},this.doLocation=async()=>{if(!this._fileToLocation)return;const R=this._fileToLocation;let P;if(typeof R=="string"?P=R:P=await this.fileTreeService.getFileTreeNodePathByUri(R),P){if(!this.fileTreeHandle)return;const k=await this.fileTreeHandle.ensureVisible(P,"center",!0);k&&this.selectFileDecoration(k)}this._fileToLocation=void 0},this.locationOnShow=R=>{this._nextLocationTarget=R},this.performLocationOnHandleShow=async()=>{this._nextLocationTarget&&(await this.location(this._nextLocationTarget),this._nextLocationTarget=void 0)}}get onDidFocusedFileChange(){return this.onDidFocusedFileChangeEmitter.event}get onDidContextMenuFileChange(){return this.onDidContextMenuFileChangeEmitter.event}get onDidSelectedFileChange(){return this.onDidSelectedFileChangeEmitter.event}get onFileTreeModelChange(){return this.onFileTreeModelChangeEmitter.event}get fileTreeHandle(){return this._fileTreeHandle}get decorations(){return this._decorations}get treeModel(){return this._treeModel}get dndService(){return this._dndService}get whenReady(){return this._whenReady.promise}get focusedFile(){return this._focusedFile}set focusedFile(R){this.onDidFocusedFileChangeEmitter.fire(R?R.uri:void 0),this._focusedFile=R}get contextMenuFile(){return this._contextMenuFile}set contextMenuFile(R){this.onDidContextMenuFileChangeEmitter.fire(R?R.uri:void 0),this._contextMenuFile=R}get selectedFiles(){return this._selectedFiles}set selectedFiles(R){this.onDidSelectedFileChangeEmitter.fire(R?R.map(P=>P.uri):[]),this._selectedFiles=R}get activeUri(){return this._activeUri}get pasteStore(){return this._pasteStore}get explorerStorage(){return this._explorerStorage}get currentRelativeUriContextKey(){return this._currentRelativeUriContextKey||(this._currentRelativeUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextRelativeUri","")),this._currentRelativeUriContextKey}get currentContextUriContextKey(){return this._currentContextUriContextKey||(this._currentContextUriContextKey=this.fileTreeService.contextMenuContextKeyService.createKey("filetreeContextUri","")),this._currentContextUriContextKey}get contextMenuResourceContext(){return this._contextMenuResourceContext||(this._contextMenuResourceContext=new v.ResourceContextKey(this.fileTreeService.contextMenuContextKeyService)),this._contextMenuResourceContext}get contextKey(){return this.fileTreeService.contextKey}get initTreeModelReady(){return this._initTreeModelReady}async initTreeModel(){this._initTreeModelReady=!1;const R=(await this.fileTreeService.resolveChildren())[0];if(!R){this._whenReady.resolve();return}this._treeModel=this.injector.get(f.FileTreeModel,[R]),this.initDecorations(R),this._dndService=this.injector.get(A.DragAndDropService,[this]),this.treeStateWatcher=this._treeModel.getTreeStateWatcher(!0),this.disposableCollection.push(this.fileTreeService.onNodeRefreshed(()=>{this.initTreeModelReady&&(this.refreshedActionDelayer.isTriggered()||this.refreshedActionDelayer.cancel(),this.refreshedActionDelayer.trigger(async()=>{if(this.selectedFiles.length===0){const k=this.editorService.currentEditor;k&&k.currentUri&&this.location(k.currentUri)}this.fileTreeService.isCompactMode||(this._activeUri=null)}))})),this.disposableCollection.push(this.fileTreeService.onWorkspaceChange(()=>{this.disposableCollection.dispose(),this.initTreeModel()})),this.disposableCollection.push(this.labelService.onDidChange(async()=>{this.initTreeModelReady&&(this.labelChangedDelayer.isTriggered()||this.labelChangedDelayer.cancel(),this.labelChangedDelayer.trigger(async()=>{this.fileTreeService.refresh()}))})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.WillResolveChildren,k=>{this.loadingDecoration.addTarget(k),this.treeModel.dispatchChange()})),this.disposableCollection.push(this.treeModel.root.watcher.on(c.TreeNodeEvent.DidResolveChildren,k=>{this.loadingDecoration.clearAppliedTarget(),this.treeModel.dispatchChange()})),this._explorerStorage=await this.storageProvider(p.STORAGE_NAMESPACE.EXPLORER);const P=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);P&&await this.loadFileTreeSnapshot(P),this.disposableCollection.push(this.treeStateWatcher.onDidChange(()=>{if(!this._initTreeModelReady)return;const k=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),F=this.treeStateWatcher.snapshot();this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...k,...F})})),this.fileTreeService.startWatchFileEvent(),this.onFileTreeModelChangeEmitter.fire(this._treeModel),this._whenReady.resolve(),this._initTreeModelReady=!0}initDecorations(R){this._decorations=new c.DecorationsManager(R),this._decorations.addDecoration(this.selectedDecoration),this._decorations.addDecoration(this.focusedDecoration),this._decorations.addDecoration(this.contextMenuDecoration),this._decorations.addDecoration(this.cutDecoration),this._decorations.addDecoration(this.loadingDecoration)}setFileTreeContextKey(R){var P;this.currentContextUriContextKey.set(R.uri.toString()),this.currentRelativeUriContextKey.set((this.treeModel.root.uri.relative(R.uri)||"").toString()),this.contextMenuResourceContext.set(R.uri),(P=this.contextKey)===null||P===void 0||P.explorerResourceIsFolder.set(R&&R.type===c.TreeNodeType.CompositeTreeNode)}async loadFileTreeSnapshot(R){await this._treeModel.loadTreeState(R)}updateExplorerCompressedContextKey(R,P){var k,F,L,B,j,W,U,Q,V,$,Y,H,z,K,Z,X;if(R&&P){(k=this.contextKey)===null||k===void 0||k.explorerCompressedFocusContext.set(!0);const ie=new S(R.name);ie.name===P.displayName?((F=this.contextKey)===null||F===void 0||F.explorerCompressedLastFocusContext.set(!0),(L=this.contextKey)===null||L===void 0||L.explorerCompressedFirstFocusContext.set(!1)):ie.root&&ie.root.name===P.displayName?((B=this.contextKey)===null||B===void 0||B.explorerCompressedLastFocusContext.set(!1),(j=this.contextKey)===null||j===void 0||j.explorerCompressedFirstFocusContext.set(!0)):((W=this.contextKey)===null||W===void 0||W.explorerCompressedLastFocusContext.set(!1),(U=this.contextKey)===null||U===void 0||U.explorerCompressedFirstFocusContext.set(!1))}else R?R.name.indexOf(S.separator)>0?((Q=this.contextKey)===null||Q===void 0||Q.explorerCompressedFocusContext.set(!0),(V=this.contextKey)===null||V===void 0||V.explorerCompressedFirstFocusContext.set(!1),($=this.contextKey)===null||$===void 0||$.explorerCompressedLastFocusContext.set(!0)):((Y=this.contextKey)===null||Y===void 0||Y.explorerCompressedFocusContext.set(!1),(H=this.contextKey)===null||H===void 0||H.explorerCompressedFirstFocusContext.set(!1),(z=this.contextKey)===null||z===void 0||z.explorerCompressedLastFocusContext.set(!1)):((K=this.contextKey)===null||K===void 0||K.explorerCompressedFocusContext.set(!1),(Z=this.contextKey)===null||Z===void 0||Z.explorerCompressedFirstFocusContext.set(!1),(X=this.contextKey)===null||X===void 0||X.explorerCompressedLastFocusContext.set(!1))}handleTreeHandler(R){this._fileTreeHandle=R}toggleOrOpenCurrentFile(){let R;this.focusedFile?R=this.focusedFile:this.contextMenuFile&&(R=this.contextMenuFile),R&&(this.activeFileDecoration(R),E.Directory.is(R)?this.toggleDirectory(R):this.fileTreeService.openFile(R.uri))}moveToNext(){let R;if(this.focusedFile?R=this.focusedFile:this.contextMenuFile&&(R=this.contextMenuFile),!R)return;const k=this.treeModel.root.getIndexAtTreeNode(R)+1,F=this.treeModel.root.getTreeNodeAtIndex(k),L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=(k+1)*l.FILE_TREE_NODE_HEIGHT-(L.scrollPosition||0),{height:j}=this.fileTreeHandle.getCurrentSize();F&&(this.activateFileFocusedDecoration(F),B>j&&this.fileTreeHandle.ensureVisible(F,"end"))}moveToPrev(){let R;if(this.focusedFile?R=this.focusedFile:this.contextMenuFile&&(R=this.contextMenuFile),!R)return;const P=this.treeModel.root.getIndexAtTreeNode(R);if(P===0)return;const k=P-1,F=this.treeModel.root.getTreeNodeAtIndex(k);if(!F)return;const L=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY),B=k*l.FILE_TREE_NODE_HEIGHT;this.activateFileFocusedDecoration(F),(L.scrollPosition||0)>B&&this.fileTreeHandle.ensureVisible(F,"start")}async collapseCurrentFile(){let R;this.focusedFile?(R=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(R=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(R);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(R));let k;if(E.Directory.is(R)&&R.expanded)k=R;else if(R)E.Directory.isRoot(R.parent)?k=R:k=R.parent;else return;this.focusedFile=k,k&&k.expanded&&(await this.fileTreeHandle.collapseNode(k),this.activeFileFocusedDecoration(k,!0))}async expandCurrentFile(){let R;this.focusedFile?(R=this.focusedFile,this.focusedDecoration.clearAppliedTarget(),this.focusedFile=void 0):this.contextMenuFile&&(R=this.contextMenuFile,this.focusedDecoration.removeTarget(this.contextMenuFile),this.contextMenuFile=void 0);const P=this.selectedFiles.indexOf(R);P>=0&&(this.selectedFiles.splice(P,1),this.selectedDecoration.removeTarget(R)),this.focusedFile=R,E.Directory.is(R)&&(R.expanded||await this.fileTreeHandle.expandNode(R))}async collapseAll(){await this.treeModel.root.collapsedAll();const R=this.explorerStorage.get(n.FILE_TREE_SNAPSHOT_KEY);R&&this.explorerStorage.set(n.FILE_TREE_SNAPSHOT_KEY,{...R,expandedDirectories:{atSurface:[],buried:[]}})}async deleteFileByUris(R){var P;if(R.length===0)return;if(this.corePreferences["explorer.confirmDelete"]){const B=this.applicationService.backendOS===p.OperatingSystem.Linux,j=B?(0,p.localize)("file.confirm.delete.ok"):(0,p.localize)("file.confirm.moveToTrash.ok"),W=(0,p.localize)("file.confirm.delete.cancel"),U=10;let Q=R.slice(0,U).map($=>$.displayName).join(`
|
|
31634
31632
|
`);if(R.length>U&&(Q+=`
|
|
31635
31633
|
...`),B||(Q+=`
|
|
31636
31634
|
|
|
@@ -31994,7 +31992,7 @@ ${(0,o.formatLocalize)("terminal.integrated.exitedWithCode",h)}`),!((u=this.pres
|
|
|
31994
31992
|
`)}warn(d){this._validationStatus.state=2,this._outputChannel.append(d+`
|
|
31995
31993
|
`)}error(d){this._validationStatus.state=3,this._outputChannel.append(d+`
|
|
31996
31994
|
`)}fatal(d){this._validationStatus.state=4,this._outputChannel.append(d+`
|
|
31997
|
-
`)}get status(){return this._validationStatus}}let h=class extends o.Disposable{constructor(){super(),this._onDidStateChange=new c.Emitter,this.onDidStateChange=this._onDidStateChange.event,this._onDidRegisterTaskProvider=new c.Emitter,this.onDidRegisterTaskProvider=this._onDidRegisterTaskProvider.event,this.providerHandler=0,this.runningTasks=new Map,this.toQuickOpenItem=d=>{var E;return new o.QuickOpenItem({label:d._label||"",detail:d instanceof _.ContributedTask?`${d.command.name||""} ${d.command.args?(E=d.command.args)===null||E===void 0?void 0:E.join(" "):""}`:void 0,run:f=>f===o.Mode.OPEN?(this.runTask(d),!0):!1})},this.providers=new Map,this.providerTypes=new Map,this.addDispose([this.taskSystem.onDidStateChange(d=>this._onDidStateChange.fire(d)),this.taskSystem.onDidBackgroundTaskBegin(d=>this._onDidStateChange.fire(d)),this.taskSystem.onDidBackgroundTaskEnded(d=>this._onDidStateChange.fire(d)),this.taskSystem.onDidProblemMatched(d=>this._onDidStateChange.fire(d))])}get outputChannel(){return this._outputChannel||(this._outputChannel=this.outputService.getChannel((0,o.localize)("task.outputchannel.name"))),this._outputChannel}get workspaceFolders(){return this._workspaceFolders||this.tryGetWorkspaceFolders(),this._workspaceFolders}tryGetWorkspaceFolders(){this._workspaceFolders=this.workspaceService.tryGetRoots().map(d=>o.Uri.parse(d.uri))}async runTaskCommand(){const d=await this.getGroupedTasks(),E=await this.getWorkspaceTasks(d),[f,l]=this.combineQuickItems(d,E);this.quickOpenService.open({onType:(b,y)=>y([...f,...l])},{placeholder:(0,o.formatLocalize)("TaskService.pickRunTask")})}run(d){return this.runTask(d)}async attach(d,E){if(this.runningTasks.has(d))return;const[,,,f]=d.split(",");if(f)if(this.providerTypes.has(f)){const l=await this.getTask(this.workspaceFolders[0],d);l&&(this.taskSystem.attach(l,E),this.runningTasks.set(d,l))}else{const l=this._onDidRegisterTaskProvider.event(async b=>{if(b===f){const y=await this.getTask(this.workspaceFolders[0],d);y&&(this.taskSystem.attach(y,E),this.runningTasks.set(d,y),l.dispose())}})}}async terminateTask(d){const E=this.taskSystem.getActiveTasks();for(const f of E)f._id===d&&await this.taskSystem.terminate(f)}getTask(d,E,f=!1){const l=(0,o.isString)(E)?E:this.taskDefinitionRegistry.createTaskIdentifier(E,console);return l===void 0?Promise.resolve(void 0):this.getWorkspaceGroupedTasks(d).then(b=>{if(!b)return Promise.resolve(void 0);const y=b.get(d.toString());if(!y)return Promise.resolve(void 0);for(const A of y)if(A.matches(l,f)||A._id===E||A._label===E)return A})}async runTask(d){const E=await this.taskSystem.run(d);return E.promise.then(f=>{this.runningTasks.has(d._id)&&this.runningTasks.delete(d._id),this.outputChannel.appendLine(`Task ${d._label} done, exit code ${f.exitCode}`)}),this.runningTasks.set(d._id,d),Promise.resolve(E.promise)}async tasks(d){var E;const f=await this.getWorkspaceGroupedTasks(),l=[];for(const b of f.values())for(const y of b)d&&d.type&&((E=y.getDefinition())===null||E===void 0?void 0:E.type)===d.type&&l.push(y);return l}async getWorkspaceGroupedTasks(d=this.workspaceFolders[0]){const E=await this.getGroupedTasks(),f=await this.getWorkspaceTasks(E),l=[];for(const A of E)A.tasks&&A.tasks.length>0&&l.push(...A.tasks);const b=f?.get(d.toString());b&&b.set&&l.push(...b.set.tasks);const y=new Map;return y.set(d.toString(),l),y}async getGroupedTasks(){const d={};for(const f of this.taskDefinitionRegistry.all())d[f.taskType]=!0;d.shell=!0,d.process=!0;const E=[];for(const[,f]of this.providers){const l=await f.provideTasks(d);E.push(l)}return E}toQuickOpenGroupItem(d,E,f){return new o.QuickOpenItem({groupLabel:d?(0,o.formatLocalize)("task.contribute"):void 0,run:E,showBorder:d,label:f,value:{type:f,grouped:!0},iconClass:(0,o.getIcon)("folder")})}combineQuickItems(d,E){var f,l;const b=[],y=[];let A=!0;for(const S of d){const w=D=>D===o.Mode.OPEN?(this.quickOpenService.open({onType:(I,O)=>S.tasks.length===0?O([new o.QuickOpenItem({value:"none",label:(0,o.formatLocalize)("task.cannotFindTask",S.type),run:M=>M===o.Mode.OPEN})]):O(S.tasks.map(this.toQuickOpenItem))}),!1):!0,T=this.toQuickOpenGroupItem(A,w,S.type);b.push(T),A=!1}if(E){for(const S of E.values())if(!((f=S.configurations)===null||f===void 0)&&f.byIdentifier&&Object.keys((l=S.configurations)===null||l===void 0?void 0:l.byIdentifier).forEach(w=>{var T;const D=(T=S.configurations)===null||T===void 0?void 0:T.byIdentifier[w];y.push(this.toQuickOpenItem(D))}),S.set&&S.set.tasks.length>0)for(const w of S.set.tasks)y.push(this.toQuickOpenItem(w))}return[y,b]}async getWorkspaceTasks(d){return this.updateWorkspaceTasks(d)}updateWorkspaceTasks(d){return this.workspaceFolders.length===0?Promise.resolve(new Map):this.workspaceFolders.length===1?this.computeWorkspaceFolderTasks(this.workspaceFolders[0],d).then(E=>{const f=new Map;return f.set(this.workspaceFolders[0].toString(),E),f}):Promise.resolve(void 0)}computeWorkspaceFolderTasks(d,E){return new Promise(async f=>{const l=this.preferences.get("tasks"),b=new Map;for(const y of E)for(const A of y.tasks)_.ContributedTask.is(A)&&b.set(A.defines._key,A);if(l&&l.tasks){let y;const A=[];let S=!1;const w=new a(this.outputChannel),T=(0,g.parse)({uri:d,name:d.path,index:0},c.platform,l,w,this.taskDefinitionRegistry,this.problemMatcher,this.problemPattern);if(T.validationStatus.isOK()||(S=!0,this.showOutput()),T.configured&&T.configured.length>0){y={byIdentifier:Object.create(null)};for(const D of T.configured)y.byIdentifier[D.configures._key]=D}A.push(...T.custom),y&&y.byIdentifier&&Object.keys(y.byIdentifier).forEach(D=>{if(b.has(D)){const I=(0,g.createCustomTask)(b.get(D),y.byIdentifier[D]);y.byIdentifier[D]=I}}),f({workspaceFolder:{uri:d,name:d.path,index:0},set:{tasks:A},configurations:y,hasErrors:S})}else f({workspaceFolder:{uri:d,name:d.path,index:0},set:{tasks:[]},configurations:{byIdentifier:{}},hasErrors:!1})})}showOutput(){this.outputChannel.appendLine("There are task errors. See the output for details.")}rerunLastTask(){return this.taskSystem.rerun()}registerTaskProvider(d,E){const f=this.providerHandler+=1;return this.providers.set(f,d),this.providerTypes.set(E,f),this._onDidRegisterTaskProvider.fire(E),{dispose:()=>{this.providers.delete(f),this.providerTypes.delete(E)}}}};t.TaskService=h,n.__decorate([(0,r.Autowired)(p.OutputService),n.__metadata("design:type",p.OutputService)],h.prototype,"outputService",void 0),n.__decorate([(0,r.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],h.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(o.QuickOpenService),n.__metadata("design:type",Object)],h.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],h.prototype,"preferences",void 0),n.__decorate([(0,r.Autowired)(m.ITaskSystem),n.__metadata("design:type",Object)],h.prototype,"taskSystem",void 0),n.__decorate([(0,r.Autowired)(c.ITaskDefinitionRegistry),n.__metadata("design:type",Object)],h.prototype,"taskDefinitionRegistry",void 0),n.__decorate([(0,r.Autowired)(c.IProblemMatcherRegistry),n.__metadata("design:type",Object)],h.prototype,"problemMatcher",void 0),n.__decorate([(0,r.Autowired)(c.IProblemPatternRegistry),n.__metadata("design:type",Object)],h.prototype,"problemPattern",void 0),t.TaskService=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},66893:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalTaskSystem=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(80907),p=e(1041),v=e(12968),m=e(95268),{deepClone:_}=o.objects,{Path:s}=o.path;let g=class extends o.Disposable{constructor(){super(...arguments),this.executorId=0,this.activeTaskExecutors=new Map,this._onDidStateChange=new o.Emitter,this._onDidBackgroundTaskBegin=new o.Emitter,this._onDidBackgroundTaskEnded=new o.Emitter,this._onDidProblemMatched=new o.Emitter,this.taskExecutors=[],this.onDidStateChange=this._onDidStateChange.event,this.onDidBackgroundTaskBegin=this._onDidBackgroundTaskBegin.event,this.onDidBackgroundTaskEnded=this._onDidBackgroundTaskEnded.event,this.onDidProblemMatched=this._onDidProblemMatched.event}run(h){return this.currentTask=h,this.executeTask(h)}attach(h,u){return this.currentTask=h,this.attachTask(h,u)}async buildShellConfig(h){let u="";const d=h.name,E=h.args,f=[],l=[];if(d&&(typeof d=="string"?u=d:u=d.value),f.push(u),E)for(const b of E)typeof b=="string"?f.push(b):f.push(b.value);for(const b of f)b.indexOf(s.separator)>-1?l.push(await this.resolveVariables(b.split(s.separator))):l.push(await this.resolveVariable(b));return{args:["-c",`${l.join(" ")}`]}}findAvailableExecutor(){return this.taskExecutors.find(h=>h.taskStatus===m.TaskStatus.PROCESS_EXITED)}async createTaskExecutor(h,u){const d=await this.resolveMatchers(h.configurationProperties.problemMatchers),E=new v.ProblemCollector(d),f=this.injector.get(m.TerminalTaskExecutor,[h,u,E,this.executorId]);return this.executorId+=1,this.taskExecutors.push(f),this.addDispose(f.onDidTerminalWidgetRemove(()=>{this.taskExecutors=this.taskExecutors.filter(l=>l.executorId!==f.executorId)})),f}async attachTask(h,u){const E=(await this.createTaskExecutor(h,u.launchConfig)).attach(u);return this.lastTask=h,{task:h,kind:1,promise:E}}async executeTask(h){var u,d,E;const f=h.command&&h.command.runtime===p.RuntimeType.CustomExecution,l=await this.resolveMatchers(h.configurationProperties.problemMatchers),b=new v.ProblemCollector(l),{args:y}=await this.buildShellConfig(h.command),A={name:this.createTerminalName(h),args:y,isExtensionOwnedTerminal:f,env:((u=h.command.options)===null||u===void 0?void 0:u.env)||{},cwd:!((d=h.command.options)===null||d===void 0)&&d.cwd?await this.resolveVariable((E=h.command.options)===null||E===void 0?void 0:E.cwd):await this.resolveVariable("${workspaceFolder}"),disablePreserveHistory:!0};let S=this.findAvailableExecutor(),w=!1;S?(w=!0,S.updateProblemCollector(b),S.updateLaunchConfig(A),S.reset()):S=await this.createTaskExecutor(h,A),w?this._onDidStateChange.fire(p.TaskEvent.create("start",h,S.terminalId)):this.addDispose(S.onDidTerminalCreated(I=>{this._onDidStateChange.fire(p.TaskEvent.create("start",h,I))})),w||(this.addDispose(S.onDidTaskProcessExit(I=>{this._onDidStateChange.fire(p.TaskEvent.create("processEnded",h,I)),this._onDidStateChange.fire(p.TaskEvent.create("end",h))})),this.addDispose(S.onDidBackgroundTaskBegin(()=>this._onDidBackgroundTaskBegin.fire(p.TaskEvent.create("backgroundTaskBegin",h)))),this.addDispose(S.onDidBackgroundTaskEnd(()=>this._onDidBackgroundTaskEnded.fire(p.TaskEvent.create("backgroundTaskEnded",h)))),this.addDispose(S.onDidProblemMatched(I=>this._onDidProblemMatched.fire(p.TaskEvent.create("problemMatched",h,I)))));const T=S.execute(h,w),D=h.getMapKey();return this.activeTaskExecutors.set(D,{promise:Promise.resolve(T),task:h,executor:S}),this._onDidStateChange.fire(p.TaskEvent.create("active",h)),await S.processReady.promise,this._onDidStateChange.fire(p.TaskEvent.create("processStarted",h,S.processId)),this.lastTask=h,{task:h,kind:1,promise:T}}createTerminalName(h){return(0,o.formatLocalize)("TerminalTaskSystem.terminalName",h.getQualifiedLabel()||h.configurationProperties.name)}async resolveVariables(h){const u=[];for(const d of h)u.push(await this.resolveVariable(d));return u.join(s.separator)}async resolveVariable(h){if((0,o.isString)(h))return await this.variableResolver.resolve(h);if(h!==void 0)return{value:await this.variableResolver.resolve(h.value),quoting:h.quoting};throw new Error("Should never try to resolve undefined.")}async resolveMatchers(h){if(h==null||h.length===0)return[];const u=[];for(const d of h){let E;if((0,o.isString)(d)?d[0].startsWith("$")?E=this.problemMatcher.get(d.substring(1)):E=this.problemMatcher.get(d):E=d,!E)continue;const f=E.filePrefix!==void 0;if(!f)u.push(E);else{const l=_(E);f&&(l.filePrefix=await this.resolveVariable(l.filePrefix)),u.push(l)}}return u}getActiveTasks(){return Array.from(this.activeTaskExecutors.values()).map(h=>h.task)}async terminate(h){const u=h.getMapKey(),d=this.activeTaskExecutors.get(u);if(!d)return Promise.resolve({task:void 0,success:!0});const{success:E}=await d.executor.terminate();return this.activeTaskExecutors.delete(u),{task:h,success:E}}async rerun(){return this.lastTask&&await this.executeTask(this.lastTask)}isActive(){throw new Error("Method not implemented.")}isActiveSync(){throw new Error("Method not implemented.")}getBusyTasks(){throw new Error("Method not implemented.")}canAutoTerminate(){throw new Error("Method not implemented.")}terminateAll(){throw new Error("Method not implemented.")}revealTask(h){throw new Error("Method not implemented.")}customExecutionComplete(h,u){throw new Error("Method not implemented.")}};t.TerminalTaskSystem=g,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],g.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(o.IProblemMatcherRegistry),n.__metadata("design:type",Object)],g.prototype,"problemMatcher",void 0),n.__decorate([(0,r.Autowired)(c.IVariableResolverService),n.__metadata("design:type",Object)],g.prototype,"variableResolver",void 0),t.TerminalTaskSystem=g=n.__decorate([(0,r.Injectable)()],g)},93950:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ITaskSystem=t.ITaskExecutor=t.ITaskService=void 0,t.ITaskService=Symbol("ITaskService"),t.ITaskExecutor=Symbol("ITaskExecutor"),t.ITaskSystem=Symbol("ITaskSystem")},1041:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskEvent=t.TaskSorter=t.ExecutionEngine=t.InMemoryTask=t.ContributedTask=t.ConfiguringTask=t.CustomTask=t.CommonTask=t.RunOptions=t.RunOnOptions=t.TaskSourceKind=t.TaskGroup=t.CommandString=t.RuntimeType=t.PresentationOptions=t.PanelKind=t.RevealProblemKind=t.RevealKind=t.CommandOptions=t.CUSTOMIZED_TASK_TYPE=t.ShellQuoting=t.TASK_RUNNING_STATE=void 0;const n=e(40191),r=e(43718),{basename:o}=r.path;t.TASK_RUNNING_STATE=new n.RawContextKey("taskRunning",!1);var c;(function(D){D[D.Escape=1]="Escape",D[D.Strong=2]="Strong",D[D.Weak=3]="Weak"})(c||(t.ShellQuoting=c={})),t.CUSTOMIZED_TASK_TYPE="$customized",function(D){function I(O){if(!O)return D.Strong;switch(O.toLowerCase()){case"escape":return D.Escape;case"strong":return D.Strong;case"weak":return D.Weak;default:return D.Strong}}D.from=I}(c||(t.ShellQuoting=c={}));var p;(function(D){D.defaults={cwd:"${workspaceFolder}"}})(p||(t.CommandOptions=p={}));var v;(function(D){D[D.Always=1]="Always",D[D.Silent=2]="Silent",D[D.Never=3]="Never"})(v||(t.RevealKind=v={})),function(D){function I(O){switch(O.toLowerCase()){case"always":return D.Always;case"silent":return D.Silent;case"never":return D.Never;default:return D.Always}}D.fromString=I}(v||(t.RevealKind=v={}));var m;(function(D){D[D.Never=1]="Never",D[D.OnProblem=2]="OnProblem",D[D.Always=3]="Always"})(m||(t.RevealProblemKind=m={})),function(D){function I(O){switch(O.toLowerCase()){case"always":return D.Always;case"never":return D.Never;case"onproblem":return D.OnProblem;default:return D.OnProblem}}D.fromString=I}(m||(t.RevealProblemKind=m={}));var _;(function(D){D[D.Shared=1]="Shared",D[D.Dedicated=2]="Dedicated",D[D.New=3]="New"})(_||(t.PanelKind=_={})),function(D){function I(O){switch(O.toLowerCase()){case"shared":return D.Shared;case"dedicated":return D.Dedicated;case"new":return D.New;default:return D.Shared}}D.fromString=I}(_||(t.PanelKind=_={}));var s;(function(D){D.defaults={echo:!0,reveal:v.Always,revealProblems:m.Never,focus:!1,panel:_.Shared,showReuseMessage:!0,clear:!1}})(s||(t.PresentationOptions=s={}));var g;(function(D){D[D.Shell=1]="Shell",D[D.Process=2]="Process",D[D.CustomExecution=3]="CustomExecution",D[D.CustomExecution2=4]="CustomExecution2"})(g||(t.RuntimeType=g={})),function(D){function I(O){switch(O.toLowerCase()){case"shell":return D.Shell;case"process":return D.Process;case"customExecution":return D.CustomExecution;default:return D.Process}}D.fromString=I}(g||(t.RuntimeType=g={}));var a;(function(D){function I(O){return(0,r.isString)(O)?O:O.value}D.value=I})(a||(t.CommandString=a={}));var h;(function(D){D.Clean={_id:"clean",isDefault:!1},D.Build={_id:"build",isDefault:!1},D.Rebuild={_id:"rebuild",isDefault:!1},D.Test={_id:"test",isDefault:!1};function I(M){return M===D.Clean._id||M===D.Build._id||M===D.Rebuild._id||M===D.Test._id}D.is=I;function O(M){if(M!==void 0)return(0,r.isString)(M)?I(M)?{_id:M,isDefault:!1}:void 0:M}D.from=O})(h||(t.TaskGroup=h={}));var u;(function(D){D.Workspace="workspace",D.Extension="extension",D.InMemory="inMemory",D.WorkspaceFile="workspaceFile",D.User="user"})(u||(t.TaskSourceKind=u={}));var d;(function(D){D[D.default=1]="default",D[D.folderOpen=2]="folderOpen"})(d||(t.RunOnOptions=d={}));var E;(function(D){D.defaults={reevaluateOnRerun:!0,runOn:d.default}})(E||(t.RunOptions=E={}));class f{constructor(I,O,M,R,P,k){this._label="",this._id=I,O&&(this._label=O),M&&(this.type=M),this.runOptions=R,this.configurationProperties=P,this._source=k}getDefinition(I){}getMapKey(){return this._id}getRecentlyUsedKey(){}clone(){return this.fromObject(Object.assign({},this))}getWorkspaceFolder(){}getWorkspaceFileName(){}getTelemetryKind(){return"unknown"}matches(I,O=!1){if(I===void 0)return!1;if((0,r.isString)(I))return I===this._label||I===this.configurationProperties.identifier||O&&I===this._id;const M=this.getDefinition(!0);return M!==void 0&&M._key===I._key}getQualifiedLabel(){const I=this.getWorkspaceFolder();return I?`${this._label} (${I.name})`:this._label}getTaskExecution(){return{id:this._id,task:this}}addTaskLoadMessages(I){this._taskLoadMessages===void 0&&(this._taskLoadMessages=[]),I&&(this._taskLoadMessages=this._taskLoadMessages.concat(I))}get taskLoadMessages(){return this._taskLoadMessages}}t.CommonTask=f;class l extends f{constructor(I,O,M,R,P,k,F,L){super(I,M,void 0,F,L,O),this.command={},this._source=O,this.hasDefinedMatchers=k,P&&(this.command=P)}customizes(){if(this._source&&this._source.customizes)return this._source.customizes}getDefinition(I=!1){if(I&&this._source.customizes!==void 0)return this._source.customizes;{let O;switch(this.command?this.command.runtime:void 0){case g.Shell:O="shell";break;case g.Process:O="process";break;case g.CustomExecution:O="customExecution";break;case void 0:O="$composite";break;default:throw new Error("Unexpected task runtime")}return{type:O,_key:this._id,id:this._id}}}static is(I){return I instanceof l}getMapKey(){const I=this._source.config.workspaceFolder;return I?`${I.uri.toString()}|${this._id}`:this._id}getRecentlyUsedKey(){const I=this._source.config.workspaceFolder;if(!I)return;let O=this.configurationProperties.identifier;this._source.kind!==u.Workspace&&(O+=this._source.kind);const M={type:t.CUSTOMIZED_TASK_TYPE,folder:I.uri.toString(),id:O};return JSON.stringify(M)}getWorkspaceFolder(){return this._source.config.workspaceFolder}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?o(this._source.config.workspace.configuration.toString()):void 0}getTelemetryKind(){return this._source.customizes?"workspace>extension":"workspace"}fromObject(I){return new l(I._id,I._source,I._label,I.type,I.command,I.hasDefinedMatchers,I.runOptions,I.configurationProperties)}}t.CustomTask=l;class b extends f{constructor(I,O,M,R,P,k,F){super(I,M,R,k,F,O),this._source=O,this.configures=P}static is(I){return I instanceof b}fromObject(I){return I}getDefinition(){return this.configures}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?o(this._source.config.workspace.configuration.toString()):void 0}}t.ConfiguringTask=b;class y extends f{constructor(I,O,M,R,P,k,F,L,B){super(I,M,R,L,B,O),this.defines=P,this.hasDefinedMatchers=F,this.command=k}getDefinition(){return this.defines}static is(I){return I instanceof y}getMapKey(){const I=this._source.workspaceFolder;return I?`${this._source.scope.toString()}|${I.uri.toString()}|${this._id}`:`${this._source.scope.toString()}|${this._id}`}getRecentlyUsedKey(){const I={type:"contributed",scope:this._source.scope,id:this._id};return this._source.scope===3&&this._source.workspaceFolder&&(I.folder=this._source.workspaceFolder.uri.toString()),JSON.stringify(I)}getWorkspaceFolder(){return this._source.workspaceFolder}getTelemetryKind(){return"extension"}fromObject(I){return new y(I._id,I._source,I._label,I.type,I.defines,I.command,I.hasDefinedMatchers,I.runOptions,I.configurationProperties)}}t.ContributedTask=y;class A extends f{constructor(I,O,M,R,P,k){super(I,M,R,P,k,O),this._source=O}static is(I){return I instanceof A}getTelemetryKind(){return"composite"}fromObject(I){return new A(I._id,I._source,I._label,I.type,I.runOptions,I.configurationProperties)}}t.InMemoryTask=A;var S;(function(D){D[D.Process=1]="Process",D[D.Terminal=2]="Terminal"})(S||(t.ExecutionEngine=S={})),function(D){D._default=D.Terminal}(S||(t.ExecutionEngine=S={}));class w{constructor(I){this._order=new Map;for(let O=0;O<I.length;O++)this._order.set(I[O].uri.toString(),O)}compare(I,O){const M=I.getWorkspaceFolder(),R=O.getWorkspaceFolder();if(M&&R){let P=this._order.get(M.uri.toString());P=P===void 0?0:P+1;let k=this._order.get(R.uri.toString());return k=k===void 0?0:k+1,P===k?I._label.localeCompare(O._label):P-k}else return!M&&R?-1:M&&!R?1:0}}t.TaskSorter=w;var T;(function(D){function I(O,M,R){if(M){const P={kind:O,taskId:M._id,taskName:M.configurationProperties.name,runType:M.configurationProperties.isBackground?"background":"singleRun",group:M.configurationProperties.group,processId:void 0,exitCode:void 0,terminalId:void 0,__task:M};return O==="start"?P.terminalId=R:O==="processStarted"?P.processId=R:O==="processEnded"?P.exitCode=R:O==="problemMatched"&&(P.problems=R),Object.freeze(P)}else return Object.freeze({kind:"changed"})}D.create=I})(T||(t.TaskEvent=T={}))},90305:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(14041)),o=n.__importDefault(e(75655));let c=0,p=null;t.default=v=>{const{start:m,stop:_,self:s,left:g,right:a,wholeWidth:h,last:u}=v,d=l=>{c=l.clientX,p=s,m()},E=l=>{if(!c)return!1;const b=l.clientX,y=(b-c)/h*100;c=b,y<0?(s&&s.increase(y),a&&a.increase(-y)):p&&p===g&&(s&&s.increase(-y),g&&g.increase(y))},f=l=>{c=0,p=null,s.resize(),g&&g.resize(),a&&a.resize(),_()};return r.default.createElement("div",{className:o.default.resizeDelegetContainer,onMouseUp:f,onMouseMove:E},!u&&r.default.createElement("div",{className:o.default.resizeDelegateBar,onMouseDown:d,onMouseUp:f}))}},92699:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeDirection=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(41869),p=e(7473),v=n.__importDefault(e(90305)),m=n.__importDefault(e(75655));var _;(function(a){a[a.vertical=0]="vertical",a[a.horizontal=1]="horizontal"})(_||(t.ResizeDirection=_={}));const s=({index:a,widget:h,wholeWidth:u,setEvent:d,self:E,left:f,right:l,last:b})=>{const y=(0,c.useAutorun)(h.shadowDynamic);return o.default.createElement("div",{key:`resize-item-${a}`,style:{width:`${y}%`},className:m.default.resizeHandler},o.default.createElement(v.default,{wholeWidth:u,start:()=>d(!0),stop:()=>d(!1),self:E,left:f,right:l,last:b}))},g=({widget:a,dynamic:h,draw:u,handleRemoveWidget:d,widgetsLength:E})=>{const f=(0,c.useAutorun)(h);return o.default.createElement("div",{key:a.id,style:{width:`${f}%`},className:m.default.resizeItem},u(a),E>1&&o.default.createElement("div",{className:(0,r.default)(m.default.closeBtn,(0,c.getIcon)("close")),onClick:()=>{d(a.id)}}))};t.default=a=>{const{group:h,shadow:u}=a,d=(0,c.useAutorun)(h.widgets),[E,f]=o.default.useState(!1),[l,b]=o.default.useState(1/0),y=(0,c.useInjectable)(p.ITerminalGroupViewService),A=o.default.useRef(null);o.default.useEffect(()=>{A.current&&A.current.clientHeight!==l&&b(A.current.clientWidth)});const S=o.default.useCallback(w=>{y.removeWidget(w)},[]);return o.default.createElement("div",{className:m.default.resizeWrapper,ref:A},o.default.createElement("div",{style:{pointerEvents:E?"all":"none"},className:m.default.resizeDelegate},d&&d.map((w,T)=>{const D=T-1>-1?d[T-1]:null,I=d[T],O=T+1<d.length?d[T+1]:null;return o.default.createElement(s,{key:T,index:T,widget:w,wholeWidth:l,setEvent:f,self:I,left:D,right:O,last:T===d.length-1})})),o.default.createElement("div",{style:{pointerEvents:E?"none":"all"},className:m.default.resizePanel},d&&d.map(w=>o.default.createElement(g,{key:w.id,widget:w,dynamic:u?w.dynamic:w.shadowDynamic,draw:a.draw,handleRemoveWidget:S,widgetsLength:d.length}))))}},70483:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalSearch=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(26405),m=n.__importDefault(e(50587));t.TerminalSearch=o.default.memo(_=>{const s=(0,p.useInjectable)(v.ITerminalSearchService),[g,a]=o.default.useState(s.UIState),[h,u]=o.default.useState(null),[d,E]=o.default.useState(s.text||""),f=o.default.useRef(null);o.default.useEffect(()=>{const I=s.onVisibleChange(O=>{O&&f.current&&(f.current.focus(),f.current.value.length>0&&f.current.setSelectionRange(0,f.current.value.length))});return()=>I.dispose()},[s]),o.default.useEffect(()=>{if(!s.onResultChange)return;const I=s.onResultChange(O=>{u(O)});return()=>I.dispose()},[s]);const l=o.default.useCallback(I=>{s.text=I.target.value,s.search(),E(I.target.value)},[s]),b=o.default.useCallback(I=>{I.key==="Enter"&&s.search(),I.key==="Escape"&&(s.close(),s.clear())},[s]),y=o.default.useCallback(()=>{s.updateUIState({isMatchCase:!g.isMatchCase}),a(s.UIState)},[s,g]),A=o.default.useCallback(()=>{s.updateUIState({isUseRegexp:!g.isUseRegexp}),a(s.UIState)},[s,g]),S=o.default.useCallback(()=>{s.updateUIState({isWholeWord:!g.isWholeWord}),a(s.UIState)},[s,g]),w=o.default.useCallback(()=>{s.searchNext()},[s]),T=o.default.useCallback(()=>{s.searchPrevious()},[s]),D=o.default.useCallback(()=>{s.close()},[s]);return o.default.createElement("div",{className:m.default.terminalSearch},o.default.createElement(c.ValidateInput,{className:m.default.searchField,autoFocus:!0,id:"search-input-field",title:(0,p.localize)("search.input.placeholder"),type:"text",value:d,placeholder:(0,p.localize)("common.find"),onKeyDown:b,onChange:l,ref:f,validateMessage:void 0,addonAfter:[o.default.createElement("span",{key:(0,p.localize)("search.caseDescription"),className:(0,r.default)((0,p.getIcon)("ab"),m.default["match-case"],m.default.optionBtn,{[m.default.select]:g.isMatchCase}),title:(0,p.localize)("search.caseDescription"),onClick:y}),o.default.createElement("span",{key:(0,p.localize)("search.wordsDescription"),className:(0,r.default)((0,p.getIcon)("abl"),m.default["whole-word"],m.default.optionBtn,{[m.default.select]:g.isWholeWord}),title:(0,p.localize)("search.wordsDescription"),onClick:S}),o.default.createElement("span",{key:(0,p.localize)("search.regexDescription"),className:(0,r.default)((0,p.getIcon)("regex"),m.default["use-regexp"],m.default.optionBtn,{[m.default.select]:g.isUseRegexp}),title:(0,p.localize)("search.regexDescription"),onClick:A})]}),o.default.createElement("div",{className:m.default.searchResult},h?`${h.resultIndex+1}/${h.resultCount}`:"0/0"),o.default.createElement("div",{className:(0,r.default)(m.default.panelBtn,(0,p.getIcon)("up")),onClick:T}),o.default.createElement("div",{className:(0,r.default)(m.default.panelBtn,(0,p.getIcon)("down")),onClick:w}),o.default.createElement("div",{className:(0,r.default)(m.default.panelBtn,(0,p.getIcon)("close")),onClick:D}))})},65586:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderAddItem=t.renderInfoItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(12784)),c=n.__importStar(e(14041)),p=e(80564),v=e(41869),m=e(89897),_=e(1149),s=e(7443),g=e(26405),a=n.__importDefault(e(99886)),h=d=>{var E,f,l,b;const y=(0,v.useInjectable)(s.IconService),A=(0,o.default)(()=>d.onClick&&d.onClick(),20),S=(0,o.default)(()=>d.onClose&&d.onClose(),20),w=(0,v.useDesignStyles)(a.default.item_container,"item_container"),T=(0,v.useDesignStyles)(a.default.tab_item_selected,"tab_item_selected"),D=(0,v.useDesignStyles)(a.default.item_info_name,"item_info_name"),I=(0,v.useDesignStyles)(a.default.tab_close_icon,"tab_close_icon"),O=(0,v.useInjectable)(_.LayoutViewSizeConfig),M=(0,c.useRef)(null),{group:R}=d;if(!R)return null;const{options:P,id:k}=R,F=(0,v.useAutorun)(R.editable),L=(0,v.useAutorun)(R.snapshot),B=(0,c.useCallback)($=>{$.key==="Enter"&&d.onInputEnter&&k&&d.onInputEnter(k,$.target.value)},[k,d.onInputEnter]);(0,c.useEffect)(()=>{var $;d.selected&&(($=M.current)===null||$===void 0||$.scrollIntoView())},[M,d.selected]);let j;P?.icon&&(!((E=P.icon)===null||E===void 0)&&E.id?j=y.fromString(`$(${(f=P.icon)===null||f===void 0?void 0:f.id})`):P.icon instanceof v.URI?j=y.fromIcon(P?.icon.toString()):(!((l=P.icon)===null||l===void 0)&&l.light||!((b=P?.icon)===null||b===void 0)&&b.dark)&&(j=d.theme==="light"?y.fromIcon(P.icon.light.toString()):y.fromIcon(P.icon.dark.toString())));const W=(0,c.useCallback)($=>{var Y;(Y=d.onDragStart)===null||Y===void 0||Y.call(d,$)},[d.onDragStart]),U=(0,c.useCallback)($=>{$.preventDefault(),M.current&&M.current.classList.add("on-drag-over")},[M]),Q=(0,c.useCallback)(()=>{M.current&&M.current.classList.remove("on-drag-over")},[M]),V=(0,c.useCallback)($=>{var Y;M.current&&M.current.classList.remove("on-drag-over"),(Y=d.onDrop)===null||Y===void 0||Y.call(d,$)},[M,d.onDrop]);return c.default.createElement("div",{draggable:d.draggable,onDragStart:W,onDragOver:U,onDragLeave:Q,onDrop:V,ref:M,className:(0,r.default)({[w]:!0,[T]:!!d.selected}),style:{height:O.panelTitleBarHeight},onClick:()=>A(),onContextMenu:$=>d.onContextMenu&&d.onContextMenu($)},F?c.default.createElement("input",{autoFocus:!0,ref:$=>$&&$.select(),className:a.default.item_info_input,defaultValue:L,onClick:$=>$.stopPropagation(),onBlur:()=>d.onInputBlur&&R.id&&d.onInputBlur(R.id),onKeyDown:$=>B($)}):c.default.createElement("div",{id:R.id,className:D,title:L},L!==""?c.default.createElement(c.default.Fragment,null,c.default.createElement(p.Icon,{iconClass:j||(0,v.getIcon)(L?.toLowerCase()||"terminal")||(0,v.getIcon)("terminal"),style:{marginRight:4,color:"inherit",fontSize:14}}),c.default.createElement("span",{className:a.default.item_title},L)):c.default.createElement(m.Loading,null)),F?c.default.createElement("div",null):c.default.createElement("div",{className:(0,r.default)([(0,v.getIcon)("close"),I]),onClick:$=>{$.stopPropagation(),S()}}))};t.renderInfoItem=h;const u=d=>{const E=(0,o.default)(()=>d.onClick&&d.onClick(),20),f=d.getKeybinding&&d.getKeybinding(v.TERMINAL_COMMANDS.ADD.id),l=f?`${(0,v.localize)("terminal.new")}(${f})`:(0,v.localize)("terminal.new"),b=(0,v.useDesignStyles)(a.default.tab_item_wrapper,"tab_item_wrapper");return c.default.createElement("div",{className:b},c.default.createElement("div",{title:l,className:(0,r.default)({[(0,v.getIcon)("plus")]:!0,[a.default.item_add]:!0}),onClick:()=>E()}),c.default.createElement("div",{title:(0,v.localize)("terminal.new.type"),className:(0,r.default)({[(0,v.getIcon)("down")]:!0,[a.default.item_more]:!0}),onClick:d.onDropdown}))};t.renderAddItem=u,t.default=d=>{switch(d.type||g.ItemType.info){case g.ItemType.info:return(0,c.createElement)(d.provider.infoItemRender,d);case g.ItemType.add:return(0,c.createElement)(d.provider.addItemRender,d);default:return null}}},17632:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(52416),v=e(26405),m=e(88023),_=n.__importDefault(e(65586)),s=n.__importDefault(e(99886));t.default=()=>{const g=(0,c.useInjectable)(v.ITerminalGroupViewService),a=(0,c.useInjectable)(v.ITerminalRenderProvider),h=(0,c.useInjectable)(m.TerminalContextMenuService),u=(0,c.useInjectable)(p.IThemeService),d=(0,c.useInjectable)(c.KeybindingRegistry),E=(0,r.useRef)(),[f,l]=(0,r.useState)("dark"),b=(0,c.useDesignStyles)(s.default.tab_contents,"tab_contents"),y=(0,c.useAutorun)(g.groups),A=(0,c.useAutorun)(g.currentGroup),S=(0,r.useCallback)(()=>(u.getCurrentTheme().then(w=>{l(w.type)}),u.onThemeChange(w=>{l(w.type)})),[f,u]);return(0,r.useEffect)(()=>{const w=S();return()=>{w.dispose()}},[]),r.default.createElement("div",{className:s.default.view_container},r.default.createElement("div",{className:s.default.tabs},r.default.createElement(o.Scrollbars,{forwardedRef:w=>w?E.current=w.ref:null},r.default.createElement("div",{className:b},y.filter(Boolean).map((w,T)=>r.default.createElement(_.default,{draggable:!0,onDragStart:D=>{D.dataTransfer.setData("groupIndex",String(T))},onDrop:D=>{if(D.preventDefault(),D.dataTransfer.getData("groupIndex")){const I=D.dataTransfer.getData("groupIndex");g.swapGroup(Number(I),T),g.selectGroup(T)}},key:w.id,group:w,selected:A&&A.id===w.id,onInputBlur:()=>w.unedit(),onInputEnter:(D,I)=>w.rename(I),onClick:()=>g.selectGroup(T),onClose:()=>g.removeGroup(T),onContextMenu:D=>h.onTabContextMenu(D,T),provider:a,theme:f})),r.default.createElement("div",{className:s.default.button},r.default.createElement(_.default,{type:v.ItemType.add,onClick:()=>{const w=g.createGroup(),T=g.getGroup(w);g.createWidget(T),g.selectGroup(w)},getKeybinding:w=>{const T=d.getKeybindingsForCommand(w);return Array.isArray(T)&&T[0]&&d.acceleratorFor(T[0],"")[0]||""},onDropdown:w=>h.onDropDownContextMenu(w),provider:a,theme:f}))))))}},7066:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalVariable=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(43718),c=e(94620),p=n.__importDefault(e(74599));function v(_,s){_.forEach((g,a)=>{g.forEach(h=>{s.add((0,c.mutatorTypeLabel)(h.type,h.value,a))})})}const m=({diff:_})=>{const s=r.default.useMemo(()=>{const a=new Set;return _?.added&&_?.added.size>0&&v(_.added,a),_?.changed&&_.changed.size>0&&v(_.changed,a),Array.from(a.values())},[_]),g=r.default.useMemo(()=>{if(!_?.removed||_?.removed.size===0)return[];const a=new Set;return v(_.removed,a),Array.from(a.values())},[_]);return r.default.createElement("div",{className:p.default.variable_container},s.length>0&&r.default.createElement(r.default.Fragment,null,r.default.createElement("h3",null,(0,o.localize)("terminal.environment.changes")),s.map((a,h)=>r.default.createElement("p",{key:a+h,className:p.default.variable_change},a))),g.length>0&&r.default.createElement(r.default.Fragment,null,r.default.createElement("h3",null,(0,o.localize)("terminal.environment.removal")),g.map((a,h)=>r.default.createElement("p",{key:a+h,className:p.default.variable_change},a))))};t.TerminalVariable=m},48139:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(12784)),o=n.__importDefault(e(14041)),c=e(41869),p=e(26405),v=n.__importStar(e(92699)),m=e(70483),_=n.__importDefault(e(73567)),s=n.__importDefault(e(76970));e(86650),t.default=()=>{const g=(0,c.useInjectable)(p.ITerminalController),a=(0,c.useInjectable)(p.ITerminalSearchService),h=(0,c.useInjectable)(p.ITerminalErrorService),u=(0,c.useInjectable)(p.ITerminalNetwork),d=o.default.useRef(null),E=(0,c.useInjectable)(p.ITerminalGroupViewService),f=(0,c.useAutorun)(E.currentGroupId),l=(0,c.useAutorun)(E.currentGroupIndex),b=(0,c.useAutorun)(E.groups),[y,A]=o.default.useState(g.themeBackground);(0,c.useEventEffect)(g.onThemeBackgroundChange,M=>{A(M)});const[S,w]=o.default.useState(h.errors),T=(0,r.default)(()=>{w(h.errors)},c.FRAME_THREE);(0,c.useEventEffect)(h.onErrorsChange,T);const D=o.default.useCallback((M,R)=>{const P=g.findClientFromWidgetId(M.id);let k;return P?k=u.shouldReconnect(P.id)?void 0:S.get(P.id):k=S.get(M.id),o.default.createElement(s.default,{show:l===R,error:k,widget:M})},[l,g,S,u,E]),[I,O]=o.default.useState(a.isVisible);return(0,c.useEventEffect)(a.onVisibleChange,M=>{O(M)}),o.default.useEffect(()=>{d.current&&(g.initContextKey(d.current),g.viewReady.resolve())},[d.current]),o.default.createElement("div",{ref:d,className:_.default.terminalWrapper,style:{backgroundColor:y},"data-group-current":f},I&&o.default.createElement(m.TerminalSearch,null),b.map((M,R)=>{if(M.activated.get())return o.default.createElement("div",{"data-group-rendered":M.activated.get(),key:`terminal-${M.id}`,style:{display:l===R?"block":"none"},className:_.default.group,onFocus:g.focus.bind(g),onBlur:g.blur.bind(g),onContextMenu:g.onContextMenu.bind(g)},o.default.createElement(v.default,{shadow:!1,useFlex:!1,direction:v.ResizeDirection.horizontal,group:M,draw:P=>D(P,R)}))}))}},76970:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),c=e(26405),p=n.__importDefault(e(73567));function v(m,_,s){const g=()=>{s.removeWidget(m.id)},a=()=>{_.fix(m.id)};return m?.type===c.ETerminalErrorType.CREATE_FAIL?r.default.createElement("div",{className:p.default.terminalCover},r.default.createElement("div",null,(0,o.localize)("terminal.can.not.create"),": ",m.message),r.default.createElement("div",null,r.default.createElement("a",{onClick:g},(0,o.localize)("terminal.stop")),(0,o.localize)("terminal.or"),r.default.createElement("a",{onClick:a},(0,o.localize)("terminal.try.recreate")))):m.stopped?r.default.createElement("div",{className:p.default.terminalCover},r.default.createElement("div",null,(0,o.localize)("terminal.disconnected")),r.default.createElement("div",null,(0,o.localize)("terminal.can.not.reconnect"),r.default.createElement("a",{onClick:a},(0,o.localize)("terminal.try.reconnect")))):r.default.createElement("div",{className:p.default.terminalCover},r.default.createElement("div",null,(0,o.localize)("terminal.disconnected")),r.default.createElement("div",null,r.default.createElement("a",{onClick:g},(0,o.localize)("terminal.stop")),(0,o.localize)("terminal.or"),r.default.createElement("a",{onClick:a},(0,o.localize)("terminal.try.reconnect"))))}t.default=({widget:m,error:_,show:s})=>{const g=r.default.useRef(null),a=(0,o.useInjectable)(c.ITerminalErrorService),h=(0,o.useInjectable)(c.ITerminalGroupViewService);r.default.useEffect(()=>{if(g.current&&m.element)g.current.appendChild(m.element);else if(g.current&&!m.element){const d=document.createElement("div");g.current.appendChild(d),d.className=p.default.terminalContent,m.element=d}},[]),r.default.useEffect(()=>{m.show=s},[s]),r.default.useEffect(()=>{m.error=!!_},[_]);const u=()=>{h.selectWidget(m.id)};return r.default.createElement("div",{className:p.default.terminalContainer},_?v(_,a,h):null,r.default.createElement("div",{"data-term-id":m.id,style:{display:_?"none":"block"},className:p.default.terminalContentWrapper,onFocus:u,ref:g}))}},21623:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(71852),t),n.__exportStar(e(43397),t),n.__exportStar(e(7082),t),n.__exportStar(e(11476),t),n.__exportStar(e(63341),t),n.__exportStar(e(96051),t),n.__exportStar(e(79404),t)},71852:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalCommandContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(63067),p=e(26405),v=e(48520),m=e(35628),_=e(94620);let s=class{onReconnect(){this.terminalController.reconnect()}onDisposeSideEffects(){}setDefaultTerminalType(a){this.preference.update("terminal.type",a)}registerCommands(a){a.registerCommand({...o.TERMINAL_COMMANDS.OPEN_SEARCH,iconClass:(0,o.getIcon)("search")},{execute:()=>{if(this.search.isVisible){this.search.close();return}this.search.open()}}),a.registerCommand({...o.TERMINAL_COMMANDS.SPLIT,iconClass:(0,o.getIcon)("embed")},{execute:()=>{const h=this.view.currentGroup.get();if(!h)return;const u=this.view.createWidget(h);this.view.selectWidget(u.id)}}),a.registerCommand(o.TERMINAL_COMMANDS.CLEAR,{execute:()=>{this.view.clear()}}),a.registerCommand(o.TERMINAL_COMMANDS.ADD,{execute:async()=>{await this.terminalController.createTerminalWithWidget({}),this.terminalController.showTerminalPanel()}}),a.registerCommand(o.TERMINAL_COMMANDS.TOGGLE_TERMINAL,{execute:()=>{this.terminalController.toggleTerminalPanel()}}),a.registerCommand(o.TERMINAL_COMMANDS.SEARCH_NEXT,{execute:()=>{this.search.isVisible?this.search.search():this.search.open()}}),a.registerCommand({...o.TERMINAL_COMMANDS.REMOVE,iconClass:(0,o.getIcon)("delete")},{execute:async()=>{const h=this.view.currentWidgetId.get();h&&this.view.removeWidget(h)}}),a.registerCommand(o.TERMINAL_COMMANDS.OPEN_WITH_PATH,{execute:async h=>{h&&(await this.terminalApi.createTerminal({cwd:h.codeUri.fsPath})).show()}}),a.registerCommand(o.TERMINAL_COMMANDS.TAB_RENAME,{execute:async(h,u)=>{const d=this.view.getGroup(u);d&&d.edit()}}),a.registerCommand({...o.TERMINAL_COMMANDS.SELECT_ALL_CONTENT},{execute:()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.selectAll()}}),a.registerCommand({...o.TERMINAL_COMMANDS.CLEAR_CONTENT,iconClass:(0,o.getIcon)("clear")},{execute:()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.clear()}}),a.registerCommand({...o.TERMINAL_COMMANDS.CLEAR_ALL_CONTENT},{execute:()=>{this.terminalController.clearAllGroups()}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_ZSH,{execute:async()=>{this.setDefaultTerminalType("zsh")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_BASH,{execute:async()=>{this.setDefaultTerminalType("bash")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_SH,{execute:async()=>{this.setDefaultTerminalType("sh")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_POWERSHELL,{execute:async()=>{this.setDefaultTerminalType("powershell")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_CMD,{execute:async()=>{this.setDefaultTerminalType("cmd")}}),a.registerCommand(o.TERMINAL_COMMANDS.MORE_SETTINGS,{execute:async()=>{this.commands.executeCommand(o.COMMON_COMMANDS.OPEN_PREFERENCES.id,"terminal")}}),a.registerCommand(o.TERMINAL_COMMANDS.COPY,{execute:async()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&await this.clipboardService.writeText(u.getSelection())}}),a.registerCommand(o.TERMINAL_COMMANDS.PASTE,{execute:async()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.paste(await this.clipboardService.readText())}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_ALL,{execute:()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.selectAll()}}),a.registerCommand(o.TERMINAL_COMMANDS.RE_LAUNCH,{execute:()=>{const h=this.view.groups.get();for(const u of h)u.widgets.get().forEach(E=>{const f=this.terminalController.findClientFromWidgetId(E.id);f&&f.reset()})}}),a.registerCommand(o.COMMON_COMMANDS.ENVIRONMENT_VARIABLE,{execute:async()=>await this.terminalEnvironmentService.getProcessEnv()}),a.registerCommand(o.TERMINAL_COMMANDS.FOCUS_NEXT_TERMINAL,{execute:()=>{const h=this.view.currentGroup.get();if(h&&h.widgets.get().length<=1)return;const u=this.getNextOrPrevTerminalClient("next");u?.focus()}}),a.registerCommand(o.TERMINAL_COMMANDS.FOCUS_PREVIOUS_TERMINAL,{execute:()=>{const h=this.view.currentGroup.get();if(h&&h.widgets.get().length<=1)return;const u=this.getNextOrPrevTerminalClient("prev");u?.focus()}}),a.registerCommand(o.TERMINAL_COMMANDS.KILL_PROCESS,{execute:async()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);if(u){const d=u.getSelection();d&&d.length>0?await this.clipboardService.writeText(u.getSelection()):await this.terminalApi.sendText(h,"")}}})}getNextOrPrevTerminalClient(a){const h=this.view.currentGroup.get();if(!h)return;const u=h.widgets.get(),d=u.findIndex(l=>l.id===this.view.currentWidgetId.get());let E;a==="next"?E=d===u.length-1?0:d+1:E=d===0?u.length-1:d-1;const f=u[E];return this.terminalController.findClientFromWidgetId(f.id)}};t.TerminalCommandContribution=s,n.__decorate([(0,r.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(_.EnvironmentVariableServiceToken),n.__metadata("design:type",v.TerminalEnvironmentService)],s.prototype,"terminalEnvironmentService",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalGroupViewService),n.__metadata("design:type",Object)],s.prototype,"view",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalSearchService),n.__metadata("design:type",Object)],s.prototype,"search",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalRestore),n.__metadata("design:type",Object)],s.prototype,"store",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalApiService),n.__metadata("design:type",Object)],s.prototype,"terminalApi",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],s.prototype,"preference",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],s.prototype,"settingService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],s.prototype,"commands",void 0),n.__decorate([(0,r.Autowired)(c.IMainLayoutService),n.__metadata("design:type",Object)],s.prototype,"mainlayoutService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],s.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",m.TerminalKeyBoardInputService)],s.prototype,"terminalInput",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],s.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(o.IClipboardService),n.__metadata("design:type",Object)],s.prototype,"clipboardService",void 0),t.TerminalCommandContribution=s=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ClientAppContribution)],s)},63341:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalKeybindingContribution=void 0;const n=e(85608),r=e(41869),o=e(66e3),c=e(40191),p=e(43718);let v=class{registerKeybindings(_){_.registerKeybinding({command:r.TERMINAL_COMMANDS.OPEN_SEARCH.id,keybinding:"ctrlcmd+f",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.CLEAR_CONTENT.id,keybinding:"ctrlcmd+k",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.SEARCH_NEXT.id,keybinding:"ctrlcmd+g",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.COPY.id,keybinding:p.isWindows?"ctrlcmd+shift+c":"ctrlcmd+c",when:c.RawContextKey.and(o.IsTerminalFocused.raw,"locationProtocol != http")}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.KILL_PROCESS.id,keybinding:"ctrlcmd+c",when:c.RawContextKey.and(o.IsTerminalFocused.raw,"locationProtocol != http","isWindows")}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.PASTE.id,keybinding:p.isWindows?"ctrlcmd+shift+v":"ctrlcmd+v",when:c.RawContextKey.and(o.IsTerminalFocused.raw,"locationProtocol != http")}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.SELECT_ALL.id,keybinding:"ctrlcmd+a",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.SPLIT.id,keybinding:"ctrlcmd+\\",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.ADD.id,keybinding:"ctrl+shift+`"}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_NEXT_TERMINAL.id,keybinding:"ctrlcmd+alt+right",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_NEXT_TERMINAL.id,keybinding:"ctrlcmd+alt+down",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_PREVIOUS_TERMINAL.id,keybinding:"ctrlcmd+alt+left",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_PREVIOUS_TERMINAL.id,keybinding:"ctrlcmd+alt+up",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.TOGGLE_TERMINAL.id,keybinding:"ctrl+`"})}};t.TerminalKeybindingContribution=v,t.TerminalKeybindingContribution=v=n.__decorate([(0,p.Domain)(r.KeybindingContribution)],v)},43397:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalLifeCycleContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(63067),p=e(26405),v=e(94620),m=e(43395),_=e(35628);let s=class{initialize(){(0,m.registerTerminalColors)()}onStart(){this.terminalInput.listen(),this.environmentService.initEnvironmentVariableCollections()}onDidRender(){this.store.restore().then(()=>{this.terminalController.firstInitialize()})}onStop(){this.terminalController.disposeTerminalClients({isTaskExecutor:!0}),this.store.save()}};t.TerminalLifeCycleContribution=s,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",_.TerminalKeyBoardInputService)],s.prototype,"terminalInput",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalRestore),n.__metadata("design:type",Object)],s.prototype,"store",void 0),n.__decorate([(0,r.Autowired)(v.EnvironmentVariableServiceToken),n.__metadata("design:type",Object)],s.prototype,"environmentService",void 0),t.TerminalLifeCycleContribution=s=n.__decorate([(0,o.Domain)(o.ClientAppContribution,c.MainLayoutContribution)],s)},7082:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalMenuContribution=t.more2=t.more1Sub=t.more1=t.group=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(30144),p=e(93899),v=e(43718),m=e(26405);t.group="panel_menu",t.more1="more_1",t.more1Sub="more_1_sub",t.more2="more_2";let _=class{registerMenus(g){g.registerMenuItem(p.MenuId.TerminalTabContext,{command:{id:o.TERMINAL_COMMANDS.TAB_RENAME.id,label:(0,o.localize)("terminal.menu.rename")},order:1,group:t.group}),g.registerMenuItem(p.MenuId.TerminalTabContext,{command:{id:o.TERMINAL_COMMANDS.SPLIT.id,label:(0,o.localize)("terminal.menu.split")},order:2,group:t.group}),g.registerMenuItem(p.MenuId.TerminalTabContext,{command:{id:o.TERMINAL_COMMANDS.REMOVE.id,label:(0,o.localize)("terminal.menu.stopGroup")},order:3,group:t.group}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.COPY,group:"1_modify"}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.PASTE,group:"1_modify"}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.SELECT_ALL,group:"1_modify"}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.CLEAR_CONTENT,group:"1_modify"});const a=(0,o.getSlotLocation)("@opensumi/ide-terminal-next",this.config.layoutConfig),h=(0,o.getTabbarCtxKey)(a),u=(0,p.getTabbarCommonMenuId)(a),d=`${h} == ${c.TERMINAL_CONTAINER_ID}`;g.registerMenuItem(u,{command:o.TERMINAL_COMMANDS.CLEAR,order:1,group:t.more1,when:d}),g.registerMenuItem(u,{command:o.TERMINAL_COMMANDS.CLEAR_ALL_CONTENT,order:1,group:t.more1,when:d}),g.registerMenuItem(u,{label:(0,o.localize)("terminal.menu.selectType"),submenu:p.MenuId.TerminalDefaultTypeMenu,order:1,group:t.more2,when:d}),v.isWindows?g.registerMenuItems(p.MenuId.TerminalDefaultTypeMenu,[{command:o.TERMINAL_COMMANDS.SELECT_CMD,order:1,group:t.more1Sub,toggledWhen:"config.terminal.type == cmd",when:d},{command:o.TERMINAL_COMMANDS.SELECT_POWERSHELL,order:2,group:t.more1Sub,toggledWhen:"config.terminal.type == powershell",when:d}]):g.registerMenuItems(p.MenuId.TerminalDefaultTypeMenu,[{command:o.TERMINAL_COMMANDS.SELECT_ZSH,order:1,group:t.more1Sub,toggledWhen:"config.terminal.type == zsh",when:d},{command:o.TERMINAL_COMMANDS.SELECT_BASH,order:2,group:t.more1Sub,toggledWhen:"config.terminal.type == bash",when:d},{command:o.TERMINAL_COMMANDS.SELECT_SH,order:3,group:t.more1Sub,toggledWhen:"config.terminal.type == sh",when:d}]),g.registerMenuItem(u,{command:o.TERMINAL_COMMANDS.MORE_SETTINGS,order:1,group:t.more2,when:d})}};t.TerminalMenuContribution=_,n.__decorate([(0,r.Autowired)(m.ITerminalController),n.__metadata("design:type",Object)],_.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(m.ITerminalGroupViewService),n.__metadata("design:type",Object)],_.prototype,"view",void 0),n.__decorate([(0,r.Autowired)(m.ITerminalSearchService),n.__metadata("design:type",Object)],_.prototype,"search",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],_.prototype,"settingService",void 0),n.__decorate([(0,r.Autowired)(v.CommandService),n.__metadata("design:type",Object)],_.prototype,"commands",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],_.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preference",void 0),t.TerminalMenuContribution=_=n.__decorate([(0,v.Domain)(p.MenuContribution)],_)},96051:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalNetworkContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(26405);let v=class extends c.WithEventBus{onStart(){this.network.bindErrors()}handleBrowserConnectionOpen(_){this.network.setStatus(p.TerminalNetworkStatus.CONNECTED)}handleBrowserConnectionClose(_){this.network.setStatus(p.TerminalNetworkStatus.DISCONNECTED)}};t.TerminalNetworkContribution=v,n.__decorate([(0,r.Autowired)(p.ITerminalNetwork),n.__metadata("design:type",Object)],v.prototype,"network",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalInternalService),n.__metadata("design:type",Object)],v.prototype,"service",void 0),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[c.BrowserConnectionOpenEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[c.BrowserConnectionCloseEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"handleBrowserConnectionClose",null),t.TerminalNetworkContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],v)},79404:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalPreferenceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(26405),v=e(3276),m=e(91815);let _=class{constructor(){this.schema=v.terminalPreferenceSchema;const g=["git-bash","powershell","cmd","default"],{properties:{["terminal.type"]:a}}={...v.terminalPreferenceSchema};this.ptyTerminal.getOS().then(h=>{h===c.OperatingSystem.Windows&&this.preferenceSchemaProvider.setSchema({properties:{"terminal.type":{...a,enum:g}}},!0)})}};t.TerminalPreferenceContribution=_,n.__decorate([(0,r.Autowired)(p.ITerminalService),n.__metadata("design:type",m.NodePtyTerminalService)],_.prototype,"ptyTerminal",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],_.prototype,"preferenceSchemaProvider",void 0),t.TerminalPreferenceContribution=_=n.__decorate([(0,c.Domain)(o.PreferenceContribution),n.__metadata("design:paramtypes",[])],_)},11476:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalRenderContribution=void 0;const r=e(85608),o=e(41869),c=e(30144),p=r.__importDefault(e(17632)),v=r.__importDefault(e(48139));let m=n=class{registerToolbarItems(s){s.registerItem({id:o.TERMINAL_COMMANDS.OPEN_SEARCH.id,command:o.TERMINAL_COMMANDS.OPEN_SEARCH.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.search")}),s.registerItem({id:o.TERMINAL_COMMANDS.CLEAR_CONTENT.id,command:o.TERMINAL_COMMANDS.CLEAR_CONTENT.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.menu.clearCurrentContent")}),s.registerItem({id:o.TERMINAL_COMMANDS.SPLIT.id,command:o.TERMINAL_COMMANDS.SPLIT.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.split")}),s.registerItem({id:o.TERMINAL_COMMANDS.REMOVE.id,command:o.TERMINAL_COMMANDS.REMOVE.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.remove")})}registerComponent(s){s.register("@opensumi/ide-terminal-next",{component:v.default,id:n.viewId},{title:(0,o.localize)("terminal.name"),priority:1,activateKeyBinding:"ctrl+`",containerId:n.viewId,titleComponent:p.default,draggable:!0,hideLocationTab:["right"]})}};t.TerminalRenderContribution=m,m.viewId=c.TERMINAL_CONTAINER_ID,t.TerminalRenderContribution=m=n=r.__decorate([(0,o.Domain)(o.ComponentContribution,o.TabBarToolbarContribution)],m)},17236:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalNextModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26405),p=e(94620),v=e(3276),m=e(21623),_=e(98944),s=e(69061),g=e(7734),a=e(48520),h=e(102),u=e(53891),d=e(82022),E=e(12642),f=e(13663),l=e(89570),b=e(94486),y=e(46666),A=e(70406),S=e(12894),w=e(91815),T=e(29041),D=e(68611);let I=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[m.TerminalLifeCycleContribution,m.TerminalRenderContribution,m.TerminalCommandContribution,m.TerminalMenuContribution,m.TerminalKeybindingContribution,m.TerminalNetworkContribution,m.TerminalPreferenceContribution,{token:c.ITerminalApiService,useClass:_.TerminalApiService},{token:c.ITerminalController,useClass:g.TerminalController},{token:c.ITerminalTheme,useClass:T.TerminalTheme},{token:c.ITerminalSearchService,useClass:S.TerminalSearchService},{token:c.ITerminalHoverManagerService,useClass:u.TerminalHoverManagerService},{token:c.ITerminalGroupViewService,useClass:D.TerminalGroupViewService},{token:c.ITerminalErrorService,useClass:h.TerminalErrorService},{token:c.ITerminalService,useClass:w.NodePtyTerminalService},{token:c.ITerminalInternalService,useClass:d.TerminalInternalService},{token:c.ITerminalRestore,useClass:A.TerminalRestore},{token:v.ITerminalPreference,useClass:f.TerminalPreference},{token:c.ITerminalRenderProvider,useClass:y.TerminalRenderProvider},{token:c.ITerminalClientFactory2,useFactory:s.createTerminalClientFactory2},{token:c.ITerminalNetwork,useClass:E.TerminalNetworkService},{token:p.EnvironmentVariableServiceToken,useClass:a.TerminalEnvironmentService},{token:c.ITerminalProfileService,useClass:l.TerminalProfileService},{token:c.ITerminalProfileInternalService,useClass:b.TerminalProfileInternalService}],this.backServices=[{servicePath:c.ITerminalServicePath,clientToken:c.ITerminalService},{servicePath:c.ITerminalProcessPath,clientToken:p.EnvironmentVariableServiceToken}]}};t.TerminalNextModule=I,t.TerminalNextModule=I=n.__decorate([(0,r.Injectable)()],I)},67245:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalBaseLinkProvider=void 0;class e{async provideLinks(r,o){var c;(c=this._activeLinks)===null||c===void 0||c.forEach(p=>p.dispose),this._activeLinks=await this._provideLinks(r),o(this._activeLinks)}}t.TerminalBaseLinkProvider=e},52826:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalExternalLinkProviderAdapter=void 0;const n=e(85608),r=e(76003),o=e(67245),c=e(28247),p=e(97144);let v=class extends o.TerminalBaseLinkProvider{constructor(_,s,g,a,h){super(),this._xterm=_,this._instance=s,this._externalLinkProvider=g,this._wrapLinkHandler=a,this._tooltipCallback=h}async _provideLinks(_){var s,g;let a=_-1,h=a;const u=[this._xterm.buffer.active.getLine(a)];for(;a>=0&&(!((s=this._xterm.buffer.active.getLine(a))===null||s===void 0)&&s.isWrapped);)u.unshift(this._xterm.buffer.active.getLine(a-1)),a--;for(;h<this._xterm.buffer.active.length&&(!((g=this._xterm.buffer.active.getLine(h+1))===null||g===void 0)&&g.isWrapped);)u.push(this._xterm.buffer.active.getLine(h+1)),h++;const d=(0,c.getXtermLineContent)(this._xterm.buffer.active,a,h,this._xterm.cols);if(d.trim().length===0)return[];const E=await this._externalLinkProvider.provideLinks(this._instance,d);return E?E.map(f=>{const l=(0,c.convertLinkRangeToBuffer)(u,this._xterm.cols,{startColumn:f.startIndex+1,startLineNumber:1,endColumn:f.startIndex+f.length+1,endLineNumber:1},a),b=d.substr(f.startIndex,f.length)||"",y=this._wrapLinkHandler((A,S)=>f.activate(S));return this.injector.get(p.TerminalLink,[this._xterm,l,b,this._xterm.buffer.active.viewportY,y,this._tooltipCallback,!0,f.label])}):[]}};t.TerminalExternalLinkProviderAdapter=v,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],v.prototype,"injector",void 0),t.TerminalExternalLinkProviderAdapter=v=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Object,Object,Function,Function])],v)},28247:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertLinkRangeToBuffer=e,t.convertBufferRangeToViewport=n,t.getXtermLineContent=r,t.positionIsInRange=o;function e(c,p,v,m){const _={start:{x:v.startColumn,y:v.startLineNumber+m},end:{x:v.endColumn-1,y:v.endLineNumber+m}};let s=0;const g=Math.ceil(v.startColumn/p);for(let u=0;u<Math.min(g);u++){const d=Math.min(p,v.startColumn-u*p);let E=0;const f=c[u];if(!f)break;for(let l=0;l<Math.min(p,d+E);l++){const b=f.getCell(l);b.getWidth()===2&&E++;const A=b.getChars();A.length>1&&(E-=A.length-1)}s+=E}let a=0;const h=Math.ceil(v.endColumn/p);for(let u=Math.max(0,g-1);u<h;u++){const d=u===g-1?(v.startColumn+s)%p:0,E=Math.min(p,v.endColumn+s-u*p),f=u===g-1?s:0;let l=0;const b=c[u];if(!b)break;for(let y=d;y<Math.min(p,E+l+f);y++){const A=b.getCell(y);A.getWidth()===2&&l++,y===p-1&&A.getChars()===""&&l++}a+=l}for(_.start.x+=s,_.end.x+=s+a;_.start.x>p;)_.start.x-=p,_.start.y++;for(;_.end.x>p;)_.end.x-=p,_.end.y++;return _}function n(c,p){return{start:{x:c.start.x-1,y:c.start.y-p-1},end:{x:c.end.x-1,y:c.end.y-p-1}}}function r(c,p,v,m){let _="";for(let s=p;s<=v;s++){const g=c.getLine(s);g&&(_+=g.translateToString(!0,0,m))}return _}function o(c,p){return!(c.y<p.start.y||c.y>p.end.y||c.y===p.start.y&&c.x<p.start.x||c.y===p.end.y&&c.x>p.end.x)}},29970:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalLinkManager=void 0;const n=e(85608),r=e(87083),o=e(76003),c=e(41869),p=e(43718),v=e(23418),m=e(14951),_=e(26405),s=e(69061),g=e(52826),a=e(11192),h=e(73481),u=e(67251),{posix:d,win32:E}=p.path;let f=class extends p.Disposable{constructor(b,y){super(),this._xterm=b,this._client=y,this._standardLinkProviders=[],this._standardLinkProvidersDisposables=new p.DisposableCollection;const A=this._wrapLinkHandler((D,I)=>this._handleProtocolLink(I)),S=this.injector.get(a.TerminalProtocolLinkProvider,[this._xterm,A,this._tooltipCallback.bind(this)]);this._standardLinkProviders.push(S);const w=this._wrapLinkHandler((D,I)=>this._handleLocalLink(I));this._wrappedTextLinkActivateCallback=w;const T=this.injector.get(h.TerminalValidatedLocalLinkProvider,[this._xterm,this._client,w,this._wrapLinkHandler.bind(this),this._tooltipCallback.bind(this),async(D,I)=>I(await this._resolvePath(D))]);this._standardLinkProviders.push(T),this.addTerminalWordLinkProvider(),this._registerStandardLinkProviders()}set processCwd(b){this._processCwd=b}addTerminalWordLinkProvider(){const b=this.injector.get(u.TerminalWordLinkProvider,[this._xterm,async(y,A)=>A(await this._resolvePath(y)),this._wrappedTextLinkActivateCallback]);this._standardLinkProviders.push(b)}async getTerminalCwd(){return await this.terminalService.getCwd(this._client.id)||this._processCwd}_registerStandardLinkProviders(){this._standardLinkProvidersDisposables.dispose(),this._standardLinkProvidersDisposables=new p.DisposableCollection;for(const b of this._standardLinkProviders)this._standardLinkProvidersDisposables.push(this._xterm.registerLinkProvider(b))}_tooltipCallback(b,y,A,S){const w=this._xterm._core,T={width:w._renderService.dimensions.css.cell.width,height:w._renderService.dimensions.css.cell.height},D={width:this._xterm.cols,height:this._xterm.rows},I=w.element.getBoundingClientRect();return this._showHover({viewportRange:y,cellDimensions:T,terminalDimensions:D,boundingClientRect:I,modifierDownCallback:A,modifierUpCallback:S},this._getLinkHoverString(b.text,b.label),O=>b.activate(void 0,O),b)}_showHover(b,y,A,S){const w=this._hoverManager.showHover(b,y,A);return S?.onInvalidated(()=>w.dispose()),p.Disposable.create(()=>w.dispose())}registerExternalLinkProvider(b,y){const A=this.injector.get(g.TerminalExternalLinkProviderAdapter,[this._xterm,b,y,this._wrapLinkHandler.bind(this),this._tooltipCallback.bind(this)]),S=this._xterm.registerLinkProvider(A);return this._registerStandardLinkProviders(),S}_wrapLinkHandler(b){return async(y,A)=>{y?.preventDefault(),!(y&&!this._isLinkActivationModifierDown(y))&&b(y,A)}}get _localLinkRegex(){const b=this._client.os===p.OperatingSystem.Windows?h.winLocalLinkClause:h.unixLocalLinkClause;return new RegExp(`${b}(${h.lineAndColumnClause})`)}async _handleLocalLink(b){const y=await this._resolvePath(b);if(!y)return;const A=this.extractLineColumnInfo(b),S={startLineNumber:A.lineNumber,endLineNumber:A.lineNumber,startColumn:A.columnNumber,endColumn:A.columnNumber};await this._editorService.open(y.uri,{range:S})}_handleHypertextLink(b){this._openerService.open(b)}async _handleProtocolLink(b){const y=p.URI.parse(b);if(y.scheme===p.Schemes.file){const A=p.FileUri.fsPath(y);this._handleLocalLink(this._client.os!==p.OperatingSystem.Windows&&p.isWindows?A.replace(/\\/g,d.sep):A);return}this._handleHypertextLink(b)}_isLinkActivationModifierDown(b){return p.isOSX?b.metaKey:b.ctrlKey}get osPath(){return this._client.os===p.OperatingSystem.Windows?E:d}_getLinkHoverString(b,y){const A=this.preferenceService.get("editor.multiCursorModifier");let S="";A==="ctrlCmd"?p.isMacintosh?S=(0,p.localize)("terminalLinkHandler.followLinkAlt.mac","option + click"):S=(0,p.localize)("terminalLinkHandler.followLinkAlt","alt + click"):p.isMacintosh?S=(0,p.localize)("terminalLinkHandler.followLinkCmd","cmd + click"):S=(0,p.localize)("terminalLinkHandler.followLinkCtrl","ctrl + click");const w=(0,p.localize)("followLink","Follow link");return y=y||w,`${y} (${S})`}async _getUserHomeDir(){const b=await this._fileSystem.getCurrentUserHome();if(!b)throw new Error("Unable to get user home directory");return await this._fileSystem.getFsPath(b.uri)}_getUserHomeDirOnce(){return this._getHomeDirPromise||(this._getHomeDirPromise=this._getUserHomeDir()),this._getHomeDirPromise}async _preprocessPath(b){if(b.charAt(0)==="~"){const y=await this._getUserHomeDirOnce();if(!y)return null;b=this.osPath.join(y,b.substring(1))}else if(b.charAt(0)!=="/"&&b.charAt(0)!=="~"){const y=await this.getTerminalCwd();if(this._client.os===p.OperatingSystem.Windows)if(!b.match("^"+h.winDrivePrefix)&&!b.startsWith("\\\\?\\")){if(!y)return null;b=this.osPath.join(y,b)}else b=b.replace(/^\\\\\?\\/,"");else{if(!y)return null;b=this.osPath.join(y,b)}}return b=this.osPath.normalize(b),b}async _resolvePath(b){const y=await this._preprocessPath(b);if(y)try{const A=p.URI.file(y),S=await this._fileService.getFileStat(A.toString());if(S)return{uri:A,isDirectory:S.isDirectory}}catch{return}}extractLineColumnInfo(b){const y=this._localLinkRegex.exec(b),A={lineNumber:1,columnNumber:1};if(!y)return A;const S=this._client.os===p.OperatingSystem.Windows?h.winLineAndColumnMatchIndex:h.unixLineAndColumnMatchIndex;for(let w=0;w<h.lineAndColumnClause.length;w++){const T=S+h.lineAndColumnClauseGroupCount*w,D=y[T];if(D){A.lineNumber=parseInt(D,10);const I=y[T+2];I&&(A.columnNumber=parseInt(I,10));break}}return A}extractLinkUrl(b){const y=this._localLinkRegex.exec(b);return y?y[1]:null}};t.TerminalLinkManager=f,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],f.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(_.ITerminalService),n.__metadata("design:type",Object)],f.prototype,"terminalService",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",v.WorkbenchEditorService)],f.prototype,"_editorService",void 0),n.__decorate([(0,o.Autowired)(c.IOpenerService),n.__metadata("design:type",Object)],f.prototype,"_openerService",void 0),n.__decorate([(0,o.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],f.prototype,"_fileService",void 0),n.__decorate([(0,o.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],f.prototype,"_fileSystem",void 0),n.__decorate([(0,o.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],f.prototype,"preferenceService",void 0),n.__decorate([(0,o.Autowired)(_.ITerminalHoverManagerService),n.__metadata("design:type",Object)],f.prototype,"_hoverManager",void 0),t.TerminalLinkManager=f=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[r.Terminal,s.TerminalClient])],f)},97144:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalLink=t.FOLDER_NOT_IN_WORKSPACE_LABEL=t.FOLDER_IN_WORKSPACE_LABEL=t.OPEN_FILE_LABEL=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(28247),v=500;t.OPEN_FILE_LABEL=(0,c.localize)("terminal.openFile","Open file in editor"),t.FOLDER_IN_WORKSPACE_LABEL=(0,c.localize)("terminal.focusFolder","Focus folder in explorer"),t.FOLDER_NOT_IN_WORKSPACE_LABEL=(0,c.localize)("terminal.openFolder","Open folder in new window");let m=class extends c.Disposable{get onInvalidated(){return this._onInvalidated.event}constructor(s,g,a,h,u,d,E,f){super(),this._xterm=s,this.range=g,this.text=a,this._viewportY=h,this._activateCallback=u,this._tooltipCallback=d,this._isHighConfidenceLink=E,this.label=f,this._onInvalidated=new c.Emitter,this.decorations={pointerCursor:!1,underline:this._isHighConfidenceLink}}dispose(){var s,g,a;super.dispose(),(s=this._hoverListeners)===null||s===void 0||s.dispose(),this._hoverListeners=void 0,(g=this._tooltipScheduler)===null||g===void 0||g.dispose(),this._tooltipScheduler=void 0,(a=this._tooltipDisposable)===null||a===void 0||a.dispose(),this._tooltipDisposable=void 0}activate(s,g){this._activateCallback(s,g)}hover(s,g){this._hoverListeners=new c.DisposableCollection,this._hoverListeners.push((0,o.addDisposableListener)(document,"keydown",h=>{!h.repeat&&this._isModifierDown(h)&&this._enableDecorations()})),this._hoverListeners.push((0,o.addDisposableListener)(document,"keyup",h=>{!h.repeat&&!this._isModifierDown(h)&&this._disableDecorations()})),this._hoverListeners.push(this._xterm.onRender(h=>{const u=this.range.start.y-this._viewportY;u>=h.start&&u<=h.end&&this._onInvalidated.fire()})),this._isHighConfidenceLink&&(this._tooltipScheduler=new c.RunOnceScheduler(()=>{var h;this._tooltipDisposable=this._tooltipCallback(this,(0,p.convertBufferRangeToViewport)(this.range,this._viewportY),this._isHighConfidenceLink?()=>this._enableDecorations():void 0,this._isHighConfidenceLink?()=>this._disableDecorations():void 0),(h=this._tooltipScheduler)===null||h===void 0||h.dispose(),this._tooltipScheduler=void 0},this.preferenceService.get("editor.hover.delay")||v),this._tooltipScheduler.schedule());const a={x:s.pageX,y:s.pageY};this._hoverListeners.push((0,o.addDisposableListener)(document,"mousemove",h=>{var u;this._isModifierDown(h)?this._enableDecorations():this._disableDecorations(),(Math.abs(h.pageX-a.x)>window.devicePixelRatio*2||Math.abs(h.pageY-a.y)>window.devicePixelRatio*2)&&(a.x=h.pageX,a.y=h.pageY,(u=this._tooltipScheduler)===null||u===void 0||u.schedule())}))}leave(){var s,g,a;(s=this._hoverListeners)===null||s===void 0||s.dispose(),this._hoverListeners=void 0,(g=this._tooltipScheduler)===null||g===void 0||g.dispose(),this._tooltipScheduler=void 0,(a=this._tooltipDisposable)===null||a===void 0||a.dispose(),this._tooltipDisposable=void 0}_enableDecorations(){this.decorations.pointerCursor||(this.decorations.pointerCursor=!0),this.decorations.underline||(this.decorations.underline=!0)}_disableDecorations(){this.decorations.pointerCursor&&(this.decorations.pointerCursor=!1),this.decorations.underline!==this._isHighConfidenceLink&&(this.decorations.underline=this._isHighConfidenceLink)}_isModifierDown(s){return c.isOSX?s.metaKey:s.ctrlKey}};t.TerminalLink=m,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.TerminalLink=m=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Object,String,Number,Function,Function,Boolean,Object])],m)},11192:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalProtocolLinkProvider=void 0;const n=e(85608),r=e(76003),o=e(26405),c=e(67245),p=e(28247),v=e(97144);let m=class extends c.TerminalBaseLinkProvider{constructor(g,a,h){super(),this._xterm=g,this._activateCallback=a,this._tooltipCallback=h}_provideLinks(g){var a,h;let u=g-1,d=u;const E=[this._xterm.buffer.active.getLine(u)];for(;u>=0&&(!((a=this._xterm.buffer.active.getLine(u))===null||a===void 0)&&a.isWrapped);)E.unshift(this._xterm.buffer.active.getLine(u-1)),u--;for(;d<this._xterm.buffer.active.length&&(!((h=this._xterm.buffer.active.getLine(d+1))===null||h===void 0)&&h.isWrapped);)E.push(this._xterm.buffer.active.getLine(d+1)),d++;return this._linkComputerTarget=new _(this._xterm,u,d),o.LinkComputer.computeLinks(this._linkComputerTarget).map(l=>{var b;const y=(0,p.convertLinkRangeToBuffer)(E,this._xterm.cols,l.range,u);return this.injector.get(v.TerminalLink,[this._xterm,y,((b=l.url)===null||b===void 0?void 0:b.toString())||"",this._xterm.buffer.active.viewportY,this._activateCallback,this._tooltipCallback,!0,void 0])})}};t.TerminalProtocolLinkProvider=m,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],m.prototype,"injector",void 0),t.TerminalProtocolLinkProvider=m=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Function,Function])],m);class _{constructor(g,a,h){this._xterm=g,this._lineStart=a,this._lineEnd=h}getLineCount(){return 1}getLineContent(){return(0,p.getXtermLineContent)(this._xterm.buffer.active,this._lineStart,this._lineEnd,this._xterm.cols)}}},73481:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalValidatedLocalLinkProvider=t.lineAndColumnClauseGroupCount=t.unixLineAndColumnMatchIndex=t.winLineAndColumnMatchIndex=t.lineAndColumnClause=t.winLocalLinkClause=t.winDrivePrefix=t.unixLocalLinkClause=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(66894),p=e(43718),v=e(97408),m=e(67245),_=e(28247),s=e(97144),g="(\\.\\.?|\\~)",a="\\/",h="[^\\0\\s!`&*()\\[\\]'\":;\\\\]";t.unixLocalLinkClause="(("+g+"|("+h+")+)?("+a+"("+h+")+)+)",t.winDrivePrefix="(?:\\\\\\\\\\?\\\\)?[a-zA-Z]:";const u="("+t.winDrivePrefix+"|\\.\\.?|\\~)",d="(\\\\|\\/)",E="[^\\0<>\\?\\|\\/\\s!`&*()\\[\\]'\":;]";t.winLocalLinkClause="(("+u+"|("+E+")+)?("+d+"("+E+")+)+)",t.lineAndColumnClause=[`((\\S*)['"], line ((\\d+)( column (\\d+))?))`,`((\\S*)['"],((\\d+)(:(\\d+))?))`,"((\\S*) on line ((\\d+)(, column (\\d+))?))","((\\S*):line ((\\d+)(, column (\\d+))?))","(([^\\s\\(\\)]*)(\\s?[\\(\\[](\\d+)(,\\s?(\\d+))?)[\\)\\]])",`(([^:\\s\\(\\)<>'"\\[\\]]*)(:(\\d+))?(:(\\d+))?)`].join("|").replace(/ /g,"[\xA0 ]"),t.winLineAndColumnMatchIndex=12,t.unixLineAndColumnMatchIndex=11,t.lineAndColumnClauseGroupCount=6;const f=2e3;let l=class extends m.TerminalBaseLinkProvider{constructor(y,A,S,w,T,D){super(),this._xterm=y,this._client=A,this._activateFileCallback=S,this._wrapLinkHandler=w,this._tooltipCallback=T,this._validationCallback=D}async _provideLinks(y){var A,S;const w=[];let T=y-1,D=T;const I=[this._xterm.buffer.active.getLine(T)];for(;T>=0&&(!((A=this._xterm.buffer.active.getLine(T))===null||A===void 0)&&A.isWrapped);)I.unshift(this._xterm.buffer.active.getLine(T-1)),T--;for(;D<this._xterm.buffer.active.length&&(!((S=this._xterm.buffer.active.getLine(D+1))===null||S===void 0)&&S.isWrapped);)I.push(this._xterm.buffer.active.getLine(D+1)),D++;const O=(0,_.getXtermLineContent)(this._xterm.buffer.active,T,D,this._xterm.cols);if(O.length>f)return[];const M=new RegExp(this._localLinkRegex,"g");let R,P=-1;for(;(R=M.exec(O))!==null;){let k=R[0];if(!k||(P=O.indexOf(k,P+1),M.lastIndex=P+k.length,P<0))break;((O.startsWith("--- a/")||O.startsWith("+++ b/"))&&P===4||O.startsWith("diff --git")&&(k.startsWith("a/")||k.startsWith("b/")))&&(k=k.substring(2),P+=2);const F=await this.detectLocalLink(k,I,T,P,1);F.length>0&&w.push(...F)}if(w.length===0){const k=await this.detectLocalLink(O,I,T,P,2);k.length>0&&w.push(...k)}return w}async detectLocalLink(y,A,S,w,T){const D=[],I=await new Promise(O=>{this._validationCallback(y,async M=>{if(M){const R=M.isDirectory?await this._isDirectoryInsideWorkspace(M.uri)?s.FOLDER_IN_WORKSPACE_LABEL:s.FOLDER_NOT_IN_WORKSPACE_LABEL:s.OPEN_FILE_LABEL,P=this._wrapLinkHandler((F,L)=>{M.isDirectory?this._handleLocalFolderLink(M.uri):this._activateFileCallback(F,L)}),k=(0,_.convertLinkRangeToBuffer)(A,this._xterm.cols,{startColumn:w+1,startLineNumber:1,endColumn:w+y.length+T,endLineNumber:1},S);O(this.injector.get(s.TerminalLink,[this._xterm,k,y,this._xterm.buffer.active.viewportY,P,this._tooltipCallback,!0,R]))}else O(void 0)})});return I&&D.push(I),D}get _localLinkRegex(){const y=this._client.os===p.OperatingSystem.Windows?t.winLocalLinkClause:t.unixLocalLinkClause;return new RegExp(`${y}(${t.lineAndColumnClause})`)}async _handleLocalFolderLink(y){if(await this._isDirectoryInsideWorkspace(y)){await this.commandService.executeCommand("revealInExplorer",y);return}this.appConfig.isElectronRenderer&&this.windowService.openWorkspace(y,{newWindow:!0})}async _isDirectoryInsideWorkspace(y){const A=await this.workspaceService.roots;for(const S of A)if(p.URI.parse(S.uri).isEqualOrParent(y))return!0;return!1}};t.TerminalValidatedLocalLinkProvider=l,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],l.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(c.IWindowService),n.__metadata("design:type",Object)],l.prototype,"windowService",void 0),n.__decorate([(0,r.Autowired)(p.CommandService),n.__metadata("design:type",Object)],l.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],l.prototype,"appConfig",void 0),t.TerminalValidatedLocalLinkProvider=l=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Function,Function,Function,Function,Function])],l)},67251:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalWordLinkProvider=t.USUAL_WORD_SEPARATORS=void 0;const n=e(85608),r=e(87083),o=e(76003),c=e(74404),p=e(11050),v=e(66894),m=e(43718),_=e(92323),s=e(97408),g=e(70845),a=e(67245),h=e(28247),u=e(97144);t.USUAL_WORD_SEPARATORS=" ()[]{}',\"`\u2500\u2018\u2019\u201C\u201D|";let d=class extends a.TerminalBaseLinkProvider{constructor(f,l,b){super(),this._xterm=f,this._validationCallback=l,this._activateFileCallback=b,this._refreshSeparatorCodes()}_refreshSeparatorCodes(){let f="";for(let l=57520;l<=57535;l++)f+=String.fromCharCode(l);this._separatorRegex=new RegExp(`[${(0,g.escapeRegExpCharacters)(t.USUAL_WORD_SEPARATORS)}${f}]`,"g")}_provideLinks(f){const l=[],b=f-1,y=b,A=[this._xterm.buffer.active.getLine(b)],S=(0,h.getXtermLineContent)(this._xterm.buffer.active,b,y,this._xterm.cols);if(S===""||S.length>1024)return[];const w=this._parseWords(S);for(const T of w){if(T.text==="")continue;T.text.length>0&&T.text.charAt(T.text.length-1)===":"&&(T.text=T.text.slice(0,-1),T.endIndex--);const D=(0,h.convertLinkRangeToBuffer)(A,this._xterm.cols,{startColumn:T.startIndex+1,startLineNumber:1,endColumn:T.endIndex+1,endLineNumber:1},b),I=(O,M)=>{this._validationCallback(M,async R=>{R?R.isDirectory?this._handleLocalFolderLink(R.uri):this._activateFileCallback(O,M):this.quickOpenService.open(M)})};l.push(this.injector.get(u.TerminalLink,[this._xterm,D,T.text,this._xterm.buffer.active.viewportY,I,void 0,!0,T.text]))}return l}async _handleLocalFolderLink(f){if(await this._isDirectoryInsideWorkspace(f)){await this.commandService.executeCommand("revealInExplorer",f);return}this.appConfig.isElectronRenderer&&this.windowService.openWorkspace(f,{newWindow:!0})}_parseWords(f){const l=[],b=f.split(this._separatorRegex);let y=0;for(let A=0;A<b.length;A++)l.push({text:b[A],startIndex:y,endIndex:y+b[A].length}),y+=b[A].length+1;return l}async _isDirectoryInsideWorkspace(f){const l=await this.workspaceService.roots;for(const b of l)if(m.URI.parse(b.uri).isEqualOrParent(f))return!0;return!1}};t.TerminalWordLinkProvider=d,n.__decorate([(0,o.Autowired)(p.AppConfig),n.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(_.CommandService),n.__metadata("design:type",Object)],d.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(v.IWindowService),n.__metadata("design:type",Object)],d.prototype,"windowService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],d.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(c.PrefixQuickOpenService),n.__metadata("design:type",Object)],d.prototype,"quickOpenService",void 0),t.TerminalWordLinkProvider=d=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[r.Terminal,Function,Function])],d)},62810:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_COL=t.DEFAULT_ROW=t.AttachAddon=void 0;const n=e(43718);class r extends n.Disposable{constructor(){super(...arguments),this._onData=new n.Emitter,this.onData=this._onData.event,this._onExit=new n.Emitter,this.onExit=this._onExit.event,this._onTime=new n.Emitter,this.onTime=this._onTime.event,this._lastInputTime=0,this._onBeforeProcessData=new n.Emitter,this.onBeforeProcessData=this._onBeforeProcessData.event}setConnection(c){this._disposeConnection&&(this._disposeConnection.dispose(),this._disposeConnection=null),this.connection=c,c&&(this._disposeConnection=new n.Disposable(c.onData(p=>{let v=p;if(typeof p=="string"){const m={data:p};this._onBeforeProcessData.fire(m),m.data!==void 0&&(v=m.data)}if(this._onData.fire(v),this._terminal.write(typeof v=="string"?v:new Uint8Array(v,0,v.byteLength)),this._lastInputTime){const m=Date.now()-this._lastInputTime;this._lastInputTime=0,this._onTime.fire(m)}})),c.onExit&&this._disposeConnection.addDispose(c.onExit(p=>{this._onExit.fire(p)})))}async activate(c){this._terminal=c,this.addDispose(n.Disposable.create(()=>{var p;return(p=this._disposeConnection)===null||p===void 0?void 0:p.dispose()})),this.addDispose(c.onData(p=>this._sendData(p))),this.addDispose(c.onBinary(p=>this._sendBinary(p)))}_sendData(c){!this.connection||this.connection.readonly||(this._timeResponse(),this.connection.sendData(c))}_sendBinary(c){if(!this.connection||this.connection.readonly)return;const p=new Uint8Array(c.length);for(let v=0;v<c.length;++v)p[v]=c.charCodeAt(v)&255;this._timeResponse(),this.connection.sendData(p)}_timeResponse(){this._lastInputTime=Date.now()}}t.AttachAddon=r,t.DEFAULT_ROW=80,t.DEFAULT_COL=24},98944:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalApiService=void 0;const n=e(85608),r=n.__importDefault(e(56005)),o=e(76003),c=e(43718),p=e(28423),v=e(26405);let m=class{constructor(){this._onDidOpenTerminal=new c.Emitter,this._onDidCloseTerminal=new c.Emitter,this._onDidTerminalTitleChange=new c.Emitter,this._onDidChangeActiveTerminal=new c.Emitter,this.onDidOpenTerminal=this._onDidOpenTerminal.event,this.onDidCloseTerminal=this._onDidCloseTerminal.event,this.onDidTerminalTitleChange=this._onDidTerminalTitleChange.event,this.onDidChangeActiveTerminal=this._onDidChangeActiveTerminal.event,this.controller.onDidOpenTerminal(s=>{this._onDidOpenTerminal.fire(s)}),this.controller.onDidCloseTerminal(s=>{this._onDidCloseTerminal.fire(s)}),this.controller.onDidTerminalTitleChange(s=>{this._onDidTerminalTitleChange.fire(s)}),this.controller.onDidChangeActiveTerminal(s=>{this._onDidChangeActiveTerminal.fire(s)})}get terminals(){return Array.from(this.controller.clients.values()).map(s=>({id:s.id,name:s.name,isActive:this.view.currentWidgetId.get()===s.id}))}async createTerminal(s,g){const a=await this.controller.createTerminalWithWidgetByTerminalOptions({terminalOptions:s,id:g}),h={get id(){return a.id},get name(){return a.name},get processId(){return a.pid},show:(u=!0)=>{const d=a.widget;this.view.selectWidget(d.id),this.controller.showTerminalPanel(),u||setTimeout(()=>a.focus())},hide:()=>{this.controller.hideTerminalPanel()},dispose:()=>{this.view.removeWidget(a.widget.id),this.controller.clients.delete(a.id)}};return await a.attached.promise,h.show(),h}async getProcessId(s){const g=this.controller.clients.get(s);if(g)return g.pid}async getDefaultShellPath(){const s=await this.terminalProfileInternalService.resolveDefaultProfile();return s?.path||"/bin/bash"}sendText(s,g,a=!0){this.service.sendText(s,`${g}${a?"\r":""}`)}showTerm(s,g=!0){const a=this.controller.clients.get(s);if(!a)return;const h=a.widget;this.view.selectWidget(h.id),this.controller.showTerminalPanel(),g||setTimeout(()=>a.focus())}hideTerm(s){this.controller.clients.get(s)&&this.controller.hideTerminalPanel()}removeTerm(s){const g=this.controller.clients.get(s);g&&(this.view.removeWidget(g.widget.id),this.controller.clients.delete(s))}createWidget(s,g){const a=s,h=this.view.createGroup(),u=this.view.getGroup(h),d=this.view.createWidget(u,a,!1,!0);return(0,p.transaction)(E=>{d.name.set((0,r.default)(s),E)}),this.view.selectWidget(a),d.onRender(()=>{g(d.element)}),d}scheduleReconnection(){return this.network.scheduleReconnection()}};t.TerminalApiService=m,n.__decorate([(0,o.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],m.prototype,"controller",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalGroupViewService),n.__metadata("design:type",Object)],m.prototype,"view",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalInternalService),n.__metadata("design:type",Object)],m.prototype,"service",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalNetwork),n.__metadata("design:type",Object)],m.prototype,"network",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalProfileInternalService),n.__metadata("design:type",Object)],m.prototype,"terminalProfileInternalService",void 0),t.TerminalApiService=m=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],m)},69061:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.createTerminalClientFactory2=t.TerminalClientFactory=t.TerminalClient=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(67889),v=e(43718),m=e(23418),_=e(42933),s=e(28423),g=e(72665),a=e(88913),h=e(10560),u=e(26405),d=e(94620),E=e(3276),f=e(29970),l=e(62810),b=e(90853),y=e(35628),A=e(70845),S=e(41685);let w=n=class extends v.Disposable{constructor(){super(),this.isTaskExecutor=!1,this._ready=!1,this._hasOutput=!1,this._areLinksReady=!1,this._onInput=new v.Emitter,this.onInput=this._onInput.event,this._onOutput=new v.Emitter,this.onOutput=this._onOutput.event,this._onExit=new v.Emitter,this.onExit=this._onExit.event,this._onTitleChange=new v.Emitter,this.onTitleChange=this._onTitleChange.event,this._onLinksReady=new v.Emitter,this.onLinksReady=this._onLinksReady.event,this._onResponseTime=new v.Emitter,this.onResponseTime=this._onResponseTime.event,this._onNameChangeEmitter=new v.Emitter,this.onNameChange=this._onNameChangeEmitter.event,this._name="",this.init()}async init(){this.xterm=this.injector.get(S.XTerm,[{xtermOptions:{theme:this.theme.terminalTheme,...this.internalService.getOptions(),...this.terminalPreference.toJSON()}}]),this.addDispose(this.xterm),this.addDispose(this.internalService.onError(O=>{var M;this.messageService.error(O.message),!((M=O.launchConfig)===null||M===void 0)&&M.executable?this.updateTerminalName({name:"error: "+O.launchConfig.executable}):this.updateTerminalName({name:"error"})})),this.addDispose(this.internalService.onProcessChange(O=>{O.sessionId===this.id&&(0,s.transaction)(M=>{this.widget.processName.set(O.processName,M)})}))}onWidgetShow(){this._show&&(this._show.resolve(),this._show=null),this._layout()}async setupWidget(O){this._widget=O,this._prepare(),this.addDispose(v.Disposable.create(()=>{n.WORKSPACE_PATH_CACHED.delete(O.group.id)})),this.addDispose(this.terminalPreference.onChange(async({name:M,value:R})=>{!O.show&&!this._show&&(this._show=new v.Deferred),this._show&&await this._show.promise,this._setOption(M,R),this.xterm.updatePreferences({[M]:R})})),O.show?this.onWidgetShow():this.addDispose(O.onShow(M=>{M&&this.onWidgetShow()})),this.addDispose(O.onError(M=>{var R;M||((R=this._error)===null||R===void 0||R.resolve(),this._layout())})),this.addDispose(O.onResize(async()=>{this._debounceResize()}))}async init2(O,M){var R,P,k,F;if(this._uid=M?.id||O.id,this.setupWidget(O),!M||Object.keys(M).length===0){const j=await this.terminalProfileInternalService.resolveDefaultProfile();M={id:this._uid,config:j}}if(!M.cwd){const W=O.group.widgets.get();if(W.length>1&&W[0]){const U=await this.internalService.getCwd(W[0].id);U&&(M.cwd=U)}}await this._checkWorkspace();const L=(k=(R=M.cwd)!==null&&R!==void 0?R:(P=M?.config)===null||P===void 0?void 0:P.cwd)!==null&&k!==void 0?k:this._workspacePath,B=this.controller.convertProfileToLaunchConfig(M.config,L);this._launchConfig=B,this._launchConfig.__fromTerminalOptions&&(this._terminalOptions=this._launchConfig.__fromTerminalOptions),this.name=B.name||"",B.initialText&&this.xterm.raw.writeln(B.initialText),B.env||(B.env={}),(F=this.environmentService.mergedCollection)===null||F===void 0||F.applyToProcessEnvironment(B.env,this.applicationService.backendOS,this.variableResolver.resolve.bind(this.variableResolver)),this.addDispose(this.environmentService.onDidChangeCollections(j=>{j.applyToProcessEnvironment(B.env,this.applicationService.backendOS,this.variableResolver.resolve.bind(this.variableResolver))})),this._attachXterm(),this._attachAfterRender()}get name(){return this._name}set name(O){this._name!==O&&(this._name=O,this._onNameChangeEmitter.fire(O))}get term(){return this.xterm.raw}get pid(){return this.internalService.getProcessId(this.id)}get launchConfig(){return this._launchConfig}get createOptions(){}get container(){return this.xterm.container}get id(){return this._uid}get widget(){return this._widget}get ready(){return this._ready}get attached(){return this._attached}get firstOutput(){return this._firstStdout}get show(){return this._show}get areLinksReady(){return this._areLinksReady}get os(){return this._os}_prepareAddons(){this._attachAddon=new l.AttachAddon;const O=this._attachAddon.onBeforeProcessData;if(this.preferenceService.get("terminal.integrated.localEchoEnabled")){const M=this.preferenceService.get("terminal.integrated.localEchoExcludePrograms",A.DEFAULT_LOCAL_ECHO_EXCLUDE),R=new A.TypeAheadAddon(O,{localEchoExcludePrograms:Array.isArray(M)?M:A.DEFAULT_LOCAL_ECHO_EXCLUDE,localEchoLatencyThreshold:this.preferenceService.get("terminal.integrated.localEchoLatencyThreshold",30),localEchoStyle:this.preferenceService.get("terminal.integrated.localEchoStyle","dim")},this.preferenceService.onPreferenceChanged);this.addDispose(R),this.xterm.raw.loadAddon(R)}this.addDispose([this._attachAddon,this._attachAddon.onData(M=>{this._onOutput.fire({id:this.id,data:M})}),this._attachAddon.onExit(M=>{var R,P;this.logger.warn(`${this.id} ${this.name} exit with ${M}`),M!==0&&this.messageService.error(`terminal ${this.name}(${(P=(R=this._attachAddon.connection)===null||R===void 0?void 0:R.ptyInstance)===null||P===void 0?void 0:P.shellPath}) exited with non-zero code ${M}`),this._onExit.fire({id:this.id,code:M})}),this._attachAddon.onTime(M=>{this._onResponseTime.fire(M),this.reporter.performance(v.REPORT_NAME.TERMINAL_MEASURE,{duration:M,msg:"terminal.response"})})]),this.xterm.raw.loadAddon(this._attachAddon)}_xtermEvents(){this.addDispose(this.xterm.raw.onResize(O=>{this._hasOutput&&this._doResize()}))}_attachXterm(){this._prepareAddons(),this._xtermEvents(),this._linkManager=this.injector.get(f.TerminalLinkManager,[this.xterm.raw,this]),this._linkManager.processCwd=this._workspacePath,this.addDispose(this._linkManager),this._areLinksReady=!0,this._onLinksReady.fire(this)}_doResize(){this.internalService.resize(this.id,this.xterm.raw.cols,this.xterm.raw.rows)}_prepare(){var O,M,R,P,k;(O=this._attached)===null||O===void 0||O.reject("TerminalClient is Re-initialization"),(M=this._firstStdout)===null||M===void 0||M.reject("TerminalClient is Re-initialization"),(R=this._error)===null||R===void 0||R.reject("TerminalClient is Re-initialization"),(P=this._show)===null||P===void 0||P.reject("TerminalClient is Re-initialization"),this._ready=!1,this._hasOutput=!1,this._attached=new v.Deferred,this._show=new v.Deferred,this._error=new v.Deferred,this._firstStdout=new v.Deferred,(k=this._attachAddon)===null||k===void 0||k.setConnection(void 0),this.internalService.getOS().then(L=>{this._os=L});const{dispose:F}=this.onOutput(()=>{F(),this._hasOutput=!0,this._firstStdout.resolve()})}_attachAfterRender(){queueMicrotask(()=>{var O;this._layout(),this.attach(),this.focus(),this.widget.show||(O=this._show)===null||O===void 0||O.promise.then(async()=>{this._show=new v.Deferred})})}async _pickWorkspace(){var O;if(this.workspace.isMultiRootWorkspaceOpened&&!this._widget.recovery){const M=this.workspace.tryGetRoots();return await this.quickPick.show(M.map(P=>new v.URI(P.uri).codeUri.fsPath),{placeholder:(0,c.localize)("terminal.selectCWDForNewTerminal")})}else return this.workspace.workspace?new v.URI((O=this.workspace.workspace)===null||O===void 0?void 0:O.uri).codeUri.fsPath:void 0}async _checkWorkspace(){const O=this._widget;if(n.WORKSPACE_PATH_CACHED.has(O.group.id))this._workspacePath=n.WORKSPACE_PATH_CACHED.get(O.group.id);else{const M=await this._pickWorkspace();M&&(this._workspacePath=M,n.WORKSPACE_PATH_CACHED.set(O.group.id,this._workspacePath))}}async checkHealthy(){return await this.internalService.check([this.id])}displayUnHealthyMessage(){const O=this.term,M=O.options.theme,R=(k,F,L)=>{const B=" ",j=k.split(`
|
|
31995
|
+
`)}get status(){return this._validationStatus}}let h=class extends o.Disposable{constructor(){super(),this._onDidStateChange=new c.Emitter,this.onDidStateChange=this._onDidStateChange.event,this._onDidRegisterTaskProvider=new c.Emitter,this.onDidRegisterTaskProvider=this._onDidRegisterTaskProvider.event,this.providerHandler=0,this.runningTasks=new Map,this.toQuickOpenItem=d=>{var E;return new o.QuickOpenItem({label:d._label||"",detail:d instanceof _.ContributedTask?`${d.command.name||""} ${d.command.args?(E=d.command.args)===null||E===void 0?void 0:E.join(" "):""}`:void 0,run:f=>f===o.Mode.OPEN?(this.runTask(d),!0):!1})},this.providers=new Map,this.providerTypes=new Map,this.addDispose([this.taskSystem.onDidStateChange(d=>this._onDidStateChange.fire(d)),this.taskSystem.onDidBackgroundTaskBegin(d=>this._onDidStateChange.fire(d)),this.taskSystem.onDidBackgroundTaskEnded(d=>this._onDidStateChange.fire(d)),this.taskSystem.onDidProblemMatched(d=>this._onDidStateChange.fire(d))])}get outputChannel(){return this._outputChannel||(this._outputChannel=this.outputService.getChannel((0,o.localize)("task.outputchannel.name"))),this._outputChannel}get workspaceFolders(){return this._workspaceFolders||this.tryGetWorkspaceFolders(),this._workspaceFolders}tryGetWorkspaceFolders(){this._workspaceFolders=this.workspaceService.tryGetRoots().map(d=>o.Uri.parse(d.uri))}async runTaskCommand(){const d=await this.getGroupedTasks(),E=await this.getWorkspaceTasks(d),[f,l]=this.combineQuickItems(d,E);this.quickOpenService.open({onType:(b,y)=>y([...f,...l])},{placeholder:(0,o.formatLocalize)("TaskService.pickRunTask")})}run(d){return this.runTask(d)}async attach(d,E){if(this.runningTasks.has(d))return;const[,,,f]=d.split(",");if(f)if(this.providerTypes.has(f)){const l=await this.getTask(this.workspaceFolders[0],d);l&&(this.taskSystem.attach(l,E),this.runningTasks.set(d,l))}else{const l=this._onDidRegisterTaskProvider.event(async b=>{if(b===f){const y=await this.getTask(this.workspaceFolders[0],d);y&&(this.taskSystem.attach(y,E),this.runningTasks.set(d,y),l.dispose())}})}}async terminateTask(d){const E=this.taskSystem.getActiveTasks();for(const f of E)f._id===d&&await this.taskSystem.terminate(f)}getTask(d,E,f=!1){const l=(0,o.isString)(E)?E:this.taskDefinitionRegistry.createTaskIdentifier(E,console);return l===void 0?Promise.resolve(void 0):this.getWorkspaceGroupedTasks(d).then(b=>{if(!b)return Promise.resolve(void 0);const y=b.get(d.toString());if(!y)return Promise.resolve(void 0);for(const A of y)if(A.matches(l,f)||A._id===E||A._label===E)return A})}async runTask(d){const E=await this.taskSystem.run(d);return E.promise.then(f=>{this.runningTasks.has(d._id)&&this.runningTasks.delete(d._id),this.outputChannel.appendLine(`Task ${d._label} done, exit code ${f.exitCode}`)}),this.runningTasks.set(d._id,d),Promise.resolve(E.promise)}async tasks(d){var E;const f=await this.getWorkspaceGroupedTasks(),l=[];for(const b of f.values())for(const y of b)d&&d.type&&((E=y.getDefinition())===null||E===void 0?void 0:E.type)===d.type&&l.push(y);return l}async getWorkspaceGroupedTasks(d=this.workspaceFolders[0]){const E=await this.getGroupedTasks(),f=await this.getWorkspaceTasks(E),l=[];for(const A of E)A.tasks&&A.tasks.length>0&&l.push(...A.tasks);const b=f?.get(d.toString());b&&b.set&&l.push(...b.set.tasks);const y=new Map;return y.set(d.toString(),l),y}async getGroupedTasks(){const d={};for(const f of this.taskDefinitionRegistry.all())d[f.taskType]=!0;d.shell=!0,d.process=!0;const E=[];for(const[,f]of this.providers){const l=await f.provideTasks(d);E.push(l)}return E}toQuickOpenGroupItem(d,E,f){return new o.QuickOpenItem({groupLabel:d?(0,o.formatLocalize)("task.contribute"):void 0,run:E,showBorder:d,label:f,value:{type:f,grouped:!0},iconClass:(0,o.getIcon)("folder")})}combineQuickItems(d,E){var f,l;const b=[],y=[];let A=!0;for(const S of d){const w=D=>D===o.Mode.OPEN?(this.quickOpenService.open({onType:(I,O)=>S.tasks.length===0?O([new o.QuickOpenItem({value:"none",label:(0,o.formatLocalize)("task.cannotFindTask",S.type),run:M=>M===o.Mode.OPEN})]):O(S.tasks.map(this.toQuickOpenItem))}),!1):!0,T=this.toQuickOpenGroupItem(A,w,S.type);b.push(T),A=!1}if(E){for(const S of E.values())if(!((f=S.configurations)===null||f===void 0)&&f.byIdentifier&&Object.keys((l=S.configurations)===null||l===void 0?void 0:l.byIdentifier).forEach(w=>{var T;const D=(T=S.configurations)===null||T===void 0?void 0:T.byIdentifier[w];y.push(this.toQuickOpenItem(D))}),S.set&&S.set.tasks.length>0)for(const w of S.set.tasks)y.push(this.toQuickOpenItem(w))}return[y,b]}async getWorkspaceTasks(d){return this.updateWorkspaceTasks(d)}updateWorkspaceTasks(d){return this.workspaceFolders.length===0?Promise.resolve(new Map):this.workspaceFolders.length===1?this.computeWorkspaceFolderTasks(this.workspaceFolders[0],d).then(E=>{const f=new Map;return f.set(this.workspaceFolders[0].toString(),E),f}):Promise.resolve(void 0)}computeWorkspaceFolderTasks(d,E){return new Promise(async f=>{const l=this.preferences.get("tasks"),b=new Map;for(const y of E)for(const A of y.tasks)_.ContributedTask.is(A)&&b.set(A.defines._key,A);if(l&&l.tasks){let y;const A=[];let S=!1;const w=new a(this.outputChannel),T=(0,g.parse)({uri:d,name:d.path,index:0},c.platform,l,w,this.taskDefinitionRegistry,this.problemMatcher,this.problemPattern);if(T.validationStatus.isOK()||(S=!0,this.showOutput()),T.configured&&T.configured.length>0){y={byIdentifier:Object.create(null)};for(const D of T.configured)y.byIdentifier[D.configures._key]=D}A.push(...T.custom),y&&y.byIdentifier&&Object.keys(y.byIdentifier).forEach(D=>{if(b.has(D)){const I=(0,g.createCustomTask)(b.get(D),y.byIdentifier[D]);y.byIdentifier[D]=I}}),f({workspaceFolder:{uri:d,name:d.path,index:0},set:{tasks:A},configurations:y,hasErrors:S})}else f({workspaceFolder:{uri:d,name:d.path,index:0},set:{tasks:[]},configurations:{byIdentifier:{}},hasErrors:!1})})}showOutput(){this.outputChannel.appendLine("There are task errors. See the output for details.")}rerunLastTask(){return this.taskSystem.rerun()}registerTaskProvider(d,E){const f=this.providerHandler+=1;return this.providers.set(f,d),this.providerTypes.set(E,f),this._onDidRegisterTaskProvider.fire(E),{dispose:()=>{this.providers.delete(f),this.providerTypes.delete(E)}}}};t.TaskService=h,n.__decorate([(0,r.Autowired)(p.OutputService),n.__metadata("design:type",p.OutputService)],h.prototype,"outputService",void 0),n.__decorate([(0,r.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],h.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(o.QuickOpenService),n.__metadata("design:type",Object)],h.prototype,"quickOpenService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],h.prototype,"preferences",void 0),n.__decorate([(0,r.Autowired)(m.ITaskSystem),n.__metadata("design:type",Object)],h.prototype,"taskSystem",void 0),n.__decorate([(0,r.Autowired)(c.ITaskDefinitionRegistry),n.__metadata("design:type",Object)],h.prototype,"taskDefinitionRegistry",void 0),n.__decorate([(0,r.Autowired)(c.IProblemMatcherRegistry),n.__metadata("design:type",Object)],h.prototype,"problemMatcher",void 0),n.__decorate([(0,r.Autowired)(c.IProblemPatternRegistry),n.__metadata("design:type",Object)],h.prototype,"problemPattern",void 0),t.TaskService=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},66893:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalTaskSystem=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(80907),p=e(1041),v=e(12968),m=e(95268),{deepClone:_}=o.objects,{Path:s}=o.path;let g=class extends o.Disposable{constructor(){super(...arguments),this.executorId=0,this.activeTaskExecutors=new Map,this._onDidStateChange=new o.Emitter,this._onDidBackgroundTaskBegin=new o.Emitter,this._onDidBackgroundTaskEnded=new o.Emitter,this._onDidProblemMatched=new o.Emitter,this.taskExecutors=[],this.onDidStateChange=this._onDidStateChange.event,this.onDidBackgroundTaskBegin=this._onDidBackgroundTaskBegin.event,this.onDidBackgroundTaskEnded=this._onDidBackgroundTaskEnded.event,this.onDidProblemMatched=this._onDidProblemMatched.event}run(h){return this.currentTask=h,this.executeTask(h)}attach(h,u){return this.currentTask=h,this.attachTask(h,u)}async buildShellConfig(h){let u="";const d=h.name,E=h.args,f=[],l=[];if(d&&(typeof d=="string"?u=d:u=d.value),f.push(u),E)for(const b of E)typeof b=="string"?f.push(b):f.push(b.value);for(const b of f)b.indexOf(s.separator)>-1?l.push(await this.resolveVariables(b.split(s.separator))):l.push(await this.resolveVariable(b));return{args:["-c",`${l.join(" ")}`]}}findAvailableExecutor(){return this.taskExecutors.find(h=>h.taskStatus===m.TaskStatus.PROCESS_EXITED)}async createTaskExecutor(h,u){const d=await this.resolveMatchers(h.configurationProperties.problemMatchers),E=new v.ProblemCollector(d),f=this.injector.get(m.TerminalTaskExecutor,[h,u,E,this.executorId]);return this.executorId+=1,this.taskExecutors.push(f),this.addDispose(f.onDidTerminalWidgetRemove(()=>{this.taskExecutors=this.taskExecutors.filter(l=>l.executorId!==f.executorId)})),f}async attachTask(h,u){const E=(await this.createTaskExecutor(h,u.launchConfig)).attach(u);return this.lastTask=h,{task:h,kind:1,promise:E}}async executeTask(h){var u,d,E;const f=h.command&&h.command.runtime===p.RuntimeType.CustomExecution,l=await this.resolveMatchers(h.configurationProperties.problemMatchers),b=new v.ProblemCollector(l),{args:y}=await this.buildShellConfig(h.command),A={name:this.createTerminalName(h),args:y,isExtensionOwnedTerminal:f,env:((u=h.command.options)===null||u===void 0?void 0:u.env)||{},cwd:!((d=h.command.options)===null||d===void 0)&&d.cwd?await this.resolveVariable((E=h.command.options)===null||E===void 0?void 0:E.cwd):await this.resolveVariable("${workspaceFolder}"),disablePreserveHistory:!0};let S=this.findAvailableExecutor(),w=!1;S?(w=!0,S.updateProblemCollector(b),S.updateLaunchConfig(A),S.reset()):S=await this.createTaskExecutor(h,A),w?this._onDidStateChange.fire(p.TaskEvent.create("start",h,S.terminalId)):this.addDispose(S.onDidTerminalCreated(I=>{this._onDidStateChange.fire(p.TaskEvent.create("start",h,I))})),w||(this.addDispose(S.onDidTaskProcessExit(I=>{this._onDidStateChange.fire(p.TaskEvent.create("processEnded",h,I)),this._onDidStateChange.fire(p.TaskEvent.create("end",h))})),this.addDispose(S.onDidBackgroundTaskBegin(()=>this._onDidBackgroundTaskBegin.fire(p.TaskEvent.create("backgroundTaskBegin",h)))),this.addDispose(S.onDidBackgroundTaskEnd(()=>this._onDidBackgroundTaskEnded.fire(p.TaskEvent.create("backgroundTaskEnded",h)))),this.addDispose(S.onDidProblemMatched(I=>this._onDidProblemMatched.fire(p.TaskEvent.create("problemMatched",h,I)))));const T=S.execute(h,w),D=h.getMapKey();return this.activeTaskExecutors.set(D,{promise:Promise.resolve(T),task:h,executor:S}),this._onDidStateChange.fire(p.TaskEvent.create("active",h)),await S.processReady.promise,this._onDidStateChange.fire(p.TaskEvent.create("processStarted",h,S.processId)),this.lastTask=h,{task:h,kind:1,promise:T}}createTerminalName(h){return(0,o.formatLocalize)("TerminalTaskSystem.terminalName",h.getQualifiedLabel()||h.configurationProperties.name)}async resolveVariables(h){const u=[];for(const d of h)u.push(await this.resolveVariable(d));return u.join(s.separator)}async resolveVariable(h){if((0,o.isString)(h))return await this.variableResolver.resolve(h);if(h!==void 0)return{value:await this.variableResolver.resolve(h.value),quoting:h.quoting};throw new Error("Should never try to resolve undefined.")}async resolveMatchers(h){if(h==null||h.length===0)return[];const u=[];for(const d of h){let E;if((0,o.isString)(d)?d[0].startsWith("$")?E=this.problemMatcher.get(d.substring(1)):E=this.problemMatcher.get(d):E=d,!E)continue;const f=E.filePrefix!==void 0;if(!f)u.push(E);else{const l=_(E);f&&(l.filePrefix=await this.resolveVariable(l.filePrefix)),u.push(l)}}return u}getActiveTasks(){return Array.from(this.activeTaskExecutors.values()).map(h=>h.task)}async terminate(h){const u=h.getMapKey(),d=this.activeTaskExecutors.get(u);if(!d)return Promise.resolve({task:void 0,success:!0});const{success:E}=await d.executor.terminate();return this.activeTaskExecutors.delete(u),{task:h,success:E}}async rerun(){return this.lastTask&&await this.executeTask(this.lastTask)}isActive(){throw new Error("Method not implemented.")}isActiveSync(){throw new Error("Method not implemented.")}getBusyTasks(){throw new Error("Method not implemented.")}canAutoTerminate(){throw new Error("Method not implemented.")}terminateAll(){throw new Error("Method not implemented.")}revealTask(h){throw new Error("Method not implemented.")}customExecutionComplete(h,u){throw new Error("Method not implemented.")}};t.TerminalTaskSystem=g,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],g.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(o.IProblemMatcherRegistry),n.__metadata("design:type",Object)],g.prototype,"problemMatcher",void 0),n.__decorate([(0,r.Autowired)(c.IVariableResolverService),n.__metadata("design:type",Object)],g.prototype,"variableResolver",void 0),t.TerminalTaskSystem=g=n.__decorate([(0,r.Injectable)()],g)},93950:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ITaskSystem=t.ITaskExecutor=t.ITaskService=void 0,t.ITaskService=Symbol("ITaskService"),t.ITaskExecutor=Symbol("ITaskExecutor"),t.ITaskSystem=Symbol("ITaskSystem")},1041:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskEvent=t.TaskSorter=t.ExecutionEngine=t.InMemoryTask=t.ContributedTask=t.ConfiguringTask=t.CustomTask=t.CommonTask=t.RunOptions=t.RunOnOptions=t.TaskSourceKind=t.TaskGroup=t.CommandString=t.RuntimeType=t.PresentationOptions=t.PanelKind=t.RevealProblemKind=t.RevealKind=t.CommandOptions=t.CUSTOMIZED_TASK_TYPE=t.ShellQuoting=t.TASK_RUNNING_STATE=void 0;const n=e(40191),r=e(43718),{basename:o}=r.path;t.TASK_RUNNING_STATE=new n.RawContextKey("taskRunning",!1);var c;(function(D){D[D.Escape=1]="Escape",D[D.Strong=2]="Strong",D[D.Weak=3]="Weak"})(c||(t.ShellQuoting=c={})),t.CUSTOMIZED_TASK_TYPE="$customized",function(D){function I(O){if(!O)return D.Strong;switch(O.toLowerCase()){case"escape":return D.Escape;case"strong":return D.Strong;case"weak":return D.Weak;default:return D.Strong}}D.from=I}(c||(t.ShellQuoting=c={}));var p;(function(D){D.defaults={cwd:"${workspaceFolder}"}})(p||(t.CommandOptions=p={}));var v;(function(D){D[D.Always=1]="Always",D[D.Silent=2]="Silent",D[D.Never=3]="Never"})(v||(t.RevealKind=v={})),function(D){function I(O){switch(O.toLowerCase()){case"always":return D.Always;case"silent":return D.Silent;case"never":return D.Never;default:return D.Always}}D.fromString=I}(v||(t.RevealKind=v={}));var m;(function(D){D[D.Never=1]="Never",D[D.OnProblem=2]="OnProblem",D[D.Always=3]="Always"})(m||(t.RevealProblemKind=m={})),function(D){function I(O){switch(O.toLowerCase()){case"always":return D.Always;case"never":return D.Never;case"onproblem":return D.OnProblem;default:return D.OnProblem}}D.fromString=I}(m||(t.RevealProblemKind=m={}));var _;(function(D){D[D.Shared=1]="Shared",D[D.Dedicated=2]="Dedicated",D[D.New=3]="New"})(_||(t.PanelKind=_={})),function(D){function I(O){switch(O.toLowerCase()){case"shared":return D.Shared;case"dedicated":return D.Dedicated;case"new":return D.New;default:return D.Shared}}D.fromString=I}(_||(t.PanelKind=_={}));var s;(function(D){D.defaults={echo:!0,reveal:v.Always,revealProblems:m.Never,focus:!1,panel:_.Shared,showReuseMessage:!0,clear:!1}})(s||(t.PresentationOptions=s={}));var g;(function(D){D[D.Shell=1]="Shell",D[D.Process=2]="Process",D[D.CustomExecution=3]="CustomExecution",D[D.CustomExecution2=4]="CustomExecution2"})(g||(t.RuntimeType=g={})),function(D){function I(O){switch(O.toLowerCase()){case"shell":return D.Shell;case"process":return D.Process;case"customExecution":return D.CustomExecution;default:return D.Process}}D.fromString=I}(g||(t.RuntimeType=g={}));var a;(function(D){function I(O){return(0,r.isString)(O)?O:O.value}D.value=I})(a||(t.CommandString=a={}));var h;(function(D){D.Clean={_id:"clean",isDefault:!1},D.Build={_id:"build",isDefault:!1},D.Rebuild={_id:"rebuild",isDefault:!1},D.Test={_id:"test",isDefault:!1};function I(M){return M===D.Clean._id||M===D.Build._id||M===D.Rebuild._id||M===D.Test._id}D.is=I;function O(M){if(M!==void 0)return(0,r.isString)(M)?I(M)?{_id:M,isDefault:!1}:void 0:M}D.from=O})(h||(t.TaskGroup=h={}));var u;(function(D){D.Workspace="workspace",D.Extension="extension",D.InMemory="inMemory",D.WorkspaceFile="workspaceFile",D.User="user"})(u||(t.TaskSourceKind=u={}));var d;(function(D){D[D.default=1]="default",D[D.folderOpen=2]="folderOpen"})(d||(t.RunOnOptions=d={}));var E;(function(D){D.defaults={reevaluateOnRerun:!0,runOn:d.default}})(E||(t.RunOptions=E={}));class f{constructor(I,O,M,R,P,k){this._label="",this._id=I,O&&(this._label=O),M&&(this.type=M),this.runOptions=R,this.configurationProperties=P,this._source=k}getDefinition(I){}getMapKey(){return this._id}getRecentlyUsedKey(){}clone(){return this.fromObject(Object.assign({},this))}getWorkspaceFolder(){}getWorkspaceFileName(){}getTelemetryKind(){return"unknown"}matches(I,O=!1){if(I===void 0)return!1;if((0,r.isString)(I))return I===this._label||I===this.configurationProperties.identifier||O&&I===this._id;const M=this.getDefinition(!0);return M!==void 0&&M._key===I._key}getQualifiedLabel(){const I=this.getWorkspaceFolder();return I?`${this._label} (${I.name})`:this._label}getTaskExecution(){return{id:this._id,task:this}}addTaskLoadMessages(I){this._taskLoadMessages===void 0&&(this._taskLoadMessages=[]),I&&(this._taskLoadMessages=this._taskLoadMessages.concat(I))}get taskLoadMessages(){return this._taskLoadMessages}}t.CommonTask=f;class l extends f{constructor(I,O,M,R,P,k,F,L){super(I,M,void 0,F,L,O),this.command={},this._source=O,this.hasDefinedMatchers=k,P&&(this.command=P)}customizes(){if(this._source&&this._source.customizes)return this._source.customizes}getDefinition(I=!1){if(I&&this._source.customizes!==void 0)return this._source.customizes;{let O;switch(this.command?this.command.runtime:void 0){case g.Shell:O="shell";break;case g.Process:O="process";break;case g.CustomExecution:O="customExecution";break;case void 0:O="$composite";break;default:throw new Error("Unexpected task runtime")}return{type:O,_key:this._id,id:this._id}}}static is(I){return I instanceof l}getMapKey(){const I=this._source.config.workspaceFolder;return I?`${I.uri.toString()}|${this._id}`:this._id}getRecentlyUsedKey(){const I=this._source.config.workspaceFolder;if(!I)return;let O=this.configurationProperties.identifier;this._source.kind!==u.Workspace&&(O+=this._source.kind);const M={type:t.CUSTOMIZED_TASK_TYPE,folder:I.uri.toString(),id:O};return JSON.stringify(M)}getWorkspaceFolder(){return this._source.config.workspaceFolder}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?o(this._source.config.workspace.configuration.toString()):void 0}getTelemetryKind(){return this._source.customizes?"workspace>extension":"workspace"}fromObject(I){return new l(I._id,I._source,I._label,I.type,I.command,I.hasDefinedMatchers,I.runOptions,I.configurationProperties)}}t.CustomTask=l;class b extends f{constructor(I,O,M,R,P,k,F){super(I,M,R,k,F,O),this._source=O,this.configures=P}static is(I){return I instanceof b}fromObject(I){return I}getDefinition(){return this.configures}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?o(this._source.config.workspace.configuration.toString()):void 0}}t.ConfiguringTask=b;class y extends f{constructor(I,O,M,R,P,k,F,L,B){super(I,M,R,L,B,O),this.defines=P,this.hasDefinedMatchers=F,this.command=k}getDefinition(){return this.defines}static is(I){return I instanceof y}getMapKey(){const I=this._source.workspaceFolder;return I?`${this._source.scope.toString()}|${I.uri.toString()}|${this._id}`:`${this._source.scope.toString()}|${this._id}`}getRecentlyUsedKey(){const I={type:"contributed",scope:this._source.scope,id:this._id};return this._source.scope===3&&this._source.workspaceFolder&&(I.folder=this._source.workspaceFolder.uri.toString()),JSON.stringify(I)}getWorkspaceFolder(){return this._source.workspaceFolder}getTelemetryKind(){return"extension"}fromObject(I){return new y(I._id,I._source,I._label,I.type,I.defines,I.command,I.hasDefinedMatchers,I.runOptions,I.configurationProperties)}}t.ContributedTask=y;class A extends f{constructor(I,O,M,R,P,k){super(I,M,R,P,k,O),this._source=O}static is(I){return I instanceof A}getTelemetryKind(){return"composite"}fromObject(I){return new A(I._id,I._source,I._label,I.type,I.runOptions,I.configurationProperties)}}t.InMemoryTask=A;var S;(function(D){D[D.Process=1]="Process",D[D.Terminal=2]="Terminal"})(S||(t.ExecutionEngine=S={})),function(D){D._default=D.Terminal}(S||(t.ExecutionEngine=S={}));class w{constructor(I){this._order=new Map;for(let O=0;O<I.length;O++)this._order.set(I[O].uri.toString(),O)}compare(I,O){const M=I.getWorkspaceFolder(),R=O.getWorkspaceFolder();if(M&&R){let P=this._order.get(M.uri.toString());P=P===void 0?0:P+1;let k=this._order.get(R.uri.toString());return k=k===void 0?0:k+1,P===k?I._label.localeCompare(O._label):P-k}else return!M&&R?-1:M&&!R?1:0}}t.TaskSorter=w;var T;(function(D){function I(O,M,R){if(M){const P={kind:O,taskId:M._id,taskName:M.configurationProperties.name,runType:M.configurationProperties.isBackground?"background":"singleRun",group:M.configurationProperties.group,processId:void 0,exitCode:void 0,terminalId:void 0,__task:M};return O==="start"?P.terminalId=R:O==="processStarted"?P.processId=R:O==="processEnded"?P.exitCode=R:O==="problemMatched"&&(P.problems=R),Object.freeze(P)}else return Object.freeze({kind:"changed"})}D.create=I})(T||(t.TaskEvent=T={}))},90305:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(14041)),o=n.__importDefault(e(75655));let c=0,p=null;t.default=v=>{const{start:m,stop:_,self:s,left:g,right:a,wholeWidth:h,last:u}=v,d=l=>{c=l.clientX,p=s,m()},E=l=>{if(!c)return!1;const b=l.clientX,y=(b-c)/h*100;c=b,y<0?(s&&s.increase(y),a&&a.increase(-y)):p&&p===g&&(s&&s.increase(-y),g&&g.increase(y))},f=l=>{c=0,p=null,s.resize(),g&&g.resize(),a&&a.resize(),_()};return r.default.createElement("div",{className:o.default.resizeDelegetContainer,onMouseUp:f,onMouseMove:E},!u&&r.default.createElement("div",{className:o.default.resizeDelegateBar,onMouseDown:d,onMouseUp:f}))}},92699:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResizeDirection=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(41869),p=e(7473),v=n.__importDefault(e(90305)),m=n.__importDefault(e(75655));var _;(function(a){a[a.vertical=0]="vertical",a[a.horizontal=1]="horizontal"})(_||(t.ResizeDirection=_={}));const s=({index:a,widget:h,wholeWidth:u,setEvent:d,self:E,left:f,right:l,last:b})=>{const y=(0,c.useAutorun)(h.shadowDynamic);return o.default.createElement("div",{key:`resize-item-${a}`,style:{width:`${y}%`},className:m.default.resizeHandler},o.default.createElement(v.default,{wholeWidth:u,start:()=>d(!0),stop:()=>d(!1),self:E,left:f,right:l,last:b}))},g=({widget:a,dynamic:h,draw:u,handleRemoveWidget:d,widgetsLength:E})=>{const f=(0,c.useAutorun)(h);return o.default.createElement("div",{key:a.id,style:{width:`${f}%`},className:m.default.resizeItem},u(a),E>1&&o.default.createElement("div",{className:(0,r.default)(m.default.closeBtn,(0,c.getIcon)("close")),onClick:()=>{d(a.id)}}))};t.default=a=>{const{group:h,shadow:u}=a,d=(0,c.useAutorun)(h.widgets),[E,f]=o.default.useState(!1),[l,b]=o.default.useState(1/0),y=(0,c.useInjectable)(p.ITerminalGroupViewService),A=o.default.useRef(null);o.default.useEffect(()=>{A.current&&A.current.clientHeight!==l&&b(A.current.clientWidth)});const S=o.default.useCallback(w=>{y.removeWidget(w)},[]);return o.default.createElement("div",{className:m.default.resizeWrapper,ref:A},o.default.createElement("div",{style:{pointerEvents:E?"all":"none"},className:m.default.resizeDelegate},d&&d.map((w,T)=>{const D=T-1>-1?d[T-1]:null,I=d[T],O=T+1<d.length?d[T+1]:null;return o.default.createElement(s,{key:T,index:T,widget:w,wholeWidth:l,setEvent:f,self:I,left:D,right:O,last:T===d.length-1})})),o.default.createElement("div",{style:{pointerEvents:E?"none":"all"},className:m.default.resizePanel},d&&d.map(w=>o.default.createElement(g,{key:w.id,widget:w,dynamic:u?w.dynamic:w.shadowDynamic,draw:a.draw,handleRemoveWidget:S,widgetsLength:d.length}))))}},70483:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalSearch=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(14041)),c=e(97267),p=e(41869),v=e(26405),m=n.__importDefault(e(50587));t.TerminalSearch=o.default.memo(_=>{const s=(0,p.useInjectable)(v.ITerminalSearchService),[g,a]=o.default.useState(s.UIState),[h,u]=o.default.useState(null),[d,E]=o.default.useState(s.text||""),f=o.default.useRef(null);o.default.useEffect(()=>{const I=s.onVisibleChange(O=>{O&&f.current&&(f.current.focus(),f.current.value.length>0&&f.current.setSelectionRange(0,f.current.value.length))});return()=>I.dispose()},[s]),o.default.useEffect(()=>{if(!s.onResultChange)return;const I=s.onResultChange(O=>{u(O)});return()=>I.dispose()},[s]);const l=o.default.useCallback(I=>{s.text=I.target.value,s.search(),E(I.target.value)},[s]),b=o.default.useCallback(I=>{I.key==="Enter"&&s.search(),I.key==="Escape"&&(s.close(),s.clear())},[s]),y=o.default.useCallback(()=>{s.updateUIState({isMatchCase:!g.isMatchCase}),a(s.UIState)},[s,g]),A=o.default.useCallback(()=>{s.updateUIState({isUseRegexp:!g.isUseRegexp}),a(s.UIState)},[s,g]),S=o.default.useCallback(()=>{s.updateUIState({isWholeWord:!g.isWholeWord}),a(s.UIState)},[s,g]),w=o.default.useCallback(()=>{s.searchNext()},[s]),T=o.default.useCallback(()=>{s.searchPrevious()},[s]),D=o.default.useCallback(()=>{s.close()},[s]);return o.default.createElement("div",{className:m.default.terminalSearch},o.default.createElement(c.ValidateInput,{className:m.default.searchField,autoFocus:!0,id:"search-input-field",title:(0,p.localize)("search.input.placeholder"),type:"text",value:d,placeholder:(0,p.localize)("common.find"),onKeyDown:b,onChange:l,ref:f,validateMessage:void 0,addonAfter:[o.default.createElement("span",{key:(0,p.localize)("search.caseDescription"),className:(0,r.default)((0,p.getIcon)("ab"),m.default["match-case"],m.default.optionBtn,{[m.default.select]:g.isMatchCase}),title:(0,p.localize)("search.caseDescription"),onClick:y}),o.default.createElement("span",{key:(0,p.localize)("search.wordsDescription"),className:(0,r.default)((0,p.getIcon)("abl"),m.default["whole-word"],m.default.optionBtn,{[m.default.select]:g.isWholeWord}),title:(0,p.localize)("search.wordsDescription"),onClick:S}),o.default.createElement("span",{key:(0,p.localize)("search.regexDescription"),className:(0,r.default)((0,p.getIcon)("regex"),m.default["use-regexp"],m.default.optionBtn,{[m.default.select]:g.isUseRegexp}),title:(0,p.localize)("search.regexDescription"),onClick:A})]}),o.default.createElement("div",{className:m.default.searchResult},h?`${h.resultIndex+1}/${h.resultCount}`:"0/0"),o.default.createElement("div",{className:(0,r.default)(m.default.panelBtn,(0,p.getIcon)("up")),onClick:T}),o.default.createElement("div",{className:(0,r.default)(m.default.panelBtn,(0,p.getIcon)("down")),onClick:w}),o.default.createElement("div",{className:(0,r.default)(m.default.panelBtn,(0,p.getIcon)("close")),onClick:D}))})},65586:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderAddItem=t.renderInfoItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importDefault(e(12784)),c=n.__importStar(e(14041)),p=e(80564),v=e(41869),m=e(89897),_=e(1149),s=e(7443),g=e(26405),a=n.__importDefault(e(99886)),h=d=>{var E,f,l,b;const y=(0,v.useInjectable)(s.IconService),A=(0,o.default)(()=>d.onClick&&d.onClick(),20),S=(0,o.default)(()=>d.onClose&&d.onClose(),20),w=(0,v.useDesignStyles)(a.default.item_container,"item_container"),T=(0,v.useDesignStyles)(a.default.tab_item_selected,"tab_item_selected"),D=(0,v.useDesignStyles)(a.default.item_info_name,"item_info_name"),I=(0,v.useDesignStyles)(a.default.tab_close_icon,"tab_close_icon"),O=(0,v.useInjectable)(_.LayoutViewSizeConfig),M=(0,c.useRef)(null),{group:R}=d;if(!R)return null;const{options:P,id:k}=R,F=(0,v.useAutorun)(R.editable),L=(0,v.useAutorun)(R.snapshot),B=(0,c.useCallback)($=>{$.key==="Enter"&&d.onInputEnter&&k&&d.onInputEnter(k,$.target.value)},[k,d.onInputEnter]);(0,c.useEffect)(()=>{var $;d.selected&&(($=M.current)===null||$===void 0||$.scrollIntoView())},[M,d.selected]);let j;P?.icon&&(!((E=P.icon)===null||E===void 0)&&E.id?j=y.fromString(`$(${(f=P.icon)===null||f===void 0?void 0:f.id})`):P.icon instanceof v.URI?j=y.fromIcon(P?.icon.toString()):(!((l=P.icon)===null||l===void 0)&&l.light||!((b=P?.icon)===null||b===void 0)&&b.dark)&&(j=d.theme==="light"?y.fromIcon(P.icon.light.toString()):y.fromIcon(P.icon.dark.toString())));const W=(0,c.useCallback)($=>{var Y;(Y=d.onDragStart)===null||Y===void 0||Y.call(d,$)},[d.onDragStart]),U=(0,c.useCallback)($=>{$.preventDefault(),M.current&&M.current.classList.add("on-drag-over")},[M]),Q=(0,c.useCallback)(()=>{M.current&&M.current.classList.remove("on-drag-over")},[M]),V=(0,c.useCallback)($=>{var Y;M.current&&M.current.classList.remove("on-drag-over"),(Y=d.onDrop)===null||Y===void 0||Y.call(d,$)},[M,d.onDrop]);return c.default.createElement("div",{draggable:d.draggable,onDragStart:W,onDragOver:U,onDragLeave:Q,onDrop:V,ref:M,className:(0,r.default)({[w]:!0,[T]:!!d.selected}),style:{height:O.panelTitleBarHeight},onClick:()=>A(),onContextMenu:$=>d.onContextMenu&&d.onContextMenu($)},F?c.default.createElement("input",{autoFocus:!0,ref:$=>$&&$.select(),className:a.default.item_info_input,defaultValue:L,onClick:$=>$.stopPropagation(),onBlur:()=>d.onInputBlur&&R.id&&d.onInputBlur(R.id),onKeyDown:$=>B($)}):c.default.createElement("div",{id:R.id,className:D,title:L},L!==""?c.default.createElement(c.default.Fragment,null,c.default.createElement(p.Icon,{iconClass:j||(0,v.getIcon)(L?.toLowerCase()||"terminal")||(0,v.getIcon)("terminal"),style:{marginRight:4,color:"inherit",fontSize:14}}),c.default.createElement("span",{className:a.default.item_title},L)):c.default.createElement(m.Loading,null)),F?c.default.createElement("div",null):c.default.createElement("div",{className:(0,r.default)([(0,v.getIcon)("close"),I]),onClick:$=>{$.stopPropagation(),S()}}))};t.renderInfoItem=h;const u=d=>{const E=(0,o.default)(()=>d.onClick&&d.onClick(),20),f=d.getKeybinding&&d.getKeybinding(v.TERMINAL_COMMANDS.ADD.id),l=f?`${(0,v.localize)("terminal.new")}(${f})`:(0,v.localize)("terminal.new"),b=(0,v.useDesignStyles)(a.default.tab_item_wrapper,"tab_item_wrapper");return c.default.createElement("div",{className:b},c.default.createElement("div",{title:l,className:(0,r.default)({[(0,v.getIcon)("plus")]:!0,[a.default.item_add]:!0}),onClick:()=>E()}),c.default.createElement("div",{title:(0,v.localize)("terminal.new.type"),className:(0,r.default)({[(0,v.getIcon)("down")]:!0,[a.default.item_more]:!0}),onClick:d.onDropdown}))};t.renderAddItem=u,t.default=d=>{switch(d.type||g.ItemType.info){case g.ItemType.info:return(0,c.createElement)(d.provider.infoItemRender,d);case g.ItemType.add:return(0,c.createElement)(d.provider.addItemRender,d);default:return null}}},17632:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(52416),v=e(26405),m=e(88023),_=n.__importDefault(e(65586)),s=n.__importDefault(e(99886));t.default=()=>{const g=(0,c.useInjectable)(v.ITerminalGroupViewService),a=(0,c.useInjectable)(v.ITerminalRenderProvider),h=(0,c.useInjectable)(m.TerminalContextMenuService),u=(0,c.useInjectable)(p.IThemeService),d=(0,c.useInjectable)(c.KeybindingRegistry),E=(0,r.useRef)(),[f,l]=(0,r.useState)("dark"),b=(0,c.useDesignStyles)(s.default.tab_contents,"tab_contents"),y=(0,c.useAutorun)(g.groups),A=(0,c.useAutorun)(g.currentGroup),S=(0,r.useCallback)(()=>(u.getCurrentTheme().then(w=>{l(w.type)}),u.onThemeChange(w=>{l(w.type)})),[f,u]);return(0,r.useEffect)(()=>{const w=S();return()=>{w.dispose()}},[]),r.default.createElement("div",{className:s.default.view_container},r.default.createElement("div",{className:s.default.tabs},r.default.createElement(o.Scrollbars,{forwardedRef:w=>w?E.current=w.ref:null},r.default.createElement("div",{className:b},y.filter(Boolean).map((w,T)=>r.default.createElement(_.default,{draggable:!0,onDragStart:D=>{D.dataTransfer.setData("groupIndex",String(T))},onDrop:D=>{if(D.preventDefault(),D.dataTransfer.getData("groupIndex")){const I=D.dataTransfer.getData("groupIndex");g.swapGroup(Number(I),T),g.selectGroup(T)}},key:w.id,group:w,selected:A&&A.id===w.id,onInputBlur:()=>w.unedit(),onInputEnter:(D,I)=>w.rename(I),onClick:()=>g.selectGroup(T),onClose:()=>g.removeGroup(T),onContextMenu:D=>h.onTabContextMenu(D,T),provider:a,theme:f})),r.default.createElement("div",{className:s.default.button},r.default.createElement(_.default,{type:v.ItemType.add,onClick:()=>{const w=g.createGroup(),T=g.getGroup(w);g.createWidget(T),g.selectGroup(w)},getKeybinding:w=>{const T=d.getKeybindingsForCommand(w);return Array.isArray(T)&&T[0]&&d.acceleratorFor(T[0],"")[0]||""},onDropdown:w=>h.onDropDownContextMenu(w),provider:a,theme:f}))))))}},7066:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalVariable=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(43718),c=e(94620),p=n.__importDefault(e(74599));function v(_,s){_.forEach((g,a)=>{g.forEach(h=>{s.add((0,c.mutatorTypeLabel)(h.type,h.value,a))})})}const m=({diff:_})=>{const s=r.default.useMemo(()=>{const a=new Set;return _?.added&&_?.added.size>0&&v(_.added,a),_?.changed&&_.changed.size>0&&v(_.changed,a),Array.from(a.values())},[_]),g=r.default.useMemo(()=>{if(!_?.removed||_?.removed.size===0)return[];const a=new Set;return v(_.removed,a),Array.from(a.values())},[_]);return r.default.createElement("div",{className:p.default.variable_container},s.length>0&&r.default.createElement(r.default.Fragment,null,r.default.createElement("h3",null,(0,o.localize)("terminal.environment.changes")),s.map((a,h)=>r.default.createElement("p",{key:a+h,className:p.default.variable_change},a))),g.length>0&&r.default.createElement(r.default.Fragment,null,r.default.createElement("h3",null,(0,o.localize)("terminal.environment.removal")),g.map((a,h)=>r.default.createElement("p",{key:a+h,className:p.default.variable_change},a))))};t.TerminalVariable=m},48139:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(12784)),o=n.__importDefault(e(14041)),c=e(41869),p=e(26405),v=n.__importStar(e(92699)),m=e(70483),_=n.__importDefault(e(73567)),s=n.__importDefault(e(76970));e(86650),t.default=()=>{const g=(0,c.useInjectable)(p.ITerminalController),a=(0,c.useInjectable)(p.ITerminalSearchService),h=(0,c.useInjectable)(p.ITerminalErrorService),u=(0,c.useInjectable)(p.ITerminalNetwork),d=o.default.useRef(null),E=(0,c.useInjectable)(p.ITerminalGroupViewService),f=(0,c.useAutorun)(E.currentGroupId),l=(0,c.useAutorun)(E.currentGroupIndex),b=(0,c.useAutorun)(E.groups),[y,A]=o.default.useState(g.themeBackground);(0,c.useEventEffect)(g.onThemeBackgroundChange,M=>{A(M)});const[S,w]=o.default.useState(h.errors),T=(0,r.default)(()=>{w(h.errors)},c.FRAME_THREE);(0,c.useEventEffect)(h.onErrorsChange,T);const D=o.default.useCallback((M,R)=>{const P=g.findClientFromWidgetId(M.id);let k;return P?k=u.shouldReconnect(P.id)?void 0:S.get(P.id):k=S.get(M.id),o.default.createElement(s.default,{show:l===R,error:k,widget:M})},[l,g,S,u,E]),[I,O]=o.default.useState(a.isVisible);return(0,c.useEventEffect)(a.onVisibleChange,M=>{O(M)}),o.default.useEffect(()=>{d.current&&(g.initContextKey(d.current),g.viewReady.resolve())},[d.current]),o.default.createElement("div",{ref:d,className:_.default.terminalWrapper,style:{backgroundColor:y},"data-group-current":f},I&&o.default.createElement(m.TerminalSearch,null),b.map((M,R)=>{if(M.activated.get())return o.default.createElement("div",{"data-group-rendered":M.activated.get(),key:`terminal-${M.id}`,style:{display:l===R?"block":"none"},className:_.default.group,onFocus:g.focus.bind(g),onBlur:g.blur.bind(g),onContextMenu:g.onContextMenu.bind(g)},o.default.createElement(v.default,{shadow:!1,useFlex:!1,direction:v.ResizeDirection.horizontal,group:M,draw:P=>D(P,R)}))}))}},76970:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),c=e(26405),p=n.__importDefault(e(73567));function v(m,_,s){const g=()=>{s.removeWidget(m.id)},a=()=>{_.fix(m.id)};return m?.type===c.ETerminalErrorType.CREATE_FAIL?r.default.createElement("div",{className:p.default.terminalCover},r.default.createElement("div",null,(0,o.localize)("terminal.can.not.create"),": ",m.message),r.default.createElement("div",null,r.default.createElement("a",{onClick:g},(0,o.localize)("terminal.stop")),(0,o.localize)("terminal.or"),r.default.createElement("a",{onClick:a},(0,o.localize)("terminal.try.recreate")))):m.stopped?r.default.createElement("div",{className:p.default.terminalCover},r.default.createElement("div",null,(0,o.localize)("terminal.disconnected")),r.default.createElement("div",null,(0,o.localize)("terminal.can.not.reconnect"),r.default.createElement("a",{onClick:a},(0,o.localize)("terminal.try.reconnect")))):r.default.createElement("div",{className:p.default.terminalCover},r.default.createElement("div",null,(0,o.localize)("terminal.disconnected")),r.default.createElement("div",null,r.default.createElement("a",{onClick:g},(0,o.localize)("terminal.stop")),(0,o.localize)("terminal.or"),r.default.createElement("a",{onClick:a},(0,o.localize)("terminal.try.reconnect"))))}t.default=({widget:m,error:_,show:s})=>{const g=r.default.useRef(null),a=(0,o.useInjectable)(c.ITerminalErrorService),h=(0,o.useInjectable)(c.ITerminalGroupViewService);r.default.useEffect(()=>{if(g.current&&m.element)g.current.appendChild(m.element);else if(g.current&&!m.element){const d=document.createElement("div");g.current.appendChild(d),d.className=p.default.terminalContent,m.element=d}},[]),r.default.useEffect(()=>{m.show=s},[s]),r.default.useEffect(()=>{m.error=!!_},[_]);const u=()=>{h.selectWidget(m.id)};return r.default.createElement("div",{className:p.default.terminalContainer},_?v(_,a,h):null,r.default.createElement("div",{"data-term-id":m.id,style:{display:_?"none":"block"},className:p.default.terminalContentWrapper,onFocus:u,ref:g}))}},21623:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(71852),t),n.__exportStar(e(43397),t),n.__exportStar(e(7082),t),n.__exportStar(e(11476),t),n.__exportStar(e(63341),t),n.__exportStar(e(96051),t),n.__exportStar(e(79404),t)},71852:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalCommandContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(63067),p=e(26405),v=e(48520),m=e(35628),_=e(94620);let s=class{onReconnect(){this.terminalController.reconnect()}onDisposeSideEffects(){}setDefaultTerminalType(a){this.preference.update("terminal.type",a)}registerCommands(a){a.registerCommand({...o.TERMINAL_COMMANDS.OPEN_SEARCH,iconClass:(0,o.getIcon)("search")},{execute:()=>{if(this.search.isVisible){this.search.close();return}this.search.open()}}),a.registerCommand({...o.TERMINAL_COMMANDS.SPLIT,iconClass:(0,o.getIcon)("embed")},{execute:()=>{const h=this.view.currentGroup.get();if(!h)return;const u=this.view.createWidget(h);this.view.selectWidget(u.id)}}),a.registerCommand(o.TERMINAL_COMMANDS.CLEAR,{execute:()=>{this.view.clear()}}),a.registerCommand(o.TERMINAL_COMMANDS.ADD,{execute:async()=>{await this.terminalController.createTerminalWithWidget({}),this.terminalController.showTerminalPanel()}}),a.registerCommand(o.TERMINAL_COMMANDS.TOGGLE_TERMINAL,{execute:()=>{this.terminalController.toggleTerminalPanel()}}),a.registerCommand(o.TERMINAL_COMMANDS.SEARCH_NEXT,{execute:()=>{this.search.isVisible?this.search.search():this.search.open()}}),a.registerCommand({...o.TERMINAL_COMMANDS.REMOVE,iconClass:(0,o.getIcon)("delete")},{execute:async()=>{const h=this.view.currentWidgetId.get();h&&this.view.removeWidget(h)}}),a.registerCommand(o.TERMINAL_COMMANDS.OPEN_WITH_PATH,{execute:async h=>{h&&(await this.terminalApi.createTerminal({cwd:h.codeUri.fsPath})).show()}}),a.registerCommand(o.TERMINAL_COMMANDS.TAB_RENAME,{execute:async(h,u)=>{const d=this.view.getGroup(u);d&&d.edit()}}),a.registerCommand({...o.TERMINAL_COMMANDS.SELECT_ALL_CONTENT},{execute:()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.selectAll()}}),a.registerCommand({...o.TERMINAL_COMMANDS.CLEAR_CONTENT,iconClass:(0,o.getIcon)("clear")},{execute:()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.clear()}}),a.registerCommand({...o.TERMINAL_COMMANDS.CLEAR_ALL_CONTENT},{execute:()=>{this.terminalController.clearAllGroups()}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_ZSH,{execute:async()=>{this.setDefaultTerminalType("zsh")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_BASH,{execute:async()=>{this.setDefaultTerminalType("bash")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_SH,{execute:async()=>{this.setDefaultTerminalType("sh")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_POWERSHELL,{execute:async()=>{this.setDefaultTerminalType("powershell")}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_CMD,{execute:async()=>{this.setDefaultTerminalType("cmd")}}),a.registerCommand(o.TERMINAL_COMMANDS.MORE_SETTINGS,{execute:async()=>{this.commands.executeCommand(o.COMMON_COMMANDS.OPEN_PREFERENCES.id,"terminal")}}),a.registerCommand(o.TERMINAL_COMMANDS.COPY,{execute:async()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&await this.clipboardService.writeText(u.getSelection())}}),a.registerCommand(o.TERMINAL_COMMANDS.PASTE,{execute:async()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.paste(await this.clipboardService.readText())}}),a.registerCommand(o.TERMINAL_COMMANDS.SELECT_ALL,{execute:()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);u&&u.selectAll()}}),a.registerCommand(o.TERMINAL_COMMANDS.RE_LAUNCH,{execute:()=>{const h=this.view.groups.get();for(const u of h)u.widgets.get().forEach(E=>{const f=this.terminalController.findClientFromWidgetId(E.id);f&&f.reset()})}}),a.registerCommand(o.COMMON_COMMANDS.ENVIRONMENT_VARIABLE,{execute:async()=>await this.terminalEnvironmentService.getProcessEnv()}),a.registerCommand(o.TERMINAL_COMMANDS.FOCUS_NEXT_TERMINAL,{execute:()=>{const h=this.view.currentGroup.get();if(h&&h.widgets.get().length<=1)return;const u=this.getNextOrPrevTerminalClient("next");u?.focus()}}),a.registerCommand(o.TERMINAL_COMMANDS.FOCUS_PREVIOUS_TERMINAL,{execute:()=>{const h=this.view.currentGroup.get();if(h&&h.widgets.get().length<=1)return;const u=this.getNextOrPrevTerminalClient("prev");u?.focus()}}),a.registerCommand(o.TERMINAL_COMMANDS.KILL_PROCESS,{execute:async()=>{const h=this.view.currentWidgetId.get(),u=this.terminalController.findClientFromWidgetId(h);if(u){const d=u.getSelection();d&&d.length>0?await this.clipboardService.writeText(u.getSelection()):await this.terminalApi.sendText(h,"")}}})}getNextOrPrevTerminalClient(a){const h=this.view.currentGroup.get();if(!h)return;const u=h.widgets.get(),d=u.findIndex(l=>l.id===this.view.currentWidgetId.get());let E;a==="next"?E=d===u.length-1?0:d+1:E=d===0?u.length-1:d-1;const f=u[E];return this.terminalController.findClientFromWidgetId(f.id)}};t.TerminalCommandContribution=s,n.__decorate([(0,r.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(_.EnvironmentVariableServiceToken),n.__metadata("design:type",v.TerminalEnvironmentService)],s.prototype,"terminalEnvironmentService",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalGroupViewService),n.__metadata("design:type",Object)],s.prototype,"view",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalSearchService),n.__metadata("design:type",Object)],s.prototype,"search",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalRestore),n.__metadata("design:type",Object)],s.prototype,"store",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalApiService),n.__metadata("design:type",Object)],s.prototype,"terminalApi",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],s.prototype,"preference",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],s.prototype,"settingService",void 0),n.__decorate([(0,r.Autowired)(o.CommandService),n.__metadata("design:type",Object)],s.prototype,"commands",void 0),n.__decorate([(0,r.Autowired)(c.IMainLayoutService),n.__metadata("design:type",Object)],s.prototype,"mainlayoutService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],s.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",m.TerminalKeyBoardInputService)],s.prototype,"terminalInput",void 0),n.__decorate([(0,r.Autowired)(o.ILogger),n.__metadata("design:type",Object)],s.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(o.IClipboardService),n.__metadata("design:type",Object)],s.prototype,"clipboardService",void 0),t.TerminalCommandContribution=s=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ClientAppContribution)],s)},63341:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalKeybindingContribution=void 0;const n=e(85608),r=e(41869),o=e(66e3),c=e(40191),p=e(43718);let v=class{registerKeybindings(_){_.registerKeybinding({command:r.TERMINAL_COMMANDS.OPEN_SEARCH.id,keybinding:"ctrlcmd+f",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.CLEAR_CONTENT.id,keybinding:"ctrlcmd+k",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.SEARCH_NEXT.id,keybinding:"ctrlcmd+g",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.COPY.id,keybinding:p.isWindows?"ctrlcmd+shift+c":"ctrlcmd+c",when:c.RawContextKey.and(o.IsTerminalFocused.raw,"locationProtocol != http")}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.KILL_PROCESS.id,keybinding:"ctrlcmd+c",when:c.RawContextKey.and(o.IsTerminalFocused.raw,"locationProtocol != http","isWindows")}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.PASTE.id,keybinding:p.isWindows?"ctrlcmd+shift+v":"ctrlcmd+v",when:c.RawContextKey.and(o.IsTerminalFocused.raw,"locationProtocol != http")}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.SELECT_ALL.id,keybinding:"ctrlcmd+a",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.SPLIT.id,keybinding:"ctrlcmd+\\",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.ADD.id,keybinding:"ctrl+shift+`"}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_NEXT_TERMINAL.id,keybinding:"ctrlcmd+alt+right",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_NEXT_TERMINAL.id,keybinding:"ctrlcmd+alt+down",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_PREVIOUS_TERMINAL.id,keybinding:"ctrlcmd+alt+left",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.FOCUS_PREVIOUS_TERMINAL.id,keybinding:"ctrlcmd+alt+up",when:o.IsTerminalFocused.raw}),_.registerKeybinding({command:r.TERMINAL_COMMANDS.TOGGLE_TERMINAL.id,keybinding:"ctrl+`"})}};t.TerminalKeybindingContribution=v,t.TerminalKeybindingContribution=v=n.__decorate([(0,p.Domain)(r.KeybindingContribution)],v)},43397:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalLifeCycleContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(63067),p=e(26405),v=e(94620),m=e(43395),_=e(35628);let s=class{initialize(){(0,m.registerTerminalColors)()}onStart(){this.terminalInput.listen(),this.environmentService.initEnvironmentVariableCollections()}onDidRender(){this.store.restore().then(()=>{this.terminalController.firstInitialize()})}onStop(){this.terminalController.disposeTerminalClients({isTaskExecutor:!0}),this.store.save()}};t.TerminalLifeCycleContribution=s,n.__decorate([(0,r.Autowired)(),n.__metadata("design:type",_.TerminalKeyBoardInputService)],s.prototype,"terminalInput",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalRestore),n.__metadata("design:type",Object)],s.prototype,"store",void 0),n.__decorate([(0,r.Autowired)(v.EnvironmentVariableServiceToken),n.__metadata("design:type",Object)],s.prototype,"environmentService",void 0),t.TerminalLifeCycleContribution=s=n.__decorate([(0,o.Domain)(o.ClientAppContribution,c.MainLayoutContribution)],s)},7082:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalMenuContribution=t.more2=t.more1Sub=t.more1=t.group=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(30144),p=e(93899),v=e(43718),m=e(26405);t.group="panel_menu",t.more1="more_1",t.more1Sub="more_1_sub",t.more2="more_2";let _=class{registerMenus(g){g.registerMenuItem(p.MenuId.TerminalTabContext,{command:{id:o.TERMINAL_COMMANDS.TAB_RENAME.id,label:(0,o.localize)("terminal.menu.rename")},order:1,group:t.group}),g.registerMenuItem(p.MenuId.TerminalTabContext,{command:{id:o.TERMINAL_COMMANDS.SPLIT.id,label:(0,o.localize)("terminal.menu.split")},order:2,group:t.group}),g.registerMenuItem(p.MenuId.TerminalTabContext,{command:{id:o.TERMINAL_COMMANDS.REMOVE.id,label:(0,o.localize)("terminal.menu.stopGroup")},order:3,group:t.group}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.COPY,group:"1_modify"}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.PASTE,group:"1_modify"}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.SELECT_ALL,group:"1_modify"}),g.registerMenuItem(p.MenuId.TerminalInstanceContext,{command:o.TERMINAL_COMMANDS.CLEAR_CONTENT,group:"1_modify"});const a=(0,o.getSlotLocation)("@opensumi/ide-terminal-next",this.config.layoutConfig),h=(0,o.getTabbarCtxKey)(a),u=(0,p.getTabbarCommonMenuId)(a),d=`${h} == ${c.TERMINAL_CONTAINER_ID}`;g.registerMenuItem(u,{command:o.TERMINAL_COMMANDS.CLEAR,order:1,group:t.more1,when:d}),g.registerMenuItem(u,{command:o.TERMINAL_COMMANDS.CLEAR_ALL_CONTENT,order:1,group:t.more1,when:d}),g.registerMenuItem(u,{label:(0,o.localize)("terminal.menu.selectType"),submenu:p.MenuId.TerminalDefaultTypeMenu,order:1,group:t.more2,when:d}),v.isWindows?g.registerMenuItems(p.MenuId.TerminalDefaultTypeMenu,[{command:o.TERMINAL_COMMANDS.SELECT_CMD,order:1,group:t.more1Sub,toggledWhen:"config.terminal.type == cmd",when:d},{command:o.TERMINAL_COMMANDS.SELECT_POWERSHELL,order:2,group:t.more1Sub,toggledWhen:"config.terminal.type == powershell",when:d}]):g.registerMenuItems(p.MenuId.TerminalDefaultTypeMenu,[{command:o.TERMINAL_COMMANDS.SELECT_ZSH,order:1,group:t.more1Sub,toggledWhen:"config.terminal.type == zsh",when:d},{command:o.TERMINAL_COMMANDS.SELECT_BASH,order:2,group:t.more1Sub,toggledWhen:"config.terminal.type == bash",when:d},{command:o.TERMINAL_COMMANDS.SELECT_SH,order:3,group:t.more1Sub,toggledWhen:"config.terminal.type == sh",when:d}]),g.registerMenuItem(u,{command:o.TERMINAL_COMMANDS.MORE_SETTINGS,order:1,group:t.more2,when:d})}};t.TerminalMenuContribution=_,n.__decorate([(0,r.Autowired)(m.ITerminalController),n.__metadata("design:type",Object)],_.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(m.ITerminalGroupViewService),n.__metadata("design:type",Object)],_.prototype,"view",void 0),n.__decorate([(0,r.Autowired)(m.ITerminalSearchService),n.__metadata("design:type",Object)],_.prototype,"search",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],_.prototype,"settingService",void 0),n.__decorate([(0,r.Autowired)(v.CommandService),n.__metadata("design:type",Object)],_.prototype,"commands",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],_.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],_.prototype,"preference",void 0),t.TerminalMenuContribution=_=n.__decorate([(0,v.Domain)(p.MenuContribution)],_)},96051:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalNetworkContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(26405);let v=class extends c.WithEventBus{onStart(){this.network.bindErrors()}handleBrowserConnectionOpen(_){this.network.setStatus(p.TerminalNetworkStatus.CONNECTED)}handleBrowserConnectionClose(_){this.network.setStatus(p.TerminalNetworkStatus.DISCONNECTED)}};t.TerminalNetworkContribution=v,n.__decorate([(0,r.Autowired)(p.ITerminalNetwork),n.__metadata("design:type",Object)],v.prototype,"network",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalInternalService),n.__metadata("design:type",Object)],v.prototype,"service",void 0),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[c.BrowserConnectionOpenEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[c.BrowserConnectionCloseEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"handleBrowserConnectionClose",null),t.TerminalNetworkContribution=v=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],v)},79404:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalPreferenceContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(26405),v=e(3276),m=e(91815);let _=class{constructor(){this.schema=v.terminalPreferenceSchema;const g=["git-bash","powershell","cmd","default"],{properties:{["terminal.type"]:a}}={...v.terminalPreferenceSchema};this.ptyTerminal.getOS().then(h=>{h===c.OperatingSystem.Windows&&this.preferenceSchemaProvider.setSchema({properties:{"terminal.type":{...a,enum:g}}},!0)})}};t.TerminalPreferenceContribution=_,n.__decorate([(0,r.Autowired)(p.ITerminalService),n.__metadata("design:type",m.NodePtyTerminalService)],_.prototype,"ptyTerminal",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],_.prototype,"preferenceSchemaProvider",void 0),t.TerminalPreferenceContribution=_=n.__decorate([(0,c.Domain)(o.PreferenceContribution),n.__metadata("design:paramtypes",[])],_)},11476:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalRenderContribution=void 0;const r=e(85608),o=e(41869),c=e(30144),p=r.__importDefault(e(17632)),v=r.__importDefault(e(48139));let m=n=class{registerToolbarItems(s){s.registerItem({id:o.TERMINAL_COMMANDS.OPEN_SEARCH.id,command:o.TERMINAL_COMMANDS.OPEN_SEARCH.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.search")}),s.registerItem({id:o.TERMINAL_COMMANDS.CLEAR_CONTENT.id,command:o.TERMINAL_COMMANDS.CLEAR_CONTENT.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.menu.clearCurrentContent")}),s.registerItem({id:o.TERMINAL_COMMANDS.SPLIT.id,command:o.TERMINAL_COMMANDS.SPLIT.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.split")}),s.registerItem({id:o.TERMINAL_COMMANDS.REMOVE.id,command:o.TERMINAL_COMMANDS.REMOVE.id,viewId:n.viewId,tooltip:(0,o.localize)("terminal.remove")})}registerComponent(s){s.register("@opensumi/ide-terminal-next",{component:v.default,id:n.viewId},{title:(0,o.localize)("terminal.name"),priority:1,activateKeyBinding:"ctrl+`",containerId:n.viewId,titleComponent:p.default,draggable:!0,hideLocationTab:["right"]})}};t.TerminalRenderContribution=m,m.viewId=c.TERMINAL_CONTAINER_ID,t.TerminalRenderContribution=m=n=r.__decorate([(0,o.Domain)(o.ComponentContribution,o.TabBarToolbarContribution)],m)},17236:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalNextModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26405),p=e(94620),v=e(3276),m=e(21623),_=e(98944),s=e(69061),g=e(7734),a=e(48520),h=e(102),u=e(53891),d=e(82022),E=e(12642),f=e(13663),l=e(89570),b=e(94486),y=e(46666),A=e(70406),S=e(12894),w=e(91815),T=e(29041),D=e(68611);let I=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[m.TerminalLifeCycleContribution,m.TerminalRenderContribution,m.TerminalCommandContribution,m.TerminalMenuContribution,m.TerminalKeybindingContribution,m.TerminalNetworkContribution,m.TerminalPreferenceContribution,{token:c.ITerminalApiService,useClass:_.TerminalApiService},{token:c.ITerminalController,useClass:g.TerminalController},{token:c.ITerminalTheme,useClass:T.TerminalTheme},{token:c.ITerminalSearchService,useClass:S.TerminalSearchService},{token:c.ITerminalHoverManagerService,useClass:u.TerminalHoverManagerService},{token:c.ITerminalGroupViewService,useClass:D.TerminalGroupViewService},{token:c.ITerminalErrorService,useClass:h.TerminalErrorService},{token:c.ITerminalService,useClass:w.NodePtyTerminalService},{token:c.ITerminalInternalService,useClass:d.TerminalInternalService},{token:c.ITerminalRestore,useClass:A.TerminalRestore},{token:v.ITerminalPreference,useClass:f.TerminalPreference},{token:c.ITerminalRenderProvider,useClass:y.TerminalRenderProvider},{token:c.ITerminalClientFactory2,useFactory:s.createTerminalClientFactory2},{token:c.ITerminalNetwork,useClass:E.TerminalNetworkService},{token:p.EnvironmentVariableServiceToken,useClass:a.TerminalEnvironmentService},{token:c.ITerminalProfileService,useClass:l.TerminalProfileService},{token:c.ITerminalProfileInternalService,useClass:b.TerminalProfileInternalService}],this.backServices=[{servicePath:c.ITerminalServicePath,clientToken:c.ITerminalService},{servicePath:c.ITerminalProcessPath,clientToken:p.EnvironmentVariableServiceToken}]}};t.TerminalNextModule=I,t.TerminalNextModule=I=n.__decorate([(0,r.Injectable)()],I)},67245:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalBaseLinkProvider=void 0;class e{async provideLinks(r,o){var c;(c=this._activeLinks)===null||c===void 0||c.forEach(p=>p.dispose),this._activeLinks=await this._provideLinks(r),o(this._activeLinks)}}t.TerminalBaseLinkProvider=e},52826:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalExternalLinkProviderAdapter=void 0;const n=e(85608),r=e(76003),o=e(67245),c=e(28247),p=e(97144);let v=class extends o.TerminalBaseLinkProvider{constructor(_,s,g,a,h){super(),this._xterm=_,this._instance=s,this._externalLinkProvider=g,this._wrapLinkHandler=a,this._tooltipCallback=h}async _provideLinks(_){var s,g;let a=_-1,h=a;const u=[this._xterm.buffer.active.getLine(a)];for(;a>=0&&(!((s=this._xterm.buffer.active.getLine(a))===null||s===void 0)&&s.isWrapped);)u.unshift(this._xterm.buffer.active.getLine(a-1)),a--;for(;h<this._xterm.buffer.active.length&&(!((g=this._xterm.buffer.active.getLine(h+1))===null||g===void 0)&&g.isWrapped);)u.push(this._xterm.buffer.active.getLine(h+1)),h++;const d=(0,c.getXtermLineContent)(this._xterm.buffer.active,a,h,this._xterm.cols);if(d.trim().length===0)return[];const E=await this._externalLinkProvider.provideLinks(this._instance,d);return E?E.map(f=>{const l=(0,c.convertLinkRangeToBuffer)(u,this._xterm.cols,{startColumn:f.startIndex+1,startLineNumber:1,endColumn:f.startIndex+f.length+1,endLineNumber:1},a),b=d.substr(f.startIndex,f.length)||"",y=this._wrapLinkHandler((S,w)=>f.activate(w)),A=(S,w,T,D)=>this._tooltipCallback(S,w,T,D);return this.injector.get(p.TerminalLink,[this._xterm,l,b,this._xterm.buffer.active.viewportY,y,A,!0,f.label])}):[]}};t.TerminalExternalLinkProviderAdapter=v,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],v.prototype,"injector",void 0),t.TerminalExternalLinkProviderAdapter=v=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Object,Object,Function,Function])],v)},28247:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertLinkRangeToBuffer=e,t.convertBufferRangeToViewport=n,t.getXtermLineContent=r,t.positionIsInRange=o;function e(c,p,v,m){const _={start:{x:v.startColumn,y:v.startLineNumber+m},end:{x:v.endColumn-1,y:v.endLineNumber+m}};let s=0;const g=Math.ceil(v.startColumn/p);for(let u=0;u<Math.min(g);u++){const d=Math.min(p,v.startColumn-u*p);let E=0;const f=c[u];if(!f)break;for(let l=0;l<Math.min(p,d+E);l++){const b=f.getCell(l);b.getWidth()===2&&E++;const A=b.getChars();A.length>1&&(E-=A.length-1)}s+=E}let a=0;const h=Math.ceil(v.endColumn/p);for(let u=Math.max(0,g-1);u<h;u++){const d=u===g-1?(v.startColumn+s)%p:0,E=Math.min(p,v.endColumn+s-u*p),f=u===g-1?s:0;let l=0;const b=c[u];if(!b)break;for(let y=d;y<Math.min(p,E+l+f);y++){const A=b.getCell(y);A.getWidth()===2&&l++,y===p-1&&A.getChars()===""&&l++}a+=l}for(_.start.x+=s,_.end.x+=s+a;_.start.x>p;)_.start.x-=p,_.start.y++;for(;_.end.x>p;)_.end.x-=p,_.end.y++;return _}function n(c,p){return{start:{x:c.start.x-1,y:c.start.y-p-1},end:{x:c.end.x-1,y:c.end.y-p-1}}}function r(c,p,v,m){let _="";for(let s=p;s<=v;s++){const g=c.getLine(s);g&&(_+=g.translateToString(!0,0,m))}return _}function o(c,p){return!(c.y<p.start.y||c.y>p.end.y||c.y===p.start.y&&c.x<p.start.x||c.y===p.end.y&&c.x>p.end.x)}},29970:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalLinkManager=void 0;const n=e(85608),r=e(87083),o=e(76003),c=e(41869),p=e(43718),v=e(23418),m=e(14951),_=e(26405),s=e(69061),g=e(52826),a=e(11192),h=e(73481),u=e(67251),{posix:d,win32:E}=p.path;let f=class extends p.Disposable{constructor(b,y){super(),this._xterm=b,this._client=y,this._standardLinkProviders=[],this._standardLinkProvidersDisposables=new p.DisposableCollection;const A=this._wrapLinkHandler((D,I)=>this._handleProtocolLink(I)),S=this.injector.get(a.TerminalProtocolLinkProvider,[this._xterm,A,this._tooltipCallback.bind(this)]);this._standardLinkProviders.push(S);const w=this._wrapLinkHandler((D,I)=>this._handleLocalLink(I));this._wrappedTextLinkActivateCallback=w;const T=this.injector.get(h.TerminalValidatedLocalLinkProvider,[this._xterm,this._client,w,this._wrapLinkHandler.bind(this),this._tooltipCallback.bind(this),async(D,I)=>I(await this._resolvePath(D))]);this._standardLinkProviders.push(T),this.addTerminalWordLinkProvider(),this._registerStandardLinkProviders()}set processCwd(b){this._processCwd=b}addTerminalWordLinkProvider(){const b=this.injector.get(u.TerminalWordLinkProvider,[this._xterm,async(y,A)=>A(await this._resolvePath(y)),this._wrappedTextLinkActivateCallback]);this._standardLinkProviders.push(b)}async getTerminalCwd(){return await this.terminalService.getCwd(this._client.id)||this._processCwd}_registerStandardLinkProviders(){this._standardLinkProvidersDisposables.dispose(),this._standardLinkProvidersDisposables=new p.DisposableCollection;for(const b of this._standardLinkProviders)this._standardLinkProvidersDisposables.push(this._xterm.registerLinkProvider(b))}_tooltipCallback(b,y,A,S){const w=this._xterm._core,T={width:w._renderService.dimensions.css.cell.width,height:w._renderService.dimensions.css.cell.height},D={width:this._xterm.cols,height:this._xterm.rows},I=w.element.getBoundingClientRect();return this._showHover({viewportRange:y,cellDimensions:T,terminalDimensions:D,boundingClientRect:I,modifierDownCallback:A,modifierUpCallback:S},this._getLinkHoverString(b.text,b.label),O=>b.activate(void 0,O),b)}_showHover(b,y,A,S){const w=this._hoverManager.showHover(b,y,A);return S?.onInvalidated(()=>w.dispose()),p.Disposable.create(()=>w.dispose())}registerExternalLinkProvider(b,y){const A=this.injector.get(g.TerminalExternalLinkProviderAdapter,[this._xterm,b,y,this._wrapLinkHandler.bind(this),this._tooltipCallback.bind(this)]),S=this._xterm.registerLinkProvider(A);return this._registerStandardLinkProviders(),S}_wrapLinkHandler(b){return async(y,A)=>{y?.preventDefault(),!(y&&!this._isLinkActivationModifierDown(y))&&b(y,A)}}get _localLinkRegex(){const b=this._client.os===p.OperatingSystem.Windows?h.winLocalLinkClause:h.unixLocalLinkClause;return new RegExp(`${b}(${h.lineAndColumnClause})`)}async _handleLocalLink(b){const y=await this._resolvePath(b);if(!y)return;const A=this.extractLineColumnInfo(b),S={startLineNumber:A.lineNumber,endLineNumber:A.lineNumber,startColumn:A.columnNumber,endColumn:A.columnNumber};await this._editorService.open(y.uri,{range:S})}_handleHypertextLink(b){this._openerService.open(b)}async _handleProtocolLink(b){const y=p.URI.parse(b);if(y.scheme===p.Schemes.file){const A=p.FileUri.fsPath(y);this._handleLocalLink(this._client.os!==p.OperatingSystem.Windows&&p.isWindows?A.replace(/\\/g,d.sep):A);return}this._handleHypertextLink(b)}_isLinkActivationModifierDown(b){return p.isOSX?b.metaKey:b.ctrlKey}get osPath(){return this._client.os===p.OperatingSystem.Windows?E:d}_getLinkHoverString(b,y){const A=this.preferenceService.get("editor.multiCursorModifier");let S="";A==="ctrlCmd"?p.isMacintosh?S=(0,p.localize)("terminalLinkHandler.followLinkAlt.mac","option + click"):S=(0,p.localize)("terminalLinkHandler.followLinkAlt","alt + click"):p.isMacintosh?S=(0,p.localize)("terminalLinkHandler.followLinkCmd","cmd + click"):S=(0,p.localize)("terminalLinkHandler.followLinkCtrl","ctrl + click");const w=(0,p.localize)("followLink","Follow link");return y=y||w,`${y} (${S})`}async _getUserHomeDir(){const b=await this._fileSystem.getCurrentUserHome();if(!b)throw new Error("Unable to get user home directory");return await this._fileSystem.getFsPath(b.uri)}_getUserHomeDirOnce(){return this._getHomeDirPromise||(this._getHomeDirPromise=this._getUserHomeDir()),this._getHomeDirPromise}async _preprocessPath(b){if(b.charAt(0)==="~"){const y=await this._getUserHomeDirOnce();if(!y)return null;b=this.osPath.join(y,b.substring(1))}else if(b.charAt(0)!=="/"&&b.charAt(0)!=="~"){const y=await this.getTerminalCwd();if(this._client.os===p.OperatingSystem.Windows)if(!b.match("^"+h.winDrivePrefix)&&!b.startsWith("\\\\?\\")){if(!y)return null;b=this.osPath.join(y,b)}else b=b.replace(/^\\\\\?\\/,"");else{if(!y)return null;b=this.osPath.join(y,b)}}return b=this.osPath.normalize(b),b}async _resolvePath(b){const y=await this._preprocessPath(b);if(y)try{const A=p.URI.file(y),S=await this._fileService.getFileStat(A.toString());if(S)return{uri:A,isDirectory:S.isDirectory}}catch{return}}extractLineColumnInfo(b){const y=this._localLinkRegex.exec(b),A={lineNumber:1,columnNumber:1};if(!y)return A;const S=this._client.os===p.OperatingSystem.Windows?h.winLineAndColumnMatchIndex:h.unixLineAndColumnMatchIndex;for(let w=0;w<h.lineAndColumnClause.length;w++){const T=S+h.lineAndColumnClauseGroupCount*w,D=y[T];if(D){A.lineNumber=parseInt(D,10);const I=y[T+2];I&&(A.columnNumber=parseInt(I,10));break}}return A}extractLinkUrl(b){const y=this._localLinkRegex.exec(b);return y?y[1]:null}};t.TerminalLinkManager=f,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],f.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(_.ITerminalService),n.__metadata("design:type",Object)],f.prototype,"terminalService",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",v.WorkbenchEditorService)],f.prototype,"_editorService",void 0),n.__decorate([(0,o.Autowired)(c.IOpenerService),n.__metadata("design:type",Object)],f.prototype,"_openerService",void 0),n.__decorate([(0,o.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],f.prototype,"_fileService",void 0),n.__decorate([(0,o.Autowired)(m.IFileServiceClient),n.__metadata("design:type",Object)],f.prototype,"_fileSystem",void 0),n.__decorate([(0,o.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],f.prototype,"preferenceService",void 0),n.__decorate([(0,o.Autowired)(_.ITerminalHoverManagerService),n.__metadata("design:type",Object)],f.prototype,"_hoverManager",void 0),t.TerminalLinkManager=f=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[r.Terminal,s.TerminalClient])],f)},97144:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalLink=t.FOLDER_NOT_IN_WORKSPACE_LABEL=t.FOLDER_IN_WORKSPACE_LABEL=t.OPEN_FILE_LABEL=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(28247),v=500;t.OPEN_FILE_LABEL=(0,c.localize)("terminal.openFile","Open file in editor"),t.FOLDER_IN_WORKSPACE_LABEL=(0,c.localize)("terminal.focusFolder","Focus folder in explorer"),t.FOLDER_NOT_IN_WORKSPACE_LABEL=(0,c.localize)("terminal.openFolder","Open folder in new window");let m=class extends c.Disposable{get onInvalidated(){return this._onInvalidated.event}constructor(s,g,a,h,u,d,E,f){super(),this._xterm=s,this.range=g,this.text=a,this._viewportY=h,this._activateCallback=u,this._tooltipCallback=d,this._isHighConfidenceLink=E,this.label=f,this._onInvalidated=new c.Emitter,this.decorations={pointerCursor:!1,underline:this._isHighConfidenceLink}}dispose(){var s,g,a;super.dispose(),(s=this._hoverListeners)===null||s===void 0||s.dispose(),this._hoverListeners=void 0,(g=this._tooltipScheduler)===null||g===void 0||g.dispose(),this._tooltipScheduler=void 0,(a=this._tooltipDisposable)===null||a===void 0||a.dispose(),this._tooltipDisposable=void 0}activate(s,g){this._activateCallback(s,g)}hover(s,g){this._hoverListeners=new c.DisposableCollection,this._hoverListeners.push((0,o.addDisposableListener)(document,"keydown",h=>{!h.repeat&&this._isModifierDown(h)&&this._enableDecorations()})),this._hoverListeners.push((0,o.addDisposableListener)(document,"keyup",h=>{!h.repeat&&!this._isModifierDown(h)&&this._disableDecorations()})),this._hoverListeners.push(this._xterm.onRender(h=>{const u=this.range.start.y-this._viewportY;u>=h.start&&u<=h.end&&this._onInvalidated.fire()})),this._isHighConfidenceLink&&(this._tooltipScheduler=new c.RunOnceScheduler(()=>{var h,u;this._tooltipDisposable=(h=this._tooltipCallback)===null||h===void 0?void 0:h.call(this,this,(0,p.convertBufferRangeToViewport)(this.range,this._viewportY),this._isHighConfidenceLink?()=>this._enableDecorations():void 0,this._isHighConfidenceLink?()=>this._disableDecorations():void 0),(u=this._tooltipScheduler)===null||u===void 0||u.dispose(),this._tooltipScheduler=void 0},this.preferenceService.get("editor.hover.delay")||v),this._tooltipScheduler.schedule());const a={x:s.pageX,y:s.pageY};this._hoverListeners.push((0,o.addDisposableListener)(document,"mousemove",h=>{var u;this._isModifierDown(h)?this._enableDecorations():this._disableDecorations(),(Math.abs(h.pageX-a.x)>window.devicePixelRatio*2||Math.abs(h.pageY-a.y)>window.devicePixelRatio*2)&&(a.x=h.pageX,a.y=h.pageY,(u=this._tooltipScheduler)===null||u===void 0||u.schedule())}))}leave(){var s,g,a;(s=this._hoverListeners)===null||s===void 0||s.dispose(),this._hoverListeners=void 0,(g=this._tooltipScheduler)===null||g===void 0||g.dispose(),this._tooltipScheduler=void 0,(a=this._tooltipDisposable)===null||a===void 0||a.dispose(),this._tooltipDisposable=void 0}_enableDecorations(){this.decorations.pointerCursor||(this.decorations.pointerCursor=!0),this.decorations.underline||(this.decorations.underline=!0)}_disableDecorations(){this.decorations.pointerCursor&&(this.decorations.pointerCursor=!1),this.decorations.underline!==this._isHighConfidenceLink&&(this.decorations.underline=this._isHighConfidenceLink)}_isModifierDown(s){return c.isOSX?s.metaKey:s.ctrlKey}};t.TerminalLink=m,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.TerminalLink=m=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Object,String,Number,Function,Function,Boolean,Object])],m)},11192:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalProtocolLinkProvider=void 0;const n=e(85608),r=e(76003),o=e(26405),c=e(67245),p=e(28247),v=e(97144);let m=class extends c.TerminalBaseLinkProvider{constructor(g,a,h){super(),this._xterm=g,this._activateCallback=a,this._tooltipCallback=h}_provideLinks(g){var a,h;let u=g-1,d=u;const E=[this._xterm.buffer.active.getLine(u)];for(;u>=0&&(!((a=this._xterm.buffer.active.getLine(u))===null||a===void 0)&&a.isWrapped);)E.unshift(this._xterm.buffer.active.getLine(u-1)),u--;for(;d<this._xterm.buffer.active.length&&(!((h=this._xterm.buffer.active.getLine(d+1))===null||h===void 0)&&h.isWrapped);)E.push(this._xterm.buffer.active.getLine(d+1)),d++;return this._linkComputerTarget=new _(this._xterm,u,d),o.LinkComputer.computeLinks(this._linkComputerTarget).map(l=>{var b;const y=(0,p.convertLinkRangeToBuffer)(E,this._xterm.cols,l.range,u),A=(S,w,T,D)=>this._tooltipCallback(S,w,T,D);return this.injector.get(v.TerminalLink,[this._xterm,y,((b=l.url)===null||b===void 0?void 0:b.toString())||"",this._xterm.buffer.active.viewportY,this._activateCallback,A,!0,void 0])})}};t.TerminalProtocolLinkProvider=m,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],m.prototype,"injector",void 0),t.TerminalProtocolLinkProvider=m=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Function,Function])],m);class _{constructor(g,a,h){this._xterm=g,this._lineStart=a,this._lineEnd=h}getLineCount(){return 1}getLineContent(){return(0,p.getXtermLineContent)(this._xterm.buffer.active,this._lineStart,this._lineEnd,this._xterm.cols)}}},73481:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalValidatedLocalLinkProvider=t.lineAndColumnClauseGroupCount=t.unixLineAndColumnMatchIndex=t.winLineAndColumnMatchIndex=t.lineAndColumnClause=t.winLocalLinkClause=t.winDrivePrefix=t.unixLocalLinkClause=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(66894),p=e(43718),v=e(97408),m=e(67245),_=e(28247),s=e(97144),g="(\\.\\.?|\\~)",a="\\/",h="[^\\0\\s!`&*()\\[\\]'\":;\\\\]";t.unixLocalLinkClause="(("+g+"|("+h+")+)?("+a+"("+h+")+)+)",t.winDrivePrefix="(?:\\\\\\\\\\?\\\\)?[a-zA-Z]:";const u="("+t.winDrivePrefix+"|\\.\\.?|\\~)",d="(\\\\|\\/)",E="[^\\0<>\\?\\|\\/\\s!`&*()\\[\\]'\":;]";t.winLocalLinkClause="(("+u+"|("+E+")+)?("+d+"("+E+")+)+)",t.lineAndColumnClause=[`((\\S*)['"], line ((\\d+)( column (\\d+))?))`,`((\\S*)['"],((\\d+)(:(\\d+))?))`,"((\\S*) on line ((\\d+)(, column (\\d+))?))","((\\S*):line ((\\d+)(, column (\\d+))?))","(([^\\s\\(\\)]*)(\\s?[\\(\\[](\\d+)(,\\s?(\\d+))?)[\\)\\]])",`(([^:\\s\\(\\)<>'"\\[\\]]*)(:(\\d+))?(:(\\d+))?)`].join("|").replace(/ /g,"[\xA0 ]"),t.winLineAndColumnMatchIndex=12,t.unixLineAndColumnMatchIndex=11,t.lineAndColumnClauseGroupCount=6;const f=2e3;let l=class extends m.TerminalBaseLinkProvider{constructor(y,A,S,w,T,D){super(),this._xterm=y,this._client=A,this._activateFileCallback=S,this._wrapLinkHandler=w,this._tooltipCallback=T,this._validationCallback=D}async _provideLinks(y){var A,S;const w=[];let T=y-1,D=T;const I=[this._xterm.buffer.active.getLine(T)];for(;T>=0&&(!((A=this._xterm.buffer.active.getLine(T))===null||A===void 0)&&A.isWrapped);)I.unshift(this._xterm.buffer.active.getLine(T-1)),T--;for(;D<this._xterm.buffer.active.length&&(!((S=this._xterm.buffer.active.getLine(D+1))===null||S===void 0)&&S.isWrapped);)I.push(this._xterm.buffer.active.getLine(D+1)),D++;const O=(0,_.getXtermLineContent)(this._xterm.buffer.active,T,D,this._xterm.cols);if(O.length>f)return[];const M=new RegExp(this._localLinkRegex,"g");let R,P=-1;for(;(R=M.exec(O))!==null;){let k=R[0];if(!k||(P=O.indexOf(k,P+1),M.lastIndex=P+k.length,P<0))break;((O.startsWith("--- a/")||O.startsWith("+++ b/"))&&P===4||O.startsWith("diff --git")&&(k.startsWith("a/")||k.startsWith("b/")))&&(k=k.substring(2),P+=2);const F=await this.detectLocalLink(k,I,T,P,1);F.length>0&&w.push(...F)}return w}async detectLocalLink(y,A,S,w,T){const D=[],I=await new Promise(O=>{this._validationCallback(y,async M=>{if(M){const R=M.isDirectory?await this._isDirectoryInsideWorkspace(M.uri)?s.FOLDER_IN_WORKSPACE_LABEL:s.FOLDER_NOT_IN_WORKSPACE_LABEL:s.OPEN_FILE_LABEL,P=this._wrapLinkHandler((L,B)=>{M.isDirectory?this._handleLocalFolderLink(M.uri):this._activateFileCallback(L,B)}),k=(0,_.convertLinkRangeToBuffer)(A,this._xterm.cols,{startColumn:w+1,startLineNumber:1,endColumn:w+y.length+T,endLineNumber:1},S),F=(L,B,j,W)=>this._tooltipCallback(L,B,j,W);O(this.injector.get(s.TerminalLink,[this._xterm,k,y,this._xterm.buffer.active.viewportY,P,F,!0,R]))}else O(void 0)})});return I&&D.push(I),D}get _localLinkRegex(){const y=this._client.os===p.OperatingSystem.Windows?t.winLocalLinkClause:t.unixLocalLinkClause;return new RegExp(`${y}(${t.lineAndColumnClause})`)}async _handleLocalFolderLink(y){if(await this._isDirectoryInsideWorkspace(y)){await this.commandService.executeCommand("revealInExplorer",y);return}this.appConfig.isElectronRenderer&&this.windowService.openWorkspace(y,{newWindow:!0})}async _isDirectoryInsideWorkspace(y){const A=await this.workspaceService.roots;for(const S of A)if(p.URI.parse(S.uri).isEqualOrParent(y))return!0;return!1}};t.TerminalValidatedLocalLinkProvider=l,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],l.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(c.IWindowService),n.__metadata("design:type",Object)],l.prototype,"windowService",void 0),n.__decorate([(0,r.Autowired)(p.CommandService),n.__metadata("design:type",Object)],l.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(v.IWorkspaceService),n.__metadata("design:type",Object)],l.prototype,"workspaceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],l.prototype,"appConfig",void 0),t.TerminalValidatedLocalLinkProvider=l=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Function,Function,Function,Function,Function,Function])],l)},67251:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalWordLinkProvider=t.USUAL_WORD_SEPARATORS=void 0;const n=e(85608),r=e(87083),o=e(76003),c=e(74404),p=e(11050),v=e(66894),m=e(43718),_=e(92323),s=e(97408),g=e(70845),a=e(67245),h=e(28247),u=e(97144);t.USUAL_WORD_SEPARATORS=" ()[]{}',\"`\u2500\u2018\u2019\u201C\u201D|";let d=class extends a.TerminalBaseLinkProvider{constructor(f,l,b){super(),this._xterm=f,this._validationCallback=l,this._activateFileCallback=b,this._refreshSeparatorCodes()}_refreshSeparatorCodes(){let f="";for(let l=57520;l<=57535;l++)f+=String.fromCharCode(l);this._separatorRegex=new RegExp(`[${(0,g.escapeRegExpCharacters)(t.USUAL_WORD_SEPARATORS)}${f}]`,"g")}_provideLinks(f){const l=[],b=f-1,y=b,A=[this._xterm.buffer.active.getLine(b)],S=(0,h.getXtermLineContent)(this._xterm.buffer.active,b,y,this._xterm.cols);if(S===""||S.length>1024)return[];const w=this._parseWords(S);for(const T of w){if(T.text==="")continue;T.text.length>0&&T.text.charAt(T.text.length-1)===":"&&(T.text=T.text.slice(0,-1),T.endIndex--);const D=(0,h.convertLinkRangeToBuffer)(A,this._xterm.cols,{startColumn:T.startIndex+1,startLineNumber:1,endColumn:T.endIndex+1,endLineNumber:1},b),I=(O,M)=>{this._validationCallback(M,async R=>{if(R)R.isDirectory?this._handleLocalFolderLink(R.uri):this._activateFileCallback(O,M);else{const P=this.appConfig.openWordLinkWithPaletteOnTerminal;((0,m.isUndefined)(P)||P)&&this.quickOpenService.open(M)}})};l.push(this.injector.get(u.TerminalLink,[this._xterm,D,T.text,this._xterm.buffer.active.viewportY,I,void 0,!0,T.text]))}return l}async _handleLocalFolderLink(f){if(await this._isDirectoryInsideWorkspace(f)){await this.commandService.executeCommand("revealInExplorer",f);return}this.appConfig.isElectronRenderer&&this.windowService.openWorkspace(f,{newWindow:!0})}_parseWords(f){const l=[],b=f.split(this._separatorRegex);let y=0;for(let A=0;A<b.length;A++)l.push({text:b[A],startIndex:y,endIndex:y+b[A].length}),y+=b[A].length+1;return l}async _isDirectoryInsideWorkspace(f){const l=await this.workspaceService.roots;for(const b of l)if(m.URI.parse(b.uri).isEqualOrParent(f))return!0;return!1}};t.TerminalWordLinkProvider=d,n.__decorate([(0,o.Autowired)(p.AppConfig),n.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(_.CommandService),n.__metadata("design:type",Object)],d.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(v.IWindowService),n.__metadata("design:type",Object)],d.prototype,"windowService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],d.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(s.IWorkspaceService),n.__metadata("design:type",Object)],d.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(c.PrefixQuickOpenService),n.__metadata("design:type",Object)],d.prototype,"quickOpenService",void 0),t.TerminalWordLinkProvider=d=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[r.Terminal,Function,Function])],d)},62810:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_COL=t.DEFAULT_ROW=t.AttachAddon=void 0;const n=e(43718);class r extends n.Disposable{constructor(){super(...arguments),this._onData=new n.Emitter,this.onData=this._onData.event,this._onExit=new n.Emitter,this.onExit=this._onExit.event,this._onTime=new n.Emitter,this.onTime=this._onTime.event,this._lastInputTime=0,this._onBeforeProcessData=new n.Emitter,this.onBeforeProcessData=this._onBeforeProcessData.event}setConnection(c){this._disposeConnection&&(this._disposeConnection.dispose(),this._disposeConnection=null),this.connection=c,c&&(this._disposeConnection=new n.Disposable(c.onData(p=>{let v=p;if(typeof p=="string"){const m={data:p};this._onBeforeProcessData.fire(m),m.data!==void 0&&(v=m.data)}if(this._onData.fire(v),this._terminal.write(typeof v=="string"?v:new Uint8Array(v,0,v.byteLength)),this._lastInputTime){const m=Date.now()-this._lastInputTime;this._lastInputTime=0,this._onTime.fire(m)}})),c.onExit&&this._disposeConnection.addDispose(c.onExit(p=>{this._onExit.fire(p)})))}async activate(c){this._terminal=c,this.addDispose(n.Disposable.create(()=>{var p;return(p=this._disposeConnection)===null||p===void 0?void 0:p.dispose()})),this.addDispose(c.onData(p=>this._sendData(p))),this.addDispose(c.onBinary(p=>this._sendBinary(p)))}_sendData(c){!this.connection||this.connection.readonly||(this._timeResponse(),this.connection.sendData(c))}_sendBinary(c){if(!this.connection||this.connection.readonly)return;const p=new Uint8Array(c.length);for(let v=0;v<c.length;++v)p[v]=c.charCodeAt(v)&255;this._timeResponse(),this.connection.sendData(p)}_timeResponse(){this._lastInputTime=Date.now()}}t.AttachAddon=r,t.DEFAULT_ROW=80,t.DEFAULT_COL=24},98944:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalApiService=void 0;const n=e(85608),r=n.__importDefault(e(56005)),o=e(76003),c=e(43718),p=e(28423),v=e(26405);let m=class{constructor(){this._onDidOpenTerminal=new c.Emitter,this._onDidCloseTerminal=new c.Emitter,this._onDidTerminalTitleChange=new c.Emitter,this._onDidChangeActiveTerminal=new c.Emitter,this.onDidOpenTerminal=this._onDidOpenTerminal.event,this.onDidCloseTerminal=this._onDidCloseTerminal.event,this.onDidTerminalTitleChange=this._onDidTerminalTitleChange.event,this.onDidChangeActiveTerminal=this._onDidChangeActiveTerminal.event,this.controller.onDidOpenTerminal(s=>{this._onDidOpenTerminal.fire(s)}),this.controller.onDidCloseTerminal(s=>{this._onDidCloseTerminal.fire(s)}),this.controller.onDidTerminalTitleChange(s=>{this._onDidTerminalTitleChange.fire(s)}),this.controller.onDidChangeActiveTerminal(s=>{this._onDidChangeActiveTerminal.fire(s)})}get terminals(){return Array.from(this.controller.clients.values()).map(s=>({id:s.id,name:s.name,isActive:this.view.currentWidgetId.get()===s.id}))}async createTerminal(s,g){const a=await this.controller.createTerminalWithWidgetByTerminalOptions({terminalOptions:s,id:g}),h={get id(){return a.id},get name(){return a.name},get processId(){return a.pid},show:(u=!0)=>{const d=a.widget;this.view.selectWidget(d.id),this.controller.showTerminalPanel(),u||setTimeout(()=>a.focus())},hide:()=>{this.controller.hideTerminalPanel()},dispose:()=>{this.view.removeWidget(a.widget.id),this.controller.clients.delete(a.id)}};return await a.attached.promise,h.show(),h}async getProcessId(s){const g=this.controller.clients.get(s);if(g)return g.pid}async getDefaultShellPath(){const s=await this.terminalProfileInternalService.resolveDefaultProfile();return s?.path||"/bin/bash"}sendText(s,g,a=!0){this.service.sendText(s,`${g}${a?"\r":""}`)}showTerm(s,g=!0){const a=this.controller.clients.get(s);if(!a)return;const h=a.widget;this.view.selectWidget(h.id),this.controller.showTerminalPanel(),g||setTimeout(()=>a.focus())}hideTerm(s){this.controller.clients.get(s)&&this.controller.hideTerminalPanel()}removeTerm(s){const g=this.controller.clients.get(s);g&&(this.view.removeWidget(g.widget.id),this.controller.clients.delete(s))}createWidget(s,g){const a=s,h=this.view.createGroup(),u=this.view.getGroup(h),d=this.view.createWidget(u,a,!1,!0);return(0,p.transaction)(E=>{d.name.set((0,r.default)(s),E)}),this.view.selectWidget(a),d.onRender(()=>{g(d.element)}),d}scheduleReconnection(){return this.network.scheduleReconnection()}};t.TerminalApiService=m,n.__decorate([(0,o.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],m.prototype,"controller",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalGroupViewService),n.__metadata("design:type",Object)],m.prototype,"view",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalInternalService),n.__metadata("design:type",Object)],m.prototype,"service",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalNetwork),n.__metadata("design:type",Object)],m.prototype,"network",void 0),n.__decorate([(0,o.Autowired)(v.ITerminalProfileInternalService),n.__metadata("design:type",Object)],m.prototype,"terminalProfileInternalService",void 0),t.TerminalApiService=m=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],m)},69061:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.createTerminalClientFactory2=t.TerminalClientFactory=t.TerminalClient=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(67889),v=e(43718),m=e(23418),_=e(42933),s=e(28423),g=e(72665),a=e(88913),h=e(10560),u=e(26405),d=e(94620),E=e(3276),f=e(29970),l=e(62810),b=e(90853),y=e(35628),A=e(70845),S=e(41685);let w=n=class extends v.Disposable{constructor(){super(),this.isTaskExecutor=!1,this._ready=!1,this._hasOutput=!1,this._areLinksReady=!1,this._onInput=new v.Emitter,this.onInput=this._onInput.event,this._onOutput=new v.Emitter,this.onOutput=this._onOutput.event,this._onExit=new v.Emitter,this.onExit=this._onExit.event,this._onTitleChange=new v.Emitter,this.onTitleChange=this._onTitleChange.event,this._onLinksReady=new v.Emitter,this.onLinksReady=this._onLinksReady.event,this._onResponseTime=new v.Emitter,this.onResponseTime=this._onResponseTime.event,this._onNameChangeEmitter=new v.Emitter,this.onNameChange=this._onNameChangeEmitter.event,this._name="",this.init()}async init(){this.xterm=this.injector.get(S.XTerm,[{xtermOptions:{theme:this.theme.terminalTheme,...this.internalService.getOptions(),...this.terminalPreference.toJSON()}}]),this.addDispose(this.xterm),this.addDispose(this.internalService.onError(O=>{var M;this.messageService.error(O.message),!((M=O.launchConfig)===null||M===void 0)&&M.executable?this.updateTerminalName({name:"error: "+O.launchConfig.executable}):this.updateTerminalName({name:"error"})})),this.addDispose(this.internalService.onProcessChange(O=>{O.sessionId===this.id&&(0,s.transaction)(M=>{this.widget.processName.set(O.processName,M)})}))}onWidgetShow(){this._show&&(this._show.resolve(),this._show=null),this._layout()}async setupWidget(O){this._widget=O,this._prepare(),this.addDispose(v.Disposable.create(()=>{n.WORKSPACE_PATH_CACHED.delete(O.group.id)})),this.addDispose(this.terminalPreference.onChange(async({name:M,value:R})=>{!O.show&&!this._show&&(this._show=new v.Deferred),this._show&&await this._show.promise,this._setOption(M,R),this.xterm.updatePreferences({[M]:R})})),O.show?this.onWidgetShow():this.addDispose(O.onShow(M=>{M&&this.onWidgetShow()})),this.addDispose(O.onError(M=>{var R;M||((R=this._error)===null||R===void 0||R.resolve(),this._layout())})),this.addDispose(O.onResize(async()=>{this._debounceResize()}))}async init2(O,M){var R,P,k,F;if(this._uid=M?.id||O.id,this.setupWidget(O),!M||Object.keys(M).length===0){const j=await this.terminalProfileInternalService.resolveDefaultProfile();M={id:this._uid,config:j}}if(!M.cwd){const W=O.group.widgets.get();if(W.length>1&&W[0]){const U=await this.internalService.getCwd(W[0].id);U&&(M.cwd=U)}}await this._checkWorkspace();const L=(k=(R=M.cwd)!==null&&R!==void 0?R:(P=M?.config)===null||P===void 0?void 0:P.cwd)!==null&&k!==void 0?k:this._workspacePath,B=this.controller.convertProfileToLaunchConfig(M.config,L);this._launchConfig=B,this._launchConfig.__fromTerminalOptions&&(this._terminalOptions=this._launchConfig.__fromTerminalOptions),this.name=B.name||"",B.initialText&&this.xterm.raw.writeln(B.initialText),B.env||(B.env={}),(F=this.environmentService.mergedCollection)===null||F===void 0||F.applyToProcessEnvironment(B.env,this.applicationService.backendOS,this.variableResolver.resolve.bind(this.variableResolver)),this.addDispose(this.environmentService.onDidChangeCollections(j=>{j.applyToProcessEnvironment(B.env,this.applicationService.backendOS,this.variableResolver.resolve.bind(this.variableResolver))})),this._attachXterm(),this._attachAfterRender()}get name(){return this._name}set name(O){this._name!==O&&(this._name=O,this._onNameChangeEmitter.fire(O))}get term(){return this.xterm.raw}get pid(){return this.internalService.getProcessId(this.id)}get launchConfig(){return this._launchConfig}get createOptions(){}get container(){return this.xterm.container}get id(){return this._uid}get widget(){return this._widget}get ready(){return this._ready}get attached(){return this._attached}get firstOutput(){return this._firstStdout}get show(){return this._show}get areLinksReady(){return this._areLinksReady}get os(){return this._os}_prepareAddons(){this._attachAddon=new l.AttachAddon;const O=this._attachAddon.onBeforeProcessData;if(this.preferenceService.get("terminal.integrated.localEchoEnabled")){const M=this.preferenceService.get("terminal.integrated.localEchoExcludePrograms",A.DEFAULT_LOCAL_ECHO_EXCLUDE),R=new A.TypeAheadAddon(O,{localEchoExcludePrograms:Array.isArray(M)?M:A.DEFAULT_LOCAL_ECHO_EXCLUDE,localEchoLatencyThreshold:this.preferenceService.get("terminal.integrated.localEchoLatencyThreshold",30),localEchoStyle:this.preferenceService.get("terminal.integrated.localEchoStyle","dim")},this.preferenceService.onPreferenceChanged);this.addDispose(R),this.xterm.raw.loadAddon(R)}this.addDispose([this._attachAddon,this._attachAddon.onData(M=>{this._onOutput.fire({id:this.id,data:M})}),this._attachAddon.onExit(M=>{var R,P;this.logger.warn(`${this.id} ${this.name} exit with ${M}`),M!==0&&this.messageService.error(`terminal ${this.name}(${(P=(R=this._attachAddon.connection)===null||R===void 0?void 0:R.ptyInstance)===null||P===void 0?void 0:P.shellPath}) exited with non-zero code ${M}`),this._onExit.fire({id:this.id,code:M})}),this._attachAddon.onTime(M=>{this._onResponseTime.fire(M),this.reporter.performance(v.REPORT_NAME.TERMINAL_MEASURE,{duration:M,msg:"terminal.response"})})]),this.xterm.raw.loadAddon(this._attachAddon)}_xtermEvents(){this.addDispose(this.xterm.raw.onResize(O=>{this._hasOutput&&this._doResize()}))}_attachXterm(){this._prepareAddons(),this._xtermEvents(),this._linkManager=this.injector.get(f.TerminalLinkManager,[this.xterm.raw,this]),this._linkManager.processCwd=this._workspacePath,this.addDispose(this._linkManager),this._areLinksReady=!0,this._onLinksReady.fire(this)}_doResize(){this.internalService.resize(this.id,this.xterm.raw.cols,this.xterm.raw.rows)}_prepare(){var O,M,R,P,k;(O=this._attached)===null||O===void 0||O.reject("TerminalClient is Re-initialization"),(M=this._firstStdout)===null||M===void 0||M.reject("TerminalClient is Re-initialization"),(R=this._error)===null||R===void 0||R.reject("TerminalClient is Re-initialization"),(P=this._show)===null||P===void 0||P.reject("TerminalClient is Re-initialization"),this._ready=!1,this._hasOutput=!1,this._attached=new v.Deferred,this._show=new v.Deferred,this._error=new v.Deferred,this._firstStdout=new v.Deferred,(k=this._attachAddon)===null||k===void 0||k.setConnection(void 0),this.internalService.getOS().then(L=>{this._os=L});const{dispose:F}=this.onOutput(()=>{F(),this._hasOutput=!0,this._firstStdout.resolve()})}_attachAfterRender(){queueMicrotask(()=>{var O;this._layout(),this.attach(),this.focus(),this.widget.show||(O=this._show)===null||O===void 0||O.promise.then(async()=>{this._show=new v.Deferred})})}async _pickWorkspace(){var O;if(this.workspace.isMultiRootWorkspaceOpened&&!this._widget.recovery){const M=this.workspace.tryGetRoots();return await this.quickPick.show(M.map(P=>new v.URI(P.uri).codeUri.fsPath),{placeholder:(0,c.localize)("terminal.selectCWDForNewTerminal")})}else return this.workspace.workspace?new v.URI((O=this.workspace.workspace)===null||O===void 0?void 0:O.uri).codeUri.fsPath:void 0}async _checkWorkspace(){const O=this._widget;if(n.WORKSPACE_PATH_CACHED.has(O.group.id))this._workspacePath=n.WORKSPACE_PATH_CACHED.get(O.group.id);else{const M=await this._pickWorkspace();M&&(this._workspacePath=M,n.WORKSPACE_PATH_CACHED.set(O.group.id,this._workspacePath))}}async checkHealthy(){return await this.internalService.check([this.id])}displayUnHealthyMessage(){const O=this.term,M=O.options.theme,R=(k,F,L)=>{const B=" ",j=k.split(`
|
|
31998
31996
|
`).map(U=>B+U+B).join(`
|
|
31999
31997
|
`),W=`\x1B[48;2;${P(F)};38;2;${P(L)}m${j}\x1B[0m`;O.writeln(`
|
|
32000
31998
|
`),O.writeln(`
|