@univerjs/docs-thread-comment-ui 0.3.0-alpha.0 → 0.3.0-nightly.202410101606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),threadCommentUi=require("@univerjs/thread-comment-ui"),engineRender=require("@univerjs/engine-render"),ui=require("@univerjs/ui"),docsUi=require("@univerjs/docs-ui"),threadComment=require("@univerjs/thread-comment"),docs=require("@univerjs/docs"),React=require("react"),rxjs=require("rxjs"),PLUGIN_NAME="DOC_THREAD_COMMENT_UI_PLUGIN",DEFAULT_DOC_SUBUNIT_ID="default_doc";var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=React.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=React.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return React.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a6){var key=_a6[0],value=_a6[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a6,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a6=node.children)===null||_a6===void 0)&&_a6.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CommentSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"comment-single",ref,icon:element}))});CommentSingle.displayName="CommentSingle";const AddDocCommentComment={id:"docs.command.add-comment",type:core.CommandType.COMMAND,async handler(accessor,params){if(!params)return!1;const{comment:originComment,unitId}=params,comment=await accessor.get(threadComment.IThreadCommentDataSourceService).addComment(originComment),commandService=accessor.get(core.ICommandService),doMutation=docsUi.addCustomDecorationBySelectionFactory(accessor,{id:comment.id,type:core.CustomDecorationType.COMMENT});if(doMutation){const addComment={id:threadComment.AddCommentMutation.id,params:{unitId,subUnitId:DEFAULT_DOC_SUBUNIT_ID,comment}},activeOperation={id:threadCommentUi.SetActiveCommentOperation.id,params:{unitId,subUnitId:DEFAULT_DOC_SUBUNIT_ID,commentId:comment.id}};return(await core.sequenceExecuteAsync([addComment,doMutation,activeOperation],commandService)).result}return!1}},DeleteDocCommentComment={id:"docs.command.delete-comment",type:core.CommandType.COMMAND,async handler(accessor,params){if(!params)return!1;const{commentId,unitId}=params,commandService=accessor.get(core.ICommandService),doMutation=docsUi.deleteCustomDecorationFactory(accessor,{id:commentId,unitId});return doMutation?(await core.sequenceExecute([doMutation],commandService)).result:!1}};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a;let DocThreadCommentService=(_a=class extends core.Disposable{constructor(_sidebarService,_threadCommentPanelService){super();__publicField(this,"_addingComment$",new rxjs.BehaviorSubject(void 0));__publicField(this,"addingComment$",this._addingComment$.asObservable());this._sidebarService=_sidebarService,this._threadCommentPanelService=_threadCommentPanelService,this.disposeWithMe(()=>{this._addingComment$.complete()})}get addingComment(){return this._addingComment$.getValue()}startAdd(comment){this._addingComment$.next(comment)}endAdd(){this._addingComment$.next(void 0)}},__name(_a,"DocThreadCommentService"),_a);DocThreadCommentService=__decorateClass$4([__decorateParam$4(0,ui.ISidebarService),__decorateParam$4(1,core.Inject(threadCommentUi.ThreadCommentPanelService))],DocThreadCommentService);const ShowCommentPanelOperation={id:"docs.operation.show-comment-panel",type:core.CommandType.OPERATION,handler(accessor,params){var _a6;const panelService=accessor.get(threadCommentUi.ThreadCommentPanelService),sidebarService=accessor.get(ui.ISidebarService);return(!panelService.panelVisible||((_a6=sidebarService.options.children)==null?void 0:_a6.label)!==DocThreadCommentPanel.componentKey)&&(sidebarService.open({header:{title:"threadCommentUI.panel.title"},children:{label:DocThreadCommentPanel.componentKey},width:320,onClose:__name(()=>panelService.setPanelVisible(!1),"onClose")}),panelService.setPanelVisible(!0)),params&&panelService.setActiveComment(params==null?void 0:params.activeComment),!0}},ToggleCommentPanelOperation={id:"docs.operation.toggle-comment-panel",type:core.CommandType.OPERATION,handler(accessor){var _a6;const panelService=accessor.get(threadCommentUi.ThreadCommentPanelService),sidebarService=accessor.get(ui.ISidebarService);return!panelService.panelVisible||((_a6=sidebarService.options.children)==null?void 0:_a6.label)!==DocThreadCommentPanel.componentKey?(sidebarService.open({header:{title:"threadCommentUI.panel.title"},children:{label:DocThreadCommentPanel.componentKey},width:320,onClose:__name(()=>panelService.setPanelVisible(!1),"onClose")}),panelService.setPanelVisible(!0)):(sidebarService.close(),panelService.setPanelVisible(!1),panelService.setActiveComment(null)),!0}},StartAddCommentOperation={id:"docs.operation.start-add-comment",type:core.CommandType.OPERATION,handler(accessor){var _a6,_b,_c;const panelService=accessor.get(threadCommentUi.ThreadCommentPanelService),doc=accessor.get(core.IUniverInstanceService).getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC),docSelectionManagerService=accessor.get(docs.DocSelectionManagerService),renderManagerService=accessor.get(engineRender.IRenderManagerService),userManagerService=accessor.get(core.UserManagerService),docCommentService=accessor.get(DocThreadCommentService),commandService=accessor.get(core.ICommandService),sidebarService=accessor.get(ui.ISidebarService),textRange=docSelectionManagerService.getActiveTextRange();if(!doc||!textRange)return!1;const docSelectionRenderManager=(_a6=renderManagerService.getRenderById(doc.getUnitId()))==null?void 0:_a6.with(docsUi.DocSelectionRenderService);if(textRange.collapsed)return panelService.panelVisible?(panelService.setPanelVisible(!1),sidebarService.close()):commandService.executeCommand(ShowCommentPanelOperation.id),!0;commandService.executeCommand(ShowCommentPanelOperation.id);const unitId=doc.getUnitId(),dataStream=((_c=(_b=doc.getBody())==null?void 0:_b.dataStream)!=null?_c:"").slice(textRange.startOffset,textRange.endOffset),text=core.BuildTextUtils.transform.getPlainText(dataStream),subUnitId=DEFAULT_DOC_SUBUNIT_ID,commentId="",comment={unitId,subUnitId,id:commentId,ref:text,dT:threadCommentUi.getDT(),personId:userManagerService.getCurrentUser().userID,text:{dataStream:`\r
2
- `},startOffset:textRange.startOffset,endOffset:textRange.endOffset,collapsed:!0,threadId:commentId};return docSelectionRenderManager==null||docSelectionRenderManager.blurEditor(),docCommentService.startAdd(comment),panelService.setActiveComment({unitId,subUnitId,commentId}),!0}},shouldDisableAddComment=__name(accessor=>{const renderManagerService=accessor.get(engineRender.IRenderManagerService),docSelectionManagerService=accessor.get(docs.DocSelectionManagerService),render2=renderManagerService.getCurrent(),skeleton=render2==null?void 0:render2.with(docs.DocSkeletonManagerService).getSkeleton(),editArea=skeleton==null?void 0:skeleton.getViewModel().getEditArea();if(editArea===engineRender.DocumentEditArea.FOOTER||editArea===engineRender.DocumentEditArea.HEADER)return!0;const range=docSelectionManagerService.getActiveTextRange();return!!(range==null||range.collapsed)},"shouldDisableAddComment");function AddDocCommentMenuItemFactory(accessor){return{id:StartAddCommentOperation.id,type:ui.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC),disabled$:new rxjs.Observable(function(subscribe){const observer=accessor.get(docs.DocSelectionManagerService).textSelection$.pipe(rxjs.debounceTime(16)).subscribe(()=>{subscribe.next(shouldDisableAddComment(accessor))});return()=>{observer.unsubscribe()}})}}__name(AddDocCommentMenuItemFactory,"AddDocCommentMenuItemFactory");function ToolbarDocCommentMenuItemFactory(accessor){return{id:ToggleCommentPanelOperation.id,type:ui.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC)}}__name(ToolbarDocCommentMenuItemFactory,"ToolbarDocCommentMenuItemFactory");const DocThreadCommentPanel=__name(()=>{const univerInstanceService=core.useDependency(core.IUniverInstanceService),injector=core.useDependency(core.Injector),doc$=React.useMemo(()=>univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC),[univerInstanceService]),doc=core.useObservable(doc$),subUnitId$=React.useMemo(()=>new rxjs.Observable(sub=>sub.next(DEFAULT_DOC_SUBUNIT_ID)),[]),docSelectionManagerService=core.useDependency(docs.DocSelectionManagerService),selectionChange$=React.useMemo(()=>docSelectionManagerService.textSelection$.pipe(rxjs.debounceTime(16)),[docSelectionManagerService.textSelection$]);core.useObservable(selectionChange$);const commandService=core.useDependency(core.ICommandService),docCommentService=core.useDependency(DocThreadCommentService),tempComment=core.useObservable(docCommentService.addingComment$),[commentIds,setCommentIds]=React.useState([]);if(React.useEffect(()=>{var _a6;const set=new Set,customRanges=doc==null?void 0:doc.getCustomDecorations();setCommentIds((_a6=customRanges==null?void 0:customRanges.map(r=>r.id).filter(i=>{const hasRepeat=set.has(i);return set.add(i),!hasRepeat}))!=null?_a6:[]);const dispose=commandService.onCommandExecuted(command=>{var _a7;if(command.id===docs.RichTextEditingMutation.id){const set2=new Set,customRanges2=doc==null?void 0:doc.getCustomDecorations();setCommentIds((_a7=customRanges2==null?void 0:customRanges2.map(r=>r.id).filter(i=>{const hasRepeat=set2.has(i);return set2.add(i),!hasRepeat}))!=null?_a7:[])}});return()=>{dispose.dispose()}},[commandService,doc]),!doc)return null;const isInValidSelection=shouldDisableAddComment(injector),unitId=doc.getUnitId();return React.createElement(threadCommentUi.ThreadCommentPanel,{unitId,subUnitId$,type:core.UniverInstanceType.UNIVER_DOC,onAdd:__name(()=>{commandService.executeCommand(StartAddCommentOperation.id)},"onAdd"),getSubUnitName:__name(()=>"","getSubUnitName"),disableAdd:isInValidSelection,tempComment,onAddComment:__name(comment=>{if(!comment.parentId){const params={unitId,range:tempComment,comment};return commandService.executeCommand(AddDocCommentComment.id,params),docCommentService.endAdd(),!1}return!0},"onAddComment"),onDeleteComment:__name(comment=>{if(!comment.parentId){const params={unitId,commentId:comment.id};return commandService.executeCommand(DeleteDocCommentComment.id,params),!1}return!0},"onDeleteComment"),showComments:commentIds})},"DocThreadCommentPanel");DocThreadCommentPanel.componentKey="univer.doc.thread-comment-panel";const menuSchema={[ui.RibbonStartGroup.OTHERS]:{[ToggleCommentPanelOperation.id]:{order:1,menuItemFactory:ToolbarDocCommentMenuItemFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.DATA]:{[StartAddCommentOperation.id]:{order:1,menuItemFactory:AddDocCommentMenuItemFactory}}}};var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3"),_a2;let DocThreadCommentUIController=(_a2=class extends core.Disposable{constructor(_commandService,_menuManagerService,_componentManager){super(),this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._componentManager=_componentManager,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[AddDocCommentComment,DeleteDocCommentComment,ShowCommentPanelOperation,StartAddCommentOperation,ToggleCommentPanelOperation].forEach(command=>{this.disposeWithMe(this._commandService.registerCommand(command))})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initComponents(){[DocThreadCommentPanel].forEach(comp=>{this.disposeWithMe(this._componentManager.register(comp.componentKey,comp))}),this.disposeWithMe(this._componentManager.register("CommentSingle",CommentSingle))}},__name(_a2,"DocThreadCommentUIController"),_a2);DocThreadCommentUIController=__decorateClass$3([core.OnLifecycle(core.LifecycleStages.Rendered,DocThreadCommentUIController),__decorateParam$3(0,core.ICommandService),__decorateParam$3(1,ui.IMenuManagerService),__decorateParam$3(2,core.Inject(ui.ComponentManager))],DocThreadCommentUIController);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a3;let DocThreadCommentSelectionController=(_a3=class extends core.Disposable{constructor(_threadCommentPanelService,_univerInstanceService,_commandService,_docThreadCommentService,_renderManagerService,_threadCommentModel){super(),this._threadCommentPanelService=_threadCommentPanelService,this._univerInstanceService=_univerInstanceService,this._commandService=_commandService,this._docThreadCommentService=_docThreadCommentService,this._renderManagerService=_renderManagerService,this._threadCommentModel=_threadCommentModel,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let lastSelection;this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{var _a6,_b,_c,_d;if(commandInfo.id===docs.SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges}=params,doc=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),primary=ranges[0];if((lastSelection==null?void 0:lastSelection.startOffset)===(primary==null?void 0:primary.startOffset)&&(lastSelection==null?void 0:lastSelection.endOffset)===(primary==null?void 0:primary.endOffset))return;if(lastSelection=primary,primary&&doc){const{startOffset,endOffset,collapsed}=primary;let customRange;if(collapsed?customRange=(_b=(_a6=doc.getBody())==null?void 0:_a6.customDecorations)==null?void 0:_b.find(value=>value.startIndex<=startOffset&&value.endIndex>=endOffset-1):customRange=(_d=(_c=doc.getBody())==null?void 0:_c.customDecorations)==null?void 0:_d.find(value=>value.startIndex<=startOffset&&value.endIndex>=endOffset-1),customRange){const comment=this._threadCommentModel.getComment(unitId,DEFAULT_DOC_SUBUNIT_ID,customRange.id);comment&&!comment.resolved&&this._commandService.executeCommand(ShowCommentPanelOperation.id,{activeComment:{unitId,subUnitId:DEFAULT_DOC_SUBUNIT_ID,commentId:customRange.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(threadCommentUi.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(activeComment=>{var _a6,_b,_c,_d;if(activeComment){const doc=this._univerInstanceService.getUnit(activeComment.unitId);if(doc){const backScrollController=(_a6=this._renderManagerService.getRenderById(activeComment.unitId))==null?void 0:_a6.with(docsUi.DocBackScrollRenderController),customRange=(_c=(_b=doc.getBody())==null?void 0:_b.customDecorations)==null?void 0:_c.find(range=>range.id===activeComment.commentId);customRange&&backScrollController&&backScrollController.scrollToRange({startOffset:customRange.startIndex,endOffset:customRange.endIndex,collapsed:!1})}}(!activeComment||activeComment.commentId!==((_d=this._docThreadCommentService.addingComment)==null?void 0:_d.id))&&this._docThreadCommentService.endAdd()}))}},__name(_a3,"DocThreadCommentSelectionController"),_a3);DocThreadCommentSelectionController=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Rendered,DocThreadCommentSelectionController),__decorateParam$2(0,core.Inject(threadCommentUi.ThreadCommentPanelService)),__decorateParam$2(1,core.IUniverInstanceService),__decorateParam$2(2,core.ICommandService),__decorateParam$2(3,core.Inject(DocThreadCommentService)),__decorateParam$2(4,engineRender.IRenderManagerService),__decorateParam$2(5,core.Inject(threadComment.ThreadCommentModel))],DocThreadCommentSelectionController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a4;let DocThreadCommentRenderController=(_a4=class extends core.Disposable{constructor(_context,_docInterceptorService,_threadCommentPanelService,_docRenderController,_univerInstanceService,_threadCommentModel){super(),this._context=_context,this._docInterceptorService=_docInterceptorService,this._threadCommentPanelService=_threadCommentPanelService,this._docRenderController=_docRenderController,this._univerInstanceService=_univerInstanceService,this._threadCommentModel=_threadCommentModel,this._interceptorViewModel(),this._initReRender()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(activeComment=>{var _a6;if(activeComment){this._docRenderController.reRender(activeComment.unitId);return}const unitId=(_a6=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC))==null?void 0:_a6.getUnitId();unitId&&this._docRenderController.reRender(unitId)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(update=>{update.type==="resolve"&&this._docRenderController.reRender(update.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(docs.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:__name((data,pos,next)=>{if(!data)return next(data);const{unitId,index,customDecorations}=pos,activeComment=this._threadCommentPanelService.activeCommentId,{commentId,unitId:commentUnitID}=activeComment||{},activeCustomDecoration=customDecorations.find(i=>i.id===commentId),comment=this._threadCommentModel.getComment(unitId,DEFAULT_DOC_SUBUNIT_ID,data.id);if(!comment)return next({...data,show:!1});const isActiveIndex=activeCustomDecoration&&index>=activeCustomDecoration.startIndex&&index<=activeCustomDecoration.endIndex,isActive=commentUnitID===unitId&&data.id===commentId;return next({...data,active:isActive||isActiveIndex,show:!comment.resolved})},"handler")})}},__name(_a4,"DocThreadCommentRenderController"),_a4);DocThreadCommentRenderController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,DocThreadCommentRenderController),__decorateParam$1(1,core.Inject(docs.DocInterceptorService)),__decorateParam$1(2,core.Inject(threadCommentUi.ThreadCommentPanelService)),__decorateParam$1(3,core.Inject(docsUi.DocRenderController)),__decorateParam$1(4,core.IUniverInstanceService),__decorateParam$1(5,core.Inject(threadComment.ThreadCommentModel))],DocThreadCommentRenderController);const PLUGIN_CONFIG_KEY="docs-thread-comment-ui.config",defaultPluginConfig={};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField"),_a5;exports.UniverDocsThreadCommentUIPlugin=(_a5=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_renderManagerSrv,_configService){super(),this._config=_config,this._injector=_injector,this._renderManagerSrv=_renderManagerSrv,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[DocThreadCommentUIController],[DocThreadCommentSelectionController],[DocThreadCommentService]].forEach(dep=>{this._injector.add(dep)})}onRendered(){this._initRenderModule()}_initRenderModule(){[DocThreadCommentRenderController].forEach(dep=>{this._renderManagerSrv.registerRenderModule(core.UniverInstanceType.UNIVER_DOC,dep)})}},__name(_a5,"UniverDocsThreadCommentUIPlugin"),_a5);__publicField2(exports.UniverDocsThreadCommentUIPlugin,"pluginName",PLUGIN_NAME);__publicField2(exports.UniverDocsThreadCommentUIPlugin,"type",core.UniverInstanceType.UNIVER_DOC);exports.UniverDocsThreadCommentUIPlugin=__decorateClass([core.DependentOn(threadCommentUi.UniverThreadCommentUIPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,engineRender.IRenderManagerService),__decorateParam(3,core.IConfigService)],exports.UniverDocsThreadCommentUIPlugin);exports.AddDocCommentComment=AddDocCommentComment;exports.DeleteDocCommentComment=DeleteDocCommentComment;exports.ShowCommentPanelOperation=ShowCommentPanelOperation;exports.StartAddCommentOperation=StartAddCommentOperation;
1
+ 'use strict';const _0x41f395=_0x4757;(function(_0x2151f3,_0x1a3f82){const _0x503b64=_0x4757,_0x1c3397=_0x2151f3();while(!![]){try{const _0x1fdf2a=-parseInt(_0x503b64(0x1f7))/0x1+parseInt(_0x503b64(0x23c))/0x2+-parseInt(_0x503b64(0x21b))/0x3*(-parseInt(_0x503b64(0x200))/0x4)+-parseInt(_0x503b64(0x296))/0x5*(-parseInt(_0x503b64(0x215))/0x6)+-parseInt(_0x503b64(0x27f))/0x7+parseInt(_0x503b64(0x27d))/0x8*(parseInt(_0x503b64(0x254))/0x9)+-parseInt(_0x503b64(0x27b))/0xa;if(_0x1fdf2a===_0x1a3f82)break;else _0x1c3397['push'](_0x1c3397['shift']());}catch(_0x8e685b){_0x1c3397['push'](_0x1c3397['shift']());}}}(_0x1738,0x66729));var __defProp=Object['defineProperty'],__defNormalProp=(_0x4b9457,_0xd10a2d,_0x1b3de0)=>_0xd10a2d in _0x4b9457?__defProp(_0x4b9457,_0xd10a2d,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x1b3de0}):_0x4b9457[_0xd10a2d]=_0x1b3de0,__name=(_0x4ab1f3,_0x606dfa)=>__defProp(_0x4ab1f3,_0x41f395(0x274),{'value':_0x606dfa,'configurable':!0x0}),__publicField=(_0x1628ed,_0x29d813,_0x1bf672)=>__defNormalProp(_0x1628ed,typeof _0x29d813!=_0x41f395(0x1b4)?_0x29d813+'':_0x29d813,_0x1bf672);Object['defineProperty'](exports,Symbol[_0x41f395(0x287)],{'value':_0x41f395(0x20f)});const core=require('@univerjs/core'),engineRender=require(_0x41f395(0x271)),threadCommentUi=require(_0x41f395(0x1da)),docs=require(_0x41f395(0x1d7)),docsUi=require(_0x41f395(0x26d)),threadComment=require(_0x41f395(0x26f)),ui=require(_0x41f395(0x1ef)),rxjs=require(_0x41f395(0x1f5)),React=require('react'),PLUGIN_NAME=_0x41f395(0x20c),DEFAULT_DOC_SUBUNIT_ID=_0x41f395(0x1fd),PLUGIN_CONFIG_KEY='docs-thread-comment-ui.config',defaultPluginConfig={};var __defProp$4=Object[_0x41f395(0x1b0)],__getOwnPropDesc$4=Object[_0x41f395(0x28a)],__decorateClass$4=__name((_0x27851b,_0x26b731,_0x134f9b,_0x432bb1)=>{const _0x526796=_0x41f395;for(var _0x5badf5=_0x432bb1>0x1?void 0x0:_0x432bb1?__getOwnPropDesc$4(_0x26b731,_0x134f9b):_0x26b731,_0x52508b=_0x27851b[_0x526796(0x1c0)]-0x1,_0x646c9f;_0x52508b>=0x0;_0x52508b--)(_0x646c9f=_0x27851b[_0x52508b])&&(_0x5badf5=(_0x432bb1?_0x646c9f(_0x26b731,_0x134f9b,_0x5badf5):_0x646c9f(_0x5badf5))||_0x5badf5);return _0x432bb1&&_0x5badf5&&__defProp$4(_0x26b731,_0x134f9b,_0x5badf5),_0x5badf5;},'__decorateClass$4'),__decorateParam$4=__name((_0x493d5b,_0xa5152d)=>(_0x541e9a,_0x8f66c0)=>_0xa5152d(_0x541e9a,_0x8f66c0,_0x493d5b),'__decorateParam$4'),_a;let DocThreadCommentService=(_a=class extends core[_0x41f395(0x1e6)]{constructor(_0x235541,_0x2aaf75){const _0x572722=_0x41f395;super(),__publicField(this,_0x572722(0x238),new rxjs['BehaviorSubject'](void 0x0)),__publicField(this,'addingComment$',this[_0x572722(0x238)]['asObservable']()),(this[_0x572722(0x24c)]=_0x235541,this[_0x572722(0x283)]=_0x2aaf75,this['disposeWithMe'](()=>{const _0x5cbd74=_0x572722;this[_0x5cbd74(0x238)][_0x5cbd74(0x234)]();}));}get[_0x41f395(0x1d2)](){const _0x2e36ea=_0x41f395;return this[_0x2e36ea(0x238)][_0x2e36ea(0x255)]();}[_0x41f395(0x265)](_0x403051){const _0x11f9a2=_0x41f395;this[_0x11f9a2(0x238)]['next'](_0x403051);}[_0x41f395(0x29a)](){const _0x218e53=_0x41f395;this[_0x218e53(0x238)][_0x218e53(0x29c)](void 0x0);}},__name(_a,_0x41f395(0x206)),_a);DocThreadCommentService=__decorateClass$4([__decorateParam$4(0x0,ui['ISidebarService']),__decorateParam$4(0x1,core[_0x41f395(0x22a)](threadCommentUi[_0x41f395(0x220)]))],DocThreadCommentService);const AddDocCommentComment={'id':'docs.command.add-comment','type':core[_0x41f395(0x1ee)][_0x41f395(0x21e)],async 'handler'(_0xf42cf6,_0x165854){const _0x350d48=_0x41f395;if(!_0x165854)return!0x1;const {comment:_0x3f8fa3,unitId:_0x910368}=_0x165854,_0x1c85f2=await _0xf42cf6[_0x350d48(0x29d)](threadComment[_0x350d48(0x26b)])[_0x350d48(0x1fa)](_0x3f8fa3),_0x409acc=_0xf42cf6['get'](core[_0x350d48(0x1dd)]),_0x2ce336=docsUi['addCustomDecorationBySelectionFactory'](_0xf42cf6,{'id':_0x1c85f2['id'],'type':core[_0x350d48(0x294)][_0x350d48(0x25e)]});if(_0x2ce336){const _0x117ea4={'id':threadComment[_0x350d48(0x239)]['id'],'params':{'unitId':_0x910368,'subUnitId':DEFAULT_DOC_SUBUNIT_ID,'comment':_0x1c85f2}},_0x336883={'id':threadCommentUi['SetActiveCommentOperation']['id'],'params':{'unitId':_0x910368,'subUnitId':DEFAULT_DOC_SUBUNIT_ID,'commentId':_0x1c85f2['id']}};return(await core[_0x350d48(0x1d9)]([_0x117ea4,_0x2ce336,_0x336883],_0x409acc))['result'];}return!0x1;}},DeleteDocCommentComment={'id':_0x41f395(0x1ff),'type':core[_0x41f395(0x1ee)][_0x41f395(0x21e)],async 'handler'(_0x5da4e7,_0x1a224e){const _0xa14e26=_0x41f395;if(!_0x1a224e)return!0x1;const {commentId:_0xe16df4,unitId:_0x50f41e}=_0x1a224e,_0xdb4b33=_0x5da4e7[_0xa14e26(0x29d)](core[_0xa14e26(0x1dd)]),_0x5ad6e3=docsUi[_0xa14e26(0x1ec)](_0x5da4e7,{'id':_0xe16df4,'unitId':_0x50f41e});return _0x5ad6e3?(await core[_0xa14e26(0x272)]([_0x5ad6e3],_0xdb4b33))['result']:!0x1;}},shouldDisableAddComment=__name(_0x6a79af=>{const _0x1846b7=_0x41f395,_0x542bf8=_0x6a79af['get'](engineRender['IRenderManagerService']),_0x187ec7=_0x6a79af[_0x1846b7(0x29d)](docs['DocSelectionManagerService']),_0x5f2a9d=_0x542bf8[_0x1846b7(0x1c5)](),_0x433573=_0x5f2a9d==null?void 0x0:_0x5f2a9d[_0x1846b7(0x22f)](docs['DocSkeletonManagerService'])[_0x1846b7(0x27e)](),_0x326b6b=_0x433573==null?void 0x0:_0x433573[_0x1846b7(0x225)]()[_0x1846b7(0x264)]();if(_0x326b6b===engineRender[_0x1846b7(0x1f8)][_0x1846b7(0x247)]||_0x326b6b===engineRender['DocumentEditArea'][_0x1846b7(0x1eb)])return!0x0;const _0x5e45fc=_0x187ec7[_0x1846b7(0x257)]();return!!(_0x5e45fc==null||_0x5e45fc[_0x1846b7(0x237)]);},_0x41f395(0x230));function AddDocCommentMenuItemFactory(_0x2bc6b1){const _0x45a42a=_0x41f395;return{'id':StartAddCommentOperation['id'],'type':ui[_0x45a42a(0x20a)][_0x45a42a(0x207)],'icon':'CommentSingle','title':_0x45a42a(0x245),'tooltip':_0x45a42a(0x245),'hidden$':ui[_0x45a42a(0x231)](_0x2bc6b1,core['UniverInstanceType']['UNIVER_DOC']),'disabled$':new rxjs[(_0x45a42a(0x1c3))](function(_0x1e1a87){const _0x39236a=_0x45a42a,_0x24b628=_0x2bc6b1['get'](docs['DocSelectionManagerService'])[_0x39236a(0x285)][_0x39236a(0x295)](rxjs['debounceTime'](0x10))[_0x39236a(0x1b6)](()=>{const _0x185504=_0x39236a;_0x1e1a87[_0x185504(0x29c)](shouldDisableAddComment(_0x2bc6b1));});return()=>{const _0x4c7163=_0x39236a;_0x24b628[_0x4c7163(0x1cb)]();};})};}function _0x1738(){const _0x967f56=['3484970genqcQ','CUSTOM_DECORATION','8hfyVXN','getSkeleton','4067112vgwQqr','UniverIcon','getSubUnitName','DocSelectionManagerService','_threadCommentPanelService','add','textSelection$','getDT','toStringTag','getUnitId','useObservable','getOwnPropertyDescriptor','activeCommentId','commentId','setActiveComment','ThreadCommentModel','_configService','IRenderManagerService','xlink:href','string','replaceRuntimeIdsInDefs','CustomDecorationType','pipe','35UZeAnl','CommentSingle','label','path','endAdd','blurEditor','next','get','DocThreadCommentPanel','activeCommentId$','tag','M5.83725\x206.78345C6.22188\x206.78345\x206.53368\x207.10742\x206.53368\x207.50706V8.41159C6.53368\x208.81123\x206.22188\x209.13521\x205.83725\x209.13521\x205.45263\x209.13521\x205.14082\x208.81123\x205.14082\x208.41159V7.50706C5.14082\x207.10742\x205.45263\x206.78345\x205.83725\x206.78345zM8.73904\x206.78345C9.12366\x206.78345\x209.43546\x207.10742\x209.43546\x207.50706V8.41159C9.43546\x208.81123\x209.12366\x209.13521\x208.73904\x209.13521\x208.35441\x209.13521\x208.04261\x208.81123\x208.04261\x208.41159V7.50706C8.04261\x207.10742\x208.35441\x206.78345\x208.73904\x206.78345zM11.6408\x206.78345C12.0254\x206.78345\x2012.3372\x207.10742\x2012.3372\x207.50706V8.41159C12.3372\x208.81123\x2012.0254\x209.13521\x2011.6408\x209.13521\x2011.2562\x209.13521\x2010.9444\x208.81123\x2010.9444\x208.41159V7.50706C10.9444\x207.10742\x2011.2562\x206.78345\x2011.6408\x206.78345z','resolved','defineProperty','IMenuManagerService','RibbonStartGroup','_initActiveCommandChange','symbol','DOC_INTERCEPTOR_POINT','subscribe','__publicField','getOwnPropertySymbols','scrollToRange','_docInterceptorService','startOffset','_initMenus','OPERATION','commentUpdate$','_renderManagerSrv','length','Plugin','trim','Observable','slice','getCurrent','evenodd','DeleteDocCommentComment','fill','prototype','handler','unsubscribe','IUniverInstanceService','_commandService','_docThreadCommentService','getCurrentUnitForType','UNIVER_DOC','disposeWithMe','addingComment','register','getCustomDecorations','__defNormalProp','idSuffix','@univerjs/docs','ShowCommentPanelOperation','sequenceExecuteAsync','@univerjs/thread-comment-ui','comment-single','open','ICommandService','endOffset','getCurrentTypeOfUnit$','reRender','onDeleteComment','ContextMenuGroup','parentId','menu','componentKey','Disposable','useMemo','customDecorations','_menuManagerService','onStarting','HEADER','deleteCustomDecorationFactory','find','CommandType','@univerjs/ui','OTHERS','1em','__decorateParam$1','M1.84351\x203.41861C1.84351\x203.01861\x202.15531\x202.69434\x202.53993\x202.69434H14.9381C15.3228\x202.69434\x2015.6346\x203.01861\x2015.6346\x203.41861V12.4611C15.6346\x2012.8612\x2015.3228\x2013.1854\x2014.9381\x2013.1854H8.82117L6.06643\x2014.6179C5.85054\x2014.7301\x205.59416\x2014.7181\x205.38884\x2014.5862C5.18352\x2014.4542\x205.05855\x2014.2211\x205.05855\x2013.9701V13.1854H2.53993C2.15531\x2013.1854\x201.84351\x2012.8612\x201.84351\x2012.4611L1.84351\x203.41861ZM6.45141\x2012.7982L8.34531\x2012.0135C8.44201\x2011.9632\x208.54864\x2011.9371\x208.65676\x2011.9371H14.2417C14.3522\x2011.9371\x2014.4417\x2011.8475\x2014.4417\x2011.7371V4.14271C14.4417\x204.03225\x2014.3522\x203.94271\x2014.2417\x203.94271H3.23636C3.12591\x203.94271\x203.03636\x204.03225\x203.03636\x204.14271L3.03636\x2011.7371C3.03636\x2011.8475\x203.12591\x2011.9371\x203.23636\x2011.9371L5.75498\x2011.9371C6.1396\x2011.9371\x206.45141\x2012.0611\x206.45141\x2012.4611V12.7982Z','UniverDocsThreadCommentUIPlugin','rxjs','panelVisible','342616LFExuP','DocumentEditArea','call','addComment','useState','unitId','default_doc','attrs','docs.command.delete-comment','387052jlLSkT','render','useDependency','IConfigService','docs.operation.toggle-comment-panel','startIndex','DocThreadCommentService','BUTTON','indexOf','univer.doc.thread-comment-panel','MenuItemType','forEach','DOC_THREAD_COMMENT_UI_PLUGIN','className','_initReRender','Module','ContextMenuPosition','_univerInstanceService','propertyIsEnumerable','children','intercept','68898QKIInW','_threadCommentModel','forwardRef','docs.operation.show-comment-panel','endIndex','executeCommand','12oeTnfq','_docRenderController','svg','COMMAND','activeComment','ThreadCommentPanelService','current','currentColor','close','__decorateClass$1','getViewModel','ToolbarDocCommentMenuItemFactory','UniverInstanceType','_initCommands','useEffect','Inject','registerRenderModule','defIds','colorChannel1','_initComponents','with','shouldDisableAddComment','getMenuHiddenObservable','map','options','complete','none','setPanelVisible','collapsed','_addingComment$','AddCommentMutation','_renderManagerService','ISidebarService','842588zFkmkP','SetTextSelectionsOperation','Injector','transform','filter','0\x200\x2017\x2017','random','DocThreadCommentUIController','concat','threadCommentUI.panel.addComment','univerjs-icon\x20univerjs-icon-','FOOTER','DATA','getBody','substring','defs','_sidebarService','_initRenderModule','_initSelectionChange','onClose','displayName','__decorateParam$3','_interceptorViewModel','debounceTime','7227243nyQgHQ','getValue','StartAddCommentOperation','getActiveTextRange','_config','apply','ComponentManager','entries','_context','getRenderById','COMMENT','getCurrentUser','createElement','assign','setConfig','UserManagerService','getEditArea','startAdd','extend','has','_injector','icon','_componentManager','IThreadCommentDataSourceService','__decorateClass$3','@univerjs/docs-ui','onCommandExecuted','@univerjs/thread-comment','addingComment$','@univerjs/engine-render','sequenceExecute','getUnit','name','__decorateParam','DocSelectionRenderService','getPlainText','hasOwnProperty','getComment','BuildTextUtils'];_0x1738=function(){return _0x967f56;};return _0x1738();}__name(AddDocCommentMenuItemFactory,'AddDocCommentMenuItemFactory');function ToolbarDocCommentMenuItemFactory(_0x11e19b){const _0x5dd8da=_0x41f395;return{'id':ToggleCommentPanelOperation['id'],'type':ui[_0x5dd8da(0x20a)][_0x5dd8da(0x207)],'icon':'CommentSingle','title':_0x5dd8da(0x245),'tooltip':_0x5dd8da(0x245),'hidden$':ui[_0x5dd8da(0x231)](_0x11e19b,core[_0x5dd8da(0x227)][_0x5dd8da(0x1d0)])};}__name(ToolbarDocCommentMenuItemFactory,_0x41f395(0x226));const DocThreadCommentPanel=__name(()=>{const _0x4c8dda=_0x41f395,_0x3c7d9f=core[_0x4c8dda(0x202)](core[_0x4c8dda(0x1cc)]),_0x20a7a0=core[_0x4c8dda(0x202)](core[_0x4c8dda(0x23e)]),_0x524f59=React[_0x4c8dda(0x1e7)](()=>_0x3c7d9f[_0x4c8dda(0x1df)](core[_0x4c8dda(0x227)][_0x4c8dda(0x1d0)]),[_0x3c7d9f]),_0x42dce1=core[_0x4c8dda(0x289)](_0x524f59),_0x1a1cb1=React['useMemo'](()=>new rxjs[(_0x4c8dda(0x1c3))](_0x22111c=>_0x22111c['next'](DEFAULT_DOC_SUBUNIT_ID)),[]),_0x3d0773=core[_0x4c8dda(0x202)](docs[_0x4c8dda(0x282)]),_0x3ad77f=React[_0x4c8dda(0x1e7)](()=>_0x3d0773['textSelection$'][_0x4c8dda(0x295)](rxjs[_0x4c8dda(0x253)](0x10)),[_0x3d0773[_0x4c8dda(0x285)]]);core['useObservable'](_0x3ad77f);const _0x19d205=core['useDependency'](core[_0x4c8dda(0x1dd)]),_0x43cb7d=core[_0x4c8dda(0x202)](DocThreadCommentService),_0x348a6f=core['useObservable'](_0x43cb7d[_0x4c8dda(0x270)]),[_0x4e3814,_0x14fc1d]=React[_0x4c8dda(0x1fb)]([]);if(React[_0x4c8dda(0x229)](()=>{const _0x2f48a0=_0x4c8dda;var _0x13d593;const _0x35e92f=new Set(),_0x1f9752=_0x42dce1==null?void 0x0:_0x42dce1['getCustomDecorations']();_0x14fc1d((_0x13d593=_0x1f9752==null?void 0x0:_0x1f9752['map'](_0x13dc26=>_0x13dc26['id'])[_0x2f48a0(0x240)](_0x259ba7=>{const _0x2c8c6f=_0x2f48a0,_0x5d6f28=_0x35e92f[_0x2c8c6f(0x267)](_0x259ba7);return _0x35e92f[_0x2c8c6f(0x284)](_0x259ba7),!_0x5d6f28;}))!=null?_0x13d593:[]);const _0x1d57de=_0x19d205[_0x2f48a0(0x26e)](_0x9b2d1d=>{const _0x237ca5=_0x2f48a0;var _0x483158;if(_0x9b2d1d['id']===docs['RichTextEditingMutation']['id']){const _0x41a3e4=new Set(),_0x5a84c4=_0x42dce1==null?void 0x0:_0x42dce1[_0x237ca5(0x1d4)]();_0x14fc1d((_0x483158=_0x5a84c4==null?void 0x0:_0x5a84c4[_0x237ca5(0x232)](_0x458444=>_0x458444['id'])[_0x237ca5(0x240)](_0x1ef291=>{const _0x521f30=_0x237ca5,_0x282738=_0x41a3e4[_0x521f30(0x267)](_0x1ef291);return _0x41a3e4[_0x521f30(0x284)](_0x1ef291),!_0x282738;}))!=null?_0x483158:[]);}});return()=>{_0x1d57de['dispose']();};},[_0x19d205,_0x42dce1]),!_0x42dce1)return null;const _0x46f329=shouldDisableAddComment(_0x20a7a0),_0xb7b628=_0x42dce1['getUnitId']();return React[_0x4c8dda(0x260)](threadCommentUi['ThreadCommentPanel'],{'unitId':_0xb7b628,'subUnitId$':_0x1a1cb1,'type':core['UniverInstanceType']['UNIVER_DOC'],'onAdd':__name(()=>{const _0x40617e=_0x4c8dda;_0x19d205[_0x40617e(0x21a)](StartAddCommentOperation['id']);},'onAdd'),'getSubUnitName':__name(()=>'',_0x4c8dda(0x281)),'disableAdd':_0x46f329,'tempComment':_0x348a6f,'onAddComment':__name(_0x2f45e2=>{const _0x36bcb7=_0x4c8dda;if(!_0x2f45e2[_0x36bcb7(0x1e3)]){const _0x74b067={'unitId':_0xb7b628,'range':_0x348a6f,'comment':_0x2f45e2};return _0x19d205['executeCommand'](AddDocCommentComment['id'],_0x74b067),_0x43cb7d[_0x36bcb7(0x29a)](),!0x1;}return!0x0;},'onAddComment'),'onDeleteComment':__name(_0x107293=>{const _0x2b0c37=_0x4c8dda;if(!_0x107293[_0x2b0c37(0x1e3)]){const _0x8f79c1={'unitId':_0xb7b628,'commentId':_0x107293['id']};return _0x19d205[_0x2b0c37(0x21a)](DeleteDocCommentComment['id'],_0x8f79c1),!0x1;}return!0x0;},_0x4c8dda(0x1e1)),'showComments':_0x4e3814});},_0x41f395(0x29e));DocThreadCommentPanel[_0x41f395(0x1e5)]=_0x41f395(0x209);const ShowCommentPanelOperation={'id':_0x41f395(0x218),'type':core[_0x41f395(0x1ee)][_0x41f395(0x1bd)],'handler'(_0x1b1571,_0x1a8d6e){const _0x342722=_0x41f395;var _0x45b86c;const _0x347e10=_0x1b1571[_0x342722(0x29d)](threadCommentUi['ThreadCommentPanelService']),_0x1f099b=_0x1b1571[_0x342722(0x29d)](ui[_0x342722(0x23b)]);return(!_0x347e10[_0x342722(0x1f6)]||((_0x45b86c=_0x1f099b[_0x342722(0x233)][_0x342722(0x213)])==null?void 0x0:_0x45b86c[_0x342722(0x298)])!==DocThreadCommentPanel['componentKey'])&&(_0x1f099b[_0x342722(0x1dc)]({'header':{'title':'threadCommentUI.panel.title'},'children':{'label':DocThreadCommentPanel['componentKey']},'width':0x140,'onClose':__name(()=>_0x347e10[_0x342722(0x236)](!0x1),_0x342722(0x24f))}),_0x347e10[_0x342722(0x236)](!0x0)),_0x1a8d6e&&_0x347e10[_0x342722(0x28d)](_0x1a8d6e==null?void 0x0:_0x1a8d6e[_0x342722(0x21f)]),!0x0;}},ToggleCommentPanelOperation={'id':_0x41f395(0x204),'type':core[_0x41f395(0x1ee)][_0x41f395(0x1bd)],'handler'(_0x1f872c){const _0x1ef3ee=_0x41f395;var _0xafee75;const _0x1b07bc=_0x1f872c[_0x1ef3ee(0x29d)](threadCommentUi[_0x1ef3ee(0x220)]),_0x4d8a1d=_0x1f872c[_0x1ef3ee(0x29d)](ui['ISidebarService']);return!_0x1b07bc[_0x1ef3ee(0x1f6)]||((_0xafee75=_0x4d8a1d['options']['children'])==null?void 0x0:_0xafee75[_0x1ef3ee(0x298)])!==DocThreadCommentPanel['componentKey']?(_0x4d8a1d[_0x1ef3ee(0x1dc)]({'header':{'title':'threadCommentUI.panel.title'},'children':{'label':DocThreadCommentPanel[_0x1ef3ee(0x1e5)]},'width':0x140,'onClose':__name(()=>_0x1b07bc['setPanelVisible'](!0x1),_0x1ef3ee(0x24f))}),_0x1b07bc[_0x1ef3ee(0x236)](!0x0)):(_0x4d8a1d[_0x1ef3ee(0x223)](),_0x1b07bc['setPanelVisible'](!0x1),_0x1b07bc[_0x1ef3ee(0x28d)](null)),!0x0;}},StartAddCommentOperation={'id':'docs.operation.start-add-comment','type':core[_0x41f395(0x1ee)][_0x41f395(0x1bd)],'handler'(_0x348ea7){const _0x489a1c=_0x41f395;var _0x56a8ec,_0x1dcea3,_0x4c5c26;const _0x179007=_0x348ea7['get'](threadCommentUi[_0x489a1c(0x220)]),_0x1c5f73=_0x348ea7[_0x489a1c(0x29d)](core['IUniverInstanceService'])[_0x489a1c(0x1cf)](core['UniverInstanceType']['UNIVER_DOC']),_0x3fad7c=_0x348ea7[_0x489a1c(0x29d)](docs[_0x489a1c(0x282)]),_0x488cb0=_0x348ea7[_0x489a1c(0x29d)](engineRender['IRenderManagerService']),_0xca4d5e=_0x348ea7['get'](core[_0x489a1c(0x263)]),_0x353e14=_0x348ea7[_0x489a1c(0x29d)](DocThreadCommentService),_0x5175f2=_0x348ea7['get'](core[_0x489a1c(0x1dd)]),_0x46ffaf=_0x348ea7[_0x489a1c(0x29d)](ui[_0x489a1c(0x23b)]),_0x26d25b=_0x3fad7c['getActiveTextRange']();if(!_0x1c5f73||!_0x26d25b)return!0x1;const _0x54966b=(_0x56a8ec=_0x488cb0[_0x489a1c(0x25d)](_0x1c5f73['getUnitId']()))==null?void 0x0:_0x56a8ec[_0x489a1c(0x22f)](docsUi[_0x489a1c(0x276)]);if(_0x26d25b[_0x489a1c(0x237)])return _0x179007[_0x489a1c(0x1f6)]?(_0x179007[_0x489a1c(0x236)](!0x1),_0x46ffaf[_0x489a1c(0x223)]()):_0x5175f2[_0x489a1c(0x21a)](ShowCommentPanelOperation['id']),!0x0;_0x5175f2[_0x489a1c(0x21a)](ShowCommentPanelOperation['id']);const _0x3f010e=_0x1c5f73[_0x489a1c(0x288)](),_0x3290b2=((_0x4c5c26=(_0x1dcea3=_0x1c5f73['getBody']())==null?void 0x0:_0x1dcea3['dataStream'])!=null?_0x4c5c26:'')[_0x489a1c(0x1c4)](_0x26d25b[_0x489a1c(0x1bb)],_0x26d25b['endOffset']),_0x36a20d=core[_0x489a1c(0x27a)][_0x489a1c(0x23f)][_0x489a1c(0x277)](_0x3290b2),_0x1a582c=DEFAULT_DOC_SUBUNIT_ID,_0x2c1b3a='',_0x536bf0={'unitId':_0x3f010e,'subUnitId':_0x1a582c,'id':_0x2c1b3a,'ref':_0x36a20d,'dT':threadCommentUi[_0x489a1c(0x286)](),'personId':_0xca4d5e[_0x489a1c(0x25f)]()['userID'],'text':{'dataStream':'\x0d\x0a'},'startOffset':_0x26d25b[_0x489a1c(0x1bb)],'endOffset':_0x26d25b[_0x489a1c(0x1de)],'collapsed':!0x0,'threadId':_0x2c1b3a};return _0x54966b==null||_0x54966b[_0x489a1c(0x29b)](),_0x353e14[_0x489a1c(0x265)](_0x536bf0),_0x179007['setActiveComment']({'unitId':_0x3f010e,'subUnitId':_0x1a582c,'commentId':_0x2c1b3a}),!0x0;}};var __defProp$3=Object[_0x41f395(0x1b0)],__getOwnPropDesc$3=Object[_0x41f395(0x28a)],__decorateClass$3=__name((_0x273862,_0xb6d5d8,_0x30adc7,_0x5534c0)=>{const _0xe55b=_0x41f395;for(var _0x36b5de=_0x5534c0>0x1?void 0x0:_0x5534c0?__getOwnPropDesc$3(_0xb6d5d8,_0x30adc7):_0xb6d5d8,_0x55d001=_0x273862[_0xe55b(0x1c0)]-0x1,_0x269b5d;_0x55d001>=0x0;_0x55d001--)(_0x269b5d=_0x273862[_0x55d001])&&(_0x36b5de=(_0x5534c0?_0x269b5d(_0xb6d5d8,_0x30adc7,_0x36b5de):_0x269b5d(_0x36b5de))||_0x36b5de);return _0x5534c0&&_0x36b5de&&__defProp$3(_0xb6d5d8,_0x30adc7,_0x36b5de),_0x36b5de;},_0x41f395(0x26c)),__decorateParam$3=__name((_0x8a1c92,_0x5e0c16)=>(_0x1603e2,_0x26bc9b)=>_0x5e0c16(_0x1603e2,_0x26bc9b,_0x8a1c92),_0x41f395(0x251)),_a2;let DocThreadCommentSelectionController=(_a2=class extends core[_0x41f395(0x1e6)]{constructor(_0x1a04ed,_0x776e61,_0x11dfcf,_0x20ed10,_0x587d25,_0x2edb57){const _0x39d1f1=_0x41f395;super(),this['_threadCommentPanelService']=_0x1a04ed,this[_0x39d1f1(0x211)]=_0x776e61,this[_0x39d1f1(0x1cd)]=_0x11dfcf,this[_0x39d1f1(0x1ce)]=_0x20ed10,this['_renderManagerService']=_0x587d25,this['_threadCommentModel']=_0x2edb57,this[_0x39d1f1(0x24e)](),this['_initActiveCommandChange']();}['_initSelectionChange'](){const _0x1db465=_0x41f395;let _0x567736;this['disposeWithMe'](this[_0x1db465(0x1cd)][_0x1db465(0x26e)](_0x3a8650=>{const _0x1c2920=_0x1db465;var _0x53facb,_0x5118bc,_0x5a6126,_0x1499f9;if(_0x3a8650['id']===docs[_0x1c2920(0x23d)]['id']){const _0x3352db=_0x3a8650['params'],{unitId:_0x3eac99,ranges:_0x5c7a18}=_0x3352db,_0x51a00c=this[_0x1c2920(0x211)][_0x1c2920(0x273)](_0x3eac99,core[_0x1c2920(0x227)][_0x1c2920(0x1d0)]),_0x483feb=_0x5c7a18[0x0];if((_0x567736==null?void 0x0:_0x567736[_0x1c2920(0x1bb)])===(_0x483feb==null?void 0x0:_0x483feb[_0x1c2920(0x1bb)])&&(_0x567736==null?void 0x0:_0x567736[_0x1c2920(0x1de)])===(_0x483feb==null?void 0x0:_0x483feb[_0x1c2920(0x1de)]))return;if(_0x567736=_0x483feb,_0x483feb&&_0x51a00c){const {startOffset:_0x2761c2,endOffset:_0x214815,collapsed:_0x506ca1}=_0x483feb;let _0x10c563;if(_0x506ca1?_0x10c563=(_0x5118bc=(_0x53facb=_0x51a00c[_0x1c2920(0x249)]())==null?void 0x0:_0x53facb[_0x1c2920(0x1e8)])==null?void 0x0:_0x5118bc[_0x1c2920(0x1ed)](_0x11f1bc=>_0x11f1bc[_0x1c2920(0x205)]<=_0x2761c2&&_0x11f1bc[_0x1c2920(0x219)]>=_0x214815-0x1):_0x10c563=(_0x1499f9=(_0x5a6126=_0x51a00c[_0x1c2920(0x249)]())==null?void 0x0:_0x5a6126[_0x1c2920(0x1e8)])==null?void 0x0:_0x1499f9[_0x1c2920(0x1ed)](_0x491deb=>_0x491deb['startIndex']<=_0x2761c2&&_0x491deb[_0x1c2920(0x219)]>=_0x214815-0x1),_0x10c563){const _0x21fd9f=this[_0x1c2920(0x216)][_0x1c2920(0x279)](_0x3eac99,DEFAULT_DOC_SUBUNIT_ID,_0x10c563['id']);_0x21fd9f&&!_0x21fd9f[_0x1c2920(0x1af)]&&this[_0x1c2920(0x1cd)][_0x1c2920(0x21a)](ShowCommentPanelOperation['id'],{'activeComment':{'unitId':_0x3eac99,'subUnitId':DEFAULT_DOC_SUBUNIT_ID,'commentId':_0x10c563['id']}});return;}}if(!this[_0x1c2920(0x283)][_0x1c2920(0x28b)])return;this[_0x1c2920(0x1cd)][_0x1c2920(0x21a)](threadCommentUi['SetActiveCommentOperation']['id']);}}));}[_0x41f395(0x1b3)](){const _0x51b45e=_0x41f395;this[_0x51b45e(0x1d1)](this[_0x51b45e(0x283)][_0x51b45e(0x29f)][_0x51b45e(0x1b6)](_0x2c887f=>{const _0x155fcd=_0x51b45e;var _0x33f8fe,_0x4285fb,_0x2216bf,_0x311cb5;if(_0x2c887f){const _0x105ac4=this['_univerInstanceService']['getUnit'](_0x2c887f[_0x155fcd(0x1fc)]);if(_0x105ac4){const _0x34b5d5=(_0x33f8fe=this[_0x155fcd(0x23a)][_0x155fcd(0x25d)](_0x2c887f[_0x155fcd(0x1fc)]))==null?void 0x0:_0x33f8fe[_0x155fcd(0x22f)](docsUi['DocBackScrollRenderController']),_0x48d9c8=(_0x2216bf=(_0x4285fb=_0x105ac4[_0x155fcd(0x249)]())==null?void 0x0:_0x4285fb[_0x155fcd(0x1e8)])==null?void 0x0:_0x2216bf[_0x155fcd(0x1ed)](_0x430863=>_0x430863['id']===_0x2c887f[_0x155fcd(0x28c)]);_0x48d9c8&&_0x34b5d5&&_0x34b5d5[_0x155fcd(0x1b9)]({'startOffset':_0x48d9c8[_0x155fcd(0x205)],'endOffset':_0x48d9c8[_0x155fcd(0x219)],'collapsed':!0x1});}}(!_0x2c887f||_0x2c887f[_0x155fcd(0x28c)]!==((_0x311cb5=this['_docThreadCommentService'][_0x155fcd(0x1d2)])==null?void 0x0:_0x311cb5['id']))&&this['_docThreadCommentService']['endAdd']();}));}},__name(_a2,'DocThreadCommentSelectionController'),_a2);DocThreadCommentSelectionController=__decorateClass$3([__decorateParam$3(0x0,core[_0x41f395(0x22a)](threadCommentUi[_0x41f395(0x220)])),__decorateParam$3(0x1,core[_0x41f395(0x1cc)]),__decorateParam$3(0x2,core[_0x41f395(0x1dd)]),__decorateParam$3(0x3,core[_0x41f395(0x22a)](DocThreadCommentService)),__decorateParam$3(0x4,engineRender[_0x41f395(0x290)]),__decorateParam$3(0x5,core['Inject'](threadComment[_0x41f395(0x28e)]))],DocThreadCommentSelectionController);function _0x4757(_0x4cb33a,_0x25dd68){const _0x173880=_0x1738();return _0x4757=function(_0x47575d,_0x587f6e){_0x47575d=_0x47575d-0x1af;let _0x11ca97=_0x173880[_0x47575d];return _0x11ca97;},_0x4757(_0x4cb33a,_0x25dd68);}var __assign=function(){const _0x3daf8f=_0x41f395;return __assign=Object[_0x3daf8f(0x261)]||function(_0x10fbaf){const _0x409ec4=_0x3daf8f;for(var _0x35155f,_0x3c9d87=0x1,_0x39232e=arguments[_0x409ec4(0x1c0)];_0x3c9d87<_0x39232e;_0x3c9d87++){_0x35155f=arguments[_0x3c9d87];for(var _0x376cd8 in _0x35155f)Object[_0x409ec4(0x1c9)]['hasOwnProperty'][_0x409ec4(0x1f9)](_0x35155f,_0x376cd8)&&(_0x10fbaf[_0x376cd8]=_0x35155f[_0x376cd8]);}return _0x10fbaf;},__assign[_0x3daf8f(0x259)](this,arguments);},__rest=function(_0x42f739,_0x3103d7){const _0x13286b=_0x41f395;var _0x464919={};for(var _0x2231b4 in _0x42f739)Object['prototype'][_0x13286b(0x278)]['call'](_0x42f739,_0x2231b4)&&_0x3103d7['indexOf'](_0x2231b4)<0x0&&(_0x464919[_0x2231b4]=_0x42f739[_0x2231b4]);if(_0x42f739!=null&&typeof Object[_0x13286b(0x1b8)]=='function'){for(var _0x42ec1b=0x0,_0x2231b4=Object[_0x13286b(0x1b8)](_0x42f739);_0x42ec1b<_0x2231b4['length'];_0x42ec1b++)_0x3103d7[_0x13286b(0x208)](_0x2231b4[_0x42ec1b])<0x0&&Object[_0x13286b(0x1c9)][_0x13286b(0x212)][_0x13286b(0x1f9)](_0x42f739,_0x2231b4[_0x42ec1b])&&(_0x464919[_0x2231b4[_0x42ec1b]]=_0x42f739[_0x2231b4[_0x42ec1b]]);}return _0x464919;},IconBase=React['forwardRef'](function(_0x175a89,_0x11acd1){const _0x53aa2b=_0x41f395;var _0x4e66e0=_0x175a89[_0x53aa2b(0x269)],_0x36b345=_0x175a89['id'],_0x480531=_0x175a89[_0x53aa2b(0x20d)],_0xf365d1=_0x175a89[_0x53aa2b(0x266)],_0x6b6f70=__rest(_0x175a89,[_0x53aa2b(0x269),'id',_0x53aa2b(0x20d),_0x53aa2b(0x266)]),_0x25b296=_0x53aa2b(0x246)['concat'](_0x36b345,'\x20')[_0x53aa2b(0x244)](_0x480531||'')[_0x53aa2b(0x1c2)](),_0x17d15b=React['useRef']('_'[_0x53aa2b(0x244)](generateShortUuid()));return render(_0x4e66e0,''[_0x53aa2b(0x244)](_0x36b345),{'defIds':_0x4e66e0[_0x53aa2b(0x22c)],'idSuffix':_0x17d15b[_0x53aa2b(0x221)]},__assign({'ref':_0x11acd1,'className':_0x25b296},_0x6b6f70),_0xf365d1);});function render(_0x4a2827,_0x392169,_0x1900da,_0x1688ce,_0x2b63dd){const _0x20e5ef=_0x41f395;return React[_0x20e5ef(0x260)](_0x4a2827['tag'],__assign(__assign({'key':_0x392169},replaceRuntimeIdsAndExtInAttrs(_0x4a2827,_0x1900da,_0x2b63dd)),_0x1688ce),(replaceRuntimeIdsInDefs(_0x4a2827,_0x1900da)[_0x20e5ef(0x213)]||[])[_0x20e5ef(0x232)](function(_0x3ce9f2,_0x374b9e){const _0x32901b=_0x20e5ef;return render(_0x3ce9f2,''['concat'](_0x392169,'-')[_0x32901b(0x244)](_0x4a2827[_0x32901b(0x2a0)],'-')[_0x32901b(0x244)](_0x374b9e),_0x1900da,void 0x0,_0x2b63dd);}));}__name(render,_0x41f395(0x201));function replaceRuntimeIdsAndExtInAttrs(_0x4f4487,_0x178cf7,_0x69c28e){const _0x512a88=_0x41f395;var _0x52de9f=__assign({},_0x4f4487[_0x512a88(0x1fe)]);_0x69c28e!=null&&_0x69c28e[_0x512a88(0x22d)]&&_0x52de9f[_0x512a88(0x1c8)]===_0x512a88(0x22d)&&(_0x52de9f[_0x512a88(0x1c8)]=_0x69c28e['colorChannel1']);var _0x19814b=_0x178cf7[_0x512a88(0x22c)];return!_0x19814b||_0x19814b[_0x512a88(0x1c0)]===0x0||(_0x4f4487[_0x512a88(0x2a0)]==='use'&&_0x52de9f[_0x512a88(0x291)]&&(_0x52de9f[_0x512a88(0x291)]=_0x52de9f[_0x512a88(0x291)]+_0x178cf7[_0x512a88(0x1d6)]),Object[_0x512a88(0x25b)](_0x52de9f)[_0x512a88(0x20b)](function(_0x173fec){const _0x53ccd3=_0x512a88;var _0x3814cf=_0x173fec[0x0],_0x149fce=_0x173fec[0x1];typeof _0x149fce==_0x53ccd3(0x292)&&(_0x52de9f[_0x3814cf]=_0x149fce['replace'](/url\(#(.*)\)/,'url(#$1'[_0x53ccd3(0x244)](_0x178cf7[_0x53ccd3(0x1d6)],')')));})),_0x52de9f;}__name(replaceRuntimeIdsAndExtInAttrs,'replaceRuntimeIdsAndExtInAttrs');function replaceRuntimeIdsInDefs(_0x535f90,_0x27a6b9){const _0x581c90=_0x41f395;var _0x11a3dc,_0x360c4=_0x27a6b9[_0x581c90(0x22c)];return!_0x360c4||_0x360c4[_0x581c90(0x1c0)]===0x0?_0x535f90:_0x535f90[_0x581c90(0x2a0)]===_0x581c90(0x24b)&&(!((_0x11a3dc=_0x535f90['children'])===null||_0x11a3dc===void 0x0)&&_0x11a3dc['length'])?__assign(__assign({},_0x535f90),{'children':_0x535f90[_0x581c90(0x213)]['map'](function(_0x19eecb){const _0x5c7be2=_0x581c90;return typeof _0x19eecb['attrs']['id']==_0x5c7be2(0x292)&&_0x360c4&&_0x360c4['indexOf'](_0x19eecb[_0x5c7be2(0x1fe)]['id'])>-0x1?__assign(__assign({},_0x19eecb),{'attrs':__assign(__assign({},_0x19eecb[_0x5c7be2(0x1fe)]),{'id':_0x19eecb[_0x5c7be2(0x1fe)]['id']+_0x27a6b9[_0x5c7be2(0x1d6)]})}):_0x19eecb;})}):_0x535f90;}__name(replaceRuntimeIdsInDefs,_0x41f395(0x293));function generateShortUuid(){const _0x2a789e=_0x41f395;return Math[_0x2a789e(0x242)]()['toString'](0x24)[_0x2a789e(0x24a)](0x2,0x8);}__name(generateShortUuid,'generateShortUuid'),IconBase[_0x41f395(0x250)]=_0x41f395(0x280);var element={'tag':_0x41f395(0x21d),'attrs':{'fill':_0x41f395(0x235),'viewBox':_0x41f395(0x241),'width':_0x41f395(0x1f1),'height':_0x41f395(0x1f1)},'children':[{'tag':_0x41f395(0x299),'attrs':{'fill':_0x41f395(0x222),'d':'M5.83725\x206.78345C6.22188\x206.78345\x206.53368\x207.10742\x206.53368\x207.50706V8.41159C6.53368\x208.81123\x206.22188\x209.13521\x205.83725\x209.13521C5.45263\x209.13521\x205.14082\x208.81123\x205.14082\x208.41159V7.50706C5.14082\x207.10742\x205.45263\x206.78345\x205.83725\x206.78345ZM8.73904\x206.78345C9.12366\x206.78345\x209.43546\x207.10742\x209.43546\x207.50706V8.41159C9.43546\x208.81123\x209.12366\x209.13521\x208.73904\x209.13521C8.35441\x209.13521\x208.04261\x208.81123\x208.04261\x208.41159V7.50706C8.04261\x207.10742\x208.35441\x206.78345\x208.73904\x206.78345ZM11.6408\x206.78345C12.0254\x206.78345\x2012.3372\x207.10742\x2012.3372\x207.50706V8.41159C12.3372\x208.81123\x2012.0254\x209.13521\x2011.6408\x209.13521C11.2562\x209.13521\x2010.9444\x208.81123\x2010.9444\x208.41159V7.50706C10.9444\x207.10742\x2011.2562\x206.78345\x2011.6408\x206.78345Z','fillRule':_0x41f395(0x1c6),'clipRule':'evenodd'}},{'tag':'path','attrs':{'fill':_0x41f395(0x222),'d':_0x41f395(0x2a1)}},{'tag':_0x41f395(0x299),'attrs':{'fill':'currentColor','d':_0x41f395(0x1f3),'fillRule':_0x41f395(0x1c6),'clipRule':_0x41f395(0x1c6)}}]},CommentSingle=React[_0x41f395(0x217)](function(_0xa1fa75,_0x3eb671){const _0x16e608=_0x41f395;return React[_0x16e608(0x260)](IconBase,Object[_0x16e608(0x261)]({},_0xa1fa75,{'id':_0x16e608(0x1db),'ref':_0x3eb671,'icon':element}));});CommentSingle[_0x41f395(0x250)]=_0x41f395(0x297);const menuSchema={[ui[_0x41f395(0x1b2)][_0x41f395(0x1f0)]]:{[ToggleCommentPanelOperation['id']]:{'order':0x1,'menuItemFactory':ToolbarDocCommentMenuItemFactory}},[ui[_0x41f395(0x210)]['MAIN_AREA']]:{[ui[_0x41f395(0x1e2)][_0x41f395(0x248)]]:{[StartAddCommentOperation['id']]:{'order':0x1,'menuItemFactory':AddDocCommentMenuItemFactory}}}};var __defProp$2=Object['defineProperty'],__getOwnPropDesc$2=Object[_0x41f395(0x28a)],__decorateClass$2=__name((_0x1f244e,_0x511616,_0x25634c,_0x3c34ef)=>{const _0xe9ddef=_0x41f395;for(var _0x316b47=_0x3c34ef>0x1?void 0x0:_0x3c34ef?__getOwnPropDesc$2(_0x511616,_0x25634c):_0x511616,_0x15612a=_0x1f244e[_0xe9ddef(0x1c0)]-0x1,_0x247001;_0x15612a>=0x0;_0x15612a--)(_0x247001=_0x1f244e[_0x15612a])&&(_0x316b47=(_0x3c34ef?_0x247001(_0x511616,_0x25634c,_0x316b47):_0x247001(_0x316b47))||_0x316b47);return _0x3c34ef&&_0x316b47&&__defProp$2(_0x511616,_0x25634c,_0x316b47),_0x316b47;},'__decorateClass$2'),__decorateParam$2=__name((_0x1a94cd,_0x3fb596)=>(_0x423ed4,_0x3c3a7b)=>_0x3fb596(_0x423ed4,_0x3c3a7b,_0x1a94cd),'__decorateParam$2'),_a3;let DocThreadCommentUIController=(_a3=class extends core[_0x41f395(0x1e6)]{constructor(_0x325d3c,_0x1e29f4,_0x22583e){const _0x993efc=_0x41f395;super(),this[_0x993efc(0x1cd)]=_0x325d3c,this[_0x993efc(0x1e9)]=_0x1e29f4,this[_0x993efc(0x26a)]=_0x22583e,this[_0x993efc(0x228)](),this[_0x993efc(0x1bc)](),this[_0x993efc(0x22e)]();}[_0x41f395(0x228)](){const _0x52ed41=_0x41f395;[AddDocCommentComment,DeleteDocCommentComment,ShowCommentPanelOperation,StartAddCommentOperation,ToggleCommentPanelOperation][_0x52ed41(0x20b)](_0x362533=>{const _0x537d49=_0x52ed41;this[_0x537d49(0x1d1)](this[_0x537d49(0x1cd)]['registerCommand'](_0x362533));});}[_0x41f395(0x1bc)](){const _0x25e2a1=_0x41f395;this[_0x25e2a1(0x1e9)]['mergeMenu'](menuSchema);}['_initComponents'](){const _0x56ebe6=_0x41f395;[DocThreadCommentPanel][_0x56ebe6(0x20b)](_0x25794f=>{const _0x463a75=_0x56ebe6;this['disposeWithMe'](this[_0x463a75(0x26a)][_0x463a75(0x1d3)](_0x25794f[_0x463a75(0x1e5)],_0x25794f));}),this[_0x56ebe6(0x1d1)](this[_0x56ebe6(0x26a)][_0x56ebe6(0x1d3)](_0x56ebe6(0x297),CommentSingle));}},__name(_a3,_0x41f395(0x243)),_a3);DocThreadCommentUIController=__decorateClass$2([__decorateParam$2(0x0,core[_0x41f395(0x1dd)]),__decorateParam$2(0x1,ui[_0x41f395(0x1b1)]),__decorateParam$2(0x2,core['Inject'](ui[_0x41f395(0x25a)]))],DocThreadCommentUIController);var __defProp$1=Object[_0x41f395(0x1b0)],__getOwnPropDesc$1=Object[_0x41f395(0x28a)],__decorateClass$1=__name((_0x4ee04b,_0x593351,_0x37677c,_0x37f46b)=>{const _0x51ce02=_0x41f395;for(var _0x3178c3=_0x37f46b>0x1?void 0x0:_0x37f46b?__getOwnPropDesc$1(_0x593351,_0x37677c):_0x593351,_0x42132b=_0x4ee04b[_0x51ce02(0x1c0)]-0x1,_0x3f0193;_0x42132b>=0x0;_0x42132b--)(_0x3f0193=_0x4ee04b[_0x42132b])&&(_0x3178c3=(_0x37f46b?_0x3f0193(_0x593351,_0x37677c,_0x3178c3):_0x3f0193(_0x3178c3))||_0x3178c3);return _0x37f46b&&_0x3178c3&&__defProp$1(_0x593351,_0x37677c,_0x3178c3),_0x3178c3;},_0x41f395(0x224)),__decorateParam$1=__name((_0x184f20,_0x4b75fd)=>(_0x42795d,_0x24dac8)=>_0x4b75fd(_0x42795d,_0x24dac8,_0x184f20),_0x41f395(0x1f2)),_a4;let DocThreadCommentRenderController=(_a4=class extends core[_0x41f395(0x1e6)]{constructor(_0x49cc18,_0x579466,_0x28217c,_0xe7a971,_0x201d79,_0x5f3465){const _0x101fe1=_0x41f395;super(),this[_0x101fe1(0x25c)]=_0x49cc18,this[_0x101fe1(0x1ba)]=_0x579466,this[_0x101fe1(0x283)]=_0x28217c,this[_0x101fe1(0x21c)]=_0xe7a971,this[_0x101fe1(0x211)]=_0x201d79,this['_threadCommentModel']=_0x5f3465,this[_0x101fe1(0x252)](),this[_0x101fe1(0x20e)]();}[_0x41f395(0x20e)](){const _0x31dbbd=_0x41f395;this[_0x31dbbd(0x1d1)](this[_0x31dbbd(0x283)]['activeCommentId$']['subscribe'](_0x20ada0=>{const _0x4a7d0a=_0x31dbbd;var _0x2ef9fb;if(_0x20ada0){this['_docRenderController'][_0x4a7d0a(0x1e0)](_0x20ada0[_0x4a7d0a(0x1fc)]);return;}const _0x500e97=(_0x2ef9fb=this[_0x4a7d0a(0x211)][_0x4a7d0a(0x1cf)](core[_0x4a7d0a(0x227)][_0x4a7d0a(0x1d0)]))==null?void 0x0:_0x2ef9fb[_0x4a7d0a(0x288)]();_0x500e97&&this[_0x4a7d0a(0x21c)][_0x4a7d0a(0x1e0)](_0x500e97);})),this[_0x31dbbd(0x1d1)](this['_threadCommentModel'][_0x31dbbd(0x1be)][_0x31dbbd(0x1b6)](_0x58c5fe=>{const _0x2ab331=_0x31dbbd;_0x58c5fe['type']==='resolve'&&this[_0x2ab331(0x21c)][_0x2ab331(0x1e0)](_0x58c5fe[_0x2ab331(0x1fc)]);}));}[_0x41f395(0x252)](){const _0x1e9caa=_0x41f395;this['_docInterceptorService'][_0x1e9caa(0x214)](docs[_0x1e9caa(0x1b5)][_0x1e9caa(0x27c)],{'handler':__name((_0xde00af,_0x5c94db,_0x3b2ec9)=>{const _0x1430db=_0x1e9caa;if(!_0xde00af)return _0x3b2ec9(_0xde00af);const {unitId:_0x3fe226,index:_0x504a32,customDecorations:_0xdde180}=_0x5c94db,_0x1a6877=this['_threadCommentPanelService'][_0x1430db(0x28b)],{commentId:_0x303eb8,unitId:_0x21b3c4}=_0x1a6877||{},_0x8f1e7=_0xdde180[_0x1430db(0x1ed)](_0x3ba0dc=>_0x3ba0dc['id']===_0x303eb8),_0x212af8=this[_0x1430db(0x216)]['getComment'](_0x3fe226,DEFAULT_DOC_SUBUNIT_ID,_0xde00af['id']);if(!_0x212af8)return _0x3b2ec9({..._0xde00af,'show':!0x1});const _0x22b028=_0x8f1e7&&_0x504a32>=_0x8f1e7[_0x1430db(0x205)]&&_0x504a32<=_0x8f1e7[_0x1430db(0x219)],_0xc4dccd=_0x21b3c4===_0x3fe226&&_0xde00af['id']===_0x303eb8;return _0x3b2ec9({..._0xde00af,'active':_0xc4dccd||_0x22b028,'show':!_0x212af8[_0x1430db(0x1af)]});},_0x1e9caa(0x1ca))});}},__name(_a4,'DocThreadCommentRenderController'),_a4);DocThreadCommentRenderController=__decorateClass$1([__decorateParam$1(0x1,core[_0x41f395(0x22a)](docs['DocInterceptorService'])),__decorateParam$1(0x2,core[_0x41f395(0x22a)](threadCommentUi[_0x41f395(0x220)])),__decorateParam$1(0x3,core['Inject'](docsUi['DocRenderController'])),__decorateParam$1(0x4,core['IUniverInstanceService']),__decorateParam$1(0x5,core[_0x41f395(0x22a)](threadComment[_0x41f395(0x28e)]))],DocThreadCommentRenderController);var __defProp2=Object[_0x41f395(0x1b0)],__getOwnPropDesc=Object['getOwnPropertyDescriptor'],__defNormalProp2=__name((_0x560a40,_0x4e0116,_0x59d896)=>_0x4e0116 in _0x560a40?__defProp2(_0x560a40,_0x4e0116,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x59d896}):_0x560a40[_0x4e0116]=_0x59d896,_0x41f395(0x1d5)),__decorateClass=__name((_0x257ded,_0x1e2cbd,_0x22f870,_0xd9b682)=>{for(var _0x5a0717=_0xd9b682>0x1?void 0x0:_0xd9b682?__getOwnPropDesc(_0x1e2cbd,_0x22f870):_0x1e2cbd,_0x235551=_0x257ded['length']-0x1,_0x35584e;_0x235551>=0x0;_0x235551--)(_0x35584e=_0x257ded[_0x235551])&&(_0x5a0717=(_0xd9b682?_0x35584e(_0x1e2cbd,_0x22f870,_0x5a0717):_0x35584e(_0x5a0717))||_0x5a0717);return _0xd9b682&&_0x5a0717&&__defProp2(_0x1e2cbd,_0x22f870,_0x5a0717),_0x5a0717;},'__decorateClass'),__decorateParam=__name((_0x26ba22,_0x501097)=>(_0x21ff96,_0x347e0b)=>_0x501097(_0x21ff96,_0x347e0b,_0x26ba22),_0x41f395(0x275)),__publicField2=__name((_0x3073d5,_0x1fd747,_0x5b3f43)=>__defNormalProp2(_0x3073d5,typeof _0x1fd747!='symbol'?_0x1fd747+'':_0x1fd747,_0x5b3f43),_0x41f395(0x1b7)),_a5;exports['UniverDocsThreadCommentUIPlugin']=(_a5=class extends core[_0x41f395(0x1c1)]{constructor(_0x484702=defaultPluginConfig,_0x4076f8,_0x7fe8b4,_0x1d6cc4){const _0x454ba4=_0x41f395;super(),this[_0x454ba4(0x258)]=_0x484702,this[_0x454ba4(0x268)]=_0x4076f8,this[_0x454ba4(0x1bf)]=_0x7fe8b4,this['_configService']=_0x1d6cc4;const {menu:_0x2abe18,..._0x10d629}=this[_0x454ba4(0x258)];_0x2abe18&&this[_0x454ba4(0x28f)][_0x454ba4(0x262)](_0x454ba4(0x1e4),_0x2abe18,{'merge':!0x0}),this[_0x454ba4(0x28f)][_0x454ba4(0x262)](PLUGIN_CONFIG_KEY,_0x10d629);}[_0x41f395(0x1ea)](){const _0x35bc7b=_0x41f395;[[DocThreadCommentUIController],[DocThreadCommentSelectionController],[DocThreadCommentService]][_0x35bc7b(0x20b)](_0x2145ec=>{const _0xb81bb4=_0x35bc7b;this['_injector'][_0xb81bb4(0x284)](_0x2145ec);});}['onRendered'](){const _0x434ee4=_0x41f395;this[_0x434ee4(0x24d)](),this[_0x434ee4(0x268)][_0x434ee4(0x29d)](DocThreadCommentSelectionController),this['_injector']['get'](DocThreadCommentUIController);}[_0x41f395(0x24d)](){[DocThreadCommentRenderController]['forEach'](_0x37a4fd=>{const _0x2087f6=_0x4757;this[_0x2087f6(0x1bf)][_0x2087f6(0x22b)](core['UniverInstanceType'][_0x2087f6(0x1d0)],_0x37a4fd);});}},__name(_a5,_0x41f395(0x1f4)),_a5),__publicField2(exports[_0x41f395(0x1f4)],'pluginName',PLUGIN_NAME),__publicField2(exports[_0x41f395(0x1f4)],'type',core[_0x41f395(0x227)]['UNIVER_DOC']),exports[_0x41f395(0x1f4)]=__decorateClass([core['DependentOn'](threadCommentUi['UniverThreadCommentUIPlugin']),__decorateParam(0x1,core['Inject'](core[_0x41f395(0x23e)])),__decorateParam(0x2,engineRender[_0x41f395(0x290)]),__decorateParam(0x3,core[_0x41f395(0x203)])],exports[_0x41f395(0x1f4)]),exports['AddDocCommentComment']=AddDocCommentComment,exports[_0x41f395(0x1c7)]=DeleteDocCommentComment,exports[_0x41f395(0x1d8)]=ShowCommentPanelOperation,exports[_0x41f395(0x256)]=StartAddCommentOperation;
package/lib/es/index.js CHANGED
@@ -1,522 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { CommandType, ICommandService, CustomDecorationType, sequenceExecuteAsync, sequenceExecute, Inject, Disposable, IUniverInstanceService, UniverInstanceType, UserManagerService, BuildTextUtils, useDependency, Injector, useObservable, OnLifecycle, LifecycleStages, DependentOn, Plugin, IConfigService } from "@univerjs/core";
6
- import { SetActiveCommentOperation, ThreadCommentPanelService, getDT, ThreadCommentPanel, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
7
- import { IRenderManagerService, DocumentEditArea } from "@univerjs/engine-render";
8
- import { ISidebarService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IMenuManagerService } from "@univerjs/ui";
9
- import { addCustomDecorationBySelectionFactory, deleteCustomDecorationFactory, DocSelectionRenderService, DocBackScrollRenderController, DocRenderController } from "@univerjs/docs-ui";
10
- import { IThreadCommentDataSourceService, AddCommentMutation, ThreadCommentModel } from "@univerjs/thread-comment";
11
- import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation, DocInterceptorService, DOC_INTERCEPTOR_POINT } from "@univerjs/docs";
12
- import React, { forwardRef, useRef, createElement, useMemo, useState, useEffect } from "react";
13
- import { BehaviorSubject, Observable, debounceTime } from "rxjs";
14
- const PLUGIN_NAME = "DOC_THREAD_COMMENT_UI_PLUGIN", DEFAULT_DOC_SUBUNIT_ID = "default_doc";
15
- var __assign = function() {
16
- return __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
20
- }
21
- return t;
22
- }, __assign.apply(this, arguments);
23
- }, __rest = function(s, e) {
24
- var t = {};
25
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
26
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
27
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
28
- e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
29
- return t;
30
- }, IconBase = forwardRef(function(props, ref) {
31
- var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
32
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
33
- });
34
- function render(node, id, runtimeProps, rootProps, extend) {
35
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
36
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
37
- }));
38
- }
39
- __name(render, "render");
40
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
41
- var attrs = __assign({}, node.attrs);
42
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
43
- var defIds = runtimeProps.defIds;
44
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a6) {
45
- var key = _a6[0], value = _a6[1];
46
- typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
47
- })), attrs;
48
- }
49
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
50
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
51
- var _a6, defIds = runtimeProps.defIds;
52
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a6 = node.children) === null || _a6 === void 0) && _a6.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
53
- return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
54
- }) }) : node;
55
- }
56
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
57
- function generateShortUuid() {
58
- return Math.random().toString(36).substring(2, 8);
59
- }
60
- __name(generateShortUuid, "generateShortUuid");
61
- IconBase.displayName = "UniverIcon";
62
- var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, CommentSingle = forwardRef(function(props, ref) {
63
- return createElement(IconBase, Object.assign({}, props, {
64
- id: "comment-single",
65
- ref,
66
- icon: element
67
- }));
68
- });
69
- CommentSingle.displayName = "CommentSingle";
70
- const AddDocCommentComment = {
71
- id: "docs.command.add-comment",
72
- type: CommandType.COMMAND,
73
- async handler(accessor, params) {
74
- if (!params)
75
- return !1;
76
- const { comment: originComment, unitId } = params, comment = await accessor.get(IThreadCommentDataSourceService).addComment(originComment), commandService = accessor.get(ICommandService), doMutation = addCustomDecorationBySelectionFactory(
77
- accessor,
78
- {
79
- id: comment.id,
80
- type: CustomDecorationType.COMMENT
81
- }
82
- );
83
- if (doMutation) {
84
- const addComment = {
85
- id: AddCommentMutation.id,
86
- params: {
87
- unitId,
88
- subUnitId: DEFAULT_DOC_SUBUNIT_ID,
89
- comment
90
- }
91
- }, activeOperation = {
92
- id: SetActiveCommentOperation.id,
93
- params: {
94
- unitId,
95
- subUnitId: DEFAULT_DOC_SUBUNIT_ID,
96
- commentId: comment.id
97
- }
98
- };
99
- return (await sequenceExecuteAsync([addComment, doMutation, activeOperation], commandService)).result;
100
- }
101
- return !1;
102
- }
103
- }, DeleteDocCommentComment = {
104
- id: "docs.command.delete-comment",
105
- type: CommandType.COMMAND,
106
- async handler(accessor, params) {
107
- if (!params)
108
- return !1;
109
- const { commentId, unitId } = params, commandService = accessor.get(ICommandService), doMutation = deleteCustomDecorationFactory(accessor, {
110
- id: commentId,
111
- unitId
112
- });
113
- return doMutation ? (await sequenceExecute([doMutation], commandService)).result : !1;
114
- }
115
- };
116
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
117
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
118
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
119
- return kind && result && __defProp$4(target, key, result), result;
120
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a;
121
- let DocThreadCommentService = (_a = class extends Disposable {
122
- constructor(_sidebarService, _threadCommentPanelService) {
123
- super();
124
- __publicField(this, "_addingComment$", new BehaviorSubject(void 0));
125
- __publicField(this, "addingComment$", this._addingComment$.asObservable());
126
- this._sidebarService = _sidebarService, this._threadCommentPanelService = _threadCommentPanelService, this.disposeWithMe(() => {
127
- this._addingComment$.complete();
128
- });
129
- }
130
- get addingComment() {
131
- return this._addingComment$.getValue();
132
- }
133
- startAdd(comment) {
134
- this._addingComment$.next(comment);
135
- }
136
- endAdd() {
137
- this._addingComment$.next(void 0);
138
- }
139
- }, __name(_a, "DocThreadCommentService"), _a);
140
- DocThreadCommentService = __decorateClass$4([
141
- __decorateParam$4(0, ISidebarService),
142
- __decorateParam$4(1, Inject(ThreadCommentPanelService))
143
- ], DocThreadCommentService);
144
- const ShowCommentPanelOperation = {
145
- id: "docs.operation.show-comment-panel",
146
- type: CommandType.OPERATION,
147
- handler(accessor, params) {
148
- var _a6;
149
- const panelService = accessor.get(ThreadCommentPanelService), sidebarService = accessor.get(ISidebarService);
150
- return (!panelService.panelVisible || ((_a6 = sidebarService.options.children) == null ? void 0 : _a6.label) !== DocThreadCommentPanel.componentKey) && (sidebarService.open({
151
- header: { title: "threadCommentUI.panel.title" },
152
- children: { label: DocThreadCommentPanel.componentKey },
153
- width: 320,
154
- onClose: /* @__PURE__ */ __name(() => panelService.setPanelVisible(!1), "onClose")
155
- }), panelService.setPanelVisible(!0)), params && panelService.setActiveComment(params == null ? void 0 : params.activeComment), !0;
156
- }
157
- }, ToggleCommentPanelOperation = {
158
- id: "docs.operation.toggle-comment-panel",
159
- type: CommandType.OPERATION,
160
- handler(accessor) {
161
- var _a6;
162
- const panelService = accessor.get(ThreadCommentPanelService), sidebarService = accessor.get(ISidebarService);
163
- return !panelService.panelVisible || ((_a6 = sidebarService.options.children) == null ? void 0 : _a6.label) !== DocThreadCommentPanel.componentKey ? (sidebarService.open({
164
- header: { title: "threadCommentUI.panel.title" },
165
- children: { label: DocThreadCommentPanel.componentKey },
166
- width: 320,
167
- onClose: /* @__PURE__ */ __name(() => panelService.setPanelVisible(!1), "onClose")
168
- }), panelService.setPanelVisible(!0)) : (sidebarService.close(), panelService.setPanelVisible(!1), panelService.setActiveComment(null)), !0;
169
- }
170
- }, StartAddCommentOperation = {
171
- id: "docs.operation.start-add-comment",
172
- type: CommandType.OPERATION,
173
- handler(accessor) {
174
- var _a6, _b, _c;
175
- const panelService = accessor.get(ThreadCommentPanelService), doc = accessor.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_DOC), docSelectionManagerService = accessor.get(DocSelectionManagerService), renderManagerService = accessor.get(IRenderManagerService), userManagerService = accessor.get(UserManagerService), docCommentService = accessor.get(DocThreadCommentService), commandService = accessor.get(ICommandService), sidebarService = accessor.get(ISidebarService), textRange = docSelectionManagerService.getActiveTextRange();
176
- if (!doc || !textRange)
177
- return !1;
178
- const docSelectionRenderManager = (_a6 = renderManagerService.getRenderById(doc.getUnitId())) == null ? void 0 : _a6.with(DocSelectionRenderService);
179
- if (textRange.collapsed)
180
- return panelService.panelVisible ? (panelService.setPanelVisible(!1), sidebarService.close()) : commandService.executeCommand(ShowCommentPanelOperation.id), !0;
181
- commandService.executeCommand(ShowCommentPanelOperation.id);
182
- const unitId = doc.getUnitId(), dataStream = ((_c = (_b = doc.getBody()) == null ? void 0 : _b.dataStream) != null ? _c : "").slice(textRange.startOffset, textRange.endOffset), text = BuildTextUtils.transform.getPlainText(dataStream), subUnitId = DEFAULT_DOC_SUBUNIT_ID, commentId = "", comment = {
183
- unitId,
184
- subUnitId,
185
- id: commentId,
186
- ref: text,
187
- dT: getDT(),
188
- personId: userManagerService.getCurrentUser().userID,
189
- text: {
190
- dataStream: `\r
191
- `
192
- },
193
- startOffset: textRange.startOffset,
194
- endOffset: textRange.endOffset,
195
- collapsed: !0,
196
- threadId: commentId
197
- };
198
- return docSelectionRenderManager == null || docSelectionRenderManager.blurEditor(), docCommentService.startAdd(comment), panelService.setActiveComment({
199
- unitId,
200
- subUnitId,
201
- commentId
202
- }), !0;
203
- }
204
- }, shouldDisableAddComment = /* @__PURE__ */ __name((accessor) => {
205
- const renderManagerService = accessor.get(IRenderManagerService), docSelectionManagerService = accessor.get(DocSelectionManagerService), render2 = renderManagerService.getCurrent(), skeleton = render2 == null ? void 0 : render2.with(DocSkeletonManagerService).getSkeleton(), editArea = skeleton == null ? void 0 : skeleton.getViewModel().getEditArea();
206
- if (editArea === DocumentEditArea.FOOTER || editArea === DocumentEditArea.HEADER)
207
- return !0;
208
- const range = docSelectionManagerService.getActiveTextRange();
209
- return !!(range == null || range.collapsed);
210
- }, "shouldDisableAddComment");
211
- function AddDocCommentMenuItemFactory(accessor) {
212
- return {
213
- id: StartAddCommentOperation.id,
214
- type: MenuItemType.BUTTON,
215
- icon: "CommentSingle",
216
- title: "threadCommentUI.panel.addComment",
217
- tooltip: "threadCommentUI.panel.addComment",
218
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),
219
- disabled$: new Observable(function(subscribe) {
220
- const observer = accessor.get(DocSelectionManagerService).textSelection$.pipe(debounceTime(16)).subscribe(() => {
221
- subscribe.next(shouldDisableAddComment(accessor));
222
- });
223
- return () => {
224
- observer.unsubscribe();
225
- };
226
- })
227
- };
228
- }
229
- __name(AddDocCommentMenuItemFactory, "AddDocCommentMenuItemFactory");
230
- function ToolbarDocCommentMenuItemFactory(accessor) {
231
- return {
232
- id: ToggleCommentPanelOperation.id,
233
- type: MenuItemType.BUTTON,
234
- icon: "CommentSingle",
235
- title: "threadCommentUI.panel.addComment",
236
- tooltip: "threadCommentUI.panel.addComment",
237
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
238
- };
239
- }
240
- __name(ToolbarDocCommentMenuItemFactory, "ToolbarDocCommentMenuItemFactory");
241
- const DocThreadCommentPanel = /* @__PURE__ */ __name(() => {
242
- const univerInstanceService = useDependency(IUniverInstanceService), injector = useDependency(Injector), doc$ = useMemo(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), [univerInstanceService]), doc = useObservable(doc$), subUnitId$ = useMemo(() => new Observable((sub) => sub.next(DEFAULT_DOC_SUBUNIT_ID)), []), docSelectionManagerService = useDependency(DocSelectionManagerService), selectionChange$ = useMemo(
243
- () => docSelectionManagerService.textSelection$.pipe(debounceTime(16)),
244
- [docSelectionManagerService.textSelection$]
245
- );
246
- useObservable(selectionChange$);
247
- const commandService = useDependency(ICommandService), docCommentService = useDependency(DocThreadCommentService), tempComment = useObservable(docCommentService.addingComment$), [commentIds, setCommentIds] = useState([]);
248
- if (useEffect(() => {
249
- var _a6;
250
- const set = /* @__PURE__ */ new Set(), customRanges = doc == null ? void 0 : doc.getCustomDecorations();
251
- setCommentIds((_a6 = customRanges == null ? void 0 : customRanges.map((r) => r.id).filter((i) => {
252
- const hasRepeat = set.has(i);
253
- return set.add(i), !hasRepeat;
254
- })) != null ? _a6 : []);
255
- const dispose = commandService.onCommandExecuted((command) => {
256
- var _a7;
257
- if (command.id === RichTextEditingMutation.id) {
258
- const set2 = /* @__PURE__ */ new Set(), customRanges2 = doc == null ? void 0 : doc.getCustomDecorations();
259
- setCommentIds((_a7 = customRanges2 == null ? void 0 : customRanges2.map((r) => r.id).filter((i) => {
260
- const hasRepeat = set2.has(i);
261
- return set2.add(i), !hasRepeat;
262
- })) != null ? _a7 : []);
263
- }
264
- });
265
- return () => {
266
- dispose.dispose();
267
- };
268
- }, [commandService, doc]), !doc)
269
- return null;
270
- const isInValidSelection = shouldDisableAddComment(injector), unitId = doc.getUnitId();
271
- return /* @__PURE__ */ React.createElement(
272
- ThreadCommentPanel,
273
- {
274
- unitId,
275
- subUnitId$,
276
- type: UniverInstanceType.UNIVER_DOC,
277
- onAdd: /* @__PURE__ */ __name(() => {
278
- commandService.executeCommand(StartAddCommentOperation.id);
279
- }, "onAdd"),
280
- getSubUnitName: /* @__PURE__ */ __name(() => "", "getSubUnitName"),
281
- disableAdd: isInValidSelection,
282
- tempComment,
283
- onAddComment: /* @__PURE__ */ __name((comment) => {
284
- if (!comment.parentId) {
285
- const params = {
286
- unitId,
287
- range: tempComment,
288
- comment
289
- };
290
- return commandService.executeCommand(AddDocCommentComment.id, params), docCommentService.endAdd(), !1;
291
- }
292
- return !0;
293
- }, "onAddComment"),
294
- onDeleteComment: /* @__PURE__ */ __name((comment) => {
295
- if (!comment.parentId) {
296
- const params = {
297
- unitId,
298
- commentId: comment.id
299
- };
300
- return commandService.executeCommand(DeleteDocCommentComment.id, params), !1;
301
- }
302
- return !0;
303
- }, "onDeleteComment"),
304
- showComments: commentIds
305
- }
306
- );
307
- }, "DocThreadCommentPanel");
308
- DocThreadCommentPanel.componentKey = "univer.doc.thread-comment-panel";
309
- const menuSchema = {
310
- [RibbonStartGroup.OTHERS]: {
311
- [ToggleCommentPanelOperation.id]: {
312
- order: 1,
313
- menuItemFactory: ToolbarDocCommentMenuItemFactory
314
- }
315
- },
316
- [ContextMenuPosition.MAIN_AREA]: {
317
- [ContextMenuGroup.DATA]: {
318
- [StartAddCommentOperation.id]: {
319
- order: 1,
320
- menuItemFactory: AddDocCommentMenuItemFactory
321
- }
322
- }
323
- }
324
- };
325
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
326
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
327
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
328
- return kind && result && __defProp$3(target, key, result), result;
329
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a2;
330
- let DocThreadCommentUIController = (_a2 = class extends Disposable {
331
- constructor(_commandService, _menuManagerService, _componentManager) {
332
- super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._componentManager = _componentManager, this._initCommands(), this._initMenus(), this._initComponents();
333
- }
334
- _initCommands() {
335
- [
336
- AddDocCommentComment,
337
- DeleteDocCommentComment,
338
- ShowCommentPanelOperation,
339
- StartAddCommentOperation,
340
- ToggleCommentPanelOperation
341
- ].forEach((command) => {
342
- this.disposeWithMe(this._commandService.registerCommand(command));
343
- });
344
- }
345
- _initMenus() {
346
- this._menuManagerService.mergeMenu(menuSchema);
347
- }
348
- _initComponents() {
349
- [DocThreadCommentPanel].forEach((comp) => {
350
- this.disposeWithMe(this._componentManager.register(comp.componentKey, comp));
351
- }), this.disposeWithMe(this._componentManager.register("CommentSingle", CommentSingle));
352
- }
353
- }, __name(_a2, "DocThreadCommentUIController"), _a2);
354
- DocThreadCommentUIController = __decorateClass$3([
355
- OnLifecycle(LifecycleStages.Rendered, DocThreadCommentUIController),
356
- __decorateParam$3(0, ICommandService),
357
- __decorateParam$3(1, IMenuManagerService),
358
- __decorateParam$3(2, Inject(ComponentManager))
359
- ], DocThreadCommentUIController);
360
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
361
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
362
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
363
- return kind && result && __defProp$2(target, key, result), result;
364
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a3;
365
- let DocThreadCommentSelectionController = (_a3 = class extends Disposable {
366
- constructor(_threadCommentPanelService, _univerInstanceService, _commandService, _docThreadCommentService, _renderManagerService, _threadCommentModel) {
367
- super(), this._threadCommentPanelService = _threadCommentPanelService, this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._docThreadCommentService = _docThreadCommentService, this._renderManagerService = _renderManagerService, this._threadCommentModel = _threadCommentModel, this._initSelectionChange(), this._initActiveCommandChange();
368
- }
369
- _initSelectionChange() {
370
- let lastSelection;
371
- this.disposeWithMe(
372
- this._commandService.onCommandExecuted((commandInfo) => {
373
- var _a6, _b, _c, _d;
374
- if (commandInfo.id === SetTextSelectionsOperation.id) {
375
- const params = commandInfo.params, { unitId, ranges } = params, doc = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC), primary = ranges[0];
376
- if ((lastSelection == null ? void 0 : lastSelection.startOffset) === (primary == null ? void 0 : primary.startOffset) && (lastSelection == null ? void 0 : lastSelection.endOffset) === (primary == null ? void 0 : primary.endOffset))
377
- return;
378
- if (lastSelection = primary, primary && doc) {
379
- const { startOffset, endOffset, collapsed } = primary;
380
- let customRange;
381
- if (collapsed ? customRange = (_b = (_a6 = doc.getBody()) == null ? void 0 : _a6.customDecorations) == null ? void 0 : _b.find((value) => value.startIndex <= startOffset && value.endIndex >= endOffset - 1) : customRange = (_d = (_c = doc.getBody()) == null ? void 0 : _c.customDecorations) == null ? void 0 : _d.find((value) => value.startIndex <= startOffset && value.endIndex >= endOffset - 1), customRange) {
382
- const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, customRange.id);
383
- comment && !comment.resolved && this._commandService.executeCommand(ShowCommentPanelOperation.id, {
384
- activeComment: {
385
- unitId,
386
- subUnitId: DEFAULT_DOC_SUBUNIT_ID,
387
- commentId: customRange.id
388
- }
389
- });
390
- return;
391
- }
392
- }
393
- if (!this._threadCommentPanelService.activeCommentId)
394
- return;
395
- this._commandService.executeCommand(SetActiveCommentOperation.id);
396
- }
397
- })
398
- );
399
- }
400
- _initActiveCommandChange() {
401
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
402
- var _a6, _b, _c, _d;
403
- if (activeComment) {
404
- const doc = this._univerInstanceService.getUnit(activeComment.unitId);
405
- if (doc) {
406
- const backScrollController = (_a6 = this._renderManagerService.getRenderById(activeComment.unitId)) == null ? void 0 : _a6.with(DocBackScrollRenderController), customRange = (_c = (_b = doc.getBody()) == null ? void 0 : _b.customDecorations) == null ? void 0 : _c.find((range) => range.id === activeComment.commentId);
407
- customRange && backScrollController && backScrollController.scrollToRange({
408
- startOffset: customRange.startIndex,
409
- endOffset: customRange.endIndex,
410
- collapsed: !1
411
- });
412
- }
413
- }
414
- (!activeComment || activeComment.commentId !== ((_d = this._docThreadCommentService.addingComment) == null ? void 0 : _d.id)) && this._docThreadCommentService.endAdd();
415
- }));
416
- }
417
- }, __name(_a3, "DocThreadCommentSelectionController"), _a3);
418
- DocThreadCommentSelectionController = __decorateClass$2([
419
- OnLifecycle(LifecycleStages.Rendered, DocThreadCommentSelectionController),
420
- __decorateParam$2(0, Inject(ThreadCommentPanelService)),
421
- __decorateParam$2(1, IUniverInstanceService),
422
- __decorateParam$2(2, ICommandService),
423
- __decorateParam$2(3, Inject(DocThreadCommentService)),
424
- __decorateParam$2(4, IRenderManagerService),
425
- __decorateParam$2(5, Inject(ThreadCommentModel))
426
- ], DocThreadCommentSelectionController);
427
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
428
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
429
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
430
- return kind && result && __defProp$1(target, key, result), result;
431
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a4;
432
- let DocThreadCommentRenderController = (_a4 = class extends Disposable {
433
- constructor(_context, _docInterceptorService, _threadCommentPanelService, _docRenderController, _univerInstanceService, _threadCommentModel) {
434
- super(), this._context = _context, this._docInterceptorService = _docInterceptorService, this._threadCommentPanelService = _threadCommentPanelService, this._docRenderController = _docRenderController, this._univerInstanceService = _univerInstanceService, this._threadCommentModel = _threadCommentModel, this._interceptorViewModel(), this._initReRender();
435
- }
436
- _initReRender() {
437
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
438
- var _a6;
439
- if (activeComment) {
440
- this._docRenderController.reRender(activeComment.unitId);
441
- return;
442
- }
443
- const unitId = (_a6 = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a6.getUnitId();
444
- unitId && this._docRenderController.reRender(unitId);
445
- })), this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe((update) => {
446
- update.type === "resolve" && this._docRenderController.reRender(update.unitId);
447
- }));
448
- }
449
- _interceptorViewModel() {
450
- this._docInterceptorService.intercept(DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION, {
451
- handler: /* @__PURE__ */ __name((data, pos, next) => {
452
- if (!data)
453
- return next(data);
454
- const { unitId, index, customDecorations } = pos, activeComment = this._threadCommentPanelService.activeCommentId, { commentId, unitId: commentUnitID } = activeComment || {}, activeCustomDecoration = customDecorations.find((i) => i.id === commentId), comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, data.id);
455
- if (!comment)
456
- return next({
457
- ...data,
458
- show: !1
459
- });
460
- const isActiveIndex = activeCustomDecoration && index >= activeCustomDecoration.startIndex && index <= activeCustomDecoration.endIndex, isActive = commentUnitID === unitId && data.id === commentId;
461
- return next({
462
- ...data,
463
- active: isActive || isActiveIndex,
464
- show: !comment.resolved
465
- });
466
- }, "handler")
467
- });
468
- }
469
- }, __name(_a4, "DocThreadCommentRenderController"), _a4);
470
- DocThreadCommentRenderController = __decorateClass$1([
471
- OnLifecycle(LifecycleStages.Starting, DocThreadCommentRenderController),
472
- __decorateParam$1(1, Inject(DocInterceptorService)),
473
- __decorateParam$1(2, Inject(ThreadCommentPanelService)),
474
- __decorateParam$1(3, Inject(DocRenderController)),
475
- __decorateParam$1(4, IUniverInstanceService),
476
- __decorateParam$1(5, Inject(ThreadCommentModel))
477
- ], DocThreadCommentRenderController);
478
- const PLUGIN_CONFIG_KEY = "docs-thread-comment-ui.config", defaultPluginConfig = {};
479
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
480
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
481
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
482
- return kind && result && __defProp2(target, key, result), result;
483
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a5;
484
- let UniverDocsThreadCommentUIPlugin = (_a5 = class extends Plugin {
485
- constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
486
- super(), this._config = _config, this._injector = _injector, this._renderManagerSrv = _renderManagerSrv, this._configService = _configService;
487
- const { menu, ...rest } = this._config;
488
- menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
489
- }
490
- onStarting() {
491
- [
492
- [DocThreadCommentUIController],
493
- [DocThreadCommentSelectionController],
494
- [DocThreadCommentService]
495
- ].forEach((dep) => {
496
- this._injector.add(dep);
497
- });
498
- }
499
- onRendered() {
500
- this._initRenderModule();
501
- }
502
- _initRenderModule() {
503
- [DocThreadCommentRenderController].forEach((dep) => {
504
- this._renderManagerSrv.registerRenderModule(UniverInstanceType.UNIVER_DOC, dep);
505
- });
506
- }
507
- }, __name(_a5, "UniverDocsThreadCommentUIPlugin"), _a5);
508
- __publicField2(UniverDocsThreadCommentUIPlugin, "pluginName", PLUGIN_NAME);
509
- __publicField2(UniverDocsThreadCommentUIPlugin, "type", UniverInstanceType.UNIVER_DOC);
510
- UniverDocsThreadCommentUIPlugin = __decorateClass([
511
- DependentOn(UniverThreadCommentUIPlugin),
512
- __decorateParam(1, Inject(Injector)),
513
- __decorateParam(2, IRenderManagerService),
514
- __decorateParam(3, IConfigService)
515
- ], UniverDocsThreadCommentUIPlugin);
516
- export {
517
- AddDocCommentComment,
518
- DeleteDocCommentComment,
519
- ShowCommentPanelOperation,
520
- StartAddCommentOperation,
521
- UniverDocsThreadCommentUIPlugin
522
- };
1
+ const _0x4c9f4b=_0x2e2b;(function(_0x521d65,_0x5ba4ba){const _0xb60c20=_0x2e2b,_0xed7ca1=_0x521d65();while(!![]){try{const _0x498711=parseInt(_0xb60c20(0x1f8))/0x1*(-parseInt(_0xb60c20(0x233))/0x2)+parseInt(_0xb60c20(0x217))/0x3+-parseInt(_0xb60c20(0x225))/0x4*(parseInt(_0xb60c20(0x20b))/0x5)+parseInt(_0xb60c20(0x193))/0x6+parseInt(_0xb60c20(0x1d3))/0x7+parseInt(_0xb60c20(0x1a7))/0x8+-parseInt(_0xb60c20(0x1a1))/0x9*(parseInt(_0xb60c20(0x222))/0xa);if(_0x498711===_0x5ba4ba)break;else _0xed7ca1['push'](_0xed7ca1['shift']());}catch(_0xc90667){_0xed7ca1['push'](_0xed7ca1['shift']());}}}(_0x3588,0xe50a0));var __defProp=Object[_0x4c9f4b(0x1ec)],__defNormalProp=(_0x234d25,_0x221acc,_0x23908f)=>_0x221acc in _0x234d25?__defProp(_0x234d25,_0x221acc,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x23908f}):_0x234d25[_0x221acc]=_0x23908f,__name=(_0x56993a,_0x2f6a5e)=>__defProp(_0x56993a,_0x4c9f4b(0x21a),{'value':_0x2f6a5e,'configurable':!0x0}),__publicField=(_0x18bcf5,_0x2d3f0c,_0x26272d)=>__defNormalProp(_0x18bcf5,typeof _0x2d3f0c!='symbol'?_0x2d3f0c+'':_0x2d3f0c,_0x26272d);import{Inject,Disposable,CommandType,ICommandService,CustomDecorationType,sequenceExecuteAsync,sequenceExecute,UniverInstanceType,useDependency,IUniverInstanceService,Injector,useObservable,UserManagerService,BuildTextUtils,DependentOn,Plugin,IConfigService}from'@univerjs/core';import{IRenderManagerService,DocumentEditArea}from'@univerjs/engine-render';import{ThreadCommentPanelService,SetActiveCommentOperation,ThreadCommentPanel,getDT,UniverThreadCommentUIPlugin}from'@univerjs/thread-comment-ui';import{DocSelectionManagerService,DocSkeletonManagerService,RichTextEditingMutation,SetTextSelectionsOperation,DocInterceptorService,DOC_INTERCEPTOR_POINT}from'@univerjs/docs';import{addCustomDecorationBySelectionFactory,deleteCustomDecorationFactory,DocSelectionRenderService,DocBackScrollRenderController,DocRenderController}from'@univerjs/docs-ui';import{IThreadCommentDataSourceService,AddCommentMutation,ThreadCommentModel}from'@univerjs/thread-comment';function _0x3588(){const _0x414cb6=['propertyIsEnumerable','_docThreadCommentService','addingComment$','getActiveTextRange','registerRenderModule','getRenderById','getUnit','pluginName','docs.command.delete-comment','onCommandExecuted','xlink:href','getBody','hasOwnProperty','CommentSingle','onClose','getOwnPropertySymbols','DocThreadCommentPanel','_initSelectionChange','defineProperty','children','__decorateClass$1','endOffset','DOC_THREAD_COMMENT_UI_PLUGIN','startIndex','textSelection$','getCurrentUser','BUTTON','OTHERS','getOwnPropertyDescriptor','default_doc','15lUrutE','__decorateClass','DocThreadCommentService','componentKey','_context','_config','getSubUnitName','displayName','substring','unsubscribe','getComment','_univerInstanceService','DocThreadCommentSelectionController','_interceptorViewModel','dispose','_initCommands','_commandService','result','startAdd','15ifTzfz','entries','icon','OPERATION','handler','dataStream','getPlainText','_initReRender','parentId','__decorateClass$4','fill','extend','5481006QzfdHq','endAdd','_docRenderController','name','replace','use','getSkeleton','idSuffix','1em','0\x200\x2017\x2017','addingComment','130UZglWV','activeCommentId$','HEADER','1677756VAGgSd','path','trim','comment-single','threadCommentUI.panel.title','generateShortUuid','_initActiveCommandChange','onStarting','attrs','docs.operation.toggle-comment-panel','unitId','setActiveComment','with','defIds','4030iPveXO','FOOTER','className','UniverIcon','concat','render','docs.operation.show-comment-panel','registerCommand','reRender','commentUpdate$','resolve','forEach','docs.command.add-comment','UniverDocsThreadCommentUIPlugin','string','activeComment','_threadCommentPanelService','random','startOffset','open','get','10704246PQecjF','function','getViewModel','setPanelVisible','_componentManager','next','find','activeCommentId','svg','_renderManagerSrv','getEditArea','_addingComment$','MAIN_AREA','params','1448649dvceVc','complete','setConfig','_menuManagerService','getCurrentUnitForType','_injector','611504zFPjcD','_configService','_initRenderModule','none','__publicField','UNIVER_DOC','getCustomDecorations','label','resolved','filter','docs-thread-comment-ui.config','options','_docInterceptorService','indexOf','univerjs-icon\x20univerjs-icon-','current','replaceRuntimeIdsAndExtInAttrs','call','COMMAND','_sidebarService','close','getUnitId','_renderManagerService','getValue','userID','threadCommentUI.panel.addComment','colorChannel1','prototype','M1.84351\x203.41861C1.84351\x203.01861\x202.15531\x202.69434\x202.53993\x202.69434H14.9381C15.3228\x202.69434\x2015.6346\x203.01861\x2015.6346\x203.41861V12.4611C15.6346\x2012.8612\x2015.3228\x2013.1854\x2014.9381\x2013.1854H8.82117L6.06643\x2014.6179C5.85054\x2014.7301\x205.59416\x2014.7181\x205.38884\x2014.5862C5.18352\x2014.4542\x205.05855\x2014.2211\x205.05855\x2013.9701V13.1854H2.53993C2.15531\x2013.1854\x201.84351\x2012.8612\x201.84351\x2012.4611L1.84351\x203.41861ZM6.45141\x2012.7982L8.34531\x2012.0135C8.44201\x2011.9632\x208.54864\x2011.9371\x208.65676\x2011.9371H14.2417C14.3522\x2011.9371\x2014.4417\x2011.8475\x2014.4417\x2011.7371V4.14271C14.4417\x204.03225\x2014.3522\x203.94271\x2014.2417\x203.94271H3.23636C3.12591\x203.94271\x203.03636\x204.03225\x203.03636\x204.14271L3.03636\x2011.7371C3.03636\x2011.8475\x203.12591\x2011.9371\x203.23636\x2011.9371L5.75498\x2011.9371C6.1396\x2011.9371\x206.45141\x2012.0611\x206.45141\x2012.4611V12.7982Z','disposeWithMe','evenodd','currentColor','transform','tag','__defNormalProp','collapsed','endIndex','panelVisible','subscribe','commentId','length','has','AddDocCommentMenuItemFactory','symbol','4421886oRLnlb','_threadCommentModel','map','type','add','executeCommand','CUSTOM_DECORATION'];_0x3588=function(){return _0x414cb6;};return _0x3588();}import{ISidebarService,MenuItemType,getMenuHiddenObservable,RibbonStartGroup,ContextMenuPosition,ContextMenuGroup,ComponentManager,IMenuManagerService}from'@univerjs/ui';import{BehaviorSubject,Observable,debounceTime}from'rxjs';import _0x245919,{useMemo,useState,useEffect,forwardRef,useRef,createElement}from'react';const PLUGIN_NAME=_0x4c9f4b(0x1f0),DEFAULT_DOC_SUBUNIT_ID=_0x4c9f4b(0x1f7),PLUGIN_CONFIG_KEY=_0x4c9f4b(0x1b1),defaultPluginConfig={};var __defProp$4=Object[_0x4c9f4b(0x1ec)],__getOwnPropDesc$4=Object['getOwnPropertyDescriptor'],__decorateClass$4=__name((_0x35fb1e,_0x378f61,_0x104a46,_0x1f68a6)=>{for(var _0x42be0e=_0x1f68a6>0x1?void 0x0:_0x1f68a6?__getOwnPropDesc$4(_0x378f61,_0x104a46):_0x378f61,_0xd17813=_0x35fb1e['length']-0x1,_0x373dac;_0xd17813>=0x0;_0xd17813--)(_0x373dac=_0x35fb1e[_0xd17813])&&(_0x42be0e=(_0x1f68a6?_0x373dac(_0x378f61,_0x104a46,_0x42be0e):_0x373dac(_0x42be0e))||_0x42be0e);return _0x1f68a6&&_0x42be0e&&__defProp$4(_0x378f61,_0x104a46,_0x42be0e),_0x42be0e;},_0x4c9f4b(0x214)),__decorateParam$4=__name((_0x4132f6,_0x5add8c)=>(_0xe934a2,_0x933679)=>_0x5add8c(_0xe934a2,_0x933679,_0x4132f6),'__decorateParam$4'),_a;let DocThreadCommentService=(_a=class extends Disposable{constructor(_0xd5c685,_0x547942){const _0x5b90ed=_0x4c9f4b;super(),__publicField(this,'_addingComment$',new BehaviorSubject(void 0x0)),__publicField(this,_0x5b90ed(0x1dc),this[_0x5b90ed(0x19e)]['asObservable']()),(this[_0x5b90ed(0x1ba)]=_0xd5c685,this[_0x5b90ed(0x18e)]=_0x547942,this[_0x5b90ed(0x1c4)](()=>{const _0x1f3f35=_0x5b90ed;this['_addingComment$'][_0x1f3f35(0x1a2)]();}));}get['addingComment'](){const _0x292f9c=_0x4c9f4b;return this['_addingComment$'][_0x292f9c(0x1be)]();}['startAdd'](_0x3a386b){const _0x28d166=_0x4c9f4b;this[_0x28d166(0x19e)][_0x28d166(0x198)](_0x3a386b);}[_0x4c9f4b(0x218)](){const _0x3b597a=_0x4c9f4b;this[_0x3b597a(0x19e)]['next'](void 0x0);}},__name(_a,_0x4c9f4b(0x1fa)),_a);function _0x2e2b(_0x266113,_0x328db5){const _0x35889d=_0x3588();return _0x2e2b=function(_0x2e2b21,_0x3d13bd){_0x2e2b21=_0x2e2b21-0x183;let _0x32fc94=_0x35889d[_0x2e2b21];return _0x32fc94;},_0x2e2b(_0x266113,_0x328db5);}DocThreadCommentService=__decorateClass$4([__decorateParam$4(0x0,ISidebarService),__decorateParam$4(0x1,Inject(ThreadCommentPanelService))],DocThreadCommentService);const AddDocCommentComment={'id':_0x4c9f4b(0x18a),'type':CommandType[_0x4c9f4b(0x1b9)],async 'handler'(_0x54a65e,_0x1e8066){const _0xce397b=_0x4c9f4b;if(!_0x1e8066)return!0x1;const {comment:_0x4860c7,unitId:_0x5c468b}=_0x1e8066,_0xbe9d63=await _0x54a65e[_0xce397b(0x192)](IThreadCommentDataSourceService)['addComment'](_0x4860c7),_0x2f4f63=_0x54a65e[_0xce397b(0x192)](ICommandService),_0x3abaf8=addCustomDecorationBySelectionFactory(_0x54a65e,{'id':_0xbe9d63['id'],'type':CustomDecorationType['COMMENT']});if(_0x3abaf8){const _0x22283f={'id':AddCommentMutation['id'],'params':{'unitId':_0x5c468b,'subUnitId':DEFAULT_DOC_SUBUNIT_ID,'comment':_0xbe9d63}},_0x34d9f0={'id':SetActiveCommentOperation['id'],'params':{'unitId':_0x5c468b,'subUnitId':DEFAULT_DOC_SUBUNIT_ID,'commentId':_0xbe9d63['id']}};return(await sequenceExecuteAsync([_0x22283f,_0x3abaf8,_0x34d9f0],_0x2f4f63))[_0xce397b(0x209)];}return!0x1;}},DeleteDocCommentComment={'id':_0x4c9f4b(0x1e2),'type':CommandType[_0x4c9f4b(0x1b9)],async 'handler'(_0x5b8a37,_0x413f1c){const _0x5732e1=_0x4c9f4b;if(!_0x413f1c)return!0x1;const {commentId:_0x9a8acb,unitId:_0x65e74b}=_0x413f1c,_0x1f571e=_0x5b8a37[_0x5732e1(0x192)](ICommandService),_0x49096f=deleteCustomDecorationFactory(_0x5b8a37,{'id':_0x9a8acb,'unitId':_0x65e74b});return _0x49096f?(await sequenceExecute([_0x49096f],_0x1f571e))[_0x5732e1(0x209)]:!0x1;}},shouldDisableAddComment=__name(_0x329f1e=>{const _0x40a13f=_0x4c9f4b,_0x9339f1=_0x329f1e[_0x40a13f(0x192)](IRenderManagerService),_0x5a806b=_0x329f1e[_0x40a13f(0x192)](DocSelectionManagerService),_0x4c95c8=_0x9339f1['getCurrent'](),_0x17ca39=_0x4c95c8==null?void 0x0:_0x4c95c8[_0x40a13f(0x231)](DocSkeletonManagerService)[_0x40a13f(0x21d)](),_0xecee44=_0x17ca39==null?void 0x0:_0x17ca39[_0x40a13f(0x195)]()[_0x40a13f(0x19d)]();if(_0xecee44===DocumentEditArea[_0x40a13f(0x234)]||_0xecee44===DocumentEditArea[_0x40a13f(0x224)])return!0x0;const _0x56b0e1=_0x5a806b[_0x40a13f(0x1dd)]();return!!(_0x56b0e1==null||_0x56b0e1['collapsed']);},'shouldDisableAddComment');function AddDocCommentMenuItemFactory(_0x6f8b20){const _0x1644ff=_0x4c9f4b;return{'id':StartAddCommentOperation['id'],'type':MenuItemType[_0x1644ff(0x1f4)],'icon':_0x1644ff(0x1e7),'title':_0x1644ff(0x1c0),'tooltip':_0x1644ff(0x1c0),'hidden$':getMenuHiddenObservable(_0x6f8b20,UniverInstanceType[_0x1644ff(0x1ac)]),'disabled$':new Observable(function(_0x324f91){const _0x597f35=_0x1644ff,_0xc173bb=_0x6f8b20[_0x597f35(0x192)](DocSelectionManagerService)[_0x597f35(0x1f2)]['pipe'](debounceTime(0x10))[_0x597f35(0x1cd)](()=>{_0x324f91['next'](shouldDisableAddComment(_0x6f8b20));});return()=>{const _0x2278fd=_0x597f35;_0xc173bb[_0x2278fd(0x201)]();};})};}__name(AddDocCommentMenuItemFactory,_0x4c9f4b(0x1d1));function ToolbarDocCommentMenuItemFactory(_0x119071){const _0x10b5ac=_0x4c9f4b;return{'id':ToggleCommentPanelOperation['id'],'type':MenuItemType['BUTTON'],'icon':_0x10b5ac(0x1e7),'title':_0x10b5ac(0x1c0),'tooltip':_0x10b5ac(0x1c0),'hidden$':getMenuHiddenObservable(_0x119071,UniverInstanceType[_0x10b5ac(0x1ac)])};}__name(ToolbarDocCommentMenuItemFactory,'ToolbarDocCommentMenuItemFactory');const DocThreadCommentPanel=__name(()=>{const _0x2790e4=_0x4c9f4b,_0x52d5ea=useDependency(IUniverInstanceService),_0x1ff2ab=useDependency(Injector),_0x5b3863=useMemo(()=>_0x52d5ea['getCurrentTypeOfUnit$'](UniverInstanceType[_0x2790e4(0x1ac)]),[_0x52d5ea]),_0x50c167=useObservable(_0x5b3863),_0x3a8096=useMemo(()=>new Observable(_0x33ebbb=>_0x33ebbb[_0x2790e4(0x198)](DEFAULT_DOC_SUBUNIT_ID)),[]),_0x3293e4=useDependency(DocSelectionManagerService),_0x4e4f39=useMemo(()=>_0x3293e4[_0x2790e4(0x1f2)]['pipe'](debounceTime(0x10)),[_0x3293e4[_0x2790e4(0x1f2)]]);useObservable(_0x4e4f39);const _0x2e874c=useDependency(ICommandService),_0x520a07=useDependency(DocThreadCommentService),_0x17893a=useObservable(_0x520a07['addingComment$']),[_0x263f7e,_0x4c95e3]=useState([]);if(useEffect(()=>{const _0x2dbdd6=_0x2790e4;var _0xe71e5c;const _0x4a1d17=new Set(),_0xe8a789=_0x50c167==null?void 0x0:_0x50c167[_0x2dbdd6(0x1ad)]();_0x4c95e3((_0xe71e5c=_0xe8a789==null?void 0x0:_0xe8a789[_0x2dbdd6(0x1d5)](_0x506fbe=>_0x506fbe['id'])['filter'](_0x245958=>{const _0x2da24d=_0x2dbdd6,_0x4b21b3=_0x4a1d17[_0x2da24d(0x1d0)](_0x245958);return _0x4a1d17['add'](_0x245958),!_0x4b21b3;}))!=null?_0xe71e5c:[]);const _0x234869=_0x2e874c[_0x2dbdd6(0x1e3)](_0x18e56d=>{const _0x3e4946=_0x2dbdd6;var _0x4a5d75;if(_0x18e56d['id']===RichTextEditingMutation['id']){const _0x515e7a=new Set(),_0x57d6b8=_0x50c167==null?void 0x0:_0x50c167[_0x3e4946(0x1ad)]();_0x4c95e3((_0x4a5d75=_0x57d6b8==null?void 0x0:_0x57d6b8['map'](_0x5b79a8=>_0x5b79a8['id'])[_0x3e4946(0x1b0)](_0x44cae8=>{const _0x4b2b13=_0x3e4946,_0x5b3c64=_0x515e7a[_0x4b2b13(0x1d0)](_0x44cae8);return _0x515e7a[_0x4b2b13(0x1d7)](_0x44cae8),!_0x5b3c64;}))!=null?_0x4a5d75:[]);}});return()=>{const _0x33c600=_0x2dbdd6;_0x234869[_0x33c600(0x206)]();};},[_0x2e874c,_0x50c167]),!_0x50c167)return null;const _0x45504c=shouldDisableAddComment(_0x1ff2ab),_0x42168c=_0x50c167[_0x2790e4(0x1bc)]();return _0x245919['createElement'](ThreadCommentPanel,{'unitId':_0x42168c,'subUnitId$':_0x3a8096,'type':UniverInstanceType[_0x2790e4(0x1ac)],'onAdd':__name(()=>{const _0x1bdd74=_0x2790e4;_0x2e874c[_0x1bdd74(0x1d8)](StartAddCommentOperation['id']);},'onAdd'),'getSubUnitName':__name(()=>'',_0x2790e4(0x1fe)),'disableAdd':_0x45504c,'tempComment':_0x17893a,'onAddComment':__name(_0x4c873a=>{const _0x1881a3=_0x2790e4;if(!_0x4c873a[_0x1881a3(0x213)]){const _0x178b92={'unitId':_0x42168c,'range':_0x17893a,'comment':_0x4c873a};return _0x2e874c['executeCommand'](AddDocCommentComment['id'],_0x178b92),_0x520a07[_0x1881a3(0x218)](),!0x1;}return!0x0;},'onAddComment'),'onDeleteComment':__name(_0x100800=>{const _0x343cf8=_0x2790e4;if(!_0x100800[_0x343cf8(0x213)]){const _0xadb9ba={'unitId':_0x42168c,'commentId':_0x100800['id']};return _0x2e874c[_0x343cf8(0x1d8)](DeleteDocCommentComment['id'],_0xadb9ba),!0x1;}return!0x0;},'onDeleteComment'),'showComments':_0x263f7e});},_0x4c9f4b(0x1ea));DocThreadCommentPanel[_0x4c9f4b(0x1fb)]='univer.doc.thread-comment-panel';const ShowCommentPanelOperation={'id':_0x4c9f4b(0x184),'type':CommandType['OPERATION'],'handler'(_0x22cc21,_0x1f8e79){const _0x50c090=_0x4c9f4b;var _0x2d1c52;const _0x34f932=_0x22cc21[_0x50c090(0x192)](ThreadCommentPanelService),_0x5e74d2=_0x22cc21[_0x50c090(0x192)](ISidebarService);return(!_0x34f932[_0x50c090(0x1cc)]||((_0x2d1c52=_0x5e74d2[_0x50c090(0x1b2)][_0x50c090(0x1ed)])==null?void 0x0:_0x2d1c52[_0x50c090(0x1ae)])!==DocThreadCommentPanel[_0x50c090(0x1fb)])&&(_0x5e74d2[_0x50c090(0x191)]({'header':{'title':_0x50c090(0x229)},'children':{'label':DocThreadCommentPanel['componentKey']},'width':0x140,'onClose':__name(()=>_0x34f932[_0x50c090(0x196)](!0x1),_0x50c090(0x1e8))}),_0x34f932[_0x50c090(0x196)](!0x0)),_0x1f8e79&&_0x34f932[_0x50c090(0x230)](_0x1f8e79==null?void 0x0:_0x1f8e79[_0x50c090(0x18d)]),!0x0;}},ToggleCommentPanelOperation={'id':_0x4c9f4b(0x22e),'type':CommandType[_0x4c9f4b(0x20e)],'handler'(_0x45e0bf){const _0x63974f=_0x4c9f4b;var _0x41212f;const _0x19cf10=_0x45e0bf['get'](ThreadCommentPanelService),_0x563754=_0x45e0bf[_0x63974f(0x192)](ISidebarService);return!_0x19cf10[_0x63974f(0x1cc)]||((_0x41212f=_0x563754[_0x63974f(0x1b2)][_0x63974f(0x1ed)])==null?void 0x0:_0x41212f[_0x63974f(0x1ae)])!==DocThreadCommentPanel['componentKey']?(_0x563754['open']({'header':{'title':_0x63974f(0x229)},'children':{'label':DocThreadCommentPanel[_0x63974f(0x1fb)]},'width':0x140,'onClose':__name(()=>_0x19cf10[_0x63974f(0x196)](!0x1),'onClose')}),_0x19cf10[_0x63974f(0x196)](!0x0)):(_0x563754['close'](),_0x19cf10[_0x63974f(0x196)](!0x1),_0x19cf10[_0x63974f(0x230)](null)),!0x0;}},StartAddCommentOperation={'id':'docs.operation.start-add-comment','type':CommandType['OPERATION'],'handler'(_0x27b533){const _0x51bddc=_0x4c9f4b;var _0x1b5156,_0x439146,_0x261da1;const _0x2b88b1=_0x27b533['get'](ThreadCommentPanelService),_0x236a0c=_0x27b533[_0x51bddc(0x192)](IUniverInstanceService)[_0x51bddc(0x1a5)](UniverInstanceType['UNIVER_DOC']),_0x5830f8=_0x27b533[_0x51bddc(0x192)](DocSelectionManagerService),_0xa05799=_0x27b533['get'](IRenderManagerService),_0x2ae913=_0x27b533[_0x51bddc(0x192)](UserManagerService),_0x1f747d=_0x27b533[_0x51bddc(0x192)](DocThreadCommentService),_0x42d83f=_0x27b533[_0x51bddc(0x192)](ICommandService),_0x138404=_0x27b533['get'](ISidebarService),_0xc329f5=_0x5830f8[_0x51bddc(0x1dd)]();if(!_0x236a0c||!_0xc329f5)return!0x1;const _0x3fef17=(_0x1b5156=_0xa05799[_0x51bddc(0x1df)](_0x236a0c[_0x51bddc(0x1bc)]()))==null?void 0x0:_0x1b5156[_0x51bddc(0x231)](DocSelectionRenderService);if(_0xc329f5[_0x51bddc(0x1ca)])return _0x2b88b1['panelVisible']?(_0x2b88b1[_0x51bddc(0x196)](!0x1),_0x138404[_0x51bddc(0x1bb)]()):_0x42d83f['executeCommand'](ShowCommentPanelOperation['id']),!0x0;_0x42d83f['executeCommand'](ShowCommentPanelOperation['id']);const _0x27f5ce=_0x236a0c[_0x51bddc(0x1bc)](),_0x1a1f8b=((_0x261da1=(_0x439146=_0x236a0c[_0x51bddc(0x1e5)]())==null?void 0x0:_0x439146[_0x51bddc(0x210)])!=null?_0x261da1:'')['slice'](_0xc329f5[_0x51bddc(0x190)],_0xc329f5[_0x51bddc(0x1ef)]),_0x2db3b5=BuildTextUtils[_0x51bddc(0x1c7)][_0x51bddc(0x211)](_0x1a1f8b),_0x244e68=DEFAULT_DOC_SUBUNIT_ID,_0x4971d2='',_0x29f1ca={'unitId':_0x27f5ce,'subUnitId':_0x244e68,'id':_0x4971d2,'ref':_0x2db3b5,'dT':getDT(),'personId':_0x2ae913[_0x51bddc(0x1f3)]()[_0x51bddc(0x1bf)],'text':{'dataStream':'\x0d\x0a'},'startOffset':_0xc329f5[_0x51bddc(0x190)],'endOffset':_0xc329f5[_0x51bddc(0x1ef)],'collapsed':!0x0,'threadId':_0x4971d2};return _0x3fef17==null||_0x3fef17['blurEditor'](),_0x1f747d[_0x51bddc(0x20a)](_0x29f1ca),_0x2b88b1[_0x51bddc(0x230)]({'unitId':_0x27f5ce,'subUnitId':_0x244e68,'commentId':_0x4971d2}),!0x0;}};var __defProp$3=Object[_0x4c9f4b(0x1ec)],__getOwnPropDesc$3=Object[_0x4c9f4b(0x1f6)],__decorateClass$3=__name((_0xf748c7,_0x92212f,_0x2b8b9e,_0x15ea4b)=>{for(var _0x8b070c=_0x15ea4b>0x1?void 0x0:_0x15ea4b?__getOwnPropDesc$3(_0x92212f,_0x2b8b9e):_0x92212f,_0x332b0c=_0xf748c7['length']-0x1,_0x492437;_0x332b0c>=0x0;_0x332b0c--)(_0x492437=_0xf748c7[_0x332b0c])&&(_0x8b070c=(_0x15ea4b?_0x492437(_0x92212f,_0x2b8b9e,_0x8b070c):_0x492437(_0x8b070c))||_0x8b070c);return _0x15ea4b&&_0x8b070c&&__defProp$3(_0x92212f,_0x2b8b9e,_0x8b070c),_0x8b070c;},'__decorateClass$3'),__decorateParam$3=__name((_0x270cc2,_0x2bcbe2)=>(_0x4f3116,_0xa57f50)=>_0x2bcbe2(_0x4f3116,_0xa57f50,_0x270cc2),'__decorateParam$3'),_a2;let DocThreadCommentSelectionController=(_a2=class extends Disposable{constructor(_0x343244,_0xf2b469,_0x404749,_0x302378,_0x227285,_0x59bb68){const _0x57cf4c=_0x4c9f4b;super(),this['_threadCommentPanelService']=_0x343244,this[_0x57cf4c(0x203)]=_0xf2b469,this[_0x57cf4c(0x208)]=_0x404749,this[_0x57cf4c(0x1db)]=_0x302378,this[_0x57cf4c(0x1bd)]=_0x227285,this[_0x57cf4c(0x1d4)]=_0x59bb68,this[_0x57cf4c(0x1eb)](),this['_initActiveCommandChange']();}[_0x4c9f4b(0x1eb)](){const _0x564eb1=_0x4c9f4b;let _0x1d9b4a;this[_0x564eb1(0x1c4)](this[_0x564eb1(0x208)]['onCommandExecuted'](_0x2a955e=>{const _0x4c299e=_0x564eb1;var _0x46caac,_0x4912df,_0x46311f,_0xf9003c;if(_0x2a955e['id']===SetTextSelectionsOperation['id']){const _0x1c6d99=_0x2a955e[_0x4c299e(0x1a0)],{unitId:_0x3833a0,ranges:_0x223ff2}=_0x1c6d99,_0x173203=this['_univerInstanceService'][_0x4c299e(0x1e0)](_0x3833a0,UniverInstanceType['UNIVER_DOC']),_0x3538a7=_0x223ff2[0x0];if((_0x1d9b4a==null?void 0x0:_0x1d9b4a[_0x4c299e(0x190)])===(_0x3538a7==null?void 0x0:_0x3538a7[_0x4c299e(0x190)])&&(_0x1d9b4a==null?void 0x0:_0x1d9b4a[_0x4c299e(0x1ef)])===(_0x3538a7==null?void 0x0:_0x3538a7[_0x4c299e(0x1ef)]))return;if(_0x1d9b4a=_0x3538a7,_0x3538a7&&_0x173203){const {startOffset:_0x3d00eb,endOffset:_0x456e09,collapsed:_0x4eda38}=_0x3538a7;let _0x1cde32;if(_0x4eda38?_0x1cde32=(_0x4912df=(_0x46caac=_0x173203[_0x4c299e(0x1e5)]())==null?void 0x0:_0x46caac['customDecorations'])==null?void 0x0:_0x4912df[_0x4c299e(0x199)](_0xb91117=>_0xb91117[_0x4c299e(0x1f1)]<=_0x3d00eb&&_0xb91117[_0x4c299e(0x1cb)]>=_0x456e09-0x1):_0x1cde32=(_0xf9003c=(_0x46311f=_0x173203[_0x4c299e(0x1e5)]())==null?void 0x0:_0x46311f['customDecorations'])==null?void 0x0:_0xf9003c[_0x4c299e(0x199)](_0x1d8935=>_0x1d8935[_0x4c299e(0x1f1)]<=_0x3d00eb&&_0x1d8935[_0x4c299e(0x1cb)]>=_0x456e09-0x1),_0x1cde32){const _0x1eb859=this[_0x4c299e(0x1d4)][_0x4c299e(0x202)](_0x3833a0,DEFAULT_DOC_SUBUNIT_ID,_0x1cde32['id']);_0x1eb859&&!_0x1eb859[_0x4c299e(0x1af)]&&this[_0x4c299e(0x208)][_0x4c299e(0x1d8)](ShowCommentPanelOperation['id'],{'activeComment':{'unitId':_0x3833a0,'subUnitId':DEFAULT_DOC_SUBUNIT_ID,'commentId':_0x1cde32['id']}});return;}}if(!this[_0x4c299e(0x18e)][_0x4c299e(0x19a)])return;this[_0x4c299e(0x208)]['executeCommand'](SetActiveCommentOperation['id']);}}));}[_0x4c9f4b(0x22b)](){const _0x2eedda=_0x4c9f4b;this[_0x2eedda(0x1c4)](this[_0x2eedda(0x18e)][_0x2eedda(0x223)]['subscribe'](_0x2ea713=>{const _0x19f528=_0x2eedda;var _0x186eb3,_0x3eb263,_0x4398c8,_0x259254;if(_0x2ea713){const _0x124f0f=this['_univerInstanceService'][_0x19f528(0x1e0)](_0x2ea713[_0x19f528(0x22f)]);if(_0x124f0f){const _0x3148f2=(_0x186eb3=this['_renderManagerService'][_0x19f528(0x1df)](_0x2ea713[_0x19f528(0x22f)]))==null?void 0x0:_0x186eb3[_0x19f528(0x231)](DocBackScrollRenderController),_0x80a61e=(_0x4398c8=(_0x3eb263=_0x124f0f['getBody']())==null?void 0x0:_0x3eb263['customDecorations'])==null?void 0x0:_0x4398c8['find'](_0x5c7cc5=>_0x5c7cc5['id']===_0x2ea713[_0x19f528(0x1ce)]);_0x80a61e&&_0x3148f2&&_0x3148f2['scrollToRange']({'startOffset':_0x80a61e['startIndex'],'endOffset':_0x80a61e[_0x19f528(0x1cb)],'collapsed':!0x1});}}(!_0x2ea713||_0x2ea713[_0x19f528(0x1ce)]!==((_0x259254=this[_0x19f528(0x1db)][_0x19f528(0x221)])==null?void 0x0:_0x259254['id']))&&this[_0x19f528(0x1db)][_0x19f528(0x218)]();}));}},__name(_a2,_0x4c9f4b(0x204)),_a2);DocThreadCommentSelectionController=__decorateClass$3([__decorateParam$3(0x0,Inject(ThreadCommentPanelService)),__decorateParam$3(0x1,IUniverInstanceService),__decorateParam$3(0x2,ICommandService),__decorateParam$3(0x3,Inject(DocThreadCommentService)),__decorateParam$3(0x4,IRenderManagerService),__decorateParam$3(0x5,Inject(ThreadCommentModel))],DocThreadCommentSelectionController);var __assign=function(){return __assign=Object['assign']||function(_0x2c0c14){const _0x42067e=_0x2e2b;for(var _0x3cd71d,_0x48f6c1=0x1,_0x20202d=arguments[_0x42067e(0x1cf)];_0x48f6c1<_0x20202d;_0x48f6c1++){_0x3cd71d=arguments[_0x48f6c1];for(var _0x19e350 in _0x3cd71d)Object[_0x42067e(0x1c2)][_0x42067e(0x1e6)][_0x42067e(0x1b8)](_0x3cd71d,_0x19e350)&&(_0x2c0c14[_0x19e350]=_0x3cd71d[_0x19e350]);}return _0x2c0c14;},__assign['apply'](this,arguments);},__rest=function(_0x3a3825,_0xa121fe){const _0x253889=_0x4c9f4b;var _0x3d0751={};for(var _0x5c957e in _0x3a3825)Object['prototype'][_0x253889(0x1e6)][_0x253889(0x1b8)](_0x3a3825,_0x5c957e)&&_0xa121fe[_0x253889(0x1b4)](_0x5c957e)<0x0&&(_0x3d0751[_0x5c957e]=_0x3a3825[_0x5c957e]);if(_0x3a3825!=null&&typeof Object[_0x253889(0x1e9)]==_0x253889(0x194)){for(var _0x22cda8=0x0,_0x5c957e=Object[_0x253889(0x1e9)](_0x3a3825);_0x22cda8<_0x5c957e[_0x253889(0x1cf)];_0x22cda8++)_0xa121fe[_0x253889(0x1b4)](_0x5c957e[_0x22cda8])<0x0&&Object[_0x253889(0x1c2)][_0x253889(0x1da)]['call'](_0x3a3825,_0x5c957e[_0x22cda8])&&(_0x3d0751[_0x5c957e[_0x22cda8]]=_0x3a3825[_0x5c957e[_0x22cda8]]);}return _0x3d0751;},IconBase=forwardRef(function(_0x235527,_0x4722f2){const _0xdff866=_0x4c9f4b;var _0x2ceb51=_0x235527[_0xdff866(0x20d)],_0x4619e7=_0x235527['id'],_0x7ed6f5=_0x235527[_0xdff866(0x235)],_0x29159b=_0x235527[_0xdff866(0x216)],_0x2d264a=__rest(_0x235527,[_0xdff866(0x20d),'id',_0xdff866(0x235),_0xdff866(0x216)]),_0x1cd40b=_0xdff866(0x1b5)[_0xdff866(0x237)](_0x4619e7,'\x20')[_0xdff866(0x237)](_0x7ed6f5||'')[_0xdff866(0x227)](),_0x10e3b8=useRef('_'['concat'](generateShortUuid()));return render(_0x2ceb51,''['concat'](_0x4619e7),{'defIds':_0x2ceb51[_0xdff866(0x232)],'idSuffix':_0x10e3b8[_0xdff866(0x1b6)]},__assign({'ref':_0x4722f2,'className':_0x1cd40b},_0x2d264a),_0x29159b);});function render(_0x4bd856,_0x586a95,_0x3372f8,_0x173a77,_0x4c8c8f){const _0x225e94=_0x4c9f4b;return createElement(_0x4bd856['tag'],__assign(__assign({'key':_0x586a95},replaceRuntimeIdsAndExtInAttrs(_0x4bd856,_0x3372f8,_0x4c8c8f)),_0x173a77),(replaceRuntimeIdsInDefs(_0x4bd856,_0x3372f8)[_0x225e94(0x1ed)]||[])[_0x225e94(0x1d5)](function(_0x3aaa05,_0x256db2){const _0x37be79=_0x225e94;return render(_0x3aaa05,''[_0x37be79(0x237)](_0x586a95,'-')[_0x37be79(0x237)](_0x4bd856[_0x37be79(0x1c8)],'-')['concat'](_0x256db2),_0x3372f8,void 0x0,_0x4c8c8f);}));}__name(render,_0x4c9f4b(0x183));function replaceRuntimeIdsAndExtInAttrs(_0xfb3b63,_0x19fbb4,_0x33df65){const _0x3edda3=_0x4c9f4b;var _0x4f44c3=__assign({},_0xfb3b63[_0x3edda3(0x22d)]);_0x33df65!=null&&_0x33df65[_0x3edda3(0x1c1)]&&_0x4f44c3[_0x3edda3(0x215)]===_0x3edda3(0x1c1)&&(_0x4f44c3['fill']=_0x33df65[_0x3edda3(0x1c1)]);var _0x1c3bfa=_0x19fbb4[_0x3edda3(0x232)];return!_0x1c3bfa||_0x1c3bfa[_0x3edda3(0x1cf)]===0x0||(_0xfb3b63['tag']===_0x3edda3(0x21c)&&_0x4f44c3[_0x3edda3(0x1e4)]&&(_0x4f44c3['xlink:href']=_0x4f44c3[_0x3edda3(0x1e4)]+_0x19fbb4[_0x3edda3(0x21e)]),Object[_0x3edda3(0x20c)](_0x4f44c3)[_0x3edda3(0x189)](function(_0x2fa8d7){const _0x51aa94=_0x3edda3;var _0xb263e1=_0x2fa8d7[0x0],_0x44032d=_0x2fa8d7[0x1];typeof _0x44032d==_0x51aa94(0x18c)&&(_0x4f44c3[_0xb263e1]=_0x44032d[_0x51aa94(0x21b)](/url\(#(.*)\)/,'url(#$1'[_0x51aa94(0x237)](_0x19fbb4['idSuffix'],')')));})),_0x4f44c3;}__name(replaceRuntimeIdsAndExtInAttrs,_0x4c9f4b(0x1b7));function replaceRuntimeIdsInDefs(_0x5339bb,_0xc56781){const _0x1165aa=_0x4c9f4b;var _0x2133fe,_0x196702=_0xc56781[_0x1165aa(0x232)];return!_0x196702||_0x196702[_0x1165aa(0x1cf)]===0x0?_0x5339bb:_0x5339bb[_0x1165aa(0x1c8)]==='defs'&&(!((_0x2133fe=_0x5339bb[_0x1165aa(0x1ed)])===null||_0x2133fe===void 0x0)&&_0x2133fe[_0x1165aa(0x1cf)])?__assign(__assign({},_0x5339bb),{'children':_0x5339bb['children']['map'](function(_0x9e8396){const _0x4a0d6a=_0x1165aa;return typeof _0x9e8396['attrs']['id']==_0x4a0d6a(0x18c)&&_0x196702&&_0x196702['indexOf'](_0x9e8396[_0x4a0d6a(0x22d)]['id'])>-0x1?__assign(__assign({},_0x9e8396),{'attrs':__assign(__assign({},_0x9e8396[_0x4a0d6a(0x22d)]),{'id':_0x9e8396[_0x4a0d6a(0x22d)]['id']+_0xc56781[_0x4a0d6a(0x21e)]})}):_0x9e8396;})}):_0x5339bb;}__name(replaceRuntimeIdsInDefs,'replaceRuntimeIdsInDefs');function generateShortUuid(){const _0x1973e3=_0x4c9f4b;return Math[_0x1973e3(0x18f)]()['toString'](0x24)[_0x1973e3(0x200)](0x2,0x8);}__name(generateShortUuid,_0x4c9f4b(0x22a)),IconBase['displayName']=_0x4c9f4b(0x236);var element={'tag':_0x4c9f4b(0x19b),'attrs':{'fill':_0x4c9f4b(0x1aa),'viewBox':_0x4c9f4b(0x220),'width':'1em','height':_0x4c9f4b(0x21f)},'children':[{'tag':'path','attrs':{'fill':_0x4c9f4b(0x1c6),'d':'M5.83725\x206.78345C6.22188\x206.78345\x206.53368\x207.10742\x206.53368\x207.50706V8.41159C6.53368\x208.81123\x206.22188\x209.13521\x205.83725\x209.13521C5.45263\x209.13521\x205.14082\x208.81123\x205.14082\x208.41159V7.50706C5.14082\x207.10742\x205.45263\x206.78345\x205.83725\x206.78345ZM8.73904\x206.78345C9.12366\x206.78345\x209.43546\x207.10742\x209.43546\x207.50706V8.41159C9.43546\x208.81123\x209.12366\x209.13521\x208.73904\x209.13521C8.35441\x209.13521\x208.04261\x208.81123\x208.04261\x208.41159V7.50706C8.04261\x207.10742\x208.35441\x206.78345\x208.73904\x206.78345ZM11.6408\x206.78345C12.0254\x206.78345\x2012.3372\x207.10742\x2012.3372\x207.50706V8.41159C12.3372\x208.81123\x2012.0254\x209.13521\x2011.6408\x209.13521C11.2562\x209.13521\x2010.9444\x208.81123\x2010.9444\x208.41159V7.50706C10.9444\x207.10742\x2011.2562\x206.78345\x2011.6408\x206.78345Z','fillRule':_0x4c9f4b(0x1c5),'clipRule':_0x4c9f4b(0x1c5)}},{'tag':_0x4c9f4b(0x226),'attrs':{'fill':'currentColor','d':'M5.83725\x206.78345C6.22188\x206.78345\x206.53368\x207.10742\x206.53368\x207.50706V8.41159C6.53368\x208.81123\x206.22188\x209.13521\x205.83725\x209.13521\x205.45263\x209.13521\x205.14082\x208.81123\x205.14082\x208.41159V7.50706C5.14082\x207.10742\x205.45263\x206.78345\x205.83725\x206.78345zM8.73904\x206.78345C9.12366\x206.78345\x209.43546\x207.10742\x209.43546\x207.50706V8.41159C9.43546\x208.81123\x209.12366\x209.13521\x208.73904\x209.13521\x208.35441\x209.13521\x208.04261\x208.81123\x208.04261\x208.41159V7.50706C8.04261\x207.10742\x208.35441\x206.78345\x208.73904\x206.78345zM11.6408\x206.78345C12.0254\x206.78345\x2012.3372\x207.10742\x2012.3372\x207.50706V8.41159C12.3372\x208.81123\x2012.0254\x209.13521\x2011.6408\x209.13521\x2011.2562\x209.13521\x2010.9444\x208.81123\x2010.9444\x208.41159V7.50706C10.9444\x207.10742\x2011.2562\x206.78345\x2011.6408\x206.78345z'}},{'tag':_0x4c9f4b(0x226),'attrs':{'fill':'currentColor','d':_0x4c9f4b(0x1c3),'fillRule':'evenodd','clipRule':_0x4c9f4b(0x1c5)}}]},CommentSingle=forwardRef(function(_0x27bfd4,_0x275274){const _0x584aca=_0x4c9f4b;return createElement(IconBase,Object['assign']({},_0x27bfd4,{'id':_0x584aca(0x228),'ref':_0x275274,'icon':element}));});CommentSingle[_0x4c9f4b(0x1ff)]='CommentSingle';const menuSchema={[RibbonStartGroup[_0x4c9f4b(0x1f5)]]:{[ToggleCommentPanelOperation['id']]:{'order':0x1,'menuItemFactory':ToolbarDocCommentMenuItemFactory}},[ContextMenuPosition[_0x4c9f4b(0x19f)]]:{[ContextMenuGroup['DATA']]:{[StartAddCommentOperation['id']]:{'order':0x1,'menuItemFactory':AddDocCommentMenuItemFactory}}}};var __defProp$2=Object[_0x4c9f4b(0x1ec)],__getOwnPropDesc$2=Object[_0x4c9f4b(0x1f6)],__decorateClass$2=__name((_0x4725d4,_0x5d6126,_0x3ce687,_0x25c513)=>{const _0x479ac2=_0x4c9f4b;for(var _0x5dea04=_0x25c513>0x1?void 0x0:_0x25c513?__getOwnPropDesc$2(_0x5d6126,_0x3ce687):_0x5d6126,_0x331050=_0x4725d4[_0x479ac2(0x1cf)]-0x1,_0x22b561;_0x331050>=0x0;_0x331050--)(_0x22b561=_0x4725d4[_0x331050])&&(_0x5dea04=(_0x25c513?_0x22b561(_0x5d6126,_0x3ce687,_0x5dea04):_0x22b561(_0x5dea04))||_0x5dea04);return _0x25c513&&_0x5dea04&&__defProp$2(_0x5d6126,_0x3ce687,_0x5dea04),_0x5dea04;},'__decorateClass$2'),__decorateParam$2=__name((_0x1fae45,_0x23c79e)=>(_0x101b0c,_0x52047f)=>_0x23c79e(_0x101b0c,_0x52047f,_0x1fae45),'__decorateParam$2'),_a3;let DocThreadCommentUIController=(_a3=class extends Disposable{constructor(_0x41c074,_0x5706a7,_0x4a6d3a){const _0x2fa2d9=_0x4c9f4b;super(),this[_0x2fa2d9(0x208)]=_0x41c074,this[_0x2fa2d9(0x1a4)]=_0x5706a7,this[_0x2fa2d9(0x197)]=_0x4a6d3a,this[_0x2fa2d9(0x207)](),this['_initMenus'](),this['_initComponents']();}[_0x4c9f4b(0x207)](){const _0x927325=_0x4c9f4b;[AddDocCommentComment,DeleteDocCommentComment,ShowCommentPanelOperation,StartAddCommentOperation,ToggleCommentPanelOperation][_0x927325(0x189)](_0x2c6797=>{const _0x191af0=_0x927325;this[_0x191af0(0x1c4)](this[_0x191af0(0x208)][_0x191af0(0x185)](_0x2c6797));});}['_initMenus'](){const _0x542b64=_0x4c9f4b;this[_0x542b64(0x1a4)]['mergeMenu'](menuSchema);}['_initComponents'](){const _0x1fe88f=_0x4c9f4b;[DocThreadCommentPanel]['forEach'](_0x1a36ce=>{const _0x5f32e8=_0x2e2b;this[_0x5f32e8(0x1c4)](this[_0x5f32e8(0x197)]['register'](_0x1a36ce['componentKey'],_0x1a36ce));}),this['disposeWithMe'](this[_0x1fe88f(0x197)]['register'](_0x1fe88f(0x1e7),CommentSingle));}},__name(_a3,'DocThreadCommentUIController'),_a3);DocThreadCommentUIController=__decorateClass$2([__decorateParam$2(0x0,ICommandService),__decorateParam$2(0x1,IMenuManagerService),__decorateParam$2(0x2,Inject(ComponentManager))],DocThreadCommentUIController);var __defProp$1=Object[_0x4c9f4b(0x1ec)],__getOwnPropDesc$1=Object[_0x4c9f4b(0x1f6)],__decorateClass$1=__name((_0x2f0d1c,_0x308ea4,_0x4b30e2,_0x23bbdb)=>{const _0x31a760=_0x4c9f4b;for(var _0x9ce2c2=_0x23bbdb>0x1?void 0x0:_0x23bbdb?__getOwnPropDesc$1(_0x308ea4,_0x4b30e2):_0x308ea4,_0x42e3f9=_0x2f0d1c[_0x31a760(0x1cf)]-0x1,_0x5ea047;_0x42e3f9>=0x0;_0x42e3f9--)(_0x5ea047=_0x2f0d1c[_0x42e3f9])&&(_0x9ce2c2=(_0x23bbdb?_0x5ea047(_0x308ea4,_0x4b30e2,_0x9ce2c2):_0x5ea047(_0x9ce2c2))||_0x9ce2c2);return _0x23bbdb&&_0x9ce2c2&&__defProp$1(_0x308ea4,_0x4b30e2,_0x9ce2c2),_0x9ce2c2;},_0x4c9f4b(0x1ee)),__decorateParam$1=__name((_0x36a3c1,_0x2a8020)=>(_0x379755,_0x4c2aa8)=>_0x2a8020(_0x379755,_0x4c2aa8,_0x36a3c1),'__decorateParam$1'),_a4;let DocThreadCommentRenderController=(_a4=class extends Disposable{constructor(_0x48b175,_0x478073,_0x59117a,_0x1d5bba,_0x5b2b24,_0x55c927){const _0x49704b=_0x4c9f4b;super(),this[_0x49704b(0x1fc)]=_0x48b175,this[_0x49704b(0x1b3)]=_0x478073,this['_threadCommentPanelService']=_0x59117a,this[_0x49704b(0x219)]=_0x1d5bba,this[_0x49704b(0x203)]=_0x5b2b24,this[_0x49704b(0x1d4)]=_0x55c927,this[_0x49704b(0x205)](),this[_0x49704b(0x212)]();}[_0x4c9f4b(0x212)](){const _0x2ee2d4=_0x4c9f4b;this[_0x2ee2d4(0x1c4)](this['_threadCommentPanelService']['activeCommentId$'][_0x2ee2d4(0x1cd)](_0x450132=>{const _0x59a171=_0x2ee2d4;var _0x545d0a;if(_0x450132){this[_0x59a171(0x219)]['reRender'](_0x450132[_0x59a171(0x22f)]);return;}const _0x1c2288=(_0x545d0a=this[_0x59a171(0x203)][_0x59a171(0x1a5)](UniverInstanceType['UNIVER_DOC']))==null?void 0x0:_0x545d0a[_0x59a171(0x1bc)]();_0x1c2288&&this[_0x59a171(0x219)][_0x59a171(0x186)](_0x1c2288);})),this[_0x2ee2d4(0x1c4)](this['_threadCommentModel'][_0x2ee2d4(0x187)]['subscribe'](_0x276b7b=>{const _0x55d589=_0x2ee2d4;_0x276b7b[_0x55d589(0x1d6)]===_0x55d589(0x188)&&this['_docRenderController']['reRender'](_0x276b7b[_0x55d589(0x22f)]);}));}[_0x4c9f4b(0x205)](){const _0x989282=_0x4c9f4b;this[_0x989282(0x1b3)]['intercept'](DOC_INTERCEPTOR_POINT[_0x989282(0x1d9)],{'handler':__name((_0xc74a0,_0x23c843,_0x9338e8)=>{const _0x4415ec=_0x989282;if(!_0xc74a0)return _0x9338e8(_0xc74a0);const {unitId:_0x479dda,index:_0x42c602,customDecorations:_0x5c9a35}=_0x23c843,_0xdb4559=this['_threadCommentPanelService']['activeCommentId'],{commentId:_0x58bd43,unitId:_0x686727}=_0xdb4559||{},_0x34502c=_0x5c9a35['find'](_0x11f5b5=>_0x11f5b5['id']===_0x58bd43),_0x5853aa=this[_0x4415ec(0x1d4)][_0x4415ec(0x202)](_0x479dda,DEFAULT_DOC_SUBUNIT_ID,_0xc74a0['id']);if(!_0x5853aa)return _0x9338e8({..._0xc74a0,'show':!0x1});const _0x2781a0=_0x34502c&&_0x42c602>=_0x34502c[_0x4415ec(0x1f1)]&&_0x42c602<=_0x34502c[_0x4415ec(0x1cb)],_0x4bb5ea=_0x686727===_0x479dda&&_0xc74a0['id']===_0x58bd43;return _0x9338e8({..._0xc74a0,'active':_0x4bb5ea||_0x2781a0,'show':!_0x5853aa['resolved']});},_0x989282(0x20f))});}},__name(_a4,'DocThreadCommentRenderController'),_a4);DocThreadCommentRenderController=__decorateClass$1([__decorateParam$1(0x1,Inject(DocInterceptorService)),__decorateParam$1(0x2,Inject(ThreadCommentPanelService)),__decorateParam$1(0x3,Inject(DocRenderController)),__decorateParam$1(0x4,IUniverInstanceService),__decorateParam$1(0x5,Inject(ThreadCommentModel))],DocThreadCommentRenderController);var __defProp2=Object[_0x4c9f4b(0x1ec)],__getOwnPropDesc=Object[_0x4c9f4b(0x1f6)],__defNormalProp2=__name((_0x3c13ec,_0x75509f,_0x12ce03)=>_0x75509f in _0x3c13ec?__defProp2(_0x3c13ec,_0x75509f,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x12ce03}):_0x3c13ec[_0x75509f]=_0x12ce03,_0x4c9f4b(0x1c9)),__decorateClass=__name((_0x394130,_0x55b7ac,_0xb33bd7,_0x465e4d)=>{const _0x372271=_0x4c9f4b;for(var _0x16b5d4=_0x465e4d>0x1?void 0x0:_0x465e4d?__getOwnPropDesc(_0x55b7ac,_0xb33bd7):_0x55b7ac,_0x4b5dd8=_0x394130[_0x372271(0x1cf)]-0x1,_0x142dc5;_0x4b5dd8>=0x0;_0x4b5dd8--)(_0x142dc5=_0x394130[_0x4b5dd8])&&(_0x16b5d4=(_0x465e4d?_0x142dc5(_0x55b7ac,_0xb33bd7,_0x16b5d4):_0x142dc5(_0x16b5d4))||_0x16b5d4);return _0x465e4d&&_0x16b5d4&&__defProp2(_0x55b7ac,_0xb33bd7,_0x16b5d4),_0x16b5d4;},_0x4c9f4b(0x1f9)),__decorateParam=__name((_0x4d12f3,_0x5403a6)=>(_0x255d53,_0x52d9a8)=>_0x5403a6(_0x255d53,_0x52d9a8,_0x4d12f3),'__decorateParam'),__publicField2=__name((_0x29e5e4,_0x42532e,_0x4f7a11)=>__defNormalProp2(_0x29e5e4,typeof _0x42532e!=_0x4c9f4b(0x1d2)?_0x42532e+'':_0x42532e,_0x4f7a11),_0x4c9f4b(0x1ab)),_a5;let UniverDocsThreadCommentUIPlugin=(_a5=class extends Plugin{constructor(_0x4fa004=defaultPluginConfig,_0x520422,_0x45e3be,_0x3efe33){const _0x4fec8b=_0x4c9f4b;super(),this[_0x4fec8b(0x1fd)]=_0x4fa004,this[_0x4fec8b(0x1a6)]=_0x520422,this['_renderManagerSrv']=_0x45e3be,this[_0x4fec8b(0x1a8)]=_0x3efe33;const {menu:_0x5c7320,..._0x4c7990}=this[_0x4fec8b(0x1fd)];_0x5c7320&&this['_configService'][_0x4fec8b(0x1a3)]('menu',_0x5c7320,{'merge':!0x0}),this['_configService'][_0x4fec8b(0x1a3)](PLUGIN_CONFIG_KEY,_0x4c7990);}[_0x4c9f4b(0x22c)](){const _0x31d097=_0x4c9f4b;[[DocThreadCommentUIController],[DocThreadCommentSelectionController],[DocThreadCommentService]][_0x31d097(0x189)](_0x20d46b=>{const _0x7c5932=_0x31d097;this[_0x7c5932(0x1a6)][_0x7c5932(0x1d7)](_0x20d46b);});}['onRendered'](){const _0x33dc34=_0x4c9f4b;this[_0x33dc34(0x1a9)](),this['_injector'][_0x33dc34(0x192)](DocThreadCommentSelectionController),this[_0x33dc34(0x1a6)][_0x33dc34(0x192)](DocThreadCommentUIController);}[_0x4c9f4b(0x1a9)](){const _0x16423e=_0x4c9f4b;[DocThreadCommentRenderController][_0x16423e(0x189)](_0x286da5=>{const _0x488857=_0x16423e;this[_0x488857(0x19c)][_0x488857(0x1de)](UniverInstanceType[_0x488857(0x1ac)],_0x286da5);});}},__name(_a5,_0x4c9f4b(0x18b)),_a5);__publicField2(UniverDocsThreadCommentUIPlugin,_0x4c9f4b(0x1e1),PLUGIN_NAME),__publicField2(UniverDocsThreadCommentUIPlugin,'type',UniverInstanceType[_0x4c9f4b(0x1ac)]),UniverDocsThreadCommentUIPlugin=__decorateClass([DependentOn(UniverThreadCommentUIPlugin),__decorateParam(0x1,Inject(Injector)),__decorateParam(0x2,IRenderManagerService),__decorateParam(0x3,IConfigService)],UniverDocsThreadCommentUIPlugin);export{AddDocCommentComment,DeleteDocCommentComment,ShowCommentPanelOperation,StartAddCommentOperation,UniverDocsThreadCommentUIPlugin};
@@ -1,7 +1,7 @@
1
1
  import { DocumentDataModel, Disposable, IUniverInstanceService } from '@univerjs/core';
2
+ import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
2
3
  import { DocInterceptorService } from '@univerjs/docs';
3
4
  import { DocRenderController } from '@univerjs/docs-ui';
4
- import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
5
5
  import { ThreadCommentModel } from '@univerjs/thread-comment';
6
6
  import { ThreadCommentPanelService } from '@univerjs/thread-comment-ui';
7
7
  export declare class DocThreadCommentRenderController extends Disposable implements IRenderModule {
@@ -1,6 +1,6 @@
1
+ import { IUniverDocsThreadCommentUIConfig } from './controllers/config.schema';
1
2
  import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
3
  import { IRenderManagerService } from '@univerjs/engine-render';
3
- import { IUniverDocsThreadCommentUIConfig } from './controllers/config.schema';
4
4
  export declare class UniverDocsThreadCommentUIPlugin extends Plugin {
5
5
  private readonly _config;
6
6
  protected _injector: Injector;
package/lib/umd/index.js CHANGED
@@ -1,2 +1 @@
1
- (function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/thread-comment-ui"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("@univerjs/docs-ui"),require("@univerjs/thread-comment"),require("@univerjs/docs"),require("react"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment-ui","@univerjs/engine-render","@univerjs/ui","@univerjs/docs-ui","@univerjs/thread-comment","@univerjs/docs","react","rxjs"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocsThreadCommentUi={},global.UniverCore,global.UniverThreadCommentUi,global.UniverEngineRender,global.UniverUi,global.UniverDocsUi,global.UniverThreadComment,global.UniverDocs,global.React,global.rxjs))})(this,function(exports2,core,threadCommentUi,engineRender,ui,docsUi,threadComment,docs,React,rxjs){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c,_d,_e;const PLUGIN_NAME="DOC_THREAD_COMMENT_UI_PLUGIN",DEFAULT_DOC_SUBUNIT_ID="default_doc";var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=React.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=React.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return React.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CommentSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"comment-single",ref,icon:element}))});CommentSingle.displayName="CommentSingle";const AddDocCommentComment={id:"docs.command.add-comment",type:core.CommandType.COMMAND,async handler(accessor,params){if(!params)return!1;const{comment:originComment,unitId}=params,comment=await accessor.get(threadComment.IThreadCommentDataSourceService).addComment(originComment),commandService=accessor.get(core.ICommandService),doMutation=docsUi.addCustomDecorationBySelectionFactory(accessor,{id:comment.id,type:core.CustomDecorationType.COMMENT});if(doMutation){const addComment={id:threadComment.AddCommentMutation.id,params:{unitId,subUnitId:DEFAULT_DOC_SUBUNIT_ID,comment}},activeOperation={id:threadCommentUi.SetActiveCommentOperation.id,params:{unitId,subUnitId:DEFAULT_DOC_SUBUNIT_ID,commentId:comment.id}};return(await core.sequenceExecuteAsync([addComment,doMutation,activeOperation],commandService)).result}return!1}},DeleteDocCommentComment={id:"docs.command.delete-comment",type:core.CommandType.COMMAND,async handler(accessor,params){if(!params)return!1;const{commentId,unitId}=params,commandService=accessor.get(core.ICommandService),doMutation=docsUi.deleteCustomDecorationFactory(accessor,{id:commentId,unitId});return doMutation?(await core.sequenceExecute([doMutation],commandService)).result:!1}};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4");let DocThreadCommentService=(_a=class extends core.Disposable{constructor(_sidebarService,_threadCommentPanelService){super();__publicField(this,"_addingComment$",new rxjs.BehaviorSubject(void 0));__publicField(this,"addingComment$",this._addingComment$.asObservable());this._sidebarService=_sidebarService,this._threadCommentPanelService=_threadCommentPanelService,this.disposeWithMe(()=>{this._addingComment$.complete()})}get addingComment(){return this._addingComment$.getValue()}startAdd(comment){this._addingComment$.next(comment)}endAdd(){this._addingComment$.next(void 0)}},__name(_a,"DocThreadCommentService"),_a);DocThreadCommentService=__decorateClass$4([__decorateParam$4(0,ui.ISidebarService),__decorateParam$4(1,core.Inject(threadCommentUi.ThreadCommentPanelService))],DocThreadCommentService);const ShowCommentPanelOperation={id:"docs.operation.show-comment-panel",type:core.CommandType.OPERATION,handler(accessor,params){var _a2;const panelService=accessor.get(threadCommentUi.ThreadCommentPanelService),sidebarService=accessor.get(ui.ISidebarService);return(!panelService.panelVisible||((_a2=sidebarService.options.children)==null?void 0:_a2.label)!==DocThreadCommentPanel.componentKey)&&(sidebarService.open({header:{title:"threadCommentUI.panel.title"},children:{label:DocThreadCommentPanel.componentKey},width:320,onClose:__name(()=>panelService.setPanelVisible(!1),"onClose")}),panelService.setPanelVisible(!0)),params&&panelService.setActiveComment(params==null?void 0:params.activeComment),!0}},ToggleCommentPanelOperation={id:"docs.operation.toggle-comment-panel",type:core.CommandType.OPERATION,handler(accessor){var _a2;const panelService=accessor.get(threadCommentUi.ThreadCommentPanelService),sidebarService=accessor.get(ui.ISidebarService);return!panelService.panelVisible||((_a2=sidebarService.options.children)==null?void 0:_a2.label)!==DocThreadCommentPanel.componentKey?(sidebarService.open({header:{title:"threadCommentUI.panel.title"},children:{label:DocThreadCommentPanel.componentKey},width:320,onClose:__name(()=>panelService.setPanelVisible(!1),"onClose")}),panelService.setPanelVisible(!0)):(sidebarService.close(),panelService.setPanelVisible(!1),panelService.setActiveComment(null)),!0}},StartAddCommentOperation={id:"docs.operation.start-add-comment",type:core.CommandType.OPERATION,handler(accessor){var _a2,_b2,_c2;const panelService=accessor.get(threadCommentUi.ThreadCommentPanelService),doc=accessor.get(core.IUniverInstanceService).getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC),docSelectionManagerService=accessor.get(docs.DocSelectionManagerService),renderManagerService=accessor.get(engineRender.IRenderManagerService),userManagerService=accessor.get(core.UserManagerService),docCommentService=accessor.get(DocThreadCommentService),commandService=accessor.get(core.ICommandService),sidebarService=accessor.get(ui.ISidebarService),textRange=docSelectionManagerService.getActiveTextRange();if(!doc||!textRange)return!1;const docSelectionRenderManager=(_a2=renderManagerService.getRenderById(doc.getUnitId()))==null?void 0:_a2.with(docsUi.DocSelectionRenderService);if(textRange.collapsed)return panelService.panelVisible?(panelService.setPanelVisible(!1),sidebarService.close()):commandService.executeCommand(ShowCommentPanelOperation.id),!0;commandService.executeCommand(ShowCommentPanelOperation.id);const unitId=doc.getUnitId(),dataStream=((_c2=(_b2=doc.getBody())==null?void 0:_b2.dataStream)!=null?_c2:"").slice(textRange.startOffset,textRange.endOffset),text=core.BuildTextUtils.transform.getPlainText(dataStream),subUnitId=DEFAULT_DOC_SUBUNIT_ID,commentId="",comment={unitId,subUnitId,id:commentId,ref:text,dT:threadCommentUi.getDT(),personId:userManagerService.getCurrentUser().userID,text:{dataStream:`\r
2
- `},startOffset:textRange.startOffset,endOffset:textRange.endOffset,collapsed:!0,threadId:commentId};return docSelectionRenderManager==null||docSelectionRenderManager.blurEditor(),docCommentService.startAdd(comment),panelService.setActiveComment({unitId,subUnitId,commentId}),!0}},shouldDisableAddComment=__name(accessor=>{const renderManagerService=accessor.get(engineRender.IRenderManagerService),docSelectionManagerService=accessor.get(docs.DocSelectionManagerService),render2=renderManagerService.getCurrent(),skeleton=render2==null?void 0:render2.with(docs.DocSkeletonManagerService).getSkeleton(),editArea=skeleton==null?void 0:skeleton.getViewModel().getEditArea();if(editArea===engineRender.DocumentEditArea.FOOTER||editArea===engineRender.DocumentEditArea.HEADER)return!0;const range=docSelectionManagerService.getActiveTextRange();return!!(range==null||range.collapsed)},"shouldDisableAddComment");function AddDocCommentMenuItemFactory(accessor){return{id:StartAddCommentOperation.id,type:ui.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC),disabled$:new rxjs.Observable(function(subscribe){const observer=accessor.get(docs.DocSelectionManagerService).textSelection$.pipe(rxjs.debounceTime(16)).subscribe(()=>{subscribe.next(shouldDisableAddComment(accessor))});return()=>{observer.unsubscribe()}})}}__name(AddDocCommentMenuItemFactory,"AddDocCommentMenuItemFactory");function ToolbarDocCommentMenuItemFactory(accessor){return{id:ToggleCommentPanelOperation.id,type:ui.MenuItemType.BUTTON,icon:"CommentSingle",title:"threadCommentUI.panel.addComment",tooltip:"threadCommentUI.panel.addComment",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC)}}__name(ToolbarDocCommentMenuItemFactory,"ToolbarDocCommentMenuItemFactory");const DocThreadCommentPanel=__name(()=>{const univerInstanceService=core.useDependency(core.IUniverInstanceService),injector=core.useDependency(core.Injector),doc$=React.useMemo(()=>univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_DOC),[univerInstanceService]),doc=core.useObservable(doc$),subUnitId$=React.useMemo(()=>new rxjs.Observable(sub=>sub.next(DEFAULT_DOC_SUBUNIT_ID)),[]),docSelectionManagerService=core.useDependency(docs.DocSelectionManagerService),selectionChange$=React.useMemo(()=>docSelectionManagerService.textSelection$.pipe(rxjs.debounceTime(16)),[docSelectionManagerService.textSelection$]);core.useObservable(selectionChange$);const commandService=core.useDependency(core.ICommandService),docCommentService=core.useDependency(DocThreadCommentService),tempComment=core.useObservable(docCommentService.addingComment$),[commentIds,setCommentIds]=React.useState([]);if(React.useEffect(()=>{var _a2;const set=new Set,customRanges=doc==null?void 0:doc.getCustomDecorations();setCommentIds((_a2=customRanges==null?void 0:customRanges.map(r=>r.id).filter(i=>{const hasRepeat=set.has(i);return set.add(i),!hasRepeat}))!=null?_a2:[]);const dispose=commandService.onCommandExecuted(command=>{var _a3;if(command.id===docs.RichTextEditingMutation.id){const set2=new Set,customRanges2=doc==null?void 0:doc.getCustomDecorations();setCommentIds((_a3=customRanges2==null?void 0:customRanges2.map(r=>r.id).filter(i=>{const hasRepeat=set2.has(i);return set2.add(i),!hasRepeat}))!=null?_a3:[])}});return()=>{dispose.dispose()}},[commandService,doc]),!doc)return null;const isInValidSelection=shouldDisableAddComment(injector),unitId=doc.getUnitId();return React.createElement(threadCommentUi.ThreadCommentPanel,{unitId,subUnitId$,type:core.UniverInstanceType.UNIVER_DOC,onAdd:__name(()=>{commandService.executeCommand(StartAddCommentOperation.id)},"onAdd"),getSubUnitName:__name(()=>"","getSubUnitName"),disableAdd:isInValidSelection,tempComment,onAddComment:__name(comment=>{if(!comment.parentId){const params={unitId,range:tempComment,comment};return commandService.executeCommand(AddDocCommentComment.id,params),docCommentService.endAdd(),!1}return!0},"onAddComment"),onDeleteComment:__name(comment=>{if(!comment.parentId){const params={unitId,commentId:comment.id};return commandService.executeCommand(DeleteDocCommentComment.id,params),!1}return!0},"onDeleteComment"),showComments:commentIds})},"DocThreadCommentPanel");DocThreadCommentPanel.componentKey="univer.doc.thread-comment-panel";const menuSchema={[ui.RibbonStartGroup.OTHERS]:{[ToggleCommentPanelOperation.id]:{order:1,menuItemFactory:ToolbarDocCommentMenuItemFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.DATA]:{[StartAddCommentOperation.id]:{order:1,menuItemFactory:AddDocCommentMenuItemFactory}}}};var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");let DocThreadCommentUIController=(_b=class extends core.Disposable{constructor(_commandService,_menuManagerService,_componentManager){super(),this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._componentManager=_componentManager,this._initCommands(),this._initMenus(),this._initComponents()}_initCommands(){[AddDocCommentComment,DeleteDocCommentComment,ShowCommentPanelOperation,StartAddCommentOperation,ToggleCommentPanelOperation].forEach(command=>{this.disposeWithMe(this._commandService.registerCommand(command))})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initComponents(){[DocThreadCommentPanel].forEach(comp=>{this.disposeWithMe(this._componentManager.register(comp.componentKey,comp))}),this.disposeWithMe(this._componentManager.register("CommentSingle",CommentSingle))}},__name(_b,"DocThreadCommentUIController"),_b);DocThreadCommentUIController=__decorateClass$3([core.OnLifecycle(core.LifecycleStages.Rendered,DocThreadCommentUIController),__decorateParam$3(0,core.ICommandService),__decorateParam$3(1,ui.IMenuManagerService),__decorateParam$3(2,core.Inject(ui.ComponentManager))],DocThreadCommentUIController);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let DocThreadCommentSelectionController=(_c=class extends core.Disposable{constructor(_threadCommentPanelService,_univerInstanceService,_commandService,_docThreadCommentService,_renderManagerService,_threadCommentModel){super(),this._threadCommentPanelService=_threadCommentPanelService,this._univerInstanceService=_univerInstanceService,this._commandService=_commandService,this._docThreadCommentService=_docThreadCommentService,this._renderManagerService=_renderManagerService,this._threadCommentModel=_threadCommentModel,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let lastSelection;this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{var _a2,_b2,_c2,_d2;if(commandInfo.id===docs.SetTextSelectionsOperation.id){const params=commandInfo.params,{unitId,ranges}=params,doc=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC),primary=ranges[0];if((lastSelection==null?void 0:lastSelection.startOffset)===(primary==null?void 0:primary.startOffset)&&(lastSelection==null?void 0:lastSelection.endOffset)===(primary==null?void 0:primary.endOffset))return;if(lastSelection=primary,primary&&doc){const{startOffset,endOffset,collapsed}=primary;let customRange;if(collapsed?customRange=(_b2=(_a2=doc.getBody())==null?void 0:_a2.customDecorations)==null?void 0:_b2.find(value=>value.startIndex<=startOffset&&value.endIndex>=endOffset-1):customRange=(_d2=(_c2=doc.getBody())==null?void 0:_c2.customDecorations)==null?void 0:_d2.find(value=>value.startIndex<=startOffset&&value.endIndex>=endOffset-1),customRange){const comment=this._threadCommentModel.getComment(unitId,DEFAULT_DOC_SUBUNIT_ID,customRange.id);comment&&!comment.resolved&&this._commandService.executeCommand(ShowCommentPanelOperation.id,{activeComment:{unitId,subUnitId:DEFAULT_DOC_SUBUNIT_ID,commentId:customRange.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;this._commandService.executeCommand(threadCommentUi.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(activeComment=>{var _a2,_b2,_c2,_d2;if(activeComment){const doc=this._univerInstanceService.getUnit(activeComment.unitId);if(doc){const backScrollController=(_a2=this._renderManagerService.getRenderById(activeComment.unitId))==null?void 0:_a2.with(docsUi.DocBackScrollRenderController),customRange=(_c2=(_b2=doc.getBody())==null?void 0:_b2.customDecorations)==null?void 0:_c2.find(range=>range.id===activeComment.commentId);customRange&&backScrollController&&backScrollController.scrollToRange({startOffset:customRange.startIndex,endOffset:customRange.endIndex,collapsed:!1})}}(!activeComment||activeComment.commentId!==((_d2=this._docThreadCommentService.addingComment)==null?void 0:_d2.id))&&this._docThreadCommentService.endAdd()}))}},__name(_c,"DocThreadCommentSelectionController"),_c);DocThreadCommentSelectionController=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Rendered,DocThreadCommentSelectionController),__decorateParam$2(0,core.Inject(threadCommentUi.ThreadCommentPanelService)),__decorateParam$2(1,core.IUniverInstanceService),__decorateParam$2(2,core.ICommandService),__decorateParam$2(3,core.Inject(DocThreadCommentService)),__decorateParam$2(4,engineRender.IRenderManagerService),__decorateParam$2(5,core.Inject(threadComment.ThreadCommentModel))],DocThreadCommentSelectionController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");let DocThreadCommentRenderController=(_d=class extends core.Disposable{constructor(_context,_docInterceptorService,_threadCommentPanelService,_docRenderController,_univerInstanceService,_threadCommentModel){super(),this._context=_context,this._docInterceptorService=_docInterceptorService,this._threadCommentPanelService=_threadCommentPanelService,this._docRenderController=_docRenderController,this._univerInstanceService=_univerInstanceService,this._threadCommentModel=_threadCommentModel,this._interceptorViewModel(),this._initReRender()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(activeComment=>{var _a2;if(activeComment){this._docRenderController.reRender(activeComment.unitId);return}const unitId=(_a2=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC))==null?void 0:_a2.getUnitId();unitId&&this._docRenderController.reRender(unitId)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(update=>{update.type==="resolve"&&this._docRenderController.reRender(update.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(docs.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:__name((data,pos,next)=>{if(!data)return next(data);const{unitId,index,customDecorations}=pos,activeComment=this._threadCommentPanelService.activeCommentId,{commentId,unitId:commentUnitID}=activeComment||{},activeCustomDecoration=customDecorations.find(i=>i.id===commentId),comment=this._threadCommentModel.getComment(unitId,DEFAULT_DOC_SUBUNIT_ID,data.id);if(!comment)return next({...data,show:!1});const isActiveIndex=activeCustomDecoration&&index>=activeCustomDecoration.startIndex&&index<=activeCustomDecoration.endIndex,isActive=commentUnitID===unitId&&data.id===commentId;return next({...data,active:isActive||isActiveIndex,show:!comment.resolved})},"handler")})}},__name(_d,"DocThreadCommentRenderController"),_d);DocThreadCommentRenderController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Starting,DocThreadCommentRenderController),__decorateParam$1(1,core.Inject(docs.DocInterceptorService)),__decorateParam$1(2,core.Inject(threadCommentUi.ThreadCommentPanelService)),__decorateParam$1(3,core.Inject(docsUi.DocRenderController)),__decorateParam$1(4,core.IUniverInstanceService),__decorateParam$1(5,core.Inject(threadComment.ThreadCommentModel))],DocThreadCommentRenderController);const PLUGIN_CONFIG_KEY="docs-thread-comment-ui.config",defaultPluginConfig={};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");exports2.UniverDocsThreadCommentUIPlugin=(_e=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_renderManagerSrv,_configService){super(),this._config=_config,this._injector=_injector,this._renderManagerSrv=_renderManagerSrv,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[DocThreadCommentUIController],[DocThreadCommentSelectionController],[DocThreadCommentService]].forEach(dep=>{this._injector.add(dep)})}onRendered(){this._initRenderModule()}_initRenderModule(){[DocThreadCommentRenderController].forEach(dep=>{this._renderManagerSrv.registerRenderModule(core.UniverInstanceType.UNIVER_DOC,dep)})}},__name(_e,"UniverDocsThreadCommentUIPlugin"),_e),__publicField2(exports2.UniverDocsThreadCommentUIPlugin,"pluginName",PLUGIN_NAME),__publicField2(exports2.UniverDocsThreadCommentUIPlugin,"type",core.UniverInstanceType.UNIVER_DOC),exports2.UniverDocsThreadCommentUIPlugin=__decorateClass([core.DependentOn(threadCommentUi.UniverThreadCommentUIPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,engineRender.IRenderManagerService),__decorateParam(3,core.IConfigService)],exports2.UniverDocsThreadCommentUIPlugin),exports2.AddDocCommentComment=AddDocCommentComment,exports2.DeleteDocCommentComment=DeleteDocCommentComment,exports2.ShowCommentPanelOperation=ShowCommentPanelOperation,exports2.StartAddCommentOperation=StartAddCommentOperation,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
1
+ function _0x2884(_0x3bbe3a,_0x1a5921){var _0x317931=_0x3179();return _0x2884=function(_0x2884fb,_0x5de9a7){_0x2884fb=_0x2884fb-0x11a;var _0x2bd458=_0x317931[_0x2884fb];return _0x2bd458;},_0x2884(_0x3bbe3a,_0x1a5921);}(function(_0x3ed9e9,_0x161a60){var _0x32c9d1=_0x2884,_0x50b2ce=_0x3ed9e9();while(!![]){try{var _0x4a801b=-parseInt(_0x32c9d1(0x124))/0x1+-parseInt(_0x32c9d1(0x151))/0x2*(-parseInt(_0x32c9d1(0x139))/0x3)+-parseInt(_0x32c9d1(0x199))/0x4*(-parseInt(_0x32c9d1(0x19e))/0x5)+-parseInt(_0x32c9d1(0x1e9))/0x6+-parseInt(_0x32c9d1(0x146))/0x7+parseInt(_0x32c9d1(0x12b))/0x8*(-parseInt(_0x32c9d1(0x127))/0x9)+parseInt(_0x32c9d1(0x136))/0xa*(parseInt(_0x32c9d1(0x211))/0xb);if(_0x4a801b===_0x161a60)break;else _0x50b2ce['push'](_0x50b2ce['shift']());}catch(_0x34d966){_0x50b2ce['push'](_0x50b2ce['shift']());}}}(_0x3179,0xee9a8),function(_0x33ae75,_0x4e7255){var _0x10e85c=_0x2884;typeof exports==_0x10e85c(0x21a)&&typeof module<'u'?_0x4e7255(exports,require('@univerjs/core'),require('@univerjs/engine-render'),require(_0x10e85c(0x1eb)),require(_0x10e85c(0x172)),require('@univerjs/docs-ui'),require(_0x10e85c(0x1b0)),require(_0x10e85c(0x191)),require(_0x10e85c(0x212)),require(_0x10e85c(0x19f))):typeof define==_0x10e85c(0x184)&&define[_0x10e85c(0x1d3)]?define([_0x10e85c(0x1a4),_0x10e85c(0x121),_0x10e85c(0x1df),_0x10e85c(0x1eb),'@univerjs/docs',_0x10e85c(0x1a2),'@univerjs/thread-comment','@univerjs/ui','rxjs',_0x10e85c(0x19f)],_0x4e7255):(_0x33ae75=typeof globalThis<'u'?globalThis:_0x33ae75||self,_0x4e7255(_0x33ae75[_0x10e85c(0x141)]={},_0x33ae75['UniverCore'],_0x33ae75[_0x10e85c(0x1f8)],_0x33ae75['UniverThreadCommentUi'],_0x33ae75['UniverDocs'],_0x33ae75[_0x10e85c(0x1cc)],_0x33ae75[_0x10e85c(0x126)],_0x33ae75['UniverUi'],_0x33ae75[_0x10e85c(0x212)],_0x33ae75[_0x10e85c(0x1ef)]));}(this,function(_0x2b8852,_0x44ebeb,_0x2615a9,_0x4f8117,_0x552a43,_0x542d70,_0x465787,_0x305256,_0x7a1bf5,_0x112c86){'use strict';var _0x2cd4f0=_0x2884;var _0xbac21=Object['defineProperty'],_0x3466fb=(_0x2f4fd1,_0x2af634,_0xcd27b8)=>_0x2af634 in _0x2f4fd1?_0xbac21(_0x2f4fd1,_0x2af634,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0xcd27b8}):_0x2f4fd1[_0x2af634]=_0xcd27b8,_0x2be698=(_0x3c6001,_0x32ef50)=>_0xbac21(_0x3c6001,_0x2cd4f0(0x181),{'value':_0x32ef50,'configurable':!0x0}),_0x1bd200=(_0x3d9ebb,_0xaa7b32,_0x3d1db1)=>_0x3466fb(_0x3d9ebb,typeof _0xaa7b32!='symbol'?_0xaa7b32+'':_0xaa7b32,_0x3d1db1),_0x44a9b2,_0x50ef99,_0x161ac3,_0xefc3bc,_0x42a903;const _0x50a9d7='DOC_THREAD_COMMENT_UI_PLUGIN',_0x14be74=_0x2cd4f0(0x14b),_0x2c595f=_0x2cd4f0(0x182),_0x158bf1={};var _0x229e45=Object[_0x2cd4f0(0x1b3)],_0x3da3d1=Object['getOwnPropertyDescriptor'],_0x4ebab2=_0x2be698((_0x39cf65,_0x9fd970,_0x2adf38,_0x28ad32)=>{var _0x346315=_0x2cd4f0;for(var _0x4da523=_0x28ad32>0x1?void 0x0:_0x28ad32?_0x3da3d1(_0x9fd970,_0x2adf38):_0x9fd970,_0x2aebb8=_0x39cf65[_0x346315(0x13d)]-0x1,_0x17a4c8;_0x2aebb8>=0x0;_0x2aebb8--)(_0x17a4c8=_0x39cf65[_0x2aebb8])&&(_0x4da523=(_0x28ad32?_0x17a4c8(_0x9fd970,_0x2adf38,_0x4da523):_0x17a4c8(_0x4da523))||_0x4da523);return _0x28ad32&&_0x4da523&&_0x229e45(_0x9fd970,_0x2adf38,_0x4da523),_0x4da523;},_0x2cd4f0(0x1ca)),_0x268d20=_0x2be698((_0x23ba48,_0x3f4185)=>(_0x58fe2f,_0x1f8b20)=>_0x3f4185(_0x58fe2f,_0x1f8b20,_0x23ba48),_0x2cd4f0(0x150));let _0x2ab4a4=(_0x44a9b2=class extends _0x44ebeb['Disposable']{constructor(_0x1822c3,_0xe2d2d5){var _0x2c0f4f=_0x2cd4f0;super(),_0x1bd200(this,_0x2c0f4f(0x137),new _0x7a1bf5[(_0x2c0f4f(0x13a))](void 0x0)),_0x1bd200(this,_0x2c0f4f(0x15d),this['_addingComment$']['asObservable']()),(this[_0x2c0f4f(0x1ec)]=_0x1822c3,this[_0x2c0f4f(0x1f4)]=_0xe2d2d5,this[_0x2c0f4f(0x1da)](()=>{var _0x233723=_0x2c0f4f;this[_0x233723(0x137)]['complete']();}));}get['addingComment'](){var _0x5e6951=_0x2cd4f0;return this[_0x5e6951(0x137)]['getValue']();}['startAdd'](_0x2d9be2){var _0x9d745=_0x2cd4f0;this[_0x9d745(0x137)][_0x9d745(0x202)](_0x2d9be2);}[_0x2cd4f0(0x12e)](){var _0x1a711c=_0x2cd4f0;this[_0x1a711c(0x137)][_0x1a711c(0x202)](void 0x0);}},_0x2be698(_0x44a9b2,_0x2cd4f0(0x1fa)),_0x44a9b2);_0x2ab4a4=_0x4ebab2([_0x268d20(0x0,_0x305256[_0x2cd4f0(0x123)]),_0x268d20(0x1,_0x44ebeb[_0x2cd4f0(0x13b)](_0x4f8117[_0x2cd4f0(0x1c4)]))],_0x2ab4a4);const _0x3c552b={'id':_0x2cd4f0(0x20d),'type':_0x44ebeb[_0x2cd4f0(0x198)]['COMMAND'],async 'handler'(_0x22d887,_0x145458){var _0x58f7d1=_0x2cd4f0;if(!_0x145458)return!0x1;const {comment:_0x17b6b4,unitId:_0x41ec38}=_0x145458,_0x4081cc=await _0x22d887['get'](_0x465787[_0x58f7d1(0x135)])[_0x58f7d1(0x132)](_0x17b6b4),_0x3dd534=_0x22d887['get'](_0x44ebeb['ICommandService']),_0x44d4bc=_0x542d70[_0x58f7d1(0x11e)](_0x22d887,{'id':_0x4081cc['id'],'type':_0x44ebeb[_0x58f7d1(0x11a)][_0x58f7d1(0x20a)]});if(_0x44d4bc){const _0x330947={'id':_0x465787[_0x58f7d1(0x1dc)]['id'],'params':{'unitId':_0x41ec38,'subUnitId':_0x14be74,'comment':_0x4081cc}},_0x312ba1={'id':_0x4f8117[_0x58f7d1(0x1d9)]['id'],'params':{'unitId':_0x41ec38,'subUnitId':_0x14be74,'commentId':_0x4081cc['id']}};return(await _0x44ebeb[_0x58f7d1(0x168)]([_0x330947,_0x44d4bc,_0x312ba1],_0x3dd534))[_0x58f7d1(0x1b8)];}return!0x1;}},_0x164290={'id':'docs.command.delete-comment','type':_0x44ebeb[_0x2cd4f0(0x198)][_0x2cd4f0(0x204)],async 'handler'(_0x1eebaf,_0x12c17c){var _0x316847=_0x2cd4f0;if(!_0x12c17c)return!0x1;const {commentId:_0x5510b2,unitId:_0x4a2664}=_0x12c17c,_0x37752d=_0x1eebaf['get'](_0x44ebeb['ICommandService']),_0x1621a8=_0x542d70[_0x316847(0x12f)](_0x1eebaf,{'id':_0x5510b2,'unitId':_0x4a2664});return _0x1621a8?(await _0x44ebeb[_0x316847(0x1f0)]([_0x1621a8],_0x37752d))[_0x316847(0x1b8)]:!0x1;}},_0x47a4b9=_0x2be698(_0x19bf80=>{var _0x351221=_0x2cd4f0;const _0x1cd838=_0x19bf80[_0x351221(0x1c7)](_0x2615a9[_0x351221(0x1e2)]),_0x55fc0a=_0x19bf80[_0x351221(0x1c7)](_0x552a43[_0x351221(0x12d)]),_0x3b9aef=_0x1cd838[_0x351221(0x1f6)](),_0x50e7d1=_0x3b9aef==null?void 0x0:_0x3b9aef[_0x351221(0x1d4)](_0x552a43['DocSkeletonManagerService'])['getSkeleton'](),_0x24421c=_0x50e7d1==null?void 0x0:_0x50e7d1[_0x351221(0x178)]()['getEditArea']();if(_0x24421c===_0x2615a9[_0x351221(0x159)][_0x351221(0x16b)]||_0x24421c===_0x2615a9[_0x351221(0x159)][_0x351221(0x1f1)])return!0x0;const _0x5b9d11=_0x55fc0a[_0x351221(0x165)]();return!!(_0x5b9d11==null||_0x5b9d11[_0x351221(0x214)]);},'shouldDisableAddComment');function _0x3ba924(_0x377af8){var _0x9c533f=_0x2cd4f0;return{'id':_0x581523['id'],'type':_0x305256[_0x9c533f(0x206)]['BUTTON'],'icon':_0x9c533f(0x163),'title':'threadCommentUI.panel.addComment','tooltip':_0x9c533f(0x1b5),'hidden$':_0x305256[_0x9c533f(0x18f)](_0x377af8,_0x44ebeb[_0x9c533f(0x1e1)][_0x9c533f(0x16c)]),'disabled$':new _0x7a1bf5[(_0x9c533f(0x1ed))](function(_0x24f2a3){var _0x51a723=_0x9c533f;const _0x1f2e3a=_0x377af8[_0x51a723(0x1c7)](_0x552a43[_0x51a723(0x12d)])[_0x51a723(0x1fe)][_0x51a723(0x1ee)](_0x7a1bf5['debounceTime'](0x10))['subscribe'](()=>{var _0x10802f=_0x51a723;_0x24f2a3[_0x10802f(0x202)](_0x47a4b9(_0x377af8));});return()=>{var _0x4b61b8=_0x51a723;_0x1f2e3a[_0x4b61b8(0x201)]();};})};}_0x2be698(_0x3ba924,_0x2cd4f0(0x166));function _0x1e8090(_0x2047f6){var _0x4976db=_0x2cd4f0;return{'id':_0x1c7e01['id'],'type':_0x305256[_0x4976db(0x206)]['BUTTON'],'icon':_0x4976db(0x163),'title':_0x4976db(0x1b5),'tooltip':'threadCommentUI.panel.addComment','hidden$':_0x305256[_0x4976db(0x18f)](_0x2047f6,_0x44ebeb[_0x4976db(0x1e1)][_0x4976db(0x16c)])};}_0x2be698(_0x1e8090,_0x2cd4f0(0x1ac));const _0x538023=_0x2be698(()=>{var _0x2cac62=_0x2cd4f0;const _0x4a834d=_0x44ebeb['useDependency'](_0x44ebeb[_0x2cac62(0x213)]),_0x2cbecb=_0x44ebeb['useDependency'](_0x44ebeb[_0x2cac62(0x156)]),_0x6d2aea=_0x112c86[_0x2cac62(0x147)](()=>_0x4a834d[_0x2cac62(0x1a6)](_0x44ebeb['UniverInstanceType'][_0x2cac62(0x16c)]),[_0x4a834d]),_0x172318=_0x44ebeb[_0x2cac62(0x185)](_0x6d2aea),_0x2f28da=_0x112c86[_0x2cac62(0x147)](()=>new _0x7a1bf5[(_0x2cac62(0x1ed))](_0x13276d=>_0x13276d[_0x2cac62(0x202)](_0x14be74)),[]),_0x34989b=_0x44ebeb[_0x2cac62(0x16a)](_0x552a43[_0x2cac62(0x12d)]),_0x53fc5a=_0x112c86['useMemo'](()=>_0x34989b[_0x2cac62(0x1fe)][_0x2cac62(0x1ee)](_0x7a1bf5['debounceTime'](0x10)),[_0x34989b[_0x2cac62(0x1fe)]]);_0x44ebeb[_0x2cac62(0x185)](_0x53fc5a);const _0x399412=_0x44ebeb[_0x2cac62(0x16a)](_0x44ebeb[_0x2cac62(0x144)]),_0x36ba94=_0x44ebeb[_0x2cac62(0x16a)](_0x2ab4a4),_0x3f965c=_0x44ebeb[_0x2cac62(0x185)](_0x36ba94[_0x2cac62(0x15d)]),[_0x5a12fb,_0x388e99]=_0x112c86['useState']([]);if(_0x112c86['useEffect'](()=>{var _0x49503a=_0x2cac62,_0x2cf17e;const _0x5b8fa4=new Set(),_0x20a75e=_0x172318==null?void 0x0:_0x172318[_0x49503a(0x1dd)]();_0x388e99((_0x2cf17e=_0x20a75e==null?void 0x0:_0x20a75e[_0x49503a(0x11b)](_0x4718d7=>_0x4718d7['id'])[_0x49503a(0x1ad)](_0x4f1395=>{var _0x17d3ed=_0x49503a;const _0x11c069=_0x5b8fa4[_0x17d3ed(0x190)](_0x4f1395);return _0x5b8fa4[_0x17d3ed(0x1d5)](_0x4f1395),!_0x11c069;}))!=null?_0x2cf17e:[]);const _0x3e6dc7=_0x399412[_0x49503a(0x15e)](_0x504e51=>{var _0x5b538d=_0x49503a,_0x24ea87;if(_0x504e51['id']===_0x552a43[_0x5b538d(0x131)]['id']){const _0x2e5e79=new Set(),_0xf91d92=_0x172318==null?void 0x0:_0x172318[_0x5b538d(0x1dd)]();_0x388e99((_0x24ea87=_0xf91d92==null?void 0x0:_0xf91d92[_0x5b538d(0x11b)](_0x283cb4=>_0x283cb4['id'])[_0x5b538d(0x1ad)](_0x4024dc=>{var _0x57e806=_0x5b538d;const _0x2a3d52=_0x2e5e79['has'](_0x4024dc);return _0x2e5e79[_0x57e806(0x1d5)](_0x4024dc),!_0x2a3d52;}))!=null?_0x24ea87:[]);}});return()=>{var _0xa9e485=_0x49503a;_0x3e6dc7[_0xa9e485(0x16d)]();};},[_0x399412,_0x172318]),!_0x172318)return null;const _0x1f349b=_0x47a4b9(_0x2cbecb),_0x1a73b1=_0x172318[_0x2cac62(0x1a3)]();return _0x112c86[_0x2cac62(0x17f)](_0x4f8117[_0x2cac62(0x1f7)],{'unitId':_0x1a73b1,'subUnitId$':_0x2f28da,'type':_0x44ebeb[_0x2cac62(0x1e1)][_0x2cac62(0x16c)],'onAdd':_0x2be698(()=>{var _0x496038=_0x2cac62;_0x399412[_0x496038(0x186)](_0x581523['id']);},_0x2cac62(0x130)),'getSubUnitName':_0x2be698(()=>'',_0x2cac62(0x208)),'disableAdd':_0x1f349b,'tempComment':_0x3f965c,'onAddComment':_0x2be698(_0x2d87d9=>{var _0x37ea2a=_0x2cac62;if(!_0x2d87d9['parentId']){const _0x5cbf28={'unitId':_0x1a73b1,'range':_0x3f965c,'comment':_0x2d87d9};return _0x399412[_0x37ea2a(0x186)](_0x3c552b['id'],_0x5cbf28),_0x36ba94['endAdd'](),!0x1;}return!0x0;},_0x2cac62(0x1db)),'onDeleteComment':_0x2be698(_0x43f2b7=>{var _0x1ab3c6=_0x2cac62;if(!_0x43f2b7[_0x1ab3c6(0x217)]){const _0x2407e3={'unitId':_0x1a73b1,'commentId':_0x43f2b7['id']};return _0x399412[_0x1ab3c6(0x186)](_0x164290['id'],_0x2407e3),!0x1;}return!0x0;},_0x2cac62(0x189)),'showComments':_0x5a12fb});},_0x2cd4f0(0x13c));_0x538023[_0x2cd4f0(0x1c0)]=_0x2cd4f0(0x1a8);const _0x2ffef8={'id':'docs.operation.show-comment-panel','type':_0x44ebeb[_0x2cd4f0(0x198)][_0x2cd4f0(0x1c8)],'handler'(_0x17f144,_0x16c4c1){var _0x4dc8c3=_0x2cd4f0,_0x4dd9ca;const _0x4068e6=_0x17f144[_0x4dc8c3(0x1c7)](_0x4f8117['ThreadCommentPanelService']),_0x2d7cbb=_0x17f144[_0x4dc8c3(0x1c7)](_0x305256[_0x4dc8c3(0x123)]);return(!_0x4068e6['panelVisible']||((_0x4dd9ca=_0x2d7cbb[_0x4dc8c3(0x180)][_0x4dc8c3(0x140)])==null?void 0x0:_0x4dd9ca[_0x4dc8c3(0x1a0)])!==_0x538023['componentKey'])&&(_0x2d7cbb['open']({'header':{'title':_0x4dc8c3(0x1c6)},'children':{'label':_0x538023[_0x4dc8c3(0x1c0)]},'width':0x140,'onClose':_0x2be698(()=>_0x4068e6[_0x4dc8c3(0x193)](!0x1),'onClose')}),_0x4068e6['setPanelVisible'](!0x0)),_0x16c4c1&&_0x4068e6[_0x4dc8c3(0x1e3)](_0x16c4c1==null?void 0x0:_0x16c4c1['activeComment']),!0x0;}},_0x1c7e01={'id':'docs.operation.toggle-comment-panel','type':_0x44ebeb['CommandType'][_0x2cd4f0(0x1c8)],'handler'(_0x25362d){var _0x100168=_0x2cd4f0,_0x2e493c;const _0xa91cf4=_0x25362d[_0x100168(0x1c7)](_0x4f8117[_0x100168(0x1c4)]),_0x1cd291=_0x25362d[_0x100168(0x1c7)](_0x305256[_0x100168(0x123)]);return!_0xa91cf4[_0x100168(0x148)]||((_0x2e493c=_0x1cd291[_0x100168(0x180)][_0x100168(0x140)])==null?void 0x0:_0x2e493c[_0x100168(0x1a0)])!==_0x538023['componentKey']?(_0x1cd291[_0x100168(0x14a)]({'header':{'title':'threadCommentUI.panel.title'},'children':{'label':_0x538023['componentKey']},'width':0x140,'onClose':_0x2be698(()=>_0xa91cf4['setPanelVisible'](!0x1),'onClose')}),_0xa91cf4[_0x100168(0x193)](!0x0)):(_0x1cd291['close'](),_0xa91cf4['setPanelVisible'](!0x1),_0xa91cf4['setActiveComment'](null)),!0x0;}},_0x581523={'id':_0x2cd4f0(0x1c9),'type':_0x44ebeb[_0x2cd4f0(0x198)][_0x2cd4f0(0x1c8)],'handler'(_0x30d1f8){var _0x4d793c=_0x2cd4f0,_0xe5b50d,_0x447762,_0x3eb69e;const _0x24f606=_0x30d1f8[_0x4d793c(0x1c7)](_0x4f8117[_0x4d793c(0x1c4)]),_0x2ea657=_0x30d1f8['get'](_0x44ebeb[_0x4d793c(0x213)])['getCurrentUnitForType'](_0x44ebeb[_0x4d793c(0x1e1)][_0x4d793c(0x16c)]),_0x1c180d=_0x30d1f8[_0x4d793c(0x1c7)](_0x552a43[_0x4d793c(0x12d)]),_0x3dde6e=_0x30d1f8[_0x4d793c(0x1c7)](_0x2615a9[_0x4d793c(0x1e2)]),_0x306c80=_0x30d1f8['get'](_0x44ebeb['UserManagerService']),_0x52a346=_0x30d1f8['get'](_0x2ab4a4),_0x4b1ba8=_0x30d1f8[_0x4d793c(0x1c7)](_0x44ebeb[_0x4d793c(0x144)]),_0x351931=_0x30d1f8['get'](_0x305256[_0x4d793c(0x123)]),_0x1e8294=_0x1c180d['getActiveTextRange']();if(!_0x2ea657||!_0x1e8294)return!0x1;const _0x599cec=(_0xe5b50d=_0x3dde6e['getRenderById'](_0x2ea657[_0x4d793c(0x1a3)]()))==null?void 0x0:_0xe5b50d[_0x4d793c(0x1d4)](_0x542d70[_0x4d793c(0x175)]);if(_0x1e8294[_0x4d793c(0x214)])return _0x24f606[_0x4d793c(0x148)]?(_0x24f606[_0x4d793c(0x193)](!0x1),_0x351931[_0x4d793c(0x173)]()):_0x4b1ba8[_0x4d793c(0x186)](_0x2ffef8['id']),!0x0;_0x4b1ba8['executeCommand'](_0x2ffef8['id']);const _0x415bc0=_0x2ea657[_0x4d793c(0x1a3)](),_0xe90ca0=((_0x3eb69e=(_0x447762=_0x2ea657['getBody']())==null?void 0x0:_0x447762[_0x4d793c(0x160)])!=null?_0x3eb69e:'')[_0x4d793c(0x143)](_0x1e8294[_0x4d793c(0x205)],_0x1e8294[_0x4d793c(0x1b4)]),_0xdb6730=_0x44ebeb['BuildTextUtils'][_0x4d793c(0x20e)][_0x4d793c(0x149)](_0xe90ca0),_0x2f7d08=_0x14be74,_0x15e2e2='',_0x5b8fdd={'unitId':_0x415bc0,'subUnitId':_0x2f7d08,'id':_0x15e2e2,'ref':_0xdb6730,'dT':_0x4f8117['getDT'](),'personId':_0x306c80[_0x4d793c(0x152)]()[_0x4d793c(0x15b)],'text':{'dataStream':'\x0d\x0a'},'startOffset':_0x1e8294['startOffset'],'endOffset':_0x1e8294[_0x4d793c(0x1b4)],'collapsed':!0x0,'threadId':_0x15e2e2};return _0x599cec==null||_0x599cec[_0x4d793c(0x1fc)](),_0x52a346[_0x4d793c(0x14e)](_0x5b8fdd),_0x24f606['setActiveComment']({'unitId':_0x415bc0,'subUnitId':_0x2f7d08,'commentId':_0x15e2e2}),!0x0;}};var _0x5b7567=Object[_0x2cd4f0(0x1b3)],_0x19a65d=Object[_0x2cd4f0(0x16f)],_0x3a9189=_0x2be698((_0x2015d5,_0x1894f8,_0x56e465,_0x13715c)=>{var _0x5f268f=_0x2cd4f0;for(var _0x408730=_0x13715c>0x1?void 0x0:_0x13715c?_0x19a65d(_0x1894f8,_0x56e465):_0x1894f8,_0x4591ed=_0x2015d5[_0x5f268f(0x13d)]-0x1,_0x273e26;_0x4591ed>=0x0;_0x4591ed--)(_0x273e26=_0x2015d5[_0x4591ed])&&(_0x408730=(_0x13715c?_0x273e26(_0x1894f8,_0x56e465,_0x408730):_0x273e26(_0x408730))||_0x408730);return _0x13715c&&_0x408730&&_0x5b7567(_0x1894f8,_0x56e465,_0x408730),_0x408730;},_0x2cd4f0(0x1ff)),_0x40c645=_0x2be698((_0x34e8ee,_0x42d68f)=>(_0x3f1624,_0x32cfee)=>_0x42d68f(_0x3f1624,_0x32cfee,_0x34e8ee),_0x2cd4f0(0x1d2));let _0x32021d=(_0x50ef99=class extends _0x44ebeb['Disposable']{constructor(_0x4b5c10,_0x351131,_0xf1ed45,_0x56b70c,_0x495d76,_0x1d004e){var _0xf16d93=_0x2cd4f0;super(),this['_threadCommentPanelService']=_0x4b5c10,this[_0xf16d93(0x18e)]=_0x351131,this[_0xf16d93(0x15a)]=_0xf1ed45,this['_docThreadCommentService']=_0x56b70c,this[_0xf16d93(0x17e)]=_0x495d76,this['_threadCommentModel']=_0x1d004e,this['_initSelectionChange'](),this[_0xf16d93(0x1af)]();}[_0x2cd4f0(0x18d)](){var _0x18ff9e=_0x2cd4f0;let _0x11630e;this[_0x18ff9e(0x1da)](this[_0x18ff9e(0x15a)]['onCommandExecuted'](_0x36b69a=>{var _0x237a2d=_0x18ff9e,_0x5bdab2,_0x40b7b1,_0x4ba629,_0x4a8ef5;if(_0x36b69a['id']===_0x552a43[_0x237a2d(0x164)]['id']){const _0x4da729=_0x36b69a['params'],{unitId:_0x41ee91,ranges:_0x371709}=_0x4da729,_0x14fc4a=this[_0x237a2d(0x18e)][_0x237a2d(0x15c)](_0x41ee91,_0x44ebeb[_0x237a2d(0x1e1)][_0x237a2d(0x16c)]),_0x171694=_0x371709[0x0];if((_0x11630e==null?void 0x0:_0x11630e[_0x237a2d(0x205)])===(_0x171694==null?void 0x0:_0x171694['startOffset'])&&(_0x11630e==null?void 0x0:_0x11630e[_0x237a2d(0x1b4)])===(_0x171694==null?void 0x0:_0x171694[_0x237a2d(0x1b4)]))return;if(_0x11630e=_0x171694,_0x171694&&_0x14fc4a){const {startOffset:_0x28d2c1,endOffset:_0x5944ef,collapsed:_0xa5a113}=_0x171694;let _0x5051ec;if(_0xa5a113?_0x5051ec=(_0x40b7b1=(_0x5bdab2=_0x14fc4a[_0x237a2d(0x134)]())==null?void 0x0:_0x5bdab2['customDecorations'])==null?void 0x0:_0x40b7b1[_0x237a2d(0x1e6)](_0x3e9e40=>_0x3e9e40[_0x237a2d(0x1a9)]<=_0x28d2c1&&_0x3e9e40['endIndex']>=_0x5944ef-0x1):_0x5051ec=(_0x4a8ef5=(_0x4ba629=_0x14fc4a[_0x237a2d(0x134)]())==null?void 0x0:_0x4ba629[_0x237a2d(0x1bd)])==null?void 0x0:_0x4a8ef5['find'](_0x3b65ab=>_0x3b65ab[_0x237a2d(0x1a9)]<=_0x28d2c1&&_0x3b65ab['endIndex']>=_0x5944ef-0x1),_0x5051ec){const _0x311749=this[_0x237a2d(0x207)][_0x237a2d(0x122)](_0x41ee91,_0x14be74,_0x5051ec['id']);_0x311749&&!_0x311749['resolved']&&this[_0x237a2d(0x15a)][_0x237a2d(0x186)](_0x2ffef8['id'],{'activeComment':{'unitId':_0x41ee91,'subUnitId':_0x14be74,'commentId':_0x5051ec['id']}});return;}}if(!this[_0x237a2d(0x1f4)][_0x237a2d(0x1ab)])return;this[_0x237a2d(0x15a)][_0x237a2d(0x186)](_0x4f8117[_0x237a2d(0x1d9)]['id']);}}));}[_0x2cd4f0(0x1af)](){var _0x2b3db9=_0x2cd4f0;this[_0x2b3db9(0x1da)](this[_0x2b3db9(0x1f4)]['activeCommentId$'][_0x2b3db9(0x133)](_0x32b750=>{var _0x37e8f9=_0x2b3db9,_0xb7e7ef,_0x1daa00,_0x12a3c9,_0x5c4231;if(_0x32b750){const _0x5f0819=this[_0x37e8f9(0x18e)][_0x37e8f9(0x15c)](_0x32b750[_0x37e8f9(0x13f)]);if(_0x5f0819){const _0x5c6b30=(_0xb7e7ef=this[_0x37e8f9(0x17e)][_0x37e8f9(0x15f)](_0x32b750[_0x37e8f9(0x13f)]))==null?void 0x0:_0xb7e7ef[_0x37e8f9(0x1d4)](_0x542d70['DocBackScrollRenderController']),_0x310474=(_0x12a3c9=(_0x1daa00=_0x5f0819[_0x37e8f9(0x134)]())==null?void 0x0:_0x1daa00['customDecorations'])==null?void 0x0:_0x12a3c9[_0x37e8f9(0x1e6)](_0x273753=>_0x273753['id']===_0x32b750[_0x37e8f9(0x1c3)]);_0x310474&&_0x5c6b30&&_0x5c6b30[_0x37e8f9(0x129)]({'startOffset':_0x310474[_0x37e8f9(0x1a9)],'endOffset':_0x310474[_0x37e8f9(0x1e0)],'collapsed':!0x1});}}(!_0x32b750||_0x32b750[_0x37e8f9(0x1c3)]!==((_0x5c4231=this[_0x37e8f9(0x18c)]['addingComment'])==null?void 0x0:_0x5c4231['id']))&&this['_docThreadCommentService'][_0x37e8f9(0x12e)]();}));}},_0x2be698(_0x50ef99,_0x2cd4f0(0x1d6)),_0x50ef99);_0x32021d=_0x3a9189([_0x40c645(0x0,_0x44ebeb['Inject'](_0x4f8117[_0x2cd4f0(0x1c4)])),_0x40c645(0x1,_0x44ebeb[_0x2cd4f0(0x213)]),_0x40c645(0x2,_0x44ebeb['ICommandService']),_0x40c645(0x3,_0x44ebeb[_0x2cd4f0(0x13b)](_0x2ab4a4)),_0x40c645(0x4,_0x2615a9[_0x2cd4f0(0x1e2)]),_0x40c645(0x5,_0x44ebeb[_0x2cd4f0(0x13b)](_0x465787['ThreadCommentModel']))],_0x32021d);var _0x37f9b0=function(){var _0x4ed1e6=_0x2cd4f0;return _0x37f9b0=Object[_0x4ed1e6(0x219)]||function(_0x49b5e9){var _0xc33b98=_0x4ed1e6;for(var _0x13c5f6,_0x8c6be0=0x1,_0x4e0075=arguments[_0xc33b98(0x13d)];_0x8c6be0<_0x4e0075;_0x8c6be0++){_0x13c5f6=arguments[_0x8c6be0];for(var _0x14d068 in _0x13c5f6)Object[_0xc33b98(0x176)]['hasOwnProperty'][_0xc33b98(0x161)](_0x13c5f6,_0x14d068)&&(_0x49b5e9[_0x14d068]=_0x13c5f6[_0x14d068]);}return _0x49b5e9;},_0x37f9b0[_0x4ed1e6(0x20f)](this,arguments);},_0x1b5c6c=function(_0x579a53,_0x26c7ad){var _0x2a7072=_0x2cd4f0,_0x286298={};for(var _0x5bc0f7 in _0x579a53)Object[_0x2a7072(0x176)][_0x2a7072(0x18b)][_0x2a7072(0x161)](_0x579a53,_0x5bc0f7)&&_0x26c7ad[_0x2a7072(0x209)](_0x5bc0f7)<0x0&&(_0x286298[_0x5bc0f7]=_0x579a53[_0x5bc0f7]);if(_0x579a53!=null&&typeof Object[_0x2a7072(0x1a7)]==_0x2a7072(0x184)){for(var _0x661ff6=0x0,_0x5bc0f7=Object[_0x2a7072(0x1a7)](_0x579a53);_0x661ff6<_0x5bc0f7[_0x2a7072(0x13d)];_0x661ff6++)_0x26c7ad[_0x2a7072(0x209)](_0x5bc0f7[_0x661ff6])<0x0&&Object[_0x2a7072(0x176)][_0x2a7072(0x177)]['call'](_0x579a53,_0x5bc0f7[_0x661ff6])&&(_0x286298[_0x5bc0f7[_0x661ff6]]=_0x579a53[_0x5bc0f7[_0x661ff6]]);}return _0x286298;},_0x2837a6=_0x112c86['forwardRef'](function(_0x3c35b9,_0x4ddd01){var _0x477851=_0x2cd4f0,_0xd002ca=_0x3c35b9[_0x477851(0x125)],_0x33604b=_0x3c35b9['id'],_0x1d75dd=_0x3c35b9[_0x477851(0x1d1)],_0x10af1f=_0x3c35b9['extend'],_0x9e1394=_0x1b5c6c(_0x3c35b9,[_0x477851(0x125),'id','className',_0x477851(0x187)]),_0x9869c4=_0x477851(0x1e8)['concat'](_0x33604b,'\x20')[_0x477851(0x1a1)](_0x1d75dd||'')[_0x477851(0x1f2)](),_0xedf0cd=_0x112c86['useRef']('_'[_0x477851(0x1a1)](_0x4a6558()));return _0x404d6c(_0xd002ca,''[_0x477851(0x1a1)](_0x33604b),{'defIds':_0xd002ca['defIds'],'idSuffix':_0xedf0cd[_0x477851(0x128)]},_0x37f9b0({'ref':_0x4ddd01,'className':_0x9869c4},_0x9e1394),_0x10af1f);});function _0x404d6c(_0x4e551b,_0x12af63,_0x510d2e,_0x701f76,_0x387447){var _0xe86a32=_0x2cd4f0;return _0x112c86[_0xe86a32(0x17f)](_0x4e551b[_0xe86a32(0x162)],_0x37f9b0(_0x37f9b0({'key':_0x12af63},_0x1c25db(_0x4e551b,_0x510d2e,_0x387447)),_0x701f76),(_0x144106(_0x4e551b,_0x510d2e)[_0xe86a32(0x140)]||[])[_0xe86a32(0x11b)](function(_0x4f85d1,_0x1873aa){var _0x4a05c5=_0xe86a32;return _0x404d6c(_0x4f85d1,''[_0x4a05c5(0x1a1)](_0x12af63,'-')[_0x4a05c5(0x1a1)](_0x4e551b[_0x4a05c5(0x162)],'-')[_0x4a05c5(0x1a1)](_0x1873aa),_0x510d2e,void 0x0,_0x387447);}));}_0x2be698(_0x404d6c,'render');function _0x1c25db(_0x1dc055,_0x1aaf05,_0x10c9c4){var _0x86bbfd=_0x2cd4f0,_0x1dc11a=_0x37f9b0({},_0x1dc055[_0x86bbfd(0x210)]);_0x10c9c4!=null&&_0x10c9c4[_0x86bbfd(0x1c2)]&&_0x1dc11a[_0x86bbfd(0x171)]===_0x86bbfd(0x1c2)&&(_0x1dc11a[_0x86bbfd(0x171)]=_0x10c9c4[_0x86bbfd(0x1c2)]);var _0x45dbd6=_0x1aaf05['defIds'];return!_0x45dbd6||_0x45dbd6[_0x86bbfd(0x13d)]===0x0||(_0x1dc055[_0x86bbfd(0x162)]===_0x86bbfd(0x197)&&_0x1dc11a[_0x86bbfd(0x196)]&&(_0x1dc11a[_0x86bbfd(0x196)]=_0x1dc11a[_0x86bbfd(0x196)]+_0x1aaf05[_0x86bbfd(0x1cd)]),Object[_0x86bbfd(0x21b)](_0x1dc11a)['forEach'](function(_0x4104e6){var _0x5a979a=_0x86bbfd,_0xf2fb02=_0x4104e6[0x0],_0x1643a5=_0x4104e6[0x1];typeof _0x1643a5==_0x5a979a(0x1de)&&(_0x1dc11a[_0xf2fb02]=_0x1643a5['replace'](/url\(#(.*)\)/,_0x5a979a(0x11d)[_0x5a979a(0x1a1)](_0x1aaf05[_0x5a979a(0x1cd)],')')));})),_0x1dc11a;}_0x2be698(_0x1c25db,'replaceRuntimeIdsAndExtInAttrs');function _0x144106(_0x20eb86,_0x1505ad){var _0x61c1d4=_0x2cd4f0,_0xb94959,_0x2c1053=_0x1505ad[_0x61c1d4(0x17a)];return!_0x2c1053||_0x2c1053[_0x61c1d4(0x13d)]===0x0?_0x20eb86:_0x20eb86[_0x61c1d4(0x162)]===_0x61c1d4(0x1d0)&&(!((_0xb94959=_0x20eb86['children'])===null||_0xb94959===void 0x0)&&_0xb94959[_0x61c1d4(0x13d)])?_0x37f9b0(_0x37f9b0({},_0x20eb86),{'children':_0x20eb86['children'][_0x61c1d4(0x11b)](function(_0x46df4f){var _0x244df9=_0x61c1d4;return typeof _0x46df4f[_0x244df9(0x210)]['id']==_0x244df9(0x1de)&&_0x2c1053&&_0x2c1053[_0x244df9(0x209)](_0x46df4f[_0x244df9(0x210)]['id'])>-0x1?_0x37f9b0(_0x37f9b0({},_0x46df4f),{'attrs':_0x37f9b0(_0x37f9b0({},_0x46df4f[_0x244df9(0x210)]),{'id':_0x46df4f[_0x244df9(0x210)]['id']+_0x1505ad[_0x244df9(0x1cd)]})}):_0x46df4f;})}):_0x20eb86;}_0x2be698(_0x144106,_0x2cd4f0(0x19b));function _0x4a6558(){var _0x1f8105=_0x2cd4f0;return Math[_0x1f8105(0x167)]()['toString'](0x24)[_0x1f8105(0x1ae)](0x2,0x8);}_0x2be698(_0x4a6558,_0x2cd4f0(0x17d)),_0x2837a6['displayName']=_0x2cd4f0(0x120);var _0x28cfb1={'tag':'svg','attrs':{'fill':_0x2cd4f0(0x169),'viewBox':_0x2cd4f0(0x17c),'width':_0x2cd4f0(0x1a5),'height':_0x2cd4f0(0x1a5)},'children':[{'tag':_0x2cd4f0(0x11f),'attrs':{'fill':_0x2cd4f0(0x13e),'d':_0x2cd4f0(0x174),'fillRule':_0x2cd4f0(0x1b6),'clipRule':_0x2cd4f0(0x1b6)}},{'tag':_0x2cd4f0(0x11f),'attrs':{'fill':'currentColor','d':'M5.83725\x206.78345C6.22188\x206.78345\x206.53368\x207.10742\x206.53368\x207.50706V8.41159C6.53368\x208.81123\x206.22188\x209.13521\x205.83725\x209.13521\x205.45263\x209.13521\x205.14082\x208.81123\x205.14082\x208.41159V7.50706C5.14082\x207.10742\x205.45263\x206.78345\x205.83725\x206.78345zM8.73904\x206.78345C9.12366\x206.78345\x209.43546\x207.10742\x209.43546\x207.50706V8.41159C9.43546\x208.81123\x209.12366\x209.13521\x208.73904\x209.13521\x208.35441\x209.13521\x208.04261\x208.81123\x208.04261\x208.41159V7.50706C8.04261\x207.10742\x208.35441\x206.78345\x208.73904\x206.78345zM11.6408\x206.78345C12.0254\x206.78345\x2012.3372\x207.10742\x2012.3372\x207.50706V8.41159C12.3372\x208.81123\x2012.0254\x209.13521\x2011.6408\x209.13521\x2011.2562\x209.13521\x2010.9444\x208.81123\x2010.9444\x208.41159V7.50706C10.9444\x207.10742\x2011.2562\x206.78345\x2011.6408\x206.78345z'}},{'tag':'path','attrs':{'fill':_0x2cd4f0(0x13e),'d':_0x2cd4f0(0x20c),'fillRule':_0x2cd4f0(0x1b6),'clipRule':_0x2cd4f0(0x1b6)}}]},_0x5be711=_0x112c86[_0x2cd4f0(0x1ba)](function(_0x1b4380,_0x4c1d8e){var _0x8f8ae8=_0x2cd4f0;return _0x112c86[_0x8f8ae8(0x17f)](_0x2837a6,Object[_0x8f8ae8(0x219)]({},_0x1b4380,{'id':'comment-single','ref':_0x4c1d8e,'icon':_0x28cfb1}));});_0x5be711['displayName']=_0x2cd4f0(0x163);const _0x18e8a4={[_0x305256['RibbonStartGroup'][_0x2cd4f0(0x1bf)]]:{[_0x1c7e01['id']]:{'order':0x1,'menuItemFactory':_0x1e8090}},[_0x305256[_0x2cd4f0(0x1bb)][_0x2cd4f0(0x18a)]]:{[_0x305256['ContextMenuGroup'][_0x2cd4f0(0x19d)]]:{[_0x581523['id']]:{'order':0x1,'menuItemFactory':_0x3ba924}}}};var _0x19d87e=Object[_0x2cd4f0(0x1b3)],_0xcae46a=Object[_0x2cd4f0(0x16f)],_0x1de0ca=_0x2be698((_0x5cda7d,_0x264459,_0x2d4941,_0x106c77)=>{var _0xba30b7=_0x2cd4f0;for(var _0x4de645=_0x106c77>0x1?void 0x0:_0x106c77?_0xcae46a(_0x264459,_0x2d4941):_0x264459,_0x28500a=_0x5cda7d[_0xba30b7(0x13d)]-0x1,_0x2141bf;_0x28500a>=0x0;_0x28500a--)(_0x2141bf=_0x5cda7d[_0x28500a])&&(_0x4de645=(_0x106c77?_0x2141bf(_0x264459,_0x2d4941,_0x4de645):_0x2141bf(_0x4de645))||_0x4de645);return _0x106c77&&_0x4de645&&_0x19d87e(_0x264459,_0x2d4941,_0x4de645),_0x4de645;},_0x2cd4f0(0x1aa)),_0x40ea24=_0x2be698((_0x180e60,_0xd79bb8)=>(_0x47a214,_0xd15a2)=>_0xd79bb8(_0x47a214,_0xd15a2,_0x180e60),_0x2cd4f0(0x203));let _0x9acbaf=(_0x161ac3=class extends _0x44ebeb[_0x2cd4f0(0x1d7)]{constructor(_0x4c4536,_0xfae3ad,_0x448717){var _0x4763ec=_0x2cd4f0;super(),this['_commandService']=_0x4c4536,this[_0x4763ec(0x1b7)]=_0xfae3ad,this['_componentManager']=_0x448717,this[_0x4763ec(0x1cb)](),this['_initMenus'](),this[_0x4763ec(0x1c1)]();}[_0x2cd4f0(0x1cb)](){[_0x3c552b,_0x164290,_0x2ffef8,_0x581523,_0x1c7e01]['forEach'](_0x730d09=>{var _0xd22e04=_0x2884;this[_0xd22e04(0x1da)](this[_0xd22e04(0x15a)][_0xd22e04(0x215)](_0x730d09));});}[_0x2cd4f0(0x218)](){var _0x288110=_0x2cd4f0;this[_0x288110(0x1b7)][_0x288110(0x11c)](_0x18e8a4);}['_initComponents'](){var _0x4bf3cb=_0x2cd4f0;[_0x538023]['forEach'](_0x52f2c8=>{var _0x4ed382=_0x2884;this[_0x4ed382(0x1da)](this[_0x4ed382(0x1ea)][_0x4ed382(0x145)](_0x52f2c8['componentKey'],_0x52f2c8));}),this['disposeWithMe'](this[_0x4bf3cb(0x1ea)][_0x4bf3cb(0x145)](_0x4bf3cb(0x163),_0x5be711));}},_0x2be698(_0x161ac3,_0x2cd4f0(0x195)),_0x161ac3);_0x9acbaf=_0x1de0ca([_0x40ea24(0x0,_0x44ebeb[_0x2cd4f0(0x144)]),_0x40ea24(0x1,_0x305256[_0x2cd4f0(0x1e4)]),_0x40ea24(0x2,_0x44ebeb[_0x2cd4f0(0x13b)](_0x305256[_0x2cd4f0(0x1b2)]))],_0x9acbaf);var _0x549792=Object[_0x2cd4f0(0x1b3)],_0xbccee1=Object[_0x2cd4f0(0x16f)],_0x41208d=_0x2be698((_0x1c0f78,_0x195ecc,_0x2aee38,_0x1d61ad)=>{var _0x39ad89=_0x2cd4f0;for(var _0x504000=_0x1d61ad>0x1?void 0x0:_0x1d61ad?_0xbccee1(_0x195ecc,_0x2aee38):_0x195ecc,_0xd052b2=_0x1c0f78[_0x39ad89(0x13d)]-0x1,_0x11d587;_0xd052b2>=0x0;_0xd052b2--)(_0x11d587=_0x1c0f78[_0xd052b2])&&(_0x504000=(_0x1d61ad?_0x11d587(_0x195ecc,_0x2aee38,_0x504000):_0x11d587(_0x504000))||_0x504000);return _0x1d61ad&&_0x504000&&_0x549792(_0x195ecc,_0x2aee38,_0x504000),_0x504000;},_0x2cd4f0(0x157)),_0x5e9e0e=_0x2be698((_0x364788,_0x3239b1)=>(_0x2e8334,_0x54ef4b)=>_0x3239b1(_0x2e8334,_0x54ef4b,_0x364788),'__decorateParam$1');let _0x4141b6=(_0xefc3bc=class extends _0x44ebeb[_0x2cd4f0(0x1d7)]{constructor(_0x35cb98,_0x288afb,_0xadbcb5,_0x5994e1,_0x5383a1,_0x577d8e){var _0x6e7008=_0x2cd4f0;super(),this[_0x6e7008(0x17b)]=_0x35cb98,this[_0x6e7008(0x1be)]=_0x288afb,this['_threadCommentPanelService']=_0xadbcb5,this['_docRenderController']=_0x5994e1,this[_0x6e7008(0x18e)]=_0x5383a1,this[_0x6e7008(0x207)]=_0x577d8e,this[_0x6e7008(0x14d)](),this[_0x6e7008(0x170)]();}[_0x2cd4f0(0x170)](){var _0x375d6c=_0x2cd4f0;this[_0x375d6c(0x1da)](this[_0x375d6c(0x1f4)]['activeCommentId$'][_0x375d6c(0x133)](_0x2059e6=>{var _0x241df1=_0x375d6c,_0x3ed580;if(_0x2059e6){this['_docRenderController']['reRender'](_0x2059e6[_0x241df1(0x13f)]);return;}const _0x30b41b=(_0x3ed580=this['_univerInstanceService'][_0x241df1(0x200)](_0x44ebeb[_0x241df1(0x1e1)][_0x241df1(0x16c)]))==null?void 0x0:_0x3ed580[_0x241df1(0x1a3)]();_0x30b41b&&this[_0x241df1(0x183)][_0x241df1(0x20b)](_0x30b41b);})),this[_0x375d6c(0x1da)](this[_0x375d6c(0x207)]['commentUpdate$'][_0x375d6c(0x133)](_0x251bc8=>{var _0x44da6d=_0x375d6c;_0x251bc8[_0x44da6d(0x1cf)]===_0x44da6d(0x1b9)&&this[_0x44da6d(0x183)][_0x44da6d(0x20b)](_0x251bc8['unitId']);}));}[_0x2cd4f0(0x14d)](){var _0x35584f=_0x2cd4f0;this[_0x35584f(0x1be)]['intercept'](_0x552a43[_0x35584f(0x188)][_0x35584f(0x1e7)],{'handler':_0x2be698((_0x32700d,_0x14f86c,_0xabe4a)=>{var _0x43b63d=_0x35584f;if(!_0x32700d)return _0xabe4a(_0x32700d);const {unitId:_0xfae838,index:_0x5221ea,customDecorations:_0x51a68e}=_0x14f86c,_0x1d9bd2=this[_0x43b63d(0x1f4)][_0x43b63d(0x1ab)],{commentId:_0x15d3fa,unitId:_0x33f142}=_0x1d9bd2||{},_0x103949=_0x51a68e[_0x43b63d(0x1e6)](_0x359cf0=>_0x359cf0['id']===_0x15d3fa),_0x45a66d=this[_0x43b63d(0x207)][_0x43b63d(0x122)](_0xfae838,_0x14be74,_0x32700d['id']);if(!_0x45a66d)return _0xabe4a({..._0x32700d,'show':!0x1});const _0x3fac4b=_0x103949&&_0x5221ea>=_0x103949[_0x43b63d(0x1a9)]&&_0x5221ea<=_0x103949[_0x43b63d(0x1e0)],_0xaf93e4=_0x33f142===_0xfae838&&_0x32700d['id']===_0x15d3fa;return _0xabe4a({..._0x32700d,'active':_0xaf93e4||_0x3fac4b,'show':!_0x45a66d['resolved']});},_0x35584f(0x153))});}},_0x2be698(_0xefc3bc,_0x2cd4f0(0x1f5)),_0xefc3bc);_0x4141b6=_0x41208d([_0x5e9e0e(0x1,_0x44ebeb['Inject'](_0x552a43[_0x2cd4f0(0x154)])),_0x5e9e0e(0x2,_0x44ebeb[_0x2cd4f0(0x13b)](_0x4f8117[_0x2cd4f0(0x1c4)])),_0x5e9e0e(0x3,_0x44ebeb[_0x2cd4f0(0x13b)](_0x542d70[_0x2cd4f0(0x14c)])),_0x5e9e0e(0x4,_0x44ebeb['IUniverInstanceService']),_0x5e9e0e(0x5,_0x44ebeb[_0x2cd4f0(0x13b)](_0x465787[_0x2cd4f0(0x179)]))],_0x4141b6);var _0x2e4733=Object[_0x2cd4f0(0x1b3)],_0x29a54c=Object[_0x2cd4f0(0x16f)],_0x1196f7=_0x2be698((_0x2cb76a,_0x331e27,_0x3ab457)=>_0x331e27 in _0x2cb76a?_0x2e4733(_0x2cb76a,_0x331e27,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x3ab457}):_0x2cb76a[_0x331e27]=_0x3ab457,_0x2cd4f0(0x19a)),_0x4f6952=_0x2be698((_0xa08c2e,_0x1f2f57,_0xe4e2ec,_0x3292ff)=>{var _0x4f0cd5=_0x2cd4f0;for(var _0xfd6406=_0x3292ff>0x1?void 0x0:_0x3292ff?_0x29a54c(_0x1f2f57,_0xe4e2ec):_0x1f2f57,_0x5430e5=_0xa08c2e[_0x4f0cd5(0x13d)]-0x1,_0x23cc2c;_0x5430e5>=0x0;_0x5430e5--)(_0x23cc2c=_0xa08c2e[_0x5430e5])&&(_0xfd6406=(_0x3292ff?_0x23cc2c(_0x1f2f57,_0xe4e2ec,_0xfd6406):_0x23cc2c(_0xfd6406))||_0xfd6406);return _0x3292ff&&_0xfd6406&&_0x2e4733(_0x1f2f57,_0xe4e2ec,_0xfd6406),_0xfd6406;},_0x2cd4f0(0x158)),_0x11a8c9=_0x2be698((_0x36a83f,_0x3788c0)=>(_0x86202f,_0x3be136)=>_0x3788c0(_0x86202f,_0x3be136,_0x36a83f),_0x2cd4f0(0x138)),_0x4c6770=_0x2be698((_0x13792d,_0x346bbc,_0x3ebdca)=>_0x1196f7(_0x13792d,typeof _0x346bbc!=_0x2cd4f0(0x16e)?_0x346bbc+'':_0x346bbc,_0x3ebdca),_0x2cd4f0(0x1f9));_0x2b8852[_0x2cd4f0(0x1e5)]=(_0x42a903=class extends _0x44ebeb[_0x2cd4f0(0x12c)]{constructor(_0x595379=_0x158bf1,_0x164019,_0x42ed4b,_0x4c81a0){var _0x4f5749=_0x2cd4f0;super(),this[_0x4f5749(0x194)]=_0x595379,this['_injector']=_0x164019,this[_0x4f5749(0x1fd)]=_0x42ed4b,this[_0x4f5749(0x1ce)]=_0x4c81a0;const {menu:_0x11cca2,..._0x2d552c}=this[_0x4f5749(0x194)];_0x11cca2&&this[_0x4f5749(0x1ce)][_0x4f5749(0x192)](_0x4f5749(0x155),_0x11cca2,{'merge':!0x0}),this['_configService']['setConfig'](_0x2c595f,_0x2d552c);}[_0x2cd4f0(0x1fb)](){var _0x5a06a2=_0x2cd4f0;[[_0x9acbaf],[_0x32021d],[_0x2ab4a4]][_0x5a06a2(0x19c)](_0x39b603=>{var _0x4de51e=_0x5a06a2;this[_0x4de51e(0x216)]['add'](_0x39b603);});}[_0x2cd4f0(0x1bc)](){var _0x4bbec5=_0x2cd4f0;this[_0x4bbec5(0x12a)](),this['_injector']['get'](_0x32021d),this[_0x4bbec5(0x216)][_0x4bbec5(0x1c7)](_0x9acbaf);}[_0x2cd4f0(0x12a)](){var _0x3bf6ef=_0x2cd4f0;[_0x4141b6][_0x3bf6ef(0x19c)](_0x352104=>{var _0x4572bf=_0x3bf6ef;this['_renderManagerSrv'][_0x4572bf(0x142)](_0x44ebeb[_0x4572bf(0x1e1)][_0x4572bf(0x16c)],_0x352104);});}},_0x2be698(_0x42a903,_0x2cd4f0(0x1e5)),_0x42a903),_0x4c6770(_0x2b8852[_0x2cd4f0(0x1e5)],_0x2cd4f0(0x14f),_0x50a9d7),_0x4c6770(_0x2b8852[_0x2cd4f0(0x1e5)],'type',_0x44ebeb[_0x2cd4f0(0x1e1)]['UNIVER_DOC']),_0x2b8852['UniverDocsThreadCommentUIPlugin']=_0x4f6952([_0x44ebeb[_0x2cd4f0(0x1b1)](_0x4f8117[_0x2cd4f0(0x1d8)]),_0x11a8c9(0x1,_0x44ebeb['Inject'](_0x44ebeb['Injector'])),_0x11a8c9(0x2,_0x2615a9[_0x2cd4f0(0x1e2)]),_0x11a8c9(0x3,_0x44ebeb['IConfigService'])],_0x2b8852[_0x2cd4f0(0x1e5)]),_0x2b8852['AddDocCommentComment']=_0x3c552b,_0x2b8852[_0x2cd4f0(0x1c5)]=_0x164290,_0x2b8852[_0x2cd4f0(0x1f3)]=_0x2ffef8,_0x2b8852['StartAddCommentOperation']=_0x581523,Object[_0x2cd4f0(0x1b3)](_0x2b8852,Symbol['toStringTag'],{'value':'Module'});}));function _0x3179(){var _0x4c86f5=['_configService','type','defs','className','__decorateParam$3','amd','with','add','DocThreadCommentSelectionController','Disposable','UniverThreadCommentUIPlugin','SetActiveCommentOperation','disposeWithMe','onAddComment','AddCommentMutation','getCustomDecorations','string','@univerjs/engine-render','endIndex','UniverInstanceType','IRenderManagerService','setActiveComment','IMenuManagerService','UniverDocsThreadCommentUIPlugin','find','CUSTOM_DECORATION','univerjs-icon\x20univerjs-icon-','4461402GPOmgN','_componentManager','@univerjs/thread-comment-ui','_sidebarService','Observable','pipe','React','sequenceExecute','HEADER','trim','ShowCommentPanelOperation','_threadCommentPanelService','DocThreadCommentRenderController','getCurrent','ThreadCommentPanel','UniverEngineRender','__publicField','DocThreadCommentService','onStarting','blurEditor','_renderManagerSrv','textSelection$','__decorateClass$3','getCurrentUnitForType','unsubscribe','next','__decorateParam$2','COMMAND','startOffset','MenuItemType','_threadCommentModel','getSubUnitName','indexOf','COMMENT','reRender','M1.84351\x203.41861C1.84351\x203.01861\x202.15531\x202.69434\x202.53993\x202.69434H14.9381C15.3228\x202.69434\x2015.6346\x203.01861\x2015.6346\x203.41861V12.4611C15.6346\x2012.8612\x2015.3228\x2013.1854\x2014.9381\x2013.1854H8.82117L6.06643\x2014.6179C5.85054\x2014.7301\x205.59416\x2014.7181\x205.38884\x2014.5862C5.18352\x2014.4542\x205.05855\x2014.2211\x205.05855\x2013.9701V13.1854H2.53993C2.15531\x2013.1854\x201.84351\x2012.8612\x201.84351\x2012.4611L1.84351\x203.41861ZM6.45141\x2012.7982L8.34531\x2012.0135C8.44201\x2011.9632\x208.54864\x2011.9371\x208.65676\x2011.9371H14.2417C14.3522\x2011.9371\x2014.4417\x2011.8475\x2014.4417\x2011.7371V4.14271C14.4417\x204.03225\x2014.3522\x203.94271\x2014.2417\x203.94271H3.23636C3.12591\x203.94271\x203.03636\x204.03225\x203.03636\x204.14271L3.03636\x2011.7371C3.03636\x2011.8475\x203.12591\x2011.9371\x203.23636\x2011.9371L5.75498\x2011.9371C6.1396\x2011.9371\x206.45141\x2012.0611\x206.45141\x2012.4611V12.7982Z','docs.command.add-comment','transform','apply','attrs','4847183utzvqt','rxjs','IUniverInstanceService','collapsed','registerCommand','_injector','parentId','_initMenus','assign','object','entries','CustomDecorationType','map','mergeMenu','url(#$1','addCustomDecorationBySelectionFactory','path','UniverIcon','@univerjs/core','getComment','ISidebarService','98836FynDuX','icon','UniverThreadComment','62469HSOGJc','current','scrollToRange','_initRenderModule','1712gvZNWw','Plugin','DocSelectionManagerService','endAdd','deleteCustomDecorationFactory','onAdd','RichTextEditingMutation','addComment','subscribe','getBody','IThreadCommentDataSourceService','40uftOwf','_addingComment$','__decorateParam','12aWjrpD','BehaviorSubject','Inject','DocThreadCommentPanel','length','currentColor','unitId','children','UniverDocsThreadCommentUi','registerRenderModule','slice','ICommandService','register','2323041iJmKQA','useMemo','panelVisible','getPlainText','open','default_doc','DocRenderController','_interceptorViewModel','startAdd','pluginName','__decorateParam$4','394502TvZgON','getCurrentUser','handler','DocInterceptorService','menu','Injector','__decorateClass$1','__decorateClass','DocumentEditArea','_commandService','userID','getUnit','addingComment$','onCommandExecuted','getRenderById','dataStream','call','tag','CommentSingle','SetTextSelectionsOperation','getActiveTextRange','AddDocCommentMenuItemFactory','random','sequenceExecuteAsync','none','useDependency','FOOTER','UNIVER_DOC','dispose','symbol','getOwnPropertyDescriptor','_initReRender','fill','@univerjs/docs','close','M5.83725\x206.78345C6.22188\x206.78345\x206.53368\x207.10742\x206.53368\x207.50706V8.41159C6.53368\x208.81123\x206.22188\x209.13521\x205.83725\x209.13521C5.45263\x209.13521\x205.14082\x208.81123\x205.14082\x208.41159V7.50706C5.14082\x207.10742\x205.45263\x206.78345\x205.83725\x206.78345ZM8.73904\x206.78345C9.12366\x206.78345\x209.43546\x207.10742\x209.43546\x207.50706V8.41159C9.43546\x208.81123\x209.12366\x209.13521\x208.73904\x209.13521C8.35441\x209.13521\x208.04261\x208.81123\x208.04261\x208.41159V7.50706C8.04261\x207.10742\x208.35441\x206.78345\x208.73904\x206.78345ZM11.6408\x206.78345C12.0254\x206.78345\x2012.3372\x207.10742\x2012.3372\x207.50706V8.41159C12.3372\x208.81123\x2012.0254\x209.13521\x2011.6408\x209.13521C11.2562\x209.13521\x2010.9444\x208.81123\x2010.9444\x208.41159V7.50706C10.9444\x207.10742\x2011.2562\x206.78345\x2011.6408\x206.78345Z','DocSelectionRenderService','prototype','propertyIsEnumerable','getViewModel','ThreadCommentModel','defIds','_context','0\x200\x2017\x2017','generateShortUuid','_renderManagerService','createElement','options','name','docs-thread-comment-ui.config','_docRenderController','function','useObservable','executeCommand','extend','DOC_INTERCEPTOR_POINT','onDeleteComment','MAIN_AREA','hasOwnProperty','_docThreadCommentService','_initSelectionChange','_univerInstanceService','getMenuHiddenObservable','has','@univerjs/ui','setConfig','setPanelVisible','_config','DocThreadCommentUIController','xlink:href','use','CommandType','16OqHOPy','__defNormalProp','replaceRuntimeIdsInDefs','forEach','DATA','1356680SHsXnR','react','label','concat','@univerjs/docs-ui','getUnitId','exports','1em','getCurrentTypeOfUnit$','getOwnPropertySymbols','univer.doc.thread-comment-panel','startIndex','__decorateClass$2','activeCommentId','ToolbarDocCommentMenuItemFactory','filter','substring','_initActiveCommandChange','@univerjs/thread-comment','DependentOn','ComponentManager','defineProperty','endOffset','threadCommentUI.panel.addComment','evenodd','_menuManagerService','result','resolve','forwardRef','ContextMenuPosition','onRendered','customDecorations','_docInterceptorService','OTHERS','componentKey','_initComponents','colorChannel1','commentId','ThreadCommentPanelService','DeleteDocCommentComment','threadCommentUI.panel.title','get','OPERATION','docs.operation.start-add-comment','__decorateClass$4','_initCommands','UniverDocsUi','idSuffix'];_0x3179=function(){return _0x4c86f5;};return _0x3179();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-thread-comment-ui",
3
- "version": "0.3.0-alpha.0",
3
+ "version": "0.3.0-nightly.202410101606",
4
4
  "private": false,
5
5
  "description": "Univer thread comment plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -46,23 +46,23 @@
46
46
  "peerDependencies": {
47
47
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
48
48
  "rxjs": ">=7.0.0",
49
- "@univerjs/core": "0.3.0-alpha.0",
50
- "@univerjs/docs": "0.3.0-alpha.0",
51
- "@univerjs/engine-render": "0.3.0-alpha.0",
52
- "@univerjs/docs-ui": "0.3.0-alpha.0",
53
- "@univerjs/thread-comment": "0.3.0-alpha.0",
54
- "@univerjs/thread-comment-ui": "0.3.0-alpha.0",
55
- "@univerjs/ui": "0.3.0-alpha.0"
49
+ "@univerjs/core": "0.3.0-nightly.202410101606",
50
+ "@univerjs/docs": "0.3.0-nightly.202410101606",
51
+ "@univerjs/docs-ui": "0.3.0-nightly.202410101606",
52
+ "@univerjs/thread-comment": "0.3.0-nightly.202410101606",
53
+ "@univerjs/engine-render": "0.3.0-nightly.202410101606",
54
+ "@univerjs/thread-comment-ui": "0.3.0-nightly.202410101606",
55
+ "@univerjs/ui": "0.3.0-nightly.202410101606"
56
56
  },
57
57
  "dependencies": {
58
58
  "@univerjs/icons": "^0.1.78",
59
59
  "clsx": "^2.1.1",
60
- "@univerjs/core": "0.3.0-alpha.0",
61
- "@univerjs/design": "0.3.0-alpha.0",
62
- "@univerjs/engine-formula": "0.3.0-alpha.0",
63
- "@univerjs/thread-comment": "0.3.0-alpha.0",
64
- "@univerjs/thread-comment-ui": "0.3.0-alpha.0",
65
- "@univerjs/ui": "0.3.0-alpha.0"
60
+ "@univerjs/core": "0.3.0-nightly.202410101606",
61
+ "@univerjs/design": "0.3.0-nightly.202410101606",
62
+ "@univerjs/engine-formula": "0.3.0-nightly.202410101606",
63
+ "@univerjs/thread-comment": "0.3.0-nightly.202410101606",
64
+ "@univerjs/thread-comment-ui": "0.3.0-nightly.202410101606",
65
+ "@univerjs/ui": "0.3.0-nightly.202410101606"
66
66
  },
67
67
  "devDependencies": {
68
68
  "react": "18.3.1",
@@ -70,7 +70,7 @@
70
70
  "typescript": "^5.6.2",
71
71
  "vite": "^5.4.8",
72
72
  "vitest": "^2.1.1",
73
- "@univerjs-infra/shared": "0.3.0-alpha.0"
73
+ "@univerjs-infra/shared": "0.3.0"
74
74
  },
75
75
  "univerSpace": {
76
76
  ".": {
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS