/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@univerjs/sheets-thread-comment-ui@0.20.0/lib/es/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{CommandType as e,DependentOn as t,Disposable as n,DisposableCollection as r,ICommandService as i,IConfigService as a,IUniverInstanceService as o,Inject as s,Injector as c,InterceptorEffectEnum as l,LocaleService as u,Plugin as d,RANGE_TYPE as f,Range as p,Rectangle as m,Tools as h,UniverInstanceType as g,merge as ee}from"@univerjs/core";import{INTERCEPTOR_POINT as te,RangeProtectionPermissionViewPoint as _,SetWorksheetActiveOperation as v,SheetInterceptorService as y,SheetPermissionCheckController as b,SheetsSelectionsService as ne,WorkbookCommentPermission as x,WorksheetViewPermission as S,getSheetCommandTarget as re}from"@univerjs/sheets";import{SheetsThreadCommentModel as C,UniverSheetsThreadCommentPlugin as ie}from"@univerjs/sheets-thread-comment";import{SetActiveCommentOperation as w,ThreadCommentPanel as ae,ThreadCommentPanelService as T,ThreadCommentTree as oe,ThreadCommentTreeLocation as se,UniverThreadCommentUIPlugin as ce,UniverThreadCommentUIPlugin as le}from"@univerjs/thread-comment-ui";import{ComponentManager as ue,ContextMenuGroup as de,ContextMenuPosition as fe,IMenuManagerService as pe,IShortcutService as me,ISidebarService as he,IZenZoneService as ge,KeyCode as _e,MenuItemType as E,MetaKeys as D,RibbonInsertGroup as ve,getMenuHiddenObservable as O,useDependency as k,useObservable as A}from"@univerjs/ui";import{COPY_TYPE as ye,CellPopupManagerService as be,HoverManagerService as xe,IEditorBridgeService as Se,IMarkSelectionService as j,ISheetClipboardService as Ce,ScrollToRangeOperation as we,SheetCanvasPopManagerService as Te,SheetSkeletonManagerService as Ee,getCurrentRangeDisable$ as M,whenSheetEditorFocused as De}from"@univerjs/sheets-ui";import{BehaviorSubject as Oe,debounceTime as N,map as ke}from"rxjs";import{IRenderManagerService as P}from"@univerjs/engine-render";import{serializeRange as Ae,singleReferenceToGrid as F}from"@univerjs/engine-formula";import{AddCommentCommand as je,AddCommentCommand as Me,AddCommentMutation as I,DeleteCommentCommand as Ne,DeleteCommentCommand as Pe,DeleteCommentMutation as L,DeleteCommentTreeCommand as Fe,DeleteCommentTreeCommand as Ie,IThreadCommentDataSourceService as Le,IThreadCommentDataSourceService as Re,ResolveCommentCommand as ze,ResolveCommentCommand as Be,UpdateCommentCommand as Ve,UpdateCommentCommand as He}from"@univerjs/thread-comment";import{CommentIcon as Ue}from"@univerjs/icons";import{jsx as R}from"react/jsx-runtime";import{useCallback as z,useEffect as We,useMemo as Ge,useRef as Ke}from"react";const qe=`univer.sheet.thread-comment-modal`,Je=`univer.sheet.thread-comment-panel`,Ye=`SHEET_THREAD_COMMENT_UI_PLUGIN`;function B(e){"@babel/helpers - typeof";return B=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},B(e)}function Xe(e,t){if(B(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(B(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ze(e){var t=Xe(e,`string`);return B(t)==`symbol`?t:t+``}function V(e,t,n){return(t=Ze(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t){return function(n,r){t(n,r,e)}}function U(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let W=class extends n{get activePopup(){return this._activePopup}constructor(e,t,n){super(),this._canvasPopupManagerService=e,this._zenZoneService=t,this._cellPopupManagerService=n,V(this,`_lastPopup`,null),V(this,`_activePopup`,void 0),V(this,`_activePopup$`,new Oe(null)),V(this,`activePopup$`,this._activePopup$.asObservable()),this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e&&this.hidePopup()}))}dispose(){super.dispose(),this.hidePopup()}showPopup(e,t){var n;let{row:i,col:a,unitId:o,subUnitId:s}=e;if(this._activePopup&&i===this._activePopup.row&&a===this._activePopup.col&&o===this._activePopup.unitId&&s===((n=this.activePopup)==null?void 0:n.subUnitId)){this._activePopup=e,this._activePopup$.next(e);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=e,this._activePopup$.next(e);let c=this._cellPopupManagerService.showPopup({row:i,col:a,unitId:o,subUnitId:s},{componentKey:qe,onClickOutside:()=>{this.hidePopup()},direction:`horizontal`,excludeOutside:[...Array.from(document.querySelectorAll(`.univer-thread-comment`)),document.getElementById(`thread-comment-add`)].filter(Boolean),priority:2});if(!c)throw Error(`[SheetsThreadCommentPopupService]: cannot show popup!`);let l=new r;l.add(c),l.add({dispose:()=>{t==null||t()}}),this._lastPopup=l}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}};W=U([H(0,s(Te)),H(1,ge),H(2,s(be))],W);const G={type:e.OPERATION,id:`sheet.operation.show-comment-modal`,handler(e){var t;let n=e.get(ne),r=e.get(o),i=e.get(W),a=e.get(T),s=(t=n.getCurrentLastSelection())==null?void 0:t.primary,c=e.get(C);if(!s)return!1;let l=re(r);if(!l)return!1;let{workbook:u,worksheet:d,unitId:f,subUnitId:p}=l,m={workbook:u,worksheet:d,unitId:f,subUnitId:p,row:s.startRow,col:s.startColumn};i.showPopup(m);let h=c.getByLocation(f,p,s.startRow,s.startColumn);return h&&a.setActiveComment({unitId:f,subUnitId:p,commentId:h,trigger:`context-menu`}),!0}},K={id:`sheet.operation.toggle-comment-panel`,type:e.OPERATION,handler(e){let t=e.get(he),n=e.get(T);return n.panelVisible?(t.close(),n.setPanelVisible(!1)):(t.open({header:{title:`threadCommentUI.panel.title`},children:{label:Je},width:360}),n.setPanelVisible(!0)),!0}};var Qe=`@univerjs/sheets-thread-comment-ui`,$e=`0.20.0`;const et=`sheets-thread-comment.config`;Symbol(et);const tt={};let q=class extends n{constructor(e,t,n,r){super(),this._sheetInterceptorService=e,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=r,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(te.CELL_CONTENT,{effect:l.Style,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t;return this._sheetsThreadCommentModel.showCommentMarker(a,o,r,i)?((!e||e===t.rawData)&&(e={...t.rawData}),e.markers={...e==null?void 0:e.markers,tr:{color:`#FFBD37`,size:6}},n(e)):n(e)},priority:100}))}_initSkeletonChange(){let e=()=>{var e;let t=this._univerInstanceService.getCurrentUnitForType(g.UNIVER_SHEET);if(!t)return;let n=t.getUnitId(),r=this._renderManagerService.getRenderById(n);r==null||(e=r.mainComponent)==null||e.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(N(16)).subscribe(()=>{e()}))}};q=U([H(0,s(y)),H(1,s(C)),H(2,o),H(3,P)],q);const nt=(e,t,n)=>{let r=F(e),i=n.row-t.row,a=n.column-t.column;return Ae({startColumn:r.column+a,startRow:r.row+i,endColumn:r.column+a,endRow:r.row+i})};let J=class extends n{constructor(e,t,n){super(),this._sheetClipboardService=e,this._sheetsThreadCommentModel=t,this._threadCommentDataSourceService=n,V(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Ye,onBeforeCopy:(e,t,n)=>{this._copyInfo={unitId:e,subUnitId:t,range:n}},onPasteCells:(e,t,n,r)=>{let{unitId:i,subUnitId:a,range:o}=t,s={row:o.rows[0],column:o.cols[0]};if(r.copyType===ye.CUT&&this._copyInfo){let{range:e,unitId:t,subUnitId:n}=this._copyInfo,r={row:e.startRow,column:e.startColumn};if(!(i===t&&a===n)){let o=[];p.foreach(e,(e,r)=>{let i=this._sheetsThreadCommentModel.getAllByLocation(t,n,e,r);this._threadCommentDataSourceService.syncUpdateMutationToColla?i.forEach(e=>{o.push(e)}):i.forEach(({children:e,...t})=>{t.parentId||o.push(t)})});let c=[],l=[],u=[],d=[],f=e=>{c.unshift({id:L.id,params:{unitId:t,subUnitId:n,commentId:e.id}}),u.push({id:I.id,params:{unitId:i,subUnitId:a,comment:{...e,ref:nt(e.ref,r,s),unitId:i,subUnitId:a},sync:!0}}),l.push({id:I.id,params:{unitId:t,subUnitId:n,comment:e,sync:!0}}),d.unshift({id:L.id,params:{unitId:i,subUnitId:a,commentId:e.id}})};return o.forEach(e=>{f(e)}),{redos:[...c,...u],undos:[...d,...l]}}}return{redos:[],undos:[]}}}))}};J=U([H(0,s(Ce)),H(1,s(C)),H(2,Re)],J);let Y=class extends n{constructor(e,t,n,r){super(),this._hoverManagerService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=r,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(N(100)).subscribe(e=>{let t=this._sheetsThreadCommentPopupService.activePopup;if(e&&(t&&t.temp||!t)){let{location:n}=e,{unitId:r,subUnitId:i,row:a,col:o}=n,s=this._sheetsThreadCommentModel.getByLocation(r,i,a,o);if(s){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]},[{startRow:a,startColumn:o,endRow:a,endColumn:o}],r,i))return;let e=this._sheetsThreadCommentModel.getComment(r,i,s);e&&!e.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:r,subUnitId:i,row:a,col:o,commentId:s,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Y=U([H(0,s(xe)),H(1,s(W)),H(2,s(C)),H(3,s(b))],Y);let X=class extends n{constructor(e,t,n,r){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._sheetsThreadCommentModel=r,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{let{id:t}=e;if(t===G.id||t===K.id)this._sheetPermissionCheckController.permissionCheckWithoutRange({workbookTypes:[x],worksheetTypes:[S]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`));else if(t===Me.id){let{unitId:t,subUnitId:n,comment:r}=e.params,{row:i,column:a}=F(r.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]},[{startRow:i,startColumn:a,endRow:i,endColumn:a}],t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`))}else if(t===He.id){let{unitId:t,subUnitId:n,payload:r}=e.params,{commentId:i}=r,a=this._sheetsThreadCommentModel.getComment(t,n,i);if(a){let{row:e,column:r}=F(a.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]},[{startRow:e,startColumn:r,endRow:e,endColumn:r}],t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`))}}else if(t===Be.id||t===Pe.id||t===Ie.id){let{unitId:t,subUnitId:n,commentId:r}=e.params,i=this._sheetsThreadCommentModel.getComment(t,n,r);if(i){let{row:e,column:r}=F(i.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]},[{startRow:e,startColumn:r,endRow:e,endColumn:r}],t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`))}}}))}};X=U([H(0,s(u)),H(1,i),H(2,s(b)),H(3,s(C))],X);let Z=class extends n{constructor(e,t,n,r,i,a,o,s,c,l){super(),this._commandService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionCheckController=a,this._markSelectionService=o,this._sheetSelectionService=s,this._editorBridgeService=c,this._renderManagerService=l,V(this,`_isSwitchToCommenting`,!1),V(this,`_selectionShapeInfo`,null),this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(e,t,n){var r,i,a;let o=(r=e[0])==null?void 0:r.range,s=this._renderManagerService.getRenderById(t),c=s==null||(i=s.with(Ee).getSkeletonParam(n))==null?void 0:i.skeleton;if(!c||!o)return;let l=c.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((a=o.rangeType)==null?f.NORMAL:a)!==f.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((l.isMerged||l.isMergedMainCell)&&m.equals(l.mergeInfo,o))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(w.id);return}let u=l.actualRow,d=l.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(t,n,u,d)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(w.id);return}let p=this._sheetsThreadCommentModel.getByLocation(t,n,u,d);p&&this._commandService.executeCommand(w.id,{unitId:t,subUnitId:n,commentId:p})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(e=>{if(this._isSwitchToCommenting)return;let t=this._sheetSelectionService.currentSelectionParam;t&&this._handleSelectionChange(e,t.unitId,t.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(e=>{if(e.id===L.id){let t=e.params,n=this._sheetsThreadCommentPopupService.activePopup;if(!n)return;let{unitId:r,subUnitId:i,commentId:a}=n;t.unitId===r&&t.subUnitId===i&&t.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async e=>{if(e){var t;let{unitId:n,subUnitId:r,commentId:i,trigger:a}=e,o=this._sheetsThreadCommentModel.getComment(n,r,i);if(!o||o.resolved)return;let s=this._univerInstanceService.getCurrentUnitForType(g.UNIVER_SHEET);if(!s||s.getUnitId()!==n)return;this._isSwitchToCommenting=!0,((t=s.getActiveSheet())==null?void 0:t.getSheetId())!==r&&await this._commandService.executeCommand(v.id,{unitId:n,subUnitId:r}),this._isSwitchToCommenting=!1;let c=F(o.ref),{row:l,column:u}=c;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]},[{startRow:l,startColumn:u,endRow:l,endColumn:u}],n,r)||(await this._commandService.executeCommand(we.id,{range:{startRow:Math.max(c.row-1,0),endRow:c.row+1,startColumn:Math.max(c.column-1,0),endColumn:c.column+1}}),this._editorBridgeService.isVisible().visible))return;this._sheetsThreadCommentPopupService.showPopup({unitId:n,subUnitId:r,row:c.row,col:c.column,commentId:o.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(N(100)).subscribe(e=>{var t,n;if(!e){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}let{unitId:r,subUnitId:i,commentId:a}=e;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);let o=this._sheetsThreadCommentModel.getComment(r,i,a);if(!o)return;let{row:s,column:c}=F(o.ref);if(Number.isNaN(s)||Number.isNaN(c))return null;let l=(t=this._univerInstanceService.getCurrentUnitForType(g.UNIVER_SHEET))==null?void 0:t.getSheetBySheetId(i),u=(n=l==null?void 0:l.getMergedCell(s,c))==null?{startColumn:c,endColumn:c,startRow:s,endRow:s}:n,d=this._markSelectionService.addShape({range:u,style:{fill:`rgba(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null},[],-1);d&&(this._selectionShapeInfo={...e,shapeId:d})}))}};Z=U([H(0,i),H(1,s(W)),H(2,s(C)),H(3,s(T)),H(4,o),H(5,s(b)),H(6,j),H(7,s(ne)),H(8,Se),H(9,P)],Z);const rt=e=>({id:G.id,type:E.BUTTON,icon:`CommentIcon`,title:`sheetThreadComment.menu.addComment`,hidden$:O(e,g.UNIVER_SHEET),disabled$:M(e,{workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]})}),it=e=>({id:K.id,type:E.BUTTON,icon:`CommentIcon`,tooltip:`sheetThreadComment.menu.commentManagement`,disabled$:M(e,{workbookTypes:[x],worksheetTypes:[S],rangeTypes:[_]}),hidden$:O(e,g.UNIVER_SHEET)}),at={id:G.id,binding:_e.M|D.CTRL_COMMAND|D.ALT,preconditions:De},ot={[ve.MEDIA]:{[K.id]:{order:2,menuItemFactory:it}},[fe.MAIN_AREA]:{[de.OTHERS]:{[G.id]:{order:0,menuItemFactory:rt}}}},st=()=>{let e=k(o),t=k(W),n=A(t.activePopup$),r=k(C);if(A(r.commentUpdate$),!n)return null;let{row:i,col:a,unitId:s,subUnitId:c,trigger:l}=n,u=r.getByLocation(s,c,i,a),d=`${h.chatAtABC(a)}${i+1}`;return R(oe,{onClick:()=>{t.persistPopup()},location:se.CELL,id:u,unitId:s,subUnitId:c,type:g.UNIVER_SHEET,refStr:d,onClose:()=>{t.hidePopup()},getSubUnitName:t=>{var n,r;return(n=(r=e.getCurrentUnitForType(g.UNIVER_SHEET))==null||(r=r.getSheetBySheetId(t))==null?void 0:r.getName())==null?``:n},autoFocus:l===`context-menu`})},ct=()=>{var e;let t=k(j),n=k(o),r=k(W),a=n.getCurrentUnitForType(g.UNIVER_SHEET),s=a.getUnitId(),c=k(i),l=Ge(()=>a.activeSheet$.pipe(ke(e=>e==null?void 0:e.getSheetId())),[a.activeSheet$]),u=A(l,(e=a.getActiveSheet())==null?void 0:e.getSheetId()),d=Ke(null),f=k(T),p=A(f.activeCommentId$),m=A(f.panelVisible$,f.panelVisible),h=z(e=>{let t=a.getSheets(),n={};t.forEach((e,t)=>{n[e.getSheetId()]=t});let r=e=>e.map(e=>{var t;let r=F(e.ref),i=[(t=n[e.subUnitId])==null?0:t,r.row,r.column];return{...e,p:i}}).sort((e,t)=>e.p[0]===t.p[0]?e.p[1]===t.p[1]?e.p[2]-t.p[2]:e.p[1]-t.p[1]:e.p[0]-t.p[0]);return[...r(e.filter(e=>!e.resolved)),...r(e.filter(e=>e.resolved))]},[a]),ee=z(e=>{if(e.unitId===s&&e.subUnitId===u&&!e.resolved){var n;let{row:r,column:i}=F(e.ref),o=a.getSheetBySheetId(e.subUnitId),s=(n=o==null?void 0:o.getMergedCell(r,i))==null?{startColumn:i,endColumn:i,startRow:r,endRow:r}:n;if(!Number.isNaN(r)&&!Number.isNaN(i))return t.addShape({range:s,style:{fill:`rgb(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null})}return null},[t,u,s]),te=e=>{var t,n;return(t=(n=a.getSheetBySheetId(e))==null?void 0:n.getName())==null?``:t},_=()=>{c.executeCommand(G.id)},v=e=>{p&&p.unitId===e.unitId&&p.subUnitId===e.subUnitId&&p.commentId===e.id||(d.current&&(t.removeShape(d.current),d.current=null),d.current=ee(e))},y=()=>{d.current&&(t.removeShape(d.current),d.current=null)};return We(()=>{!m&&d.current&&t.removeShape(d.current)},[t,m]),R(ae,{unitId:s,subUnitId$:l,type:g.UNIVER_SHEET,onAdd:_,getSubUnitName:te,onResolve:(e,t)=>{t&&r.hidePopup()},sortComments:h,onItemEnter:v,onItemLeave:y,onDeleteComment:()=>(y(),!0)})};let Q=class extends n{constructor(e,t,n){super(),this._menuManagerService=e,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(at)}_initMenu(){this._menuManagerService.mergeMenu(ot)}_initComponent(){[[qe,st],[Je,ct],[`CommentIcon`,Ue]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};Q=U([H(0,pe),H(1,s(ue)),H(2,me)],Q);let $=class extends d{constructor(e=tt,t,n,r){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=r;let{menu:i,...a}=ee({},tt,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(et,a)}onStarting(){[[Q],[q],[J],[Y],[Z],[W],[X]].forEach(e=>{this._injector.add(e)}),[G,K].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(Q)}onReady(){this._injector.get(q)}onRendered(){this._injector.get(J),this._injector.get(Y),this._injector.get(Z),this._injector.get(X)}};V($,`pluginName`,Ye),V($,`packageName`,Qe),V($,`version`,$e),V($,`type`,g.UNIVER_SHEET),$=U([t(le,ie),H(1,s(c)),H(2,s(i)),H(3,a)],$);export{je as AddCommentCommand,Ne as DeleteCommentCommand,Fe as DeleteCommentTreeCommand,Le as IThreadCommentDataSourceService,ze as ResolveCommentCommand,W as SheetsThreadCommentPopupService,G as ShowAddSheetCommentModalOperation,K as ToggleSheetCommentPanelOperation,$ as UniverSheetsThreadCommentUIPlugin,ce as UniverThreadCommentUIPlugin,Ve as UpdateCommentCommand};