@univerjs/preset-sheets-thread-comment 0.5.0-beta.1
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/LICENSE +176 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locales/en-US.js +1 -0
- package/lib/cjs/locales/fa-IR.js +1 -0
- package/lib/cjs/locales/ru-RU.js +1 -0
- package/lib/cjs/locales/vi-VN.js +1 -0
- package/lib/cjs/locales/zh-CN.js +1 -0
- package/lib/cjs/locales/zh-TW.js +1 -0
- package/lib/es/index.js +16 -0
- package/lib/es/locales/en-US.js +11 -0
- package/lib/es/locales/fa-IR.js +11 -0
- package/lib/es/locales/ru-RU.js +11 -0
- package/lib/es/locales/vi-VN.js +11 -0
- package/lib/es/locales/zh-CN.js +11 -0
- package/lib/es/locales/zh-TW.js +11 -0
- package/lib/index.css +1 -0
- package/lib/types/index.d.ts +16 -0
- package/lib/types/locales/en-US.d.ts +2 -0
- package/lib/types/locales/fa-IR.d.ts +2 -0
- package/lib/types/locales/ru-RU.d.ts +2 -0
- package/lib/types/locales/vi-VN.d.ts +2 -0
- package/lib/types/locales/zh-CN.d.ts +2 -0
- package/lib/types/locales/zh-TW.d.ts +2 -0
- package/lib/types/types.d.ts +11 -0
- package/lib/umd/index.js +293 -0
- package/lib/umd/locales/en-US.js +4 -0
- package/lib/umd/locales/fa-IR.js +4 -0
- package/lib/umd/locales/ru-RU.js +4 -0
- package/lib/umd/locales/vi-VN.js +4 -0
- package/lib/umd/locales/zh-CN.js +4 -0
- package/lib/umd/locales/zh-TW.js +4 -0
- package/package.json +72 -0
package/lib/umd/index.js
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment
|
|
2
|
+
|
|
3
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
7
|
+
|
|
8
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
12
|
+
|
|
13
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
14
|
+
* @license React
|
|
15
|
+
* react-jsx-runtime.production.min.js
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the MIT license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
22
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
23
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
27
|
+
|
|
28
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
29
|
+
* @license React
|
|
30
|
+
* react-jsx-runtime.production.min.js
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
40
|
+
|
|
41
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
42
|
+
|
|
43
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment
|
|
44
|
+
|
|
45
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
49
|
+
|
|
50
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
54
|
+
|
|
55
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
56
|
+
* @license React
|
|
57
|
+
* react-jsx-runtime.production.min.js
|
|
58
|
+
*
|
|
59
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license found in the
|
|
62
|
+
* LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
64
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
65
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
69
|
+
|
|
70
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
71
|
+
* @license React
|
|
72
|
+
* react-jsx-runtime.production.min.js
|
|
73
|
+
*
|
|
74
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
75
|
+
*
|
|
76
|
+
* This source code is licensed under the MIT license found in the
|
|
77
|
+
* LICENSE file in the root directory of this source tree.
|
|
78
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
82
|
+
|
|
83
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
84
|
+
|
|
85
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment
|
|
86
|
+
|
|
87
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
91
|
+
|
|
92
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
96
|
+
|
|
97
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
98
|
+
* @license React
|
|
99
|
+
* react-jsx-runtime.production.min.js
|
|
100
|
+
*
|
|
101
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the MIT license found in the
|
|
104
|
+
* LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
106
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
107
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
111
|
+
|
|
112
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
113
|
+
* @license React
|
|
114
|
+
* react-jsx-runtime.production.min.js
|
|
115
|
+
*
|
|
116
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the MIT license found in the
|
|
119
|
+
* LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
124
|
+
|
|
125
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
126
|
+
|
|
127
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment
|
|
128
|
+
|
|
129
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
133
|
+
|
|
134
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
138
|
+
|
|
139
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
140
|
+
* @license React
|
|
141
|
+
* react-jsx-runtime.production.min.js
|
|
142
|
+
*
|
|
143
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the MIT license found in the
|
|
146
|
+
* LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
148
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
149
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
153
|
+
|
|
154
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
155
|
+
* @license React
|
|
156
|
+
* react-jsx-runtime.production.min.js
|
|
157
|
+
*
|
|
158
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the MIT license found in the
|
|
161
|
+
* LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
166
|
+
|
|
167
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
168
|
+
|
|
169
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment
|
|
170
|
+
|
|
171
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
175
|
+
|
|
176
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
180
|
+
|
|
181
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
182
|
+
* @license React
|
|
183
|
+
* react-jsx-runtime.production.min.js
|
|
184
|
+
*
|
|
185
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
186
|
+
*
|
|
187
|
+
* This source code is licensed under the MIT license found in the
|
|
188
|
+
* LICENSE file in the root directory of this source tree.
|
|
189
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
190
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
191
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
195
|
+
|
|
196
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
197
|
+
* @license React
|
|
198
|
+
* react-jsx-runtime.production.min.js
|
|
199
|
+
*
|
|
200
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
201
|
+
*
|
|
202
|
+
* This source code is licensed under the MIT license found in the
|
|
203
|
+
* LICENSE file in the root directory of this source tree.
|
|
204
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
208
|
+
|
|
209
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
210
|
+
|
|
211
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment
|
|
212
|
+
|
|
213
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
217
|
+
|
|
218
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
222
|
+
|
|
223
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
224
|
+
* @license React
|
|
225
|
+
* react-jsx-runtime.production.min.js
|
|
226
|
+
*
|
|
227
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the MIT license found in the
|
|
230
|
+
* LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
232
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
233
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
237
|
+
|
|
238
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
239
|
+
* @license React
|
|
240
|
+
* react-jsx-runtime.production.min.js
|
|
241
|
+
*
|
|
242
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the MIT license found in the
|
|
245
|
+
* LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
250
|
+
|
|
251
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
252
|
+
|
|
253
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets-thread-comment-ui"),require("@univerjs/thread-comment-ui"),require("@univerjs-pro/thread-comment-datasource"),require("@univerjs/sheets-thread-comment/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/sheets-thread-comment","@univerjs/sheets-thread-comment-ui","@univerjs/thread-comment-ui","@univerjs-pro/thread-comment-datasource","@univerjs/sheets-thread-comment/facade"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.UniverPresetSheetsThreadComment={},e.UniverSheetsThreadComment,e.UniverSheetsThreadCommentUi,e.UniverThreadCommentUi,e.UniverThreadCommentDatasource))})(this,function(e,t,r,i,s){"use strict";function m(o={}){const{collaboration:u}=o,n=[i.UniverThreadCommentUIPlugin,t.UniverSheetsThreadCommentPlugin,r.UniverSheetsThreadCommentUIPlugin];return u&&n.push(s.UniverThreadCommentDataSourcePlugin),{plugins:n}}e.UniverSheetsThreadCommentPreset=m,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
254
|
+
eadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment/facade
|
|
258
|
+
|
|
259
|
+
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/thread-comment-ui
|
|
263
|
+
|
|
264
|
+
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverThreadCommentUi={},m.UniverCore,m.UniverThreadComment,m.UniverUi,m.rxjs,m.React,m.UniverDesign,m.UniverDocs,m.UniverDocsUi,m.UniverEngineRender))})(this,function(m,o,b,k,ne,h,_,Me,Oe,Re){"use strict";var ut=Object.defineProperty;var vt=(m,o,b)=>o in m?ut(m,o,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[o]=b;var L=(m,o,b)=>vt(m,typeof o!="symbol"?o+"":o,b);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?we(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);m.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();L(this,"_panelVisible",!1);L(this,"_panelVisible$",new ne.BehaviorSubject(!1));L(this,"_activeCommentId");L(this,"_activeCommentId$",new ne.BehaviorSubject(void 0));L(this,"panelVisible$",this._panelVisible$.asObservable());L(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(ne.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},m.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],m.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(m.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(m.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};class Ve{constructor(){L(this,"dataSource");L(this,"renderSuggestion");L(this,"trigger","@")}async getMentions(e,t,r){return this.dataSource?this.dataSource.getMentions(e,t,r):[]}}const le=o.createIdentifier("thread-comment.mention-data.service");var ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,We=(n,e,t,r)=>{for(var i=r>1?void 0:r?Be(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(i=(r?c(e,t,i):c(i))||i);return r&&i&&ve(e,t,i),i},me=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Fe(n,typeof e!="symbol"?e+"":e,t);m.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...c}=this._config;d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Le,c)}onStarting(){var e;o.mergeOverrideWithDependencies([[m.ThreadCommentPanelService],[le,{useClass:Ve}]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,F].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(m.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(m.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),m.UniverThreadCommentUIPlugin=We([o.DependentOn(b.UniverThreadCommentPlugin),me(1,o.Inject(o.Injector)),me(2,o.ICommandService),me(3,o.IConfigService)],m.UniverThreadCommentUIPlugin);var fe={exports:{}},re={};/**
|
|
265
|
+
* @license React
|
|
266
|
+
* react-jsx-runtime.production.min.js
|
|
267
|
+
*
|
|
268
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
269
|
+
*
|
|
270
|
+
* This source code is licensed under the MIT license found in the
|
|
271
|
+
* LICENSE file in the root directory of this source tree.
|
|
272
|
+
*/var ze=h,Ze=Symbol.for("react.element"),Ge=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ye=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function ge(n,e,t){var r,i={},d=null,c=null;t!==void 0&&(d=""+t),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(c=e.ref);for(r in e)Ke.call(e,r)&&!Je.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ze,type:n,key:d,ref:c,props:i,_owner:Ye.current}}re.Fragment=Ge,re.jsx=ge,re.jsxs=ge,fe.exports=re;var a=fe.exports,N=function(){return N=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},N.apply(this,arguments)},Qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,c=Qe(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),g=h.useRef("_".concat($e()));return pe(t,"".concat(r),{defIds:t.defIds,idSuffix:g.current},N({ref:e,className:C},c),d)});function pe(n,e,t,r,i){return h.createElement(n.tag,N(N({key:e},Xe(n,t,i)),r),(qe(n,t).children||[]).map(function(d,c){return pe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,i)}))}function Xe(n,e,t){var r=N({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],C=d[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function qe(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?N(N({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?N(N({},i),{attrs:N(N({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:et}))});Ie.displayName="DeleteSingle";var tt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:tt}))});Se.displayName="IncreaseSingle";var nt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:nt}))});xe.displayName="MoreHorizontalSingle";var rt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:rt}))});ye.displayName="ReplyToCommentSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:it}))});be.displayName="ResolvedSingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:ot}))});Te.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function at(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},st=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},dt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),_e=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&i.push({type:"text",content:e.slice(d,c.startIndex)}),i.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex).slice(1,-1),id:c.rangeId}}),d=c.endIndex}),i.push({type:"text",content:e.slice(d,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const d=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
|
|
273
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},lt=n=>({display:n.label,id:`${n.id}`,raw:n}),mt=(n,e,t,r,i)=>{var c,C;const d=(c=n.raw)==null?void 0:c.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[d?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:d}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var x,R;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:c,unitId:C,subUnitId:g}=n,j=o.useDependency(le),w=o.useDependency(o.ICommandService),M=o.useDependency(o.LocaleService),[I,f]=h.useState({...t}),[p,S]=h.useState(!1),O=h.useRef(null),T=o.useDependency(Me.DocSelectionManagerService),u=(x=o.useDependency(Re.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:x.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(s){var y;f({...t,text:s,attachments:[]}),(y=O.current)==null||y.inputElement.focus()}}));const W=()=>{var s;I.text&&(r==null||r({...I,text:I.text}),S(!1),f({text:void 0}),(s=O.current)==null||s.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:s=>s.preventDefault(),children:[a.jsx(_.Mentions,{ref:O,autoFocus:c,style:{width:"100%"},placeholder:M.t("threadCommentUI.editor.placeholder"),value:I!=null&&I.text?dt(_e(I.text)):"",onChange:s=>{s.target.value||f({...t,text:void 0}),f==null||f({...t,text:Ue(st(s.target.value))})},onFocus:()=>{const s=T.getActiveTextRange();s&&s.collapsed&&(u==null||u.removeAllRanges()),u==null||u.blur(),S(!0)},children:a.jsx(_.Mention,{trigger:j.trigger,data:(s,y)=>j.getMentions(s,C,g).then(U=>U.map(lt)).then(y),displayTransform:(s,y)=>`@${y} `,renderSuggestion:(R=j.renderSuggestion)!=null?R:mt},j.trigger)}),p?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(_.Button,{style:{marginRight:12},onClick:()=>{d==null||d(),S(!1),f({text:void 0}),w.executeCommand(F.id)},children:M.t("threadCommentUI.editor.cancel")}),a.jsx(_.Button,{type:"primary",disabled:!I.text,onClick:W,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),v={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ct=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:c,resolved:C,isRoot:g,onClose:j,onDeleteComment:w}=n,M=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),f=o.useDependency(o.UserManagerService),p=f.getUser(e.personId),S=k.useObservable(f.currentUser$),O=(S==null?void 0:S.userID)===e.personId,T=e.id===Ee,[Z,u]=h.useState(!1),W=()=>{(w==null?void 0:w(e))!==!1&&(M.executeCommand(g?b.DeleteCommentTreeCommand.id:b.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),g&&(j==null||j()))};return a.jsxs("div",{className:v.threadCommentItem,onMouseLeave:()=>u(!1),onMouseEnter:()=>u(!0),children:[a.jsx("img",{className:v.threadCommentItemHead,src:p==null?void 0:p.avatar}),a.jsxs("div",{className:v.threadCommentItemTitle,children:[a.jsx("div",{className:v.threadCommentUsername,children:(p==null?void 0:p.name)||" "}),a.jsxs("div",{children:[T||C?null:Z?a.jsx("div",{className:v.threadCommentIcon,onClick:()=>c(p),children:a.jsx(ye,{})}):null,O&&!T&&!C?a.jsx(_.Dropdown,{overlay:a.jsxs(_.Menu,{children:[a.jsx(_.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(_.MenuItem,{onClick:W,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:v.threadCommentIcon,children:a.jsx(xe,{})})}):null]})]}),a.jsx("div",{className:v.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:x,attachments:R})=>{d==null||d(!1),M.executeCommand(b.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:x,attachments:R}})}}):a.jsx("div",{className:v.threadCommentItemContent,children:_e(e.text).map((x,R)=>{switch(x.type){case"mention":return a.jsxs("a",{className:v.threadCommentItemAt,children:["@",x.content.label," "]},R);default:return x.content}})})]})},Ne=n=>{var ae,$,ee;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:c,showHighlight:C,onClose:g,getSubUnitName:j,prefix:w,autoFocus:M,onMouseEnter:I,onMouseLeave:f,onAddComment:p,onDeleteComment:S,onResolve:O}=n,T=o.useDependency(b.ThreadCommentModel),[Z,u]=h.useState(!1),[W,x]=h.useState(""),R=h.useMemo(()=>T.commentUpdate$.pipe(ne.debounceTime(16)),[T]);k.useObservable(R);const s=e?T.getCommentWithChildren(t,r,e):null,y=o.useDependency(o.ICommandService),U=o.useDependency(o.UserManagerService),H=s==null?void 0:s.root.resolved,D=k.useObservable(U.currentUser$),Q=h.useRef(null),X=[...s?[s.root]:[{id:Ee,text:{dataStream:`
|
|
274
|
+
\r`},personId:(ae=D==null?void 0:D.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...($=s==null?void 0:s.children)!=null?$:[]],G=h.useRef(null),V=P=>{P.stopPropagation(),H?y.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):y.executeCommand(F.id),y.executeCommand(b.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!H}),O==null||O(!H)},q=P=>{P.stopPropagation(),y.executeCommand(F.id),!(s!=null&&s.root&&(S==null?void 0:S(s.root))===!1)&&(y.executeCommand(b.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),g==null||g())};h.useEffect(()=>f==null?void 0:f(),[]);const B=j((ee=s==null?void 0:s.root.subUnitId)!=null?ee:r),oe=d&&!W&&!H,Y=`${i||(s==null?void 0:s.root.ref)||""}${B?" · ":""}${B}`;return a.jsxs("div",{className:at(v.threadComment,{[v.threadCommentActive]:!H&&(C||Z||w==="cell")}),onClick:c,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),u(!0)},onMouseLeave:()=>{f==null||f(),u(!1)},children:[!H&&C?a.jsx("div",{className:v.threadCommentHighlight}):null,a.jsxs("div",{className:v.threadCommentTitle,children:[a.jsxs("div",{className:v.threadCommentTitlePosition,children:[a.jsx("div",{className:v.threadCommentTitleHighlight}),a.jsx(_.Tooltip,{showIfEllipsis:!0,title:Y,children:a.jsx("div",{className:v.threadCommentTitlePositionText,children:Y})})]}),s?a.jsxs("div",{className:v.threadCommentIconContainer,children:[a.jsx("div",{onClick:V,className:v.threadCommentIcon,style:{color:H?"rgb(var(--green-500))":""},children:H?a.jsx(be,{}):a.jsx(Te,{})}),(D==null?void 0:D.userID)===s.root.personId?a.jsx("div",{className:v.threadCommentIcon,onClick:q,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:v.threadCommentContent,ref:G,children:X.map(P=>a.jsx(ct,{onClose:g,unitId:t,subUnitId:r,item:P,isRoot:P.id===(s==null?void 0:s.root.id),editing:W===P.id,resolved:s==null?void 0:s.root.resolved,onEditingChange:A=>{x(A?P.id:"")},onReply:A=>{A&&requestAnimationFrame(()=>{var l;(l=Q.current)==null||l.reply(Ue([{type:"mention",content:{id:A.userID,label:A.name}}]))})},onAddComment:p,onDeleteComment:S},P.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:Q,unitId:t,subUnitId:r,onSave:async({text:P,attachments:A})=>{const l={text:P,attachments:A,dT:b.getDT(),id:o.generateRandomId(),ref:i,personId:D==null?void 0:D.userID,parentId:s==null?void 0:s.root.id,unitId:t,subUnitId:r,threadId:s==null?void 0:s.root.threadId};(p==null?void 0:p(l))!==!1&&(await y.executeCommand(b.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:l}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:M||!s,onCancel:()=>{s||g==null||g()}},`${M}`)}):null]})},J={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},ht=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:c,sortComments:C,onItemLeave:g,onItemEnter:j,disableAdd:w,tempComment:M,onAddComment:I,onDeleteComment:f,showComments:p}=n,[S,O]=h.useState("all"),[T,Z]=h.useState("all"),u=o.useDependency(o.LocaleService),W=o.useDependency(o.UserManagerService),x=o.useDependency(b.ThreadCommentModel),[R,s]=h.useState(()=>x.getUnit(e)),y=o.useDependency(m.ThreadCommentPanelService),U=k.useObservable(y.activeCommentId$),H=k.useObservable(x.commentUpdate$),D=o.useDependency(o.ICommandService),Q=k.useObservable(t),X=h.useRef(!0),G="panel",V=k.useObservable(W.currentUser$),q=h.useMemo(()=>{var de;const l=S==="all"?R:(de=R.filter(E=>E.subUnitId===Q))!=null?de:[],te=C!=null?C:E=>E,se=l.map(E=>{var K;return{...E.root,children:(K=E.children)!=null?K:[],users:E.relativeUsers}});if(p){const E=new Map;return se.forEach(K=>{E.set(K.id,K)}),[...p,""].map(K=>E.get(K)).filter(Boolean)}else return te(se)},[p,S,R,C,Q]),B=h.useMemo(()=>[...q.filter(l=>!l.resolved),...q.filter(l=>l.resolved)],[q]),oe=h.useMemo(()=>T==="resolved"?B.filter(l=>l.resolved):T==="unsolved"?B.filter(l=>!l.resolved):T==="concern_me"&&V!=null&&V.userID?B.filter(l=>l==null?void 0:l.users.has(V.userID)):B,[B,V==null?void 0:V.userID,T]),Y=M?[M,...oe]:oe,ae=Y.filter(l=>!l.resolved),$=Y.filter(l=>l.resolved),ee=T!=="all"||S!=="all",P=()=>{Z("all"),O("all")};h.useEffect(()=>{e&&s(x.getUnit(e))},[e,x,H]),h.useEffect(()=>{var E;if(!U)return;if(!X.current){X.current=!0;return}const{unitId:l,subUnitId:te,commentId:se}=U,de=`${G}-${l}-${te}-${se}`;(E=document.getElementById(de))==null||E.scrollIntoView({block:"center"})},[U]);const A=l=>a.jsx(Ne,{prefix:G,getSubUnitName:d,id:l.id,unitId:l.unitId,subUnitId:l.subUnitId,refStr:l.ref,type:r,showEdit:(U==null?void 0:U.commentId)===l.id,showHighlight:(U==null?void 0:U.commentId)===l.id,onClick:()=>{X.current=!1,l.resolved?D.executeCommand(F.id):D.executeCommand(F.id,{unitId:l.unitId,subUnitId:l.subUnitId,commentId:l.id,temp:!1})},onMouseEnter:()=>j==null?void 0:j(l),onMouseLeave:()=>g==null?void 0:g(l),onAddComment:I,onDeleteComment:f,onResolve:te=>c==null?void 0:c(l.id,te)},l.id);return a.jsxs("div",{className:J.threadCommentPanel,children:[a.jsxs("div",{className:J.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(_.Select,{borderless:!0,value:S,onChange:l=>O(l),options:[{value:"current",label:u.t("threadCommentUI.filter.sheet.current")},{value:"all",label:u.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(_.Select,{borderless:!0,value:T,onChange:l=>Z(l),options:[{value:"all",label:u.t("threadCommentUI.filter.status.all")},{value:"resolved",label:u.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:u.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:u.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(A),$.length?a.jsx("div",{className:J.threadCommentPanelSolved,children:"已解决"}):null,$.map(A),Y.length?null:a.jsxs("div",{className:J.threadCommentPanelEmpty,children:[ee?u.t("threadCommentUI.panel.filterEmpty"):u.t("threadCommentUI.panel.empty"),ee?a.jsx(_.Button,{onClick:P,type:"link",children:u.t("threadCommentUI.panel.reset")}):a.jsxs(_.Button,{id:"thread-comment-add",className:J.threadCommentPanelAdd,type:"primary",onClick:i,disabled:w,children:[a.jsx(Se,{}),u.t("threadCommentUI.panel.addComment")]})]})]})};m.IThreadCommentMentionDataService=le,m.SetActiveCommentOperation=F,m.THREAD_COMMENT_PANEL=he,m.ThreadCommentPanel=ht,m.ThreadCommentTree=Ne,m.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs/sheets-thread-comment-ui
|
|
278
|
+
|
|
279
|
+
(function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","react","@univerjs/engine-formula","@univerjs/thread-comment"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.React,c.UniverEngineFormula,c.UniverThreadComment))})(this,function(c,a,p,A,I,g,f,k,re,E,$,C){"use strict";var st=Object.defineProperty;var at=(c,a,p)=>a in c?st(c,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[a]=p;var N=(c,a,p)=>at(c,typeof a!="symbol"?a+"":a,p);const ie="univer.sheet.thread-comment-modal",J="comment-single",Q="SHEET_THREAD_COMMENT";var ve=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_e=(i,t,r,e)=>{for(var n=e>1?void 0:e?Se(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ve(t,r,n),n},oe=(i,t)=>(r,e)=>t(r,e,i);c.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(r,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:n,col:o,unitId:s,subUnitId:d}=r;if(this._activePopup&&n===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(n,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new a.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=_e([oe(0,a.Inject(g.SheetCanvasPopManagerService)),oe(1,f.IZenZoneService)],c.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var P;const t=i.get(p.SheetsSelectionsService),r=i.get(a.IUniverInstanceService),e=i.get(c.SheetsThreadCommentPopupService),n=i.get(I.ThreadCommentPanelService),o=(P=t.getCurrentLastSelection())==null?void 0:P.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,v={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(v);const _=s.getByLocation(l,h,o.startRow,o.startColumn);return _&&n.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},fe="sheets-thread-comment.config",Ce={};var Ie=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Pe=(i,t,r,e)=>{for(var n=e>1?void 0:e?ge(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Ie(t,r,n),n},L=(i,t)=>(r,e)=>t(r,e,i);let x=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,r)=>{const{row:e,col:n,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,n)?r({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):r(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var n;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(n=e==null?void 0:e.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};x=Pe([L(0,a.Inject(p.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,re.IRenderManagerService)],x);var y=function(){return y=Object.assign||function(i){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},y.apply(this,arguments)},Te=function(i,t){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)t.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(r[e[n]]=i[e[n]]);return r},se=E.forwardRef(function(i,t){var r=i.icon,e=i.id,n=i.className,o=i.extend,s=Te(i,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(n||"").trim(),u=E.useRef("_".concat(Me()));return ae(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},s),o)});function ae(i,t,r,e,n){return E.createElement(i.tag,y(y({key:t},be(i,r,n)),e),(ye(i,r).children||[]).map(function(o,s){return ae(o,"".concat(t,"-").concat(i.tag,"-").concat(s),r,void 0,n)}))}function be(i,t,r){var e=y({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var n=t.defIds;return!n||n.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],d=o[1];typeof d=="string"&&(e[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ye(i,t){var r,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?y(y({},i),{children:i.children.map(function(n){return typeof n.attrs.id=="string"&&e&&e.indexOf(n.attrs.id)>-1?y(y({},n),{attrs:y(y({},n.attrs),{id:n.attrs.id+t.idSuffix})}):n})}):i}function Me(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";var we={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"}}]},ce=E.forwardRef(function(i,t){return E.createElement(se,Object.assign({},i,{id:"comment-single",ref:t,icon:we}))});ce.displayName="CommentSingle";var de={exports:{}},W={};/**
|
|
280
|
+
* @license React
|
|
281
|
+
* react-jsx-runtime.production.min.js
|
|
282
|
+
*
|
|
283
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the MIT license found in the
|
|
286
|
+
* LICENSE file in the root directory of this source tree.
|
|
287
|
+
*/var Oe=E,Ee=Symbol.for("react.element"),Re=Symbol.for("react.fragment"),Ue=Object.prototype.hasOwnProperty,je=Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0};function ue(i,t,r){var e,n={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)Ue.call(t,e)&&!De.hasOwnProperty(e)&&(n[e]=t[e]);if(i&&i.defaultProps)for(e in t=i.defaultProps,t)n[e]===void 0&&(n[e]=t[e]);return{$$typeof:Ee,type:i,key:o,ref:s,props:n,_owner:je.current}}W.Fragment=Re,W.jsx=ue,W.jsxs=ue,de.exports=W;var me=de.exports;const Ne=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(c.SheetsThreadCommentPopupService),r=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!r)return null;const{row:n,col:o,unitId:s,subUnitId:d,trigger:u}=r,m=e.getByLocation(s,d,n,o),l=`${a.Tools.chatAtABC(o)}${n+1}`,h=()=>{t.hidePopup()},v=_=>{var P,M,V;return(V=(M=(P=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:P.getSheetBySheetId(_))==null?void 0:M.getName())!=null?V:""};return me.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:s,subUnitId:d,type:a.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:v,autoFocus:u==="context-menu"})},Ae=()=>{var w;const i=a.useDependency(g.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),r=a.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),n=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(S=>S==null?void 0:S.getSheetId())),[e.activeSheet$]),d=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),m=a.useDependency(I.ThreadCommentPanelService),l=f.useObservable(m.activeCommentId$),h=f.useObservable(m.panelVisible$,m.panelVisible),v=E.useCallback(S=>{const O=e.getSheets(),T={};O.forEach((R,b)=>{T[R.getSheetId()]=b});const j=R=>R.map(b=>{var pe;const D=$.singleReferenceToGrid(b.ref),ot=[(pe=T[b.subUnitId])!=null?pe:0,D.row,D.column];return{...b,p:ot}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(S.filter(R=>!R.resolved)),...j(S.filter(R=>R.resolved))]},[e]),_=E.useCallback(S=>{var O;if(S.unitId===n&&S.subUnitId===d&&!S.resolved){const{row:T,column:j}=$.singleReferenceToGrid(S.ref),R=e.getSheetBySheetId(S.subUnitId),b=(O=R==null?void 0:R.getMergedCell(T,j))!=null?O:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,d,n]),P=S=>{var O,T;return(T=(O=e.getSheetBySheetId(S))==null?void 0:O.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=S=>{l&&l.unitId===S.unitId&&l.subUnitId===S.subUnitId&&l.commentId===S.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=_(S))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},ne=(S,O)=>{O&&r.hidePopup()};return E.useEffect(()=>{!h&&u.current&&i.removeShape(u.current)},[i,h]),me.jsx(I.ThreadCommentPanel,{unitId:n,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:P,onResolve:ne,sortComments:v,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ve=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:J,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),$e=i=>({id:I.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:J,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:g.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),Be={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:g.whenSheetEditorFocused},ke={[f.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:$e}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ve}}}};var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,xe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Le(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&He(t,r,n),n},X=(i,t)=>(r,e)=>t(r,e,i);let F=class extends a.Disposable{constructor(i,t,r){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Be)}_initMenu(){this._menuManagerService.mergeMenu(ke)}_initComponent(){[[ie,Ne],[I.THREAD_COMMENT_PANEL,Ae],[J,ce]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};F=xe([X(0,f.IMenuManagerService),X(1,a.Inject(f.ComponentManager)),X(2,f.IShortcutService)],F);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ge=(i,t,r,e)=>{for(var n=e>1?void 0:e?Fe(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&We(t,r,n),n},ee=(i,t)=>(r,e)=>t(r,e,i);const Ze=(i,t,r)=>{const e=$.singleReferenceToGrid(i),n=r.row-t.row,o=r.column-t.column,s={startColumn:e.column+o,startRow:e.row+n,endColumn:e.column+o,endRow:e.row+n};return $.serializeRange(s)};let G=class extends a.Disposable{constructor(t,r,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,n)=>{const{unitId:o,subUnitId:s,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(n.copyType===g.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,v={row:m.startRow,column:m.startColumn};if(!(o===l&&s===h)){const _=[];a.Range.foreach(m,(w,S)=>{const O=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,S);this._threadCommentDataSourceService.syncUpdateMutationToColla?O.forEach(T=>{_.push(T)}):O.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const P=[],M=[],V=[],H=[],ne=w=>{P.unshift({id:C.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:Ze(w.ref,v,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...P,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};G=Ge([ee(0,a.Inject(g.ISheetClipboardService)),ee(1,a.Inject(A.SheetsThreadCommentModel)),ee(2,C.IThreadCommentDataSourceService)],G);var ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(i,t,r,e)=>{for(var n=e>1?void 0:e?Ye(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&ze(t,r,n),n},Z=(i,t)=>(r,e)=>t(r,e,i);let z=class extends a.Disposable{constructor(i,t,r,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:r}=i,{unitId:e,subUnitId:n,row:o,col:s}=r,d=this._sheetsThreadCommentModel.getByLocation(e,n,o,s);if(d){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const m=this._sheetsThreadCommentModel.getComment(e,n,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:o,col:s,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};z=Ke([Z(0,a.Inject(g.HoverManagerService)),Z(1,a.Inject(c.SheetsThreadCommentPopupService)),Z(2,a.Inject(A.SheetsThreadCommentModel)),Z(3,a.Inject(g.SheetPermissionInterceptorBaseController))],z);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Qe=(i,t,r,e)=>{for(var n=e>1?void 0:e?Je(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&qe(t,r,n),n},U=(i,t)=>(r,e)=>t(r,e,i);let Y=class extends a.Disposable{constructor(t,r,e,n,o,s,d,u,m,l){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=n,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var v,_,P;const n=(v=t[0])==null?void 0:v.range,o=this._renderManagerService.getRenderById(r),s=(_=o==null?void 0:o.with(g.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:_.skeleton;if(!s||!n)return;const d=s.getCellWithCoordByIndex(n.startRow,n.startColumn);if((((P=n.rangeType)!=null?P:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||n.endColumn-n.startColumn>0||n.endRow-n.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&a.Rectangle.equals(d.mergeInfo,n))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:n,subUnitId:o,commentId:s}=e;r.unitId===n&&r.subUnitId===o&&r.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:n,commentId:o,trigger:s}=t,d=this._sheetsThreadCommentModel.getComment(e,n,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==n&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n}),this._isSwitchToCommenting=!1;const h=$.singleReferenceToGrid(d.ref),{row:v,column:_}=h;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:v,startColumn:_,endRow:v,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(g.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:n,row:h.row,col:h.column,commentId:d.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var v,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:n}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,n);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:d,column:u}=s;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};Y=Qe([U(0,a.ICommandService),U(1,a.Inject(c.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(I.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(g.SheetPermissionInterceptorBaseController)),U(6,g.IMarkSelectionService),U(7,a.Inject(p.SheetsSelectionsService)),U(8,g.IEditorBridgeService),U(9,re.IRenderManagerService)],Y);var Xe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(i,t,r,e)=>{for(var n=e>1?void 0:e?et(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&Xe(t,r,n),n},K=(i,t)=>(r,e)=>t(r,e,i);let q=class extends a.Disposable{constructor(i,t,r,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===p.RemoveSheetCommand.id){const r=i.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const n=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(n,o),d=Array.from(s.values()).filter(v=>!v.parentId),u=d.map(v=>v.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(v=>({id:C.DeleteCommentMutation.id,params:{unitId:n,subUnitId:o,commentId:v}})),h=d.map(({children:v,..._})=>({id:C.AddCommentMutation.id,params:{unitId:n,subUnitId:o,comment:{..._,children:m?v:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};q=tt([K(0,a.Inject(p.SheetInterceptorService)),K(1,a.IUniverInstanceService),K(2,a.Inject(C.ThreadCommentModel)),K(3,C.IThreadCommentDataSourceService)],q);var he=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,rt=(i,t,r)=>t in i?he(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,it=(i,t,r,e)=>{for(var n=e>1?void 0:e?nt(t,r):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(e?s(t,r,n):s(n))||n);return e&&n&&he(t,r,n),n},te=(i,t)=>(r,e)=>t(r,e,i),le=(i,t,r)=>rt(i,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ce,r,e,n){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=n;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(fe,s)}onStarting(){[[F],[x],[G],[z],[q],[Y],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(F)}onReady(){this._injector.get(x),this._injector.get(q)}onRendered(){this._injector.get(G),this._injector.get(z),this._injector.get(Y)}},le(c.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),le(c.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=it([a.DependentOn(I.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),te(1,a.Inject(a.Injector)),te(2,a.Inject(a.ICommandService)),te(3,a.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"IThreadCommentMentionDataService",{enumerable:!0,get:()=>I.IThreadCommentMentionDataService}),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=Q,c.ShowAddSheetCommentModalOperation=B,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-thread-comment/node_modules/@univerjs-pro/thread-comment-datasource
|
|
291
|
+
|
|
292
|
+
function _0x1085(_0x330f90,_0x71315c){const _0x45cb86=_0x45cb();return _0x1085=function(_0x1085fa,_0x46606a){_0x1085fa=_0x1085fa-0xfe;let _0x2655bd=_0x45cb86[_0x1085fa];return _0x2655bd;},_0x1085(_0x330f90,_0x71315c);}(function(_0x1c3962,_0x38a0e2){const _0xcc7751=_0x1085,_0x25cd31=_0x1c3962();while(!![]){try{const _0x4ef23e=parseInt(_0xcc7751(0x155))/0x1+parseInt(_0xcc7751(0x119))/0x2+parseInt(_0xcc7751(0x193))/0x3*(-parseInt(_0xcc7751(0x15d))/0x4)+-parseInt(_0xcc7751(0x147))/0x5+-parseInt(_0xcc7751(0x16c))/0x6*(-parseInt(_0xcc7751(0x181))/0x7)+parseInt(_0xcc7751(0x18c))/0x8+-parseInt(_0xcc7751(0x157))/0x9;if(_0x4ef23e===_0x38a0e2)break;else _0x25cd31['push'](_0x25cd31['shift']());}catch(_0x1c931a){_0x25cd31['push'](_0x25cd31['shift']());}}}(_0x45cb,0xc73dd),function(_0x223df9,_0x2a32d0){const _0x169cb1=_0x1085;typeof exports==_0x169cb1(0x16e)&&typeof module<'u'?_0x2a32d0(exports,require('@univerjs/core'),require(_0x169cb1(0x13d)),require(_0x169cb1(0x178)),require(_0x169cb1(0x105)),require(_0x169cb1(0x13b)),require(_0x169cb1(0x128)),require(_0x169cb1(0x120))):typeof define=='function'&&define['amd']?define([_0x169cb1(0x106),_0x169cb1(0x188),'@univerjs/thread-comment-ui','@univerjs-pro/collaboration-client',_0x169cb1(0x105),_0x169cb1(0x13b),'rxjs',_0x169cb1(0x120)],_0x2a32d0):(_0x223df9=typeof globalThis<'u'?globalThis:_0x223df9||self,_0x2a32d0(_0x223df9[_0x169cb1(0x143)]={},_0x223df9['UniverCore'],_0x223df9[_0x169cb1(0x187)],_0x223df9[_0x169cb1(0x16d)],_0x223df9[_0x169cb1(0x160)],_0x223df9[_0x169cb1(0x144)],_0x223df9[_0x169cb1(0x128)],_0x223df9[_0x169cb1(0x12b)]));}(this,function(_0x17a296,_0x3d0190,_0x3ed21d,_0x3db026,_0x51384d,_0x5c0884,_0x1b5c0a,_0x49bd93){'use strict';const _0x2d1c5a=_0x1085;const _0x581514='UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN';var _0x5cda73=(_0x209b8d=>(_0x209b8d[_0x209b8d[_0x2d1c5a(0x121)]=0x0]=_0x2d1c5a(0x121),_0x209b8d[_0x209b8d[_0x2d1c5a(0x16f)]=0x1]=_0x2d1c5a(0x16f),_0x209b8d[_0x209b8d[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x209b8d))(_0x5cda73||{}),_0x4aae21=(_0x569621=>(_0x569621[_0x569621[_0x2d1c5a(0x12c)]=0x0]=_0x2d1c5a(0x12c),_0x569621[_0x569621[_0x2d1c5a(0xfe)]=0x1]=_0x2d1c5a(0xfe),_0x569621[_0x569621['Reply']=0x2]=_0x2d1c5a(0x194),_0x569621[_0x569621[_0x2d1c5a(0x18f)]=0x3]=_0x2d1c5a(0x18f),_0x569621[_0x569621['Delete']=0x4]=_0x2d1c5a(0x15f),_0x569621[_0x569621[_0x2d1c5a(0x163)]=0x5]='Solve',_0x569621[_0x569621[_0x2d1c5a(0x137)]=-0x1]=_0x2d1c5a(0x137),_0x569621))(_0x4aae21||{});const _0x1d64e1=_0x32d4fa=>_0x3d0190[_0x2d1c5a(0x168)](new Date(+_0x32d4fa))['format'](_0x2d1c5a(0x17a)),_0x41e898=async(_0x1daffb,_0x2ae0d7)=>{const _0x49961f=_0x2d1c5a,_0x4f8c20=_0x1daffb[_0x49961f(0x191)](_0x3d0190[_0x49961f(0x11c)]),_0x50f0c5=_0x1daffb[_0x49961f(0x191)](_0x49bd93[_0x49961f(0x176)]);_0x2ae0d7[_0x49961f(0x11d)](_0x27ee20=>{const _0x12083e=_0x49961f;_0x4f8c20['getUser'](_0x27ee20)&&_0x2ae0d7[_0x12083e(0x124)](_0x27ee20);}),_0x2ae0d7[_0x49961f(0x156)]&&(await _0x50f0c5[_0x49961f(0x191)]('/universer-api/user/list',{'params':{'userIDs':[..._0x2ae0d7]}}))[_0x49961f(0x141)][_0x49961f(0x177)][_0x49961f(0x11d)](_0x1f578d=>{const _0x5d3ae8=_0x49961f;_0x1f578d&&_0x4f8c20[_0x5d3ae8(0x111)](_0x1f578d);});};var _0x2b18e9=Object['defineProperty'],_0xaed435=Object['getOwnPropertyDescriptor'],_0xdbf4ec=(_0x3443bc,_0x3e2fe7,_0x3d4a6c,_0x5e2b31)=>{const _0x5b531d=_0x2d1c5a;for(var _0x15e483=_0x5e2b31>0x1?void 0x0:_0x5e2b31?_0xaed435(_0x3e2fe7,_0x3d4a6c):_0x3e2fe7,_0x229be8=_0x3443bc[_0x5b531d(0x104)]-0x1,_0x29a12f;_0x229be8>=0x0;_0x229be8--)(_0x29a12f=_0x3443bc[_0x229be8])&&(_0x15e483=(_0x5e2b31?_0x29a12f(_0x3e2fe7,_0x3d4a6c,_0x15e483):_0x29a12f(_0x15e483))||_0x15e483);return _0x5e2b31&&_0x15e483&&_0x2b18e9(_0x3e2fe7,_0x3d4a6c,_0x15e483),_0x15e483;},_0x470027=(_0x2a44f3,_0x529c33)=>(_0x166652,_0x92e77d)=>_0x529c33(_0x166652,_0x92e77d,_0x2a44f3);let _0x2c4030=class extends _0x3d0190['Disposable']{constructor(_0x1c592b,_0xef8ea5,_0x4e6c26,_0x22f0c3){const _0x6f6060=_0x2d1c5a;super(),this[_0x6f6060(0x11f)]=_0x1c592b,this[_0x6f6060(0x114)]=_0xef8ea5,this[_0x6f6060(0x151)]=_0x4e6c26,this[_0x6f6060(0x101)]=_0x22f0c3,this['_init'](),this[_0x6f6060(0x127)]();}[_0x2d1c5a(0x127)](){const _0x568e0e=_0x2d1c5a;this[_0x568e0e(0xff)](this['_threadCommentModel'][_0x568e0e(0x16a)][_0x568e0e(0x100)](_0x1b5c0a[_0x568e0e(0x15e)](0x10))['subscribe'](_0x496c60=>{const _0x35946b=new Set();_0x496c60['forEach'](_0x34a6dc=>{const _0xeb10e9=_0x1085;switch(_0x34a6dc[_0xeb10e9(0x117)]){case _0xeb10e9(0x139):{const _0x5d3422=_0x34a6dc[_0xeb10e9(0x17e)][_0xeb10e9(0x162)];_0x35946b[_0xeb10e9(0x139)](_0x5d3422);break;}}}),_0x41e898(this['_injector'],_0x35946b);}));}['_init'](){const _0x32d451=_0x2d1c5a;this[_0x32d451(0xff)](this['_commentService']['commentUpdate$'][_0x32d451(0x167)](async _0x490edc=>{const _0x159d32=_0x32d451;var _0x22400e,_0xc8d55f,_0x22c0dd,_0x4b8c1f;const _0x29d0eb=(_0x22400e=this['_threadCommentModel']['getUnit'](_0x490edc[_0x159d32(0x17d)])['find'](_0x43f4ee=>_0x43f4ee['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x22400e['root'];if(!_0x29d0eb)return;const {unitId:_0x117158,subUnitId:_0x3aafe5}=_0x29d0eb;switch(_0x490edc[_0x159d32(0x130)]&&this[_0x159d32(0x151)]['addUser'](_0x490edc['user']),_0x490edc[_0x159d32(0x117)]){case _0x4aae21[_0x159d32(0xfe)]:break;case _0x4aae21[_0x159d32(0x194)]:{this['_threadCommentModel']['addComment'](_0x117158,_0x3aafe5,{'unitId':_0x117158,'subUnitId':_0x3aafe5,'ref':'','id':_0x490edc['replyId'],'dT':_0x1d64e1(+_0x490edc['createTimestamp']),'threadId':_0x490edc[_0x159d32(0x14f)],'personId':(_0x22c0dd=(_0xc8d55f=_0x490edc[_0x159d32(0x130)])==null?void 0x0:_0xc8d55f[_0x159d32(0x171)])!=null?_0x22c0dd:_0x490edc['userId'],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)]),'parentId':_0x29d0eb['id']});break;}case _0x4aae21[_0x159d32(0x15f)]:{const _0x55b8a5=this[_0x159d32(0x114)][_0x159d32(0x183)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);_0x55b8a5&&_0x55b8a5['parentId']&&this[_0x159d32(0x114)][_0x159d32(0x140)](_0x117158,_0x3aafe5,_0x490edc[_0x159d32(0x14e)]);break;}case _0x4aae21['Edit']:{this[_0x159d32(0x114)][_0x159d32(0x134)](_0x117158,_0x3aafe5,{'commentId':_0x490edc[_0x159d32(0x14e)],'text':JSON[_0x159d32(0x164)](_0x490edc[_0x159d32(0x180)])});break;}case _0x4aae21[_0x159d32(0x163)]:{const _0x99e61a=(_0x4b8c1f=this[_0x159d32(0x114)][_0x159d32(0x174)](_0x490edc['unitId'])[_0x159d32(0x154)](_0x232300=>_0x232300['threadId']===_0x490edc[_0x159d32(0x14f)]))==null?void 0x0:_0x4b8c1f[_0x159d32(0x185)];_0x99e61a&&this[_0x159d32(0x114)]['resolveComment'](_0x117158,_0x3aafe5,_0x99e61a['id'],_0x490edc[_0x159d32(0x166)]===_0x5cda73[_0x159d32(0x16f)]);break;}}}));}};_0x2c4030=_0xdbf4ec([_0x470027(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x16b)])),_0x470027(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x5c0884['ThreadCommentModel'])),_0x470027(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x470027(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190['Injector']))],_0x2c4030);const _0x168b3a=_0x2d1c5a(0x12d),_0x5c96e1={};var _0x3f3071=Object[_0x2d1c5a(0x18e)],_0x4e1f86=Object['getOwnPropertyDescriptor'],_0x34829b=(_0x4ac3ab,_0x20f67f,_0x137e72,_0x56aa0f)=>{for(var _0x42b400=_0x56aa0f>0x1?void 0x0:_0x56aa0f?_0x4e1f86(_0x20f67f,_0x137e72):_0x20f67f,_0x382a88=_0x4ac3ab['length']-0x1,_0x583b56;_0x382a88>=0x0;_0x382a88--)(_0x583b56=_0x4ac3ab[_0x382a88])&&(_0x42b400=(_0x56aa0f?_0x583b56(_0x20f67f,_0x137e72,_0x42b400):_0x583b56(_0x42b400))||_0x42b400);return _0x56aa0f&&_0x42b400&&_0x3f3071(_0x20f67f,_0x137e72,_0x42b400),_0x42b400;},_0x5b385f=(_0x3179ab,_0x2379b8)=>(_0x4ad694,_0x3d031b)=>_0x2379b8(_0x4ad694,_0x3d031b,_0x3179ab);function _0x287c05(_0x334b3e,_0x1c3ac9){const _0x1da2de=_0x2d1c5a,_0x316913=_0x334b3e[_0x1da2de(0x116)][0x0];return{..._0x1c3ac9,'id':_0x316913[_0x1da2de(0x14e)],'resolved':_0x334b3e[_0x1da2de(0x166)]===0x1,'dT':_0x1d64e1(_0x316913[_0x1da2de(0x123)]),'personId':_0x316913[_0x1da2de(0x12a)],'threadId':_0x316913[_0x1da2de(0x14f)]};}function _0x4513b1(_0x5c5d7f,_0xee5259,_0x1ea201){const _0x1aa179=_0x2d1c5a;var _0x30e012,_0x4a60c9;if(((_0x4a60c9=(_0x30e012=_0x5c5d7f==null?void 0x0:_0x5c5d7f['replies'])==null?void 0x0:_0x30e012[_0x1aa179(0x104)])!=null?_0x4a60c9:0x0)>0x0){const _0x33a106=(_0x413bee,_0x1ef023)=>({'id':_0x413bee[_0x1aa179(0x14e)],'threadId':_0x413bee['threadId'],'dT':_0x1d64e1(_0x413bee['createTimestamp']),'personId':_0x413bee['userId'],'resolved':_0x5c5d7f['solved']===_0x5cda73[_0x1aa179(0x16f)],'unitId':_0xee5259,'subUnitId':_0x1ea201,'text':JSON[_0x1aa179(0x164)](_0x413bee['content']),'parentId':_0x1ef023}),_0x2fcf35=_0x33a106(_0x5c5d7f['replies'][0x0]);return{..._0x2fcf35,'children':_0x5c5d7f[_0x1aa179(0x116)]['slice'](0x1)[_0x1aa179(0x17b)](_0x25c910=>_0x33a106(_0x25c910,_0x2fcf35['id']))};}return null;}let _0x4c567b=class{constructor(_0x504ccd,_0x440d1d,_0x13d849,_0x1e6654){const _0x21ba5d=_0x2d1c5a;this[_0x21ba5d(0x109)]=_0x504ccd,this[_0x21ba5d(0x151)]=_0x440d1d,this[_0x21ba5d(0x102)]=_0x13d849,this[_0x21ba5d(0x101)]=_0x1e6654;}async[_0x2d1c5a(0x126)](_0x2d47fd){const _0x30ca48=_0x2d1c5a;var _0x23c2b9,_0x54c2a1;const {parentId:_0x92c8a9,unitId:_0x5cc676,text:_0x3d84cf,threadId:_0x5735b3}=_0x2d47fd,_0x2e07a3=(_0x54c2a1=(_0x23c2b9=_0x3d84cf[_0x30ca48(0x135)])==null?void 0x0:_0x23c2b9['filter'](_0x3766f4=>_0x3766f4[_0x30ca48(0x15b)]===_0x3d0190[_0x30ca48(0x150)][_0x30ca48(0x18b)])[_0x30ca48(0x17b)](_0x3231ef=>_0x3231ef[_0x30ca48(0x122)]))!=null?_0x54c2a1:[],_0x57e106=JSON[_0x30ca48(0x14d)](_0x3d84cf),_0x44db1c=(await this[_0x30ca48(0x102)]['requireSession'](_0x5cc676))[_0x30ca48(0x18a)]();if(_0x92c8a9){const _0x20deb8={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3,'threadId':_0x5735b3},_0x5ed8eb=(await this['_httpService'][_0x30ca48(0x14b)]('/universer-api/comment/unit/'+_0x5cc676+_0x30ca48(0x192),{'body':_0x20deb8}))[_0x30ca48(0x141)][_0x30ca48(0x161)];return{..._0x2d47fd,'id':_0x5ed8eb[_0x30ca48(0x14e)],'dT':_0x3d0190[_0x30ca48(0x168)](+_0x5ed8eb[_0x30ca48(0x123)])['format'](_0x30ca48(0x17a)),'personId':_0x5ed8eb['userId']};}else{const _0x36ed66={'memberId':_0x44db1c,'unitId':_0x5cc676,'content':_0x57e106,'mention':_0x2e07a3},_0x2048d0=await this[_0x30ca48(0x109)][_0x30ca48(0x14b)](_0x30ca48(0x10a)+_0x5cc676+_0x30ca48(0x184),{'body':_0x36ed66});return _0x287c05(_0x2048d0[_0x30ca48(0x141)][_0x30ca48(0x17f)],_0x2d47fd);}}async[_0x2d1c5a(0x134)](_0xa03223){const _0x2b9009=_0x2d1c5a;var _0xd70d8b,_0x2971aa;const {text:_0xa9b207,unitId:_0x38e37f}=_0xa03223,_0x2a422d=(_0x2971aa=(_0xd70d8b=_0xa9b207[_0x2b9009(0x135)])==null?void 0x0:_0xd70d8b[_0x2b9009(0x175)](_0x2e447c=>_0x2e447c['rangeType']===_0x3d0190[_0x2b9009(0x150)]['COMMENT'])[_0x2b9009(0x17b)](_0x2a0ee2=>_0x2a0ee2[_0x2b9009(0x122)]))!=null?_0x2971aa:[],_0x27365a=JSON[_0x2b9009(0x14d)](_0xa9b207),_0xa8dbb2=_0xa03223[_0x2b9009(0x14f)],_0x32e73c=_0xa03223['id'],_0x30dbfc={'memberId':(await this[_0x2b9009(0x102)][_0x2b9009(0x11e)](_0x38e37f))['getMemberID'](),'unitId':_0x38e37f,'threadId':_0xa8dbb2,'mention':_0x2a422d,'content':_0x27365a,'replyId':_0x32e73c},_0x335d49=await this[_0x2b9009(0x109)]['post'](_0x2b9009(0x10a)+_0x38e37f+_0x2b9009(0x13f),{'body':_0x30dbfc});return!_0x335d49[_0x2b9009(0x141)][_0x2b9009(0x132)]||_0x335d49['body']['error'][_0x2b9009(0x107)]===0x1;}async[_0x2d1c5a(0x13e)](_0x25130f){const _0x3f746e=_0x2d1c5a,{unitId:_0x45df06}=_0x25130f,_0x4b542f=_0x25130f[_0x3f746e(0x14f)],_0x458032={'memberId':this['_userService'][_0x3f746e(0x10b)]()['userID'],'unitId':_0x45df06,'threadId':_0x4b542f,'solved':_0x25130f[_0x3f746e(0x138)]?_0x5cda73[_0x3f746e(0x16f)]:_0x5cda73[_0x3f746e(0x121)]},_0x5d5e33=await this[_0x3f746e(0x109)][_0x3f746e(0x14b)](_0x3f746e(0x10a)+_0x45df06+_0x3f746e(0x186),{'body':_0x458032});return!_0x5d5e33[_0x3f746e(0x141)]['error']||_0x5d5e33[_0x3f746e(0x141)][_0x3f746e(0x132)][_0x3f746e(0x107)]===0x1;}async[_0x2d1c5a(0x140)](_0x4bf704,_0x13e9f4,_0x4a7c8d,_0x3aaf08){const _0x2b2280=_0x2d1c5a,_0x2f3900={'memberId':(await this[_0x2b2280(0x102)][_0x2b2280(0x11e)](_0x4bf704))[_0x2b2280(0x18a)](),'threadId':_0x4a7c8d,'replyId':_0x3aaf08,'unitId':_0x4bf704},_0xc6ccca=await this[_0x2b2280(0x109)][_0x2b2280(0x14b)]('/universer-api/comment/unit/'+_0x4bf704+_0x2b2280(0x172),{'body':_0x2f3900});return!_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]||_0xc6ccca[_0x2b2280(0x141)][_0x2b2280(0x132)]['code']===0x1;}async['listComments'](_0x4daf68,_0x3df24c,_0x30e3d8){const _0x5d19cd=_0x2d1c5a,_0x76a77c={'unitId':_0x4daf68,'threadId':_0x30e3d8},_0x2dd97e=await this[_0x5d19cd(0x109)]['post'](_0x5d19cd(0x10a)+_0x4daf68+_0x5d19cd(0x179),{'body':_0x76a77c}),_0x3e6e53=_0x30e3d8[_0x5d19cd(0x17b)](_0x3a0879=>_0x4513b1(_0x2dd97e['body']['comments'][_0x3a0879],_0x4daf68,_0x3df24c))['filter'](Boolean);return Object[_0x5d19cd(0x112)](_0x2dd97e[_0x5d19cd(0x141)][_0x5d19cd(0x177)])[_0x5d19cd(0x11d)](_0x4e7ff0=>{const _0x434fbd=_0x5d19cd;this['_userService'][_0x434fbd(0x111)](_0x4e7ff0);}),_0x3e6e53;}['saveCommentToSnapshot'](_0x2a7527){const _0x25447e=_0x2d1c5a;return{'id':_0x2a7527['id'],'threadId':_0x2a7527[_0x25447e(0x14f)],'ref':_0x2a7527[_0x25447e(0x11b)]};}};_0x4c567b=_0x34829b([_0x5b385f(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93['HTTPService'])),_0x5b385f(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x11c)])),_0x5b385f(0x2,_0x3d0190[_0x2d1c5a(0x182)](_0x3db026[_0x2d1c5a(0x10c)])),_0x5b385f(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)]))],_0x4c567b);var _0x570b55=Object[_0x2d1c5a(0x18e)],_0x4c869a=Object[_0x2d1c5a(0x145)],_0x2bb772=(_0x5d19b3,_0x75698f,_0x41601e,_0x4776a3)=>{const _0x42d174=_0x2d1c5a;for(var _0x5d00a1=_0x4776a3>0x1?void 0x0:_0x4776a3?_0x4c869a(_0x75698f,_0x41601e):_0x75698f,_0x372fde=_0x5d19b3[_0x42d174(0x104)]-0x1,_0x2d1d7c;_0x372fde>=0x0;_0x372fde--)(_0x2d1d7c=_0x5d19b3[_0x372fde])&&(_0x5d00a1=(_0x4776a3?_0x2d1d7c(_0x75698f,_0x41601e,_0x5d00a1):_0x2d1d7c(_0x5d00a1))||_0x5d00a1);return _0x4776a3&&_0x5d00a1&&_0x570b55(_0x75698f,_0x41601e,_0x5d00a1),_0x5d00a1;},_0x49a366=(_0x4fbd56,_0x28563b)=>(_0x62fef0,_0x2e0de7)=>_0x28563b(_0x62fef0,_0x2e0de7,_0x4fbd56);let _0x6c0c22=class{constructor(_0x8dc74c){const _0x9e5a88=_0x2d1c5a;this[_0x9e5a88(0x109)]=_0x8dc74c;}async[_0x2d1c5a(0x12e)](_0x44bee6,_0x20771b,_0x304520){const _0x58ba96=_0x2d1c5a,_0x5c5129=new URL(window[_0x58ba96(0x18d)][_0x58ba96(0x173)])['searchParams'][_0x58ba96(0x191)](_0x58ba96(0x110));if(!_0x5c5129)return[];const _0x45b2ad=window['location'][_0x58ba96(0x148)],_0x371842=window[_0x58ba96(0x18d)][_0x58ba96(0x158)]===_0x58ba96(0x12f)?_0x58ba96(0x165):_0x58ba96(0x13a);return(await this[_0x58ba96(0x109)][_0x58ba96(0x191)](_0x371842+_0x58ba96(0x149)+_0x45b2ad+_0x58ba96(0x103),{'params':{'objectID':_0x5c5129,'unitID':_0x5c5129}}))[_0x58ba96(0x141)][_0x58ba96(0x108)]['map'](_0x2a842b=>{const _0x1b1849=_0x58ba96;var _0x1e4d30,_0xf43929,_0x5015c8,_0x1c8f43,_0x561c23,_0x131e08;return{'id':(_0xf43929=(_0x1e4d30=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x1e4d30[_0x1b1849(0x171)])!=null?_0xf43929:'','label':(_0x1c8f43=(_0x5015c8=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x5015c8[_0x1b1849(0x15c)])!=null?_0x1c8f43:'','icon':(_0x131e08=(_0x561c23=_0x2a842b[_0x1b1849(0x113)])==null?void 0x0:_0x561c23[_0x1b1849(0x133)])!=null?_0x131e08:'','type':_0x1b1849(0x130)};});}};_0x6c0c22=_0x2bb772([_0x49a366(0x0,_0x3d0190[_0x2d1c5a(0x182)](_0x49bd93[_0x2d1c5a(0x176)]))],_0x6c0c22);var _0x37496f=Object[_0x2d1c5a(0x18e)],_0x2a227c=Object[_0x2d1c5a(0x145)],_0x4d0464=(_0xd2a913,_0x87dbce,_0x5883ab,_0x51ad35)=>{for(var _0x14a9f4=_0x51ad35>0x1?void 0x0:_0x51ad35?_0x2a227c(_0x87dbce,_0x5883ab):_0x87dbce,_0x44abcb=_0xd2a913['length']-0x1,_0x5f82e1;_0x44abcb>=0x0;_0x44abcb--)(_0x5f82e1=_0xd2a913[_0x44abcb])&&(_0x14a9f4=(_0x51ad35?_0x5f82e1(_0x87dbce,_0x5883ab,_0x14a9f4):_0x5f82e1(_0x14a9f4))||_0x14a9f4);return _0x51ad35&&_0x14a9f4&&_0x37496f(_0x87dbce,_0x5883ab,_0x14a9f4),_0x14a9f4;},_0x434cce=(_0x1e9d3e,_0x140f0b)=>(_0x18600b,_0x5bb0a4)=>_0x140f0b(_0x18600b,_0x5bb0a4,_0x1e9d3e);let _0x3d1a79=class extends _0x3d0190[_0x2d1c5a(0x125)]{constructor(_0x3b6ddb,_0x357b76,_0x337cf9,_0x481722){const _0x165423=_0x2d1c5a;super(),this[_0x165423(0x142)]=_0x3b6ddb,this[_0x165423(0x17c)]=_0x357b76,this[_0x165423(0x136)]=_0x337cf9,this[_0x165423(0x146)]=_0x481722,this[_0x165423(0x190)]();}[_0x2d1c5a(0x190)](){const _0x38ca74=_0x2d1c5a;this[_0x38ca74(0x142)][_0x38ca74(0x15a)]=this[_0x38ca74(0x17c)],this[_0x38ca74(0x142)][_0x38ca74(0x152)]=!0x1,this[_0x38ca74(0x136)]['dataSource']=this[_0x38ca74(0x146)];}};_0x3d1a79=_0x4d0464([_0x434cce(0x0,_0x5c0884['IThreadCommentDataSourceService']),_0x434cce(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x4c567b)),_0x434cce(0x2,_0x3ed21d[_0x2d1c5a(0x14c)]),_0x434cce(0x3,_0x3d0190[_0x2d1c5a(0x182)](_0x6c0c22))],_0x3d1a79);var _0x25b1bc=Object[_0x2d1c5a(0x18e)],_0x271190=Object[_0x2d1c5a(0x145)],_0x51ac44=(_0x241833,_0x23df0b,_0x468956)=>_0x23df0b in _0x241833?_0x25b1bc(_0x241833,_0x23df0b,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x468956}):_0x241833[_0x23df0b]=_0x468956,_0x222d11=(_0x2385c4,_0x1ead91,_0x5319db,_0x2527a7)=>{const _0x478081=_0x2d1c5a;for(var _0x55b4d9=_0x2527a7>0x1?void 0x0:_0x2527a7?_0x271190(_0x1ead91,_0x5319db):_0x1ead91,_0x5b3d36=_0x2385c4[_0x478081(0x104)]-0x1,_0x196bb6;_0x5b3d36>=0x0;_0x5b3d36--)(_0x196bb6=_0x2385c4[_0x5b3d36])&&(_0x55b4d9=(_0x2527a7?_0x196bb6(_0x1ead91,_0x5319db,_0x55b4d9):_0x196bb6(_0x55b4d9))||_0x55b4d9);return _0x2527a7&&_0x55b4d9&&_0x25b1bc(_0x1ead91,_0x5319db,_0x55b4d9),_0x55b4d9;},_0x54454a=(_0x412be0,_0x463a27)=>(_0x108220,_0x1cfaae)=>_0x463a27(_0x108220,_0x1cfaae,_0x412be0),_0x3d7f66=(_0x3bb133,_0x545864,_0x5eac52)=>_0x51ac44(_0x3bb133,typeof _0x545864!=_0x2d1c5a(0x11a)?_0x545864+'':_0x545864,_0x5eac52);_0x17a296[_0x2d1c5a(0x159)]=class extends _0x3d0190[_0x2d1c5a(0x10e)]{constructor(_0x54fd89=_0x5c96e1,_0x322218,_0x48bb3f){const _0x37d3fc=_0x2d1c5a;super(),this['_config']=_0x54fd89,this['_injector']=_0x322218,this['_configService']=_0x48bb3f;const {..._0x3fd3f9}=this[_0x37d3fc(0x169)];this[_0x37d3fc(0x170)][_0x37d3fc(0x189)](_0x168b3a,_0x3fd3f9);}[_0x2d1c5a(0x131)](){const _0x2e3fbe=_0x2d1c5a;[[_0x6c0c22],[_0x4c567b],[_0x3d1a79],[_0x2c4030]][_0x2e3fbe(0x11d)](_0x3c3c13=>{const _0x20958e=_0x2e3fbe;this['_injector'][_0x20958e(0x139)](_0x3c3c13);});}[_0x2d1c5a(0x10d)](){const _0x31eae9=_0x2d1c5a;this[_0x31eae9(0x101)]['get'](_0x3d1a79),this[_0x31eae9(0x101)][_0x31eae9(0x191)](_0x2c4030);}},_0x3d7f66(_0x17a296['UniverThreadCommentDataSourcePlugin'],_0x2d1c5a(0x13c),_0x581514),_0x3d7f66(_0x17a296[_0x2d1c5a(0x159)],'type',_0x3d0190[_0x2d1c5a(0x129)][_0x2d1c5a(0x153)]),_0x17a296[_0x2d1c5a(0x159)]=_0x222d11([_0x3d0190['DependentOn'](_0x3ed21d['UniverThreadCommentUIPlugin'],_0x3db026[_0x2d1c5a(0x115)],_0x51384d[_0x2d1c5a(0x118)]),_0x54454a(0x1,_0x3d0190[_0x2d1c5a(0x182)](_0x3d0190[_0x2d1c5a(0x10f)])),_0x54454a(0x2,_0x3d0190['IConfigService'])],_0x17a296[_0x2d1c5a(0x159)]),Object['defineProperty'](_0x17a296,Symbol[_0x2d1c5a(0x14a)],{'value':'Module'});}));function _0x45cb(){const _0x4c3ba6=['delete','Disposable','addComment','_initUserSync','rxjs','UniverInstanceType','userId','UniverNetwork','Unknown','thread-comment-data-source.config','getMentions','https:','user','onStarting','error','avatar','updateComment','customRanges','_threadCommentMentionDataService','UNRECOGNIZED','resolved','add','http','@univerjs/thread-comment','pluginName','@univerjs/thread-comment-ui','resolveComment','/edit','deleteComment','body','_threadCommentDataSourceService','UniverProThreadCommentDatasource','UniverThreadComment','getOwnPropertyDescriptor','_threadCommentMentionDataSource','6846820HIrJlY','host','://','toStringTag','post','IThreadCommentMentionDataService','stringify','replyId','threadId','CustomRangeType','_userService','syncUpdateMutationToColla','UNIVER_UNKNOWN','find','748670RYfhYR','size','14296464KKikiZ','protocol','UniverThreadCommentDataSourcePlugin','dataSource','rangeType','name','580ElmYGS','bufferTime','Delete','UniverProLicense','reply','personId','Solve','parse','https','solved','subscribe','dayjs','_config','commentUpdate$','CommentService','4782FSQpvV','UniverProCollaborationClient','object','Solved','_configService','userID','/delete','href','getUnit','filter','HTTPService','users','@univerjs-pro/collaboration-client','/list','YYYY/MM/DD\x20HH:mm','map','_threadCommentDataSource','unitId','payload','comment','content','13615oBUuuF','Inject','getComment','/add','root','/solved','UniverThreadCommentUi','@univerjs/core','setConfig','getMemberID','COMMENT','7362024zfVyhe','location','defineProperty','Edit','_initDataSource','get','/reply','14718WcxWkQ','Reply','Add','disposeWithMe','pipe','_injector','_sessionService','/universer-api/authz/collaborator','length','@univerjs-pro/license','exports','code','collaborators','_httpService','/universer-api/comment/unit/','getCurrentUser','CollaborationSessionService','onReady','Plugin','Injector','unit','addUser','values','subject','_threadCommentModel','UniverCollaborationClientPlugin','replies','type','UniverLicensePlugin','2532470kOXJCz','symbol','ref','UserManagerService','forEach','requireSession','_commentService','@univerjs/network','OpenOrReOpen','rangeId','createTimestamp'];_0x45cb=function(){return _0x4c3ba6;};return _0x45cb();}
|
|
293
|
+
|