@univerjs/preset-sheets-thread-comment 0.5.2 → 0.5.4

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.
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/en-US"),s=require("@univerjs/thread-comment-ui/locale/en-US"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/en-US"),t=require("@univerjs/thread-comment-ui/locale/en-US"),s=e.merge({},r,t);module.exports=s;
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/fa-IR"),s=require("@univerjs/thread-comment-ui/locale/fa-IR"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/fa-IR"),t=require("@univerjs/thread-comment-ui/locale/fa-IR"),s=e.merge({},r,t);module.exports=s;
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/fr-FR"),s=require("@univerjs/thread-comment-ui/locale/fr-FR"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/fr-FR"),t=require("@univerjs/thread-comment-ui/locale/fr-FR"),s=e.merge({},r,t);module.exports=s;
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/ru-RU"),s=require("@univerjs/thread-comment-ui/locale/ru-RU"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/ru-RU"),t=require("@univerjs/thread-comment-ui/locale/ru-RU"),s=e.merge({},r,t);module.exports=s;
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/vi-VN"),s=require("@univerjs/thread-comment-ui/locale/vi-VN"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/vi-VN"),t=require("@univerjs/thread-comment-ui/locale/vi-VN"),s=e.merge({},r,t);module.exports=s;
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/zh-CN"),s=require("@univerjs/thread-comment-ui/locale/zh-CN"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/zh-CN"),t=require("@univerjs/thread-comment-ui/locale/zh-CN"),s=e.merge({},r,t);module.exports=s;
@@ -1 +1 @@
1
- "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/zh-TW"),s=require("@univerjs/thread-comment-ui/locale/zh-TW"),t=e.Tools.deepMerge({},r,s);module.exports=t;
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/zh-TW"),t=require("@univerjs/thread-comment-ui/locale/zh-TW"),s=e.merge({},r,t);module.exports=s;
@@ -1,11 +1,11 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import o from "@univerjs/sheets-thread-comment-ui/locale/en-US";
3
- import r from "@univerjs/thread-comment-ui/locale/en-US";
4
- const s = e.deepMerge(
1
+ import { merge as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/en-US";
3
+ import m from "@univerjs/thread-comment-ui/locale/en-US";
4
+ const n = e(
5
5
  {},
6
- o,
7
- r
6
+ r,
7
+ m
8
8
  );
9
9
  export {
10
- s as default
10
+ n as default
11
11
  };
@@ -1,10 +1,10 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import o from "@univerjs/sheets-thread-comment-ui/locale/fa-IR";
3
- import r from "@univerjs/thread-comment-ui/locale/fa-IR";
4
- const s = e.deepMerge(
1
+ import { merge as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/fa-IR";
3
+ import m from "@univerjs/thread-comment-ui/locale/fa-IR";
4
+ const s = e(
5
5
  {},
6
- o,
7
- r
6
+ r,
7
+ m
8
8
  );
9
9
  export {
10
10
  s as default
@@ -1,10 +1,10 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import r from "@univerjs/sheets-thread-comment-ui/locale/fr-FR";
3
- import o from "@univerjs/thread-comment-ui/locale/fr-FR";
4
- const s = e.deepMerge(
1
+ import { merge as r } from "@univerjs/core";
2
+ import e from "@univerjs/sheets-thread-comment-ui/locale/fr-FR";
3
+ import m from "@univerjs/thread-comment-ui/locale/fr-FR";
4
+ const s = r(
5
5
  {},
6
- r,
7
- o
6
+ e,
7
+ m
8
8
  );
9
9
  export {
10
10
  s as default
@@ -1,10 +1,10 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import r from "@univerjs/sheets-thread-comment-ui/locale/ru-RU";
3
- import o from "@univerjs/thread-comment-ui/locale/ru-RU";
4
- const s = e.deepMerge(
1
+ import { merge as r } from "@univerjs/core";
2
+ import e from "@univerjs/sheets-thread-comment-ui/locale/ru-RU";
3
+ import m from "@univerjs/thread-comment-ui/locale/ru-RU";
4
+ const s = r(
5
5
  {},
6
- r,
7
- o
6
+ e,
7
+ m
8
8
  );
9
9
  export {
10
10
  s as default
@@ -1,10 +1,10 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import o from "@univerjs/sheets-thread-comment-ui/locale/vi-VN";
3
- import r from "@univerjs/thread-comment-ui/locale/vi-VN";
4
- const s = e.deepMerge(
1
+ import { merge as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/vi-VN";
3
+ import m from "@univerjs/thread-comment-ui/locale/vi-VN";
4
+ const s = e(
5
5
  {},
6
- o,
7
- r
6
+ r,
7
+ m
8
8
  );
9
9
  export {
10
10
  s as default
@@ -1,10 +1,10 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import o from "@univerjs/sheets-thread-comment-ui/locale/zh-CN";
3
- import r from "@univerjs/thread-comment-ui/locale/zh-CN";
4
- const s = e.deepMerge(
1
+ import { merge as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/zh-CN";
3
+ import m from "@univerjs/thread-comment-ui/locale/zh-CN";
4
+ const s = e(
5
5
  {},
6
- o,
7
- r
6
+ r,
7
+ m
8
8
  );
9
9
  export {
10
10
  s as default
@@ -1,10 +1,10 @@
1
- import { Tools as e } from "@univerjs/core";
2
- import o from "@univerjs/sheets-thread-comment-ui/locale/zh-TW";
3
- import r from "@univerjs/thread-comment-ui/locale/zh-TW";
4
- const s = e.deepMerge(
1
+ import { merge as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/zh-TW";
3
+ import m from "@univerjs/thread-comment-ui/locale/zh-TW";
4
+ const s = e(
5
5
  {},
6
- o,
7
- r
6
+ r,
7
+ m
8
8
  );
9
9
  export {
10
10
  s as default
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(63 131 248 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(63 131 248 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*{scrollbar-color:initial;scrollbar-width:initial}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
1
+ .univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
@@ -1,6 +1,7 @@
1
1
  import { IPreset } from './types';
2
2
  import '@univerjs/sheets-thread-comment/facade';
3
3
  import '@univerjs/thread-comment-ui/lib/index.css';
4
+ export type * from '@univerjs/sheets-thread-comment/facade';
4
5
  export interface IUniverSheetsThreadCommentPresetConfig {
5
6
  }
6
7
  /**
package/lib/umd/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // @univerjs/thread-comment/index
2
- (function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.UniverThreadComment={},s.UniverCore,s.rxjs))})(this,function(s,c,M){"use strict";var F=Object.defineProperty;var z=(s,c,M)=>c in s?F(s,c,{enumerable:!0,configurable:!0,writable:!0,value:M}):s[c]=M;var u=(s,c,M)=>z(s,typeof c!="symbol"?c+"":c,M);var T;class E extends c.Disposable{constructor(){super();u(this,"_dataSource",null);u(this,"syncUpdateMutationToColla",!0)}set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}async getThreadComment(e,t,n){return this._dataSource?(await this._dataSource.listComments(e,t,[n]))[0]:null}async addComment(e){var t;return this._dataSource?this._dataSource.addComment(e):{...e,threadId:(t=e.threadId)!=null?t:e.id}}async updateComment(e){return this._dataSource?this._dataSource.updateComment(e):!0}async resolveComment(e){return this._dataSource?this._dataSource.resolveComment(e):!0}async deleteComment(e,t,n,o){return this._dataSource?this._dataSource.deleteComment(e,t,n,o):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){const n={};return Object.keys(e).forEach(o=>{const a=e[o];n[o]=a.map(this.dataSource.saveCommentToSnapshot)}),n}return e}}const C=c.createIdentifier("univer.thread-comment.data-source-service");var V=Object.defineProperty,W=Object.getOwnPropertyDescriptor,b=(r,m,e,t)=>{for(var n=t>1?void 0:t?W(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&V(m,e,n),n},R=(r,m)=>(e,t)=>m(e,t,r);s.ThreadCommentModel=class extends c.Disposable{constructor(e,t){super();u(this,"_commentsMap",new Map);u(this,"_threadMap",new Map);u(this,"_commentUpdate$",new M.Subject);u(this,"commentUpdate$",this._commentUpdate$.asObservable());u(this,"_tasks",[]);this._dataSourceService=e,this._lifecycleService=t,this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(n=>{const o=new Map;n===c.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:a,subUnitId:d,threadIds:i})=>{let h=o.get(a);h||(h=new Map,o.set(a,h));let l=h.get(d);l||(l=new Set,h.set(d,l));for(const f of i)l.add(f)}),this._tasks=[],o.forEach((a,d)=>{a.forEach((i,h)=>{this.syncThreadComments(d,h,Array.from(i))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}ensureMap(e,t){return this._ensureCommentMap(e,t)}_ensureThreadMap(e,t){let n=this._threadMap.get(e);n||(n=new Map,this._threadMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}_replaceComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n.id);if(a){const{children:d,...i}=n,h={...i,ref:a.ref};o.set(n.id,h),d==null||d.forEach(l=>{o.set(l.id,{...l,ref:""})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"syncUpdate",payload:h}),!!n.resolved!=!!a.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n.id,resolved:!!n.resolved}})}}async syncThreadComments(e,t,n){if(this._lifecycleService.stage<c.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:t,threadIds:n});return}const o=this._ensureThreadMap(e,t),a=this._ensureCommentMap(e,t),d=await this._dataSourceService.listThreadComments(e,t,n);if(!d)return;const i=new Set(n);d.forEach(h=>{this._replaceComment(e,t,h),i.delete(h.threadId)}),i.forEach(h=>{o.delete(h),a.forEach((l,f)=>{l.threadId===h&&a.delete(f)})})}addComment(e,t,n,o){const a=this._ensureCommentMap(e,t),{parentId:d,children:i=[],...h}=n,l={...h,parentId:d===n.id?void 0:d};l.threadId||(l.threadId=l.parentId||l.id);const f=p=>{a.set(p.id,p),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"add",payload:p,isRoot:!p.parentId})};f(l);const L=this._ensureThreadMap(e,t);if(!l.parentId){L.set(l.threadId,l);for(const p of i)f(p)}return o&&this.syncThreadComments(e,t,[l.threadId]),!0}updateComment(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n.commentId);return d&&(d.updated=!0,d.text=n.text,d.attachments=n.attachments,d.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"update",payload:n,silent:o})),!0}updateCommentRef(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n.commentId);return d?(d.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"updateRef",payload:n,silent:o,threadId:d.threadId}),!0):!1}resolveComment(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n);return d?(d.resolved=o,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n,resolved:o}}),!0):!1}getComment(e,t,n){return this._ensureCommentMap(e,t).get(n)}getRootComment(e,t,n){return this._ensureThreadMap(e,t).get(n)}getThread(e,t,n){const o=this._ensureCommentMap(e,t),a=Array.from(o.values()).filter(l=>l.threadId===n);let d;const i=[],h=new Set;for(const l of a)l.parentId?i.push(l):d=l,h.add(l.personId);if(d)return{root:d,children:i,relativeUsers:h,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){const o=this.getComment(e,t,n);if(o)return this.getThread(e,t,o.threadId)}_deleteComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n);a&&(o.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"delete",payload:{commentId:n,isRoot:!a.parentId,comment:a}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(d=>{d.threadId===n&&this._deleteComment(e,t,d.id)})}deleteComment(e,t,n){const a=this._ensureCommentMap(e,t).get(n);return a&&(a.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,a.threadId)),!0}deleteUnit(e){const t=this._commentsMap.get(e);t&&t.forEach((n,o)=>{n.forEach(a=>{this.deleteComment(e,o,a.id)})})}getUnit(e){const t=this._threadMap.get(e);if(!t)return[];const n=[];return t.forEach((o,a)=>{o.forEach((d,i)=>{const h=this.getThread(e,a,i);h&&n.push(h)})}),n}getAll(){const e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}},s.ThreadCommentModel=b([R(0,c.Inject(C)),R(1,c.Inject(c.LifecycleService))],s.ThreadCommentModel);var v=(r=>(r[r.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",r[r.UNIVER_DOC=1]="UNIVER_DOC",r[r.UNIVER_SHEET=2]="UNIVER_SHEET",r[r.UNIVER_SLIDE=3]="UNIVER_SLIDE",r[r.UNIVER_PROJECT=4]="UNIVER_PROJECT",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))(v||{});const S="UNIVER_THREAD_COMMENT_PLUGIN";var H=Object.defineProperty,J=Object.getOwnPropertyDescriptor,G=(r,m,e,t)=>{for(var n=t>1?void 0:t?J(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&H(m,e,n),n},g=(r,m)=>(e,t)=>m(e,t,r);s.ThreadCommentResourceController=class extends c.Disposable{constructor(m,e,t){super(),this._resourceManagerService=m,this._threadCommentModel=e,this._threadCommentDataSourceService=t,this._initSnapshot()}_initSnapshot(){const m=t=>{const n=this._threadCommentModel.getUnit(t),o={};return n?(n.forEach(a=>{var i;const d=(i=o[a.subUnitId])!=null?i:[];d.push({...a.root,children:a.children}),o[a.subUnitId]=d}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(o,t))):""},e=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:`SHEET_${S}`,businesses:[v.UNIVER_SHEET,v.UNIVER_DOC],toJson:t=>m(t),parseJson:t=>e(t),onUnLoad:t=>{this._threadCommentModel.deleteUnit(t)},onLoad:async(t,n)=>{Object.keys(n).forEach(o=>{const a=n[o];a.forEach(d=>{this._threadCommentModel.addComment(t,o,d)}),this._threadCommentModel.syncThreadComments(t,o,a.map(d=>d.threadId))})}}))}},s.ThreadCommentResourceController=G([g(0,c.IResourceManagerService),g(1,c.Inject(s.ThreadCommentModel)),g(2,C)],s.ThreadCommentResourceController);const y={id:"thread-comment.mutation.add-comment",type:c.CommandType.MUTATION,handler(r,m,e){if(!m)return!1;const t=r.get(s.ThreadCommentModel),{unitId:n,subUnitId:o,comment:a,sync:d}=m,i=d||(e==null?void 0:e.fromChangeset)&&!a.parentId;return t.addComment(n,o,a,i)}},U={id:"thread-comment.mutation.update-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateComment(t,n,o,a)}},O={id:"thread-comment.mutation.update-comment-ref",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateCommentRef(t,n,o,a)}},N={id:"thread-comment.mutation.resolve-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,resolved:o,commentId:a}=m;return e.resolveComment(t,n,a,o)}},_={id:"thread-comment.mutation.delete-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,commentId:o}=m;return e.deleteComment(t,n,o)}},D={id:"thread-comment.command.add-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(c.ICommandService),t=r.get(C),{comment:n}=m,o=await t.addComment(n),a=t.syncUpdateMutationToColla,d=!n.parentId,i={id:y.id,params:{...m,comment:o}};return d?await e.executeCommand(i.id,i.params):e.executeCommand(i.id,i.params,{onlyLocal:!a})}},P={id:"thread-comment.command.update-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const{unitId:e,subUnitId:t,payload:n}=m,o=r.get(c.ICommandService),a=r.get(s.ThreadCommentModel),d=r.get(C),i=d.syncUpdateMutationToColla,h=a.getComment(e,t,n.commentId);if(!h)return!1;const{children:l,...f}=h;if(!await d.updateComment({...f,...n}))return!1;const p={id:U.id,params:m};return o.executeCommand(p.id,p.params,{onlyLocal:!i}),!0}},w={id:"thread-comment.command.resolve-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const{unitId:e,subUnitId:t,resolved:n,commentId:o}=m,a=r.get(C),i=r.get(s.ThreadCommentModel).getComment(e,t,o),h=a.syncUpdateMutationToColla;return!i||!await a.resolveComment({...i,resolved:n})?!1:r.get(c.ICommandService).executeCommand(N.id,m,{onlyLocal:!h})}},j={id:"thread-comment.command.delete-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),t=r.get(C),n=r.get(c.ICommandService),{unitId:o,subUnitId:a,commentId:d}=m,i=t.syncUpdateMutationToColla,h=e.getComment(o,a,d);if(!h||!await t.deleteComment(o,a,h.threadId,d))return!1;const l={id:_.id,params:m};return n.executeCommand(l.id,l.params,{onlyLocal:!i})}},A={id:"thread-comment.command.delete-comment-tree",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),t=r.get(c.ICommandService),n=r.get(C),{unitId:o,subUnitId:a,commentId:d}=m,i=e.getCommentWithChildren(o,a,d);return!i||!await n.deleteComment(o,a,i.root.threadId,d)?!1:await t.executeCommand(_.id,{unitId:o,subUnitId:a,commentId:i.root.id})}},Y="thread-comment.config",$={};var K=Object.defineProperty,B=Object.getOwnPropertyDescriptor,q=(r,m,e,t)=>{for(var n=t>1?void 0:t?B(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&K(m,e,n),n},I=(r,m)=>(e,t)=>m(e,t,r);s.UniverThreadCommentPlugin=(T=class extends c.Plugin{constructor(m=$,e,t,n){super(),this._config=m,this._injector=e,this._commandService=t,this._configService=n;const{...o}=c.merge({},$,this._config);this._configService.setConfig(Y,o)}onStarting(){var m;c.mergeOverrideWithDependencies([[C,{useClass:E}],[s.ThreadCommentModel],[s.ThreadCommentResourceController]],(m=this._config)==null?void 0:m.overrides).forEach(e=>{this._injector.add(e)}),[D,P,j,w,A,y,U,O,_,N].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(s.ThreadCommentResourceController)}},u(T,"pluginName",S),u(T,"type",c.UniverInstanceType.UNIVER_UNKNOWN),T),s.UniverThreadCommentPlugin=q([I(1,c.Inject(c.Injector)),I(2,c.ICommandService),I(3,c.IConfigService)],s.UniverThreadCommentPlugin);function Z(){return c.dayjs().format("YYYY/MM/DD HH:mm")}s.AddCommentCommand=D,s.AddCommentMutation=y,s.DeleteCommentCommand=j,s.DeleteCommentMutation=_,s.DeleteCommentTreeCommand=A,s.IThreadCommentDataSourceService=C,s.ResolveCommentCommand=w,s.ResolveCommentMutation=N,s.TC_PLUGIN_NAME=S,s.ThreadCommentDataSourceService=E,s.UpdateCommentCommand=P,s.UpdateCommentMutation=U,s.UpdateCommentRefMutation=O,s.getDT=Z,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
2
+ (function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.UniverThreadComment={},s.UniverCore,s.rxjs))})(this,function(s,c,M){"use strict";var F=Object.defineProperty;var z=(s,c,M)=>c in s?F(s,c,{enumerable:!0,configurable:!0,writable:!0,value:M}):s[c]=M;var l=(s,c,M)=>z(s,typeof c!="symbol"?c+"":c,M);var T;class E extends c.Disposable{constructor(){super();l(this,"_dataSource",null);l(this,"syncUpdateMutationToColla",!0)}set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}async getThreadComment(e,t,n){return this._dataSource?(await this._dataSource.listComments(e,t,[n]))[0]:null}async addComment(e){var t;return this._dataSource?this._dataSource.addComment(e):{...e,threadId:(t=e.threadId)!=null?t:e.id}}async updateComment(e){return this._dataSource?this._dataSource.updateComment(e):!0}async resolveComment(e){return this._dataSource?this._dataSource.resolveComment(e):!0}async deleteComment(e,t,n,o){return this._dataSource?this._dataSource.deleteComment(e,t,n,o):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){const n={};return Object.keys(e).forEach(o=>{const a=e[o];n[o]=a.map(this.dataSource.saveCommentToSnapshot)}),n}return e}}const C=c.createIdentifier("univer.thread-comment.data-source-service");var V=Object.defineProperty,W=Object.getOwnPropertyDescriptor,b=(r,m,e,t)=>{for(var n=t>1?void 0:t?W(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&V(m,e,n),n},R=(r,m)=>(e,t)=>m(e,t,r);s.ThreadCommentModel=class extends c.Disposable{constructor(e,t){super();l(this,"_commentsMap",new Map);l(this,"_threadMap",new Map);l(this,"_commentUpdate$",new M.Subject);l(this,"commentUpdate$",this._commentUpdate$.asObservable());l(this,"_tasks",[]);this._dataSourceService=e,this._lifecycleService=t,this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(n=>{const o=new Map;n===c.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:a,subUnitId:d,threadIds:i})=>{let h=o.get(a);h||(h=new Map,o.set(a,h));let u=h.get(d);u||(u=new Set,h.set(d,u));for(const f of i)u.add(f)}),this._tasks=[],o.forEach((a,d)=>{a.forEach((i,h)=>{this.syncThreadComments(d,h,Array.from(i))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}ensureMap(e,t){return this._ensureCommentMap(e,t)}_ensureThreadMap(e,t){let n=this._threadMap.get(e);n||(n=new Map,this._threadMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}_replaceComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n.id);if(a){const{children:d,...i}=n,h={...i,ref:a.ref};o.set(n.id,h),d==null||d.forEach(u=>{o.set(u.id,{...u,ref:""})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"syncUpdate",payload:h}),!!n.resolved!=!!a.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n.id,resolved:!!n.resolved}})}}async syncThreadComments(e,t,n){if(this._lifecycleService.stage<c.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:t,threadIds:n});return}const o=this._ensureThreadMap(e,t),a=this._ensureCommentMap(e,t),d=await this._dataSourceService.listThreadComments(e,t,n);if(!d)return;const i=new Set(n);d.forEach(h=>{this._replaceComment(e,t,h),i.delete(h.threadId)}),i.forEach(h=>{o.delete(h),a.forEach((u,f)=>{u.threadId===h&&a.delete(f)})})}addComment(e,t,n,o){const a=this._ensureCommentMap(e,t),{parentId:d,children:i=[],...h}=n,u={...h,parentId:d===n.id?void 0:d};u.threadId||(u.threadId=u.parentId||u.id);const f=p=>{a.set(p.id,p),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"add",payload:p,isRoot:!p.parentId})};f(u);const L=this._ensureThreadMap(e,t);if(!u.parentId){L.set(u.threadId,u);for(const p of i)f(p)}return o&&this.syncThreadComments(e,t,[u.threadId]),!0}updateComment(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n.commentId);return d&&(d.updated=!0,d.text=n.text,d.attachments=n.attachments,d.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"update",payload:n,silent:o})),!0}updateCommentRef(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n.commentId);return d?(d.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"updateRef",payload:n,silent:o,threadId:d.threadId}),!0):!1}resolveComment(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n);return d?(d.resolved=o,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n,resolved:o}}),!0):!1}getComment(e,t,n){return this._ensureCommentMap(e,t).get(n)}getRootComment(e,t,n){return this._ensureThreadMap(e,t).get(n)}getThread(e,t,n){const o=this._ensureCommentMap(e,t),a=Array.from(o.values()).filter(u=>u.threadId===n);let d;const i=[],h=new Set;for(const u of a)u.parentId?i.push(u):d=u,h.add(u.personId);if(d)return{root:d,children:i,relativeUsers:h,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){const o=this.getComment(e,t,n);if(o)return this.getThread(e,t,o.threadId)}_deleteComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n);a&&(o.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"delete",payload:{commentId:n,isRoot:!a.parentId,comment:a}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(d=>{d.threadId===n&&this._deleteComment(e,t,d.id)})}deleteComment(e,t,n){const a=this._ensureCommentMap(e,t).get(n);return a&&(a.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,a.threadId)),!0}deleteUnit(e){const t=this._commentsMap.get(e);t&&t.forEach((n,o)=>{n.forEach(a=>{this.deleteComment(e,o,a.id)})})}getUnit(e){const t=this._threadMap.get(e);if(!t)return[];const n=[];return t.forEach((o,a)=>{o.forEach((d,i)=>{const h=this.getThread(e,a,i);h&&n.push(h)})}),n}getAll(){const e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}},s.ThreadCommentModel=b([R(0,c.Inject(C)),R(1,c.Inject(c.LifecycleService))],s.ThreadCommentModel);var v=(r=>(r[r.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",r[r.UNIVER_DOC=1]="UNIVER_DOC",r[r.UNIVER_SHEET=2]="UNIVER_SHEET",r[r.UNIVER_SLIDE=3]="UNIVER_SLIDE",r[r.UNIVER_PROJECT=4]="UNIVER_PROJECT",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))(v||{});const S="UNIVER_THREAD_COMMENT_PLUGIN";var H=Object.defineProperty,J=Object.getOwnPropertyDescriptor,G=(r,m,e,t)=>{for(var n=t>1?void 0:t?J(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&H(m,e,n),n},g=(r,m)=>(e,t)=>m(e,t,r);s.ThreadCommentResourceController=class extends c.Disposable{constructor(m,e,t){super(),this._resourceManagerService=m,this._threadCommentModel=e,this._threadCommentDataSourceService=t,this._initSnapshot()}_initSnapshot(){const m=t=>{const n=this._threadCommentModel.getUnit(t),o={};return n?(n.forEach(a=>{var i;const d=(i=o[a.subUnitId])!=null?i:[];d.push({...a.root,children:a.children}),o[a.subUnitId]=d}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(o,t))):""},e=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:`SHEET_${S}`,businesses:[v.UNIVER_SHEET,v.UNIVER_DOC],toJson:t=>m(t),parseJson:t=>e(t),onUnLoad:t=>{this._threadCommentModel.deleteUnit(t)},onLoad:async(t,n)=>{Object.keys(n).forEach(o=>{const a=n[o];a.forEach(d=>{this._threadCommentModel.addComment(t,o,d)}),this._threadCommentModel.syncThreadComments(t,o,a.map(d=>d.threadId))})}}))}},s.ThreadCommentResourceController=G([g(0,c.IResourceManagerService),g(1,c.Inject(s.ThreadCommentModel)),g(2,C)],s.ThreadCommentResourceController);const y={id:"thread-comment.mutation.add-comment",type:c.CommandType.MUTATION,handler(r,m,e){if(!m)return!1;const t=r.get(s.ThreadCommentModel),{unitId:n,subUnitId:o,comment:a,sync:d}=m,i=d||(e==null?void 0:e.fromChangeset)&&!a.parentId;return t.addComment(n,o,a,i)}},U={id:"thread-comment.mutation.update-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateComment(t,n,o,a)}},O={id:"thread-comment.mutation.update-comment-ref",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateCommentRef(t,n,o,a)}},N={id:"thread-comment.mutation.resolve-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,resolved:o,commentId:a}=m;return e.resolveComment(t,n,a,o)}},_={id:"thread-comment.mutation.delete-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,commentId:o}=m;return e.deleteComment(t,n,o)}},D={id:"thread-comment.command.add-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(c.ICommandService),t=r.get(C),{comment:n}=m,o=await t.addComment(n),a=t.syncUpdateMutationToColla,d=!n.parentId,i={id:y.id,params:{...m,comment:o}};return d?await e.executeCommand(i.id,i.params):e.executeCommand(i.id,i.params,{onlyLocal:!a})}},P={id:"thread-comment.command.update-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const{unitId:e,subUnitId:t,payload:n}=m,o=r.get(c.ICommandService),a=r.get(s.ThreadCommentModel),d=r.get(C),i=d.syncUpdateMutationToColla,h=a.getComment(e,t,n.commentId);if(!h)return!1;const{children:u,...f}=h;if(!await d.updateComment({...f,...n}))return!1;const p={id:U.id,params:m};return o.executeCommand(p.id,p.params,{onlyLocal:!i}),!0}},w={id:"thread-comment.command.resolve-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const{unitId:e,subUnitId:t,resolved:n,commentId:o}=m,a=r.get(C),i=r.get(s.ThreadCommentModel).getComment(e,t,o),h=a.syncUpdateMutationToColla;return!i||!await a.resolveComment({...i,resolved:n})?!1:r.get(c.ICommandService).executeCommand(N.id,m,{onlyLocal:!h})}},j={id:"thread-comment.command.delete-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),t=r.get(C),n=r.get(c.ICommandService),{unitId:o,subUnitId:a,commentId:d}=m,i=t.syncUpdateMutationToColla,h=e.getComment(o,a,d);if(!h||!await t.deleteComment(o,a,h.threadId,d))return!1;const u={id:_.id,params:m};return n.executeCommand(u.id,u.params,{onlyLocal:!i})}},A={id:"thread-comment.command.delete-comment-tree",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),t=r.get(c.ICommandService),n=r.get(C),{unitId:o,subUnitId:a,commentId:d}=m,i=e.getCommentWithChildren(o,a,d);return!i||!await n.deleteComment(o,a,i.root.threadId,d)?!1:await t.executeCommand(_.id,{unitId:o,subUnitId:a,commentId:i.root.id})}},Y="thread-comment.config",$={};var K=Object.defineProperty,B=Object.getOwnPropertyDescriptor,q=(r,m,e,t)=>{for(var n=t>1?void 0:t?B(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&K(m,e,n),n},I=(r,m)=>(e,t)=>m(e,t,r);s.UniverThreadCommentPlugin=(T=class extends c.Plugin{constructor(m=$,e,t,n){super(),this._config=m,this._injector=e,this._commandService=t,this._configService=n;const{...o}=c.merge({},$,this._config);this._configService.setConfig(Y,o)}onStarting(){var m;c.mergeOverrideWithDependencies([[C,{useClass:E}],[s.ThreadCommentModel],[s.ThreadCommentResourceController]],(m=this._config)==null?void 0:m.overrides).forEach(e=>{this._injector.add(e)}),[D,P,j,w,A,y,U,O,_,N].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(s.ThreadCommentResourceController)}},l(T,"pluginName",S),l(T,"type",c.UniverInstanceType.UNIVER_UNKNOWN),T),s.UniverThreadCommentPlugin=q([I(1,c.Inject(c.Injector)),I(2,c.ICommandService),I(3,c.IConfigService)],s.UniverThreadCommentPlugin);function Z(r){return c.dayjs(r).format("YYYY/MM/DD HH:mm")}s.AddCommentCommand=D,s.AddCommentMutation=y,s.DeleteCommentCommand=j,s.DeleteCommentMutation=_,s.DeleteCommentTreeCommand=A,s.IThreadCommentDataSourceService=C,s.ResolveCommentCommand=w,s.ResolveCommentMutation=N,s.TC_PLUGIN_NAME=S,s.ThreadCommentDataSourceService=E,s.UpdateCommentCommand=P,s.UpdateCommentMutation=U,s.UpdateCommentRefMutation=O,s.getDT=Z,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment/index
6
- (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"})});
6
+ (function(m,o){typeof exports=="object"&&typeof module<"u"?o(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"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m.UniverSheetsThreadComment={},m.UniverCore,m.UniverEngineFormula,m.UniverSheets,m.UniverThreadComment,m.rxjs))})(this,function(m,o,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(m,o,l)=>o in m?O(m,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):m[o]=l;var f=(m,o,l)=>x(m,typeof o!="symbol"?o+"":o,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,i,e,n)=>{for(var t=n>1?void 0:n?y(i,e):i,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(i,e,t):s(t))||t);return n&&t&&T(i,e,t),t},M=(h,i)=>(e,n)=>i(e,n,h);m.SheetsThreadCommentModel=class extends o.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 o.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:d}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&d>=0&&(this._addCommentToMatrix(_,a,d,c),u.set(c,{row:a,column:d})),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)!==o.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:d}=e.payload;if(a){const c=l.singleReferenceToGrid(d.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,d.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,d=this._threadCommentModel.getComment(n,t,a);if(!d)return;const c=l.singleReferenceToGrid(d.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:d}=e.payload,c=s.get(d);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,d),s.delete(d),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,d),s.set(d,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:d,payload:c}=e,{locationMap:_}=this._ensure(a,d),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var d;return(d=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:d.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(d=>this.getComment(e,n,d)).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)}},m.SheetsThreadCommentModel=U([M(0,o.Inject(p.ThreadCommentModel)),M(1,o.IUniverInstanceService)],m.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,i,e,n)=>{for(var t=n>1?void 0:n?b(i,e):i,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(i,e,t):s(t))||t);return n&&t&&I(i,e,t),t},C=(h,i)=>(e,n)=>i(e,n,h);m.SheetsThreadCommentRefRangeController=class extends o.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,d={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(d),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 d=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(d)?d[0]:d;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,d)=>{const{redos:c}=this._handleRangeChange(e,n,t,d,!0);o.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,d=l.singleReferenceToGrid(a.ref),c={...a,...d};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(o.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},m.SheetsThreadCommentRefRangeController=j([C(0,o.Inject(g.RefRangeService)),C(1,o.Inject(m.SheetsThreadCommentModel)),C(2,o.Inject(p.ThreadCommentModel)),C(3,o.Inject(g.SheetsSelectionsService)),C(4,o.ICommandService)],m.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,i,e)=>i in h?v(h,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[i]=e,D=(h,i,e,n)=>{for(var t=n>1?void 0:n?$(i,e):i,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(i,e,t):s(t))||t);return n&&t&&v(i,e,t),t},R=(h,i)=>(e,n)=>i(e,n,h),w=(h,i,e)=>E(h,typeof i!="symbol"?i+"":i,e);m.UniverSheetsThreadCommentPlugin=class extends o.Plugin{constructor(i,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[m.SheetsThreadCommentModel],[m.SheetsThreadCommentRefRangeController]].forEach(i=>{this._injector.add(i)}),this._injector.get(m.SheetsThreadCommentRefRangeController)}},w(m.UniverSheetsThreadCommentPlugin,"pluginName",P),w(m.UniverSheetsThreadCommentPlugin,"type",o.UniverInstanceType.UNIVER_SHEET),m.UniverSheetsThreadCommentPlugin=D([o.DependentOn(p.UniverThreadCommentPlugin),R(1,o.Inject(o.Injector)),R(2,o.Inject(o.ICommandService))],m.UniverSheetsThreadCommentPlugin),Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
7
7
 
8
8
 
9
9
  // @univerjs/sheets-thread-comment/facade
10
- (function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsThreadComment,o.UniverSheetsFacade,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,u,h,s,I,g){"use strict";var l=Object.defineProperty,v=Object.getOwnPropertyDescriptor,f=(a,t,e,n)=>{for(var r=n>1?void 0:n?v(t,e):t,m=a.length-1,d;m>=0;m--)(d=a[m])&&(r=(n?d(t,e,r):d(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,d){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=d}_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()?s.DeleteCommentTreeCommand.id:s.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=s.getDT();return await this._commandService.executeCommand(s.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(s.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=f([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 d=e.getComment(n,r,m);return d?this._injector.createInstance(o.FThreadComment,d):null}addComment(t){var _;const e=this._injector,n=(_=this.getComment())==null?void 0:_.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),d=this._workbook.getUnitId(),C=this._worksheet.getSheetId(),T=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,b=m.getCurrentUser();return r.executeCommand(s.AddCommentCommand.id,{unitId:d,subUnitId:C,comment:{text:t,attachments:[],dT:s.getDT(),id:i.Tools.generateRandomId(),ref:T,personId:b.userID,parentId:n==null?void 0:n.id,unitId:d,subUnitId:C,threadId:n==null?void 0:n.threadId}})}clearComment(){var d;const t=this._injector,e=(d=this.getComment())==null?void 0:d.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(s.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class S extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(s.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===s.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===s.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===s.DeleteCommentCommand.id||e.id===s.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(S);class U 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))}onCommented(t){return this._injector.get(i.ICommandService).onCommandExecuted(n=>{if(n.id===s.AddCommentCommand.id){const r=n.params;t(r)}})}}h.FWorksheet.extend(U),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
10
+ (function(s,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.UniverSheetsThreadCommentFacade={},s.UniverCore,s.UniverSheetsThreadComment,s.UniverSheetsFacade,s.UniverThreadComment,s.UniverEngineFormula,s.rxjs))})(this,function(s,r,a,u,m,U,b){"use strict";var w=Object.defineProperty;var B=(s,r,a)=>r in s?w(s,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[r]=a;var T=(s,r,a)=>B(s,typeof r!="symbol"?r+"":r,a);var S=Object.defineProperty,j=Object.getOwnPropertyDescriptor,k=(h,e,t,n)=>{for(var o=n>1?void 0:n?j(e,t):e,i=h.length-1,d;i>=0;i--)(d=h[i])&&(o=(n?d(e,t,o):d(o))||o);return n&&o&&S(e,t,o),o},I=(h,e)=>(t,n)=>e(t,n,h);class p{constructor(e){T(this,"_comment",{id:r.generateRandomId(),ref:"",threadId:"",dT:"",personId:"",text:r.RichTextBuilder.newEmptyData().body,attachments:[],unitId:"",subUnitId:""});e&&(this._comment=e)}static create(e){return new p(e)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return r.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return _.create(r.Tools.deepClone(this._comment))}}class _ extends p{static create(e){return new _(e)}setContent(e){return e instanceof r.RichTextValue?this._comment.text=e.getData().body:this._comment.text=e,this}setPersonId(e){return this._comment.personId=e,this}setDateTime(e){return this._comment.dT=m.getDT(e),this}setId(e){return this._comment.id=e,this}setThreadId(e){return this._comment.threadId=e,this}build(){return this._comment}}s.FThreadComment=class{constructor(e,t,n,o,i,d,C){this._thread=e,this._parent=t,this._injector=n,this._commandService=o,this._univerInstanceService=i,this._threadCommentModel=d,this._userManagerService=C}_getRef(){var n;const e=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return U.deserializeRangeWithSheet(e).range}getIsRoot(){return!this._parent}getCommentData(){const{children:e,...t}=this._thread;return t}getReplies(){var n;const e=this._getRef(),t=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,e.startRow,e.startColumn);return(n=t==null?void 0:t.children)==null?void 0:n.map(o=>this._injector.createInstance(s.FThreadComment,o))}getRange(){const e=this._univerInstanceService.getUnit(this._thread.unitId,r.UniverInstanceType.UNIVER_SHEET);if(!e)return null;const t=e.getSheetBySheetId(this._thread.subUnitId);if(!t)return null;const n=this._getRef();return this._injector.createInstance(u.FRange,e,t,n)}getContent(){return this._thread.text}getRichText(){const e=this._thread.text;return r.RichTextValue.create({body:e,documentStyle:{},id:"d"})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?m.DeleteCommentTreeCommand.id:m.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(e){return this.updateAsync(e)}async updateAsync(e){const t=e instanceof r.RichTextValue?e.getData().body:e,n=m.getDT();return await this._commandService.executeCommand(m.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:n}})}resolve(e){return this.resolveAsync(e)}resolveAsync(e){return this._commandService.executeCommand(m.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:e!=null?e:!this._thread.resolved})}async replyAsync(e){var n;const t=e.build();return this._commandService.executeCommand(m.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:r.generateRandomId(),parentId:this._thread.id,threadId:this._thread.threadId,ref:(n=this._parent)==null?void 0:n.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:t.text,attachments:t.attachments,dT:t.dT||m.getDT(),personId:t.personId||this._userManagerService.getCurrentUser().userID}})}},s.FThreadComment=k([I(2,r.Inject(r.Injector)),I(3,r.ICommandService),I(4,r.IUniverInstanceService),I(5,r.Inject(a.SheetsThreadCommentModel)),I(6,r.Inject(r.UserManagerService))],s.FThreadComment);class y extends u.FRange{getComment(){const t=this._injector.get(a.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),i=t.getByLocation(n,o,this._range.startRow,this._range.startColumn);if(!i)return null;const d=t.getComment(n,o,i);return d?this._injector.createInstance(s.FThreadComment,d):null}getComments(){const t=this._injector.get(a.SheetsThreadCommentModel),n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),i=[];return r.Range.foreach(this._range,(d,C)=>{const l=t.getByLocation(n,o,d,C);if(l){const g=t.getComment(n,o,l);g&&i.push(this._injector.createInstance(s.FThreadComment,g))}}),i}addComment(e){var v;const t=this._injector,n=(v=this.getComment())==null?void 0:v.getCommentData(),o=t.get(r.ICommandService),i=t.get(r.UserManagerService),d=this._workbook.getUnitId(),C=this._worksheet.getSheetId(),l=`${r.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,g=i.getCurrentUser(),f=e instanceof _?e.build():{text:e};return o.executeCommand(m.AddCommentCommand.id,{unitId:d,subUnitId:C,comment:{text:f.text,dT:f.dT||m.getDT(),attachments:[],id:f.id||r.generateRandomId(),ref:l,personId:f.personId||g.userID,parentId:n==null?void 0:n.id,unitId:d,subUnitId:C,threadId:(n==null?void 0:n.threadId)||r.generateRandomId()}})}clearComment(){var d;const e=this._injector,t=(d=this.getComment())==null?void 0:d.getCommentData(),n=e.get(r.ICommandService),o=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return t?n.executeCommand(m.DeleteCommentTreeCommand.id,{unitId:o,subUnitId:i,threadId:t.threadId,commentId:t.id}):Promise.resolve(!0)}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}}u.FRange.extend(y);class x extends u.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(m.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(e=>this._injector.createInstance(s.FThreadComment,e.root))}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}onThreadCommentChange(e){return r.toDisposable(this._threadCommentModel.commentUpdate$.pipe(b.filter(t=>t.unitId===this._workbook.getUnitId())).subscribe(e))}onBeforeAddThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.AddCommentCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.UpdateCommentCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(e){return r.toDisposable(this._commandService.beforeCommandExecuted((t,n)=>{const o=t.params;if(t.id===m.DeleteCommentCommand.id||t.id===m.DeleteCommentTreeCommand.id){if(o.unitId!==this._workbook.getUnitId())return;if(e(o,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}u.FWorkbook.extend(x);class D extends u.FWorksheet{getComments(){return this._injector.get(a.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(s.FThreadComment,n))}clearComments(){const t=this.getComments().map(n=>n.deleteAsync());return Promise.all(t).then(()=>!0)}onCommented(e){return this._injector.get(r.ICommandService).onCommandExecuted(n=>{if(n.id===m.AddCommentCommand.id){const o=n.params;e(o)}})}getCommentById(e){const n=this._injector.get(a.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),e);if(n)return this._injector.createInstance(s.FThreadComment,n)}}u.FWorksheet.extend(D);const c={CommentAdded:"CommentAdded",BeforeCommentAdd:"BeforeCommentAdd",CommentUpdated:"CommentUpdated",BeforeCommentUpdate:"BeforeCommentUpdate",CommentDeleted:"CommentDeleted",BeforeCommentDeleted:"BeforeCommentDeleted",CommentResolved:"CommentResolved",BeforeCommentResolve:"BeforeCommentResolve"};class R extends r.FEventName{get CommentAdded(){return c.CommentAdded}get BeforeCommentAdd(){return c.BeforeCommentAdd}get CommentUpdated(){return c.CommentUpdated}get BeforeCommentUpdate(){return c.BeforeCommentUpdate}get CommentDeleted(){return c.CommentDeleted}get BeforeCommentDeleted(){return c.BeforeCommentDeleted}get CommentResolved(){return c.CommentResolved}get BeforeCommentResolve(){return c.BeforeCommentResolve}}r.FEventName.extend(R),Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
11
11
 
12
12
 
13
13
  // @univerjs/thread-comment-ui/index
14
- (function(c,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):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.UniverDocs,c.UniverDocsUi,c.UniverEngineRender))})(this,function(c,o,_,k,re,h,E,Oe,Me,we){"use strict";var st=Object.defineProperty;var dt=(c,o,_)=>o in c?st(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var G=(c,o,_)=>dt(c,typeof o!="symbol"?o+"":o,_);var De=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Ae=(n,e,t,r)=>{for(var i=r>1?void 0:r?He(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new re.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new re.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(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(re.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)}},c.ThreadCommentPanelService=Ae([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const he="thread-comment-panel",Le="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(c.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}},W={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},ke="thread-comment-ui.config",ve={};var Ce=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?Ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ve(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&Ce(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n),fe=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ve,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:s,...l}=o.merge({},ve,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ke,l)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,W].forEach(t=>{this._commandService.registerCommand(t)})}},fe(c.UniverThreadCommentUIPlugin,"pluginName",Le),fe(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=Fe([o.DependentOn(_.UniverThreadCommentPlugin),le(1,o.Inject(o.Injector)),le(2,o.ICommandService),le(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var me={exports:{}},Y={};/**
14
+ (function(c,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):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.UniverDocs,c.UniverDocsUi,c.UniverEngineRender))})(this,function(c,o,_,k,re,u,E,Oe,Me,we){"use strict";var st=Object.defineProperty;var dt=(c,o,_)=>o in c?st(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var G=(c,o,_)=>dt(c,typeof o!="symbol"?o+"":o,_);var De=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Ae=(n,e,t,r)=>{for(var i=r>1?void 0:r?He(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new re.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new re.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(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(re.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)}},c.ThreadCommentPanelService=Ae([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const ue="thread-comment-panel",Le="UNIVER_THREAD_COMMENT_UI_PLUGIN",he={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(c.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:ue},width:330}),t.setPanelVisible(!0)),!0}},W={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},ke="thread-comment-ui.config",ve={};var Ce=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?Ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ve(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&Ce(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n),fe=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ve,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:s,...l}=o.merge({},ve,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ke,l)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[he,W].forEach(t=>{this._commandService.registerCommand(t)})}},fe(c.UniverThreadCommentUIPlugin,"pluginName",Le),fe(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=Fe([o.DependentOn(_.UniverThreadCommentPlugin),le(1,o.Inject(o.Injector)),le(2,o.ICommandService),le(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var me={exports:{}},Y={};/**
15
15
  * @license React
16
16
  * react-jsx-runtime.production.min.js
17
17
  *
@@ -19,13 +19,13 @@
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var pe;function We(){if(pe)return Y;pe=1;var n=h,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(C,u,U){var f,p={},I=null,T=null;U!==void 0&&(I=""+U),u.key!==void 0&&(I=""+u.key),u.ref!==void 0&&(T=u.ref);for(f in u)r.call(u,f)&&!s.hasOwnProperty(f)&&(p[f]=u[f]);if(C&&C.defaultProps)for(f in u=C.defaultProps,u)p[f]===void 0&&(p[f]=u[f]);return{$$typeof:e,type:C,key:I,ref:T,props:p,_owner:i.current}}return Y.Fragment=t,Y.jsx=l,Y.jsxs=l,Y}var ge;function ze(){return ge||(ge=1,me.exports=We()),me.exports}var a=ze(),M=function(){return M=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},M.apply(this,arguments)},Ze=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,s=n.extend,l=Ze(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),u=h.useRef("_".concat(Ke()));return Ie(t,"".concat(r),{defIds:t.defIds,idSuffix:u.current},M({ref:e,className:C},l),s)});function Ie(n,e,t,r,i){return h.createElement(n.tag,M(M({key:e},Je(n,t,i)),r),(Ge(n,t).children||[]).map(function(s,l){return Ie(s,"".concat(e,"-").concat(n.tag,"-").concat(l),t,void 0,i)}))}function Je(n,e,t){var r=M({},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(s){var l=s[0],C=s[1];typeof C=="string"&&(r[l]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ge(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)?M(M({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?M(M({},i),{attrs:M(M({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function Ke(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ye={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"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ye}))});xe.displayName="DeleteSingle";var Qe={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:Qe}))});Se.displayName="IncreaseSingle";var Xe={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"}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Xe}))});ye.displayName="MoreHorizontalSingle";var qe={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}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:qe}))});be.displayName="ReplyToCommentSingle";var $e={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"}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:$e}))});Te.displayName="ResolvedSingle";var et={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}}]},_e=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:et}))});_e.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 tt(){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"},nt=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},rt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),Ue=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let s=0;return t==null||t.forEach(l=>{s<l.startIndex&&i.push({type:"text",content:e.slice(s,l.startIndex)}),i.push({type:"mention",content:{label:e.slice(l.startIndex,l.endIndex).slice(1,-1),id:l.rangeId}}),s=l.endIndex}),i.push({type:"text",content:e.slice(s,r)}),i},Pe=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 s=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:s,properties:{}});break}}}),e+=`
23
- \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},it=(n,e,t,r,i)=>{var l,C;const s=(l=n.raw)==null?void 0:l.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[s?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:s}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Ee=h.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:l,unitId:C}=n,u=o.useDependency(o.IMentionIOService),U=o.useDependency(o.ICommandService),f=o.useDependency(o.LocaleService),[p,I]=h.useState({...t}),[T,x]=h.useState(!1),y=h.useRef(null),D=o.useDependency(Oe.DocSelectionManagerService),N=(V=o.useDependency(we.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:V.with(Me.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(v){var b;I({...t,text:v,attachments:[]}),(b=y.current)==null||b.inputElement.focus()}}));const S=()=>{var v;p.text&&(r==null||r({...p,text:p.text}),x(!1),I({text:void 0}),(v=y.current)==null||v.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:v=>v.preventDefault(),children:[a.jsx(E.Mentions,{ref:y,autoFocus:l,style:{width:"100%"},placeholder:f.t("threadCommentUI.editor.placeholder"),value:p!=null&&p.text?rt(Ue(p.text)):"",onChange:v=>{v.target.value||I({...t,text:void 0}),I==null||I({...t,text:Pe(nt(v.target.value))})},onFocus:()=>{const v=D.getActiveTextRange();v&&v.collapsed&&(N==null||N.removeAllRanges()),N==null||N.blur(),x(!0)},children:a.jsx(E.Mention,{trigger:"@",data:(v,b)=>u.list({search:v,unitId:C}).then(m=>m.list.map(H=>H.mentions.map(j=>({id:j.objectId,display:j.label,raw:j}))).flat()).then(b),displayTransform:(v,b)=>`@${b} `,renderSuggestion:it},"@")}),T?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(E.Button,{style:{marginRight:12},onClick:()=>{s==null||s(),x(!1),I({text:void 0}),U.executeCommand(W.id)},children:f.t("threadCommentUI.editor.cancel")}),a.jsx(E.Button,{type:"primary",disabled:!p.text,onClick:S,children:f.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),g={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"},Ne="__mock__",ot=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:s,onReply:l,resolved:C,isRoot:u,onClose:U,onDeleteComment:f}=n,p=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),T=o.useDependency(o.UserManagerService),x=T.getUser(e.personId),y=k.useObservable(T.currentUser$),D=(y==null?void 0:y.userID)===e.personId,P=e.id===Ne,[N,S]=h.useState(!1),V=()=>{(f==null?void 0:f(e))!==!1&&(p.executeCommand(u?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),u&&(U==null||U()))};return a.jsxs("div",{className:g.threadCommentItem,onMouseLeave:()=>S(!1),onMouseEnter:()=>S(!0),children:[a.jsx("img",{className:g.threadCommentItemHead,src:x==null?void 0:x.avatar}),a.jsxs("div",{className:g.threadCommentItemTitle,children:[a.jsx("div",{className:g.threadCommentUsername,children:(x==null?void 0:x.name)||" "}),a.jsxs("div",{children:[P||C?null:N?a.jsx("div",{className:g.threadCommentIcon,onClick:()=>l(x),children:a.jsx(be,{})}):null,D&&!P&&!C?a.jsx(E.DropdownLegacy,{overlay:a.jsxs(E.Menu,{children:[a.jsx(E.MenuItem,{onClick:()=>s==null?void 0:s(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(E.MenuItem,{onClick:V,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:g.threadCommentIcon,children:a.jsx(ye,{})})}):null]})]}),a.jsx("div",{className:g.threadCommentItemTime,children:e.dT}),i?a.jsx(Ee,{id:e.id,comment:e,onCancel:()=>s==null?void 0:s(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:v,attachments:b})=>{s==null||s(!1),p.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:v,attachments:b}})}}):a.jsx("div",{className:g.threadCommentItemContent,children:Ue(e.text).map((v,b)=>{switch(v.type){case"mention":return a.jsxs("a",{className:g.threadCommentItemAt,children:["@",v.content.label," "]},b);default:return v.content}})})]})},Re=n=>{var ae,ee,te;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:s=!0,onClick:l,showHighlight:C,onClose:u,getSubUnitName:U,prefix:f,autoFocus:p,onMouseEnter:I,onMouseLeave:T,onAddComment:x,onDeleteComment:y,onResolve:D}=n,P=o.useDependency(_.ThreadCommentModel),[N,S]=h.useState(!1),[V,v]=h.useState(""),b=h.useMemo(()=>P.commentUpdate$.pipe(re.debounceTime(16)),[P]);k.useObservable(b);const m=e?P.getCommentWithChildren(t,r,e):null,H=o.useDependency(o.ICommandService),j=o.useDependency(o.UserManagerService),A=m==null?void 0:m.root.resolved,w=k.useObservable(j.currentUser$),X=h.useRef(null),q=[...m?[m.root]:[{id:Ne,text:{dataStream:`
24
- \r`},personId:(ae=w==null?void 0:w.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=m==null?void 0:m.children)!=null?ee:[]],Z=h.useRef(null),B=R=>{R.stopPropagation(),A?H.executeCommand(W.id,{unitId:t,subUnitId:r,commentId:e}):H.executeCommand(W.id),H.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!A}),D==null||D(!A)},$=R=>{R.stopPropagation(),H.executeCommand(W.id),!(m!=null&&m.root&&(y==null?void 0:y(m.root))===!1)&&(H.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),u==null||u())};h.useEffect(()=>T==null?void 0:T(),[]);const F=U((te=m==null?void 0:m.root.subUnitId)!=null?te:r),oe=s&&!V&&!A,K=`${i||(m==null?void 0:m.root.ref)||""}${F?" · ":""}${F}`;return a.jsxs("div",{className:tt(g.threadComment,{[g.threadCommentActive]:!A&&(C||N||f==="cell")}),onClick:l,id:`${f}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),S(!0)},onMouseLeave:()=>{T==null||T(),S(!1)},children:[!A&&C?a.jsx("div",{className:g.threadCommentHighlight}):null,a.jsxs("div",{className:g.threadCommentTitle,children:[a.jsxs("div",{className:g.threadCommentTitlePosition,children:[a.jsx("div",{className:g.threadCommentTitleHighlight}),a.jsx(E.Tooltip,{showIfEllipsis:!0,title:K,children:a.jsx("div",{className:g.threadCommentTitlePositionText,children:K})})]}),m?a.jsxs("div",{className:g.threadCommentIconContainer,children:[a.jsx("div",{onClick:B,className:g.threadCommentIcon,style:{color:A?"rgb(var(--green-500))":""},children:A?a.jsx(Te,{}):a.jsx(_e,{})}),(w==null?void 0:w.userID)===m.root.personId?a.jsx("div",{className:g.threadCommentIcon,onClick:$,children:a.jsx(xe,{})}):null]}):null]}),a.jsx("div",{className:g.threadCommentContent,ref:Z,children:q.map(R=>a.jsx(ot,{onClose:u,unitId:t,subUnitId:r,item:R,isRoot:R.id===(m==null?void 0:m.root.id),editing:V===R.id,resolved:m==null?void 0:m.root.resolved,onEditingChange:L=>{v(L?R.id:"")},onReply:L=>{L&&requestAnimationFrame(()=>{var d;(d=X.current)==null||d.reply(Pe([{type:"mention",content:{id:L.userID,label:L.name}}]))})},onAddComment:x,onDeleteComment:y},R.id))}),oe?a.jsx("div",{children:a.jsx(Ee,{ref:X,unitId:t,subUnitId:r,onSave:async({text:R,attachments:L})=>{const d={text:R,attachments:L,dT:_.getDT(),id:o.generateRandomId(),ref:i,personId:w==null?void 0:w.userID,parentId:m==null?void 0:m.root.id,unitId:t,subUnitId:r,threadId:m==null?void 0:m.root.threadId};(x==null?void 0:x(d))!==!1&&(await H.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:d}),Z.current&&(Z.current.scrollTop=Z.current.scrollHeight))},autoFocus:p||!m,onCancel:()=>{m||u==null||u()}},`${p}`)}):null]})},Q={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"},at=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:s,onResolve:l,sortComments:C,onItemLeave:u,onItemEnter:U,disableAdd:f,tempComment:p,onAddComment:I,onDeleteComment:T,showComments:x}=n,[y,D]=h.useState("all"),[P,N]=h.useState("all"),S=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),v=o.useDependency(_.ThreadCommentModel),[b,m]=h.useState(()=>v.getUnit(e)),H=o.useDependency(c.ThreadCommentPanelService),j=k.useObservable(H.activeCommentId$),A=k.useObservable(v.commentUpdate$),w=o.useDependency(o.ICommandService),X=k.useObservable(t),q=h.useRef(!0),Z="panel",B=k.useObservable(V.currentUser$),$=h.useMemo(()=>{var de;const d=y==="all"?b:(de=b.filter(O=>O.subUnitId===X))!=null?de:[],ne=C!=null?C:O=>O,se=d.map(O=>{var J;return{...O.root,children:(J=O.children)!=null?J:[],users:O.relativeUsers}});if(x){const O=new Map;return se.forEach(J=>{O.set(J.id,J)}),[...x,""].map(J=>O.get(J)).filter(Boolean)}else return ne(se)},[x,y,b,C,X]),F=h.useMemo(()=>[...$.filter(d=>!d.resolved),...$.filter(d=>d.resolved)],[$]),oe=h.useMemo(()=>P==="resolved"?F.filter(d=>d.resolved):P==="unsolved"?F.filter(d=>!d.resolved):P==="concern_me"&&B!=null&&B.userID?F.filter(d=>d==null?void 0:d.users.has(B.userID)):F,[F,B==null?void 0:B.userID,P]),K=p?[p,...oe]:oe,ae=K.filter(d=>!d.resolved),ee=K.filter(d=>d.resolved),te=P!=="all"||y!=="all",R=()=>{N("all"),D("all")};h.useEffect(()=>{e&&m(v.getUnit(e))},[e,v,A]),h.useEffect(()=>{var O;if(!j)return;if(!q.current){q.current=!0;return}const{unitId:d,subUnitId:ne,commentId:se}=j,de=`${Z}-${d}-${ne}-${se}`;(O=document.getElementById(de))==null||O.scrollIntoView({block:"center"})},[j]);const L=d=>a.jsx(Re,{prefix:Z,getSubUnitName:s,id:d.id,unitId:d.unitId,subUnitId:d.subUnitId,refStr:d.ref,type:r,showEdit:(j==null?void 0:j.commentId)===d.id,showHighlight:(j==null?void 0:j.commentId)===d.id,onClick:()=>{q.current=!1,d.resolved?w.executeCommand(W.id):w.executeCommand(W.id,{unitId:d.unitId,subUnitId:d.subUnitId,commentId:d.id,temp:!1})},onMouseEnter:()=>U==null?void 0:U(d),onMouseLeave:()=>u==null?void 0:u(d),onAddComment:I,onDeleteComment:T,onResolve:ne=>l==null?void 0:l(d.id,ne)},d.id);return a.jsxs("div",{className:Q.threadCommentPanel,children:[a.jsxs("div",{className:Q.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(E.Select,{borderless:!0,value:y,onChange:d=>D(d),options:[{value:"current",label:S.t("threadCommentUI.filter.sheet.current")},{value:"all",label:S.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(E.Select,{borderless:!0,value:P,onChange:d=>N(d),options:[{value:"all",label:S.t("threadCommentUI.filter.status.all")},{value:"resolved",label:S.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:S.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:S.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(L),ee.length?a.jsx("div",{className:Q.threadCommentPanelSolved,children:"已解决"}):null,ee.map(L),K.length?null:a.jsxs("div",{className:Q.threadCommentPanelEmpty,children:[te?S.t("threadCommentUI.panel.filterEmpty"):S.t("threadCommentUI.panel.empty"),te?a.jsx(E.Button,{onClick:R,type:"link",children:S.t("threadCommentUI.panel.reset")}):a.jsxs(E.Button,{id:"thread-comment-add",className:Q.threadCommentPanelAdd,type:"primary",onClick:i,disabled:f,children:[a.jsx(Se,{}),S.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=W,c.THREAD_COMMENT_PANEL=he,c.ThreadCommentPanel=at,c.ThreadCommentTree=Re,c.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
22
+ */var pe;function We(){if(pe)return Y;pe=1;var n=u,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(C,h,U){var f,p={},I=null,T=null;U!==void 0&&(I=""+U),h.key!==void 0&&(I=""+h.key),h.ref!==void 0&&(T=h.ref);for(f in h)r.call(h,f)&&!s.hasOwnProperty(f)&&(p[f]=h[f]);if(C&&C.defaultProps)for(f in h=C.defaultProps,h)p[f]===void 0&&(p[f]=h[f]);return{$$typeof:e,type:C,key:I,ref:T,props:p,_owner:i.current}}return Y.Fragment=t,Y.jsx=l,Y.jsxs=l,Y}var ge;function ze(){return ge||(ge=1,me.exports=We()),me.exports}var a=ze(),M=function(){return M=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},M.apply(this,arguments)},Ze=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=u.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,l=Ze(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),h=u.useRef("_".concat(Ke()));return Ie(t,"".concat(r),{defIds:t.defIds,idSuffix:h.current},M({ref:e,className:C},l),s)});function Ie(n,e,t,r,i){return u.createElement(n.tag,M(M({key:e},Je(n,t,i)),r),(Ge(n,t).children||[]).map(function(s,l){return Ie(s,"".concat(e,"-").concat(n.tag,"-").concat(l),t,void 0,i)}))}function Je(n,e,t){var r=M({},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(s){var l=s[0],C=s[1];typeof C=="string"&&(r[l]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ge(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)?M(M({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?M(M({},i),{attrs:M(M({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function Ke(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ye={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"}}]},xe=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ye}))});xe.displayName="DeleteSingle";var Qe={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=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Qe}))});Se.displayName="IncreaseSingle";var Xe={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"}}]},ye=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Xe}))});ye.displayName="MoreHorizontalSingle";var qe={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}}]},be=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:qe}))});be.displayName="ReplyToCommentSingle";var $e={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"}}]},Te=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:$e}))});Te.displayName="ResolvedSingle";var et={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}}]},_e=u.forwardRef(function(n,e){return u.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:et}))});_e.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 tt(){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"},nt=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},rt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),Ue=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let s=0;return t==null||t.forEach(l=>{s<l.startIndex&&i.push({type:"text",content:e.slice(s,l.startIndex)}),i.push({type:"mention",content:{label:e.slice(l.startIndex,l.endIndex).slice(1,-1),id:l.rangeId}}),s=l.endIndex}),i.push({type:"text",content:e.slice(s,r)}),i},Pe=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 s=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:s,properties:{}});break}}}),e+=`
23
+ \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},it=(n,e,t,r,i)=>{var l,C;const s=(l=n.raw)==null?void 0:l.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[s?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:s}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Ee=u.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:l,unitId:C}=n,h=o.useDependency(o.IMentionIOService),U=o.useDependency(o.ICommandService),f=o.useDependency(o.LocaleService),[p,I]=u.useState({...t}),[T,x]=u.useState(!1),y=u.useRef(null),D=o.useDependency(Oe.DocSelectionManagerService),N=(V=o.useDependency(we.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:V.with(Me.DocSelectionRenderService);u.useImperativeHandle(e,()=>({reply(v){var b;I({...t,text:v,attachments:[]}),(b=y.current)==null||b.inputElement.focus()}}));const S=()=>{var v;p.text&&(r==null||r({...p,text:p.text}),x(!1),I({text:void 0}),(v=y.current)==null||v.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:v=>v.preventDefault(),children:[a.jsx(E.Mentions,{ref:y,autoFocus:l,style:{width:"100%"},placeholder:f.t("threadCommentUI.editor.placeholder"),value:p!=null&&p.text?rt(Ue(p.text)):"",onChange:v=>{v.target.value||I({...t,text:void 0}),I==null||I({...t,text:Pe(nt(v.target.value))})},onFocus:()=>{const v=D.getActiveTextRange();v&&v.collapsed&&(N==null||N.removeAllRanges()),N==null||N.blur(),x(!0)},children:a.jsx(E.Mention,{trigger:"@",data:(v,b)=>h.list({search:v,unitId:C}).then(m=>m.list.map(H=>H.mentions.map(j=>({id:j.objectId,display:j.label,raw:j}))).flat()).then(b),displayTransform:(v,b)=>`@${b} `,renderSuggestion:it},"@")}),T?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(E.Button,{style:{marginRight:12},onClick:()=>{s==null||s(),x(!1),I({text:void 0}),U.executeCommand(W.id)},children:f.t("threadCommentUI.editor.cancel")}),a.jsx(E.Button,{type:"primary",disabled:!p.text,onClick:S,children:f.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),g={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"},Ne="__mock__",ot=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:s,onReply:l,resolved:C,isRoot:h,onClose:U,onDeleteComment:f}=n,p=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),T=o.useDependency(o.UserManagerService),x=T.getUser(e.personId),y=k.useObservable(T.currentUser$),D=(y==null?void 0:y.userID)===e.personId,P=e.id===Ne,[N,S]=u.useState(!1),V=()=>{(f==null?void 0:f(e))!==!1&&(p.executeCommand(h?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),h&&(U==null||U()))};return a.jsxs("div",{className:g.threadCommentItem,onMouseLeave:()=>S(!1),onMouseEnter:()=>S(!0),children:[a.jsx("img",{className:g.threadCommentItemHead,src:x==null?void 0:x.avatar}),a.jsxs("div",{className:g.threadCommentItemTitle,children:[a.jsx("div",{className:g.threadCommentUsername,children:(x==null?void 0:x.name)||" "}),a.jsxs("div",{children:[P||C?null:N?a.jsx("div",{className:g.threadCommentIcon,onClick:()=>l(x),children:a.jsx(be,{})}):null,D&&!P&&!C?a.jsx(E.DropdownLegacy,{overlay:a.jsxs(E.Menu,{children:[a.jsx(E.MenuItem,{onClick:()=>s==null?void 0:s(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(E.MenuItem,{onClick:V,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:g.threadCommentIcon,children:a.jsx(ye,{})})}):null]})]}),a.jsx("div",{className:g.threadCommentItemTime,children:e.dT}),i?a.jsx(Ee,{id:e.id,comment:e,onCancel:()=>s==null?void 0:s(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:v,attachments:b})=>{s==null||s(!1),p.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:v,attachments:b}})}}):a.jsx("div",{className:g.threadCommentItemContent,children:Ue(e.text).map((v,b)=>{switch(v.type){case"mention":return a.jsxs("a",{className:g.threadCommentItemAt,children:["@",v.content.label," "]},b);default:return v.content}})})]})},Re=n=>{var ae,ee,te;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:s=!0,onClick:l,showHighlight:C,onClose:h,getSubUnitName:U,prefix:f,autoFocus:p,onMouseEnter:I,onMouseLeave:T,onAddComment:x,onDeleteComment:y,onResolve:D}=n,P=o.useDependency(_.ThreadCommentModel),[N,S]=u.useState(!1),[V,v]=u.useState(""),b=u.useMemo(()=>P.commentUpdate$.pipe(re.debounceTime(16)),[P]);k.useObservable(b);const m=e?P.getCommentWithChildren(t,r,e):null,H=o.useDependency(o.ICommandService),j=o.useDependency(o.UserManagerService),A=m==null?void 0:m.root.resolved,w=k.useObservable(j.currentUser$),X=u.useRef(null),q=[...m?[m.root]:[{id:Ne,text:{dataStream:`
24
+ \r`},personId:(ae=w==null?void 0:w.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=m==null?void 0:m.children)!=null?ee:[]],Z=u.useRef(null),B=R=>{R.stopPropagation(),A?H.executeCommand(W.id,{unitId:t,subUnitId:r,commentId:e}):H.executeCommand(W.id),H.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!A}),D==null||D(!A)},$=R=>{R.stopPropagation(),H.executeCommand(W.id),!(m!=null&&m.root&&(y==null?void 0:y(m.root))===!1)&&(H.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),h==null||h())};u.useEffect(()=>T==null?void 0:T(),[]);const F=U((te=m==null?void 0:m.root.subUnitId)!=null?te:r),oe=s&&!V&&!A,K=`${i||(m==null?void 0:m.root.ref)||""}${F?" · ":""}${F}`;return a.jsxs("div",{className:tt(g.threadComment,{[g.threadCommentActive]:!A&&(C||N||f==="cell")}),onClick:l,id:`${f}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),S(!0)},onMouseLeave:()=>{T==null||T(),S(!1)},children:[!A&&C?a.jsx("div",{className:g.threadCommentHighlight}):null,a.jsxs("div",{className:g.threadCommentTitle,children:[a.jsxs("div",{className:g.threadCommentTitlePosition,children:[a.jsx("div",{className:g.threadCommentTitleHighlight}),a.jsx(E.Tooltip,{showIfEllipsis:!0,title:K,children:a.jsx("div",{className:g.threadCommentTitlePositionText,children:K})})]}),m?a.jsxs("div",{className:g.threadCommentIconContainer,children:[a.jsx("div",{onClick:B,className:g.threadCommentIcon,style:{color:A?"rgb(var(--green-500))":""},children:A?a.jsx(Te,{}):a.jsx(_e,{})}),(w==null?void 0:w.userID)===m.root.personId?a.jsx("div",{className:g.threadCommentIcon,onClick:$,children:a.jsx(xe,{})}):null]}):null]}),a.jsx("div",{className:g.threadCommentContent,ref:Z,children:q.map(R=>a.jsx(ot,{onClose:h,unitId:t,subUnitId:r,item:R,isRoot:R.id===(m==null?void 0:m.root.id),editing:V===R.id,resolved:m==null?void 0:m.root.resolved,onEditingChange:L=>{v(L?R.id:"")},onReply:L=>{L&&requestAnimationFrame(()=>{var d;(d=X.current)==null||d.reply(Pe([{type:"mention",content:{id:L.userID,label:L.name}}]))})},onAddComment:x,onDeleteComment:y},R.id))}),oe?a.jsx("div",{children:a.jsx(Ee,{ref:X,unitId:t,subUnitId:r,onSave:async({text:R,attachments:L})=>{const d={text:R,attachments:L,dT:_.getDT(),id:o.generateRandomId(),ref:i,personId:w==null?void 0:w.userID,parentId:m==null?void 0:m.root.id,unitId:t,subUnitId:r,threadId:m==null?void 0:m.root.threadId};(x==null?void 0:x(d))!==!1&&(await H.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:d}),Z.current&&(Z.current.scrollTop=Z.current.scrollHeight))},autoFocus:p||!m,onCancel:()=>{m||h==null||h()}},`${p}`)}):null]})},Q={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"},at=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:s,onResolve:l,sortComments:C,onItemLeave:h,onItemEnter:U,disableAdd:f,tempComment:p,onAddComment:I,onDeleteComment:T,showComments:x}=n,[y,D]=u.useState("all"),[P,N]=u.useState("all"),S=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),v=o.useDependency(_.ThreadCommentModel),[b,m]=u.useState(()=>v.getUnit(e)),H=o.useDependency(c.ThreadCommentPanelService),j=k.useObservable(H.activeCommentId$),A=k.useObservable(v.commentUpdate$),w=o.useDependency(o.ICommandService),X=k.useObservable(t),q=u.useRef(!0),Z="panel",B=k.useObservable(V.currentUser$),$=u.useMemo(()=>{var de;const d=y==="all"?b:(de=b.filter(O=>O.subUnitId===X))!=null?de:[],ne=C!=null?C:O=>O,se=d.map(O=>{var J;return{...O.root,children:(J=O.children)!=null?J:[],users:O.relativeUsers}});if(x){const O=new Map;return se.forEach(J=>{O.set(J.id,J)}),[...x,""].map(J=>O.get(J)).filter(Boolean)}else return ne(se)},[x,y,b,C,X]),F=u.useMemo(()=>[...$.filter(d=>!d.resolved),...$.filter(d=>d.resolved)],[$]),oe=u.useMemo(()=>P==="resolved"?F.filter(d=>d.resolved):P==="unsolved"?F.filter(d=>!d.resolved):P==="concern_me"&&B!=null&&B.userID?F.filter(d=>d==null?void 0:d.users.has(B.userID)):F,[F,B==null?void 0:B.userID,P]),K=p?[p,...oe]:oe,ae=K.filter(d=>!d.resolved),ee=K.filter(d=>d.resolved),te=P!=="all"||y!=="all",R=()=>{N("all"),D("all")};u.useEffect(()=>{e&&m(v.getUnit(e))},[e,v,A]),u.useEffect(()=>{var O;if(!j)return;if(!q.current){q.current=!0;return}const{unitId:d,subUnitId:ne,commentId:se}=j,de=`${Z}-${d}-${ne}-${se}`;(O=document.getElementById(de))==null||O.scrollIntoView({block:"center"})},[j]);const L=d=>a.jsx(Re,{prefix:Z,getSubUnitName:s,id:d.id,unitId:d.unitId,subUnitId:d.subUnitId,refStr:d.ref,type:r,showEdit:(j==null?void 0:j.commentId)===d.id,showHighlight:(j==null?void 0:j.commentId)===d.id,onClick:()=>{q.current=!1,d.resolved?w.executeCommand(W.id):w.executeCommand(W.id,{unitId:d.unitId,subUnitId:d.subUnitId,commentId:d.id,temp:!1})},onMouseEnter:()=>U==null?void 0:U(d),onMouseLeave:()=>h==null?void 0:h(d),onAddComment:I,onDeleteComment:T,onResolve:ne=>l==null?void 0:l(d.id,ne)},d.id);return a.jsxs("div",{className:Q.threadCommentPanel,children:[a.jsxs("div",{className:Q.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(E.Select,{borderless:!0,value:y,onChange:d=>D(d),options:[{value:"current",label:S.t("threadCommentUI.filter.sheet.current")},{value:"all",label:S.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(E.Select,{borderless:!0,value:P,onChange:d=>N(d),options:[{value:"all",label:S.t("threadCommentUI.filter.status.all")},{value:"resolved",label:S.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:S.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:S.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(L),ee.length?a.jsx("div",{className:Q.threadCommentPanelSolved,children:"已解决"}):null,ee.map(L),K.length?null:a.jsxs("div",{className:Q.threadCommentPanelEmpty,children:[te?S.t("threadCommentUI.panel.filterEmpty"):S.t("threadCommentUI.panel.empty"),te?a.jsx(E.Button,{onClick:R,type:"link",children:S.t("threadCommentUI.panel.reset")}):a.jsxs(E.Button,{id:"thread-comment-add",className:Q.threadCommentPanelAdd,type:"primary",onClick:i,disabled:f,children:[a.jsx(Se,{}),S.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=W,c.THREAD_COMMENT_PANEL=ue,c.ThreadCommentPanel=at,c.ThreadCommentTree=Re,c.ToggleSheetCommentPanelOperation=he,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
25
25
 
26
26
 
27
27
  // @univerjs/sheets-thread-comment-ui/index
28
- (function(d,s){typeof exports=="object"&&typeof module<"u"?s(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("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react")):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","@univerjs/engine-formula","@univerjs/thread-comment","react"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React))})(this,function(d,s,v,A,P,I,f,k,ie,$,C,E){"use strict";var rt=Object.defineProperty;var it=(d,s,v)=>s in d?rt(d,s,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[s]=v;var N=(d,s,v)=>it(d,typeof s!="symbol"?s+"":s,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ce=(i,t,n,e)=>{for(var r=e>1?void 0:e?fe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&_e(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:a,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,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 h=new s.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}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))}},d.SheetsThreadCommentPopupService=Ce([se(0,s.Inject(I.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const B={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var g;const t=i.get(v.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(P.ThreadCommentPanelService),o=(g=t.getCurrentLastSelection())==null?void 0:g.primary,a=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=a.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ie="sheets-thread-comment.config",ae={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&ge(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([L(0,s.Inject(v.SheetInterceptorService)),L(1,s.Inject(A.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ie.IRenderManagerService)],W);var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Me=(i,t,n,e)=>{for(var r=e>1?void 0:e?ye(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);const we=(i,t,n)=>{const e=$.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,a={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return $.serializeRange(a)};let F=class extends s.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&a===l)){const S=[];s.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(T=>{S.push(T)}):R.forEach(({children:T,...j})=>{j.parentId||S.push(j)})});const g=[],M=[],V=[],H=[],re=w=>{g.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:we(w.ref,p,u),unitId:o,subUnitId:a},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...g,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};F=Me([X(0,s.Inject(I.ISheetClipboardService)),X(1,s.Inject(A.SheetsThreadCommentModel)),X(2,C.IThreadCommentDataSourceService)],F);var Re=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Re(t,n,r),r},G=(i,t)=>(n,e)=>t(n,e,i);let Z=class extends s.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,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:n}=i,{unitId:e,subUnitId:r,row:o,col:a}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=Oe([G(0,s.Inject(I.HoverManagerService)),G(1,s.Inject(d.SheetsThreadCommentPopupService)),G(2,s.Inject(A.SheetsThreadCommentModel)),G(3,s.Inject(I.SheetPermissionInterceptorBaseController))],Z);var Ue=Object.defineProperty,je=Object.getOwnPropertyDescriptor,De=(i,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.Disposable{constructor(t,n,e,r,o,a,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=a,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,g;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),a=(S=o==null?void 0:o.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!a||!r)return;const c=a.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((g=r.rangeType)!=null?g:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&s.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.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 n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:a}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:a}=t,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=$.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const a=$.singleReferenceToGrid(o.ref),{row:c,column:u}=a;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};z=De([U(0,s.ICommandService),U(1,s.Inject(d.SheetsThreadCommentPopupService)),U(2,s.Inject(A.SheetsThreadCommentModel)),U(3,s.Inject(P.ThreadCommentPanelService)),U(4,s.IUniverInstanceService),U(5,s.Inject(I.SheetPermissionInterceptorBaseController)),U(6,I.IMarkSelectionService),U(7,s.Inject(v.SheetsSelectionsService)),U(8,I.IEditorBridgeService),U(9,ie.IRenderManagerService)],z);var Ne=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ne(t,n,r),r},q=(i,t)=>(n,e)=>t(n,e,i);let Y=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===v.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(r,o),c=Array.from(a.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};Y=Ve([q(0,s.Inject(v.SheetInterceptorService)),q(1,s.IUniverInstanceService),q(2,s.Inject(C.ThreadCommentModel)),q(3,C.IThreadCommentDataSourceService)],Y);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},$e=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ce=E.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=$e(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=E.useRef("_".concat(xe()));return ue(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},a),o)});function ue(i,t,n,e,r){return E.createElement(i.tag,y(y({key:t},Be(i,n,r)),e),(ke(i,n).children||[]).map(function(o,a){return ue(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function Be(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ke(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function xe(){return Math.random().toString(36).substring(2,8)}ce.displayName="UniverIcon";var He={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"}}]},de=E.forwardRef(function(i,t){return E.createElement(ce,Object.assign({},i,{id:"comment-single",ref:t,icon:He}))});de.displayName="CommentSingle";var ee={exports:{}},x={};/**
28
+ (function(d,s){typeof exports=="object"&&typeof module<"u"?s(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("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react")):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","@univerjs/engine-formula","@univerjs/thread-comment","react"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React))})(this,function(d,s,v,A,g,b,f,x,ie,k,C,E){"use strict";var rt=Object.defineProperty;var it=(d,s,v)=>s in d?rt(d,s,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[s]=v;var N=(d,s,v)=>it(d,typeof s!="symbol"?s+"":s,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ce=(i,t,n,e)=>{for(var r=e>1?void 0:e?fe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&_e(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new x.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:a,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,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 h=new s.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}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))}},d.SheetsThreadCommentPopupService=Ce([se(0,s.Inject(b.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const $={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var I;const t=i.get(v.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=a.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ie="sheets-thread-comment.config",ae={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&ge(t,n,r),r},B=(i,t)=>(n,e)=>t(n,e,i);let W=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(x.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([B(0,s.Inject(v.SheetInterceptorService)),B(1,s.Inject(A.SheetsThreadCommentModel)),B(2,s.IUniverInstanceService),B(3,ie.IRenderManagerService)],W);var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Me=(i,t,n,e)=>{for(var r=e>1?void 0:e?ye(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);const we=(i,t,n)=>{const e=k.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,a={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return k.serializeRange(a)};let F=class extends s.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&a===l)){const S=[];s.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(P=>{S.push(P)}):R.forEach(({children:P,...j})=>{j.parentId||S.push(j)})});const I=[],M=[],V=[],L=[],re=w=>{I.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:we(w.ref,p,u),unitId:o,subUnitId:a},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),L.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...I,...V],undos:[...L,...M]}}}return{redos:[],undos:[]}}}))}};F=Me([X(0,s.Inject(b.ISheetClipboardService)),X(1,s.Inject(A.SheetsThreadCommentModel)),X(2,C.IThreadCommentDataSourceService)],F);var Re=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Re(t,n,r),r},G=(i,t)=>(n,e)=>t(n,e,i);let Z=class extends s.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(x.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:a}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=Oe([G(0,s.Inject(b.HoverManagerService)),G(1,s.Inject(d.SheetsThreadCommentPopupService)),G(2,s.Inject(A.SheetsThreadCommentModel)),G(3,s.Inject(v.SheetPermissionCheckController))],Z);var Ue=Object.defineProperty,je=Object.getOwnPropertyDescriptor,De=(i,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.Disposable{constructor(t,n,e,r,o,a,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,I;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),a=(S=o==null?void 0:o.with(b.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!a||!r)return;const c=a.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((I=r.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&s.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.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 n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:a}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:a}=t,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=k.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(x.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const a=k.singleReferenceToGrid(o.ref),{row:c,column:u}=a;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};z=De([U(0,s.ICommandService),U(1,s.Inject(d.SheetsThreadCommentPopupService)),U(2,s.Inject(A.SheetsThreadCommentModel)),U(3,s.Inject(g.ThreadCommentPanelService)),U(4,s.IUniverInstanceService),U(5,s.Inject(v.SheetPermissionCheckController)),U(6,b.IMarkSelectionService),U(7,s.Inject(v.SheetsSelectionsService)),U(8,b.IEditorBridgeService),U(9,ie.IRenderManagerService)],z);var Ne=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ne(t,n,r),r},q=(i,t)=>(n,e)=>t(n,e,i);let Y=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===v.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(r,o),c=Array.from(a.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};Y=Ve([q(0,s.Inject(v.SheetInterceptorService)),q(1,s.IUniverInstanceService),q(2,s.Inject(C.ThreadCommentModel)),q(3,C.IThreadCommentDataSourceService)],Y);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},ke=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ce=E.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=ke(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=E.useRef("_".concat(He()));return ue(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},a),o)});function ue(i,t,n,e,r){return E.createElement(i.tag,y(y({key:t},$e(i,n,r)),e),(xe(i,n).children||[]).map(function(o,a){return ue(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function $e(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function xe(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function He(){return Math.random().toString(36).substring(2,8)}ce.displayName="UniverIcon";var Le={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"}}]},de=E.forwardRef(function(i,t){return E.createElement(ce,Object.assign({},i,{id:"comment-single",ref:t,icon:Le}))});de.displayName="CommentSingle";var ee={exports:{}},H={};/**
29
29
  * @license React
30
30
  * react-jsx-runtime.production.min.js
31
31
  *
@@ -33,7 +33,7 @@
33
33
  *
34
34
  * This source code is licensed under the MIT license found in the
35
35
  * LICENSE file in the root directory of this source tree.
36
- */var me;function Le(){if(me)return x;me=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=a,x.jsxs=a,x}var he;function We(){return he||(he=1,ee.exports=Le()),ee.exports}var le=We();const Fe=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=s.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:c,trigger:u}=n,h=e.getByLocation(a,c,r,o),m=`${s.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return le.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=s.useDependency(I.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=E.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=s.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((O,b)=>{T[O.getSheetId()]=b});const j=O=>O.map(b=>{var Se;const D=$.singleReferenceToGrid(b.ref),nt=[(Se=T[b.subUnitId])!=null?Se:0,D.row,D.column];return{...b,p:nt}}).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(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),b=(R=O==null?void 0:O.getMergedCell(T,j))!=null?R:{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,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),le.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ze=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),qe={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[P.THREAD_COMMENT_PANEL,Ge],[K,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,s.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var pe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&pe(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),ve=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=ae,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},ae,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ie,a)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},ve(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),ve(d.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([s.DependentOn(P.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,s.Inject(s.Injector)),ne(2,s.Inject(s.ICommandService)),ne(3,s.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=B,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
36
+ */var me;function Be(){if(me)return H;me=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return H.Fragment=n,H.jsx=a,H.jsxs=a,H}var he;function We(){return he||(he=1,ee.exports=Be()),ee.exports}var le=We();const Fe=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=s.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:c,trigger:u}=n,h=e.getByLocation(a,c,r,o),m=`${s.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var I,M,V;return(V=(M=(I=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return le.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=s.useDependency(b.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=E.useMemo(()=>e.activeSheet$.pipe(x.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=s.useDependency(g.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),P={};R.forEach((O,T)=>{P[O.getSheetId()]=T});const j=O=>O.map(T=>{var Se;const D=k.singleReferenceToGrid(T.ref),nt=[(Se=P[T.subUnitId])!=null?Se:0,D.row,D.column];return{...T,p:nt}}).sort((T,D)=>T.p[0]===D.p[0]?T.p[1]===D.p[1]?T.p[2]-D.p[2]:T.p[1]-D.p[1]:T.p[0]-D.p[0]);return[...j(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:P,column:j}=k.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),T=(R=O==null?void 0:O.getMergedCell(P,j))!=null?R:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return i.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),I=_=>{var R,P;return(P=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?P:""},M=()=>{o.executeCommand($.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},L=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),le.jsx(g.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:I,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:L,onDeleteComment:()=>(L(),!0)})},Ze=i=>({id:$.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:g.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),qe={id:$.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[$.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[g.THREAD_COMMENT_PANEL,Ge],[K,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,s.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var pe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&pe(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),ve=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=ae,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},ae,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ie,a)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[$].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},ve(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),ve(d.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([s.DependentOn(g.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,s.Inject(s.Injector)),ne(2,s.Inject(s.ICommandService)),ne(3,s.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=$,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
37
37
 
38
38
 
39
39
  // index
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/en-US
10
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/en-US"),require("@univerjs/thread-comment-ui/locale/en-US")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/en-US","@univerjs/thread-comment-ui/locale/en-US"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentEnUS=n(e.UniverCore,e.UniverSheetsThreadCommentUiEnUS,e.UniverThreadCommentUiEnUS))})(this,function(e,n,i){"use strict";return e.Tools.deepMerge({},n,i)});
10
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/en-US"),require("@univerjs/thread-comment-ui/locale/en-US")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/en-US","@univerjs/thread-comment-ui/locale/en-US"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentEnUS=n(e.UniverCore,e.UniverSheetsThreadCommentUiEnUS,e.UniverThreadCommentUiEnUS))})(this,function(e,n,i){"use strict";return e.merge({},n,i)});
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/fa-IR
10
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/fa-IR"),require("@univerjs/thread-comment-ui/locale/fa-IR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/fa-IR","@univerjs/thread-comment-ui/locale/fa-IR"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentFaIR=n(e.UniverCore,e.UniverSheetsThreadCommentUiFaIR,e.UniverThreadCommentUiFaIR))})(this,function(e,n,i){"use strict";return e.Tools.deepMerge({},n,i)});
10
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/fa-IR"),require("@univerjs/thread-comment-ui/locale/fa-IR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/fa-IR","@univerjs/thread-comment-ui/locale/fa-IR"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentFaIR=n(e.UniverCore,e.UniverSheetsThreadCommentUiFaIR,e.UniverThreadCommentUiFaIR))})(this,function(e,n,i){"use strict";return e.merge({},n,i)});
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/fr-FR
10
- (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/fr-FR"),require("@univerjs/thread-comment-ui/locale/fr-FR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/fr-FR","@univerjs/thread-comment-ui/locale/fr-FR"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentFrFR=r(e.UniverCore,e.UniverSheetsThreadCommentUiFrFR,e.UniverThreadCommentUiFrFR))})(this,function(e,r,n){"use strict";return e.Tools.deepMerge({},r,n)});
10
+ (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/fr-FR"),require("@univerjs/thread-comment-ui/locale/fr-FR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/fr-FR","@univerjs/thread-comment-ui/locale/fr-FR"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentFrFR=r(e.UniverCore,e.UniverSheetsThreadCommentUiFrFR,e.UniverThreadCommentUiFrFR))})(this,function(e,r,n){"use strict";return e.merge({},r,n)});
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/ru-RU
10
- (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ru-RU"),require("@univerjs/thread-comment-ui/locale/ru-RU")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ru-RU","@univerjs/thread-comment-ui/locale/ru-RU"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentRuRU=r(e.UniverCore,e.UniverSheetsThreadCommentUiRuRU,e.UniverThreadCommentUiRuRU))})(this,function(e,r,n){"use strict";return e.Tools.deepMerge({},r,n)});
10
+ (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ru-RU"),require("@univerjs/thread-comment-ui/locale/ru-RU")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ru-RU","@univerjs/thread-comment-ui/locale/ru-RU"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentRuRU=r(e.UniverCore,e.UniverSheetsThreadCommentUiRuRU,e.UniverThreadCommentUiRuRU))})(this,function(e,r,n){"use strict";return e.merge({},r,n)});
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/vi-VN
10
- (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/vi-VN"),require("@univerjs/thread-comment-ui/locale/vi-VN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/vi-VN","@univerjs/thread-comment-ui/locale/vi-VN"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentViVN=i(e.UniverCore,e.UniverSheetsThreadCommentUiViVN,e.UniverThreadCommentUiViVN))})(this,function(e,i,n){"use strict";return e.Tools.deepMerge({},i,n)});
10
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/vi-VN"),require("@univerjs/thread-comment-ui/locale/vi-VN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/vi-VN","@univerjs/thread-comment-ui/locale/vi-VN"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentViVN=i(e.UniverCore,e.UniverSheetsThreadCommentUiViVN,e.UniverThreadCommentUiViVN))})(this,function(e,i,n){"use strict";return e.merge({},i,n)});
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/zh-CN
10
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-CN"),require("@univerjs/thread-comment-ui/locale/zh-CN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-CN","@univerjs/thread-comment-ui/locale/zh-CN"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhCN=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhCN,e.UniverThreadCommentUiZhCN))})(this,function(e,n,i){"use strict";return e.Tools.deepMerge({},n,i)});
10
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-CN"),require("@univerjs/thread-comment-ui/locale/zh-CN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-CN","@univerjs/thread-comment-ui/locale/zh-CN"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhCN=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhCN,e.UniverThreadCommentUiZhCN))})(this,function(e,n,i){"use strict";return e.merge({},n,i)});
@@ -7,4 +7,4 @@
7
7
 
8
8
 
9
9
  // locale/zh-TW
10
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-TW"),require("@univerjs/thread-comment-ui/locale/zh-TW")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-TW","@univerjs/thread-comment-ui/locale/zh-TW"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhTW=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhTW,e.UniverThreadCommentUiZhTW))})(this,function(e,n,i){"use strict";return e.Tools.deepMerge({},n,i)});
10
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-TW"),require("@univerjs/thread-comment-ui/locale/zh-TW")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-TW","@univerjs/thread-comment-ui/locale/zh-TW"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhTW=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhTW,e.UniverThreadCommentUiZhTW))})(this,function(e,n,i){"use strict";return e.merge({},n,i)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-thread-comment",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -57,19 +57,20 @@
57
57
  "rxjs": ">=7.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@univerjs/sheets-thread-comment": "0.5.2",
61
- "@univerjs/sheets-thread-comment-ui": "0.5.2",
62
- "@univerjs/thread-comment": "0.5.2",
63
- "@univerjs/thread-comment-ui": "0.5.2"
60
+ "@univerjs/sheets-thread-comment": "0.5.4",
61
+ "@univerjs/sheets-thread-comment-ui": "0.5.4",
62
+ "@univerjs/thread-comment": "0.5.4",
63
+ "@univerjs/thread-comment-ui": "0.5.4"
64
64
  },
65
65
  "devDependencies": {
66
- "@univerjs/core": "0.5.2",
66
+ "@univerjs/core": "0.5.4",
67
67
  "typescript": "^5.7.2",
68
- "@univerjs-infra/shared": "0.5.2"
68
+ "@univerjs-infra/shared": "0.5.4"
69
69
  },
70
70
  "scripts": {
71
71
  "prebuild:preset": "tsx prepare.ts",
72
- "build:preset": "tsx build.ts"
72
+ "build:preset": "tsx build.ts",
73
+ "lint:types": "tsc --noEmit"
73
74
  },
74
75
  "module": "./lib/es/index.js"
75
76
  }