t.command===e);eu.removeFirstOf(this._items,t)}else this._items.forEach(t=>{e(t.command)&&eu.removeFirstOf(this._items,t)})}addItem(e){var t=eq.createItem(e,this._idTick++);return this._items.push(t),eX.JT.create(()=>{eu.removeFirstOf(this._items,t)})}close(){this.menu.close()}open(e,t){if(i4.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;var n=eq.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!n||0===n.length)return!1;for(var r of n){if(t&&(r.args=t),!r.filter||!!r.filter(t))this.menu.addItem(r)}return this.menu.open(e.clientX,e.clientY),!0}constructor(){this._groupByTarget=!0,this._idTick=0,this._items=[],this._sortBySelector=!0}}(0,e2.gn)([(0,e8.f)(i2),(0,e2.w6)("design:type",void 0===i2?Object:i2)],i6.prototype,"menuFactory",void 0),(0,e2.gn)([(0,td.z)(),(0,e2.w6)("design:type",Function),(0,e2.w6)("design:paramtypes",[]),(0,e2.w6)("design:returntype",void 0)],i6.prototype,"init",null),i6=(0,e2.gn)([(0,e4.b)()],i6),!function(e){e.createItem=function(e,t){var n=function(e){if(-1!==e.indexOf(","))throw Error("Selector cannot contain commas: ".concat(e));if(!ey.isValid(e))throw Error("Invalid selector: ".concat(e));return e}(e.selector),r=void 0!==e.rank?e.rank:1/0;return(0,tv._)((0,tm._)({},e),{selector:n,rank:r,id:t})};e.matchItems=function(e,r,o,a){var s=r.target;if(!s)return null;var l=r.currentTarget;if(!l)return null;for(var c=[],d=e.slice();null!==s;){for(var u=[],h=0,p=d.length;h{this.contextMenu.deleteItem(e)})}clearMenuItem(e){}addMenuItem(e){this.contextMenu.addItem(e)}createSubMenu(){return this.menuFactory()}addSubMenuItem(e,t){e.addItem(t)}open(e,t){return this.contextMenu.open(e,t)}close(){this.contextMenu.close()}}(0,e2.gn)([(0,e8.f)(i6),(0,e2.w6)("design:type",void 0===i6?Object:i6)],i3.prototype,"contextMenu",void 0),(0,e2.gn)([(0,e8.f)(i2),(0,e2.w6)("design:type",void 0===i2?Object:i2)],i3.prototype,"menuFactory",void 0),i3=(0,e2.gn)([(0,e4.b)()],i3);var i8=e0({containerModules:[new eQ.n(e=>{e(i5).toService(i3),(0,eX.KV)(e,i3,[eG]),e(i2).toFactory(e=>()=>{var t=e.container.createChild();return t.bind(i4).toSelf().inSingletonScope(),t.get(i4)}),e(i6).toSelf().inSingletonScope()})]}),i9=Symbol("TabBarRendererFactory");(0,rp.GW)((0,e4.b)(),rZ.Renderer);class i7 extends rZ.Renderer{dispose(){this.toDispose.dispose()}set tabBar(e){if(this._tabBar!==e)this._tabBar=e}get tabBar(){return this._tabBar}renderTab(e,t,n){var r=e.title,o=this.shortcutsService.getLabelWithShortcutUI(eX.mY.Default.VIEW_CLOSE_CURRENT_WIDGET),a=this.tabBar&&"horizontal"===this.tabBar.orientation&&"string"==typeof r.label?{onmouseenter:e=>this.handleMouseEnterEvent(e,r)}:{title:r.caption};return rW.li((0,tv._)((0,tm._)({},a),{key:this.createTabKey(e),className:this.createTabClass(e),id:this.createTabId(r,n),style:this.createTabStyle(e),dataset:this.createTabDataset(e),ondblclick:e=>this.handleDblClickEvent(e,r),onauxclick:e=>{e.preventDefault()},onclick:e=>this.handleClickEvent(e,r),oncontextmenu:e=>{this.menuService.open(e,r.owner),e.stopPropagation(),e.preventDefault()}}),rW.div({className:"flow-tab-icon-label"},this.renderIcon(e),this.renderLabel(e)),rW.div({className:r.saving?"lm-TabBar-tabCloseIcon saving action-label ".concat(iu):"lm-TabBar-tabCloseIcon action-label ".concat(iu),onmouseenter:e=>{e.stopPropagation(),o&&this.hoverService.requestHover({content:o,position:"bottom",target:e.target})},onclick:e=>this.handleCloseClickEvent(e,r),ondblclick:e=>e.stopPropagation()}))}createTabClass(e){var t,n=super.createTabClass(e);return!(null===(t=e.visible)||void 0===t||t)&&(n+=" p-mod-invisible"),n}handleClickEvent(e,t){this.menuService.close()}createTabId(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"shell-tab-".concat(null===(n=e.owner)||void 0===n?void 0:null===(t=n.uri)||void 0===t?void 0:t.displayName).concat(r?"-hidden":"")}createTabStyle(e){return function(e){var t,n,r="".concat(e.zIndex),{labelSize:o}=e,{iconSize:a}=e;if(o||a){var s=o?o.height:0,l=a?a.height:0,c=e.paddingTop||0;s>0&&l>0&&(c*=1.5);var d=e.paddingBottom||0;t="".concat(s+l+c+d,"px")}return{zIndex:r,height:t,minWidth:n=e.tabWidth?"".concat(e.tabWidth,"px"):"",maxWidth:n}}(e)}renderLabel(e){var t,n,r,{labelSize:o}=e,{iconSize:a}=e;if(o&&(t="".concat(o.width,"px"),n="".concat(o.height,"px")),e.paddingTop||a){var s=a?a.height:0,l=e.paddingTop||0;s>0&&(l*=1.5),r="".concat(l+s,"px")}var c={width:t,height:n,top:r};return"string"==typeof e.title.label?rW.div({className:"flow-TabBar-tabLabel-text",style:c},e.title.label):rF("div",{className:"flow-TabBar-tabLabel",style:c},{render:t=>{var n=this.labelNodeRoot.get(t);if(n)n.render(e.title.label);else{var r=(0,iR.createRoot)(t);r.render(e.title.label),this.labelNodeRoot.set(t,r)}},unrender:e=>{var t=this.labelNodeRoot.get(e);t&&(t.unmount(),this.labelNodeRoot.delete(e))}})}renderIcon(e){if(!e.title.iconLabel)return rW.div();e.paddingTop&&(t="".concat(e.paddingTop||0,"px"));var t,n={top:t},r=this.createIconClass(e);return"string"==typeof e.title.iconLabel?rW.i({className:ib(e.title.iconLabel)}):rF("div",{className:r,style:n},{render:t=>{var n=this.iconNodeRoot.get(t);if(n)n.render(e.title.iconLabel);else{var r=(0,iR.createRoot)(t);this.iconNodeRoot.set(t,r),r.render(e.title.iconLabel)}},unrender:e=>{var t=this.labelNodeRoot.get(e);t&&(t.unmount(),this.labelNodeRoot.delete(e))}})}constructor(){super(),this.toDispose=new eX.K4,this.iconNodeRoot=new WeakMap,this.labelNodeRoot=new WeakMap,this.handleMouseEnterEvent=(e,t)=>{if(this.tabBar&&this.hoverService&&e.currentTarget instanceof HTMLElement&&t){var n=t.label||t.caption;"horizontal"===this.tabBar.orientation?n&&this.hoverService.requestHover({content:n,target:e.currentTarget,position:"bottom"}):n&&this.hoverService.requestHover({content:n,target:e.currentTarget,position:"right"})}},this.handleCloseClickEvent=(e,t)=>{e.stopPropagation(),e.preventDefault(),this.tabBar&&e.currentTarget instanceof HTMLElement&&((null==t?void 0:t.saving)?this.commandService.executeCommand(eX.mY.Default.VIEW_SAVING_WIDGET_CLOSE_CONFIRM,[t]):null==t||t.owner.close())},this.handleDblClickEvent=(e,t)=>{if(!this.shell.disableFullScreen){var n,r,o=(null==t?void 0:null===(r=t.owner)||void 0===r?void 0:null===(n=r.parent)||void 0===n?void 0:n.id)===ie;this.tabBar&&e.currentTarget instanceof HTMLElement&&o&&this.commandService.executeCommand(eX.mY.Default.VIEW_FULL_SCREEN)}}}}(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],i7.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(iD),(0,e2.w6)("design:type",void 0===iD?Object:iD)],i7.prototype,"hoverService",void 0),(0,e2.gn)([(0,e8.f)(t3),(0,e2.w6)("design:type",void 0===t3?Object:t3)],i7.prototype,"shortcutsService",void 0),(0,e2.gn)([(0,e8.f)(eX.VD),(0,e2.w6)("design:type",void 0===eX.VD?Object:eX.VD)],i7.prototype,"commandService",void 0),(0,e2.gn)([(0,e8.f)(i5),(0,e2.w6)("design:type",void 0===i5?Object:i5)],i7.prototype,"menuService",void 0),i7=(0,e2.gn)([(0,e4.b)(),(0,e2.w6)("design:type",Function),(0,e2.w6)("design:paramtypes",[])],i7);var oe=Symbol("TabBarRendererFactory");class ot extends rZ{getHandleEvent(e){return!!(!e||e.classList.contains(il))||!(e.classList.contains("flow-toolbar-item")||e.classList.contains("flow-toolbar-container")||e.classList.contains(iu))&&this.getHandleEvent(e.parentElement)}handleEvent(e){(this.getHandleEvent(e.target)||"pointerup"===e.type)&&super.handleEvent(e)}rewrireDOM(){var{contentNode:e}=this;if(!e)throw Error("'this.node' does not have the content as a direct child with class name 'p-TabBar-content'.");this.node.removeChild(e);var t=document.createElement("div");t.classList.add(ia),this.preActionContainer=document.createElement("div"),this.preActionContainer.classList.add("pre-flow-tabBar-action-container"),t.appendChild(this.preActionContainer),this.scrollContainer=document.createElement("div"),this.scrollContainer.classList.add(il),t.appendChild(this.scrollContainer),this.scrollContainer.appendChild(e),this.actionContainer=document.createElement("div"),this.actionContainer.classList.add(is),t.appendChild(this.actionContainer),this.node.appendChild(t)}onResize(e){var t;super.onResize(e),null===(t=this.scrollBar)||void 0===t||t.update()}onAfterAttach(e){!this.scrollBar&&(this.scrollBar=this.scrollBarFactory()),this.toolbar&&(this.toolbar.isAttached&&rI.detach(this.toolbar),rI.attach(this.toolbar,this.actionContainer),this.viewRenderer.addReactPortal(this.toolbar)),this.preActionContainer&&(this.preToolbar.isAttached&&rI.detach(this.preToolbar),rI.attach(this.preToolbar,this.preActionContainer),this.viewRenderer.addReactPortal(this.preToolbar)),super.onAfterAttach(e)}onBeforeDetach(e){this.toolbar&&this.toolbar.isAttached&&rI.detach(this.toolbar),this.preToolbar&&this.preToolbar.isAttached&&rI.detach(this.preToolbar),super.onBeforeDetach(e)}onUpdateRequest(e){var t;super.onUpdateRequest(e),null===(t=this.scrollBar)||void 0===t||t.update()}constructor(e,t,n=t()){super({renderer:n}),this.tabBarToolbarFactory=e,this.rewrireDOM(),this.preToolbar=this.tabBarToolbarFactory(r6.LEADING),this.toolbar=this.tabBarToolbarFactory(),this.preToolbar.tabBar=this,this.toolbar.tabBar=this,n.tabBar=this,this.currentChanged.connect(()=>{var e,t=(null===(e=this.currentTitle)||void 0===e?void 0:e.owner).getResourceURI();t&&(this.preToolbar.updateURI(t),this.toolbar.updateURI(t))}),this.scrollBarFactory=()=>new rd(this.scrollContainer,{useBothWheelAxes:!0,suppressScrollY:!0})}}(0,e2.gn)([(0,e8.f)(iY),(0,e2.w6)("design:type",void 0===iY?Object:iY)],ot.prototype,"viewRenderer",void 0),ot=(0,e2.gn)([(0,e4.b)(),(0,e2.fM)(0,(0,e8.f)(i0)),(0,e2.fM)(1,(0,e8.f)(i9)),(0,e2.w6)("design:type",Function),(0,e2.w6)("design:paramtypes",[void 0===i0?Object:i0,void 0===i9?Object:i9,void 0])],ot);class on{createTabBar(){return this.tabBarFactory()}createHandle(){return rX.defaultRenderer.createHandle()}constructor(e){this.tabBarFactory=e,this.tabBarClasses=[]}}(0,e2.gn)([(0,e8.f)(iV.Factory),(0,e2.w6)("design:type",void 0===iV||void 0===iV.Factory?Object:iV.Factory)],on.prototype,"dockPanelFactory",void 0),(0,e2.gn)([(0,e8.f)(ot),(0,e2.w6)("design:type",void 0===ot?Object:ot)],on.prototype,"customTabBar",void 0),on=(0,e2.gn)([(0,e4.b)(),(0,e2.fM)(0,(0,e8.f)(oe)),(0,e2.w6)("design:type",Function),(0,e2.w6)("design:paramtypes",[void 0===oe?Object:oe])],on);class or{toggleBottomLayout(){this.shell.bottomSplitLayout.setRelativeSizes([.7,.3])}hideBottomLayout(){this.shell.bottomSplitLayout.setRelativeSizes([1,0])}getOpenTitles(){var e=[];for(var t of this.shell.mainPanel.layout.tabBars())e=e.concat(t.titles);return e}getAllTabsFromArea(e){var t=e===r4.MAIN_PANEL?this.shell.mainPanel.widgets():this.shell.bottomPanel.widgets(),n=[];for(var r of t)n.push(r);return n}closeOtherTabs(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];try{var t,n=function(t){[...t.titles].map(n=>{var r;n.label!==(null===(r=t.currentTitle)||void 0===r?void 0:r.label)&&(t.removeTab(n),e&&n.owner.dispose())})},r=null===(t=this.shell.currentWidget)||void 0===t?void 0:t.parent;if(!r)return;for(var o of r.tabBars())n(o)}catch(e){console.error(e)}}openNextTab(){for(var e of this.shell.mainPanel.layout.tabBars()){var t=e.titles.findIndex(e=>e.owner===this.shell.currentWidget);if(-1!==t){var n,r=null===(n=e.titles[(t+1)%e.titles.length].owner)||void 0===n?void 0:n.getResourceURI();r&&this.openHandler.open(r)}}}openLastTab(){for(var e of this.shell.mainPanel.layout.tabBars()){var t=e.titles.findIndex(e=>e.owner===this.shell.currentWidget);if(-1!==t){var n,r=null===(n=e.titles[(t-1+e.titles.length)%e.titles.length].owner)||void 0===n?void 0:n.getResourceURI();r&&this.openHandler.open(r)}}}enableFullScreenMode(){if(!this.isFullScreenMode)ii.forEach(e=>{if(e!==r4.MAIN_PANEL){var t=this.shell.getPanelFromArea(e);this.prevPanelMap.set(e,t.isHidden),t.hide()}}),this.isFullScreenMode=!0,this.onFullScreenModeChangeEmitter.fire(!0)}disableFullScreenMode(){if(!!this.isFullScreenMode)ii.forEach(e=>{if(e!==r4.MAIN_PANEL){var t=this.shell.getPanelFromArea(e),n=!!this.prevPanelMap.get(e);t.setHidden(n)}}),this.isFullScreenMode=!1,this.onFullScreenModeChangeEmitter.fire(!1)}switchFullScreenMode(){this.isFullScreenMode?this.disableFullScreenMode():this.enableFullScreenMode()}setActivityBarUri(e){this.shell.activityBarWidget.setCurrentUri(e)}get activityBarUri(){return this.shell.activityBarWidget.currentUri}constructor(){this.isFullScreenMode=!1,this.onFullScreenModeChangeEmitter=new eX.Q5,this.onFullScreenModeChange=this.onFullScreenModeChangeEmitter.event,this.prevPanelMap=new Map}}(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],or.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(i$),(0,e2.w6)("design:type",void 0===i$?Object:i$)],or.prototype,"openHandler",void 0),or=(0,e2.gn)([(0,e4.b)()],or);class oi{startDrag(e){var t,{uris:n,position:r,dragImage:o,callback:a,backdropTransform:s}=e,{clientX:l,clientY:c}=r,d=new rk,u=this;var h=(t=(0,e3._)(function*(){var e,t=[];return yield Promise.all(n.map((e=(0,e3._)(function*(e){var n=u.widgetManager.getFactoryFromURI(e),r=yield u.widgetManager.getOrCreateWidgetFromURI(e,n);u.viewRenderer.addReactPortal(r),t.push(r)}),function(t){return e.apply(this,arguments)}))),t}),function(){return t.apply(this,arguments)});d.setData("application/vnd.lumino.widget-factory",h),new rK({document,mimeData:d,dragImage:o,proposedAction:"move",supportedActions:"move",source:this.shell.mainPanel,backdropTransform:s}).start(l,c).then(a)}}(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],oi.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(r9),(0,e2.w6)("design:type",void 0===r9?Object:r9)],oi.prototype,"widgetManager",void 0),(0,e2.gn)([(0,e8.f)(iY),(0,e2.w6)("design:type",void 0===iY?Object:iY)],oi.prototype,"viewRenderer",void 0),oi=(0,e2.gn)([(0,e4.b)()],oi);var oo="expand",oa="close";class os extends r2{get defaultStretch(){return this._defaultStretch}set defaultStretch(e){this._defaultStretch=e}get orientation(){return this._orientation}set orientation(e){this._orientation=e}storeState(){var e;if(!!(null===(e=this.splitPanels)||void 0===e?void 0:e.length))return{sizes:this.getRelativeSizes(),panelClose:this.panels.map(e=>e.node.classList.contains(oa))}}restoreState(e){var t;if(!!(null===(t=this.splitPanels)||void 0===t?void 0:t.length))this.storeData=e,this.addClassNames()}onFitRequest(e){var t;if(super.onFitRequest(e),!!(null===(t=this.panels)||void 0===t?void 0:t.length)&&"horizontal"===this.orientation)this.panels.forEach(e=>{var t,n,r,o,a,s,l,c,d=null==e?void 0:e.node;d&&((null==d?void 0:null===(n=d.classList)||void 0===n?void 0:null===(t=n.contains)||void 0===t?void 0:t.call(n,"close"))?null===(a=d.previousSibling)||void 0===a||null===(o=a.classList)||void 0===o||null===(r=o.add)||void 0===r||r.call(o,"lm-mod-hidden"):null===(c=d.previousSibling)||void 0===c||null===(l=c.classList)||void 0===l||null===(s=l.remove)||void 0===s||s.call(l,"lm-mod-hidden"))})}init(e){var t;if(super.init(e),!!(null===(t=this.splitPanels)||void 0===t?void 0:t.length))!this.layout&&this.createContainer()}createPanel(e){var t=new rN;return t.id=e.displayName,t}addClassNames(){var e;if(!!(null===(e=this.storeData)||void 0===e?void 0:e.panelClose))this.panels.forEach((e,t)=>{var n,r;(null===(r=this.storeData)||void 0===r?void 0:null===(n=r.panelClose)||void 0===n?void 0:n[t])?this.closePanel(t):this.expandPanel(t)})}getWidget(e){var t=this.widgetManager.uriToWidgetID(e);return this.widgetManager.getWidget(t)}getWidgetExpand(e){if(!e)return!1;var t,n=this.widgetManager.uriToWidgetID(e),r=this.widgetManager.getWidget(n);return!!(null==r?void 0:null===(t=r.parent)||void 0===t?void 0:t.node.classList.contains("expand"))}createPanels(e){var t=this;return(0,e3._)(function*(){var n;return t.splitPanels.sort((e,t)=>(e.order||0)-(t.order||0)),Promise.all(t.splitPanels.map((n=(0,e3._)(function*(n,r){var o,{widgetUri:a,widget:s}=n,l=t.createPanel(a);if((null==e?void 0:e[r])===0?l.node.classList.add(oa):l.node.classList.add(oo),o=t.getWidget(a))return o;(o=yield t.widgetManager.createSubWidget(a,s)).wrapperWidget=t,t.viewRenderer.addReactPortal(o);s&&l.addWidget(o),t.panels.push(l)}),function(e,t){return n.apply(this,arguments)})))})()}toggleSubWidget(e){if(!!e&&!!this.layout){var t=this.contentPanel.relativeSizes(),n=this.panels.findIndex(t=>t.id===e.displayName);this.panels.forEach((e,r)=>{var o=e.node.classList.contains(oo);r===n&&o?(t[r]=0,e.node.classList.remove(oo),e.node.classList.add(oa),this.contentPanel.fit(),this.setRelativeSizes(t)):r===n&&!o&&(t[r]=1,e.node.classList.remove(oa),e.node.classList.add(oo),this.contentPanel.fit(),this.setRelativeSizes(t))})}}getRelativeSizes(){return this.contentPanel.relativeSizes()}closePanel(e){var t=this.panels[e];if(!(!t||t.node.classList.contains(oa)))t.node.classList.remove(oo),t.node.classList.add(oa)}expandPanel(e){var t=this.panels[e];if(!(!t||t.node.classList.contains(oo)))t.node.classList.remove(oa),t.node.classList.add(oo)}syncPanelRelativeSizes(e){this.contentPanel.setRelativeSizes(e),(null==e?void 0:e.length)&&(e.forEach((e,t)=>{0===e?this.closePanel(t):this.expandPanel(t)}),this.contentPanel.fit())}setRelativeSizes(e){this.contentPanel.setRelativeSizes(e)}getDefaultStretch(){if(this.defaultStretch)return this.defaultStretch;var e=this.panels.length;return Array(e).fill(1/e)}createContainer(){var e=this;return(0,e3._)(function*(){var t,n=e.getDefaultStretch();yield e.createPanels(n);var r=iC(e.panels,n,{orientation:e.orientation,spacing:0}),o=new rJ({layout:r});o.addClass(io),e.contentPanel=o,e.setRelativeSizes((null===(t=e.storeData)||void 0===t?void 0:t.sizes)||n),e.layout=ik([e.contentPanel],[1],{direction:e.direction,spacing:0})})()}render(){return null}constructor(...e){super(...e),this.panels=[],this.splitPanels=[],this.direction="left-to-right"}}(0,e2.gn)([(0,e8.f)(r9),(0,e2.w6)("design:type",void 0===r9?Object:r9)],os.prototype,"widgetManager",void 0),(0,e2.gn)([(0,e8.f)(iY),(0,e2.w6)("design:type",void 0===iY?Object:iY)],os.prototype,"viewRenderer",void 0),(0,e2.gn)([(0,e8.f)(iQ),(0,e2.w6)("design:type",void 0===iQ?Object:iQ)],os.prototype,"layoutRestorer",void 0),os=(0,e2.gn)([(0,e4.b)()],os);var ol=e=>{e(r5).toDynamicValue(e=>{var{container:t}=e;return{area:r4.ACTIVITY_BAR,canHandle:e=>e.isEqualOrParent(iO),createWidget:()=>{var e=t.createChild();return e.bind(iB).toSelf().inSingletonScope(),e.get(iB)}}}),e(r5).toDynamicValue(e=>{var{container:t}=e;return{area:r4.STATUS_BAR,canHandle:e=>e.isEqualOrParent(iI),createWidget:()=>{var e=t.createChild();return e.bind(iP).toSelf().inSingletonScope(),e.get(iP)}}})},oc=e=>"\n #".concat(ir[r4.TOP_BAR].displayName," {\n min-height: 40px;\n background: ").concat(e("flowide.color.base.bg.2"),";\n color: ").concat(e("flowide.color.base.text.0"),";\n border-bottom: 1px solid ").concat(e("flowide.color.base.border"),";\n }\n #").concat(ir[r4.ACTIVITY_BAR].displayName," {\n min-width: 36px;\n color: ").concat(e("flowide.color.base.text.0"),";\n background: ").concat(e("flowide.color.base.bg.2"),";\n border-right: 1px solid ").concat(e("flowide.color.base.border"),";\n }\n #").concat(ir[r4.PRIMARY_SIDEBAR].displayName," {\n min-width: 110px !important;\n color: ").concat(e("flowide.color.base.text.0"),";\n background: ").concat(e("flowide.color.base.bg.1"),";\n border-right: 1px solid ").concat(e("flowide.color.base.border"),";\n }\n #").concat(ir[r4.MAIN_PANEL].displayName," {\n color: ").concat(e("flowide.color.base.text.0"),";\n background: ").concat(e("flowide.color.base.bg.0"),";\n }\n #").concat(ir[r4.SECONDARY_SIDEBAR].displayName," {\n min-width: 110px;\n }\n #").concat(ir[r4.STATUS_BAR].displayName," {\n min-height: 22px;\n background: ").concat(e("flowide.color.base.bg.2"),";\n border-top: 1px solid ").concat(e("flowide.color.base.border"),";\n }\n #").concat(ir[r4.BOTTOM_PANEL].displayName," {\n background: ").concat(e("flowide.color.base.bg.0"),";\n color: ").concat(e("flowide.color.base.text.0"),";\n border-top: 1px solid ").concat(e("flowide.color.base.border"),";\n }\n\n .").concat(io," .lm-SplitPanel-child.expand {\n min-height: 75px;\n }\n\n .").concat(io," .lm-SplitPanel-child.close {\n min-height: 22px;\n max-height: 22px;\n }\n\n .").concat(io,'[data-orientation="vertical"] .lm-SplitPanel-handle {\n background: ').concat(e("flowide.color.base.border"),";\n min-height: 1px;\n z-index: 3;\n }\n .").concat(io,'[data-orientation="vertical"] .lm-SplitPanel-handle:hover {\n background: ').concat(e("flowide.color.base.primary.hover"),";\n min-height: 4px;\n }\n .").concat(io,'[data-orientation="vertical"] .lm-SplitPanel-handle:active {\n background: ').concat(e("flowide.color.base.primary"),";\n min-height: 4px;\n }\n\n .").concat(io,'[data-orientation="horizontal"] .lm-SplitPanel-handle {\n background: ').concat(e("flowide.color.base.border"),";\n min-width: 1px;\n }\n .").concat(io,'[data-orientation="horizontal"] .lm-SplitPanel-handle:hover {\n background: ').concat(e("flowide.color.base.primary.hover"),";\n min-width: 4px;\n }\n .").concat(io,'[data-orientation="horizontal"] .lm-SplitPanel-handle:active {\n background: ').concat(e("flowide.color.base.primary"),";\n min-width: 4px;\n }\n "),od=e=>"\n .flow-Menu {\n z-index: 10000;\n position: absolute;\n top: 0;\n left: 0;\n padding: 4px;\n white-space: nowrap;\n overflow-x: hidden;\n overflow-y: auto;\n outline: none;\n font: 12px Helvetica,Arial,sans-serif;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background: ".concat(e("flowide.color.base.bg.0"),";\n color: ").concat(e("flowide.color.base.text.0"),";\n border: 1px solid ").concat(e("flowide.color.menu.border"),";\n box-shadow: 0 1px 6px ").concat(e("flowide.color.menu.box.shadow"),";\n border-radius: 6px;\n }\n\n .flow-Menu-content {\n margin: 0;\n padding: 0;\n display: flex;\n outline: none;\n flex-direction: column;\n list-style-type: none;\n }\n\n .flow-Menu-item {\n display: flex;\n justify-content: space-between;\n padding: 0 4px;\n border-radius: 4px;\n align-items: center;\n outline: none;\n cursor: pointer;\n }\n\n .flow-Menu-item.flow-mod-active {\n background: ").concat(e("flowide.color.base.fill.0"),";\n }\n\n .flow-Menu-item.flow-mod-disabled {\n opacity: 0.35;\n }\n\n .flow-Menu-item.flow-mod-hidden,\n .flow-Menu-item.flow-mod-collapsed {\n display: none !important;\n }\n\n .flow-Menu-itemIcon,\n .flow-Menu-itemSubmenuIcon {\n text-align: center;\n }\n\n .flow-Menu-itemLabel {\n text-align: left;\n padding: 4px 35px 4px 2px;\n }\n\n .flow-Menu-itemShortcut {\n text-align: right;\n }\n .flow-Menu-itemIcon::before,\n .flow-Menu-itemSubmenuIcon::before {\n font-family: codicon;\n }\n\n .flow-Menu-item > .flow-Menu-itemSubmenuIcon::before {\n content: '\\eab6';\n line-height: 20px;\n }\n");class ou{get commandService(){return this.commandFactory()}registerStyle(e,t){var{add:n}=e,{getColor:r}=t;n("\n ".concat(od(r),"\n .flow-hover {\n color: ").concat(r("flowide.color.base.text.0"),";\n background: ").concat(r("flowide.color.base.bg.0"),";\n\n border: 2px solid ").concat(r("flowide.color.base.border"),";\n border-radius: 6px;\n padding: 4px;\n }\n .flowide-container {\n height: 100%;\n }\n .flowide-container .debug-bar-widget-container {\n position: fixed;\n width: fit-content;\n height: fit-content;\n }\n .flowide-container .lm-Widget {\n width: 100%;\n height: 100%;\n }\n .flowide-container .flow-tab-icon-label {\n display: flex;\n align-items: center;\n width: 100%;\n overflow: hidden;\n }\n .flowide-container .flow-tab-icon-label .flow-TabBar-tabLabel-text {\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n }\n .flowide-container .lm-TabBar-tabCloseIcon:hover {\n cursor: pointer;\n }\n .flowide-container .lm-TabBar-content {\n width: fit-content;\n border: 0;\n }\n .flowide-container .lm-DockPanel-handle {\n background: ").concat(r("flowide.color.base.border"),";\n }\n .flowide-container .lm-TabBar {\n color: ").concat(r("flowide.color.base.text.2"),";\n background: ").concat(r("flowide.color.base.fill.0"),";\n display: flex;\n height: 24px;\n }\n .flowide-container .lm-TabBar-tab {\n background: transparent;\n border: 0;\n min-width: 125px;\n max-height: 24px;\n line-height: 24px;\n }\n .flowide-container .lm-TabBar-tab:hover {\n color: ").concat(r("flowide.color.base.text.0"),";\n background: ").concat(r("flowide.color.base.fill.0"),';\n }\n .flowide-container .lm-DockPanel-handle[data-orientation="vertical"] {\n min-height: 1px;\n z-index: 3;\n }\n .flowide-container .lm-DockPanel-handle[data-orientation="vertical"]:hover {\n background: ').concat(r("flowide.color.base.primary.hover"),';\n min-height: 4px;\n }\n .flowide-container .lm-DockPanel-handle[data-orientation="vertical"]:active {\n background: ').concat(r("flowide.color.base.primary"),';\n min-height: 4px;\n }\n\n .flowide-container .lm-DockPanel-handle[data-orientation="horizontal"] {\n min-width: 1px;\n }\n .flowide-container .lm-DockPanel-handle[data-orientation="horizontal"]:hover {\n background: ').concat(r("flowide.color.base.primary.hover"),';\n min-width: 4px;\n }\n .flowide-container .lm-DockPanel-handle[data-orientation="horizontal"]:active {\n background: ').concat(r("flowide.color.base.primary"),";\n min-width: 4px;\n }\n .flowide-container .lm-TabBar-tab.lm-mod-current {\n background: ").concat(r("flowide.color.base.bg.0"),";\n color: ").concat(r("flowide.color.base.text.0"),";\n transform: unset;\n position: relative;\n }\n .flowide-container #").concat(ie,' .lm-TabBar-tab.lm-mod-current::before {\n position: absolute;\n top: 0;\n left: 0;\n content: "";\n width: 100%;\n height: 2px;\n background: ').concat(r("flowide.color.base.primary"),";\n }\n .flowide-container #").concat(it,' .lm-TabBar-tab.lm-mod-current::before {\n position: absolute;\n bottom: 0;\n left: 0;\n content: "";\n width: 100%;\n height: 2px;\n background: ').concat(r("flowide.color.base.primary"),';\n }\n .flowide-container .lm-TabBar-tabCloseIcon.saving:before {\n content: "\\f111";\n }\n .flowide-container .lm-TabBar-tabCloseIcon.saving:hover:before {\n content: "\\f00d";\n }\n .flowide-container .').concat(ia," {\n display: flex;\n width: 100%;\n height: 100%;\n justify-content: space-between;\n }\n .flowide-container .").concat(il," {\n flex-grow: 1;\n position: relative;\n overflow: hidden;\n }\n .flowide-container .").concat(il," .ide-ps__rail-x {\n z-index: 999999;\n user-select: none;\n pointer-events: none;\n }\n .flowide-container .").concat(il," .ide-ps__thumb-x {\n height: 2px;\n }\n .flowide-container .").concat(is," {\n flex-shrink: 0;\n height: 100%;\n }\n .flowide-container .").concat(is," .").concat(ic," {\n display: flex;\n height: 100%;\n }\n .flowide-container .").concat(is," .").concat(id," {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 4px;\n }\n ").concat(oc(r),"\n }"))}registerCommands(e){e.registerCommand({id:eX.mY.Default.VIEW_CLOSE_ALL_WIDGET,label:"Close All Tab"},{execute:()=>{var e,t=(null===(e=this.shell.currentWidget)||void 0===e?void 0:e.parent).tabBars(),n=[];for(var r of t)n=n.concat(r.titles);this.commandService.executeCommand(eX.mY.Default.VIEW_SAVING_WIDGET_CLOSE_CONFIRM,n)}}),e.registerCommand({id:eX.mY.Default.VIEW_CLOSE_CURRENT_WIDGET,label:"Close Current Tab",shortLabel:"Close"},{execute:e=>{var t=e||this.shell.currentWidget;t&&this.commandService.executeCommand(eX.mY.Default.VIEW_SAVING_WIDGET_CLOSE_CONFIRM,[t.title])}}),e.registerCommand({id:eX.mY.Default.VIEW_REOPEN_LAST_WIDGET,label:"Reopen Last Tab"},{execute:()=>{var e=this.shell.closeWidgetUriStack.pop();e&&this.openHandler.open(e)}}),e.registerCommand({id:eX.mY.Default.VIEW_CLOSE_OTHER_WIDGET,label:"Close Other Tab"},{execute:e=>{try{var t=e||this.shell.currentWidget,n=null==t?void 0:t.parent;if(!n)return;var r=[];for(var o of n.tabBars())[...o.titles].map(e=>{e.owner!==t&&r.push(e)});this.commandService.executeCommand(eX.mY.Default.VIEW_SAVING_WIDGET_CLOSE_CONFIRM,r)}catch(e){console.error(e)}}}),e.registerCommand({id:eX.mY.Default.VIEW_CLOSE_BOTTOM_PANEL,label:"Close/Open Bottom Pannel"},{execute:()=>{var e;!(null===(e=this.shell.bottomPanel)||void 0===e?void 0:e.currentTitle)&&this.commandService.executeCommand(eX.mY.Default.VIEW_PROBLEMS),this.shell.bottomPanel.setHidden(!this.shell.bottomPanel.isHidden)}}),e.registerCommand({id:eX.mY.Default.VIEW_OPEN_NEXT_TAB,label:"Open Next Tab"},{execute:()=>{this.viewService.openNextTab()}}),e.registerCommand({id:eX.mY.Default.VIEW_OEPN_LAST_TAB,label:"Open Last Tab"},{execute:()=>{this.viewService.openLastTab()}}),e.registerCommand({id:eX.mY.Default.VIEW_FULL_SCREEN,label:"Full Screen"},{execute:this.shell.disableFullScreen?()=>null:()=>{this.viewService.switchFullScreenMode()}})}registerShortcuts(e){e.registerHandlers({keybinding:"alt shift w",commandId:eX.mY.Default.VIEW_CLOSE_ALL_WIDGET}),e.registerHandlers({keybinding:"alt shift rightarrow",commandId:eX.mY.Default.VIEW_OPEN_NEXT_TAB,preventDefault:!0}),e.registerHandlers({keybinding:"alt shift leftarrow",commandId:eX.mY.Default.VIEW_OEPN_LAST_TAB,preventDefault:!0}),e.registerHandlers({keybinding:"alt w",commandId:eX.mY.Default.VIEW_CLOSE_CURRENT_WIDGET}),e.registerHandlers({keybinding:"alt shift t",commandId:eX.mY.Default.VIEW_REOPEN_LAST_WIDGET}),e.registerHandlers({keybinding:"meta alt t",commandId:eX.mY.Default.VIEW_CLOSE_OTHER_WIDGET}),e.registerHandlers({keybinding:"meta j",commandId:eX.mY.Default.VIEW_CLOSE_BOTTOM_PANEL}),e.registerHandlers({keybinding:"alt f",commandId:eX.mY.Default.VIEW_FULL_SCREEN})}}(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],ou.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(or),(0,e2.w6)("design:type",void 0===or?Object:or)],ou.prototype,"viewService",void 0),(0,e2.gn)([(0,e8.f)(na),(0,e2.w6)("design:type",void 0===na?Object:na)],ou.prototype,"navigationService",void 0),(0,e2.gn)([(0,e8.f)(eX.BB),(0,e2.w6)("design:type",Function)],ou.prototype,"commandFactory",void 0),(0,e2.gn)([(0,e8.f)(i$),(0,e2.w6)("design:type",void 0===i$?Object:i$)],ou.prototype,"openHandler",void 0),ou=(0,e2.gn)([(0,e4.b)()],ou);var oh=()=>(0,tK.jsx)("div",{children:"Something went wrong."});var op=e0({onBind:(e,t)=>{var{bind:n}=e;n(iJ).toSelf().inSingletonScope(),n(r9).toSelf().inSingletonScope(),n(iY).toSelf().inSingletonScope(),n(r7).toConstantValue((0,tm._)({widgetFallbackRender:oh},t)),n(iq).toSelf().inSingletonScope(),n(iQ).toSelf().inSingletonScope(),(0,eX.yb)(n,r5),(0,eX.yb)(n,iG),(0,eX.yb)(n,iX),(0,eX.KV)(n,i$,[ta]),n(iD).toSelf().inSingletonScope(),n(oi).toSelf().inSingletonScope(),n(or).toSelf().inSingletonScope(),n(iZ).toSelf().inSingletonScope(),n(iv).toSelf().inSingletonScope(),n(iW).toAutoFactory(iF),n(iF).toSelf(),n(r3).toFactory(e=>e=>(e.bind(r8).toSelf().inSingletonScope(),e.get(r8))),n(iH).toFactory(e=>()=>{var t=e.container.createChild();return t.bind(on).toSelf().inSingletonScope(),t.bind(ot).toSelf().inSingletonScope(),t.bind(oe).toFactory(e=>()=>{var t=e.container.createChild();return t.bind(ot).toSelf().inSingletonScope(),t.get(ot)}),t.bind(i0).toFactory(e=>t=>{var n=e.container.createChild();n.bind(i1).toSelf().inSingletonScope();var r=n.get(i1);return r.initAlign(t),r}),t.bind(i9).toFactory(e=>()=>{var t=e.container.createChild();return t.bind(i7).toSelf().inSingletonScope(),t.get(i7)}),t.get(on)}),n(nH).toDynamicValue(e=>{var t=e.container.get(iq);return e.container.get(iY).toReactComponent(t)}).inSingletonScope(),(0,eX.KV)(n,ou,[eX.pY,nM,t5]),n(iV.Factory).toFactory(()=>e=>new iV(e)),ol(n)},onInit:(X=(0,e3._)(function*(e,t){var n=e.get(iJ);yield n.init(t)}),function(e,t){return X.apply(this,arguments)}),onLayoutInit:(Q=(0,e3._)(function*(e,t){if(!(null===(n=t.presetConfig)||void 0===n?void 0:n.disableContextMenu)){var n,r=e.container.get(i5);r.addMenuItem({command:eX.mY.Default.VIEW_CLOSE_ALL_WIDGET,selector:".lm-TabBar-tab"}),r.addMenuItem({command:eX.mY.Default.VIEW_CLOSE_OTHER_WIDGET,selector:".lm-TabBar-tab"}),r.addMenuItem({command:eX.mY.Default.VIEW_FULL_SCREEN,selector:".lm-TabBar-tab",filter:e=>{var t;return(null==e?void 0:null===(t=e.parent)||void 0===t?void 0:t.id)===ie}}),r.addMenuItem({command:eX.mY.Default.VIEW_CLOSE_CURRENT_WIDGET,selector:".lm-TabBar-tab"})}var o=e.get(iJ);yield o.attach(t);var a=e.container.get(nY),s=e.container.get(i5);a.listenGlobalEvent("contextmenu",e=>{if(!t2(e.target)){var n,r=s.open(e);(!(null===(n=t.presetConfig)||void 0===n?void 0:n.disableContextMenu)||r)&&(e.stopPropagation(),e.preventDefault())}})}),function(e,t){return Q.apply(this,arguments)}),onDispose:e=>{e.get(iQ).storeLayout()}}),of=n("407821"),om=n.n(of),ov=n("472772"),og=n.n(ov),ob=n("395245"),oy=n.n(ob),o_=n("297998"),ow=n.n(o_),ox=n("646576"),oS=n.n(ox),ok=n("606121"),oC=n.n(ok),oj=n("950367"),oE={};oE.styleTagTransform=oC(),oE.setAttributes=ow(),oE.insert=oy().bind(null,"head"),oE.domAPI=og(),oE.insertStyleElement=oS(),om()(oj.Z,oE),oj.Z&&oj.Z.locals&&oj.Z.locals;var oT=n("268063"),oI={};oI.styleTagTransform=oC(),oI.setAttributes=ow(),oI.insert=oy().bind(null,"head"),oI.domAPI=og(),oI.insertStyleElement=oS(),om()(oT.Z,oI),oT.Z&&oT.Z.locals&&oT.Z.locals;class oP{onInit(){}registerCommands(e){}}(0,e2.gn)([(0,e8.f)(na),(0,e2.w6)("design:type",void 0===na?Object:na)],oP.prototype,"navigationService",void 0),(0,e2.gn)([(0,e8.f)(ts),(0,e2.w6)("design:type",void 0===ts?Object:ts)],oP.prototype,"openerService",void 0),oP=(0,e2.gn)([(0,e4.b)()],oP);(eZ||(eZ={})).create=function(e){return{container:e,get resourceService(){return e.get(tB)},get historyService(){return e.get(eX.qp)},get commandService(){return e.get(eX.VD)},get:t=>e.get(t),getAll:t=>e.getAll(t)}};var oM=(0,tq.forwardRef)((e,t)=>{var{options:n,container:r,containerModules:o,children:a,className:s}=e,l=(0,tq.useMemo)(()=>{var e;return{containerModules:o,container:r,plugins:(e=n,t=>{var n=e(t),r=[];return r.push(tW(n.resource||{}),op(n.view||{widgetFactories:[],defaultLayoutData:{activityBarItems:[],defaultWidgets:[]}}),nl(n.navigation||{}),tV(n.command||{}),(0,eX.JE)(n.history||{}),e1(n),nO(n.label||{}),t8(n.shortcut||{}),nt(n.preferences||{}),nA({}),i8(),nG()),r.push(e1({onBind(e){var{bind:t}=e;(0,eX.KV)(t,oP,[eX.pY,eG]),n.openHandlers&&n.openHandlers.forEach(e=>{"function"==typeof e?(t(e).toSelf().inSingletonScope(),t(ta).toService(e)):t(ta).toConstantValue(e)})}})),n.plugins&&r.push(...n.plugins),r}),customPluginContext:e=>eZ.create(e)}},[]);return(0,tK.jsx)(nK,(0,tv._)((0,tm._)({},l),{ref:t,children:(0,tK.jsxs)(tK.Fragment,{children:[(0,tK.jsx)(nU,{className:s}),a]})}))}),oR=()=>({version:"",patch:()=>null}),oD=n("407694"),oA=Symbol("OptionsService");class oN{send(e){}init(){}onDispose(){}constructor(){this.onMessageSendEmitter=new eX.Q5,this.onMessageSend=this.onMessageSendEmitter.event}}(0,e2.gn)([(0,e8.f)(oA),(0,e2.w6)("design:type",void 0===oA?Object:oA)],oN.prototype,"options",void 0),oN=(0,e2.gn)([(0,e4.b)()],oN);var oL=Symbol("WidgetContext"),oz=()=>(0,oD.Cg)()(e=>e.spaceId),oO="coze-project",oB=new tD("".concat(oO,":///top-bar")),oW=new tD("".concat(oO,":///default")),oF=new tD("".concat(oO,":///side-bar")),oH=new tD("".concat(oO,":///secondary-sidebar")),oU=new tD("".concat(oO,":///side-bar/resource")),oV=new tD("".concat(oO,":///side-bar/config")),oK=new tD("".concat(oO,":///ui-builder")),oq=new tD("".concat(oO,":///ui-builder/content")),oZ=new tD("".concat(oO,":///session"));var oY=((G={}).RELOAD="reload",G);class oX{switchPanel(e){var t,n,r=this.widgetManager.getWidgetFromURI(oK);e&&oK.match(e)?((null===(t=this.shell.mainPanel.parent)||void 0===t?void 0:t.parent).hide(),null==r||r.show()):(null==r||r.hide(),(null===(n=this.shell.mainPanel.parent)||void 0===n?void 0:n.parent).show())}uiBuilderReopen(){var e=this;return(0,e3._)(function*(){(yield e.widgetManager.getOrCreateWidgetFromURI(oq)).dispose(),e.openPanel("ui-builder")})()}secondarySidebarReOpen(){if(!!this.secondarySidebar.getVisible()){var e=this.widgetManager.getWidgetFromURI(oH);null==e||e.dispose(),this.openerService.open(oH)}}open(e){var t=this;return(0,e3._)(function*(){t.switchPanel(e),yield t.openerService.open(e)})()}openPanel(e){var t=this;return(0,e3._)(function*(){if("ui-builder"===e){t.switchPanel(oK);var n=t.widgetManager.getFactoryFromURI(oq),r=yield t.widgetManager.getOrCreateWidgetFromURI(oq,n);if(t.viewRenderer.addReactPortal(r),!(null==r?void 0:r.isAttached)&&r){var o,a=t.widgetManager.getWidgetFromURI(oK);null==a||null===(o=a.addWidget)||void 0===o||o.call(a,r)}}else t.switchPanel()})()}openDefault(){var e=this;return(0,e3._)(function*(){yield e.openerService.open(oW,{mode:"single-document"})})()}closeWidgetByUri(e){var t=this.widgetManager.getWidgetFromURI(e);t&&t.close()}getWidgetContextFromURI(e){var t=this.widgetManager.getWidgetFromURI(e);if(t)return t.context}splitScreen(e,t){var n,r,o,a=null===(o=this.shell.mainPanel)||void 0===o?void 0:null===(r=o.layout)||void 0===r?void 0:null===(n=r.saveLayout())||void 0===n?void 0:n.main;if((null==a?void 0:a.type)==="tab-area")this.shell.mainPanel.addWidget(t,{mode:"left"===e?"split-left":"split-right"}),this.shell.mainPanel.activateWidget(t);else if((null==a?void 0:a.type)==="split-area"){var{widgets:s}=null==a?void 0:a.children["left"===e?0:1],l=s.find(e=>e.isVisible);this.shell.mainPanel.addWidget(t,{mode:"tab-after",ref:l}),this.shell.mainPanel.activateWidget(t)}}switchFullScreenMode(){this.isFullScreenMode?this.disableFullScreenMode():this.enableFullScreenMode()}enableFullScreenMode(){if(!this.isFullScreenMode)this.primarySidebar.changeVisible(!1),this.shell.getPanelFromArea(r4.TOP_BAR).hide(),this.isFullScreenMode=!0,this.onFullScreenModeChangeEmitter.fire(!0)}disableFullScreenMode(){if(!!this.isFullScreenMode)this.primarySidebar.changeVisible(!0),this.shell.getPanelFromArea(r4.TOP_BAR).show(),this.isFullScreenMode=!1,this.onFullScreenModeChangeEmitter.fire(!1)}constructor(){this.isFullScreenMode=!1,this.onSidebarVisibleChangeEmitter=new eX.Q5,this.onSidebarVisibleChange=this.onSidebarVisibleChangeEmitter.event,this.onSecondarySidebarVisibleChangeEmitter=new eX.Q5,this.onSecondarySidebarChange=this.onSecondarySidebarVisibleChangeEmitter.event,this.onFullScreenModeChangeEmitter=new eX.Q5,this.onFullScreenModeChange=this.onFullScreenModeChangeEmitter.event,this.primarySidebar={onSidebarVisibleChange:this.onSidebarVisibleChange,getVisible:()=>this.shell.primarySidebar.isVisible,changeVisible:e=>{e?(this.shell.primarySidebar.show(),this.onSidebarVisibleChangeEmitter.fire(!0)):(this.shell.primarySidebar.hide(),this.onSidebarVisibleChangeEmitter.fire(!1))}},this.secondarySidebar={getVisible:()=>this.shell.secondarySidebar.isVisible,changeVisible:e=>{e?(!this.widgetManager.getWidgetFromURI(oH)&&this.openerService.open(oH),this.shell.secondarySidebar.show(),this.onSecondarySidebarVisibleChangeEmitter.fire(!0)):(this.shell.secondarySidebar.hide(),this.onSecondarySidebarVisibleChangeEmitter.fire(!1))}}}}(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],oX.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(r9),(0,e2.w6)("design:type",void 0===r9?Object:r9)],oX.prototype,"widgetManager",void 0),(0,e2.gn)([(0,e8.f)(ts),(0,e2.w6)("design:type",void 0===ts?Object:ts)],oX.prototype,"openerService",void 0),(0,e2.gn)([(0,e8.f)(iY),(0,e2.w6)("design:type",void 0===iY?Object:iY)],oX.prototype,"viewRenderer",void 0),oX=(0,e2.gn)([(0,e4.b)()],oX);class oQ{registerMenus(e,t){var n=()=>{var e,n=this.contextKeyService.getContext("widgetFocus");return!!(null==t?void 0:null===(e=t.test)||void 0===e?void 0:e.call(t,n.toString()))};e.forEach(e=>{if(e.submenu){var t=this.menu.createSubMenu();this.menu.addMenuItem({command:e.commandId,selector:e.selector,submenu:t,filter:n}),e.submenu.forEach(e=>{t.addItem({command:e.commandId,filter:n})})}else this.menu.addMenuItem({command:e.commandId,selector:e.selector,filter:n})})}constructor(){var e=this;this.contextmenu={registerContextMenu:(e,t)=>{this.registerMenus(e,t)},open:e=>this.menu.open(e)},this.command={execute:function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;onF(oQ);function oJ(){var e=iA();if(!e.context)throw Error("[useWidgetContext] Undefined widgetContext from ide context");return e.context}var o$=()=>{var e=iN(r4.MAIN_PANEL);return null==e?void 0:e.context},o0=n("157728"),o1=(e,t)=>{var n=iC([e.mainPanel],[1],{orientation:"vertical",spacing:0});e.bottomSplitLayout=n;var r=new rJ({layout:n}),o=ik([e.primarySidebar,r],[0,1],{direction:"left-to-right",spacing:6}),a=ik([new rL({layout:o}),t,e.secondarySidebar],[1,0,0],{direction:"left-to-right"}),s=new rL({layout:a});return ik([e.topPanel,s],[0,1],{direction:"top-to-bottom",spacing:0})},o2=(e,t)=>{var n=(0,tq.lazy)(e);return()=>(0,tK.jsx)(tq.Suspense,{fallback:t,children:(0,tK.jsx)(n,{})})},o4=e=>{var t,n,r=e.match(/space\/\d+\/project-ide\/\d+\/([^\/]+)(?:\/([^\/]+))?/);return r&&(t=r[1],n=r[2]),{resourceType:t,resourceId:n}},o6=e=>{var t=e.match(/space\/[^/]+\/project-ide\/[^/]+\/(.*)/);return t?t[1]:null},o5=e=>e.path.toString(),o3=(e,t,n)=>new tD("".concat(oO,":///").concat(e,"/").concat(t).concat(n?"?".concat(n):"")),o8=e=>new tD("".concat(oO,":///").concat(e)),o9=e=>"".concat(e.path.toString()).concat(e.query?"".concat(e.query):"").concat(e.fragment?"#".concat(e.fragment):""),o7=(e,t)=>!!e&&!!t&&e.toString()===t.toString(),ae=["commit_version"];function at(e){if(!e)return e;var t=new URLSearchParams(window.location.search),n=new URLSearchParams;for(var r of ae){var o=t.get(r);o&&!e.includes("".concat(r,"="))&&n.append(r,o)}var a=e.includes("?")?"&":"?",s=n.toString();return s?"".concat(e).concat(a).concat(s):e}var an=()=>(0,oD.Cg)()(e=>e.projectId),ar=()=>{var{view:e}=oG(),t=oz(),n=an(),r=(0,o0.useNavigate)();return(0,tq.useCallback)((o,a)=>{var s="/space/".concat(t,"/project-ide/").concat(n).concat(o),l=new tD("".concat(oO,"://").concat(o)),c=l.displayName===oK.displayName;o&&"/"!==o&&!c?e.open(l):e.openPanel(c?"ui-builder":"dev"),r(at(s),a)},[t,n,e,r])},ai=(e,t)=>{var n,r,o,a=-1,s=null===(o=e.mainPanel)||void 0===o?void 0:null===(r=o.layout)||void 0===r?void 0:null===(n=r.saveLayout)||void 0===n?void 0:n.call(r).main,l=(null==s?void 0:s.children)||[s];return(l.forEach((e,n)=>{t&&((null==e?void 0:e.widgets)||[]).some(e=>{var n,r;return(null===(r=e.uri)||void 0===r?void 0:null===(n=r.toString)||void 0===n?void 0:n.call(r))===t.toString()})&&(a=n)}),(null==l?void 0:l.length)===1)?void 0:1===a?"right":"left"},ao=(e,t)=>{var n,r=nF(iq),[o,a]=(0,tq.useState)(ai(r,e));return(0,tq.useEffect)(()=>{a(ai(r,e));var n=()=>{(null==t?void 0:t.titles.some(t=>{var n;return o7(null===(n=t.owner)||void 0===n?void 0:n.uri,e)}))&&a(ai(r,e))};return r.mainPanel.layoutModified.connect(n),()=>{r.mainPanel.layoutModified.disconnect(n)}},[null==e?void 0:null===(n=e.toString)||void 0===n?void 0:n.call(e)]),o},aa=()=>{var{widget:e}=oJ(),[t,n]=(0,tq.useState)(e.getTitle());return(0,tq.useEffect)(()=>{var t=e.onTitleChanged(e=>{n(e)});return()=>{var e;null==t||null===(e=t.dispose)||void 0===e||e.call(t)}},[]),t},as=e=>{var t=iA();(0,tq.useLayoutEffect)(()=>{var n=t.onActivate(()=>{e(t)});return()=>n.dispose()},[t,e])},al=()=>{var e,t,n=iA(),[r,o]=(0,tq.useState)((null===(e=n.uri)||void 0===e?void 0:e.queryObject)||{}),a=(0,tq.useRef)(null===(t=n.uri)||void 0===t?void 0:t.query);return as((0,tq.useCallback)(e=>{var t,n,r=null===(t=e.uri)||void 0===t?void 0:t.query;a.current!==r&&(a.current=r,o((null===(n=e.uri)||void 0===n?void 0:n.queryObject)||{}))},[a,o])),r},ac=e=>{var t,n=nF(eX.Ho);return{keybinding:nF(t3).getShortcutByCommandId(e).map(e=>e.join(" ")).join("/"),label:null===(t=n.getCommand(e))||void 0===t?void 0:t.label}},ad=n("336205"),au=n("298203"),ah=n("909776"),ap=n("382534");var af=((J={}).RESOURCE="resource",J.CLOSE_CONFIRM="close-confirm",J);class am{startPolling(e){var t=this;return(0,e3._)(function*(){t._stopPolling=!1;var n=e.res_name;try{t.onModalVisibleChangeEmitter.fire({type:"resource",scene:e.scene,resourceName:n});var{task_id:r,failed_reasons:o}=yield ap.Js.ResourceCopyDispatch(e);if(t._taskId=r,null==o?void 0:o.length){var a="";a=o.some(e=>e.res_type===ah.b0.Workflow)?ad.o.t("resource_copy_move_notify"):o.reduce((e,t)=>{var n="".concat(t.res_name||"").concat(t.reason||"");return e?"".concat(e,"\n").concat(n):n},""),t.onErrorEmitter.fire(a);return}r?t.doPolling(r):t.onErrorEmitter.fire("no_task_id")}catch(e){t.onErrorEmitter.fire(!0)}})()}retry(){var e=this;return(0,e3._)(function*(){e._stopPolling=!1,e._taskId&&(yield ap.Js.ResourceCopyRetry({task_id:e._taskId}),e.onErrorEmitter.fire(!1),e.doPolling(e._taskId))})()}doPolling(e){var t=this;return(0,e3._)(function*(){if(t._taskId=e,!t._stopPolling)try{var n=yield t.polling(),{status:r}=n||{};yield(0,au._v)(1e3),t._taskId&&!t._stopPolling&&t.onModalVisibleChangeEmitter.fire({type:"resource",scene:null==n?void 0:n.scene,resourceName:null==n?void 0:n.res_name}),r===ah.hY.Processing?t.doPolling(e):r===ah.hY.Successed?(t._stopPolling=!0,t.onModalVisibleChangeEmitter.fire({type:"resource",visible:!1}),t.onSuccessEmitter.fire(n)):t.onErrorEmitter.fire(!0)}catch(e){t._stopPolling=!0,t.onErrorEmitter.fire(!0)}})()}polling(){var e=this;return(0,e3._)(function*(){try{var{task_detail:t}=yield ap.Js.ResourceCopyDetail({task_id:e._taskId});return t}catch(t){return e._stopPolling=!0,e.onErrorEmitter.fire(!0),{status:ah.hY.Failed}}})()}onCloseResourceModal(){var e=this;return(0,e3._)(function*(){e._stopPolling=!0,e.onModalVisibleChangeEmitter.fire({type:"resource",visible:!1}),e.onCancelEmitter.fire(),e._taskId&&(yield ap.Js.ResourceCopyCancel({task_id:e._taskId}),e._taskId=void 0)})()}constructor(){this.onModalVisibleChangeEmitter=new eX.Q5,this.onModalVisibleChange=this.onModalVisibleChangeEmitter.event,this.onCancelEmitter=new eX.Q5,this.onCancel=this.onCancelEmitter.event,this.pollingDelay=1e3,this.onErrorEmitter=new eX.Q5,this.onError=this.onErrorEmitter.event,this.onSuccessEmitter=new eX.Q5,this.onSuccess=this.onSuccessEmitter.event,this._stopPolling=!1}}(0,e2.gn)([(0,e8.f)(oA),(0,e2.w6)("design:type",void 0===oA?Object:oA)],am.prototype,"options",void 0),am=(0,e2.gn)([(0,e4.b)()],am);class av{toErrorPage(){this.onErrorEmitter.fire()}constructor(){this.onErrorEmitter=new eX.Q5,this.onError=this.onErrorEmitter.event}}av=(0,e2.gn)([(0,e4.b)()],av);class ag{toKey(e){return this.widgetManager.uriToWidgetID(e)}get(e){var t=this.toKey(e);if(this.events.has(t))return this.events.get(t);var n=[];return this.events.set(t,n),n}delete(e){var t=this.toKey(e);return this.events.delete(t)}send(e,t){this.get(e).push(t),this.onSendEmitter.fire((0,tm._)({uri:e},t))}on(e){var t=this.get(e);return this.delete(e),t}compare(e,t){return this.toKey(e)===this.toKey(t)}constructor(){this.events=new Map,this.onSendEmitter=new eX.Q5,this.onSend=this.onSendEmitter.event}}(0,e2.gn)([(0,e8.f)(r9),(0,e2.w6)("design:type",void 0===r9?Object:r9)],ag.prototype,"widgetManager",void 0),ag=(0,e2.gn)([(0,e4.b)()],ag);var ab=e=>{var t=nF(oN);return(0,tq.useEffect)(()=>{var n=t.onMessageSend(e);return()=>{n.dispose()}},[]),{send:(0,tq.useCallback)(e=>{t.send(e)},[t])}},ay=n("537845"),a_=()=>nF(ag),aw=()=>{var e=a_(),t=ar(),n=(0,tq.useCallback)((t,n)=>{var r="string"==typeof t?new tD("".concat(oO,"://").concat(t)):t;e.send(r,n)},[e]);return{send:n,sendOpen:(0,tq.useCallback)((n,r)=>{var o="string"==typeof n?new tD("".concat(oO,"://").concat(n)):n;e.send(o,r),t(o9(o))},[e,t])}},ax=(e,t)=>{var n=a_(),r=(0,tq.useRef)(e),o=(0,ay.Z)(()=>{n.on(e).forEach(t)});(0,tq.useEffect)(()=>{o();var e=n.onSend(e=>{n.compare(e.uri,r.current)&&o()});return()=>e.dispose()},[n,o,r])},aS=e=>{var t=nF(r9),n=new tD("".concat(oO,"://").concat(e));return t.getWidgetFromURI(n)};class ak extends r2{refresh(){this.onRefreshEmitter.fire()}render(){return null}constructor(e){super(e),this.onRefreshEmitter=new eX.Q5,this.onRefresh=this.onRefreshEmitter.event,this.scrollOptions={minScrollbarLength:35}}}class aC{init(e,t){this.registry=e,this._widgetTitleRender=t,this.setTitle(this._title)}update(){this.widget.title.iconLabel=this._widgetTitleRender({commandRegistry:this.commandRegistry,registry:this.registry,uiState:this._uiState,title:this._title,widget:this.widget}),this.widget.title.saving="saving"===this._uiState}setTitle(e,t){this._title!==e&&this.onTitleChangedEmitter.fire(e),this._title=e,t&&(this._uiState=t),this.update()}getTitle(){return this._title}getUIState(){return this._uiState}setUIState(e){this._uiState!==e&&(this._uiState=e,this.update())}getIconType(){return this._iconType}setIconType(e){this._iconType!==e&&this.onIconTypeChangeEmitter.fire(e),this._iconType=e,this.update()}close(){this.widget.close()}constructor(){this._uiState="loading",this.onFocusEmitter=new eX.Q5,this.onFocus=this.onFocusEmitter.event,this.onTitleChangedEmitter=new eX.Q5,this.onTitleChanged=this.onTitleChangedEmitter.event,this.onIconTypeChangeEmitter=new eX.Q5,this.onIconTypeChanged=this.onIconTypeChangeEmitter.event}}(0,e2.gn)([(0,e8.f)(ak),(0,e2.w6)("design:type",ak)],aC.prototype,"widget",void 0),(0,e2.gn)([(0,e8.f)(eX.Ho),(0,e2.w6)("design:type",void 0===eX.Ho?Object:eX.Ho)],aC.prototype,"commandRegistry",void 0),aC=(0,e2.gn)([(0,e4.b)()],aC),Symbol("RegistryHandler");var aj=Symbol("ProjectIDEClientProps"),aE=n("659596");class aT{init(){this.hoverService.enableCustomHoverHost()}canHandle(e){return 500}renderer(e,t){return(null==t?void 0:t.content)?(0,tK.jsx)(aE.u,{content:t.content,position:t.position,style:{opacity:1},trigger:"custom",getPopupContainer:()=>document.body,visible:!0,children:(0,tK.jsx)("div",{style:{width:0}})},t.content):null}onDispose(){}constructor(){this.visible=!1}}(0,e2.gn)([(0,e8.f)(iD),(0,e2.w6)("design:type",void 0===iD?Object:iD)],aT.prototype,"hoverService",void 0),(0,e2.gn)([(0,td.z)(),(0,e2.w6)("design:type",Function),(0,e2.w6)("design:paramtypes",[]),(0,e2.w6)("design:returntype",void 0)],aT.prototype,"init",null),aT=(0,e2.gn)([(0,e4.b)()],aT);class aI extends ak{render(){var e=this.props.view.primarySideBar;return e?(0,tK.jsx)(e,{}):null}}(0,e2.gn)([(0,e8.f)(aj),(0,e2.w6)("design:type",void 0===aj?Object:aj)],aI.prototype,"props",void 0),aI=(0,e2.gn)([(0,e4.b)()],aI);class aP extends ak{render(){var e=this.props.view.configuration;return e?(0,tK.jsx)(e,{}):null}}(0,e2.gn)([(0,e8.f)(aj),(0,e2.w6)("design:type",void 0===aj?Object:aj)],aP.prototype,"props",void 0),aP=(0,e2.gn)([(0,e4.b)()],aP);class aM extends os{render(){return null}init(e){this.orientation="vertical",this.defaultStretch=[.7,.3],this.splitPanels=[{widgetUri:oU,widget:aI,order:1},{widgetUri:oV,widget:aP,order:2}],super.init(e)}}aM=(0,e2.gn)([(0,e4.b)()],aM);var aR=n("345420"),aD=(e,t)=>{var[n,r]=(0,tq.useState)(t.isVisible),[o,a]=(0,tq.useState)(0),s=(0,tq.useRef)(t.isVisible),[l,c]=(0,tq.useState)(!e.load),d=(0,tq.useMemo)(()=>(0,aR.Z)(e.renderContent)?e.renderContent(t.context,t):null,[e,t,o]),u=(0,tq.useCallback)((0,e3._)(function*(){if(!!e.load&&!!(0,aR.Z)(e.load))yield e.load(t.context),c(!0)}),[e,t,c]),h=(0,tq.useCallback)(e=>{var{isVisible:t}=e;return t&&!s.current&&(r(!0),s.current=!0),e.onDidChangeVisibility(e=>{e&&!s.current&&(r(!0),s.current=!0)})},[r,s]);return(0,tq.useLayoutEffect)(()=>{var e=h(t),n=t.onRefresh(()=>{a(e=>e+1)});return()=>{e.dispose(),n.dispose()}},[t,h]),(0,tq.useEffect)(()=>{u()},[u]),{loaded:l,mounted:n,content:d}};class aA{init(){this.disposable.push(this.shell.mainPanel.onDidChangeCurrent(e=>{e&&this.onFocusEmitter.fire(e)}))}dispose(){this.disposable.dispose()}constructor(){this.onFocusEmitter=new eX.Q5,this.onFocus=this.onFocusEmitter.event,this.disposable=new eX.K4(this.onFocusEmitter)}}(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],aA.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(nY),(0,e2.w6)("design:type",void 0===nY?Object:nY)],aA.prototype,"eventService",void 0),(0,e2.gn)([(0,e8.f)(i5),(0,e2.w6)("design:type",void 0===i5?Object:i5)],aA.prototype,"menuService",void 0),(0,e2.gn)([(0,td.z)(),(0,e2.w6)("design:type",Function),(0,e2.w6)("design:paramtypes",[]),(0,e2.w6)("design:returntype",void 0)],aA.prototype,"init",null),aA=(0,e2.gn)([(0,e4.b)()],aA);var aN=(e,t,n)=>{var r=nF(aA),o=nF(e5),a=(0,tq.useCallback)(()=>{var r;null==e||null===(r=e.onFocus)||void 0===r||r.call(e,t),o.setContext("widgetFocus",null==n?void 0:n.uri),o.setContext("widgetContext",t)},[t]),s=nF(iq);(0,tq.useEffect)(()=>{var o,l,c,d,u=null===(l=s.mainPanel.currentTitle)||void 0===l?void 0:null===(o=l.owner)||void 0===o?void 0:o.uri;u&&(null==n?void 0:null===(c=n.uri)||void 0===c?void 0:c.match(u))&&a();var h=r.onFocus(e=>{var t,r;(null===(t=e.owner.uri)||void 0===t?void 0:t.toString())===(null==n?void 0:null===(r=n.uri)||void 0===r?void 0:r.toString())&&a()}),p=null==n?void 0:null===(d=n.onDispose)||void 0===d?void 0:d.call(n,()=>{var n;null==e||null===(n=e.onDispose)||void 0===n||n.call(e,t)});return()=>{var e,t;null==h||null===(e=h.dispose)||void 0===e||e.call(h),null==p||null===(t=p.dispose)||void 0===t||t.call(p)}},[])},aL=e=>()=>{var t=iA(),{context:n}=t;aN(e,n,t);var{loaded:r,mounted:o,content:a}=aD(e,t);return r&&o?a:(0,tK.jsx)(aE.yC,{})};class az{onInit(){this.wsService.init(),this.props.view.widgetRegistries.forEach(e=>{if(e.registerCommands&&e.registerCommands().forEach(t=>{!this.commandRegistry.getCommand(t.id)&&this.commandRegistry.registerCommand({id:t.id,label:t.label},{execute:e=>{var n=this.contextKeyService.getContext("widgetContext");t.execute(n,e)},isEnabled:n=>{var r,o=this.contextKeyService.getContext("widgetFocus"),a=this.contextKeyService.getContext("widgetContext");return((null==o?!void 0:null===(r=o.toString)||void 0===r?!void 0:!r.call(o))||!!e.match.test(o.toString())||"widgetFocus"!==t.when)&&t.isEnable(a,n)}})}),e.registerShortcuts&&e.registerShortcuts().forEach(e=>{this.shortcutsService.registerHandlers({commandId:e.commandId,keybinding:e.keybinding,preventDefault:e.preventDefault})}),e.registerContextMenu){var t=e.registerContextMenu();this.services.contextmenu.registerContextMenu(t,e.match)}}),this.commandRegistry.unregisterCommand(eX.mY.Default.VIEW_FULL_SCREEN),this.commandRegistry.registerCommand({id:eX.mY.Default.VIEW_FULL_SCREEN,label:ad.o.t("project_ide_maximize")},{execute:()=>{this.viewService.switchFullScreenMode()}}),this.commandRegistry.registerCommand({id:oY.RELOAD,label:ad.o.t("refresh_project_tags")},{execute:e=>{if(e)e.refresh();else{var t,{currentWidget:n}=this.shell;null==n||null===(t=n.refresh)||void 0===t||t.call(n)}}}),this.shortcutsService.registerHandlers({commandId:oY.RELOAD,keybinding:"alt r",preventDefault:!1})}createLayout(e){var t=new rL;return t.id=oK.displayName,this.widgetManager.setWidget(oK.toString(),t),o1(e,t)}createWidget(e,t){var n,r=this.widgetManager.containerFactory.createChild();r.bind(ak).toSelf().inSingletonScope();var o=r.get(ak),a=null===(n=e.createStore)||void 0===n?void 0:n.call(e,t);r.bind(aC).toSelf().inSingletonScope();var s=r.get(aC);s.init(e,this.props.view.widgetTitleRender);var l={uri:t,store:a,widget:s,services:this.services};return o.context=l,o.container=r,r.bind(oL).toConstantValue(l),o.render=aL(e),o}registerView(e){var t=this.props.view.widgetRegistries.map(e=>({area:e.area||r4.MAIN_PANEL,match:e.match,createWidget:this.createWidget.bind(this,e),toolbarItems:this.props.view.preToolbar?[{render:this.props.view.preToolbar,align:r6.LEADING},{render:this.props.view.toolbar,align:r6.TRAILING}]:[]}));e.register({presetConfig:{disableContextMenu:!0,splitScreenConfig:{main:{splitOptions:{maxSplitCount:2,splitOrientation:"horizontal"},dockPanelOptions:{spacing:6}}},disableFullScreen:!0},widgetFactories:[{area:r4.MAIN_PANEL,canHandle:oq.match.bind(oq),render:this.props.view.uiBuilder},{area:r4.TOP_BAR,canHandle:oB.match.bind(oB),render:this.props.view.topBar},{area:r4.MAIN_PANEL,canHandle:oW.match.bind(oW),render:this.props.view.widgetDefaultRender},{area:r4.PRIMARY_SIDEBAR,canHandle:oF.match.bind(oF),widget:aM},{area:r4.SECONDARY_SIDEBAR,canHandle:oH.match.bind(oH),render:this.props.view.secondarySidebar},...t],defaultLayoutData:{defaultWidgets:[oB]},customLayout:this.createLayout.bind(this)})}onDispose(){this.wsService.onDispose()}}(0,e2.gn)([(0,e8.f)(aj),(0,e2.w6)("design:type",void 0===aj?Object:aj)],az.prototype,"props",void 0),(0,e2.gn)([(0,e8.f)(r9),(0,e2.w6)("design:type",void 0===r9?Object:r9)],az.prototype,"widgetManager",void 0),(0,e2.gn)([(0,e8.f)(e5),(0,e2.w6)("design:type",void 0===e5?Object:e5)],az.prototype,"contextKeyService",void 0),(0,e2.gn)([(0,e8.f)(oQ),(0,e2.w6)("design:type",void 0===oQ?Object:oQ)],az.prototype,"services",void 0),(0,e2.gn)([(0,e8.f)(eX.Ho),(0,e2.w6)("design:type",void 0===eX.Ho?Object:eX.Ho)],az.prototype,"commandRegistry",void 0),(0,e2.gn)([(0,e8.f)(t3),(0,e2.w6)("design:type",void 0===t3?Object:t3)],az.prototype,"shortcutsService",void 0),(0,e2.gn)([(0,e8.f)(iq),(0,e2.w6)("design:type",void 0===iq?Object:iq)],az.prototype,"shell",void 0),(0,e2.gn)([(0,e8.f)(oX),(0,e2.w6)("design:type",void 0===oX?Object:oX)],az.prototype,"viewService",void 0),(0,e2.gn)([(0,e8.f)(iY),(0,e2.w6)("design:type",void 0===iY?Object:iY)],az.prototype,"viewRenderer",void 0),(0,e2.gn)([(0,e8.f)(oN),(0,e2.w6)("design:type",void 0===oN?Object:oN)],az.prototype,"wsService",void 0),az=(0,e2.gn)([(0,e4.b)()],az);var aO=e0({onBind:(e,t)=>{var{bind:n}=e;n(aj).toConstantValue(t),n(aA).toSelf().inSingletonScope(),n(oX).toSelf().inSingletonScope(),n(am).toSelf().inSingletonScope(),n(ag).toSelf().inSingletonScope(),n(av).toSelf().inSingletonScope(),n(oN).toSelf().inSingletonScope(),n(oQ).toSelf().inSingletonScope(),(0,eX.KV)(n,az,[iG,eG]),(0,eX.KV)(n,aT,[nN])},onStart:e=>{e.container.get(tp).onStart()},onDispose:e=>{e.container.get(aA).dispose()}}),aB={SPLIT_LEFT:{id:"view.custom.split-left",label:ad.o.t("project_ide_tabs_open_on_left")},SPLIT_RIGHT:{id:"view.custom.split-right",label:ad.o.t("project_ide_tabs_open_on_right")},REFRESH:{id:"view.custom.refresh-widget",label:ad.o.t("refresh_project_tags")}};function aW(e){var t=0;return Array.from(e.children()).forEach(e=>{e instanceof rZ&&(t+=e.titles.length)}),t}var aF=e0({onInit(e){var t=e.container.get(i5),n=e.container.get(eX.Ho),r=e.container.get(oX),o=e.container.get(iq),a=e.container.get(t3);n.updateCommand(eX.mY.Default.VIEW_CLOSE_CURRENT_WIDGET,{label:ad.o.t("project_ide_tabs_close")}),n.updateCommand(eX.mY.Default.VIEW_CLOSE_OTHER_WIDGET,{label:ad.o.t("project_ide_tabs_close_other_tabs")}),n.updateCommand(eX.mY.Default.VIEW_CLOSE_ALL_WIDGET,{label:ad.o.t("project_ide_tabs_close_all")}),n.registerCommand(aB.REFRESH,{execute:e=>{e.refresh()}}),a.registerHandlers({keybinding:"alt r",commandId:aB.REFRESH.id}),n.registerCommand(aB.SPLIT_LEFT,{execute:e=>{r.splitScreen("left",e)},isEnabled:()=>aW(o.mainPanel)>1}),n.registerCommand(aB.SPLIT_RIGHT,{execute:e=>{r.splitScreen("right",e)},isEnabled:()=>aW(o.mainPanel)>1}),t.addMenuItem({command:eX.mY.Default.VIEW_CLOSE_CURRENT_WIDGET,selector:".lm-TabBar-tab"}),t.addMenuItem({command:eX.mY.Default.VIEW_CLOSE_OTHER_WIDGET,selector:".lm-TabBar-tab"}),t.addMenuItem({command:eX.mY.Default.VIEW_CLOSE_ALL_WIDGET,selector:".lm-TabBar-tab"}),t.addMenuItem({command:aB.REFRESH.id,selector:".lm-TabBar-tab"}),t.addMenuItem({type:"separator",selector:".lm-TabBar-tab"}),t.addMenuItem({command:aB.SPLIT_LEFT.id,selector:".lm-TabBar-tab"}),t.addMenuItem({command:aB.SPLIT_RIGHT.id,selector:".lm-TabBar-tab"})}});class aH{registerCommands(e){e.registerCommand(eX.mY.Default.VIEW_SAVING_WIDGET_CLOSE_CONFIRM,{execute:e=>{e.some(e=>null==e?void 0:e.saving)?this.modalService.onModalVisibleChangeEmitter.fire({type:af.CLOSE_CONFIRM,options:e}):e.forEach(e=>{var t,n;return null==e?void 0:null===(n=e.owner)||void 0===n?void 0:null===(t=n.close)||void 0===t?void 0:t.call(n)})}})}}(0,e2.gn)([(0,e8.f)(am),(0,e2.w6)("design:type",void 0===am?Object:am)],aH.prototype,"modalService",void 0),aH=(0,e2.gn)([(0,e4.b)()],aH);var aU=e0({onBind:e=>{var{bind:t}=e;(0,eX.KV)(t,aH,[eX.pY])}}),aV=e=>{var{presetOptions:t,plugins:n,children:r}=e,o=(0,tq.useCallback)(()=>({preferences:{defaultData:{theme:"light"}},view:{restoreDisabled:!0,widgetFactories:[],defaultLayoutData:{},widgetFallbackRender:t.view.widgetFallbackRender},plugins:[aO(t),aU(),aF(),...n||[]]}),[t,n]);return(0,tK.jsx)(oM,{options:o,className:"e2e-flow-container",children:r})},aK=n("392300");var aq=(($={}).Folder="folder",$);var aZ=((ee={}).CreateFolder="resource-folder-create-folder",ee.CreateResource="resource-folder-create-resource",ee.EditName="resource-folder-edit-name",ee.Delete="resource-folder-delete",ee),aY={"resource-folder-create-folder":{id:"resource-folder-create-folder",label:"Create Folder",executeName:"onCreateFolder"},"resource-folder-create-resource":{id:"resource-folder-create-resource",label:"Create Resource",executeName:"onCreateResource"},"resource-folder-edit-name":{id:"resource-folder-edit-name",label:"Edit Name",executeName:"onEnter"},"resource-folder-delete":{id:"resource-folder-delete",label:"Delete",executeName:"onDelete"}},aX="$-ROOT-$",aQ="resource-list-right-click-wrapper",aG={id:aX,type:aq.Folder,name:"root"},aJ="resourceFolderContextKey",a$="more-tools-class-name";var a0=((et=a0||{}).Normal="normal",et.Disabled="disabled",et),a1={textErrorColor:"rgba(var(--blockwise-error-color))",textWarningColor:"rgba(var(--blockwise-warning-color))",textSelectedColor:"rgba(6, 7, 9, 0.96)",textNormalColor:"rgba(6, 7, 9, 0.5)"},a2=(e,t)=>"".concat("resource-folder-command-prefix","_").concat(e,"_").concat(t),a4=(e,t)=>{var n=0,r=e;if(String(r.id)===String(t[n])){for(n+=1;nString(e.id)===String(t[n])),n+=1;return r}},a6=(e,t)=>{var n=null,r=null,o=(e,a)=>{if(!r){if(String(e.id)===String(t)){r={resource:e,parent:n,path:a};return}if(e.children){var s=n;n=e,e.children.forEach(e=>{o(e,[...a,e.id])}),n=s}return null}};return o(e,[e.id]),r},a5=e=>{var{resourceTree:t,from:n,to:r,options:o}=e,{collapsedMap:a}=o||{},s=[],l=!1,c=(e,t)=>{var o=String(e.id)===String(n)||String(e.id)===String(r);!l&&o?(l=!0,s.push(e.id)):l&&(s.push(e.id),o&&(l=!1)),e.children&&!(null==a?void 0:a[e.id])&&e.children.forEach(e=>{c(e,[...t,e.id])})};return c(t,[t.id]),s},a3=e=>{var t=(e,t)=>{var n,r,o,a,s=(null===(r=e.name)||void 0===r?void 0:null===(n=r.toLowerCase)||void 0===n?void 0:n.call(r))||"",l=(null===(a=t.name)||void 0===a?void 0:null===(o=a.toLowerCase)||void 0===o?void 0:o.call(a))||"";return sl?1:0},n=e.filter(e=>e.type===aq.Folder).sort((e,n)=>t(e,n)),r=e.filter(e=>e.type!==aq.Folder).sort((e,n)=>t(e,n));return n.concat(r)},a8=e=>{var{selectedId:t,resourceTree:n,collapsedMap:r,itemHeight:o}=e,a=-1,s=!1,l=e=>{if(!!e&&!s){if(a+=1,t===e.id){s=!0;return}e.children&&!r[e.id]&&e.children.forEach(e=>{l(e)})}};return l(n),(a-1)*o},a9=e=>{if(!e)return{};var t=(0,tv._)((0,tm._)({},aG),{children:e instanceof Array?e:[e]}),n={},r=(e,t)=>{if(!e)return{maxDeep:t.length-1};var o=t.length+("folder"===e.type?1:0),a="draft"===e.edit_status;return e.children&&e.children.forEach(e=>{var{maxDeep:n,editDraft:s}=r(e,[...t,e.id]);o=Math.max(o,n),a=!!(a||s)}),n[String(e.id)]=(0,tv._)((0,tm._)({},e),{path:t,maxDeep:o-t.length}),{maxDeep:o,editDraft:a}};return r(t,[t.id]),n},a7=(e,t,n)=>{var r=[],o=e=>(r.push(t[e.id]),e.children&&!n[e.id]&&e.children.forEach(e=>{o(e)}),null);return o(e),r},se=e=>{for(var{resourceList:t,parentId:n,type:r}=e,o=0,a=!1,s=[];o64?"Length exceeds":/^[A-Za-z]/.test(t)?/^[A-Za-z][0-9a-zA-Z_]*$/.test(t)?"":"only ASCII letters, digits, and _":"Must start with letter":"Empty Key"}var sn=n("825251"),sr=n("70131"),si="name_input_wrapper",so=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!e||!!(n>10)||(null===(t=e.dataset)||void 0===t?void 0:t[si])===void 0&&so(e.parentElement,n+1)},sa=e=>{var t,n,r,o,{resource:a,initValue:s,handleSave:l,handleChangeName:c,errorMsg:d,errorMsgRef:u,validateConfig:h,config:p}=e,[f,m]=(0,tq.useState)(s),v=(0,tq.useRef)(null),g=()=>{l((null==u?void 0:u.current)?s:void 0)},b=(0,tq.useRef)(!1);return(0,tq.useEffect)(()=>{setTimeout(()=>{b.current=!0},0);var e=e=>{so(e.target)&&g()};return window.addEventListener("mousedown",e,!0),()=>{window.removeEventListener("mousedown",e,!0)}},[]),(0,tK.jsxs)("div",{["data-".concat(si)]:!0,className:"base-item-name-input ".concat("mouseup-ignore-class-name"," ").concat(d?"base-item-name-input-error":""),style:{width:"100%"},children:[(0,tK.jsx)(aE.II,{className:(null==p?void 0:null===(t=p.input)||void 0===t?void 0:t.className)||"",style:(0,tm._)({padding:0},null==p?void 0:null===(n=p.input)||void 0===n?void 0:n.style),ref:v,placeholder:null==p?void 0:null===(r=p.input)||void 0===r?void 0:r.placeholder,onMouseDown:e=>{e.stopPropagation()},onKeyDown:e=>{e.stopPropagation(),"Escape"===e.code&&l("")},onEnterPress:e=>{if(!!b.current)e.stopPropagation(),e.preventDefault(),g()},onChange:e=>{m(e),c(e)},value:f,autoFocus:!0}),d?(null==h?void 0:h.errorMsgRender)?null==h?void 0:null===(o=h.errorMsgRender)||void 0===o?void 0:o.call(h,d,a):(0,tK.jsx)("div",{style:(null==h?void 0:h.errorMsgStyle)||{},className:"base-item-name-input-error-msg-absolute ".concat(null==h?void 0:h.errorMsgClassName),children:d}):null]})},ss=n("873183"),sl=e=>{var{resource:t,contextMenuCallback:n,resourceTreeWrapperRef:r,renderMoreSuffix:o}=e,a=e=>{e.currentTarget=r.current,n(e,[t])},s=(0,tK.jsx)(aE.zx,(0,tv._)((0,tm._)({"data-testid":"agent-ide.resource-item.".concat(t.type,".").concat(t.name,".more-tools")},"object"==typeof o&&(null==o?void 0:o.extraProps)?null==o?void 0:o.extraProps:{}),{className:"base-item-more-hover-display-class ".concat(a$," base-item-more-btn ").concat("object"==typeof o&&o.className?o.className:""),style:"object"==typeof o&&o.style?o.style:{},icon:(0,tK.jsx)(ss.NsR,{}),theme:"borderless",size:"small",onMouseUp:a}));if("object"==typeof o&&o.render)return o.render({onActive:a,baseBtn:s,resource:t});if("object"==typeof o&&o.tooltip)return"string"==typeof o.tooltip?(0,tK.jsx)(aE.u,{content:o.tooltip,children:s}):(0,tK.jsx)(aE.u,(0,tv._)((0,tm._)({},o.tooltip),{children:s}));return s},{Text:sc}=aE.ZT,sd=(0,tq.memo)(e=>{var{name:t,resource:n,searchConfig:r,isSelected:o,tooltipSpace:a,textRender:s}=e,l=(()=>{var e,t;if((null===(e=n.problem)||void 0===e?void 0:e.status)==="error")return a1.textErrorColor;if((null===(t=n.problem)||void 0===t?void 0:t.status)==="warning")return a1.textWarningColor;if(o)return a1.textSelectedColor;return a1.textNormalColor})();return(0,tK.jsx)("span",{style:{flex:1,display:"flex",height:"100%",alignItems:"center",justifyContent:"space-between",overflow:"hidden",fontSize:12},children:(0,tK.jsx)(sc,{style:{flex:1},ellipsis:{showTooltip:{opts:{content:"".concat(t),style:{wordBreak:"break-all"},position:"right",spacing:8+(a||0)}}},children:s?s({resource:n,isSelected:o}):(0,tK.jsx)("span",{style:{color:l},children:(0,tK.jsx)(aE.y$,{sourceString:t,searchWords:[(null==r?void 0:r.searchKey)||""],highlightStyle:(0,tv._)((0,tm._)({},null==r?void 0:r.highlightStyle),{backgroundColor:"transparent",color:"var(--semi-color-primary)"})})})})})},(e,t)=>{var n,r;return e.name===t.name&&(null===(n=e.searchConfig)||void 0===n?void 0:n.searchKey)===(null===(r=t.searchConfig)||void 0===r?void 0:r.searchKey)&&e.resource===t.resource&&e.isSelected===t.isSelected&&!0}),su=e=>{var{resource:t,path:n,icon:r,isSelected:o,isTempSelected:a,isInEdit:s,searchConfig:l,suffixRender:c,config:d,renderMoreSuffix:u,textRender:h,isDragging:p,useOptimismUI:f,isOptimismSaving:m,contextMenuCallback:v,resourceTreeWrapperRef:g}=e,b=(0,ij._)(e,["resource","path","icon","isSelected","isTempSelected","isInEdit","searchConfig","suffixRender","config","renderMoreSuffix","textRender","isDragging","useOptimismUI","isOptimismSaving","contextMenuCallback","resourceTreeWrapperRef"]),{name:y,status:_}=t,w=(0,tq.useMemo)(()=>m&&"object"==typeof f&&f.loadingRender?f.loadingRender():null,[m]),x=(0,tq.useMemo)(()=>{var e;return!s&&(null==c?void 0:null===(e=c.render)||void 0===e?void 0:e.call(c,{resource:t,isSelected:o,isTempSelected:a}))},[o,s,t,a]),S=(0,tq.useMemo)(()=>!s&&u?(0,tK.jsx)(sl,{resource:t,contextMenuCallback:v,resourceTreeWrapperRef:g,renderMoreSuffix:u}):null,[s,t,u]);return(0,tK.jsxs)("div",{"data-testid":"agent-ide.resource-item.".concat(t.type,".").concat(t.name),className:"base-item",style:(0,tm._)({justifyContent:"space-between",height:(null==d?void 0:d.itemHeight)||24,borderRadius:4,paddingLeft:(n.length-1)*((null==d?void 0:d.tabSize)||8)-4},_===a0.Disabled?{fontStyle:"italic",filter:"opacity(0.5)",cursor:"not-allowed",textDecoration:"line-through"}:{}),children:[(0,tK.jsxs)("div",{style:{display:"flex",overflow:s?"visible":"hidden",width:"100%"},children:[r?(0,tK.jsx)("span",{className:"base-item-icon",style:{color:"rgba(6, 7, 9, 0.96)"},children:r}):null,s?(0,tK.jsx)(sa,{resource:t,initValue:y,handleSave:b.handleSave,handleChangeName:b.handleChangeName,errorMsg:b.errorMsg,errorMsgRef:b.errorMsgRef,validateConfig:b.validateConfig,config:d}):(0,tK.jsx)(sd,{isSelected:o,resource:t,name:y,searchConfig:l,tooltipSpace:((null==c?void 0:c.width)||0)+(u?26:0),textRender:h})]}),w,x,S]},t.id)},sh=e=>{var{resource:t,path:n,style:r}=e,o=(0,ij._)(e,["resource","path","style"]),{id:a}=t,{iconRender:s,isSelected:l,isTempSelected:c,isExpand:d,draggingError:u,isDragging:h}=o,p=1===n.length;return(0,tK.jsx)(tK.Fragment,{children:(0,tK.jsx)("div",{style:(0,tv._)((0,tm._)({},r||{}),{cursor:u?"not-allowed":h?"grabbing":"default"}),children:!p&&(0,tK.jsx)(su,(0,tm._)({resource:t,path:n,icon:s?s({resource:t,isSelected:l,isTempSelected:c,isExpand:d}):void 0},o))},"folder-".concat(a))})},sp=e=>{var{resource:t,path:n}=e,r=(0,ij._)(e,["resource","path"]),{isDragging:o,draggingError:a,isSelected:s,isTempSelected:l,iconRender:c}=r;return(0,tK.jsx)("div",{style:{cursor:a?"not-allowed":o?"grabbing":"pointer"},children:(0,tK.jsx)(su,(0,tm._)({resource:t,path:n,icon:(null==t?void 0:t.type)?null==c?void 0:c({resource:t,isSelected:s,isTempSelected:l}):void 0},r))},"file-".concat(t.id))},sf=e=>{var t=(0,sn._)({},(0,sr._)(e)),{resource:n,path:r}=t,o=n.type===aq.Folder?sh:sp;return o?(0,tK.jsx)(o,(0,tv._)((0,tm._)({},t),{path:[...r,n.id]}),"base-render-".concat(n.id)):(0,tK.jsx)(tK.Fragment,{})},sm=(e,t)=>{var[n,r]=(0,tq.useState)(e),o=(0,tq.useRef)(e);return[o,e=>{o.current=e,r(e),null==t||t(e)},n]},sv=e=>{var{selected:t,resourceMap:n,collapsedMapRef:r,setCollapsed:o,tempSelectedMapRef:a,setTempSelectedMap:s,scrollInView:l,updateContext:c}=e,d=(0,tq.useRef)(t||"");return(0,tq.useEffect)(()=>{var e,u;if(!t){s({});return}d.current=t,c({currentSelectedId:t}),((null===(e=n.current[t])||void 0===e?void 0:e.path)||[]).forEach(e=>{delete r.current[e]}),o((0,tm._)({},r.current)),a.current={},(null===(u=n.current)||void 0===u?void 0:u[t])&&(a.current={[t]:n.current[t]}),s(a.current),setTimeout(()=>{l(t)},16)},[t]),d},sg=e=>e.map(e=>"type"in e?e:aY[e.id]?(0,tv._)((0,tm._)({},aY[e.id],e),{id:e.id}):(0,tv._)((0,tm._)({},e),{id:e.id})),sb=new Set,sy="resource-folder-separator-key",s_=e=>{var{tempSelectedMapRef:t,contextMenuHandler:n,registerCommand:r,id:o,contextMenuDisabled:a,onContextMenuVisibleChange:s}=e,l=nF(i5),c=(0,tq.useRef)(0),d=(0,tq.useRef)(0),u=(0,tq.useRef)(!1),h=e=>{u.current!==e&&(u.current=e,null==s||s(u.current))},p=()=>{l.clearMenuItems([...sb.keys(),...Object.keys(aY),...Array(c.current).fill(null).map(e=>e=>e===sy)].filter(Boolean)),c.current=0,d.current=0},f=()=>{var e,t,n;p(),null==l||null===(n=l.contextMenu)||void 0===n||null===(t=n.menu)||void 0===t||null===(e=t.close)||void 0===e||e.call(t),null==h||h(!1)};return(0,tq.useEffect)(()=>{var e,t,n,r;return null==l||null===(r=l.contextMenu)||void 0===r||null===(n=r.menu)||void 0===n||null===(t=n.aboutToClose)||void 0===t||null===(e=t.connect)||void 0===e||e.call(t,()=>{u.current&&(null==h||h(!1))}),()=>{f()}},[]),{contextMenuCallback:(e,s)=>{var u=sg(n?n(s||Object.values(t.current)):[]);return r(u),p(),u.forEach(e=>{if("type"in e){c.current=c.current+1,d.current=d.current+1,l.addMenuItem({command:sy,type:"separator",selector:".".concat(a2(aQ,o))});return}if(!!e.id)!sb.has(e.id)&&sb.add(e.id),!a&&(d.current=d.current+1,l.addMenuItem({command:e.id,selector:".".concat(a2(aQ,o)),args:e,tooltip:e.tooltip}))}),!a&&d.current>0&&(l.open(e),setTimeout(()=>{null==h||h(!0)},0)),()=>{f()}},closeContextMenu:f}},sw=e=>{var{isFocus:t,id:n,updateContext:r,clearContext:o,selectedIdRef:a,tempSelectedMapRef:s}=e,l=(0,tq.useRef)({}),c=nF(eX.Ho),d=(0,tq.useRef)({onEnter:()=>{var e,t;null===(e=(t=l.current)[aZ.EditName])||void 0===e||e.call(t)},onDelete:()=>{var e,t;null===(e=(t=l.current)[aZ.Delete])||void 0===e||e.call(t)},onCreateFolder:()=>{var e,t;null===(e=(t=l.current)[aZ.CreateFolder])||void 0===e||e.call(t)},onCreateResource:()=>{var e,t;null===(e=(t=l.current)[aZ.CreateResource])||void 0===e||e.call(t)}});return(0,tq.useEffect)(()=>{t?r((0,tv._)((0,tm._)({},d.current),{currentSelectedId:a.current,tempSelectedMap:s.current,id:n})):o()},[t]),{registerEvent:(e,t)=>{l.current[e]=t},registerCommand:e=>{e.forEach(e=>{if(!("type"in e))aY[e.id]?(e.label||e.shortLabel)&&c.updateCommand(e.id,(0,tm._)({},e.label?{label:e.label}:{},e.shortLabel?{shortLabel:e.shortLabel}:{})):e.execute&&(c.getCommand(e.id)&&c.unregisterCommand(e.id),c.registerCommand({id:e.id,label:e.label,shortLabel:e.label},{execute:()=>{var t;null===(t=e.execute)||void 0===t||t.call(e)},isEnabled:e=>!e.disabled,isVisible:e=>!e.isHidden}))})}}},sx=e=>{var{enable:t,onChange:n=aK.Z,onDrag:r=aK.Z,onChangeName:o=aK.Z,onCreate:a=aK.Z,onDelete:s=aK.Z,onRevertDelete:l=aK.Z,changeResourceTree:c,scrollInView:d,resourceTreeRef:u,resourceMap:h}=e,[p,f]=(0,tq.useState)({}),m=e=>{var t=e instanceof Array?e:[e];f((0,tm._)({},p,t.reduce((e,t)=>(0,tm._)({[t]:!0},e),{})))},v={optimismSavingMap:p,clearOptimismSavingMap:()=>{f({})}};return t?(0,tm._)({handleDrag:e=>{var t,o,{toId:a,resourceList:s}=e;if(!!a&&!!s){s.forEach(e=>{var t=a4(u.current,e.path.slice(0,e.path.length-1));(null==t?void 0:t.children)&&(t.children=t.children.filter(t=>t.id!==e.id))});var l=null===(t=a6(u.current,a))||void 0===t?void 0:t.resource;l&&(l.children=a3([...l.children||[],...s])),m(s.map(e=>e.id)),c(u.current),null==r||r(e),null==n||n((null===(o=u.current)||void 0===o?void 0:o.children)||[])}},handleChangeName:e=>{var t,r=a4(u.current,e.path||[]);if(!!r)r.name=e.name,m(r.id),c(u.current),null==o||o(e),null==n||n((null===(t=u.current)||void 0===t?void 0:t.children)||[])},handleCreate:e=>{var t,{path:r,type:o,name:s}=e,l=a4(u.current,r);if(!!l){var p="".concat("resource-folder-optimism-id-").concat(Number(new Date)),f={id:p,type:o,name:s};m(p),l.children=a3([...l.children||[],f]),c(u.current),a(e),h.current[p]=f,null==d||d(p),null==n||n((null===(t=u.current)||void 0===t?void 0:t.children)||[])}},handleDelete:e=>{s(e)},handleRevertDelete:e=>{var t;e.forEach(e=>{var t=a4(u.current,e.path||[]);t&&(t.status="normal")}),c(u.current),null==l||l(e),null==n||n((null===(t=u.current)||void 0===t?void 0:t.children)||[])}},v):(0,tm._)({handleDrag:r,handleChangeName:o,handleCreate:a,handleDelete:s,handleRevertDelete:l},v)},sS="resource_folder_key",sk="resource_folder_drag_and_drop_stop_tag",sC="resource_folder_drag_and_drop_id",sj="click_tool_bar",sE="click_outside",sT="click_context_menu",sI=(e,t)=>e.x>t.x&&e.xt.y&&e.y{var{e:t,wrapperElm:n,uniqId:r}=e,{pageX:o,pageY:a}=t,{x:s,y:l,width:c,height:d}=n.getBoundingClientRect();return sI({x:o,y:a},{x:s,y:l,width:c,height:d})&&!sI({x:o,y:a},{x:s+8,y:l+8,width:c-16,height:d-16})?aG:sM(t.target,r)},sM=(e,t,n)=>{var r,o,a,s,l,c={};if(n&&(null==e?void 0:null===(o=e.classList)||void 0===o?void 0:null===(r=o.contains)||void 0===r?void 0:r.call(o,n))&&(c.customTag=n),!e)return sE;if((null===(a=e.dataset)||void 0===a?void 0:a[sC])!==void 0&&(null===(s=e.dataset)||void 0===s?void 0:s[sS])===t)return(0,tm._)({id:e.dataset[sC]},c);if((null===(l=e.dataset)||void 0===l?void 0:l[sk])&&e.dataset[sS]===t)return(0,tm._)({id:aX},c);if(e.classList.contains("resource_folder_tool_bar_class_name"))return sj;var d=sM(e.parentElement,t,n);return"object"==typeof d&&null!==d?(0,tm._)({},d,c):d},sR=e=>{var t;if(!e)return"";if("folder"===e.type)return String(e.id);return String(null===(t=e.path)||void 0===t?void 0:t[e.path.length-2])},sD=(e,t)=>!!(Math.abs(t.x-e.x)>10||Math.abs(t.y-e.y)>10)||!1,sA=(e,t,n)=>{var{name:r,path:o,id:a}=t,s=e.filter(e=>{var t=e.path||[];return t[t.length-2]===a});if(s.length)return"Can't move ".concat(s.map(e=>e.name).join(", ")," into ").concat(r);var l=e.filter(e=>(o||[]).includes(String(e.id)));if(l.length)return"Can't move ".concat(l.map(e=>e.name).join(", ")," into ").concat(r);var c=e.reduce((e,t)=>Math.max(e,((null==t?void 0:t.maxDeep)||0)+1),0);return(t.path||[]).length-1+c>((null==n?void 0:n.maxDeep)||5)?"Can't move into ".concat(r,". MaxDeep is ").concat((null==n?void 0:n.maxDeep)||5):""};var sN=((en=sN||{}).MouseDown="mouseDown",en.MouseDownInDiv="mouseDownInDiv",en.MouseUpInDiv="mouseUpInDiv",en.MouseUp="mouseUp",en.MouseMove="mouseMove",en.KeyDown="keyDown",en),sL=()=>{var e=(0,tq.useRef)([]),t=(0,tq.useRef)([]),n=(0,tq.useRef)([]),r=(0,tq.useRef)([]),o=(0,tq.useRef)([]),a=(0,tq.useRef)([]),s=t=>{e.current.forEach(e=>{e(t)})},l=e=>{t.current.forEach(t=>{t(e)})},c=e=>{n.current.forEach(t=>{t(e)})},d=e=>{r.current.forEach(t=>{t(e)})},u=e=>{a.current.forEach(t=>{t(e)})},h=e=>{o.current.forEach(t=>{t(e)})};return(0,tq.useEffect)(()=>(window.addEventListener("mousedown",s),window.addEventListener("mouseup",d),window.addEventListener("keydown",u),window.addEventListener("mousemove",h),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("mouseup",d),window.removeEventListener("keydown",u),window.removeEventListener("mousemove",h)}),[]),{addEventListener:(s,l)=>{"keyDown"===s?a.current.push(l):"mouseDownInDiv"===s?t.current.push(l):"mouseUpInDiv"===s?n.current.push(l):"mouseDown"===s?e.current.push(l):"mouseUp"===s?r.current.push(l):"mouseMove"===s&&o.current.push(l)},customEventBox:e=>{var{children:t}=e;return(0,tK.jsx)("div",{className:"resource-list-custom-event-wrapper",onMouseDownCapture:l,onMouseUp:c,children:t})},onMouseDownInDiv:l,onMouseUpInDiv:c}},sz=e=>{var t,n,r,{iconRender:o,selectedMap:a,addEventListener:s,config:l}=e,[c,d]=(0,tq.useState)(!1),u=(0,tq.useRef)(!1),[h,p]=(0,tq.useState)(null),f=e=>{u.current&&p({x:e.clientX,y:e.clientY})};(0,tq.useEffect)(()=>{s(sN.MouseMove,f)},[]);var m=!h||(null==l?void 0:null===(t=l.dragUi)||void 0===t?void 0:t.disable)?(0,tK.jsx)(tK.Fragment,{}):(0,tK.jsx)("div",{style:(0,tm._)({position:"absolute",zIndex:99999,top:5,left:5,display:c&&(null==h?void 0:h.x)?"block":"none",transform:"translate(".concat((null==h?void 0:h.x)||0,"px, ").concat((null==h?void 0:h.y)||0,"px)"),userSelect:"none",pointerEvents:"none",backgroundColor:"rgba(6, 7, 9, 0.08)",borderRadius:6,padding:"2px 4px",minWidth:20,minHeight:20},(null==l?void 0:null===(n=l.dragUi)||void 0===n?void 0:n.wrapperStyle)||{}),className:(null==l?void 0:null===(r=l.dragUi)||void 0===r?void 0:r.wrapperClassName)||"",children:Object.values(a).length>1?(0,tK.jsx)(tK.Fragment,{children:Object.values(a).length}):Object.values(a).map(e=>(0,tK.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.type)?(0,tK.jsx)("span",{style:{marginRight:4},children:null==o?void 0:o({resource:e})}):(0,tK.jsx)(tK.Fragment,{}),(0,tK.jsx)("span",{children:e.name})]},e.name))});return{handleDrag:e=>{u.current=e,d(e),p(null),e?document.body.style.cursor="grabbing":document.body.style.cursor=""},isDragging:c,isDraggingRef:u,dragPreview:m}},sO=e=>{var{draggable:t,uniqId:n,updateId:r,setTempSelectedMap:o,collapsedMapRef:a,setCollapsedMap:s,resourceTreeRef:l,onDrag:c,disabled:d,resourceMap:u,addEventListener:h,selectedIdRef:p,onSelected:f,tempSelectedMapRef:m,resourceTreeWrapperRef:v,iconRender:g,config:b}=e,y=(0,tq.useRef)(null),[_,w]=(0,tq.useState)(!1),x=(0,tq.useRef)(!1),S=nF(oi),[k,C]=(0,tq.useState)(""),j=(0,tq.useRef)(null),{isDragging:E,isDraggingRef:T,handleDrag:I,dragPreview:P}=sz({iconRender:g,selectedMap:m.current,addEventListener:h,config:b}),M=e=>{if(!(null==b?void 0:b.resourceUriHandler))return;var t,n=Object.values(m.current).filter(e=>e.type!==aq.Folder).map(e=>{var t;return null===(t=b.resourceUriHandler)||void 0===t?void 0:t.call(b,e)}).filter(Boolean);if(!!n.length)null==S||null===(t=S.startDrag)||void 0===t||t.call(S,{uris:n,position:{clientX:e.clientX,clientY:e.clientY},callback:e=>{},backdropTransform:{clientX:e=>{var t;return Math.max(e,((null===(t=v.current)||void 0===t?void 0:t.clientWidth)||0)+100)}}})},R=e=>{t&&(M(e),C(""),I(!0))},D=()=>{C(""),I(!1)},A=e=>{var t=Object.values(e);1===t.length?j.current=t[0]:0===t.length&&(j.current=null),m.current=e,o(e)},[N,L]=(0,tq.useState)(null),z=(0,tq.useRef)(null),[O,B]=(0,tq.useState)({});(0,tq.useEffect)(()=>{if(null==N?void 0:N.id){var e=sR(N);e!==z.current&&(B((u.current[e]?a7(u.current[e],u.current,a.current):[]).reduce((e,t,n)=>(0,tv._)((0,tm._)({},e),{[t.id]:(0,tm._)({},t)}),{})),z.current=e)}else z.current=null,B({})},[null==N?void 0:N.id]);var W=()=>{r(),w(!0),x.current=!0},F=()=>{A({}),w(!1),x.current=!1},H=()=>{var e=Object.values(m.current).filter(e=>e.id!==aX);return e=e.filter(e=>{var{type:t,path:n}=u.current[e.id];if(t!==aq.Folder){var r=n||[];return!(r||[]).slice(0,r.length-1).some(e=>e!==aX&&m.current[e])}return!0})},U=e=>{if(null==d?void 0:d.current)return;var t=sM(e.target,n);if(!!t){if(W(),"object"==typeof t&&0===e.button&&(y.current={x:e.clientX,y:e.clientY}),"object"==typeof t&&!e.shiftKey&&!e.metaKey){var r,o,a=null;(null==(a=t.id===aX?aG:(null==u?void 0:null===(o=u.current)||void 0===o?void 0:o[String(null==t?void 0:t.id)])||{})?void 0:a.id)&&!(null===(r=m.current)||void 0===r?void 0:r[a.id])&&A({[a.id]:a})}}},V=e=>{if((null==d?!void 0:!d.current)&&!!x.current){var t=sM(e.target,n);if(D(),!t||t===sE){F();return}if(t===sT)return}},K=e=>{if((null==d?!void 0:!d.current)&&!T.current){var t=sM(e.target,n,a$);if("object"==typeof t&&null!==t){var r=null;if(r=t.id===aX?aG:(null==u?void 0:null===(c=u.current)||void 0===c?void 0:c[String(null==t?void 0:t.id)])||{},t.customTag===a$){A({[r.id]:r});return}if(e.ctrlKey||2===e.button&&(null==r?void 0:r.id)&&(null===(o=m.current)||void 0===o?void 0:o[r.id]))return;if(e.shiftKey){var o,c,h,v=(null===(h=j.current)||void 0===h?void 0:h.id)||(null==p?void 0:p.current);if(!v||!(null==r?void 0:r.id)||v===(null==r?void 0:r.id))return;var g=a5({resourceTree:l.current,from:v,to:r.id,options:{collapsedMap:a.current}});(g=(g||[]).reduce((e,t)=>{var n="object"==typeof t?String(t.id):String(t);return(0,tv._)((0,tm._)({},e),{[n]:null==u?void 0:u.current[n]})},{}))[aX]&&delete g[aX],A(g)}else if(e.metaKey){var b=(0,tm._)({},m.current);(null==r?void 0:r.id)&&(b[r.id]?delete b[r.id]:b=(0,tv._)((0,tm._)({},b),{[r.id]:r})),b[aX]&&delete b[aX],A(b)}else(null==r?void 0:r.type)&&"folder"!==r.type&&(null==f||f(r.id,r)),(null==r?void 0:r.id)&&A({[r.id]:r})}(!T.current||!Object.keys(m.current).length)&&"object"==typeof t&&null!==t&&t.id!==aX&&0===e.button&&!e.shiftKey&&!e.metaKey&&s(t.id,!a.current[t.id])}},q=e=>{if(null==d?!void 0:!d.current){if(T.current&&Object.keys(m.current).length&&v.current){var t=sP({e,wrapperElm:v.current,uniqId:n});if(t===sT||!t)return;if("object"==typeof t){var r=H(),o=sR(u.current[t.id]),a=sA(r,u.current[o],b);a?null==c||c({errorMsg:a}):(null==c||c({resourceList:r,toId:o}),s(o,!1))}D()}y.current=null,L(null)}};return(0,tq.useEffect)(()=>{h(sN.MouseDown,V),h(sN.MouseDownInDiv,U),h(sN.MouseUpInDiv,K),h(sN.MouseUp,q)},[]),{context:{isDragging:E,draggingError:k,isFocus:_,dataHandler:e=>({["data-".concat(sC)]:e.id,["data-".concat(sS)]:n}),tempSelectedMapRef:m,currentHoverItem:N,highlightItemMap:O},isFocusRef:x,onMouseMove:e=>{if((null==d?void 0:d.current)||!y.current)return;var t=Object.values(m.current);if(0===t.length||1===t.length&&t[0].id===aX||!(T.current||sD(y.current,{x:e.clientX,y:e.clientY})))return;if(!T.current){R(e);return}if(!v.current)return;var r=sP({e,wrapperElm:v.current,uniqId:n});if(r!==sT){if(!r||r===sE||r===sj){L(null);return}if("object"==typeof r&&(null==r?void 0:r.id)!==(null==N?void 0:N.id)){if((null==r?void 0:r.id)===aX)L(aG);else{L(u.current[String(null==r?void 0:r.id)]);var o=sR(u.current[r.id]);C(sA(H(),u.current[o],b))}}}},dragPreview:P,handleFocus:W,handleBlur:F}},sB=e=>{var{resourceTreeRef:t,collapsedMapRef:n,resourceMap:r,config:o}=e,a=(0,tq.useRef)(null),s=(0,tq.useRef)(!0);return{scrollInView:e=>{if(!a.current||!s.current||!e||!t.current||!(null==r?void 0:null===(l=r.current)||void 0===l?void 0:l[e]))return;var l,c=a8({selectedId:e,resourceTree:t.current,collapsedMap:n.current,itemHeight:(null==o?void 0:o.itemHeight)||24});if(!(c>a.current.scrollTop)||!(c{s.current=!1,setTimeout(()=>{s.current=!0},e||300)}}};class sW{registerPromiseFn(e){return this.mainFunction=e,this}registerCallbackFb(e){return this.callbacks.push(e),this}excute(e){var t=this;return(0,e3._)(function*(){if(!!t.mainFunction){t.lastVersion+=1;var n=t.lastVersion,r=yield t.mainFunction(e);t.lastVersion===n&&t.callbacks.forEach(e=>e(r))}})()}dispose(){this.callbacks=[]}constructor(){this.callbacks=[],this.lastVersion=0}}var sF=e=>{var{validator:t,callback:n}=e,r=(0,tq.useRef)(new sW);return(0,tq.useEffect)(()=>(r.current.registerPromiseFn(t).registerCallbackFb(n),()=>{var e,t;null===(t=r.current)||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}),[]),{validateAndUpdate:e=>{var t;null===(t=r.current)||void 0===t||t.excute(e)}}},sH=e=>{var t,{folderEnable:n,defaultResourceType:r,tempSelectedMapRef:o,registerEvent:a,setCollapsedMap:s,onChangeName:l,onCreate:c,resourceMap:d,selectedIdRef:u,resourceTreeRef:h,onDelete:p,validateConfig:f,config:m,resourceList:v}=e,[g,b]=(0,tq.useState)(""),y=(0,tq.useRef)(""),[_,w]=(0,tq.useState)(!1),x=(0,tq.useRef)(!1),S=e=>{x.current=e,w(e)},[k,C]=(0,tq.useState)(null),j=(0,tq.useRef)(null),[E,T]=(0,tq.useState)(null),I=(0,tq.useRef)(null),P=(0,tq.useRef)(null),M=(0,tq.useRef)(null),R=()=>{C(null),j.current=null,T(null),I.current=null,S(!1),b(""),y.current="",P.current=null,M.current=null},D=e=>{var t=d.current[e];t&&t.status!==a0.Disabled&&(C(t),j.current=t,S(!0),P.current=t.name,M.current=t.name)},A=()=>{var e=o.current;1===Object.keys(e).filter(e=>e!==aX).length&&D(Object.values(e)[0].id)},{validateAndUpdate:N}=sF({validator:(null==f?void 0:f.customValidator)||st,callback:e=>{if(e){b(e),y.current=e;return}b(""),y.current=""}});var L=(t=(0,e3._)(function*(e){var t=e||r;if(!!t&&(!!n||t!==aq.Folder)){var a=Object.values(o.current||{})[0];if(!a&&(a=d.current[u.current]),!a&&(a=d.current[aX]),"folder"!==a.type&&(null==a?void 0:a.path)&&(a=d.current[a.path[a.path.length-2]]),((null==a?void 0:null===(l=a.path)||void 0===l?void 0:l.length)||0)+(t===aq.Folder?1:0)>((null==m?void 0:m.maxDeep)||5)){aE.FN.warning("Can't create ".concat(t,". MaxDeep is 5"));return}if(a){var l,c,h,p=a.id;"folder"!==a.type&&(p=(null===(h=a.path)||void 0===h?void 0:h[(null===(c=a.path)||void 0===c?void 0:c.length)-2])||""),P.current="",M.current="",s(p,!1),yield new Promise(e=>{setTimeout(()=>{e(null)},0)}),j.current={id:"-1",name:"",type:t},C(j.current),I.current={parentId:p,type:t};var f=se({resourceList:v.current,parentId:p,type:t});T({parentId:p,type:t,index:f}),S(!0)}}}),function(e){return t.apply(this,arguments)});return(0,tq.useEffect)(()=>{a(aZ.EditName,()=>{!j.current&&A()}),a(aZ.Delete,()=>{var e=Object.values(o.current).filter(e=>e.id!==aX);e.length>0&&(null==p||p(e))}),a(aZ.CreateFolder,()=>{L(aq.Folder)}),a(aZ.CreateResource,e=>{L(e)})},[]),{context:{isInEditMode:_,editResourceId:null==k?void 0:k.id,createResourceInfo:E,handleChangeName:e=>{if(M.current=e,null==I?void 0:I.current){var t,n;N({type:"create",label:e||"",parentPath:(null===(t=d.current[null==I?void 0:null===(n=I.current)||void 0===n?void 0:n.parentId])||void 0===t?void 0:t.path)||[],resourceTree:h.current,id:"-1"})}else if(null==j?void 0:j.current){var r,o=(null==j?void 0:null===(r=j.current)||void 0===r?void 0:r.path)||[];N({type:"edit",label:e||"",parentPath:o.slice(0,(null==o?void 0:o.length)-1)||[],resourceTree:h.current,id:j.current.id})}},errorMsg:g,errorMsgRef:y,handleSave:e=>{var t,n,r,o,a,s,u=void 0===e?M.current||"":e;j.current&&("-1"===j.current.id?""!==u&&(null===(t=I.current)||void 0===t?void 0:t.parentId)&&(null==c||c({parentId:null===(n=I.current)||void 0===n?void 0:n.parentId,name:u,type:null===(r=I.current)||void 0===r?void 0:r.type,path:(null===(s=d.current)||void 0===s?void 0:null===(o=s[null===(a=I.current)||void 0===a?void 0:a.parentId])||void 0===o?void 0:o.path)||[]})):""!==u&&u!==P.current&&j.current.id&&(null==l||l({id:j.current.id,name:u,type:j.current.type,path:d.current[j.current.id].path,resource:d.current[j.current.id]}))),R()}},onCreateResource:L,isInEditModeRef:x,handleRenderList:(e,t)=>{if(!t)return e;var{index:n}=t;return[...e.slice(0,n),"-1",...e.slice(n,e.length)]},handleRename:D}},sU=e=>{var t=(0,tq.useRef)({id:e}),n=nF(e5),r=e=>{n.setContext(aJ,e)},o=()=>n.getContext(aJ);return{updateContext:n=>{var a;(null===(a=o())||void 0===a?void 0:a.id)===e&&(t.current=(0,tm._)({},t.current,n),r(t.current))},clearContext:()=>{var r;(null===(r=o())||void 0===r?void 0:r.id)===e&&n.setContext(aJ,void 0),t.current={id:e}},updateId:()=>{r(t.current)}}},sV=e=>{var{_collapsedMap:t,_setCollapsedMap:n,resourceMap:r}=e,[o,a,s]=sm(t||{});(0,tq.useEffect)(()=>{t&&a(t)},[t]);var l=e=>{null==n||n(e),!t&&a(e)};return{handleCollapse:(e,t)=>{var n,a;(null===(a=r.current)||void 0===a?void 0:null===(n=a[e])||void 0===n?void 0:n.type)==="folder"&&l((0,tv._)((0,tm._)({},o.current),{[e]:t}))},collapsedMapRef:o,setCollapsed:l,collapsedState:s}},sK=n("307321"),sq={};sq.styleTagTransform=oC(),sq.setAttributes=ow(),sq.insert=oy().bind(null,"head"),sq.domAPI=og(),sq.insertStyleElement=oS(),om()(sK.Z,sq);var sZ=sK.Z&&sK.Z.locals?sK.Z.locals:void 0,sY=0,sX=(0,tq.forwardRef)((e,t)=>{var n,r,o,{id:a,resourceTree:s,resourceMap:l,selected:c,disabled:d,searchConfig:u,defaultResourceType:h,useOptimismUI:p=!1,style:f,collapsedMap:m,setCollapsedMap:v,validateConfig:g,onChange:b=aK.Z,onSelected:y=aK.Z,onDrag:_=aK.Z,onChangeName:w=aK.Z,onCreate:x=aK.Z,onDelete:S=aK.Z,iconRender:k,suffixRender:C,textRender:j,renderMoreSuffix:E=!1,contextMenuHandler:T,onContextMenuVisibleChange:I,contextMenuDisabled:P,config:M,powerBlackMap:R,empty:D}=e,A=(0,tq.useRef)(a||"".concat(sY++)),N=(0,tq.useRef)(null),{updateContext:L,clearContext:z,updateId:O}=sU(A.current),[B,W]=sm({},e=>{null==L||L({tempSelectedMap:e})}),F=(0,tq.useRef)(l||{}),H=e=>{F.current=e,B.current=Object.keys(B.current).reduce((e,t)=>F.current[t]?(0,tv._)((0,tm._)({},e),{[t]:F.current[t]}):e,{}),W(B.current)};(0,tq.useEffect)(()=>{H(l)},[l]);var{collapsedMapRef:U,handleCollapse:V,setCollapsed:K,collapsedState:q}=sV({_collapsedMap:m,_setCollapsedMap:v,resourceMap:F}),[Z,Y]=sm((0,tv._)((0,tm._)({},aG),{children:s instanceof Array?s:[s]}),e=>{Q(a7(e,F.current,U.current))}),[X,Q]=sm(a7(Z.current,F.current,U.current));(0,tq.useEffect)(()=>{Q(a7(Z.current,F.current,U.current))},[q]);var G=(0,tq.useRef)(!!d);(0,tq.useEffect)(()=>{G.current=!!d},[d]);var{scrollInView:J,scrollWrapper:$,tempDisableScroll:ee}=sB({resourceTreeRef:Z,collapsedMapRef:U,resourceMap:F,config:M}),{handleDrag:et,handleChangeName:en,handleCreate:er,handleDelete:ei,optimismSavingMap:eo,clearOptimismSavingMap:ea}=sx({enable:!!p,onDrag:_,onChangeName:w,onCreate:x,onDelete:S,changeResourceTree:e=>{Z.current=e,H(a9((null==e?void 0:e.children)||[])),Y(Z.current)},scrollInView:J,resourceTreeRef:Z,resourceMap:F,onChange:b});(0,tq.useEffect)(()=>{Z.current=(0,tv._)((0,tm._)({},aG),{children:s instanceof Array?s:[s]}),Y(Z.current),ea()},[s]);var es=sv({selected:c,resourceMap:F,collapsedMapRef:U,setCollapsed:K,tempSelectedMapRef:B,setTempSelectedMap:W,scrollInView:J,updateContext:L}),{addEventListener:el,onMouseDownInDiv:ec,onMouseUpInDiv:ed}=sL(),{onMouseMove:eu,context:eh,context:{isFocus:ep},isFocusRef:ef,dragPreview:em,handleFocus:ev,handleBlur:eg}=sO({draggable:!(null==R?void 0:R.dragAndDrop),uniqId:A.current,updateId:O,iconRender:k,resourceTreeWrapperRef:N,collapsedMapRef:U,tempSelectedMapRef:B,setTempSelectedMap:W,setCollapsedMap:V,resourceTreeRef:Z,selectedIdRef:es,onSelected:function(){for(var e=arguments.length,t=Array(e),n=0;n({focus:()=>{ev()},blur:()=>{eg()},createResource:e=>{if(!ex.current&&!!e)null==ew||ew(e)},renameResource:e=>{ek(e)},createFolder:()=>{if(!ex.current)null==ew||ew(aq.Folder)},expandAll:()=>{U.current={},K(U.current)},collapseAll:()=>{U.current=Object.keys(F.current).reduce((e,t)=>{var n,r;return t!==aX&&(null===(r=F.current)||void 0===r?void 0:null===(n=r[t])||void 0===n?void 0:n.type)==="folder"?(0,tv._)((0,tm._)({},e),{[t]:!0}):e},{}),K(U.current)},closeContextMenu:ej}));var eE={searchConfig:u,suffixRender:C,config:M,renderMoreSuffix:!P&&E,textRender:j,contextMenuCallback:eC,resourceTreeWrapperRef:N,iconRender:k,isDragging:eh.isDragging,draggingError:eh.draggingError,currentHoverItem:eh.currentHoverItem,validateConfig:g,errorMsg:e_.errorMsg,errorMsgRef:e_.errorMsgRef,editResourceId:e_.editResourceId,handleChangeName:e_.handleChangeName,handleSave:e_.handleSave,useOptimismUI:p},eT=(null==e_?void 0:e_.createResourceInfo)?(0,tK.jsx)("div",{children:(0,tK.jsx)(sf,(0,tm._)({resource:{id:"-1",name:"",type:null==e_?void 0:e_.createResourceInfo.type},path:[...(null===(o=F.current)||void 0===o?void 0:null===(r=o[null==e_?void 0:e_.createResourceInfo.parentId])||void 0===r?void 0:r.path)||[],"-1"],isInEdit:"-1"===e_.editResourceId},eE))},"-1"):null,eI=eS(X.current,null==e_?void 0:e_.createResourceInfo);return(0,tK.jsxs)(tK.Fragment,{children:[(0,tK.jsx)("div",{className:"resource-list-wrapper ".concat(sZ["resource-list-wrapper"]),ref:N,style:f||{},children:(0,tK.jsxs)("div",{["data-".concat(sk)]:!0,["data-".concat(sS)]:A.current,ref:$,className:"".concat(a2(aQ,A.current)," resource-list-drag-and-drop-wrapper resource-list-custom-event-wrapper resource-list-scroll-container"),onMouseDown:ec,onMouseUp:ed,onMouseMove:eu,onContextMenu:e=>{e.preventDefault()},onContextMenuCapture:eC,children:[eI.map((e,t)=>{if("-1"===e)return eT;if(e.id===aX)return null;if(!e)return(0,tK.jsx)(tK.Fragment,{});var n,r,o,a,s,l,d=String(e.id)===String(e_.editResourceId),u=String(c)===String(e.id),h=!!B.current[e.id],f=(null===(n=X.current[t-1])||void 0===n?void 0:n.id)!==aX&&!!B.current[null===(r=X.current[t-1])||void 0===r?void 0:r.id],m=!!B.current[null===(o=X.current[t+1])||void 0===o?void 0:o.id],v=!U.current[e.id],g=!(null==R?void 0:R.folder)&&!!eh.highlightItemMap[e.id],b=(null===(a=X.current[t-1])||void 0===a?void 0:a.id)!==aX&&!!eh.highlightItemMap[null===(s=X.current[t-1])||void 0===s?void 0:s.id],y=!!eh.highlightItemMap[null===(l=X.current[t+1])||void 0===l?void 0:l.id],_=[...g?[e.id!==aX?"dragging-hover-class":"",b||y?"":"base-radius-class-single",b?"":"base-radius-class-first",y?"":"base-radius-class-last"]:[],u?"item-is-selected":"",...h&&!g?["item-is-temp-selected",f||m?"":"base-radius-class-single",f?"":"base-radius-class-first",m?"":"base-radius-class-last"]:[],d?"item-is-in-edit":"",eh.isDragging||u?"":"base-item-hover-class"].join(" ");return(0,tK.jsx)("div",(0,tv._)((0,tm._)({className:"item-wrapper ".concat(_)},eh.dataHandler(e)),{children:(0,tK.jsx)(sf,(0,tm._)({resource:e,path:e.path||[],isSelected:u,isTempSelected:h,isInEdit:d,isExpand:v,isOptimismSaving:p&&eo[e.id]},eE))}),e.id)}),(0===(n=eI||[]).length||1===n.length&&"-1"!==n[0]&&n[0].id===aX)&&D?D:null,(0,tK.jsx)("div",{style:{padding:12}})]})},A.current),i_.createPortal(em,document.body)]})})},678473:function(e,t,n){"use strict";n.r(t),n.d(t,{ProjectIDE:()=>ns,IDELayout:()=>eh});var r,o,a,s,l=n("151064");n("327212");var c=n("157728"),d=n("455069");n("407694");var u=()=>null,h=()=>null,p=()=>(0,l.jsx)("div",{}),f=e=>null,m=n("149528"),v=n("562392"),g=n("873183"),b={match:/\/plugin\/.*/,area:m.px.MAIN_PANEL,renderContent(){var e=(0,m.jL)(()=>n.e("1794").then(n.bind(n,517362)));return(0,l.jsx)(e,{})},renderIcon:()=>(0,l.jsx)(g.QWX,{})},y={match:/\/knowledge\/.*/,area:m.px.MAIN_PANEL,renderContent(){var e=(0,m.jL)(()=>n.e("1546").then(n.bind(n,620410)));return(0,l.jsx)(e,{})},renderIcon:()=>(0,l.jsx)(g.Guk,{})},_={match:/\/variables\/?$/,area:m.px.MAIN_PANEL,renderContent(){var e=(0,m.jL)(()=>n.e("6809").then(n.bind(n,430474)));return(0,l.jsx)(e,{})},renderIcon:()=>(0,l.jsx)(g.pFl,{})},w={match:/\/database\/.*/,area:m.px.MAIN_PANEL,renderContent(){var e=(0,m.jL)(()=>n.e("3838").then(n.bind(n,119131)));return(0,l.jsx)(e,{})},renderIcon:()=>(0,l.jsx)(g.Dzy,{})},x=n("66860"),S=n("942185"),k=n("130001"),C=n("771531"),j=n("435946");class E{listen(){this.disposable.push(this.viewService.shell.onCurrentWidgetChange(e=>{this.toggleDefaultWidget(e),this.syncURL(e)}))}toggleDefaultWidget(e){if(null==e?void 0:e.uri){if("default"!==(null==e?void 0:e.uri).displayName){var t,n=this.widgetManager.getWidgetFromURI(m.AE);null==n||null===(t=n.dispose)||void 0===t||t.call(n)}}else this.viewService.disableFullScreenMode(),this.projectIDEServices.view.openDefault()}syncURL(e){if(e){var t=null==e?void 0:e.uri;if(!(0,m.fZ)(t,m.AE)){if(t){var n=(0,m.L8)(t);if(n){var r="/space/".concat(this.optionsService.spaceId,"/project-ide/").concat(this.optionsService.projectId).concat(n);t.query&&(r+="?".concat(t.query)),this.navigate(r)}}}}else this.navigate("/space/".concat(this.optionsService.spaceId,"/project-ide/").concat(this.optionsService.projectId))}diffPath(e){var{pathname:t,search:n}=window.location;return t+n!==e}navigate(e){if(!!this.diffPath(e))this.optionsService.navigate((0,m.PF)(e))}dispose(){this.disposable.dispose()}constructor(){this.disposable=new m.K4}}(0,k.gn)([(0,C.f)(m.s1),(0,k.w6)("design:type",void 0===m.s1?Object:m.s1)],E.prototype,"viewService",void 0),(0,k.gn)([(0,C.f)(m.fH),(0,k.w6)("design:type",void 0===m.fH?Object:m.fH)],E.prototype,"widgetManager",void 0),(0,k.gn)([(0,C.f)(m.k7),(0,k.w6)("design:type",void 0===m.k7?Object:m.k7)],E.prototype,"projectIDEServices",void 0),(0,k.gn)([(0,C.f)(m.IC),(0,k.w6)("design:type",void 0===m.IC?Object:m.IC)],E.prototype,"optionsService",void 0),E=(0,k.gn)([(0,j.b)()],E);var T=n("825955"),I=n("287487"),P=n("28260"),M=n("286518"),R=n("382534");class D{init(){this.updateProjectInfo().catch(()=>{this.errorService.toErrorPage()});this.initTaskList(),this.reportUserBehavior()}initTaskList(){var e=this;return(0,T._)(function*(){var t,{task_list:n}=(yield R.sD.DraftProjectInnerTaskList({project_id:e.optionsService.projectId})).data||{},r=null==n?void 0:null===(t=n[0])||void 0===t?void 0:t.task_id;if(r){var{task_detail:o}=yield R.Js.ResourceCopyDetail({task_id:r});e.modalService.onModalVisibleChangeEmitter.fire({type:m.w8.RESOURCE,scene:null==o?void 0:o.scene,resourceName:null==o?void 0:o.res_name}),e.modalService.doPolling(r)}})()}reportUserBehavior(){R.pr.ReportUserBehavior({space_id:this.optionsService.spaceId,behavior_type:M.YQ.Visit,resource_id:this.optionsService.projectId,resource_type:M.$L.Project})}wakeUpPlugin(){var e;R.Js.WakeupIdePlugin({space_id:this.optionsService.spaceId,project_id:this.optionsService.projectId,dev_id:null===(e=I.Z.getUserInfo())||void 0===e?void 0:e.user_id_str})}updateProjectInfo(){var e=this;return(0,T._)(function*(){var t,n,r,o,a,s,l,c,d,u,h,p,f,m=yield R.sD.GetDraftIntelligenceInfo({intelligence_id:e.optionsService.projectId,intelligence_type:P.jH.Project,version:e.optionsService.version||void 0});e.projectInfo={projectInfo:null===(t=m.data)||void 0===t?void 0:t.basic_info,publishInfo:null===(n=m.data)||void 0===n?void 0:n.publish_info,ownerInfo:null===(r=m.data)||void 0===r?void 0:r.owner_info},e.initialValue={space_id:null===(o=e.optionsService)||void 0===o?void 0:o.spaceId,project_id:null===(a=e.optionsService)||void 0===a?void 0:a.projectId,name:null===(l=e.projectInfo)||void 0===l?void 0:null===(s=l.projectInfo)||void 0===s?void 0:s.name,description:null===(d=e.projectInfo)||void 0===d?void 0:null===(c=d.projectInfo)||void 0===c?void 0:c.description,icon_uri:[{uid:(null===(h=e.projectInfo)||void 0===h?void 0:null===(u=h.projectInfo)||void 0===u?void 0:u.icon_uri)||"",url:(null===(f=e.projectInfo)||void 0===f?void 0:null===(p=f.projectInfo)||void 0===p?void 0:p.icon_url)||""}]},e.onProjectInfoUpdatedEmitter.fire()})()}constructor(){this.onProjectInfoUpdatedEmitter=new m.Q5,this.onProjectInfoUpdated=this.onProjectInfoUpdatedEmitter.event}}(0,k.gn)([(0,C.f)(m.IC),(0,k.w6)("design:type",void 0===m.IC?Object:m.IC)],D.prototype,"optionsService",void 0),(0,k.gn)([(0,C.f)(m.Z7),(0,k.w6)("design:type",void 0===m.Z7?Object:m.Z7)],D.prototype,"modalService",void 0),(0,k.gn)([(0,C.f)(m.T_),(0,k.w6)("design:type",void 0===m.T_?Object:m.T_)],D.prototype,"errorService",void 0),D=(0,k.gn)([(0,j.b)()],D);class A{open(){var{resourceType:e}=(0,m.hU)(window.location.pathname);if(e===m.sq.displayName)this.openDesign(),this.tryOpenDefault();else{var t,n,r,o=(0,m.qj)(window.location.pathname);!o||o.startsWith(m.AE.displayName)?(this.tryOpenDefault(),(null===(t=this.applicationShell.mainPanel.currentTitle)||void 0===t?void 0:t.owner)&&this.applicationShell.setCurrentWidget(null===(r=this.applicationShell.mainPanel)||void 0===r?void 0:null===(n=r.currentTitle)||void 0===n?void 0:n.owner)):this.projectIDEServices.view.open((0,m.W9)(o))}}listen(){var e="popstate";window.addEventListener(e,this.syncPopstate),this.disposable.push(m.JT.create(()=>window.removeEventListener(e,this.syncPopstate)))}openDevelop(e,t,n){this.projectIDEServices.view.open((0,m.Ym)(e,t,n))}openDesign(){this.projectIDEServices.view.openPanel("ui-builder")}tryOpenDefault(){var e,t,n,r,o;(null===(o=this.viewService.shell.mainPanel)||void 0===o?void 0:null===(r=o.tabBars)||void 0===r?void 0:null===(n=r.call(o))||void 0===n?void 0:null===(t=n.next)||void 0===t?void 0:null===(e=t.call(n))||void 0===e?void 0:e.done)&&this.projectIDEServices.view.openDefault()}dispose(){this.disposable.dispose()}constructor(){this.disposable=new m.K4,this.syncPopstate=()=>{this.open()}}}(0,k.gn)([(0,C.f)(m.k7),(0,k.w6)("design:type",void 0===m.k7?Object:m.k7)],A.prototype,"projectIDEServices",void 0),(0,k.gn)([(0,C.f)(m.s1),(0,k.w6)("design:type",void 0===m.s1?Object:m.s1)],A.prototype,"viewService",void 0),(0,k.gn)([(0,C.f)(m.Ew),(0,k.w6)("design:type",void 0===m.Ew?Object:m.Ew)],A.prototype,"applicationShell",void 0),A=(0,k.gn)([(0,j.b)()],A);var N=n("710705"),L=n("808549"),z=n("18174");let O=Symbol.for("Dexie"),B=globalThis[O]||(globalThis[O]=z);if(z.semVer!==B.semVer)throw Error(`Two different versions of Dexie loaded in the same app: ${z.semVer} and ${B.semVer}`);let{liveQuery:W,mergeRanges:F,rangesOverlap:H,RangeSet:U,cmp:V,Entity:K,PropModification:q,replacePrefix:Z,add:Y,remove:X}=B;var Q=e=>e.timestamp(!s&&(s=new B("CozProjectIDELayoutData")).version(1).stores({layout:"++id, spaceId, projectId, timestamp, data"}),s);var J=(r=(0,T._)(function*(e,t,n){var r=G(),o=yield r.layout.where({spaceId:e,projectId:t}).first();o?yield r.layout.update(o.id,(0,L._)({},n)):yield r.layout.add((0,L._)({spaceId:e,projectId:t},n))}),function(e,t,n){return r.apply(this,arguments)});var $=(o=(0,T._)(function*(e,t){var n=G(),r=yield n.layout.where({spaceId:e,projectId:t}).first();if(!!r){if(Q(r)){yield n.layout.where({id:r.id}).delete();return}return r}}),function(e,t){return o.apply(this,arguments)}),ee="coz-project-ide-layout-data",et=(e,t,n)=>{var r="".concat(ee,"-").concat(e,"-").concat(t);window.localStorage.setItem(r,JSON.stringify(n))},en=(e,t)=>{var n="".concat(ee,"-").concat(e,"-").concat(t),r=window.localStorage.getItem(n);if(!!r)try{var o=JSON.parse(r);if(Q(o)){window.localStorage.removeItem(n);return}return o}catch(e){console.error(e);return}},er=(e,t)=>{var n="".concat(ee,"-").concat(e,"-").concat(t);window.localStorage.removeItem(n)},ei=(e,t,n)=>{try{var r={data:JSON.stringify(n),timestamp:Number(Date.now()),version:3};et(e,t,r),J(e,t,r)}catch(e){console.error(e)}};var eo=(a=(0,T._)(function*(e,t){var n,r=yield $(e,t),o=en(e,t);if(o?!r||r.timestamp!!e.context;class es{get openFirstWorkflow(){return this._openFirstWorkflow}set openFirstWorkflow(e){this._openFirstWorkflow=e}init(){}storeLayout(){ei(this.optionsService.spaceId,this.optionsService.projectId,this.getLayoutData())}restoreLayout(){var e=this;return(0,T._)(function*(){if(yield e.addSidebarWidget(),e.enabled){var t=yield eo(e.optionsService.spaceId,e.optionsService.projectId);yield e.setLayoutData(t||{})}})()}storeWidget(){}restoreWidget(){}getLayoutData(){var e={},{primarySidebar:t,mainPanel:n}=this.applicationShell;e.primarySidebar={isHidden:!!(null==t?void 0:t.isHidden)};var r=n.saveLayout();return e.mainPanel=this.widgetsStringifyBFS(r),e}setLayoutData(e){var t=this;return(0,T._)(function*(){var{primarySidebar:n,mainPanel:r}=e||{};if(n&&n.isHidden?t.applicationShell.primarySidebar.hide():t.applicationShell.primarySidebar.show(),r){var o,a,s=yield t.widgetsParseBFS(r),{main:l}=s||{};!(null==l?void 0:null===(o=l.widgets)||void 0===o?void 0:o.length)&&!(null==l?void 0:null===(a=l.children)||void 0===a?void 0:a.length)&&(t._openFirstWorkflow=!0),t.applicationShell.mainPanel.restoreLayout(s),t.applicationShell.mainPanel.initWidgets()}})()}addSidebarWidget(){var e=this;return(0,T._)(function*(){var t=yield e.widgetParse({uri:m.tN.toString()});e.applicationShell.primarySidebar.addWidget(t)})()}listen(){var e=()=>{this.storeLayout(),window.removeEventListener("unload",e)};window.addEventListener("unload",e)}widgetStringify(e){if(!!(null==e?void 0:e.uri)){var t={uri:e.uri.toString()};if(ea(e)){var n=e.context.widget,r=n.getTitle();r&&(t.title=r);var o=n.getIconType();o&&(t.iconType=o)}return t}}widgetsStringify(e){return e.map(e=>this.widgetStringify(e)).filter(e=>(null==e?void 0:e.uri)&&e.uri!==m.AE.toString())}widgetsStringifyBFS(e){var t=e=>(0,N.Z)(e)?Object.keys(e).reduce((n,r)=>("widgets"===r&&Array.isArray(e[r])?n[r]=this.widgetsStringify(e[r]):n[r]=t(e[r]),n),{}):Array.isArray(e)?e.map(t):e;return t(e)}widgetParse(e){var t=this;return(0,T._)(function*(){var n=new m.ov(e.uri),r=t.widgetManager.getFactoryFromURI(n),o=yield t.widgetManager.getOrCreateWidgetFromURI(n,r);if(ea(o)){var a=o.context.widget;e.title&&a.setTitle(e.title,"normal"),e.iconType&&a.setIconType(e.iconType)}return t.viewRenderer.addReactPortal(o),t.applicationShell.track(o),o})()}widgetsParseBFS(e){var t=this;return(0,T._)(function*(){var n,r=(n=(0,T._)(function*(e){if((0,N.Z)(e)){var n;return yield Object.keys(e).reduce((n=(0,T._)(function*(n,o){var a=yield n;return"widgets"===o&&Array.isArray(e[o])?a[o]=yield Promise.all(e[o].map(e=>t.widgetParse(e))):a[o]=yield r(e[o]),a}),function(e,t){return n.apply(this,arguments)}),Promise.resolve({}))}return Array.isArray(e)?yield Promise.all(e.map(r)):e}),function(e){return n.apply(this,arguments)});return yield r(e)})()}constructor(){this._openFirstWorkflow=!1,this.enabled=!0}}(0,k.gn)([(0,C.f)(m.Ew),(0,k.w6)("design:type",void 0===m.Ew?Object:m.Ew)],es.prototype,"applicationShell",void 0),(0,k.gn)([(0,C.f)(m.fH),(0,k.w6)("design:type",void 0===m.fH?Object:m.fH)],es.prototype,"widgetManager",void 0),(0,k.gn)([(0,C.f)(m.l0),(0,k.w6)("design:type",void 0===m.l0?Object:m.l0)],es.prototype,"viewRenderer",void 0),(0,k.gn)([(0,C.f)(m.IC),(0,k.w6)("design:type",void 0===m.IC?Object:m.IC)],es.prototype,"optionsService",void 0),es=(0,k.gn)([(0,j.b)()],es);class el{onStart(){this.projectInfoService.init(),this.openURIResourceService.open(),this.openURIResourceService.listen(),this.widgetEventService.listen(),this.layoutRestorer.listen(),this.onStartedEmitter.fire()}onDispose(){this.widgetEventService.dispose(),this.openURIResourceService.dispose(),this.onStartedEmitter.dispose()}constructor(){this.onStartedEmitter=new m.Q5,this.onStarted=this.onStartedEmitter.event}}(0,k.gn)([(0,C.f)(A),(0,k.w6)("design:type",void 0===A?Object:A)],el.prototype,"openURIResourceService",void 0),(0,k.gn)([(0,C.f)(E),(0,k.w6)("design:type",void 0===E?Object:E)],el.prototype,"widgetEventService",void 0),(0,k.gn)([(0,C.f)(m.cw),(0,k.w6)("design:type",void 0===m.cw?Object:m.cw)],el.prototype,"layoutRestorer",void 0),(0,k.gn)([(0,C.f)(D),(0,k.w6)("design:type",void 0===D?Object:D)],el.prototype,"projectInfoService",void 0),el=(0,k.gn)([(0,j.b)()],el);var ec=(0,m.M1)({onBind(e,t){var{bind:n,rebind:r}=e;n(m.IC).toConstantValue(t),n(D).toSelf().inSingletonScope(),n(A).toSelf().inSingletonScope(),n(E).toSelf().inSingletonScope(),r(m.cw).to(es).inSingletonScope(),(0,m.KV)(n,el,[m.dQ])}}),ed=n("244470"),eu=e=>{var{spaceId:t,projectId:n,version:r}=e;return(0,S.Gy)(n),(0,ed.Z)(t,n)?(0,l.jsx)(ns,{spaceId:t,projectId:n,version:r}):null},eh=()=>{var{space_id:e,project_id:t}=(0,c.useParams)(),n=new URLSearchParams(window.location.search).get("commit_version");return(0,l.jsx)(eu,{spaceId:e||"",projectId:t||"",version:n||""},t)},ep=n("659596"),ef=n("336205"),em=n("442178"),ev=()=>{var e,t,n,r=(0,m.RX)(D),[o,a]=(0,d.useState)(!0),[s,l]=(0,d.useState)(null===(e=r.projectInfo)||void 0===e?void 0:e.projectInfo),[c,u]=(0,d.useState)(null==r?void 0:null===(t=r.projectInfo)||void 0===t?void 0:t.publishInfo),[h,p]=(0,d.useState)(null==r?void 0:null===(n=r.projectInfo)||void 0===n?void 0:n.ownerInfo),[f,v]=(0,d.useState)(r.initialValue),{patch:g}=(0,m.zu)(e=>({patch:e.patch}));return(0,d.useEffect)(()=>{r.projectInfo&&a(!1),g({projectInfo:{projectInfo:s,publishInfo:c,ownerInfo:h}});var e=r.onProjectInfoUpdated(()=>{var e,t,n;a(!1),l(null===(e=r.projectInfo)||void 0===e?void 0:e.projectInfo),u(null===(t=r.projectInfo)||void 0===t?void 0:t.publishInfo),p(null===(n=r.projectInfo)||void 0===n?void 0:n.ownerInfo),g({projectInfo:r.projectInfo}),v(r.initialValue)});return()=>{var t;null==e||null===(t=e.dispose)||void 0===t||t.call(e)}},[]),{loading:o,initialValue:f,projectInfo:s,ownerInfo:h,publishInfo:c,updateProjectInfo:r.updateProjectInfo.bind(r)}},eg=n("479886"),eb=n.n(eg),ey=n("378925"),e_=n("407821"),ew=n.n(e_),ex=n("472772"),eS=n.n(ex),ek=n("395245"),eC=n.n(ek),ej=n("297998"),eE=n.n(ej),eT=n("646576"),eI=n.n(eT),eP=n("606121"),eM=n.n(eP),eR=n("840486"),eD={};eD.styleTagTransform=eM(),eD.setAttributes=eE(),eD.insert=eC().bind(null,"head"),eD.domAPI=eS(),eD.insertStyleElement=eI(),ew()(eR.Z,eD);var eA=eR.Z&&eR.Z.locals?eR.Z.locals:void 0,eN=e=>{var t=Number(e);return isNaN(t)?"-":eb().unix(t).format("YYYY-MM-DD HH:mm:ss")},eL=e=>{var{spaceId:t,projectInfo:n,publishInfo:r,ownerInfo:o}=e,a=(0,ey.$_)(t);if(!n)return null;var s=eN(null==n?void 0:n.create_time);return(0,l.jsxs)("div",{className:eA.content,children:[(0,l.jsx)(ep.EZ,{type:"bot",size:"xl",src:null==n?void 0:n.icon_url}),(0,l.jsx)("div",{className:eA.title,children:null==n?void 0:n.name}),(0,l.jsx)("div",{className:eA.description,children:null==n?void 0:n.description}),(0,l.jsxs)("div",{className:eA["tag-container"],children:[a?(0,l.jsx)(ep.Vp,{className:eA.tag,color:"primary",prefixIcon:(0,l.jsx)(ep.EZ,{size:"mini",src:a.icon_url}),children:a.name}):null,(null==r?void 0:r.has_published)?(0,l.jsx)(ep.Vp,{className:eA.tag,color:"green",prefixIcon:(0,l.jsx)(g.Lz_,{}),children:ef.o.t("Published_1")}):null]}),o?(0,l.jsxs)("div",{className:eA["owner-container"],children:[(0,l.jsx)(ep.EZ,{size:"micro",src:null==o?void 0:o.avatar_url}),(0,l.jsx)("div",{children:null==o?void 0:o.nickname}),(0,l.jsxs)("div",{children:["@",null==o?void 0:o.user_unique_name]})]}):null,(0,l.jsx)("div",{className:eA.time,children:ef.o.t("project_ide_info_created_on",{time:s})})]})},{Title:ez}=ep.ZT,eO=()=>{var{loading:e,initialValue:t,projectInfo:n,updateProjectInfo:r,publishInfo:o,ownerInfo:a}=ev(),s=(0,m.aQ)(),c=(0,m.vp)(),{version:u}=(0,m.jo)(),{modalContextHolder:h,openModal:p}=(0,em.AZ)({onSuccess:()=>{r(),ep.FN.success(ef.o.t("project_ide_toast_edit_success"))}}),f=(0,S.Qb)(S.PL.EDIT_INFO,c||"",s||""),v=(0,d.useCallback)(()=>{p({initialValue:t})},[t]),b=null==o?void 0:o.has_published;return e?(0,l.jsx)(ep.Od.Title,{style:{width:24,height:24}}):(0,l.jsxs)("div",{className:eA["project-info"],children:[(0,l.jsxs)(ep.J2,{content:(0,l.jsx)(eL,{projectInfo:n,publishInfo:o,ownerInfo:a,spaceId:s}),children:[(0,l.jsx)(ep.EZ,{type:"bot",size:"small",src:null==n?void 0:n.icon_url}),b?(0,l.jsx)("div",{className:eA["check-icon"],children:(0,l.jsx)(g.Lz_,{color:"green"})}):null]}),(0,l.jsx)(ez,{ellipsis:{showTooltip:{opts:{content:null==n?void 0:n.name}}},className:eA.title,fontSize:"16px",style:{maxWidth:320},children:null==n?void 0:n.name}),f&&!u?(0,l.jsx)(ep.hU,{color:"secondary",icon:(0,l.jsx)(g.JAz,{}),onClick:v}):null,h]})},eB=n("120454"),eW=n("174470");n("297751"),n("616405");var eF=()=>{var e=(0,c.useNavigate)(),t=(0,m.aQ)(),n=(0,m.vp)(),{version:r}=(0,m.jo)(),{modalContextHolder:o,deleteIntelligence:a}=(0,em.wU)({onDeleteProjectSuccess:()=>{ep.FN.success(ef.o.t("project_ide_toast_delete_success")),e("/space/".concat(t,"/develop"))}}),{modalContextHolder:s,openModal:u}=(0,em.Z$)({onSuccess:()=>e("/space/".concat(t,"/develop"))}),{projectInfo:p,initialValue:f}=ev(),v=(0,S.kc)(n),b=(0,d.useCallback)(()=>{u({initialValue:(0,eB._)((0,L._)({},f),{to_space_id:t})})},[f,t]),y=(0,d.useCallback)(()=>{a({name:f.name||"",projectId:(null==p?void 0:p.id)||""})},[f,p]),_=(0,S.Qb)(S.PL.DELETE,n,t);return r?(0,l.jsx)(ep.Vp,{prefixIcon:(0,l.jsx)(g.SA_,{}),children:ef.o.t("app_ide_viewing_archive")}):(0,l.jsxs)("div",{className:"flex items-center justify-end grow gap-[8px] overflow-hidden",children:[s,v.length?(0,l.jsxs)(l.Fragment,{children:[o,(0,l.jsxs)(eH,{children:[(0,l.jsx)(h,{}),null]}),(0,l.jsx)(ep.iz,{layout:"vertical",className:"first:hidden"}),(0,l.jsx)(eW.PublishButton,{spaceId:t,projectId:n,hasPublished:!!Number(null==p?void 0:p.publish_time)}),(0,l.jsx)(ep.J2,{trigger:"click",className:"rounded-[8px]",content:(0,l.jsxs)(ep.v2,{children:[(0,l.jsx)(ep.v2.Item,{className:"min-w-[190px] h-[32px] rounded-[4px]",onClick:b,children:ef.o.t("project_ide_duplicate")}),_?(0,l.jsx)(ep.v2.Item,{className:"min-w-[190px] h-[32px] rounded-[4px]",onClick:y,children:ef.o.t("project_ide_delete_project")}):(0,l.jsx)(ep.u,{position:"left",content:ef.o.t("project_delete_permission_tooltips"),children:(0,l.jsx)(ep.v2.Item,{disabled:!0,className:"min-w-[190px] h-[32px] rounded-[4px]",onClick:y,children:ef.o.t("project_ide_delete_project")})})]}),children:(0,l.jsx)(ep.hU,{icon:(0,l.jsx)(g.NsR,{}),color:"secondary"})})]}):(0,l.jsx)(ep.zx,{onClick:b,children:ef.o.t("project_ide_create_duplicate")})]})};function eH(e){var{children:t}=e;return t}var eU=()=>{var e=(0,c.useNavigate)(),t=(0,m.aQ)(),n=(0,d.useCallback)(()=>{e("/space/".concat(t,"/develop"))},[t,e]);return(0,l.jsx)(ep.hU,{color:"secondary",icon:(0,l.jsx)(g.$1i,{}),onClick:n})},eV=n("11549"),eK={};eK.styleTagTransform=eM(),eK.setAttributes=eE(),eK.insert=eC().bind(null,"head"),eK.domAPI=eS(),eK.insertStyleElement=eI(),ew()(eV.Z,eK);var eq=eV.Z&&eV.Z.locals?eV.Z.locals:void 0,eZ=()=>(0,l.jsx)("div",{className:eq.container,children:(0,l.jsxs)(ep.X2,{className:eq["top-bar"],children:[(0,l.jsxs)(ep.JX,{span:8,className:eq["left-col"],children:[(0,l.jsx)(eU,{}),(0,l.jsx)(eO,{})]}),(0,l.jsx)(ep.JX,{span:8,className:eq["middle-col"],children:(0,l.jsx)(u,{})}),(0,l.jsx)(ep.JX,{span:8,className:eq["right-col"],children:(0,l.jsx)(eF,{})})]})}),eY=n("252237"),eX=n.n(eY),eQ=n("450562"),eG=n("189284"),eJ=n("909776"),e$=n("833047"),e0=n("610382"),e1=n("529223"),e2=e=>{var t,{projectId:n}=e,r=(0,x.S4)();return t=(0,T._)(function*(e){var{scene:t,resource:o}=e;try{console.log("[ResourceFolder]workflow resource copy dispatch, scene ".concat(t,">>>"),o),yield r({scene:t,res_id:null==o?void 0:o.id,res_type:e1.ResType.Plugin,project_id:n,res_name:(null==o?void 0:o.name)||""})}catch(e){console.error("[ResourceFolder]workflow resource copy dispatch, scene ".concat(t," error>>>"),e)}}),function(e){return t.apply(this,arguments)}},e4=()=>{var e,t,n,r,o=(0,x.Un)(e=>e.refetch),a=(0,m.aQ)(),s=(0,m.vp)(),c=(0,x.j2)(),[u,h]=(0,d.useState)(!1);var p=(0,d.useCallback)((e=(0,T._)(function*(e){try{console.log("[ResourceFolder]on change name>>>",e);var t=yield R.Js.UpdatePluginMeta({plugin_id:e.id,name:e.name});console.log("[ResourceFolder]rename plugin response>>>",t)}catch(e){console.log("[ResourceFolder]rename plugin error>>>",e)}finally{o()}}),function(t){return e.apply(this,arguments)}),[o]);var f=(0,d.useCallback)((t=(0,T._)(function*(e){try{console.log("[ResourceFolder]on delete>>>",e);var t,n=yield R.Js.DelPlugin({plugin_id:null===(t=e.filter(e=>e.type===x.LC.Plugin))||void 0===t?void 0:t[0].res_id});ep.FN.success(ef.o.t("project_plugin_delete_success_toast")),o(),console.log("[ResourceFolder]delete plugin response>>>",n)}catch(e){console.log("[ResourceFolder]delete plugin error>>>",e)}}),function(e){return t.apply(this,arguments)}),[o,a]);var{node:v,open:g,close:b}=(0,e0.qz)({from:e$.tx.ProjectIde,pluginApiList:[],projectId:s,showCopyPlugin:!0,showButton:!1,hideCreateBtn:!0,onCopyPluginCallback:e=>{var{pluginID:t,name:n}=e;t&&(y({scene:eJ.K2.CopyResourceFromLibrary,resource:{id:t,res_id:t,name:null!=n?n:""}}),b())},onCreateSuccess:(n=(0,T._)(function*(e){if(!!(null==e?void 0:e.pluginId))yield null==o?void 0:o(),c({resourceType:x.LC.Plugin,resourceId:null==e?void 0:e.pluginId}),b()}),function(e){return n.apply(this,arguments)}),isShowStorePlugin:!1}),y=e2({projectId:s}),_=e=>{var{label:t}=e;return t?t.length>30?ef.o.t("project_resource_sidebar_warning_length_exceeds"):RegExp("^[\\w\\s\\u4e00-\\u9fa5]+$","u").test(t)?"":ef.o.t("create_plugin_modal_nameerror_cn"):ef.o.t("create_plugin_modal_name1_error")};return{onChangeName:p,onAction:(e,t)=>{switch(console.log("on action>>>",e,t),e){case x.lW.ImportLibraryResource:return g();case x.lW.DuplicateResource:return y({scene:eJ.K2.CopyProjectResource,resource:t});case x.lW.MoveToLibrary:return y({scene:eJ.K2.MoveResourceToLibrary,resource:t});case x.lW.CopyToLibrary:return y({scene:eJ.K2.CopyResourceToLibrary,resource:t});default:console.warn("[PluginResource]unsupported action>>>",e)}},onDelete:f,onCustomCreate:(e,t)=>{console.log("[ResourceFolder]on custom create>>>",e,t),h(!0)},modals:[(0,l.jsx)(e0.rm,{projectId:s,isCreate:!0,visible:u,onSuccess:(r=(0,T._)(function*(e){yield null==o?void 0:o(),c({resourceType:x.LC.Plugin,resourceId:e})}),function(e){return r.apply(this,arguments)}),onCancel:()=>{h(!1)}}),v],validateConfig:{customValidator:e=>_(e)||""}}},e6=n("328591"),e5=n("402635"),e3=e=>{var t,{projectId:n}=e,r=(0,x.S4)();return t=(0,T._)(function*(e){var{scene:t,resource:o}=e;try{console.log("[ResourceFolder]workflow resource copy dispatch, scene ".concat(t,">>>"),o),yield r({scene:t,res_id:null==o?void 0:o.id,res_type:null==o?void 0:o.res_type,project_id:n,res_name:(null==o?void 0:o.name)||""})}catch(e){console.error("[ResourceFolder]workflow resource copy dispatch, scene ".concat(t," error>>>"),e)}}),function(e){return t.apply(this,arguments)}},e8=()=>{var e,t,n,r=(0,x.Un)(e=>e.refetch),o=(0,m.aQ)(),a=(0,m.vp)(),s=(0,m.d0)(),{modal:l,open:c,close:u}=(0,e6.Eb)({projectID:a,onFinish:(e,t,n)=>{r(),u(),s("/knowledge/".concat(e,"?type=").concat(t).concat(n?"&module=upload":""))}});var h=(e=(0,T._)(function*(e,t,n){try{yield R.MJ.UpdateDataset({dataset_id:e,name:t,status:n})}catch(e){console.log("[ResourceFolder]update knowledge error>>>",e)}finally{r()}}),function(t,n,r){return e.apply(this,arguments)});var p=(t=(0,T._)(function*(e){try{yield R.MJ.UpdateDataset({dataset_id:e.id,name:e.name})}catch(e){console.log("[ResourceFolder]rename knowledge error>>>",e)}finally{r()}}),function(e){return t.apply(this,arguments)});var f=(0,d.useCallback)((n=(0,T._)(function*(e){try{var t;yield R.MJ.DeleteDataset({dataset_id:null===(t=e.filter(e=>e.type===x.LC.Knowledge))||void 0===t?void 0:t[0].res_id}),ep.FN.success(ef.o.t("Delete_success")),r()}catch(e){ep.FN.error(ef.o.t("Delete_failed"))}}),function(e){return n.apply(this,arguments)}),[r,o]),v=e3({projectId:a});return{onChangeName:p,onAction:(e,t)=>{switch(e){case x.lW.DuplicateResource:return v({scene:eJ.K2.CopyProjectResource,resource:t});case x.lW.MoveToLibrary:return v({scene:eJ.K2.MoveResourceToLibrary,resource:t});case x.lW.CopyToLibrary:return v({scene:eJ.K2.CopyResourceToLibrary,resource:t});case x.lW.DisableKnowledge:(null==t?void 0:t.id)&&h(t.id,t.name,e5._z.DatasetForbid);break;case x.lW.EnableKnowledge:(null==t?void 0:t.id)&&h(t.id,t.name,e5._z.DatasetReady)}},onDelete:f,onCustomCreate:()=>{c()},modals:[l]}},e9=n("695673"),e7=n("299464"),te=n("775699"),tt=e=>{var{label:t,onClick:n,selected:r}=e;return(0,l.jsxs)("div",{onClick:n,className:eX()(["flex items-center gap-[8px] px-[12px]","px-[12px] py-[6px] rounded-[8px]","cursor-pointer","hover:text-[var(--light-usage-text-color-text-0,#1c1f23)]","hover:bg-[var(--light-usage-fill-color-fill-0,rgba(46,50,56,5%))]",r&&"text-[var(--light-usage-text-color-text-0,#1c1d23)] bg-[var(--light-usage-fill-color-fill-0,rgba(46,47,56,5%))]"]),children:[(0,l.jsx)(g.Iqn,{}),t]})},tn=e=>{var t,n,{onClose:r}=e,[o,a]=(0,d.useState)("knowledge"),s=(0,m.vp)(),c=(0,m.aQ)(),u=(0,x.Un)(e=>e.refetch),h=e3({projectId:s});var{renderContent:p,renderSearch:f}=(0,e6.ey)({showFilters:["scope-type","search-type"],datasetList:[],onDatasetListChange:(t=(0,T._)(function*(e){e[0].dataset_id&&e[0].name&&(yield h({scene:eJ.K2.CopyResourceFromLibrary,resource:{id:e[0].dataset_id,res_id:e[0].dataset_id,name:e[0].name,res_type:eJ.b0.Knowledge}}),u(),null==r||r())}),function(e){return t.apply(this,arguments)}),canCreate:!1,defaultType:e9.AT.ALL});var{renderContent:v,renderFilter:g,renderInput:b}=(0,e7.a8)({visible:!0,onClose:()=>void 0,onAddDatabase:(n=(0,T._)(function*(e){yield h({scene:eJ.K2.CopyResourceFromLibrary,resource:{id:e,res_id:e,name:"",res_type:eJ.b0.Database}}),u(),null==r||r()}),function(e){return n.apply(this,arguments)}),onClickDatabase:()=>void 0,enterFrom:"project",spaceId:c});return(0,l.jsx)(te.tz,{keepDOM:!1,visible:!0,onCancel:r,tabs:{tabsProps:{lazyRender:!0,activeKey:o,onChange:e=>a(e)},tabPanes:[{tabPaneProps:{tab:ef.o.t("resource_type_knowledge"),itemKey:"knowledge"},content:(0,l.jsxs)("div",{className:"w-full h-full flex",children:[(0,l.jsxs)("div",{className:"w-[218px] pt-[16px] px-[12px] shrink-0 flex flex-col gap-[12px]",children:[f(),(0,l.jsx)(tt,{label:ef.o.t("project_resource_modal_library_resources",{resource:ef.o.t("resource_type_knowledge")}),selected:!0})]}),(0,l.jsx)("div",{className:"grow-[1] bg-[white] pt-[16px] px-[12px]",children:p()})]})},{tabPaneProps:{tab:ef.o.t("resource_type_database"),itemKey:"database"},content:(0,l.jsxs)("div",{className:"w-full h-full flex",children:[(0,l.jsxs)("div",{className:"w-[218px] pt-[16px] px-[12px] shrink-0 flex flex-col gap-[12px]",children:[b(),(0,l.jsx)(tt,{label:ef.o.t("project_resource_modal_library_resources",{resource:ef.o.t("resource_type_database")}),selected:!0})]}),(0,l.jsxs)("div",{className:"grow-[1] bg-[white] pt-[16px] px-[12px] flex flex-col",children:[g(),v()]})]})}]}})},tr=()=>{var[e,t]=(0,d.useState)(!1),n=()=>{t(!1)};return{modal:e?(0,l.jsx)(tn,{onClose:n}):null,open:()=>{t(!0)},close:n}},ti=()=>{var e,t,n=(0,x.Un)(e=>e.refetch),r=(0,m.aQ)(),o=(0,m.vp)(),a=(0,m.d0)(),{modal:s,open:l,close:c}=(0,e7.Gx)({projectID:o,enterFrom:"project",onFinish:e=>{n(),c(),a("/database/".concat(e,"?page_modal=normal&from=create"))}});var u=(e=(0,T._)(function*(e){try{console.log("[ResourceFolder]on change name>>>",e);var t=yield R.v6.UpdateDatabase({id:e.id,table_name:e.name});console.log("[ResourceFolder]rename database response>>>",t)}catch(e){console.log("[ResourceFolder]rename database error>>>",e)}finally{n()}}),function(t){return e.apply(this,arguments)});var h=(0,d.useCallback)((t=(0,T._)(function*(e){try{console.log("[ResourceFolder]on delete>>>",e);var t,r=yield R.v6.DeleteDatabase({id:null===(t=e.filter(e=>e.type===x.LC.Database))||void 0===t?void 0:t[0].res_id});ep.FN.success(ef.o.t("Delete_success")),n(),console.log("[ResourceFolder]delete database response>>>",r)}catch(e){console.log("[ResourceFolder]delete database error>>>",e),ep.FN.error(ef.o.t("Delete_failed"))}}),function(e){return t.apply(this,arguments)}),[n,r]),p=e3({projectId:o});return{onChangeName:u,onAction:(e,t)=>{switch(console.log("on action>>>",e,t),e){case x.lW.ImportLibraryResource:return;case x.lW.DuplicateResource:return p({scene:eJ.K2.CopyProjectResource,resource:t});case x.lW.MoveToLibrary:return p({scene:eJ.K2.MoveResourceToLibrary,resource:t});case x.lW.CopyToLibrary:return p({scene:eJ.K2.CopyResourceToLibrary,resource:t});default:console.warn("[DatabaseResource]unsupported action>>>",e)}},onDelete:h,onCustomCreate:(e,t)=>{console.log("[ResourceFolder]on custom create>>>",e,t),l()},modals:[s]}},to=()=>{var e=(0,d.useMemo)(()=>[{icon:(0,l.jsx)(g.Guk,{}),label:ef.o.t("project_resource_sidebar_create_new_resource",{resource:ef.o.t("performance_knowledge")}),subType:x.LC.Knowledge,tooltip:null},{icon:(0,l.jsx)(g.Dzy,{}),label:ef.o.t("project_resource_sidebar_create_new_resource",{resource:ef.o.t("review_bot_database")}),subType:x.LC.Database,tooltip:null}],[]),{modal:t,open:n}=tr(),r=e8(),o=ti();return{onCustomCreate(e,t){var n,a;t===x.LC.Knowledge&&(null===(n=r.onCustomCreate)||void 0===n||n.call(r,e,t)),t===x.LC.Database&&(null===(a=o.onCustomCreate)||void 0===a||a.call(o,e,t))},onChangeName(e){var t,n,a,s;(null===(t=e.resource)||void 0===t?void 0:t.res_type)===eJ.b0.Knowledge&&(null===(a=r.onChangeName)||void 0===a||a.call(r,e)),(null===(n=e.resource)||void 0===n?void 0:n.res_type)===eJ.b0.Database&&(null===(s=o.onChangeName)||void 0===s||s.call(o,e))},onAction(e,t){if(e===x.lW.ImportLibraryResource)n();else{var a,s;(null==t?void 0:t.res_type)===eJ.b0.Knowledge&&(null===(a=r.onAction)||void 0===a||a.call(r,e,t)),(null==t?void 0:t.res_type)===eJ.b0.Database&&(null===(s=o.onAction)||void 0===s||s.call(o,e,t))}},onDelete(e){var t,n,a=e.filter(e=>(null==e?void 0:e.res_type)===eJ.b0.Knowledge),s=e.filter(e=>(null==e?void 0:e.res_type)===eJ.b0.Database);a.length&&(null===(t=r.onDelete)||void 0===t||t.call(r,a)),s.length&&(null===(n=o.onDelete)||void 0===n||n.call(o,s))},createResourceConfig:e,modals:[r.modals,o.modals,t],validateConfig:{customValidator:e=>e.label?/^[^"'`\\]+$/.test(e.label)?(0,x.nU)(e):ef.o.t("dataset-name-has-wrong-word-tooltip"):ef.o.t("dataset-name-empty-tooltip")}}},ta=n("280053"),ts={[ta.a5.Text]:(0,l.jsx)(g.da8,{}),[ta.a5.Table]:(0,l.jsx)(g.E4X,{}),[ta.a5.Image]:(0,l.jsx)(g.Q2$,{})},tl=e=>{var{idPrefix:t="fixed-sidebar"}=e,{onCustomCreate:n,onDelete:r,onChangeName:o,onAction:a,createResourceConfig:s,iconRender:c,modals:u}=(0,v.qn)(),{onCustomCreate:h,onDelete:p,onChangeName:f,onAction:b,validateConfig:y,modals:_}=e4(),{onCustomCreate:w,onDelete:k,onChangeName:C,onAction:j,createResourceConfig:E,modals:T,validateConfig:I}=to(),P=(0,m.aQ)(),M=(0,m.vp)(),{version:R}=(0,m.jo)(),D=(0,S.Qb)(S.PL.CREATE_RESOURCE,M,P);R&&(D=!1);var A=(0,S.kc)(M),N=(0,d.useMemo)(()=>{var e;return(null!==(e=null==A?void 0:A.length)&&void 0!==e?e:0)===0||!!R},[A,R]),{workflowResource:L,pluginResource:z,dataResource:O,initLoaded:B}=(0,x.rA)();return(0,l.jsxs)("div",{children:[(0,l.jsx)(x.dg,{id:"".concat(t,"_").concat(x.ai.Workflow),groupType:x.ai.Workflow,defaultResourceType:x.LC.Workflow,resourceTree:L,canCreate:D,initLoaded:B,onChangeName:o,onCustomCreate:n,onDelete:r,onAction:a,createResourceConfig:s,iconRender:c,hideMoreBtn:N}),(0,l.jsx)(x.dg,{id:"".concat(t,"_").concat(x.ai.Plugin),groupType:x.ai.Plugin,defaultResourceType:x.LC.Plugin,resourceTree:z,canCreate:D,initLoaded:B,onChangeName:f,onCustomCreate:h,onDelete:p,onAction:b,iconRender:()=>(0,l.jsx)(g.QWX,{}),hideMoreBtn:N,validateConfig:y}),(0,l.jsx)(x.dg,{id:"".concat(t,"_").concat(x.ai.Data),groupType:x.ai.Data,resourceTree:O,canCreate:D,initLoaded:B,createResourceConfig:E,onChangeName:C,onDelete:k,onAction:j,onCustomCreate:w,hideMoreBtn:N,validateConfig:I,iconRender:e=>{var t,{resource:n}=e;return(console.log(n),n.id===x.Vx)?(0,l.jsx)(g.pFl,{}):n.type===x.LC.Database?(0,l.jsx)(g.Dzy,{}):n.type===x.LC.Knowledge?(0,l.jsxs)("div",{className:"flex items-center",children:[ts[null===(t=n.biz_extend)||void 0===t?void 0:t.format_type],3===n.biz_res_status?(0,l.jsx)("span",{className:"ml-[3px]",children:"已禁用"}):null]}):(0,l.jsx)(l.Fragment,{})}}),u,_,T]})},tc=n("362845"),td={};td.styleTagTransform=eM(),td.setAttributes=eE(),td.insert=eC().bind(null,"head"),td.domAPI=eS(),td.insertStyleElement=eI(),ew()(tc.Z,td);var tu=tc.Z&&tc.Z.locals?tc.Z.locals:void 0,th=(0,d.lazy)(()=>n.e("9905").then(n.bind(n,163206)).then(e=>({default:e.ResourceTreeModal}))),tp=(0,eQ._Uw)(e=>{var{hideExpand:t,idPrefix:n}=e,r=(0,m.XO)(),{workflowResource:o}=(0,x.rA)(),[a,s]=(0,d.useState)(!1),[c]=(0,eG.V)();return(0,l.jsxs)("div",{className:tu["primary-sidebar"],children:[(0,l.jsxs)("div",{className:eX()(tu["primary-sidebar-header"],"h-[".concat(44,"px]")),children:[(0,l.jsxs)("div",{className:tu.title,children:[ef.o.t("project_resource_sidebar_title"),c["bot.automation.dependency_tree"]?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ep.zx,{size:"small",icon:(0,l.jsx)(g.CfL,{}),color:"primary",disabled:!(null==o?void 0:o.length),onClick:()=>s(!0),children:ef.o.t("reference_graph_entry_button")}),a?(0,l.jsx)(d.Suspense,{fallback:null,children:(0,l.jsx)(th,{modalVisible:a,setModalVisible:s})}):null]}):null]}),t?null:(0,l.jsx)(ep.hU,{"data-testid":"project-expand-button",icon:(0,l.jsx)(g.m7o,{className:"coz-fg-primary"}),color:"secondary",size:"small",onClick:()=>{r.view.primarySidebar.changeVisible(!1)}})]}),(0,l.jsx)("div",{className:tu["resource-list-wrapper"],style:{height:"calc(100% - ".concat(44,"px)")},children:(0,l.jsx)(tl,{idPrefix:n})})]})}),tf=n("746131"),tm={};tm.styleTagTransform=eM(),tm.setAttributes=eE(),tm.insert=eC().bind(null,"head"),tm.domAPI=eS(),tm.insertStyleElement=eI(),ew()(tf.Z,tm);var tv=tf.Z&&tf.Z.locals?tf.Z.locals:void 0,tg=e=>{var{commandRegistry:t,title:n,widget:r,uiState:o,registry:a}=e,[s,c]=(0,d.useState)(!1),u=(0,d.useMemo)(()=>(null==a?void 0:a.renderIcon)&&"function"==typeof(null==a?void 0:a.renderIcon)?a.renderIcon(r.context):null,[a]),h=(0,d.useMemo)(()=>{if(s)return(0,l.jsx)(g.syE,{className:"coz-fg-secondary",style:{fontSize:16},onClick:e=>{e.stopPropagation(),t.executeCommand(m.mY.Default.VIEW_SAVING_WIDGET_CLOSE_CONFIRM,[null==r?void 0:r.title])}});if(n){if("saving"===o)return(0,l.jsx)(ep.gb,{size:"mini",loading:!0});else if("error"===o)return(0,l.jsx)(g.wR2,{className:"text-lg coz-fg-hglt-red"})}else;return null},[o,r,s,t,n]),p=(0,d.useCallback)(()=>{c(!0)},[]),f=(0,d.useCallback)(()=>{c(!1)},[]);return(0,l.jsx)("div",{className:tv["title-container"],onMouseOver:p,onMouseLeave:f,children:"loading"!==o&&n?(0,l.jsxs)("div",{className:tv["widget-title"],children:[(0,l.jsxs)("div",{className:tv["title-label"],children:[(0,l.jsx)("div",{className:tv["label-icon"],children:u}),(0,l.jsx)("div",{className:tv["label-text"],children:(0,l.jsx)(ep.ZT.Text,{ellipsis:{showTooltip:!0},children:n})})]}),(0,l.jsx)("div",{className:eX()(tv["close-icon"],m.xO),children:h})]}):(0,l.jsxs)("div",{className:tv["widget-title"],children:[(0,l.jsx)("div",{className:tv["title-label"],children:(0,l.jsx)(ep.Od.Title,{style:{width:"100px"}})}),(0,l.jsx)("div",{className:eX()(tv["close-icon"],m.xO),children:h})]})})},tb=e=>(0,l.jsx)(tg,(0,L._)({},e));n.p,n.p,n.p;var ty=n.p+"static/image/cn-workflow-frame.71d4a119.png";n.p;var t_=n.p+"static/image/cn-knowledge-frame.1e7b48d8.png",tw=n("618461"),tx={};tx.styleTagTransform=eM(),tx.setAttributes=eE(),tx.insert=eC().bind(null,"head"),tx.domAPI=eS(),tx.insertStyleElement=eI(),ew()(tw.Z,tx);var tS=tw.Z&&tw.Z.locals?tw.Z.locals:void 0,tk=()=>{var e=(0,m.XO)(),t=(0,m.eo)(),{keybinding:n}=(0,m.XU)(m.mY.Default.VIEW_FULL_SCREEN),r=(0,m.Lj)(t.currentURI,t.tabBar),[o,a]=(0,d.useState)(!1),[s,c]=(0,d.useState)(e.view.isFullScreenMode);(0,d.useEffect)(()=>{var t=e.view.onFullScreenModeChange(e=>{c(e)});return()=>{t.dispose()}},[]);var u=(0,d.useMemo)(()=>s?(0,l.jsx)(g.qSn,{}):(0,l.jsx)(g.ltt,{}),[s]),h=(0,d.useMemo)(()=>(0,l.jsxs)("div",{className:tS.shortcut,children:[(0,l.jsx)("div",{className:tS.label,children:s?ef.o.t("project_ide_restore"):ef.o.t("project_ide_maximize")}),(0,l.jsx)("div",{className:tS.keybinding,children:n})]}),[s,n]);return"left"===r?null:(0,l.jsx)(ep.u,{content:h,position:"bottom",trigger:"custom",visible:o,children:(0,l.jsx)(ep.hU,{className:tS["icon-button"],icon:u,color:"secondary",onClick:()=>{e.view.switchFullScreenMode(),a(!1)},onMouseOver:()=>a(!0),onMouseOut:()=>a(!1)})})},tC=n("260776"),tj={};tj.styleTagTransform=eM(),tj.setAttributes=eE(),tj.insert=eC().bind(null,"head"),tj.domAPI=eS(),tj.insertStyleElement=eI(),ew()(tC.Z,tj);var tE=tC.Z&&tC.Z.locals?tC.Z.locals:void 0,tT=()=>{var e=(0,m.XO)(),t=(0,m.eo)(),n=(0,m.Lj)(t.currentURI,t.tabBar),{pathname:r}=(0,c.useLocation)(),[o,a]=(0,d.useState)(e.view.primarySidebar.getVisible()),s=(0,x.Un)(e=>e.canClosePopover),[u,h]=(0,d.useState)(!1),p=(0,d.useRef)(),f=(0,d.useRef)(),v=()=>{h(!0),clearTimeout(p.current),f.current=!1},b=()=>{if(f.current=!0,!!s)p.current=setTimeout(()=>{h(!1)},100)};(0,d.useEffect)(()=>{s&&f.current&&h(!1)},[s]),(0,d.useLayoutEffect)(()=>{a(e.view.primarySidebar.getVisible())},[r]),(0,d.useEffect)(()=>{var t=e.view.onSidebarVisibleChange(e=>{a(e)});return()=>{t.dispose()}},[]);var y=(0,d.useCallback)(()=>{e.view.primarySidebar.changeVisible(!0),h(!1)},[]);return"right"===n?null:o?null:(0,l.jsx)(ep.J2,{motion:!1,visible:u,trigger:"custom",zIndex:1e3,style:{background:"transparent",border:"none",boxShadow:"none",padding:0},content:(0,l.jsx)("div",{onMouseEnter:v,onMouseLeave:b,className:tE["sidebar-wrapper"],children:(0,l.jsx)(tp,{hideExpand:!0,idPrefix:"popover-sidebar"})}),children:(0,l.jsx)(ep.hU,{className:tE["icon-button"],icon:(0,l.jsx)(g.m7o,{style:{rotate:"180deg"}}),color:"secondary",onClick:y,onMouseEnter:v,onMouseLeave:b})})},tI=n("130493"),tP={};tP.styleTagTransform=eM(),tP.setAttributes=eE(),tP.insert=eC().bind(null,"head"),tP.domAPI=eS(),tP.insertStyleElement=eI(),ew()(tI.Z,tP);var tM=tI.Z&&tI.Z.locals?tI.Z.locals:void 0,tR=e=>{var{item:t}=e,{key:n,label:r,keybinding:o}=t;return(0,l.jsxs)("div",{className:tM["shortcut-item"],children:[(0,l.jsx)("div",{className:tM.label,children:r}),(0,l.jsx)("div",{className:tM.keybinding,children:o.map(e=>e.map(e=>(0,l.jsx)("div",{className:tM["keybinding-block"],children:e},e)))})]},n)},tD=n("676466"),tA={};tA.styleTagTransform=eM(),tA.setAttributes=eE(),tA.insert=eC().bind(null,"head"),tA.domAPI=eS(),tA.insertStyleElement=eI(),ew()(tD.Z,tA);var tN=tD.Z&&tD.Z.locals?tD.Z.locals:void 0,tL=[m.mY.Default.VIEW_CLOSE_ALL_WIDGET,m.mY.Default.VIEW_CLOSE_CURRENT_WIDGET,m.mY.Default.VIEW_CLOSE_OTHER_WIDGET],tz=()=>{var e=(0,m.RX)(m.L),t=(0,m.RX)(m.Ho),n=e.shortcutsHandlers.filter(e=>tL.includes(e.commandId)).map(n=>{var r;return{key:n.commandId,label:(null===(r=t.getCommand(n.commandId))||void 0===r?void 0:r.label)||n.commandId,keybinding:e.getShortcutByCommandId(n.commandId)}}),r=(0,d.useCallback)(()=>{window.open("/docs/guides/build_project_in_projectide")},[]);(0,d.useCallback)(()=>{window.open("/docs/guides/build_ui_interface")},[]);var o=(0,d.useCallback)(()=>{window.open("/docs/guides/add_resources_to_project")},[]);return(0,l.jsxs)("div",{className:tN["default-container"],children:[(0,l.jsx)("div",{className:tN["icon-expand"],children:(0,l.jsx)(tT,{})}),(0,l.jsx)("div",{className:tN["full-screen"],children:(0,l.jsx)(tk,{})}),(0,l.jsx)("div",{className:tN.title,children:ef.o.t("project_ide_welcome_title")}),(0,l.jsx)("div",{className:tN["sub-title"],children:ef.o.t("project_ide_welcome_describe")}),(0,l.jsxs)("div",{className:tN.gallery,children:[(0,l.jsxs)("div",{className:tN["gallery-block"],children:[(0,l.jsx)(ep.Ee,{preview:!1,src:ty,width:320,height:160}),(0,l.jsx)("div",{className:tN["gallery-title"],children:ef.o.t("project_ide_welcome_workflow_title")}),(0,l.jsx)("div",{className:tN["gallery-description"],children:ef.o.t("project_ide_welcome_workflow_describe")}),(0,l.jsx)(ep.zx,{className:tN["doc-search"],icon:(0,l.jsx)(g.da8,{}),color:"primary",onClick:r,children:ef.o.t("project_ide_view_document")})]}),null,(0,l.jsxs)("div",{className:tN["gallery-block"],children:[(0,l.jsx)(ep.Ee,{preview:!1,src:t_,width:320,height:160}),(0,l.jsx)("div",{className:tN["gallery-title"],children:ef.o.t("project_ide_welcome_db_title")}),(0,l.jsx)("div",{className:tN["gallery-description"],children:ef.o.t("project_ide_welcome_db_describ")}),(0,l.jsx)(ep.zx,{className:tN["doc-search"],icon:(0,l.jsx)(g.da8,{}),color:"primary",onClick:o,children:ef.o.t("project_ide_view_document")})]})]}),(0,l.jsx)("div",{className:tN["shortcuts-list"],children:n.map(e=>(0,l.jsx)(tR,{item:e},e.key))})]})},tO=e=>{var{widget:t}=e,{keybinding:n}=(0,m.XU)(m.yJ.RELOAD),[r,o]=(0,d.useState)(!1),a=(0,d.useMemo)(()=>(0,l.jsxs)("div",{className:tS.shortcut,children:[(0,l.jsx)("div",{className:tS.label,children:ef.o.t("refresh_project_tags")}),(0,l.jsx)("div",{className:tS.keybinding,children:n})]}),[n]);return(0,l.jsx)(ep.u,{content:a,position:"bottom",trigger:"custom",visible:r,children:(0,l.jsx)(ep.hU,{className:tS["icon-button"],icon:(0,l.jsx)(g.mxP,{}),color:"secondary",onClick:()=>{t.refresh(),t.context.widget.setUIState("loading")},onMouseOver:()=>o(!0),onMouseOut:()=>o(!1)})})},tB=e=>{var{widget:t}=e;return(0,l.jsxs)("div",{style:{display:"flex"},children:[(0,l.jsx)(tO,{widget:t}),(0,l.jsx)(tk,{})]})},tW=n("184983"),tF={};tF.styleTagTransform=eM(),tF.setAttributes=eE(),tF.insert=eC().bind(null,"head"),tF.domAPI=eS(),tF.insertStyleElement=eI(),ew()(tW.Z,tF);var tH=tW.Z&&tW.Z.locals?tW.Z.locals:void 0,tU=e=>{var{scene:t,resourceName:n}=e,r=(0,d.useMemo)(()=>{switch(t){case eJ.K2.CopyResourceFromLibrary:return ef.o.t("resource_process_modal_text_copying_resource_to_project",{resourceName:n});case eJ.K2.MoveResourceToLibrary:return ef.o.t("resource_process_modal_text_moving_resource_to_library",{resourceName:n});case eJ.K2.CopyResourceToLibrary:return ef.o.t("resource_process_modal_text_copying_resource_to_library",{resourceName:n});case eJ.K2.CopyProjectResource:return ef.o.t("project_toast_copying_resource",{resourceName:n});default:return""}},[t,n]),o=(0,d.useMemo)(()=>t===eJ.K2.MoveResourceToLibrary?ef.o.t("resource_process_modal_text_moving_process_interrupt_warning"):ef.o.t("resource_process_modal_text_copying_process_interrupt_warning"),[t]);return(0,l.jsxs)("div",{className:tH["description-container"],children:[(0,l.jsx)(ep.gb,{loading:!0,wrapperClassName:tH.spin}),(0,l.jsx)("div",{children:r}),(0,l.jsx)("div",{children:o})]})},tV=()=>{var[e,t]=(0,d.useState)(!1),[n,r]=(0,d.useState)(void 0),[o,a]=(0,d.useState)(!1),[s,c]=(0,d.useState)(""),u=(0,m.RX)(m.Z7),h=(0,d.useCallback)(()=>{u.onCloseResourceModal()},[]),p=(0,d.useCallback)(()=>{o&&u.retry()},[o]),f=(0,d.useMemo)(()=>{switch(n){case eJ.K2.CopyResourceFromLibrary:return ef.o.t("resource_process_modal_title_import_resource_from_library");case eJ.K2.MoveResourceToLibrary:return ef.o.t("resource_process_modal_title_move_resource_to_library");case eJ.K2.CopyResourceToLibrary:return ef.o.t("resource_process_modal_title_copy_resource_to_library");case eJ.K2.CopyProjectResource:return ef.o.t("workflow_add_list_copy");default:return""}},[n]),v=(0,d.useMemo)(()=>{if("string"==typeof o&&"no_task_id"!==o)return o;switch(n){case eJ.K2.CopyResourceFromLibrary:return ef.o.t("resource_toast_copy_to_project_fail");case eJ.K2.MoveResourceToLibrary:return ef.o.t("resource_toast_move_to_library_fail");case eJ.K2.CopyResourceToLibrary:return ef.o.t("resource_toast_copy_to_library_fail");case eJ.K2.CopyProjectResource:return ef.o.t("project_toast_copy_failed");default:return""}},[n,o]),b=(0,d.useMemo)(()=>o?(0,l.jsxs)("div",{className:tH["error-container"],children:[(0,l.jsx)(g.U6C,{className:"coz-fg-hglt-red",fontSize:22}),v]}):(0,l.jsx)(tU,{scene:n,resourceName:s}),[o,v,s,n]),y=(0,d.useMemo)(()=>"",[o]);(0,d.useEffect)(()=>{var e=u.onModalVisibleChange(e=>{var{type:n,visible:o=!0,scene:s,resourceName:l}=e;n===m.w8.RESOURCE&&(t(!!o),r(s),c(l||""),a(!1))}),n=u.onError(e=>{a(e)});return()=>{e.dispose(),n.dispose()}},[]);var _=(0,d.useMemo)(()=>o?ef.o.t("resource_process_modal_cancel_button"):void 0,[o]);return(0,l.jsx)(ep.u_,{visible:e,width:384,type:"dialog",title:f,okText:y,onOk:p,cancelText:_,onCancel:h,maskClosable:!1,children:(0,l.jsx)("div",{className:tH.content,children:b})})},tK=n("626496"),tq={};tq.styleTagTransform=eM(),tq.setAttributes=eE(),tq.insert=eC().bind(null,"head"),tq.domAPI=eS(),tq.insertStyleElement=eI(),ew()(tK.Z,tq);var tZ=tK.Z&&tK.Z.locals?tK.Z.locals:void 0,tY=()=>{var e=(0,m.RX)(m.Z7),t=(0,m.RX)(m.un),n=(0,m.RX)(m.s1),r=(0,d.useRef)(),[o,a]=(0,d.useState)(!1),s=(0,d.useCallback)(()=>{(r.current||[]).forEach(e=>{var t;null==e||null===(t=e.owner)||void 0===t||t.close()}),a(!1)},[]),c=(0,d.useCallback)(()=>{a(!1)},[]);return(0,d.useEffect)(()=>{var o=t.onBeforeUnload(e=>{if(n.getOpenTitles().some(e=>e.saving))return e.preventDefault(),e.stopPropagation(),e.returnValue="",""}),s=e.onModalVisibleChange(e=>{var{type:t,options:n,visible:o=!0}=e;t===m.w8.CLOSE_CONFIRM&&(a(!!o),r.current=n)});return()=>{o.dispose(),s.dispose()}},[]),(0,l.jsx)(ep.u_,{visible:o,type:"dialog",title:ef.o.t("project_ide_unsaved_changes"),okText:ef.o.t("project_ide_quit"),okButtonColor:"red",cancelText:ef.o.t("project_ide_cancel"),onOk:s,onCancel:c,maskClosable:!1,children:(0,l.jsx)("div",{className:tZ.content,children:ef.o.t("project_ide_unsaved_describe")})})},tX=()=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tV,{}),(0,l.jsx)(tY,{})]}),tQ=n("110808"),tG={};tG.styleTagTransform=eM(),tG.setAttributes=eE(),tG.insert=eC().bind(null,"head"),tG.domAPI=eS(),tG.insertStyleElement=eI(),ew()(tQ.Z,tG);var tJ=tQ.Z&&tQ.Z.locals?tQ.Z.locals:void 0;new m.ov("".concat(m.OG,":///session"));var t$=new m.ov("".concat(m.OG,":///variables")),t0=()=>{var e=(0,m.d0)(),t=(0,m.eo)(),n=(0,m.VM)(),[r,o]=(0,d.useState)(!0);(0,d.useCallback)(()=>{e("/session")},[]);var a=(0,d.useCallback)(()=>{e("/variables")},[]);return(0,l.jsxs)("div",{className:tJ["config-container"],children:[(0,l.jsxs)("div",{className:eX()(tJ["primary-sidebar-header"],"h-[".concat(44,"px]")),children:[(0,l.jsx)("div",{className:tJ.title,children:ef.o.t("wf_chatflow_143")}),(0,l.jsx)(ep.hU,{icon:r?(0,l.jsx)(g.Wdl,{className:"coz-fg-primary"}):(0,l.jsx)(g.uDC,{className:"coz-fg-primary"}),color:"secondary",size:"small",onClick:()=>{t&&t.toggleSubWidget(m.KO),o(!r)}})]}),null,(0,l.jsxs)("div",{className:eX()(tJ.item,(0,m.fZ)(null==n?void 0:n.uri,t$)&&tJ.activate),onClick:a,children:[(0,l.jsx)(g.pFl,{className:"coz-fg-plus",style:{marginRight:4}}),ef.o.t("dataide002")]})]})},t1=n("794800"),t2=()=>(0,l.jsx)(ep.ub,{size:"full_screen",icon:(0,l.jsx)(t1.JD,{}),title:"An error occurred",description:"Please try again later."}),t4=n("307765"),t6=[t4.z.Database,t4.z.Dataset,t4.z.Plugin,t4.z.Workflow],t5=e=>{var{spaceId:t,projectId:n}=e,[r,o]=(0,d.useState)(!1),a=(0,m.d0)(),s=(0,m.RX)(m.T_),l=(0,m.RX)(m.cw),{version:c}=(0,m.jo)(),[u]=(0,eG.V)(),h=(0,m.qj)(window.location.pathname);if(r)throw Error("project ide global handler error");var p=(0,x.Un)(e=>e.fetchResource),f=(0,x.Un)(e=>e.refetch),[v,g]=(0,d.useState)(""),[b,y]=(0,d.useState)(""),_=(0,m.CW)("/".concat(x.LC.Workflow,"/").concat(v));return(0,d.useEffect)(()=>{if(!!v)f(e=>{var t,n,r,o=(null==e?void 0:null===(t=e.find(e=>e.groupType===x.ai.Workflow))||void 0===t?void 0:t.resourceList)||[],a=null==o?void 0:null===(n=o.find(e=>e.id===v))||void 0===n?void 0:n.name;a&&_&&(null===(r=_.context.widget)||void 0===r||r.setTitle(a))})},[v,_,b]),(0,m.q9)(e=>{if(!u["bot.automation.project_multi_tab"]||!t6.includes(e.bizType))return;var t,n,r,o=e.operateType===t4.X.Update,a=(null==e?void 0:null===(t=e.extra)||void 0===t?void 0:t.Scene)==="RollbackProject";if(o&&a){window.location.reload();return}var s=e.operateType===t4.X.Create,l=(null==e?void 0:null===(n=e.extra)||void 0===n?void 0:n.methodName)==="CreateWorkflow",c=(null==e?void 0:null===(r=e.extra)||void 0===r?void 0:r.methodName)==="EncapsulateWorkflow";if(s&&(l||c)){f();return}if(!!(null==e?void 0:e.resId))g(null==e?void 0:e.resId),y(new Date().getTime().toString())}),(0,d.useEffect)(()=>{p(t,n,c,e=>{var t,n=(null===(t=(e||[]).find(e=>e.groupType===x.ai.Workflow))||void 0===t?void 0:t.resourceList)||[],r=null==n?void 0:n[0];!h&&l.openFirstWorkflow&&r&&(a("/workflow/".concat(r.id)),l.openFirstWorkflow=!1)})},[t,n]),(0,d.useEffect)(()=>{var e=s.onError(()=>{o(!0)});return()=>{null==e||e.dispose()}},[]),null},t3=n("59955"),t8=()=>{var{projectInfo:e}=ev();return(0,l.jsx)(t3.q,{children:(0,l.jsx)("title",{children:ef.o.t("project_ide_tab_title",{project_name:null==e?void 0:e.name})})})},t9=n("740552"),t7={};t7.styleTagTransform=eM(),t7.setAttributes=eE(),t7.insert=eC().bind(null,"head"),t7.domAPI=eS(),t7.insertStyleElement=eI(),ew()(t9.Z,t7);var ne=t9.Z&&t9.Z.locals?t9.Z.locals:void 0,nt=()=>{var[e,t]=(0,d.useState)(!1),n=(0,m.RX)(el);return((0,d.useEffect)(()=>{var e=n.onStarted(()=>{t(!0)});return()=>e.dispose()},[n]),e)?null:(0,l.jsx)("div",{className:ne["global-loading"],children:(0,l.jsx)(ep.yC,{})})},nn=()=>{var{projectInfo:e}=ev();return(0,l.jsx)(f,{projectInfo:e})},nr=n("981071"),ni={};ni.styleTagTransform=eM(),ni.setAttributes=eE(),ni.insert=eC().bind(null,"head"),ni.domAPI=eS(),ni.insertStyleElement=eI(),ew()(nr.Z,ni),nr.Z&&nr.Z.locals&&nr.Z.locals;var no=n("998486"),na={};na.styleTagTransform=eM(),na.setAttributes=eE(),na.insert=eC().bind(null,"head"),na.domAPI=eS(),na.insertStyleElement=eI(),ew()(no.Z,na),no.Z&&no.Z.locals&&no.Z.locals;var ns=(0,d.memo)(e=>{var{spaceId:t,projectId:n,version:r}=e,o=(0,c.useNavigate)(),a=(0,S.Qb)(S.PL.View,n,t),s=(0,d.useMemo)(()=>({view:{widgetRegistries:[v.Q4,w,y,b,_],secondarySidebar:p,topBar:eZ,primarySideBar:tp,configuration:t0,widgetTitleRender:tb,widgetDefaultRender:tz,widgetFallbackRender:e=>{var{widget:t}=e;return(0,l.jsx)(t2,{})},preToolbar:()=>(0,l.jsx)(tT,{}),toolbar:e=>(0,l.jsx)(tB,{widget:e}),uiBuilder:()=>(0,l.jsx)(nn,{})}}),[]),u=(0,d.useMemo)(()=>[ec({spaceId:t,projectId:n,navigate:o,version:r}),(0,x.X5)()],[t,n,r,o]);if(!a)throw Error("can not view");return(0,l.jsx)(m.X9,{spaceId:t,projectId:n,version:r,children:(0,l.jsxs)(m.Xe,{presetOptions:s,plugins:u,children:[(0,l.jsx)(t8,{}),(0,l.jsx)(tX,{}),(0,l.jsx)(t5,{spaceId:t,projectId:n}),(0,l.jsx)(nt,{})]})})})},297751:function(e,t,n){"use strict";n.d(t,{vp:()=>g,zF:()=>b,TH:()=>v});var r=n("808549"),o=n("120454"),a=n("473980"),s=n("151064"),l=n("455069"),c=n("529801"),d=n("659596"),u=n("392300"),h=n("416290"),p=(0,l.createContext)({showText:!0,setItems:u.Z}),f=(e,t)=>{var{showText:n,setItems:a}=(0,l.useContext)(p),s=(0,h.Z)(t);return(0,l.useEffect)(()=>{a(t=>{var n;return(0,o._)((0,r._)({},t),{[e]:{width:null!==(n=null==s?void 0:s.width)&&void 0!==n?n:0}})})},[null==s?void 0:s.width]),(0,l.useEffect)(()=>()=>{a(t=>(0,c.Z)(t,e))},[]),n},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[n,r]=(0,l.useState)(),o=(0,h.Z)(e),a=Object.getOwnPropertySymbols(n||{}).reduce((e,r,o)=>{var a,s;return e+(null!==(s=null==n?void 0:null===(a=n[r])||void 0===a?void 0:a.width)&&void 0!==s?s:0)+(o>0?t:0)},0),s=!!(null==o?void 0:o.width)&&o.width>=a;return(0,l.useMemo)(()=>({showText:s,setItems:r}),[s])},v=e=>{var{children:t,gap:n=12}=e,r=(0,l.useRef)(null),o=m(r,n);return(0,s.jsx)("div",{ref:r,className:"flex items-center justify-end flex-1 overflow-hidden",style:{gap:n},children:(0,s.jsx)(p.Provider,{value:o,children:t})})},g=(0,l.forwardRef)((e,t)=>{var{itemKey:n,text:u}=e,h=(0,a._)(e,["itemKey","text"]),p=(0,l.useRef)(null),m=f(n,p);return(0,s.jsxs)("span",{ref:t,children:[(0,s.jsx)("div",{className:m?"":"fixed left-[-999px]",ref:p,children:(0,s.jsx)(d.zx,(0,o._)((0,r._)({size:"default",color:"secondary"},m?h:(0,c.Z)(h,"data-testid")),{children:u}))}),!m&&(0,s.jsx)(d.u,{content:u,children:(0,s.jsx)(d.hU,(0,r._)({size:"default",color:"secondary"},h))})]})}),b=(0,l.forwardRef)((e,t)=>{var{itemKey:n,fullContent:r,collapsedContent:o,collapsedTooltip:a}=e,c=(0,l.useRef)(null),u=f(n,c);return(0,s.jsxs)("span",{ref:t,children:[(0,s.jsx)("div",{className:u?"":"fixed left-[-999px]",ref:c,children:r}),!u&&(0,s.jsx)(d.u,{trigger:a?"hover":"custom",content:a,children:(0,s.jsx)("span",{children:o})})]})})},616405:function(e,t,n){"use strict";n.d(t,{kt:()=>u});var r=n("151064"),o=n("336205");n.p;var a=n("122206");a.g.Unknown,o.o.t("coze_premium_credits_cycle_4"),a.g.Never,o.o.t("coze_premium_credits_cycle_4"),a.g.Day,o.o.t("coze_premium_credits_cycle_1"),a.g.Week,o.o.t("coze_premium_credits_cycle_2"),a.g.Month,o.o.t("coze_premium_credits_cycle_3");var s=n("252237"),l=n.n(s),c=n("873183"),d=n("659596");function u(e){var{className:t,monetizeConfig:n,supportPlatforms:a}=e,s=a.map(e=>e.name).join(", ");return(0,r.jsxs)("div",{className:l()("flex justify-end items-center gap-[12px]",t),children:[(0,r.jsxs)("div",{className:"flex items-center gap-[4px]",children:[(0,r.jsx)("span",{className:"font-medium coz-fg-plus",children:"".concat(o.o.t("monetization"),": ").concat(n.is_enable?o.o.t("monetization_publish_on"):o.o.t("monetization_publish_off"))}),(0,r.jsx)(d.u,{content:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("div",{children:n.is_enable?o.o.t("monetization_on_des"):o.o.t("monetization_off_des")}),n.is_enable?(0,r.jsx)("div",{className:"mt-[8px] pt-[8px] border-0 border-t border-solid coz-stroke-primary",children:"".concat(o.o.t("free_chat_allowance")," : ").concat(n.free_chat_allowance_count)}):null]}),children:(0,r.jsx)(c.L03,{className:"w-[16px] h-[16px] coz-fg-secondary"})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-[4px]",children:[(0,r.jsxs)("span",{className:"font-normal coz-fg-tertiary",children:[o.o.t("monetization_support"),":"]}),(0,r.jsx)("span",{className:"flex items-center gap-[4px]",children:a.map(e=>(0,r.jsx)(d.qE,{className:"h-[16px] w-[16px] rounded-[4px]",size:"extra-extra-small",shape:"square",src:e.icon},e.id))}),(0,r.jsx)(d.u,{content:"".concat(o.o.t("monetization_support_tips"),": ").concat(s),children:(0,r.jsx)(c.L03,{className:"w-[16px] h-[16px] coz-fg-secondary"})})]})]})}},319276:function(e,t,n){"use strict";n.d(t,{a2:function(){return o},bQ:function(){return a},pl:function(){return r}});var r="https://lf3-static.bytednsdoc.com/obj/eden-cn/rkzild_lgvj/ljhwZthlaukjlkulzlp/",o="undefined"!=typeof location?location.origin:"https://api.xxx.com",a=e=>""},76313:function(e,t,n){"use strict";n.d(t,{N:()=>l});var r=n("825955"),o=n("455069"),a=n("735114"),s=n("382534"),l=e=>{var{type:t,intelligenceId:n,spaceId:l,enable:c}=e,[d,u]=(0,o.useState)(!1),h=(0,a.Z)((0,r._)(function*(){var e,r;return null===(r=(yield s.sD.PublishIntelligenceList({space_id:l,intelligence_type:t,intelligence_ids:[n],size:1},{__disableErrorToast:!0})).data)||void 0===r?void 0:null===(e=r.intelligences)||void 0===e?void 0:e[0]}),{manual:!0,ready:c,pollingInterval:6e4,pollingErrorRetryCount:3,onSuccess:e=>{e&&h.cancel()},onFinally:()=>{u(!0)}});return(0,o.useEffect)(()=>(u(!1),h.run(),h.cancel),[t,n,l,c]),{inited:d,ready:!!h.data}}},174470:function(e,t,n){"use strict";n.r(t),n.d(t,{usePublishStatus:()=>tJ,useBizConnectorAnchor:()=>eW,PublishButton:()=>t0,ProjectPublish:()=>tX});var r,o,a,s,l,c,d,u,h,p=n("151064"),f=n("455069"),m=n("664319"),v=n("297158"),g=n("659596"),b=n("157728"),y=n("808549"),_=n("120454"),w=n("479910"),x=n("598208"),S=n("61111"),k="10000129",C={connectorList:[],connectorUnionMap:{},selectedConnectorIds:[],showPublishResult:!1,lastVersionNumber:"",versionNumber:"",versionDescription:"",connectorPublishConfig:{},socialPlatformChatflow:{},templateConfigured:!0,connectors:{},unions:{},publishRecordDetail:{},pageLoading:!1},j=(0,x.Ue)()((0,w.mW)((e,t)=>{var n;return(0,_._)((0,y._)({},C),{reset:()=>{e(C)},setMonetizeConfig:t=>e({monetizeConfig:t}),setConnectorList:t=>{e({connectorList:t})},setSelectedConnectorIds:t=>{e({selectedConnectorIds:t})},updateSelectedConnectorIds:t=>{e(e=>({selectedConnectorIds:t(e.selectedConnectorIds)}))},setShowPublishResult:t=>{e({showPublishResult:t})},setProjectPublishInfo:(n=e,(e,t)=>{(null==t?void 0:t.replace)?n(e):n(t=>(0,y._)({},t,e))}),setProjectPublishInfoByImmer:n=>{e({connectorPublishConfig:(0,S.Uy)(t().connectorPublishConfig,n)},!1,"setProjectPublishInfoByImmer")},setPublishRecordDetail:t=>e(e=>({publishRecordDetail:(0,y._)({},e.publishRecordDetail,t)})),resetProjectPublishInfo:()=>{e(C)},exportDraft:e=>{var{versionNumber:n,versionDescription:r,selectedConnectorIds:o,connectorPublishConfig:a,unions:s,socialPlatformChatflow:l}=t();return{projectId:e,versionNumber:n,versionDescription:r,selectedConnectorIds:o,unions:s,sdkConfig:a["999"],socialPlatformConfig:l}}})},{enabled:!1,name:"botStudio.projectPublishStore"})),E=n("298203"),T="coz_project_publish_draft",I=n("825955");var P=((r={})[r.NoBindRequired=1]="NoBindRequired",r[r.AuthBind=2]="AuthBind",r[r.KvBind=3]="KvBind",r[r.KvAuthBind=4]="KvAuthBind",r[r.ApiBind=5]="ApiBind",r[r.WebSDKBind=6]="WebSDKBind",r[r.StoreBind=7]="StoreBind",r[r.AuthAndConfig=8]="AuthAndConfig",r[r.TemplateBind=9]="TemplateBind",r);var M=((o={})[o.APIOrSDK=1]="APIOrSDK",o[o.SocialPlatform=2]="SocialPlatform",o[o.Coze=3]="Coze",o[o.MiniProgram=4]="MiniProgram",o[o.CozeSpaceExtensionLibrary=5]="CozeSpaceExtensionLibrary",o);var R=((a={})[a.Normal=0]="Normal",a[a.InReview=1]="InReview",a[a.Offline=2]="Offline",a),D=n("382534"),A=e=>e.replace(/(\d+)\.(\d+)\.(\d+)/g,(e,t,n,r)=>{var o=parseInt(String(r),10)+1;return"".concat(t,".").concat(n,".").concat(o)}),N=e=>{var{lastPublishVersionNumber:t,draftVersionNumber:n,defaultVersionNumber:r}=e;return t&&!n?A(t):n?n:r};var L=((s={})[s.Configured=1]="Configured",s[s.NotConfigured=2]="NotConfigured",s[s.Disconnected=3]="Disconnected",s[s.Configuring=4]="Configuring",s[s.NeedReconfiguring=5]="NeedReconfiguring",s);var z=((l={})[l.Default=0]="Default",l[l.Auditing=1]="Auditing",l[l.Success=2]="Success",l[l.Failed=3]="Failed",l[l.Disable=4]="Disable",l);var O=((c={})[c.Packing=0]="Packing",c[c.PackFailed=1]="PackFailed",c[c.Auditing=2]="Auditing",c[c.AuditNotPass=3]="AuditNotPass",c[c.ConnectorPublishing=4]="ConnectorPublishing",c[c.PublishDone=5]="PublishDone",c),B=e=>{var{bind_type:t,config_status:n}=e;return[P.KvBind,P.AuthBind,P.KvAuthBind,P.TemplateBind].includes(t)&&n===L.NotConfigured},W=e=>{var{allow_publish:t}=e,n=B(e);return n||!t};function F(){return(F=(0,I._)(function*(e,t,n){var{setProjectPublishInfo:r,setSelectedConnectorIds:o,setMonetizeConfig:a}=j.getState();r({pageLoading:!0});try{var s,l,c=function(e){var t=h.find(t=>t.id===e);if(!t||W(t))return"continue";t.connector_union_id?g.push(t.connector_union_id):g.push(t.id),b[t.id]=t.bind_info},[d,u]=yield Promise.all([D.sD.PublishConnectorList({project_id:e}),Promise.resolve(void 0)]),{connector_list:h=[],last_publish_info:p={},connector_union_info_map:f={}}=null!==(I=d.data)&&void 0!==I?I:{},{connector_ids:m=[],connector_publish_config:v={}}=p,g=[],b={};for(var y of m)c(y);var _={};for(var[w,x]of Object.entries(f))_[w]=null!==(R=null===(P=x.connector_options.find(e=>m.includes(e.connector_id)))||void 0===P?void 0:P.connector_id)&&void 0!==R?R:x.connector_options[0].connector_id;if(null==n?void 0:null===(C=n.socialPlatformConfig)||void 0===C?void 0:null===(k=C.selected_workflows)||void 0===k?void 0:k[0].workflow_id)A=n.socialPlatformConfig;else for(var S of h){if(!!g.includes(S.id)&&S.connector_classification===M.SocialPlatform){var k,C,E,T,I,P,R,A,L,z=v[S.id];if(null==z?void 0:null===(L=z.selected_workflows)||void 0===L?void 0:L[0].workflow_id){A=z;break}}}(null==n?void 0:null===(T=n.sdkConfig)||void 0===T?void 0:null===(E=T.selected_workflows)||void 0===E?void 0:E[0].workflow_id)&&(v["999"]=n.sdkConfig),o(null!==(s=null==n?void 0:n.selectedConnectorIds)&&void 0!==s?s:g);var O=p.version_number,B=N({lastPublishVersionNumber:O,draftVersionNumber:null==n?void 0:n.versionNumber,defaultVersionNumber:"v0.0.1"});r({lastVersionNumber:O,versionNumber:B,versionDescription:null==n?void 0:n.versionDescription,connectorPublishConfig:v,connectorList:h,connectorUnionMap:f,connectors:b,unions:null!==(l=null==n?void 0:n.unions)&&void 0!==l?l:_,socialPlatformChatflow:A}),a(null==u?void 0:u.data)}catch(e){t(e)}finally{r({pageLoading:!1})}})).apply(this,arguments)}var H=n("59955"),U=n("735114"),V=n("336205"),K=n("873183");function q(e){var t,n,r=e.publish_status===O.PackFailed||e.publish_status===O.AuditNotPass,o=null!==(n=null===(t=e.connector_publish_result)||void 0===t?void 0:t.every(e=>e.connector_publish_status===z.Auditing||e.connector_publish_status===z.Failed||e.connector_publish_status===z.Success))&&void 0!==n&&n;return r||o}var Z=(0,f.createContext)({getContainerRef:()=>null,publishHeaderHeight:0,setPublishHeaderHeight:()=>0}),Y=()=>(0,f.useContext)(Z);function X(){var e,t,n=(0,b.useNavigate)(),r=(0,g.XQ)(),{space_id:o="",project_id:a=""}=(0,b.useParams)(),s=()=>n("/space/".concat(o,"/project-ide/").concat(a)),{connectorList:l,showPublishResult:c,setShowPublishResult:d,versionDescription:u,versionNumber:h,connectors:v,unions:y,connectorPublishConfig:_,socialPlatformChatflow:w,selectedConnectorIds:x,setPublishRecordDetail:S}=j((0,m.N)(e=>({connectorList:e.connectorList,showPublishResult:e.showPublishResult,setShowPublishResult:e.setShowPublishResult,versionNumber:e.versionNumber,versionDescription:e.versionDescription,connectors:e.connectors,unions:e.unions,connectorPublishConfig:e.connectorPublishConfig,socialPlatformChatflow:e.socialPlatformChatflow,selectedConnectorIds:e.selectedConnectorIds,setPublishRecordDetail:e.setPublishRecordDetail}))),[k,C]=(0,f.useState)(!1),{publishHeaderHeight:E,setPublishHeaderHeight:T}=Y();var{run:P,cancel:R}=(0,U.Z)((e=(0,I._)(function*(e){return yield D.sD.GetPublishRecordDetail(e)}),function(t){return e.apply(this,arguments)}),{pollingInterval:3e3,pollingWhenHidden:!1,pollingErrorRetryCount:3,manual:!0,onSuccess:e=>{(null==e?void 0:e.data)?(S(e.data),q(e.data)&&R(),!c&&d(!0)):R()},onError:()=>{R()}});var A=(t=(0,I._)(function*(){if(c)s();else try{if(C(!0),yield r.validate(),!x.length){g.FN.error(V.o.t("publish_tooltip_select_platform"));return}var e={},t={};x.forEach(n=>{var r,o,a,s=null!==(o=y[n])&&void 0!==o?o:n;e[s]=null!==(a=v[s])&&void 0!==a?a:{},(null===(r=l.find(e=>e.id===s))||void 0===r?void 0:r.connector_classification)===M.SocialPlatform?t[s]=w:_[s]&&(t[s]=_[s])});var{data:n}=yield D.sD.PublishProject({project_id:a,version_number:h,description:u,connectors:e,connector_publish_config:t});S({publish_monetization_result:null==n?void 0:n.publish_monetization_result}),(null==n?void 0:n.publish_record_id)&&P({publish_record_id:n.publish_record_id,project_id:a})}catch(e){"string"==typeof Object.values(e)[0]&&g.FN.error(Object.values(e)[0])}finally{C(!1)}}),function(){return t.apply(this,arguments)});return(0,p.jsxs)("div",{className:"sticky top-0 z-[100] coz-bg-primary overflow-y-hidden",style:{height:E},children:[(0,p.jsx)(H.q,{children:(0,p.jsx)("title",{children:V.o.t("Publish")})}),(0,p.jsxs)("div",{className:"flex p-[16px] justify-between items-center coz-stroke-primary border-b border-x-0 border-t-0 border-solid pl-2",children:[(0,p.jsxs)("div",{className:"flex items-center",children:[(0,p.jsx)(g.hU,{icon:(0,p.jsx)(K.$1i,{className:"h-[18px] w-[18px]"}),color:"secondary",iconSize:"large",onClick:s}),(0,p.jsx)("span",{className:"ml-[8px] font-medium text-[20px]",children:V.o.t("Publish")})]}),(0,p.jsx)(g.zx,{onClick:A,loading:k,"data-testid":"project.publish",children:c?V.o.t("bot_publish_success_back"):V.o.t("Publish")})]}),(0,p.jsx)(g.jL,{type:"info",description:V.o.t("project_release_notify"),onClose:()=>{T(65)}})]})}var Q=n("252237"),G=n.n(Q),J=n("28260"),$=n("189284"),ee=n("76313");var et=((d={})[d.Plugin=1]="Plugin",d[d.Workflow=2]="Workflow",d[d.Imageflow=3]="Imageflow",d[d.Knowledge=4]="Knowledge",d[d.UI=5]="UI",d[d.Prompt=6]="Prompt",d[d.Database=7]="Database",d[d.Variable=8]="Variable",d),en=n("319276"),er=n("193893"),ei=n("407821"),eo=n.n(ei),ea=n("472772"),es=n.n(ea),el=n("395245"),ec=n.n(el),ed=n("297998"),eu=n.n(ed),eh=n("646576"),ep=n.n(eh),ef=n("606121"),em=n.n(ef),ev=n("727683"),eg={};eg.styleTagTransform=em(),eg.setAttributes=eu(),eg.insert=ec().bind(null,"head"),eg.domAPI=es(),eg.insertStyleElement=ep(),eo()(ev.Z,eg);var eb=ev.Z&&ev.Z.locals?ev.Z.locals:void 0;function ey(e){var{index:t}=e;return(0,p.jsx)("div",{className:"w-[20px] h-[20px] rounded-full inline-flex items-center justify-center mr-[4px] coz-mg-primary",children:(0,p.jsx)("span",{className:"font-medium coz-fg-secondary",children:t})})}function e_(){var[e,t]=(0,f.useState)(!1),[n,r]=(0,f.useState)(""),o=()=>t(!1);return{node:(0,p.jsxs)(g.u_,{title:V.o.t("app_publish_sdk_title"),closable:!0,visible:e,width:640,onCancel:o,footer:(0,p.jsx)(g.zx,{onClick:o,children:V.o.t("app_publish_sdk_confirm")}),zIndex:2e3,children:[(0,p.jsxs)(g.ZT.Paragraph,{className:"font-medium mb-[8px]",children:[(0,p.jsx)(ey,{index:1}),V.o.t("app_publish_sdk_step_1",{doc_link:(0,p.jsx)(g.ZT.Text,{link:{href:"/docs/developer_guides/oauth_apps",target:"_blank"},children:V.o.t("app_publish_sdk_step_1_doc")})})]}),(0,p.jsxs)(g.ZT.Paragraph,{className:"font-medium mb-[8px]",children:[(0,p.jsx)(ey,{index:2}),V.o.t("app_publish_sdk_step_2")]}),(0,p.jsx)(er.HK,{className:eb["web-sdk-guide"],markDown:n}),(0,p.jsxs)(g.ZT.Paragraph,{className:"font-medium mb-[8px]",children:[(0,p.jsx)(ey,{index:3}),V.o.t("app_publish_sdk_step_3")]})]}),show:e=>{r(function(e){var{projectId:t,workflowId:n,version:r=""}=e;return"```html\n\n${'```'}`;\n}\n\nfunction ListIndex({ index }: { index: number }) {\n return (\n \n {index}\n
\n );\n}\n\nexport function useWebSdkGuideModal() {\n const [visible, setVisible] = useState(false);\n const [scriptTagMd, setScriptTagMd] = useState('');\n\n const show = (params: WebSdkGuideParams) => {\n const md = getWebSdkScriptTagMD(params);\n setScriptTagMd(md);\n setVisible(true);\n };\n const close = () => setVisible(false);\n\n const node = (\n {I18n.t('app_publish_sdk_confirm')}\n }\n // z-index requires a Popover greater than publish-status.\n zIndex={2000}\n >\n \n \n {I18n.t('app_publish_sdk_step_1', {\n doc_link: (\n \n {I18n.t('app_publish_sdk_step_1_doc')}\n \n ),\n })}\n \n \n \n {I18n.t('app_publish_sdk_step_2')}\n \n \n \n \n {I18n.t('app_publish_sdk_step_3')}\n \n \n );\n\n return { node, show };\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Tag, type TagProps, Typography } from '@coze-arch/coze-design';\n\nexport interface PublishStepTitleProps {\n title: string;\n tag?: string;\n color?: TagProps['color'];\n}\n\nexport function PublishStepTitle({ title, tag, color }: PublishStepTitleProps) {\n return (\n \n \n {title}\n \n {typeof tag === 'string' ? (\n \n {tag}\n \n ) : null}\n
\n );\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n IconCozCheckMarkCircle,\n IconCozClock,\n IconCozClockFill,\n IconCozCrossCircle,\n IconCozWarningCircle,\n type OriginIconProps,\n} from '@coze-arch/coze-design/icons';\nimport { type StepProps } from '@coze-arch/coze-design';\n\nexport interface PublishStepIconProps {\n status: StepProps['status'] | 'warn';\n}\n\nexport function PublishStepIcon({ status }: PublishStepIconProps) {\n const iconProps: Pick = {\n width: '16px',\n height: '16px',\n };\n switch (status) {\n case 'wait':\n return ;\n case 'process':\n return ;\n case 'finish':\n return (\n \n );\n case 'warn':\n return (\n \n );\n case 'error':\n return ;\n default:\n return null;\n }\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n type publish,\n ConnectorPublishStatus,\n} from '@coze-arch/idl/intelligence_api';\nimport { I18n, type I18nKeysNoOptionsType } from '@coze-arch/i18n';\nimport {\n CozAvatar,\n Tag,\n type TagProps,\n Typography,\n} from '@coze-arch/coze-design';\n\nimport {\n MINI_PROGRAM_DOUYIN_DOWNLOAD_CONNECTOR_ID,\n MINI_PROGRAM_WECHAT_DOWNLOAD_CONNECTOR_ID,\n WEB_SDK_CONNECTOR_ID,\n} from '@/utils/constants';\n\nfunction getMiniProgramGuideUrl(connectorId?: string) {\n switch (connectorId) {\n case MINI_PROGRAM_DOUYIN_DOWNLOAD_CONNECTOR_ID:\n return '/docs/guides/publish_app_to_douyin_microapp';\n case MINI_PROGRAM_WECHAT_DOWNLOAD_CONNECTOR_ID:\n return '/docs/guides/publish_app_to_wechat_mini_program';\n default:\n return '';\n }\n}\n\nexport interface ConnectorStatusProps {\n result: publish.ConnectorPublishResult;\n showTag?: boolean;\n onShowWebSdkGuide?: (workflowId: string) => void;\n}\n\nconst ConnectorTagMap: Record<\n ConnectorPublishStatus,\n (Pick & { text: I18nKeysNoOptionsType }) | null\n> = {\n [ConnectorPublishStatus.Default]: {\n color: 'brand',\n text: 'project_releasing',\n },\n [ConnectorPublishStatus.Auditing]: {\n color: 'brand',\n text: 'under_review',\n },\n [ConnectorPublishStatus.Failed]: {\n color: 'red',\n text: 'project_release_failed',\n },\n [ConnectorPublishStatus.Success]: {\n color: 'green',\n text: 'project_release_success',\n },\n [ConnectorPublishStatus.Disable]: null, // The corresponding state will not be returned to the front end and will not be adapted.\n};\n\nexport function ConnectorStatus({\n result,\n showTag,\n onShowWebSdkGuide,\n}: ConnectorStatusProps) {\n const tagConfig = ConnectorTagMap[result.connector_publish_status ?? 0];\n // When the Web SDK channel is successfully released, the installation instructions will be displayed\n const shouldShowWebSdkGuide =\n result.connector_id === WEB_SDK_CONNECTOR_ID &&\n result.connector_publish_status === ConnectorPublishStatus.Success;\n const workflowId =\n result.connector_publish_config?.selected_workflows?.[0]?.workflow_id;\n const showWebSdkGuide = () => onShowWebSdkGuide?.(workflowId ?? '');\n return (\n \n
\n
\n {result.connector_name}\n \n {showTag !== false && tagConfig ? (\n
\n {I18n.t(tagConfig.text)}\n \n ) : null}\n
\n {result.connector_publish_status_msg ? (\n \n {result.connector_publish_status_msg}\n \n ) : null}\n {/* Web SDK Channel - Installation Guide */}\n {shouldShowWebSdkGuide ? (\n \n {I18n.t('project_release_guide')}\n \n ) : null}\n {/* Mini Program Channel - Download Code & Installation Guide */}\n {result.download_link ? (\n <>\n \n {I18n.t('project_release_download_code')}\n \n \n {I18n.t('project_release_guide')}\n \n >\n ) : null}\n {result.share_link ? (\n \n {I18n.t('project_release_open_in_store')}\n \n ) : null}\n
\n
\n );\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport {\n ConnectorPublishStatus,\n type PublishRecordDetail,\n PublishRecordStatus,\n ResourceType,\n} from '@coze-arch/idl/intelligence_api';\nimport { I18n } from '@coze-arch/i18n';\nimport { IconCozPlugin, IconCozWorkflow } from '@coze-arch/coze-design/icons';\nimport {\n type StepProps,\n Steps,\n TagGroup,\n Typography,\n} from '@coze-arch/coze-design';\nimport { type DynamicParams } from '@coze-arch/bot-typings/teamspace';\nimport { type UITagProps } from '@coze-arch/bot-semi';\n\nimport { useWebSdkGuideModal } from '@/web-sdk-guide';\nimport { WEB_SDK_CONNECTOR_ID } from '@/utils/constants';\nimport { type ProjectPublishStore } from '@/store';\n\nimport { PublishStepTitle } from './components/publish-step-title';\nimport { PublishStepIcon } from './components/publish-step-icon';\nimport {\n ConnectorStatus,\n type ConnectorStatusProps,\n} from './components/connector-status';\n\nfunction getDefaultStepProps(title: string): StepProps {\n return {\n icon: ,\n title: ,\n };\n}\n\nfunction toPackStepProps(\n record: PublishRecordDetail,\n tagGroupRef: React.RefObject,\n maxTagCount?: number,\n): StepProps {\n const title = I18n.t('project_release_package');\n if (typeof record.publish_status !== 'number') {\n return getDefaultStepProps(title);\n }\n switch (record.publish_status) {\n case PublishRecordStatus.Packing: {\n return {\n icon: ,\n title: (\n \n ),\n };\n }\n case PublishRecordStatus.PackFailed: {\n const tags: UITagProps[] | undefined =\n record.publish_status_detail?.pack_failed_detail?.map(item => ({\n tagKey: item.entity_id,\n className: 'pack-status-tag',\n prefixIcon:\n item.entity_type === ResourceType.Workflow ? (\n \n ) : (\n \n ),\n children: item.entity_name,\n }));\n return {\n icon: ,\n title: (\n \n ),\n description: tags ? (\n \n \n {I18n.t('project_release_pack_fail_reason')}\n \n \n
\n ) : null,\n };\n }\n default: {\n return {\n icon: ,\n title: (\n \n ),\n };\n }\n }\n}\n\nfunction PackStep(props: { record: PublishRecordDetail }) {\n const ref = useRef(null);\n const [maxTagCount, setMaxTagCount] = useState(undefined);\n const stepProps = toPackStepProps(props.record, ref, maxTagCount);\n\n /**\n * TagGroup only supports setting maxTagCount to control the number of display tags, not the number of display rows.\n * Here, the number of rows it is in is determined by iterating over the offsetTop of all Tags, and maxTagCount\n * Set to just enough to display the number of two rows.\n */\n useLayoutEffect(() => {\n if (!ref.current) {\n return;\n }\n const tags = ref.current.getElementsByClassName(\n 'pack-status-tag',\n ) as HTMLCollectionOf;\n if (tags.length <= 0) {\n return;\n }\n let top = -1;\n let rowCount = 0;\n for (let i = 0; i < tags.length; i++) {\n const tagTop = tags[i].offsetTop;\n if (top !== tagTop) {\n top = tagTop;\n rowCount++;\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers -- offsetTop The third change, the current Tag is in the third line\n if (rowCount >= 3) {\n setMaxTagCount(i);\n break;\n }\n }\n }\n }, [props.record.publish_status_detail?.pack_failed_detail]);\n\n return ;\n}\n\nfunction toAuditStepProps(record: PublishRecordDetail): StepProps {\n const title = I18n.t('project_release_coze_audit');\n if (typeof record.publish_status !== 'number') {\n return getDefaultStepProps(title);\n }\n switch (record.publish_status) {\n case PublishRecordStatus.Packing:\n case PublishRecordStatus.PackFailed: {\n return getDefaultStepProps(title);\n }\n case PublishRecordStatus.Auditing: {\n return {\n status: 'process',\n icon: ,\n title: (\n \n ),\n };\n }\n case PublishRecordStatus.AuditNotPass: {\n return {\n status: 'error',\n icon: ,\n title: (\n \n ),\n };\n }\n default: {\n return {\n status: 'finish',\n icon: ,\n title: (\n \n ),\n };\n }\n }\n}\n\nfunction getConnectorsPublishStatus(\n record: ProjectPublishStore['publishRecordDetail'],\n) {\n const connectorResults = record.connector_publish_result ?? [];\n if (connectorResults.length <= 0) {\n return 'wait';\n }\n const failedCount = connectorResults.filter(\n item => item.connector_publish_status === ConnectorPublishStatus.Failed,\n ).length;\n if (failedCount > 0) {\n // All channels failed with a red cross; some channels failed with a yellow exclamation mark\n return failedCount === connectorResults.length ? 'error' : 'warn';\n }\n const publishingCount = connectorResults.filter(\n item =>\n item.connector_publish_status === ConnectorPublishStatus.Default ||\n item.connector_publish_status === ConnectorPublishStatus.Auditing,\n ).length;\n if (publishingCount > 0) {\n // Some channels are in the release, showing the clock icon.\n return 'process';\n }\n return 'finish';\n}\n\nfunction toPublishStepProps(\n record: ProjectPublishStore['publishRecordDetail'],\n onShowWebSdkGuide: ConnectorStatusProps['onShowWebSdkGuide'],\n): StepProps {\n const title = I18n.t('project_release_channel');\n if (typeof record.publish_status !== 'number') {\n return getDefaultStepProps(title);\n }\n // The \"Channel Review and Publish\" step has not been reached, the default gray clock icon is displayed\n if (record.publish_status < PublishRecordStatus.ConnectorPublishing) {\n return {\n ...getDefaultStepProps(title),\n description: record.connector_publish_result?.map(item => (\n \n )),\n };\n }\n return {\n icon: ,\n title: (\n \n ),\n description: record.connector_publish_result?.map(item => (\n \n )),\n };\n}\n\nfunction PublishStep(props: { record: PublishRecordDetail }) {\n const { project_id = '' } = useParams();\n const { node, show: showWebSdkGuideModal } = useWebSdkGuideModal();\n const onShowWebSdkGuide = (workflowId: string) =>\n showWebSdkGuideModal({\n projectId: project_id,\n workflowId,\n version: props.record.connector_publish_result?.find(\n item => item.connector_id === WEB_SDK_CONNECTOR_ID,\n )?.connector_bind_info?.sdk_version,\n });\n const stepProps = toPublishStepProps(props.record, onShowWebSdkGuide);\n return (\n <>\n \n {node}\n >\n );\n}\n\nexport interface ProjectPublishProgressProps {\n record: ProjectPublishStore['publishRecordDetail'];\n}\n\nexport function ProjectPublishProgress({\n record,\n}: ProjectPublishProgressProps) {\n return (\n \n \n \n \n \n );\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NavLink } from 'react-router-dom';\nimport { type FC } from 'react';\n\nimport { useShallow } from 'zustand/react/shallow';\nimport classNames from 'classnames';\nimport { IntelligenceType } from '@coze-arch/idl/intelligence_api';\nimport { I18n } from '@coze-arch/i18n';\nimport { useFlags } from '@coze-arch/bot-flags';\nimport { useIsPublishRecordReady } from '@coze-studio/publish-manage-hooks';\nimport { IconCozCheckMarkCircle } from '@coze-arch/coze-design/icons';\n\nimport { useProjectPublishStore } from '../store';\nimport { ProjectPublishProgress } from '../publish-progress';\n\nexport const PublishRecord: FC<{\n projectId: string;\n spaceId: string;\n}> = ({ projectId, spaceId }) => {\n const { publishRecordDetail } = useProjectPublishStore(\n useShallow(state => ({\n publishRecordDetail: state.publishRecordDetail,\n })),\n );\n\n const [FLAGS] = useFlags();\n\n const { ready, inited } = useIsPublishRecordReady({\n type: IntelligenceType.Project,\n spaceId,\n intelligenceId: projectId,\n // Support soon, so stay tuned.\n enable: FLAGS['bot.studio.publish_management'] && !IS_OPEN_SOURCE,\n });\n\n return (\n \n
\n
\n
\n {I18n.t('project_release_already_released')}\n
\n
\n {I18n.t('project_release_already_released_desc')}\n
\n {/* Support soon, so stay tuned. */}\n {FLAGS['bot.studio.publish_management'] && !IS_OPEN_SOURCE ? (\n
\n {I18n.t('release_management_detail1', {\n button: (\n {\n if (!ready) {\n e.preventDefault();\n }\n }}\n to={`/space/${spaceId}/publish/app/${projectId}`}\n >\n {I18n.t('release_management')}\n {ready || !inited\n ? null\n : `(${I18n.t('release_management_generating')})`}\n \n ),\n })}\n
\n ) : null}\n
\n\n
\n
\n );\n};\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable max-lines-per-function */\nimport { type RefObject, useEffect, useRef, useState } from 'react';\n\nimport { useDebounceFn } from 'ahooks';\nimport { ConnectorClassification } from '@coze-arch/idl/intelligence_api';\n\nimport { usePublishContainer } from '../../context/publish-container-context';\n\nexport type ConnectorRefMap = Record<\n ConnectorClassification,\n RefObject\n>;\n\nconst useConnectorRefMap = (): ConnectorRefMap => ({\n [ConnectorClassification.APIOrSDK]: useRef(null),\n [ConnectorClassification.MiniProgram]: useRef(null),\n [ConnectorClassification.SocialPlatform]: useRef(null),\n [ConnectorClassification.Coze]: useRef(null),\n [ConnectorClassification.CozeSpaceExtensionLibrary]:\n useRef(null),\n});\n\nconst getActiveConnectorTarget = ({\n containerScrollTop,\n connectorRefMap,\n connectorBarHeight,\n publishHeaderHeight,\n}: {\n containerScrollTop: number;\n connectorBarHeight: number;\n connectorRefMap: ConnectorRefMap;\n publishHeaderHeight: number;\n}) => {\n const connectorTargetLis = Object.entries(connectorRefMap)\n .map(([, ref]) => ref.current)\n .filter((element): element is HTMLDivElement => Boolean(element));\n\n const offsetTopList = connectorTargetLis.map(target => ({\n offsetTop:\n target.offsetTop -\n containerScrollTop -\n publishHeaderHeight -\n connectorBarHeight,\n target,\n }));\n\n const sortedTopList = offsetTopList.sort(\n (prev, cur) => prev.offsetTop - cur.offsetTop,\n );\n const preActiveConnectorList = sortedTopList.filter(\n item => item.offsetTop <= 0,\n );\n const activeConnector = preActiveConnectorList.length\n ? preActiveConnectorList.at(-1)\n : sortedTopList.at(0);\n\n return activeConnector?.target;\n};\n/** experience point */\nconst LOCK_TIME = 300;\n\nexport const useConnectorScroll = () => {\n const [activeConnectorTarget, setActiveConnectorTarget] =\n useState();\n const connectorBarRef = useRef(null);\n\n const { getContainerRef } = usePublishContainer();\n\n const connectorRefMap = useConnectorRefMap();\n\n const { publishHeaderHeight } = usePublishContainer();\n\n const [animationStateMap, setAnimationMap] = useState<\n Record\n >({\n [ConnectorClassification.APIOrSDK]: false,\n [ConnectorClassification.MiniProgram]: false,\n [ConnectorClassification.SocialPlatform]: false,\n [ConnectorClassification.Coze]: false,\n [ConnectorClassification.CozeSpaceExtensionLibrary]: false,\n });\n\n /**\n * All three conditions need to be met simultaneously\n * 1. As the page scrolls to different anchors, the tab bar activates the button for the corresponding area\n * 2. Click the tab bar, activate the corresponding button, and scroll directly to the corresponding area of the page\n * 3. When the page height is insufficient to scroll, click the tab bar to activate the corresponding button\n *\n * Since the scroll is a smooth effect, conditions 2 and 3 will conflict, and the lock needs to be performed when the user clicks the tab bar to scroll.\n * Condition 1 does not fire when locked\n * Need to give condition 3 an unlocking mechanism with a bottom line\n */\n const manualScrollLockRef = useRef(false);\n\n const manualScrollLock = () => {\n manualScrollLockRef.current = true;\n };\n\n const manualScrollUnLock = () => {\n manualScrollLockRef.current = false;\n };\n\n /** Unlock after LOCK_TIME */\n const manualScrollUnLockDebounce = useDebounceFn(manualScrollUnLock, {\n wait: LOCK_TIME,\n });\n\n /** The bottom unlocking mechanism, if the user clicks the tab bar but does not unlock the LOCK_TIME should also be unlocked */\n const baseUnLockDebounce = useDebounceFn(manualScrollUnLock, {\n wait: LOCK_TIME,\n });\n\n useEffect(() => {\n const containerTarget = getContainerRef()?.current;\n const connectorBarTarget = connectorBarRef.current;\n if (!containerTarget || !connectorBarTarget) {\n return;\n }\n const changeActiveConnectorTarget = () => {\n if (manualScrollLockRef.current) {\n return;\n }\n setActiveConnectorTarget(\n getActiveConnectorTarget({\n containerScrollTop: containerTarget.scrollTop,\n connectorRefMap,\n connectorBarHeight: connectorBarTarget.offsetHeight,\n publishHeaderHeight,\n }),\n );\n };\n\n changeActiveConnectorTarget();\n\n const onScroll = () => {\n // If the page scrolls, no safety net mechanism is required\n baseUnLockDebounce.cancel();\n manualScrollUnLockDebounce.run();\n changeActiveConnectorTarget();\n };\n\n containerTarget.addEventListener('scroll', onScroll);\n return () => {\n containerTarget.removeEventListener('scroll', onScroll);\n };\n }, [getContainerRef, connectorRefMap, publishHeaderHeight]);\n\n const startAnimation = (classification: ConnectorClassification) => {\n setAnimationMap(prev => ({ ...prev, [classification]: true }));\n };\n\n const closeAnimation = (classification: ConnectorClassification) => {\n setAnimationMap(prev => ({ ...prev, [classification]: false }));\n };\n\n const scrollToConnector = (classification: ConnectorClassification) => {\n const barTarget = connectorBarRef.current;\n const containerTarget = getContainerRef()?.current;\n const connectorTarget = connectorRefMap[classification].current;\n if (!barTarget || !containerTarget || !connectorTarget) {\n return;\n }\n\n containerTarget.scrollTo({\n behavior: 'smooth',\n top:\n connectorTarget.offsetTop -\n publishHeaderHeight -\n barTarget.offsetHeight,\n });\n startAnimation(classification);\n setActiveConnectorTarget(connectorTarget);\n manualScrollLock();\n baseUnLockDebounce.run();\n };\n\n return {\n connectorRefMap,\n activeConnectorTarget,\n connectorBarRef,\n scrollToConnector,\n closeAnimation,\n animationStateMap,\n };\n};\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod';\nimport { produce } from 'immer';\nimport { typeSafeJSONParse } from '@coze-arch/bot-utils';\n\nconst publishAnchorDataSchema = z.object({\n projectId: z.string(),\n connectorIdBeforeRedirect: z.string(),\n});\n\nconst publishAnchorSchema = z.record(publishAnchorDataSchema);\n\ntype PublishAnchorData = z.infer;\n\ntype PublishAnchorType = z.infer;\n\nclass PublishAnchorService {\n private PUBLISH_ANCHOR_KEY = 'coz_project_publish_anchor';\n anchorValues: PublishAnchorType = {};\n\n private load = () => {\n try {\n const stringifyLocalData = localStorage.getItem(this.PUBLISH_ANCHOR_KEY);\n const localData = typeSafeJSONParse(stringifyLocalData);\n const validData = publishAnchorSchema.parse(localData);\n // Using zod to type-check localData\n this.anchorValues = validData;\n } catch {\n this.anchorValues = {};\n }\n };\n\n private save = () => {\n localStorage.setItem(\n this.PUBLISH_ANCHOR_KEY,\n JSON.stringify(this.anchorValues),\n );\n };\n\n setAnchor: (params: {\n userId: string;\n projectId: string;\n connectorId: string;\n }) => void = ({ userId, projectId, connectorId }) => {\n this.anchorValues = produce(this.anchorValues, draft => {\n draft[userId] = {\n projectId,\n connectorIdBeforeRedirect: connectorId,\n };\n });\n this.save();\n };\n getAnchor: (params: {\n userId: string;\n projectId: string;\n }) => PublishAnchorData | undefined = ({ userId, projectId }) => {\n const userData = this.anchorValues[userId];\n if (userData?.projectId === projectId) {\n return userData;\n }\n };\n\n removeAnchor: (params: { userId: string; projectId: string }) => void = ({\n userId,\n projectId,\n }) => {\n const hasAnchor = Boolean(this.getAnchor({ userId, projectId }));\n if (!hasAnchor) {\n return;\n }\n delete this.anchorValues[userId];\n this.save();\n };\n\n clearAll = () => {\n localStorage.removeItem(this.PUBLISH_ANCHOR_KEY);\n this.anchorValues = {};\n };\n\n constructor() {\n this.load();\n }\n}\n\nexport const publishAnchorService = new PublishAnchorService();\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useUserInfo } from '@coze-arch/foundation-sdk';\nimport { type DynamicParams } from '@coze-arch/bot-typings/teamspace';\nimport { useParams } from 'react-router-dom';\n\nimport { publishAnchorService } from '@/service/connector-anchor';\n\nexport const useBizConnectorAnchor = () => {\n const userId = useUserInfo()?.user_id_str;\n const projectId = useParams().project_id;\n\n const setAnchor = (connectorId: string) => {\n if (!userId || !projectId) {\n return;\n }\n return publishAnchorService.setAnchor({ projectId, userId, connectorId });\n };\n\n const getAnchor = () => {\n if (!userId || !projectId) {\n return;\n }\n return publishAnchorService.getAnchor({ userId, projectId });\n };\n\n const removeAnchor = () => {\n if (!userId || !projectId) {\n return;\n }\n return publishAnchorService.removeAnchor({ userId, projectId });\n };\n\n return {\n setAnchor,\n getAnchor,\n removeAnchor,\n };\n};\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect } from 'react';\n\nimport { useProjectPublishStore } from '@/store';\nimport { useBizConnectorAnchor } from '@/hooks/use-biz-connector-anchor';\n\nimport { type ConnectorGroup } from '../utils/format-connector-groups';\nimport { usePublishContainer } from '../../context/publish-container-context';\nimport { type ConnectorRefMap } from './use-connector-scroll';\n\nexport const useAutoScrollToConnector = ({\n connectorGroupList,\n connectorRefMap,\n}: {\n connectorRefMap: ConnectorRefMap;\n connectorGroupList: ConnectorGroup[];\n}) => {\n const { getAnchor, removeAnchor } = useBizConnectorAnchor();\n const { getContainerRef } = usePublishContainer();\n\n useEffect(() => {\n const anchor = getAnchor();\n\n if (!anchor) {\n return;\n }\n\n const targetGroup = connectorGroupList.find(group =>\n group.connectors.some(\n connector => connector.id === anchor.connectorIdBeforeRedirect,\n ),\n );\n\n if (!targetGroup) {\n return;\n }\n\n const connectorRef = connectorRefMap[targetGroup.type];\n const { updateSelectedConnectorIds } = useProjectPublishStore.getState();\n updateSelectedConnectorIds(prev => {\n if (prev.some(id => id === anchor.connectorIdBeforeRedirect)) {\n return prev;\n }\n return prev.concat(anchor.connectorIdBeforeRedirect);\n });\n getContainerRef()?.current?.scrollTo({\n top: connectorRef.current?.offsetTop,\n behavior: 'smooth',\n });\n\n removeAnchor();\n }, [connectorGroupList, connectorRefMap]);\n};\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useRequest } from 'ahooks';\nimport { type CheckType, WorkflowMode } from '@coze-arch/idl/workflow_api';\nimport { type DynamicParams } from '@coze-arch/bot-typings/teamspace';\nimport { workflowApi } from '@coze-arch/bot-api';\nimport { useParams } from 'react-router-dom';\n\nexport interface ChatflowOptionProps {\n value: string;\n label: string;\n disabled?: boolean;\n tooltip?: string;\n}\n\nexport function useChatflowOptions(checkType?: CheckType) {\n const needsCheck = typeof checkType !== 'undefined';\n const { space_id = '', project_id = '' } = useParams();\n const { data: chatflowOptions, loading } = useRequest(async () => {\n const res = await workflowApi.GetWorkFlowList({\n space_id,\n project_id,\n flow_mode: WorkflowMode.ChatFlow,\n page: 1,\n size: 100,\n checker: needsCheck ? [checkType] : undefined,\n });\n return res.data.workflow_list?.map(item => ({\n label: item.name,\n value: item.workflow_id,\n disabled: needsCheck\n ? item.check_result?.find(r => r.type === checkType)?.is_pass !== true\n : false,\n tooltip: item.check_result?.find(r => r.type === checkType)?.reason,\n })) as ChatflowOptionProps[];\n });\n return { chatflowOptions, loading };\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type PropsWithChildren } from 'react';\n\nimport classNames from 'classnames';\nimport { IconCozCheckMarkFill } from '@coze-arch/coze-design/icons';\nimport {\n type optionRenderProps,\n Tooltip,\n Typography,\n} from '@coze-arch/coze-design';\n\nexport type OptionWithTooltipProps = PropsWithChildren<{\n option: optionRenderProps;\n tooltip?: string;\n}>;\n\nexport function OptionWithTooltip({\n option,\n tooltip,\n children,\n}: OptionWithTooltipProps) {\n const optionNode = (\n \n
\n {option.selected ? (\n \n ) : null}\n
\n {children ?? (\n
\n {option.label}\n \n )}\n
\n );\n return tooltip ? (\n \n {optionNode}\n \n ) : (\n optionNode\n );\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useShallow } from 'zustand/react/shallow';\nimport classNames from 'classnames';\nimport { CheckType } from '@coze-arch/idl/workflow_api';\nimport { ConnectorClassification } from '@coze-arch/idl/intelligence_api';\nimport { I18n } from '@coze-arch/i18n';\nimport { FormSelect, type optionRenderProps } from '@coze-arch/coze-design';\n\nimport { useProjectPublishStore } from '@/store';\n\nimport {\n type ChatflowOptionProps,\n useChatflowOptions,\n} from '../hooks/use-chatflow-options';\nimport { OptionWithTooltip } from './option-with-tooltip';\n\nexport const SocialPlatformChatflow: React.FC<{ className?: string }> = ({\n className,\n}) => {\n const {\n connectorList,\n selectedConnectorIds,\n socialPlatformChatflow,\n setProjectPublishInfo,\n } = useProjectPublishStore(\n useShallow(state => ({\n connectorList: state.connectorList,\n selectedConnectorIds: state.selectedConnectorIds,\n socialPlatformChatflow: state.socialPlatformChatflow,\n setProjectPublishInfo: state.setProjectPublishInfo,\n })),\n );\n const hasSelectedSocialPlatforms = connectorList.some(\n c =>\n selectedConnectorIds.includes(c.id) &&\n c.connector_classification === ConnectorClassification.SocialPlatform,\n );\n\n const { chatflowOptions } = useChatflowOptions(CheckType.SocialPublish);\n\n const handleSelectChatflow = (option: ChatflowOptionProps) => {\n setProjectPublishInfo({\n socialPlatformChatflow: {\n selected_workflows: [\n {\n workflow_id: option.value,\n workflow_name: option.label,\n },\n ],\n },\n });\n };\n\n return (\n \n (\n \n )}\n onSelect={(_: unknown, option: unknown) =>\n handleSelectChatflow(option as ChatflowOptionProps)\n }\n rules={[\n // Chatflow is required when SocialPlatform is selected\n { required: hasSelectedSocialPlatforms },\n // Verify that the selected chatflow exists & & is not disabled\n {\n validator: (_rule: unknown, value: unknown) => {\n if (!hasSelectedSocialPlatforms) {\n return true;\n }\n const selected = chatflowOptions?.find(\n option => option.value === (value as string),\n );\n if (!selected) {\n return new Error(I18n.t('project_release_chatflow3'));\n }\n if (selected.disabled) {\n return new Error(selected.tooltip);\n }\n return true;\n },\n },\n ]}\n />\n
\n );\n};\n","\n import API from \"!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].use[2]!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/postcss-loader/index.js??ruleSet[1].rules[10].use[3]!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+plugin-less@1.1.1_@rsbuild+core@1.1.13/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[10].use[4]!./index.module.less\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].use[2]!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/postcss-loader/index.js??ruleSet[1].rules[10].use[3]!../../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+plugin-less@1.1.1_@rsbuild+core@1.1.13/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[10].use[4]!./index.module.less\";\n export default content && content.locals ? content.locals : undefined;\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type CSSProperties, forwardRef, type PropsWithChildren } from 'react';\n\nimport classNames from 'classnames';\nimport { Badge, Button } from '@coze-arch/coze-design';\n\nimport styles from './index.module.less';\n\nexport interface TabbarItemProps {\n onClick: () => void;\n isActive: boolean;\n selectedConnectorCount: number;\n}\nexport const ConnectorTabbarItem: React.FC<\n PropsWithChildren\n> = ({ onClick, isActive, children, selectedConnectorCount }) => (\n \n);\n\nexport interface ConnectorTabbarProps {\n className?: string;\n style?: CSSProperties;\n}\n\nexport const ConnectorTabbar = forwardRef<\n HTMLDivElement,\n PropsWithChildren\n>(({ className, style, children }, ref) => (\n \n {children}\n
\n));\n","\n import API from \"!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/style-loader/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].use[2]!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/postcss-loader/index.js??ruleSet[1].rules[10].use[3]!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+plugin-less@1.1.1_@rsbuild+core@1.1.13/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[10].use[4]!./connector-group-header.module.less\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[10].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[10].use[2]!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+core@1.1.13/node_modules/@rsbuild/core/compiled/postcss-loader/index.js??ruleSet[1].rules[10].use[3]!../../../../../../../../common/temp/default/node_modules/.pnpm/@rsbuild+plugin-less@1.1.1_@rsbuild+core@1.1.13/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[10].use[4]!./connector-group-header.module.less\";\n export default content && content.locals ? content.locals : undefined;\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type AnimationEventHandler } from 'react';\n\nimport classNames from 'classnames';\nimport { ConnectorClassification } from '@coze-arch/idl/intelligence_api';\nimport { I18n } from '@coze-arch/i18n';\nimport {\n IconCozInfoCircle,\n IconCozDiamondFill,\n} from '@coze-arch/coze-design/icons';\nimport { Tooltip, Space } from '@coze-arch/coze-design';\nimport {\n useBenefitAvailable,\n PremiumPaywallScene,\n usePremiumPaywallModal,\n} from '@coze-studio/premium-components-adapter';\n\nimport styles from './connector-group-header.module.less';\n\ninterface ConnectorGroupHeaderProps {\n label: string;\n tooltipContent: string;\n showTooltipInfo: boolean;\n isHighlight: boolean;\n type: ConnectorClassification;\n onAnimationEnd: AnimationEventHandler;\n}\n\nexport function ConnectorGroupHeader({\n label,\n tooltipContent,\n showTooltipInfo,\n isHighlight,\n type,\n onAnimationEnd,\n}: ConnectorGroupHeaderProps) {\n // paywall\n const isAPIOrSDK = type === ConnectorClassification.APIOrSDK;\n const isAvailable = useBenefitAvailable({\n scene: PremiumPaywallScene.API,\n });\n const { node: premiumPaywallModal, open: openPremiumPaywallModal } =\n usePremiumPaywallModal({ scene: PremiumPaywallScene.API });\n\n return (\n \n
{label}
\n {isAPIOrSDK && !isAvailable ? (\n
\n \n {I18n.t('coze_quota_exemption_notice', {\n link: (\n \n {I18n.t('coze_upgrade_package')}\n
\n ),\n })}\n \n ) : null}\n {showTooltipInfo ? (\n
\n \n \n ) : null}\n {premiumPaywallModal}\n
\n );\n}\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type StoreBindKey } from '@/store';\n\ntype SelfMapping = {\n [K in T]: K; // Key syntax: Mapping each literal type to itself\n};\n\ntype KeyMapping = SelfMapping;\n\nexport const isStoreBindConfigured = (\n config: Record,\n): boolean => {\n // Prevent StoreBindKey changes from causing bugs\n const { category_id, display_screen }: KeyMapping = {\n category_id: 'category_id',\n display_screen: 'display_screen',\n };\n return Boolean(config[category_id]) && Boolean(config[display_screen]);\n};\n","import baseFlatten from './_baseFlatten.js';\nimport baseRest from './_baseRest.js';\nimport baseUniq from './_baseUniq.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\n\n/**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\nvar union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n});\n\nexport default union;\n","/*\n * Copyright 2025 coze-dev Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable complexity */\n/* eslint-disable @coze-arch/max-line-per-function */\nimport { useParams } from 'react-router-dom';\nimport { useState, useRef } from 'react';\n\nimport { useShallow } from 'zustand/react/shallow';\nimport { debounce, union, find } from 'lodash-es';\nimport { useInfiniteScroll } from 'ahooks';\nimport {\n CheckType,\n WorkflowMode,\n type Workflow,\n} from '@coze-arch/idl/workflow_api';\nimport {\n type PublishConnectorInfo,\n ConnectorConfigStatus,\n} from '@coze-arch/idl/intelligence_api';\nimport { I18n } from '@coze-arch/i18n';\nimport { IconCozInfoCircle, IconCozEmpty } from '@coze-arch/coze-design/icons';\nimport {\n Modal,\n Search,\n Checkbox,\n Divider,\n Spin,\n Tooltip,\n Space,\n EmptyState,\n} from '@coze-arch/coze-design';\nimport { type DynamicParams } from '@coze-arch/bot-typings/teamspace';\nimport { workflowApi } from '@coze-arch/bot-api';\n\nimport { useProjectPublishStore } from '@/store';\n\nexport interface DataList {\n list: Workflow[];\n hasMore?: boolean;\n nextCursorId?: string;\n total: number;\n nextPageIndex: number;\n}\n\nconst debounceTimer = 500;\n\nexport const UseMcpConfigModal = ({\n record,\n}: {\n record: PublishConnectorInfo;\n}) => {\n const [visible, setVisible] = useState(false);\n const [searchVal, setSearchVal] = useState('');\n const [checkedList, setCheckedList] = useState([]);\n const { space_id = '', project_id = '' } = useParams();\n\n const {\n connectorPublishConfig,\n setProjectPublishInfo,\n connectorList,\n selectedConnectorIds,\n } = useProjectPublishStore(\n useShallow(state => ({\n connectorPublishConfig: state.connectorPublishConfig,\n setProjectPublishInfo: state.setProjectPublishInfo,\n connectorList: state.connectorList,\n selectedConnectorIds: state.selectedConnectorIds,\n })),\n );\n\n const containerRef = useRef(null);\n\n const { loading, data, loadingMore } = useInfiniteScroll