@univerjs/sheets-hyper-link-ui 0.2.3 → 0.2.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.
@@ -2,6 +2,7 @@ import { Disposable, IUniverInstanceService } from '@univerjs/core';
2
2
  import { Injector } from '@wendellhu/redi';
3
3
  import { SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
4
4
  import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
5
+ import { IEditorBridgeService } from '@univerjs/sheets-ui';
5
6
 
6
7
  export declare class SheetHyperLinkSetRangeController extends Disposable {
7
8
  private readonly _sheetInterceptorService;
@@ -9,11 +10,13 @@ export declare class SheetHyperLinkSetRangeController extends Disposable {
9
10
  private readonly _hyperLinkModel;
10
11
  private readonly _selectionManagerService;
11
12
  private readonly _univerInstanceService;
12
- constructor(_sheetInterceptorService: SheetInterceptorService, _injector: Injector, _hyperLinkModel: HyperLinkModel, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService);
13
+ private readonly _editorBridgeService;
14
+ constructor(_sheetInterceptorService: SheetInterceptorService, _injector: Injector, _hyperLinkModel: HyperLinkModel, _selectionManagerService: SheetsSelectionsService, _univerInstanceService: IUniverInstanceService, _editorBridgeService: IEditorBridgeService);
13
15
  private _initCommandInterceptor;
16
+ private _getCurrentCell;
14
17
  private _initAddHyperLinkCommandInterceptor;
15
18
  private _initUpdateHyperLinkCommandInterceptor;
16
19
  private _initSetRangeValuesCommandInterceptor;
17
20
  private _initClearSelectionCommandInterceptor;
18
- private _getCurrentCell;
21
+ private _initRichTextEditorInterceptor;
19
22
  }
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@wendellhu/redi"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx"),require("@univerjs/design"),require("@univerjs/ui"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@wendellhu/redi","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/engine-render","rxjs","react","@wendellhu/redi/react-bindings","clsx","@univerjs/design","@univerjs/ui","@univerjs/engine-formula"],a):(l=typeof globalThis<"u"?globalThis:l||self,a(l.UniverSheetsHyperLinkUi={},l.UniverCore,l.UniverSheets,l["@wendellhu/redi"],l.UniverSheetsHyperLink,l.UniverSheetsUi,l.UniverEngineRender,l.rxjs,l.React,l["@wendellhu/redi/react-bindings"],l.clsx,l.UniverDesign,l.UniverUi,l.UniverEngineFormula))})(this,function(l,a,p,g,v,f,he,me,C,T,Re,I,O,A){"use strict";var Gn=Object.defineProperty;var Xn=(l,a,p)=>a in l?Gn(l,a,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[a]=p;var Y=(l,a,p)=>Xn(l,typeof a!="symbol"?a+"":a,p);var Ve=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,We=(i,e,t,n)=>{for(var r=n>1?void 0:n?xe(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ve(e,t,r),r},ve=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._hyperLinkModel=n,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===p.RemoveSheetCommand.id){const n=e.params,r=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=n.subUnitId||((t=r.getActiveSheet())==null?void 0:t.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),d=c.map(y=>({id:v.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:y.id}})),h=c.map(y=>({id:v.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:y}}));return{redos:d,undos:h}}return{redos:[],undos:[]}}}))}},l.SheetsHyperLinkRemoveSheetController=We([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRemoveSheetController),ve(0,g.Inject(p.SheetInterceptorService)),ve(1,a.IUniverInstanceService),ve(2,g.Inject(v.HyperLinkModel))],l.SheetsHyperLinkRemoveSheetController);var Be=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Pe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Fe(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Be(e,t,r),r},z=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,t,n,r){super(),this._context=e,this._hyperLinkModel=t,this._sheetSkeletonManagerService=n,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const t=this._context.unit,n=t.getUnitId(),r=(c=t.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(n);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(()=>{e()}))}},l.SheetsHyperLinkRenderController=Pe([z(1,g.Inject(v.HyperLinkModel)),z(2,g.Inject(f.SheetSkeletonManagerService)),z(3,he.IRenderManagerService)],l.SheetsHyperLinkRenderController),l.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._hyperLinkModel=t,this._themeService=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:c}=t,d=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),h=this._themeService.getCurrentTheme();return n(d?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:h.blue500}}}:e)},priority:100}))}},l.SheetsHyperLinkRenderManagerController=Pe([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRenderManagerController),z(0,g.Inject(p.SheetInterceptorService)),z(1,g.Inject(v.HyperLinkModel)),z(2,g.Inject(a.ThemeService))],l.SheetsHyperLinkRenderManagerController);var be={exports:{}},re={};/**
1
+ (function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@wendellhu/redi"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx"),require("@univerjs/design"),require("@univerjs/ui"),require("@univerjs/engine-formula"),require("@univerjs/docs-hyper-link"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@wendellhu/redi","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/engine-render","rxjs","react","@wendellhu/redi/react-bindings","clsx","@univerjs/design","@univerjs/ui","@univerjs/engine-formula","@univerjs/docs-hyper-link","@univerjs/docs"],a):(l=typeof globalThis<"u"?globalThis:l||self,a(l.UniverSheetsHyperLinkUi={},l.UniverCore,l.UniverSheets,l["@wendellhu/redi"],l.UniverSheetsHyperLink,l.UniverSheetsUi,l.UniverEngineRender,l.rxjs,l.React,l["@wendellhu/redi/react-bindings"],l.clsx,l.UniverDesign,l.UniverUi,l.UniverEngineFormula,l.UniverDocsHyperLink,l.UniverDocs))})(this,function(l,a,h,y,v,_,me,re,L,U,Re,R,w,V,Ve,xe){"use strict";var Jn=Object.defineProperty;var Qn=(l,a,h)=>a in l?Jn(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h;var K=(l,a,h)=>Qn(l,typeof a!="symbol"?a+"":a,h);var We=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Fe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Be(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&We(e,t,r),r},ve=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._hyperLinkModel=n,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===h.RemoveSheetCommand.id){const n=e.params,r=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=n.subUnitId||((t=r.getActiveSheet())==null?void 0:t.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),d=c.map(S=>({id:v.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:S.id}})),p=c.map(S=>({id:v.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:S}}));return{redos:d,undos:p}}return{redos:[],undos:[]}}}))}},l.SheetsHyperLinkRemoveSheetController=Fe([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRemoveSheetController),ve(0,y.Inject(h.SheetInterceptorService)),ve(1,a.IUniverInstanceService),ve(2,y.Inject(v.HyperLinkModel))],l.SheetsHyperLinkRemoveSheetController);var $e=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Pe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ye(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&$e(e,t,r),r},z=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,t,n,r){super(),this._context=e,this._hyperLinkModel=t,this._sheetSkeletonManagerService=n,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const t=this._context.unit,n=t.getUnitId(),r=(c=t.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(n);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(re.debounceTime(16)).subscribe(()=>{e()}))}},l.SheetsHyperLinkRenderController=Pe([z(1,y.Inject(v.HyperLinkModel)),z(2,y.Inject(_.SheetSkeletonManagerService)),z(3,me.IRenderManagerService)],l.SheetsHyperLinkRenderController),l.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._hyperLinkModel=t,this._themeService=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(h.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:c}=t,d=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),p=this._themeService.getCurrentTheme();return n(d?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:p.blue500}}}:e)},priority:100}))}},l.SheetsHyperLinkRenderManagerController=Pe([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRenderManagerController),z(0,y.Inject(h.SheetInterceptorService)),z(1,y.Inject(v.HyperLinkModel)),z(2,y.Inject(a.ThemeService))],l.SheetsHyperLinkRenderManagerController);var be={exports:{}},ie={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var $e=C,Ye=Symbol.for("react.element"),ze=Symbol.for("react.fragment"),Ke=Object.prototype.hasOwnProperty,Ze=$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ge={key:!0,ref:!0,__self:!0,__source:!0};function Ee(i,e,t){var n,r={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)Ke.call(e,n)&&!Ge.hasOwnProperty(n)&&(r[n]=e[n]);if(i&&i.defaultProps)for(n in e=i.defaultProps,e)r[n]===void 0&&(r[n]=e[n]);return{$$typeof:Ye,type:i,key:o,ref:s,props:r,_owner:Ze.current}}re.Fragment=ze,re.jsx=Ee,re.jsxs=Ee,be.exports=re;var m=be.exports,U=function(){return U=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},U.apply(this,arguments)},Xe=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},$=C.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=Xe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),d=C.useRef("_".concat(qe()));return Oe(t,"".concat(n),{defIds:t.defIds,idSuffix:d.current},U({ref:e,className:c},s),o)});function Oe(i,e,t,n,r){return C.createElement(i.tag,U(U({key:e},Je(i,t,r)),n),(Qe(i,t).children||[]).map(function(o,s){return Oe(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function Je(i,e,t){var n=U({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Qe(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?U(U({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?U(U({},r),{attrs:U(U({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function qe(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var en={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ie=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"all-border-single",ref:e,icon:en}))});ie.displayName="AllBorderSingle";var nn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},we=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"copy-single",ref:e,icon:nn}))});we.displayName="CopySingle";var tn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},oe=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"link-single",ref:e,icon:tn}))});oe.displayName="LinkSingle";var rn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},Me=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"unlink-single",ref:e,icon:rn}))});Me.displayName="UnlinkSingle";var on={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},He=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"write-single",ref:e,icon:on}))});He.displayName="WriteSingle";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Se=C.forwardRef(function(i,e){return C.createElement($,Object.assign({},i,{id:"xlsx",ref:e,icon:sn}))});Se.displayName="Xlsx";var an=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,cn=(i,e,t,n)=>{for(var r=n>1?void 0:n?ln(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&an(e,t,r),r},X=(i,e)=>(t,n)=>e(t,n,i);function dn(i,e){const t=e.getMergeData(),n=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(n<i.endColumn&&(i.endColumn=n),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return t.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}l.SheetsHyperLinkResolverService=class{constructor(e,t,n,r,o){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=o}_getURLName(e){var d;const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=s==null?void 0:s.getName())!=null?d:"";if(n){const h=A.deserializeRangeWithSheet(n).range;return a.isValidRange(h)&&n!==v.ERROR_RANGE?{type:"range",name:A.serializeRangeWithSheet(c,h)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const h=this._definedNamesService.getValueById(o.getUnitId(),r);return h?{type:"defineName",name:h.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const h=o.getSheetBySheetId(t);return h?{type:"sheet",name:h.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!t){if(n){const c=A.deserializeRangeWithSheet(n);a.isValidRange(c.range)&&n!==v.ERROR_RANGE&&this.navigateToRange(s,t,c.range);return}this.navigateToSheetById(s,t)}}parseHyperLink(e){var t,n,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(t=o.get("gid"))!=null?t:"",range:(n=o.get("range"))!=null?n:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,t,n){const r=await this.navigateToSheetById(e,t);if(r){const o=dn(n,r);await this._commandService.executeCommand(p.SetSelectionsOperation.id,{unitId:e,subUnitId:t,selections:[{range:o}]}),await this._commandService.executeCommand(f.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=n.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const s=o.getSheetId();return n.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const o=n.getSheetBySheetId(t);return o?n.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=cn([X(0,a.IUniverInstanceService),X(1,a.ICommandService),X(2,A.IDefinedNamesService),X(3,O.IMessageService),X(4,g.Inject(a.LocaleService))],l.SheetsHyperLinkResolverService);function J(i){return a.Tools.isLegalUrl(i)}function un(i){return/^[a-zA-Z]+:\/\//.test(i)}function pn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function ge(i){if(J(i)){const e=un(i)?i:pn(i)?`mailto://${i}`:`http://${i}`,t=new URL(e);return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:e}return i}function hn(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const t=e.dataStream;return t.substring(t.length-2,t.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const mn={cellLinkEditButtons:"univer-cell-link-edit-buttons"},se=()=>{var te;const[i,e]=C.useState(""),[t,n]=C.useState(""),[r,o]=C.useState("link"),[s,c]=C.useState(""),d=T.useDependency(a.LocaleService),h=T.useDependency(A.IDefinedNamesService),y=T.useDependency(a.IUniverInstanceService),L=T.useDependency(l.SheetsHyperLinkPopupService),u=O.useObservable(L.currentEditing$),R=T.useDependency(v.HyperLinkModel),_=T.useDependency(l.SheetsHyperLinkResolverService),k=T.useDependency(a.ICommandService),[P,N]=C.useState(!1),w=C.useRef(!1);C.useEffect(()=>{var S,b,M;if((u==null?void 0:u.row)!==void 0&&u.column!==void 0){const E=R.getHyperLinkByLocationSync(u.unitId,u.subUnitId,u.row,u.column);if(E){const pe=_.parseHyperLink(E.payload);if(e(E.id),n(E.display),pe.type==="outer"){o("link"),c(pe.url),pe.url===E.display&&(w.current=!0);return}else{const W=pe.searchObj;if(W.rangeid){o("rangeid"),c(W.rangeid);return}if(W.range){const Zn=W.gid&&(M=(b=(S=y.getUnit(u.unitId))==null?void 0:S.getSheetBySheetId(W.gid))==null?void 0:b.getName())!=null?M:"";if(o("range"),W.range===v.ERROR_RANGE)c("");else{const Ae=A.serializeRangeWithSheet(Zn,A.deserializeRangeWithSheet(W.range).range);c(Ae),Ae===E.display&&(w.current=!0)}return}if(W.gid){o("gid"),c(W.gid);return}}}const j=y.getUnit(u.unitId),D=j==null?void 0:j.getSheetBySheetId(u.subUnitId),Kn=D==null?void 0:D.getCellRaw(u.row,u.column),Ie=hn(Kn);o("link"),c(""),n((Ie!=null?Ie:"").toString()),e("");return}o("link"),c(""),n(""),e("")},[u,R,_,y]);const x=C.useMemo(()=>s,[r]),Z=[{label:d.t("hyperLink.form.link"),value:"link"},{label:d.t("hyperLink.form.range"),value:"range"},{label:d.t("hyperLink.form.worksheet"),value:"gid"},{label:d.t("hyperLink.form.definedName"),value:"rangeid"}],H=y.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!H)return;const G=H.getHiddenWorksheets(),B=H.getSheets().map(S=>({label:S.getName(),value:S.getSheetId()})).filter(S=>G.indexOf(S.value)===-1),F=Object.values((te=h.getDefinedNameMap(H.getUnitId()))!=null?te:{}).map(S=>({label:S.name,value:S.id})),ne=(S,b)=>{if(S==="link")return ge(b);if(S==="range"){const M=A.deserializeRangeWithSheet(b),E=H.getSheetBySheetName(M.sheetName);if(E)return`#gid=${E.getSheetId()}&range=${A.serializeRange(M.range)}`}return`#${S}=${b}`},Le=O.useEvent(S=>{var E;const b=S[0];if(!b||!a.isValidRange(b.range))return;b.sheetName||(b.sheetName=((E=H.getActiveSheet())==null?void 0:E.getName())||"");const M=A.serializeRangeToRefString(b);c(M),M&&(w.current||!t)&&(n(M),w.current=!0)}),ke=async()=>{if(u&&(i?await k.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,id:i,payload:{display:t,payload:ne(r,s)}}):await k.executeCommand(v.AddHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,link:{id:a.Tools.generateRandomId(),row:u.row,column:u.column,payload:ne(r,s),display:t}})),u){await k.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId});const S=1;await k.executeCommand(f.ScrollToRangeOperation.id,{range:{startRow:Math.max(u.row-S,0),endRow:u.row+S,startColumn:Math.max(u.column-S,0),endColumn:u.column+S}})}k.executeCommand(Q.id)};return m.jsxs("div",{children:[m.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:P&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:t,onChange:S=>{n(S),w.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),m.jsx(I.FormLayout,{label:d.t("hyperLink.form.type"),children:m.jsx(I.Select,{options:Z,value:r,onChange:S=>{o(S),c("")}})}),r==="link"&&m.jsx(I.FormLayout,{error:P?s?J(s)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:s,onChange:S=>{c(S),S&&(w.current||!t||t===s)&&(n(S),w.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(I.FormLayout,{error:P&&!s?d.t("hyperLink.form.inputError"):"",children:m.jsx(O.RangeSelector,{openForSheetUnitId:H.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:x,onChange:Le})}),r==="gid"&&m.jsx(I.FormLayout,{error:P&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:B,value:s,onChange:S=>{var E,j;c(S);const b=(E=B.find(D=>D.value===S))==null?void 0:E.label,M=(j=B.find(D=>D.value===s))==null?void 0:j.label;b&&(w.current||!t||t===M)&&(n(b),w.current=!0)}})}),r==="rangeid"&&m.jsx(I.FormLayout,{error:P&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:F,value:s,onChange:S=>{var E,j;c(S);const b=(E=F.find(D=>D.value===S))==null?void 0:E.label,M=(j=F.find(D=>D.value===s))==null?void 0:j.label;b&&(w.current||!t||t===M)&&(n(b),w.current=!0)}})}),m.jsxs("div",{className:mn.cellLinkEditButtons,children:[m.jsx(I.Button,{onClick:()=>{u&&k.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId}),k.executeCommand(Q.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!s||r==="link"&&!J(s)){N(!0);return}ke()},children:d.t("hyperLink.form.ok")})]})]})};se.componentKey="univer.sheet.cell-link-edit";const ae={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:t,subUnitId:n,row:r,column:o}=e,s=i.get(v.HyperLinkModel),c=i.get(O.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),h=s.getHyperLinkByLocation(t,n,r,o);return d.startEditing(e),c.open({header:{title:h?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:se.componentKey}}),!0}},Q={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(O.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return e.close(),t.endEditing(),!0}},le={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),t=p.getSheetCommandTarget(e);if(!t)return!1;const n=i.get(a.ICommandService),o=i.get(p.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return n.executeCommand(ae.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:s,column:c})}},ye={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(Q.id):e.executeCommand(le.id)}},V={cellLink:"univer-cell-link",cellLinkType:"univer-cell-link-type",cellLinkContent:"univer-cell-link-content",cellLinkContentError:"univer-cell-link-content-error",cellLinkUrl:"univer-cell-link-url",cellLinkOperations:"univer-cell-link-operations",cellLinkOperation:"univer-cell-link-operation",cellLinkOperationError:"univer-cell-link-operation-error"},vn={outer:m.jsx(oe,{}),link:m.jsx(oe,{}),sheet:m.jsx(Se,{}),range:m.jsx(ie,{}),defineName:m.jsx(ie,{}),"range-error":m.jsx(ie,{}),"sheet-error":m.jsx(Se,{})},ce=()=>{const i=T.useDependency(l.SheetsHyperLinkPopupService),e=T.useDependency(v.HyperLinkModel),t=T.useDependency(a.ICommandService),n=T.useDependency(O.IMessageService),r=T.useDependency(a.LocaleService),[o,s]=C.useState(null),c=T.useDependency(l.SheetsHyperLinkResolverService);if(C.useEffect(()=>{s(i.currentPopup);const _=i.currentPopup$.subscribe(k=>{s(k)});return()=>{_.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:d,subUnitId:h,id:y}=o,L=e.getHyperLink(d,h,y);if(!L)return null;const u=c.parseHyperLink(L.payload),R=u.type.indexOf("error")>-1;return m.jsxs("div",{className:V.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:Re(V.cellLinkContent,{[V.cellLinkContentError]:R}),onClick:u.handler,children:[m.jsx("div",{className:V.cellLinkType,children:vn[u.type]}),m.jsx(I.Tooltip,{showIfEllipsis:!0,title:u.name,children:m.jsx("span",{className:V.cellLinkUrl,children:u.name})})]}),m.jsxs("div",{className:V.cellLinkOperations,children:[o.copyPermission&&m.jsx("div",{className:Re(V.cellLinkOperation,{[V.cellLinkOperationError]:R}),onClick:()=>{if(!R){if(u.type!=="outer"){const _=new URL(window.location.href);_.hash=u.url.slice(1),navigator.clipboard.writeText(_.href)}else navigator.clipboard.writeText(u.url);n.show({content:r.t("hyperLink.message.coped"),type:I.MessageType.Info})}},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(we,{})})}),o.editPermission&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:V.cellLinkOperation,onClick:()=>{t.executeCommand(ae.id,{unitId:d,subUnitId:h,row:L.row,column:L.column})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(He,{})})}),m.jsx("div",{className:V.cellLinkOperation,onClick:()=>{t.executeCommand(v.CancelHyperLinkCommand.id,{unitId:d,subUnitId:h,id:L.id})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(Me,{})})})]})]})]})};ce.componentKey="univer.sheet.cell-link-popup";var Sn=Object.defineProperty,gn=Object.getOwnPropertyDescriptor,yn=(i,e,t,n)=>{for(var r=n>1?void 0:n?gn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Sn(e,t,r),r},je=(i,e)=>(t,n)=>e(t,n,i);const fn=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;l.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(t,n){super();Y(this,"_currentPopup",null);Y(this,"_currentPopup$",new me.Subject);Y(this,"currentPopup$",this._currentPopup$.asObservable());Y(this,"_currentEditing$",new me.BehaviorSubject(null));Y(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){if(this._currentPopup&&fn(t,this._currentPopup))return;this.hideCurrentPopup();const{unitId:n,subUnitId:r,row:o,col:s}=t,c=this._hyperLinkModel.getHyperLinkByLocation(n,r,o,s);if(!c)return;const d=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:ce.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});d&&(this._currentPopup={unitId:n,subUnitId:r,id:c.id,disposable:d,row:o,col:s,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var t;this._currentPopup&&((t=this._currentPopup.disposable)==null||t.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(t){this._currentEditing$.next(t)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=yn([je(0,g.Inject(v.HyperLinkModel)),je(1,g.Inject(f.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var _n=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ln=(i,e,t,n)=>{for(var r=n>1?void 0:n?Cn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&_n(e,t,r),r},q=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._sheetInterceptorService=e,this._injector=t,this._hyperLinkModel=n,this._selectionManagerService=r,this._univerInstanceService=o,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor()}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===v.AddHyperLinkCommand.id){const n=e.params,{unitId:r,subUnitId:o,link:s}=n,c=this._getCurrentCell(r,o,s.row,s.column),d={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(t=c==null?void 0:c.t)!=null?t:void 0}}}};return{redos:[{id:p.SetRangeValuesMutation.id,params:d}],undos:[{id:p.SetRangeValuesMutation.id,params:p.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===v.UpdateHyperLinkCommand.id){const t=e.params,{unitId:n,subUnitId:r,id:o,payload:s}=t,c=this._hyperLinkModel.getHyperLink(n,r,o);if(c&&c.display!==s.display){const d={unitId:n,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:p.SetRangeValuesMutation.id,params:d}],undos:[{id:p.SetRangeValuesMutation.id,params:p.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===p.SetRangeValuesCommand.id){const t=e.params,{unitId:n,subUnitId:r}=t,o=[],s=[];return t.cellValue&&new a.ObjectMatrix(t.cellValue).forValue((c,d,h)=>{var R,_,k;const y=(k=h==null?void 0:h.v)!=null?k:(_=(R=h==null?void 0:h.p)==null?void 0:R.body)==null?void 0:_.dataStream.slice(0,-2),L=(y!=null?y:"").toString(),u=this._hyperLinkModel.getHyperLinkByLocation(n,r,c,d);if(!u){if(J(L)){const P=a.Tools.generateRandomId();s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:P}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:{id:P,row:c,column:d,display:L,payload:ge(L)}}})}return}y===""&&(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:u.id}}),s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:u}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===p.ClearSelectionContentCommand.id||e.id===p.ClearSelectionAllCommand.id||e.id===p.ClearSelectionFormatCommand.id){const t=[],n=[],r=this._selectionManagerService.getCurrentLastSelection(),o=p.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(d,h)=>{const y=this._hyperLinkModel.getHyperLinkByLocation(s,c,d,h);y&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:y.id}}),n.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:y}}))})}return{redos:t,undos:n}}return{redos:[],undos:[]}}}))}_getCurrentCell(e,t,n,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(t))==null?void 0:s.getCell(n,r)}},l.SheetHyperLinkSetRangeController=Ln([a.OnLifecycle(a.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),q(0,g.Inject(p.SheetInterceptorService)),q(1,g.Inject(g.Injector)),q(2,g.Inject(v.HyperLinkModel)),q(3,g.Inject(p.SheetsSelectionsService)),q(4,a.IUniverInstanceService)],l.SheetHyperLinkSetRangeController);var kn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Rn=(i,e,t,n)=>{for(var r=n>1?void 0:n?In(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&kn(e,t,r),r},ee=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(me.debounceTime(100)).subscribe(e=>{var u,R;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const t=(R=(u=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:u.with(f.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:R.skeleton,n=e.location.col,r=e.location.row;let o=r,s=n;if(t&&t.overflowCache.forValue((_,k,P)=>{a.Rectangle.contains(P,{startColumn:n,endColumn:n,startRow:r,endRow:r})&&(o=_,s=k)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookViewPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const d=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}]),h=e.location.unitId,y=e.location.subUnitId,L=this._permissionService.composePermission([new p.WorkbookCopyPermission(h).id,new p.WorksheetCopyPermission(h,y).id]).every(_=>_.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:d,copyPermission:L})}))}},l.SheetsHyperLinkPopupController=Rn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),ee(0,g.Inject(f.HoverManagerService)),ee(1,g.Inject(l.SheetsHyperLinkPopupService)),ee(2,g.Inject(he.IRenderManagerService)),ee(3,g.Inject(a.IPermissionService)),ee(4,g.Inject(f.SheetPermissionInterceptorBaseController))],l.SheetsHyperLinkPopupController);const Pn=i=>({id:le.id,type:O.MenuItemType.BUTTON,positions:[O.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]})}),bn=i=>({tooltip:"hyperLink.form.addTitle",positions:O.MenuPosition.TOOLBAR_START,group:O.MenuGroup.TOOLBAR_OTHERS,id:ye.id,type:O.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[p.WorkbookEditablePermission],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission],rangeTypes:[p.RangeProtectionPermissionEditPoint]})}),fe={id:ye.id,binding:O.KeyCode.K|O.MetaKeys.CTRL_COMMAND,preconditions:f.whenSheetEditorFocused};var En=Object.defineProperty,On=Object.getOwnPropertyDescriptor,wn=(i,e,t,n)=>{for(var r=n>1?void 0:n?On(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&En(e,t,r),r},K=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,t,n,r,o,s,c){super(),this._config=e,this._componentManager=t,this._commandService=n,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[ce,ce.componentKey],[se,se.componentKey],[oe,"LinkSingle"]].forEach(([e,t])=>{this._componentManager.register(t,e)})}_initCommands(){[ae,Q,le,ye].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,t,n,r;this._menuService.addMenuItem(Pn(this._injector),(t=(e=this._config)==null?void 0:e.menu)!=null?t:{}),this._menuService.addMenuItem(bn(this._injector),(r=(n=this._config)==null?void 0:n.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(fe)}},l.SheetsHyperLinkUIController=wn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkUIController),K(1,g.Inject(O.ComponentManager)),K(2,a.ICommandService),K(3,g.Inject(a.LocaleService)),K(4,O.IMenuService),K(5,g.Inject(g.Injector)),K(6,g.Inject(O.IShortcutService))],l.SheetsHyperLinkUIController);const _e="SHEET_HYPER_LINK_UI_PLUGIN";var Mn=Object.defineProperty,Hn=Object.getOwnPropertyDescriptor,jn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Hn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Mn(e,t,r),r},Te=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:s,target:c,unitId:d,subUnitId:h}=r,y=f.virtualizeDiscreteRanges([s,c]),[L,u]=y.ranges,{mapFunc:R}=y,_={row:L.startRow,col:L.startColumn},k=f.getAutoFillRepeatRange(L,u),P=[],N=[];return k.forEach(w=>{const x=w.repeatStartCell,Z=w.relativeRange,H={startRow:_.row,startColumn:_.col,endColumn:_.col,endRow:_.row},G={startRow:x.row,startColumn:x.col,endColumn:x.col,endRow:x.row};a.Range.foreach(Z,(B,F)=>{const ne=a.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},H),{row:Le,col:ke}=R(ne.startRow,ne.startColumn),te=this._hyperLinkModel.getHyperLinkByLocation(d,h,Le,ke);if(te){const S=a.Rectangle.getPositionRange({startRow:B,startColumn:F,endColumn:F,endRow:B},G),{row:b,col:M}=R(S.startRow,S.startColumn),E=a.Tools.generateRandomId(),j=this._hyperLinkModel.getHyperLinkByLocation(d,h,b,M);j&&P.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:h,id:j.id}}),(f.APPLY_TYPE.COPY===o||f.APPLY_TYPE.SERIES===o)&&(P.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:h,link:{...te,id:E,row:b,column:M}}}),N.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:h,id:E}})),j&&N.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:h,link:j}})}})}),{undos:N,redos:P}},n={id:_e,onFillData:(r,o,s)=>s===f.APPLY_TYPE.COPY||s===f.APPLY_TYPE.ONLY_FORMAT||s===f.APPLY_TYPE.SERIES?t(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(n))}},l.SheetsHyperLinkAutoFillController=jn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),Te(0,f.IAutoFillService),Te(1,g.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var Tn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Nn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Un(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Tn(e,t,r),r},de=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(t,n,r,o){super();Y(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=n,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:_e,onBeforeCopy:(t,n,r)=>this._collect(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:s=f.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:h,unitId:y,subUnitId:L}=n;return this._generateMutations(h,{copyType:s,pasteType:c,copyRange:d,unitId:y,subUnitId:L})},onPastePlainText:(t,n)=>{if(J(n)){const r=ge(n),{range:o,unitId:s,subUnitId:c}=t,{ranges:[d],mapFunc:h}=f.virtualizeDiscreteRanges([o]),y=[],L=[];return a.Range.foreach(d,(u,R)=>{const{row:_,col:k}=h(u,R),P=this._hyperLinkModel.getHyperLinkByLocation(s,c,_,k);P&&y.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:P.id}});const N=a.Tools.generateRandomId();y.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:N,row:_,column:k,payload:r}}}),L.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:N}}),P&&L.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:P}})}),{redos:y,undos:L}}return{undos:[],redos:[]}}})}_collect(t,n,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:n,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=f.rangeToDiscreteRange(r,s,t,n);if(!c)return;const{rows:d,cols:h}=c;d.forEach((y,L)=>{h.forEach((u,R)=>{var k;const _=this._hyperLinkModel.getHyperLinkByLocation(t,n,y,u);o.setValue(L,R,(k=_==null?void 0:_.id)!=null?k:"")})})}_generateMutations(t,n){if(!this._copyInfo)return{redos:[],undos:[]};if(n.copyType===f.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange)return{redos:[],undos:[]};if([f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[d,h],mapFunc:y}=f.virtualizeDiscreteRanges([n.copyRange,t]);return f.getRepeatRange(d,h,!0).forEach(({startRange:u})=>{var R;(R=this._copyInfo)==null||R.matrix.forValue((_,k,P)=>{const N=a.Rectangle.getPositionRange({startRow:_,endRow:_,startColumn:k,endColumn:k},u),w=this._hyperLinkModel.getHyperLink(r,o,P),{row:x,col:Z}=y(N.startRow,N.startColumn),H=this._hyperLinkModel.getHyperLinkByLocation(n.unitId,n.subUnitId,x,Z),G=a.Tools.generateRandomId();H&&s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:H.id}}),w&&(s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:{...w,id:G,row:x,column:Z}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:G}})),H&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:H}})})}),{redos:s,undos:c}}},l.SheetsHyperLinkCopyPasteController=Nn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),de(0,f.ISheetClipboardService),de(1,g.Inject(v.HyperLinkModel)),de(2,g.Inject(g.Injector)),de(3,g.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Dn=Object.defineProperty,An=Object.getOwnPropertyDescriptor,Vn=(i,e,t,n)=>{for(var r=n>1?void 0:n?An(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Dn(e,t,r),r},xn=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}},l.SheetHyperLinkUrlController=Vn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),xn(0,g.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var Wn=Object.defineProperty,Bn=Object.getOwnPropertyDescriptor,Fn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Bn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Wn(e,t,r),r},Ce=(i,e)=>(t,n)=>e(t,n,i);let ue=class extends a.Disposable{constructor(i,e,t){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===fe.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[p.WorkbookEditablePermission],rangeTypes:[p.RangeProtectionPermissionEditPoint],worksheetTypes:[p.WorksheetEditPermission,p.WorksheetSetCellValuePermission,p.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};ue=Fn([a.OnLifecycle(a.LifecycleStages.Rendered,ue),Ce(0,g.Inject(a.LocaleService)),Ce(1,a.ICommandService),Ce(2,g.Inject(f.SheetPermissionInterceptorBaseController))],ue);var Ue=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Yn=(i,e,t)=>e in i?Ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,zn=(i,e,t,n)=>{for(var r=n>1?void 0:n?$n(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ue(e,t,r),r},Ne=(i,e)=>(t,n)=>e(t,n,i),De=(i,e,t)=>Yn(i,typeof e!="symbol"?e+"":e,t);l.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._renderManagerService=n}onStarting(e){[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRenderManagerController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[ue],[l.SheetHyperLinkUrlController]].forEach(n=>e.add(n))}onReady(){[[l.SheetsHyperLinkRenderController]].forEach(t=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,t))}},De(l.UniverSheetsHyperLinkUIPlugin,"pluginName",_e),De(l.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),l.UniverSheetsHyperLinkUIPlugin=zn([a.DependentOn(v.UniverSheetsHyperLinkPlugin),Ne(1,g.Inject(g.Injector)),Ne(2,he.IRenderManagerService)],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=Q,l.InsertHyperLinkOperation=le,l.InsertLinkShortcut=fe,l.OpenHyperLinkSidebarOperation=ae,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
9
+ */var Ke=L,ze=Symbol.for("react.element"),Ze=Symbol.for("react.fragment"),Ge=Object.prototype.hasOwnProperty,Xe=Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function Ee(i,e,t){var n,r={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)Ge.call(e,n)&&!Je.hasOwnProperty(n)&&(r[n]=e[n]);if(i&&i.defaultProps)for(n in e=i.defaultProps,e)r[n]===void 0&&(r[n]=e[n]);return{$$typeof:ze,type:i,key:o,ref:s,props:r,_owner:Xe.current}}ie.Fragment=Ze,ie.jsx=Ee,ie.jsxs=Ee,be.exports=ie;var m=be.exports,N=function(){return N=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},N.apply(this,arguments)},Qe=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},Y=L.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=Qe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),d=L.useRef("_".concat(nn()));return Oe(t,"".concat(n),{defIds:t.defIds,idSuffix:d.current},N({ref:e,className:c},s),o)});function Oe(i,e,t,n,r){return L.createElement(i.tag,N(N({key:e},qe(i,t,r)),n),(en(i,t).children||[]).map(function(o,s){return Oe(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function qe(i,e,t){var n=N({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function en(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?N(N({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?N(N({},r),{attrs:N(N({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function nn(){return Math.random().toString(36).substring(2,8)}Y.displayName="UniverIcon";var tn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z",fillRule:"evenodd",clipRule:"evenodd"}}]},oe=L.forwardRef(function(i,e){return L.createElement(Y,Object.assign({},i,{id:"all-border-single",ref:e,icon:tn}))});oe.displayName="AllBorderSingle";var rn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},we=L.forwardRef(function(i,e){return L.createElement(Y,Object.assign({},i,{id:"copy-single",ref:e,icon:rn}))});we.displayName="CopySingle";var on={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},se=L.forwardRef(function(i,e){return L.createElement(Y,Object.assign({},i,{id:"link-single",ref:e,icon:on}))});se.displayName="LinkSingle";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},Me=L.forwardRef(function(i,e){return L.createElement(Y,Object.assign({},i,{id:"unlink-single",ref:e,icon:sn}))});Me.displayName="UnlinkSingle";var an={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},He=L.forwardRef(function(i,e){return L.createElement(Y,Object.assign({},i,{id:"write-single",ref:e,icon:an}))});He.displayName="WriteSingle";var ln={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ge=L.forwardRef(function(i,e){return L.createElement(Y,Object.assign({},i,{id:"xlsx",ref:e,icon:ln}))});ge.displayName="Xlsx";var cn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,un=(i,e,t,n)=>{for(var r=n>1?void 0:n?dn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&cn(e,t,r),r},J=(i,e)=>(t,n)=>e(t,n,i);function pn(i,e){const t=e.getMergeData(),n=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(n<i.endColumn&&(i.endColumn=n),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return t.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}l.SheetsHyperLinkResolverService=class{constructor(e,t,n,r,o){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=o}_getURLName(e){var d;const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=s==null?void 0:s.getName())!=null?d:"";if(n){const p=V.deserializeRangeWithSheet(n).range;return a.isValidRange(p)&&n!==v.ERROR_RANGE?{type:"range",name:V.serializeRangeWithSheet(c,p)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const p=this._definedNamesService.getValueById(o.getUnitId(),r);return p?{type:"defineName",name:p.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const p=o.getSheetBySheetId(t);return p?{type:"sheet",name:p.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!t){if(n){const c=V.deserializeRangeWithSheet(n);a.isValidRange(c.range)&&n!==v.ERROR_RANGE&&this.navigateToRange(s,t,c.range);return}this.navigateToSheetById(s,t)}}parseHyperLink(e){var t,n,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(t=o.get("gid"))!=null?t:"",range:(n=o.get("range"))!=null?n:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,t,n){const r=await this.navigateToSheetById(e,t);if(r){const o=pn(n,r);await this._commandService.executeCommand(h.SetSelectionsOperation.id,{unitId:e,subUnitId:t,selections:[{range:o}]}),await this._commandService.executeCommand(_.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=n.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:R.MessageType.Error});return}const s=o.getSheetId();return n.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:R.MessageType.Error}),await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const o=n.getSheetBySheetId(t);return o?n.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:R.MessageType.Error}),!1):await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:R.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=un([J(0,a.IUniverInstanceService),J(1,a.ICommandService),J(2,V.IDefinedNamesService),J(3,w.IMessageService),J(4,y.Inject(a.LocaleService))],l.SheetsHyperLinkResolverService);function Q(i){return a.Tools.isLegalUrl(i)}function hn(i){return/^[a-zA-Z]+:\/\//.test(i)}function mn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function Se(i){if(Q(i)){const e=hn(i)?i:mn(i)?`mailto://${i}`:`http://${i}`,t=new URL(e);return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:e}return i}function vn(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const t=e.dataStream;return t.substring(t.length-2,t.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const gn={cellLinkEditButtons:"univer-cell-link-edit-buttons"},ae=()=>{var te;const[i,e]=L.useState(""),[t,n]=L.useState(""),[r,o]=L.useState("link"),[s,c]=L.useState(""),d=U.useDependency(a.LocaleService),p=U.useDependency(V.IDefinedNamesService),S=U.useDependency(a.IUniverInstanceService),C=U.useDependency(l.SheetsHyperLinkPopupService),u=w.useObservable(C.currentEditing$),I=U.useDependency(v.HyperLinkModel),f=U.useDependency(l.SheetsHyperLinkResolverService),k=U.useDependency(a.ICommandService),[P,T]=L.useState(!1),O=L.useRef(!1);L.useEffect(()=>{var g,b,H;if((u==null?void 0:u.row)!==void 0&&u.column!==void 0){const E=I.getHyperLinkByLocationSync(u.unitId,u.subUnitId,u.row,u.column);if(E){const he=f.parseHyperLink(E.payload);if(e(E.id),n(E.display),he.type==="outer"){o("link"),c(he.url),he.url===E.display&&(O.current=!0);return}else{const W=he.searchObj;if(W.rangeid){o("rangeid"),c(W.rangeid);return}if(W.range){const Xn=W.gid&&(H=(b=(g=S.getUnit(u.unitId))==null?void 0:g.getSheetBySheetId(W.gid))==null?void 0:b.getName())!=null?H:"";if(o("range"),W.range===v.ERROR_RANGE)c("");else{const Ae=V.serializeRangeWithSheet(Xn,V.deserializeRangeWithSheet(W.range).range);c(Ae),Ae===E.display&&(O.current=!0)}return}if(W.gid){o("gid"),c(W.gid);return}}}const j=S.getUnit(u.unitId),A=j==null?void 0:j.getSheetBySheetId(u.subUnitId),Gn=A==null?void 0:A.getCellRaw(u.row,u.column),Ie=vn(Gn);o("link"),c(""),n((Ie!=null?Ie:"").toString()),e("");return}o("link"),c(""),n(""),e("")},[u,I,f,S]);const D=L.useMemo(()=>s,[r]),B=[{label:d.t("hyperLink.form.link"),value:"link"},{label:d.t("hyperLink.form.range"),value:"range"},{label:d.t("hyperLink.form.worksheet"),value:"gid"},{label:d.t("hyperLink.form.definedName"),value:"rangeid"}],M=S.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!M)return;const X=M.getHiddenWorksheets(),F=M.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>X.indexOf(g.value)===-1),$=Object.values((te=p.getDefinedNameMap(M.getUnitId()))!=null?te:{}).map(g=>({label:g.name,value:g.id})),ne=(g,b)=>{if(g==="link")return Se(b);if(g==="range"){const H=V.deserializeRangeWithSheet(b),E=M.getSheetBySheetName(H.sheetName);if(E)return`#gid=${E.getSheetId()}&range=${V.serializeRange(H.range)}`}return`#${g}=${b}`},Le=w.useEvent(g=>{var E;const b=g[0];if(!b||!a.isValidRange(b.range))return;b.sheetName||(b.sheetName=((E=M.getActiveSheet())==null?void 0:E.getName())||"");const H=V.serializeRangeToRefString(b);c(H),H&&(O.current||!t)&&(n(H),O.current=!0)}),ke=async()=>{if(u&&(i?await k.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,id:i,payload:{display:t,payload:ne(r,s)}}):await k.executeCommand(v.AddHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,link:{id:a.Tools.generateRandomId(),row:u.row,column:u.column,payload:ne(r,s),display:t}})),u){await k.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId});const g=1;await k.executeCommand(_.ScrollToRangeOperation.id,{range:{startRow:Math.max(u.row-g,0),endRow:u.row+g,startColumn:Math.max(u.column-g,0),endColumn:u.column+g}})}k.executeCommand(q.id)};return m.jsxs("div",{children:[m.jsx(R.FormLayout,{label:d.t("hyperLink.form.label"),error:P&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(R.Input,{value:t,onChange:g=>{n(g),O.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),m.jsx(R.FormLayout,{label:d.t("hyperLink.form.type"),children:m.jsx(R.Select,{options:B,value:r,onChange:g=>{o(g),c("")}})}),r==="link"&&m.jsx(R.FormLayout,{error:P?s?Q(s)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(R.Input,{value:s,onChange:g=>{c(g),g&&(O.current||!t||t===s)&&(n(g),O.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(R.FormLayout,{error:P&&!s?d.t("hyperLink.form.inputError"):"",children:m.jsx(w.RangeSelector,{openForSheetUnitId:M.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:D,onChange:Le})}),r==="gid"&&m.jsx(R.FormLayout,{error:P&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(R.Select,{options:F,value:s,onChange:g=>{var E,j;c(g);const b=(E=F.find(A=>A.value===g))==null?void 0:E.label,H=(j=F.find(A=>A.value===s))==null?void 0:j.label;b&&(O.current||!t||t===H)&&(n(b),O.current=!0)}})}),r==="rangeid"&&m.jsx(R.FormLayout,{error:P&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(R.Select,{options:$,value:s,onChange:g=>{var E,j;c(g);const b=(E=$.find(A=>A.value===g))==null?void 0:E.label,H=(j=$.find(A=>A.value===s))==null?void 0:j.label;b&&(O.current||!t||t===H)&&(n(b),O.current=!0)}})}),m.jsxs("div",{className:gn.cellLinkEditButtons,children:[m.jsx(R.Button,{onClick:()=>{u&&k.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId}),k.executeCommand(q.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(R.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!s||r==="link"&&!Q(s)){T(!0);return}ke()},children:d.t("hyperLink.form.ok")})]})]})};ae.componentKey="univer.sheet.cell-link-edit";const le={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:t,subUnitId:n,row:r,column:o}=e,s=i.get(v.HyperLinkModel),c=i.get(w.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),p=s.getHyperLinkByLocation(t,n,r,o);return d.startEditing(e),c.open({header:{title:p?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:ae.componentKey}}),!0}},q={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(w.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return e.close(),t.endEditing(),!0}},ce={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),t=h.getSheetCommandTarget(e);if(!t)return!1;const n=i.get(a.ICommandService),o=i.get(h.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return n.executeCommand(le.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:s,column:c})}},ye={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(q.id):e.executeCommand(ce.id)}},x={cellLink:"univer-cell-link",cellLinkType:"univer-cell-link-type",cellLinkContent:"univer-cell-link-content",cellLinkContentError:"univer-cell-link-content-error",cellLinkUrl:"univer-cell-link-url",cellLinkOperations:"univer-cell-link-operations",cellLinkOperation:"univer-cell-link-operation",cellLinkOperationError:"univer-cell-link-operation-error"},Sn={outer:m.jsx(se,{}),link:m.jsx(se,{}),sheet:m.jsx(ge,{}),range:m.jsx(oe,{}),defineName:m.jsx(oe,{}),"range-error":m.jsx(oe,{}),"sheet-error":m.jsx(ge,{})},de=()=>{const i=U.useDependency(l.SheetsHyperLinkPopupService),e=U.useDependency(v.HyperLinkModel),t=U.useDependency(a.ICommandService),n=U.useDependency(w.IMessageService),r=U.useDependency(a.LocaleService),[o,s]=L.useState(null),c=U.useDependency(l.SheetsHyperLinkResolverService);if(L.useEffect(()=>{s(i.currentPopup);const f=i.currentPopup$.subscribe(k=>{s(k)});return()=>{f.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:d,subUnitId:p,id:S}=o,C=e.getHyperLink(d,p,S);if(!C)return null;const u=c.parseHyperLink(C.payload),I=u.type.indexOf("error")>-1;return m.jsxs("div",{className:x.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:Re(x.cellLinkContent,{[x.cellLinkContentError]:I}),onClick:u.handler,children:[m.jsx("div",{className:x.cellLinkType,children:Sn[u.type]}),m.jsx(R.Tooltip,{showIfEllipsis:!0,title:u.name,children:m.jsx("span",{className:x.cellLinkUrl,children:u.name})})]}),m.jsxs("div",{className:x.cellLinkOperations,children:[o.copyPermission&&m.jsx("div",{className:Re(x.cellLinkOperation,{[x.cellLinkOperationError]:I}),onClick:()=>{if(!I){if(u.type!=="outer"){const f=new URL(window.location.href);f.hash=u.url.slice(1),navigator.clipboard.writeText(f.href)}else navigator.clipboard.writeText(u.url);n.show({content:r.t("hyperLink.message.coped"),type:R.MessageType.Info})}},children:m.jsx(R.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(we,{})})}),o.editPermission&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:x.cellLinkOperation,onClick:()=>{t.executeCommand(le.id,{unitId:d,subUnitId:p,row:C.row,column:C.column})},children:m.jsx(R.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(He,{})})}),m.jsx("div",{className:x.cellLinkOperation,onClick:()=>{t.executeCommand(v.CancelHyperLinkCommand.id,{unitId:d,subUnitId:p,id:C.id})},children:m.jsx(R.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(Me,{})})})]})]})]})};de.componentKey="univer.sheet.cell-link-popup";var yn=Object.defineProperty,fn=Object.getOwnPropertyDescriptor,_n=(i,e,t,n)=>{for(var r=n>1?void 0:n?fn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&yn(e,t,r),r},Te=(i,e)=>(t,n)=>e(t,n,i);const Cn=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;l.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(t,n){super();K(this,"_currentPopup",null);K(this,"_currentPopup$",new re.Subject);K(this,"currentPopup$",this._currentPopup$.asObservable());K(this,"_currentEditing$",new re.BehaviorSubject(null));K(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){if(this._currentPopup&&Cn(t,this._currentPopup))return;this.hideCurrentPopup();const{unitId:n,subUnitId:r,row:o,col:s}=t,c=this._hyperLinkModel.getHyperLinkByLocation(n,r,o,s);if(!c)return;const d=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:de.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});d&&(this._currentPopup={unitId:n,subUnitId:r,id:c.id,disposable:d,row:o,col:s,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var t;this._currentPopup&&((t=this._currentPopup.disposable)==null||t.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(t){this._currentEditing$.next(t)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=_n([Te(0,y.Inject(v.HyperLinkModel)),Te(1,y.Inject(_.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var Ln=Object.defineProperty,kn=Object.getOwnPropertyDescriptor,In=(i,e,t,n)=>{for(var r=n>1?void 0:n?kn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ln(e,t,r),r},Z=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,t,n,r,o,s){super(),this._sheetInterceptorService=e,this._injector=t,this._hyperLinkModel=n,this._selectionManagerService=r,this._univerInstanceService=o,this._editorBridgeService=s,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor(),this._initRichTextEditorInterceptor()}_getCurrentCell(e,t,n,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(t))==null?void 0:s.getCell(n,r)}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===v.AddHyperLinkCommand.id){const n=e.params,{unitId:r,subUnitId:o,link:s}=n,c=this._getCurrentCell(r,o,s.row,s.column),d={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(t=c==null?void 0:c.t)!=null?t:void 0}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===v.UpdateHyperLinkCommand.id){const t=e.params,{unitId:n,subUnitId:r,id:o,payload:s}=t,c=this._hyperLinkModel.getHyperLink(n,r,o);if(c&&c.display!==s.display){const d={unitId:n,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.SetRangeValuesCommand.id){const t=e.params,{unitId:n,subUnitId:r}=t,o=[],s=[];return t.cellValue&&new a.ObjectMatrix(t.cellValue).forValue((c,d,p)=>{var I,f,k,P,T,O,D;const S=(k=p==null?void 0:p.v)!=null?k:(f=(I=p==null?void 0:p.p)==null?void 0:I.body)==null?void 0:f.dataStream.slice(0,-2),C=(S!=null?S:"").toString(),u=this._hyperLinkModel.getHyperLinkByLocation(n,r,c,d);if(!u){if(Q(C)||(P=p==null?void 0:p.custom)!=null&&P.__link_url){const B=(O=(T=p==null?void 0:p.custom)==null?void 0:T.__link_url)!=null?O:C,M=a.Tools.generateRandomId();s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:M}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:{id:M,row:c,column:d,display:C,payload:Se(B)}}})}return}(S===""||((D=p==null?void 0:p.custom)==null?void 0:D.__link_url)==="")&&(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:u.id}}),s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:u}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.ClearSelectionContentCommand.id||e.id===h.ClearSelectionAllCommand.id||e.id===h.ClearSelectionFormatCommand.id){const t=[],n=[],r=this._selectionManagerService.getCurrentLastSelection(),o=h.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(d,p)=>{const S=this._hyperLinkModel.getHyperLinkByLocation(s,c,d,p);S&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:S.id}}),n.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:S}}))})}return{redos:t,undos:n}}return{redos:[],undos:[]}}}))}_initRichTextEditorInterceptor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{var r,o,s,c,d,p;if(e!=null&&e.p){const S=(o=(r=e.p.body)==null?void 0:r.customRanges)==null?void 0:o.find(u=>u.rangeType===a.CustomRangeType.HYPERLINK),C=(s=e.p.resources)==null?void 0:s.find(u=>u.name===Ve.DOC_HYPER_LINK_PLUGIN);if(S&&C){const u=S.rangeId,I=(p=(d=(c=JSON.parse(C.data))==null?void 0:c.links)==null?void 0:d.find(f=>f.id===u))==null?void 0:p.payload;return n({...e,p:null,v:xe.getPlainTextFormDocument(e.p),t:a.CellValueType.STRING,custom:{__link_url:I}})}}return n(e)}}))}},l.SheetHyperLinkSetRangeController=In([a.OnLifecycle(a.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),Z(0,y.Inject(h.SheetInterceptorService)),Z(1,y.Inject(y.Injector)),Z(2,y.Inject(v.HyperLinkModel)),Z(3,y.Inject(h.SheetsSelectionsService)),Z(4,a.IUniverInstanceService),Z(5,_.IEditorBridgeService)],l.SheetHyperLinkSetRangeController);var Rn=Object.defineProperty,Pn=Object.getOwnPropertyDescriptor,bn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Pn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Rn(e,t,r),r},ee=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(re.debounceTime(100)).subscribe(e=>{var u,I;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const t=(I=(u=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:u.with(_.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:I.skeleton,n=e.location.col,r=e.location.row;let o=r,s=n;if(t&&t.overflowCache.forValue((f,k,P)=>{a.Rectangle.contains(P,{startColumn:n,endColumn:n,startRow:r,endRow:r})&&(o=f,s=k)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookViewPermission],worksheetTypes:[h.WorksheetViewPermission],rangeTypes:[h.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const d=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}]),p=e.location.unitId,S=e.location.subUnitId,C=this._permissionService.composePermission([new h.WorkbookCopyPermission(p).id,new h.WorksheetCopyPermission(p,S).id]).every(f=>f.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:d,copyPermission:C})}))}},l.SheetsHyperLinkPopupController=bn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),ee(0,y.Inject(_.HoverManagerService)),ee(1,y.Inject(l.SheetsHyperLinkPopupService)),ee(2,y.Inject(me.IRenderManagerService)),ee(3,y.Inject(a.IPermissionService)),ee(4,y.Inject(_.SheetPermissionInterceptorBaseController))],l.SheetsHyperLinkPopupController);const En=i=>({id:ce.id,type:w.MenuItemType.BUTTON,positions:[w.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:w.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:_.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),On=i=>({tooltip:"hyperLink.form.addTitle",positions:w.MenuPosition.TOOLBAR_START,group:w.MenuGroup.TOOLBAR_OTHERS,id:ye.id,type:w.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:w.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:_.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),fe={id:ye.id,binding:w.KeyCode.K|w.MetaKeys.CTRL_COMMAND,preconditions:_.whenSheetEditorFocused};var wn=Object.defineProperty,Mn=Object.getOwnPropertyDescriptor,Hn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Mn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wn(e,t,r),r},G=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,t,n,r,o,s,c){super(),this._config=e,this._componentManager=t,this._commandService=n,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[de,de.componentKey],[ae,ae.componentKey],[se,"LinkSingle"]].forEach(([e,t])=>{this._componentManager.register(t,e)})}_initCommands(){[le,q,ce,ye].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,t,n,r;this._menuService.addMenuItem(En(this._injector),(t=(e=this._config)==null?void 0:e.menu)!=null?t:{}),this._menuService.addMenuItem(On(this._injector),(r=(n=this._config)==null?void 0:n.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(fe)}},l.SheetsHyperLinkUIController=Hn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkUIController),G(1,y.Inject(w.ComponentManager)),G(2,a.ICommandService),G(3,y.Inject(a.LocaleService)),G(4,w.IMenuService),G(5,y.Inject(y.Injector)),G(6,y.Inject(w.IShortcutService))],l.SheetsHyperLinkUIController);const _e="SHEET_HYPER_LINK_UI_PLUGIN";var Tn=Object.defineProperty,jn=Object.getOwnPropertyDescriptor,Un=(i,e,t,n)=>{for(var r=n>1?void 0:n?jn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Tn(e,t,r),r},je=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:s,target:c,unitId:d,subUnitId:p}=r,S=_.virtualizeDiscreteRanges([s,c]),[C,u]=S.ranges,{mapFunc:I}=S,f={row:C.startRow,col:C.startColumn},k=_.getAutoFillRepeatRange(C,u),P=[],T=[];return k.forEach(O=>{const D=O.repeatStartCell,B=O.relativeRange,M={startRow:f.row,startColumn:f.col,endColumn:f.col,endRow:f.row},X={startRow:D.row,startColumn:D.col,endColumn:D.col,endRow:D.row};a.Range.foreach(B,(F,$)=>{const ne=a.Rectangle.getPositionRange({startRow:F,startColumn:$,endColumn:$,endRow:F},M),{row:Le,col:ke}=I(ne.startRow,ne.startColumn),te=this._hyperLinkModel.getHyperLinkByLocation(d,p,Le,ke);if(te){const g=a.Rectangle.getPositionRange({startRow:F,startColumn:$,endColumn:$,endRow:F},X),{row:b,col:H}=I(g.startRow,g.startColumn),E=a.Tools.generateRandomId(),j=this._hyperLinkModel.getHyperLinkByLocation(d,p,b,H);j&&P.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:j.id}}),(_.APPLY_TYPE.COPY===o||_.APPLY_TYPE.SERIES===o)&&(P.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:{...te,id:E,row:b,column:H}}}),T.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:E}})),j&&T.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:j}})}})}),{undos:T,redos:P}},n={id:_e,onFillData:(r,o,s)=>s===_.APPLY_TYPE.COPY||s===_.APPLY_TYPE.ONLY_FORMAT||s===_.APPLY_TYPE.SERIES?t(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(n))}},l.SheetsHyperLinkAutoFillController=Un([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),je(0,_.IAutoFillService),je(1,y.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var Nn=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,An=(i,e,t,n)=>{for(var r=n>1?void 0:n?Dn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Nn(e,t,r),r},ue=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(t,n,r,o){super();K(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=n,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:_e,onBeforeCopy:(t,n,r)=>this._collect(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:s=_.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:p,unitId:S,subUnitId:C}=n;return this._generateMutations(p,{copyType:s,pasteType:c,copyRange:d,unitId:S,subUnitId:C})},onPastePlainText:(t,n)=>{if(Q(n)){const r=Se(n),{range:o,unitId:s,subUnitId:c}=t,{ranges:[d],mapFunc:p}=_.virtualizeDiscreteRanges([o]),S=[],C=[];return a.Range.foreach(d,(u,I)=>{const{row:f,col:k}=p(u,I),P=this._hyperLinkModel.getHyperLinkByLocation(s,c,f,k);P&&S.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:P.id}});const T=a.Tools.generateRandomId();S.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:T,row:f,column:k,payload:r}}}),C.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:T}}),P&&C.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:P}})}),{redos:S,undos:C}}return{undos:[],redos:[]}}})}_collect(t,n,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:n,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=_.rangeToDiscreteRange(r,s,t,n);if(!c)return;const{rows:d,cols:p}=c;d.forEach((S,C)=>{p.forEach((u,I)=>{var k;const f=this._hyperLinkModel.getHyperLinkByLocation(t,n,S,u);o.setValue(C,I,(k=f==null?void 0:f.id)!=null?k:"")})})}_generateMutations(t,n){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange)return{redos:[],undos:[]};if([_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,_.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[d,p],mapFunc:S}=_.virtualizeDiscreteRanges([n.copyRange,t]);return _.getRepeatRange(d,p,!0).forEach(({startRange:u})=>{var I;(I=this._copyInfo)==null||I.matrix.forValue((f,k,P)=>{const T=a.Rectangle.getPositionRange({startRow:f,endRow:f,startColumn:k,endColumn:k},u),O=this._hyperLinkModel.getHyperLink(r,o,P),{row:D,col:B}=S(T.startRow,T.startColumn),M=this._hyperLinkModel.getHyperLinkByLocation(n.unitId,n.subUnitId,D,B),X=a.Tools.generateRandomId();M&&s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:M.id}}),O&&(s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:{...O,id:X,row:D,column:B}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:X}})),M&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:M}})})}),{redos:s,undos:c}}},l.SheetsHyperLinkCopyPasteController=An([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),ue(0,_.ISheetClipboardService),ue(1,y.Inject(v.HyperLinkModel)),ue(2,y.Inject(y.Injector)),ue(3,y.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Vn=Object.defineProperty,xn=Object.getOwnPropertyDescriptor,Wn=(i,e,t,n)=>{for(var r=n>1?void 0:n?xn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Vn(e,t,r),r},Bn=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}},l.SheetHyperLinkUrlController=Wn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),Bn(0,y.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var Fn=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Yn=(i,e,t,n)=>{for(var r=n>1?void 0:n?$n(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Fn(e,t,r),r},Ce=(i,e)=>(t,n)=>e(t,n,i);let pe=class extends a.Disposable{constructor(i,e,t){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===fe.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],rangeTypes:[h.RangeProtectionPermissionEditPoint],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};pe=Yn([a.OnLifecycle(a.LifecycleStages.Rendered,pe),Ce(0,y.Inject(a.LocaleService)),Ce(1,a.ICommandService),Ce(2,y.Inject(_.SheetPermissionInterceptorBaseController))],pe);var Ue=Object.defineProperty,Kn=Object.getOwnPropertyDescriptor,zn=(i,e,t)=>e in i?Ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Zn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Kn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ue(e,t,r),r},Ne=(i,e)=>(t,n)=>e(t,n,i),De=(i,e,t)=>zn(i,typeof e!="symbol"?e+"":e,t);l.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._renderManagerService=n}onStarting(e){[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRenderManagerController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[pe],[l.SheetHyperLinkUrlController]].forEach(n=>e.add(n))}onReady(){[[l.SheetsHyperLinkRenderController]].forEach(t=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,t))}},De(l.UniverSheetsHyperLinkUIPlugin,"pluginName",_e),De(l.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),l.UniverSheetsHyperLinkUIPlugin=Zn([a.DependentOn(v.UniverSheetsHyperLinkPlugin),Ne(1,y.Inject(y.Injector)),Ne(2,me.IRenderManagerService)],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=q,l.InsertHyperLinkOperation=ce,l.InsertLinkShortcut=fe,l.OpenHyperLinkSidebarOperation=le,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-hyper-link-ui",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -50,37 +50,41 @@
50
50
  "lib"
51
51
  ],
52
52
  "peerDependencies": {
53
- "@wendellhu/redi": "0.15.5",
53
+ "@wendellhu/redi": "0.16.0",
54
54
  "clsx": ">=2.0.0",
55
55
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
56
56
  "rxjs": ">=7.0.0",
57
- "@univerjs/design": "0.2.3",
58
- "@univerjs/core": "0.2.3",
59
- "@univerjs/engine-formula": "0.2.3",
60
- "@univerjs/engine-render": "0.2.3",
61
- "@univerjs/sheets-hyper-link": "0.2.3",
62
- "@univerjs/sheets": "0.2.3",
63
- "@univerjs/sheets-ui": "0.2.3",
64
- "@univerjs/ui": "0.2.3"
57
+ "@univerjs/core": "0.2.4",
58
+ "@univerjs/design": "0.2.4",
59
+ "@univerjs/docs": "0.2.4",
60
+ "@univerjs/docs-hyper-link": "0.2.4",
61
+ "@univerjs/engine-render": "0.2.4",
62
+ "@univerjs/sheets": "0.2.4",
63
+ "@univerjs/sheets-ui": "0.2.4",
64
+ "@univerjs/sheets-hyper-link": "0.2.4",
65
+ "@univerjs/engine-formula": "0.2.4",
66
+ "@univerjs/ui": "0.2.4"
65
67
  },
66
68
  "dependencies": {
67
- "@univerjs/icons": "^0.1.58",
68
- "@univerjs/sheets-hyper-link": "0.2.3"
69
+ "@univerjs/icons": "^0.1.65",
70
+ "@univerjs/sheets-hyper-link": "0.2.4"
69
71
  },
70
72
  "devDependencies": {
71
- "@wendellhu/redi": "0.15.5",
73
+ "@wendellhu/redi": "0.16.0",
72
74
  "clsx": "^2.1.1",
73
75
  "rxjs": "^7.8.1",
74
76
  "typescript": "^5.5.3",
75
- "vite": "^5.3.3",
76
- "vitest": "^1.6.0",
77
- "@univerjs/core": "0.2.3",
78
- "@univerjs/shared": "0.2.3",
79
- "@univerjs/engine-render": "0.2.3",
80
- "@univerjs/engine-formula": "0.2.3",
81
- "@univerjs/sheets": "0.2.3",
82
- "@univerjs/sheets-ui": "0.2.3",
83
- "@univerjs/ui": "0.2.3"
77
+ "vite": "^5.3.4",
78
+ "vitest": "^2.0.3",
79
+ "@univerjs/core": "0.2.4",
80
+ "@univerjs/docs": "0.2.4",
81
+ "@univerjs/shared": "0.2.4",
82
+ "@univerjs/engine-render": "0.2.4",
83
+ "@univerjs/docs-hyper-link": "0.2.4",
84
+ "@univerjs/engine-formula": "0.2.4",
85
+ "@univerjs/sheets": "0.2.4",
86
+ "@univerjs/ui": "0.2.4",
87
+ "@univerjs/sheets-ui": "0.2.4"
84
88
  },
85
89
  "univerSpace": {
86
90
  ".": {