@univerjs/sheets-hyper-link-ui 0.4.1 → 0.4.2-nightly.202410301606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/es/facade.js +1 -0
- package/lib/es/index.js +104 -560
- package/lib/locale/en-US.js +38 -0
- package/lib/locale/fa-IR.js +38 -0
- package/lib/locale/ru-RU.js +38 -0
- package/lib/locale/vi-VN.js +38 -0
- package/lib/locale/zh-CN.js +38 -0
- package/lib/locale/zh-TW.js +38 -0
- package/lib/types/controllers/menu.d.ts +5 -6
- package/lib/types/controllers/url.controller.d.ts +3 -1
- package/lib/types/facade/f-workbook.d.ts +13 -0
- package/lib/types/{types/interfaces/i-sheet-url-params.d.ts → facade/index.d.ts} +0 -6
- package/lib/types/index.d.ts +0 -4
- package/lib/types/services/resolver.service.d.ts +4 -8
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +27 -25
- package/LICENSE +0 -176
- package/lib/cjs/index.js +0 -9
- package/lib/locale/en-US.json +0 -35
- package/lib/locale/fa-IR.json +0 -35
- package/lib/locale/ru-RU.json +0 -35
- package/lib/locale/vi-VN.json +0 -35
- package/lib/locale/zh-CN.json +0 -35
- package/lib/locale/zh-TW.json +0 -35
- package/lib/types/commands/commands/add-hyper-link.command.d.ts +0 -19
- package/lib/types/commands/commands/remove-hyper-link.command.d.ts +0 -19
- package/lib/types/commands/commands/update-hyper-link.command.d.ts +0 -17
- package/lib/types/types/interfaces/i-sheet-hyper-link-info.d.ts +0 -10
- package/lib/types/types/interfaces/index.d.ts +0 -17
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
package/lib/cjs/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),sheetsHyperLink=require("@univerjs/sheets-hyper-link"),sheetsUi=require("@univerjs/sheets-ui"),design=require("@univerjs/design"),engineFormula=require("@univerjs/engine-formula"),sheets=require("@univerjs/sheets"),ui=require("@univerjs/ui"),docs=require("@univerjs/docs"),rxjs=require("rxjs"),docsUi=require("@univerjs/docs-ui"),require$$0=require("react"),engineRender=require("@univerjs/engine-render"),sheetsFormulaUi=require("@univerjs/sheets-formula-ui");function isLegalLink(link){return core.Tools.isLegalUrl(link)}__name(isLegalLink,"isLegalLink");function hasProtocol(urlString){return/^[a-zA-Z]+:\/\//.test(urlString)}__name(hasProtocol,"hasProtocol");function isEmail(url){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url)}__name(isEmail,"isEmail");function serializeUrl(urlStr){if(isLegalLink(urlStr)){const transformedUrl=hasProtocol(urlStr)?urlStr:isEmail(urlStr)?`mailto://${urlStr}`:`http://${urlStr}`;let url;try{url=new URL(transformedUrl)}catch{return urlStr}return url.hostname===location.hostname&&url.port===location.port&&url.protocol===location.protocol&&url.pathname===location.pathname&&url.hash&&!url.search?url.hash:transformedUrl}return urlStr}__name(serializeUrl,"serializeUrl");const PLUGIN_CONFIG_KEY="sheets-hyper-link-ui.config",defaultPluginConfig={};var __defProp$c=Object.defineProperty,__getOwnPropDesc$c=Object.getOwnPropertyDescriptor,__decorateClass$c=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$c(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$c(target,key,result),result},"__decorateClass$c"),__decorateParam$c=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$c");function getContainRange(range,worksheet){const mergedCells=worksheet.getMergeData(),maxCol=worksheet.getMaxColumns()-1,maxRow=worksheet.getMaxRows()-1;if(maxCol<range.endColumn&&(range.endColumn=maxCol),maxRow<range.endRow&&(range.endRow=maxRow),range.rangeType===core.RANGE_TYPE.COLUMN||core.RANGE_TYPE.ROW)return range;const relativeCells=[];return mergedCells.forEach(cell=>{core.Rectangle.intersects(range,cell)&&relativeCells.push(cell)}),core.Rectangle.realUnion(range,...relativeCells)}__name(getContainRange,"getContainRange");var _a;exports.SheetsHyperLinkResolverService=(_a=class{constructor(_univerInstanceService,_commandService,_definedNamesService,_messageService,_localeService,_configService){this._univerInstanceService=_univerInstanceService,this._commandService=_commandService,this._definedNamesService=_definedNamesService,this._messageService=_messageService,this._localeService=_localeService,this._configService=_configService}_getURLName(params){var _a15;const{gid,range,rangeid,unitid}=params,workbook=unitid?this._univerInstanceService.getUnit(unitid,core.UniverInstanceType.UNIVER_SHEET):this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),invalidLink={type:sheetsHyperLink.SheetHyperLinkType.INVALID,name:this._localeService.t("hyperLink.message.refError")};if(!workbook)return invalidLink;const sheet=gid?workbook.getSheetBySheetId(gid):workbook.getActiveSheet(),sheetName=(_a15=sheet==null?void 0:sheet.getName())!=null?_a15:"";if(range){if(!sheet)return invalidLink;const rangeObj=engineFormula.deserializeRangeWithSheet(range).range;return core.isValidRange(rangeObj,sheet)&&range!==sheetsHyperLink.ERROR_RANGE?{type:sheetsHyperLink.SheetHyperLinkType.RANGE,name:engineFormula.serializeRangeWithSheet(sheetName,rangeObj)}:invalidLink}if(rangeid){const range2=this._definedNamesService.getValueById(workbook.getUnitId(),rangeid);return range2?{type:sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME,name:range2.formulaOrRefString}:invalidLink}if(gid){const worksheet=workbook.getSheetBySheetId(gid);return worksheet?{type:sheetsHyperLink.SheetHyperLinkType.SHEET,name:worksheet.getName()}:invalidLink}return invalidLink}navigateTo(params){const{gid,range,rangeid}=params,workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return;const unitId=workbook.getUnitId();if(rangeid){const item=this._definedNamesService.getValueById(unitId,rangeid);if(!item)return;const{formulaOrRefString}=item,worksheet=this._definedNamesService.getWorksheetByRef(unitId,formulaOrRefString);if(!worksheet){this._messageService.show({content:this._localeService.t("hyperLink.message.refError"),type:design.MessageType.Error});return}if(worksheet.isSheetHidden()){this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:design.MessageType.Error});return}this.navigateToDefineName(unitId,rangeid)}if(gid){if(range){const rangeInfo=engineFormula.deserializeRangeWithSheet(range);core.isValidRange(rangeInfo.range)&&range!==sheetsHyperLink.ERROR_RANGE&&this.navigateToRange(unitId,gid,rangeInfo.range);return}this.navigateToSheetById(unitId,gid)}}buildHyperLink(unitId,sheetId,range){return`#${sheetsHyperLink.SheetHyperLinkType.SHEET}=${sheetId}${range?`&${typeof range=="string"?sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME:sheetsHyperLink.SheetHyperLinkType.RANGE}=${typeof range=="string"?range:engineFormula.serializeRange(range)}`:""}`}parseHyperLink(urlStr){var _a15,_b,_c,_d;if(urlStr.startsWith("#")){const search=new URLSearchParams(urlStr.slice(1)),searchObj={gid:(_a15=search.get("gid"))!=null?_a15:"",range:(_b=search.get("range"))!=null?_b:"",rangeid:(_c=search.get("rangeid"))!=null?_c:"",unitid:(_d=search.get("unitid"))!=null?_d:""},urlInfo=this._getURLName(searchObj);return{type:urlInfo.type,name:urlInfo.name,url:urlStr,searchObj,handler:__name(()=>{this.navigateTo(searchObj)},"handler")}}else return{type:sheetsHyperLink.SheetHyperLinkType.URL,name:urlStr,url:urlStr,handler:__name(()=>{this.navigateToOtherWebsite(urlStr)},"handler"),searchObj:null}}async navigateToRange(unitId,subUnitId,range){const worksheet=await this.navigateToSheetById(unitId,subUnitId);if(worksheet){const realRange=getContainRange(range,worksheet);await this._commandService.executeCommand(sheets.SetSelectionsOperation.id,{unitId,subUnitId,selections:[{range:realRange}]}),await this._commandService.executeCommand(sheetsUi.ScrollToRangeOperation.id,{range:realRange})}}async navigateToSheet(unitId,sheetName){const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return!1;const worksheet=workbook.getActiveSheet();if((worksheet==null?void 0:worksheet.getName())===sheetName)return!0;const targetSheet=workbook.getSheetBySheetName(sheetName);if(!targetSheet){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:design.MessageType.Error});return}const sheetId=targetSheet.getSheetId();return workbook.getHiddenWorksheets().indexOf(sheetId)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:design.MessageType.Error}),await this._commandService.executeCommand(sheets.SetWorksheetActiveOperation.id,{unitId,subUnitId:sheetId})}async navigateToSheetById(unitId,subUnitId){const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return!1;const worksheet=workbook.getActiveSheet();if(!worksheet)return!1;if(worksheet.getSheetId()===subUnitId)return worksheet;const targetSheet=workbook.getSheetBySheetId(subUnitId);return targetSheet?workbook.getHiddenWorksheets().indexOf(subUnitId)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:design.MessageType.Error}),!1):await this._commandService.executeCommand(sheets.SetWorksheetActiveOperation.id,{unitId,subUnitId})?targetSheet:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:design.MessageType.Error}),!1)}async navigateToDefineName(unitId,rangeid){return this._definedNamesService.focusRange(unitId,rangeid),!0}async navigateToOtherWebsite(url){var _a15;const config=this._configService.getConfig(PLUGIN_CONFIG_KEY);if((_a15=config==null?void 0:config.urlHandler)!=null&&_a15.navigateToOtherWebsite)return config.urlHandler.navigateToOtherWebsite(url);window.open(url,"_blank","noopener noreferrer")}},__name(_a,"SheetsHyperLinkResolverService"),_a);exports.SheetsHyperLinkResolverService=__decorateClass$c([__decorateParam$c(0,core.IUniverInstanceService),__decorateParam$c(1,core.ICommandService),__decorateParam$c(2,engineFormula.IDefinedNamesService),__decorateParam$c(3,ui.IMessageService),__decorateParam$c(4,core.Inject(core.LocaleService)),__decorateParam$c(5,core.IConfigService)],exports.SheetsHyperLinkResolverService);const SHEET_HYPER_LINK_UI_PLUGIN="SHEET_HYPER_LINK_UI_PLUGIN";var __defProp$b=Object.defineProperty,__getOwnPropDesc$b=Object.getOwnPropertyDescriptor,__decorateClass$b=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$b(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$b(target,key,result),result},"__decorateClass$b"),__decorateParam$b=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$b"),_a2;exports.SheetsHyperLinkCopyPasteController=(_a2=class extends core.Disposable{constructor(_sheetClipboardService,_hyperLinkModel,_injector,_resolverService){super();__publicField(this,"_plainTextFilter",new Set);__publicField(this,"_copyInfo");this._sheetClipboardService=_sheetClipboardService,this._hyperLinkModel=_hyperLinkModel,this._injector=_injector,this._resolverService=_resolverService,this._initCopyPaste(),this.disposeWithMe(()=>{this._plainTextFilter.clear()})}registerPlainTextFilter(filter){this._plainTextFilter.add(filter)}removePlainTextFilter(filter){this._plainTextFilter.delete(filter)}_filterPlainText(text){return Array.from(this._plainTextFilter).every(filter=>filter(text))}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:SHEET_HYPER_LINK_UI_PLUGIN,onBeforeCopy:__name((unitId,subUnitId,range)=>this._collect(unitId,subUnitId,range),"onBeforeCopy"),onPasteCells:__name((pasteFrom,pasteTo,data,payload)=>{const{copyType=sheetsUi.COPY_TYPE.COPY,pasteType}=payload,{range:copyRange}=pasteFrom||{},{range:pastedRange,unitId,subUnitId}=pasteTo;return this._generateMutations(pastedRange,{copyType,pasteType,copyRange,unitId,subUnitId})},"onPasteCells"),onPastePlainText:__name((pasteTo,clipText)=>{const filterResult=this._filterPlainText(clipText);if(isLegalLink(clipText)&&filterResult){const{range,unitId,subUnitId}=pasteTo,{ranges:[pasteToRange],mapFunc}=sheetsUi.virtualizeDiscreteRanges([range]),redos=[],undos=[];return core.Range.foreach(pasteToRange,(originRow,originCol)=>{const{row,col:column}=mapFunc(originRow,originCol),link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,column);link&&redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:link.id}}),link&&undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link}})}),{redos,undos}}return{undos:[],redos:[]}},"onPastePlainText"),priority:99})}_collect(unitId,subUnitId,range){const matrix=new core.ObjectMatrix;this._copyInfo={unitId,subUnitId,matrix};const discreteRange=this._injector.invoke(accessor=>sheetsUi.rangeToDiscreteRange(range,accessor,unitId,subUnitId));if(!discreteRange)return;const{rows,cols}=discreteRange;rows.forEach((row,rowIndex)=>{cols.forEach((col,colIndex)=>{var _a15;const link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,col);matrix.setValue(rowIndex,colIndex,(_a15=link==null?void 0:link.id)!=null?_a15:"")})})}_generateMutations(pastedRange,copyInfo){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!copyInfo.copyRange)return{redos:[],undos:[]};if([sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(copyInfo.pasteType))return{redos:[],undos:[]};const{unitId,subUnitId}=this._copyInfo,redos=[],undos=[],{ranges:[vCopyRange,vPastedRange],mapFunc}=sheetsUi.virtualizeDiscreteRanges([copyInfo.copyRange,pastedRange]);return sheetsUi.getRepeatRange(vCopyRange,vPastedRange,!0).forEach(({startRange})=>{var _a15;(_a15=this._copyInfo)==null||_a15.matrix.forValue((row,col,ruleId)=>{const range=core.Rectangle.getPositionRange({startRow:row,endRow:row,startColumn:col,endColumn:col},startRange),oldLink=this._hyperLinkModel.getHyperLink(unitId,subUnitId,ruleId),{row:startRow,col:startColumn}=mapFunc(range.startRow,range.startColumn),currentLink=this._hyperLinkModel.getHyperLinkByLocation(copyInfo.unitId,copyInfo.subUnitId,startRow,startColumn),id=core.Tools.generateRandomId();currentLink&&redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,id:currentLink.id}}),oldLink&&(redos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,link:{...oldLink,id,row:startRow,column:startColumn}}}),undos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,id}})),currentLink&&undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,link:currentLink}})})}),{redos,undos}}},__name(_a2,"SheetsHyperLinkCopyPasteController"),_a2);exports.SheetsHyperLinkCopyPasteController=__decorateClass$b([__decorateParam$b(0,sheetsUi.ISheetClipboardService),__decorateParam$b(1,core.Inject(sheetsHyperLink.HyperLinkModel)),__decorateParam$b(2,core.Inject(core.Injector)),__decorateParam$b(3,core.Inject(exports.SheetsHyperLinkResolverService))],exports.SheetsHyperLinkCopyPasteController);var HyperLinkEditSourceType=(HyperLinkEditSourceType2=>(HyperLinkEditSourceType2.EDITING="editing",HyperLinkEditSourceType2.VIEWING="viewing",HyperLinkEditSourceType2.ZEN_EDITOR="zen_mode",HyperLinkEditSourceType2))(HyperLinkEditSourceType||{}),jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q");reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports;const AddHyperLinkCommand={type:core.CommandType.COMMAND,id:"sheets.command.add-hyper-link",async handler(accessor,params){var _a15;if(!params)return!1;const commandService=accessor.get(core.ICommandService),undoRedoService=accessor.get(core.IUndoRedoService),renderManagerService=accessor.get(engineRender.IRenderManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),hyperLinkModel=accessor.get(sheetsHyperLink.HyperLinkModel),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),{unitId,subUnitId,link}=params,workbook=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),currentRender=renderManagerService.getRenderById(unitId);if(!currentRender||!workbook)return!1;const worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId),skeleton=(_a15=currentRender.with(sheetsUi.SheetSkeletonManagerService).getCurrent())==null?void 0:_a15.skeleton;if(!worksheet||!skeleton)return!1;const{payload,display,row,column,id}=link,cellData=worksheet.getCell(row,column),doc=skeleton.getBlankCellDocumentModel(cellData),snapshot=doc.documentModel.getSnapshot(),body=core.Tools.deepClone(snapshot.body);if(!body)return!1;let textX;if(display?textX=core.BuildTextUtils.selection.replace({selection:{startOffset:0,endOffset:body.dataStream.length-2,collapsed:!0},body:{dataStream:`${core.DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${core.DataStreamTreeTokenType.CUSTOM_RANGE_END}`,customRanges:[{startIndex:0,endIndex:display.length+1,rangeType:core.CustomRangeType.HYPERLINK,rangeId:id,properties:{url:payload}}]},doc:doc.documentModel}):textX=core.BuildTextUtils.customRange.add({body,range:{startOffset:0,endOffset:body.dataStream.length-2,collapsed:!1},rangeId:id,rangeType:core.CustomRangeType.HYPERLINK,properties:{url:payload,refId:id}}),!textX)return!1;const newBody=core.TextX.apply(body,textX.serialize()),newCellData={p:{...snapshot,body:newBody},t:core.CellValueType.STRING},finalCellData=await editorBridgeService.beforeSetRangeValue(workbook,worksheet,row,column,newCellData),redoParams={unitId,subUnitId,cellValue:{[link.row]:{[link.column]:finalCellData}}},redo={id:sheets.SetRangeValuesMutation.id,params:redoParams},undoParams=sheets.SetRangeValuesUndoMutationFactory(accessor,redoParams),undo={id:sheets.SetRangeValuesMutation.id,params:undoParams},redos=[redo],undos=[undo],modelLink=hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,column);return modelLink&&(redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:modelLink.id}}),undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:modelLink}})),await core.sequenceExecuteAsync(redos,commandService)?(undoRedoService.pushUndoRedo({redoMutations:redos,undoMutations:undos,unitID:unitId}),!0):!1}},AddRichHyperLinkCommand={id:"sheets.command.add-rich-hyper-link",type:core.CommandType.COMMAND,handler:__name(async(accessor,params)=>{if(!params)return!1;const{documentId,link}=params,commandService=accessor.get(core.ICommandService),textSelectionService=accessor.get(docs.DocSelectionManagerService),newId=core.generateRandomId(),{payload}=link;if(!textSelectionService.getActiveTextRange())return!1;const replaceSelection=docsUi.addCustomRangeBySelectionFactory(accessor,{unitId:documentId,rangeId:newId,rangeType:core.CustomRangeType.HYPERLINK,properties:{url:payload,refId:newId}});return replaceSelection?commandService.syncExecuteCommand(replaceSelection.id,replaceSelection.params):!1},"handler")},UpdateHyperLinkCommand={type:core.CommandType.COMMAND,id:"sheets.command.update-hyper-link",async handler(accessor,params){var _a15,_b,_c,_d;if(!params)return!1;const commandService=accessor.get(core.ICommandService),undoRedoService=accessor.get(core.IUndoRedoService),renderManagerService=accessor.get(engineRender.IRenderManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),hyperLinkModel=accessor.get(sheetsHyperLink.HyperLinkModel),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),{unitId,subUnitId,payload:link,row,column,id}=params,workbook=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),currentRender=renderManagerService.getRenderById(unitId);if(!currentRender||!workbook)return!1;const worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId),skeleton=(_a15=currentRender.with(sheetsUi.SheetSkeletonManagerService).getCurrent())==null?void 0:_a15.skeleton;if(!worksheet||!skeleton)return!1;const{payload,display=""}=link,cellData=worksheet.getCell(row,column);if(!cellData)return!1;const doc=skeleton.getCellDocumentModelWithFormula(cellData);if(!(doc!=null&&doc.documentModel))return!1;const snapshot=doc.documentModel.getSnapshot(),range=(_c=(_b=snapshot.body)==null?void 0:_b.customRanges)==null?void 0:_c.find(range2=>range2.rangeId===id);if(!range)return!1;const newId=core.generateRandomId(),textRun=(_d=core.getBodySlice(doc.documentModel.getBody(),range.startIndex,range.endIndex+1).textRuns)==null?void 0:_d[0];textRun&&(textRun.ed=display.length+1);const replaceSelection=docsUi.replaceSelectionFactory(accessor,{unitId,body:{dataStream:`${core.DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${core.DataStreamTreeTokenType.CUSTOM_RANGE_END}`,customRanges:[{rangeId:newId,rangeType:core.CustomRangeType.HYPERLINK,startIndex:0,endIndex:display.length+1,properties:{url:payload}}],textRuns:textRun?[textRun]:void 0},selection:{startOffset:range.startIndex,endOffset:range.endIndex+1,collapsed:!1},doc:doc.documentModel});if(!replaceSelection)return!1;const newBody=core.TextX.apply(core.Tools.deepClone(snapshot.body),replaceSelection.textX.serialize()),newCellData={p:{...snapshot,body:newBody},t:core.CellValueType.STRING},finalCellData=await editorBridgeService.beforeSetRangeValue(workbook,worksheet,row,column,newCellData),redo={id:sheets.SetRangeValuesMutation.id,params:{unitId,subUnitId,cellValue:{[row]:{[column]:finalCellData}}}},undoParams=sheets.SetRangeValuesUndoMutationFactory(accessor,redo.params),undo={id:sheets.SetRangeValuesMutation.id,params:undoParams},redos=[redo],undos=[undo],modelLink=hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,column);return modelLink&&(redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:modelLink.id}}),undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:modelLink}})),await core.sequenceExecuteAsync(redos,commandService)?(undoRedoService.pushUndoRedo({redoMutations:redos,undoMutations:undos,unitID:unitId}),!0):!1}},UpdateRichHyperLinkCommand={type:core.CommandType.COMMAND,id:"sheets.command.update-rich-hyper-link",handler:__name((accessor,params)=>{var _a15,_b,_c,_d;if(!params)return!1;const{documentId:unitId,payload,id:rangeId}=params,univerInstanceService=accessor.get(core.IUniverInstanceService),commandService=accessor.get(core.ICommandService),doc=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_DOC);if(!doc)return!1;const range=(_b=(_a15=doc.getBody())==null?void 0:_a15.customRanges)==null?void 0:_b.find(range2=>range2.rangeId===rangeId);if(!range)return!1;const display=(_c=params.payload.display)!=null?_c:"",newId=core.generateRandomId(),textRun=(_d=core.getBodySlice(doc.getBody(),range.startIndex,range.endIndex+1).textRuns)==null?void 0:_d[0];textRun&&(textRun.ed=display.length+1);const replaceSelection=docsUi.replaceSelectionFactory(accessor,{unitId,body:{dataStream:`${core.DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${core.DataStreamTreeTokenType.CUSTOM_RANGE_END}`,customRanges:[{rangeId:newId,rangeType:core.CustomRangeType.HYPERLINK,startIndex:0,endIndex:display.length+1,properties:{url:payload.payload}}],textRuns:textRun?[textRun]:void 0},selection:{startOffset:range.startIndex,endOffset:range.endIndex+1,collapsed:!1},doc});return replaceSelection?commandService.syncExecuteCommand(replaceSelection.id,replaceSelection.params):!1},"handler")},_SheetsHyperLinkSidePanelService=class _SheetsHyperLinkSidePanelService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_customHyperLinks",new Map)}isBuiltInLinkType(type){return type!==sheetsHyperLink.SheetHyperLinkType.URL}getOptions(){return Array.from(this._customHyperLinks.values()).map(({option})=>option)}findCustomHyperLink(link){return Array.from(this._customHyperLinks.values()).find(item=>item.match(link))}registerCustomHyperLink(customHyperLink){this._customHyperLinks.set(customHyperLink.type,customHyperLink)}getCustomHyperLink(type){return this._customHyperLinks.get(type)}removeCustomHyperLink(type){const{_customHyperLinks}=this;_customHyperLinks.delete(type)}dispose(){super.dispose(),this._customHyperLinks.clear()}};__name(_SheetsHyperLinkSidePanelService,"SheetsHyperLinkSidePanelService");let SheetsHyperLinkSidePanelService=_SheetsHyperLinkSidePanelService;const cellLinkEdit="univer-cell-link-edit",cellLinkEditButtons="univer-cell-link-edit-buttons",styles$1={cellLinkEdit,cellLinkEditButtons},CellLinkEdit=__name(()=>{var _a15;const[id,setId]=require$$0.useState(""),[hide,setHide]=require$$0.useState(!1),[display,setDisplay]=require$$0.useState(""),[showLabel,setShowLabel]=require$$0.useState(!0),[type,setType]=require$$0.useState(sheetsHyperLink.SheetHyperLinkType.URL),[payload,setPayload]=require$$0.useState(""),localeService=core.useDependency(core.LocaleService),definedNameService=core.useDependency(engineFormula.IDefinedNamesService),editorBridgeService=core.useDependency(sheetsUi.IEditorBridgeService),univerInstanceService=core.useDependency(core.IUniverInstanceService),popupService=core.useDependency(exports.SheetsHyperLinkPopupService),editing=ui.useObservable(popupService.currentEditing$),resolverService=core.useDependency(exports.SheetsHyperLinkResolverService),commandService=core.useDependency(core.ICommandService),sidePanelService=core.useDependency(SheetsHyperLinkSidePanelService),sidePanelOptions=require$$0.useMemo(()=>sidePanelService.getOptions(),[sidePanelService]),zenZoneService=core.useDependency(ui.IZenZoneService),renderManagerService=core.useDependency(engineRender.IRenderManagerService),markSelectionService=core.useDependency(sheetsUi.IMarkSelectionService),textSelectionService=core.useDependency(docs.DocSelectionManagerService),contextService=core.useDependency(core.IContextService),themeService=core.useDependency(core.ThemeService),docSelectionManagerService=core.useDependency(docs.DocSelectionManagerService),rangeSelectorActionsRef=require$$0.useRef({}),customHyperLinkSidePanel=require$$0.useMemo(()=>{if(!sidePanelService.isBuiltInLinkType(type))return sidePanelService.getCustomHyperLink(type)},[sidePanelService,type]),[showError,setShowError]=require$$0.useState(!1),[isFocusRangeSelector,isFocusRangeSelectorSet]=require$$0.useState(!1),setByPayload=require$$0.useRef(!1),workbook=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),subUnitId=(workbook==null?void 0:workbook.getActiveSheet().getSheetId())||"";require$$0.useEffect(()=>{isFocusRangeSelectorSet(!1)},[subUnitId]),require$$0.useEffect(()=>{var _a16,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,_p,_q,_r;if((editing==null?void 0:editing.row)!==void 0&&editing.col!==void 0){const{label,customRange,row,col}=editing;let link;if(customRange)link={id:(_a16=customRange==null?void 0:customRange.rangeId)!=null?_a16:"",display:label!=null?label:"",payload:(_c=(_b=customRange==null?void 0:customRange.properties)==null?void 0:_b.url)!=null?_c:"",row,column:col};else if(editing.type===HyperLinkEditSourceType.VIEWING){const workbook2=univerInstanceService.getUnit(editing.unitId),worksheet=workbook2==null?void 0:workbook2.getSheetBySheetId(editing.subUnitId),cell=worksheet==null?void 0:worksheet.getCellRaw(editing.row,editing.col),range=(_f=(_e=(_d=cell==null?void 0:cell.p)==null?void 0:_d.body)==null?void 0:_e.customRanges)==null?void 0:_f.find(range2=>{var _a17;return range2.rangeType===core.CustomRangeType.HYPERLINK&&((_a17=range2.properties)==null?void 0:_a17.url)}),cellValue=cell==null?void 0:cell.v;cell&&(!core.BuildTextUtils.transform.isEmptyDocument((_h=(_g=cell.p)==null?void 0:_g.body)==null?void 0:_h.dataStream)||cellValue)&&setShowLabel(!1),link={id:"",display:"",payload:(_j=(_i=range==null?void 0:range.properties)==null?void 0:_i.url)!=null?_j:"",row,column:col}}else{const doc=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC),selection=textSelectionService.getActiveTextRange(),customRange2=selection&&((_m=core.BuildTextUtils.customRange.getCustomRangesInterestsWithRange(selection,(_l=(_k=doc==null?void 0:doc.getBody())==null?void 0:_k.customRanges)!=null?_l:[]))==null?void 0:_m[0]);setShowLabel(!1),link={id:"",display:label!=null?label:"",payload:(_o=(_n=customRange2==null?void 0:customRange2.properties)==null?void 0:_n.url)!=null?_o:"",row,column:col}}setId(link.id);const customLink=sidePanelService.findCustomHyperLink(link);if(customLink){const customLinkInfo=customLink.convert(link);setType(customLinkInfo.type),setPayload(customLinkInfo.payload),setDisplay(customLinkInfo.display);return}setDisplay(link.display);const linkInfo=resolverService.parseHyperLink(link.payload);switch(setType(linkInfo.type===sheetsHyperLink.SheetHyperLinkType.INVALID?sheetsHyperLink.SheetHyperLinkType.RANGE:linkInfo.type),linkInfo.type){case sheetsHyperLink.SheetHyperLinkType.URL:{setPayload(linkInfo.url),linkInfo.url===link.display&&(setByPayload.current=!0);break}case sheetsHyperLink.SheetHyperLinkType.RANGE:{const params=linkInfo.searchObj,sheetName=params.gid&&(_r=(_q=(_p=univerInstanceService.getUnit(editing.unitId))==null?void 0:_p.getSheetBySheetId(params.gid))==null?void 0:_q.getName())!=null?_r:"",payload2=engineFormula.serializeRangeWithSheet(sheetName,engineFormula.deserializeRangeWithSheet(params.range).range);setPayload(payload2),payload2===link.display&&(setByPayload.current=!0);break}case sheetsHyperLink.SheetHyperLinkType.SHEET:{const params=linkInfo.searchObj;setPayload(params.gid);break}case sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME:{const params=linkInfo.searchObj;setPayload(params.rangeid);break}default:setPayload("");break}}},[editing,resolverService,sidePanelService,textSelectionService,univerInstanceService]),require$$0.useEffect(()=>{let id2=null;if(editing&&!editing.customRangeId&&editing.type===HyperLinkEditSourceType.VIEWING&&core.Tools.isDefine(editing.row)&&core.Tools.isDefine(editing.col)){const workbook2=univerInstanceService.getUnit(editing.unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook2==null?void 0:workbook2.getSheetBySheetId(editing.subUnitId),mergeInfo=worksheet==null?void 0:worksheet.getMergedCell(editing.row,editing.col),color=new core.ColorKit(themeService.getCurrentTheme().hyacinth500).toRgb();id2=markSelectionService.addShape({range:mergeInfo!=null?mergeInfo:{startColumn:editing.col,endColumn:editing.col,startRow:editing.row,endRow:editing.row},style:{hasAutoFill:!1,fill:`rgb(${color.r}, ${color.g}, ${color.b}, 0.12)`,strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1)}return()=>{id2&&markSelectionService.removeShape(id2)}},[editing,markSelectionService,themeService,univerInstanceService]);const payloadInitial=require$$0.useMemo(()=>payload,[type]);require$$0.useEffect(()=>{const render2=renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId()),disposeCollection=new core.DisposableCollection;if(render2){const selectionRenderService=render2.with(docsUi.DocSelectionRenderService);selectionRenderService.setReserveRangesStatus(!0),disposeCollection.add(()=>{selectionRenderService.setReserveRangesStatus(!1)})}return()=>{editorBridgeService.disableForceKeepVisible(),disposeCollection.dispose()}},[editorBridgeService,renderManagerService]),require$$0.useEffect(()=>(popupService.setIsKeepVisible(type===sheetsHyperLink.SheetHyperLinkType.RANGE),()=>{popupService.setIsKeepVisible(!1)}),[type]),require$$0.useEffect(()=>()=>{zenZoneService.temporaryHidden&&(zenZoneService.show(),contextService.setContextValue(core.FOCUSING_SHEET,!1))},[contextService,zenZoneService]);const linkTypeOptions=[{label:localeService.t("hyperLink.form.link"),value:sheetsHyperLink.SheetHyperLinkType.URL},{label:localeService.t("hyperLink.form.range"),value:sheetsHyperLink.SheetHyperLinkType.RANGE},{label:localeService.t("hyperLink.form.worksheet"),value:sheetsHyperLink.SheetHyperLinkType.SHEET},{label:localeService.t("hyperLink.form.definedName"),value:sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME},...sidePanelOptions];if(!workbook)return;const hiddens=workbook.getHiddenWorksheets(),sheetsOption=workbook.getSheets().map(sheet=>({label:sheet.getName(),value:sheet.getSheetId()})).filter(opt=>hiddens.indexOf(opt.value)===-1),definedNames=Object.values((_a15=definedNameService.getDefinedNameMap(workbook.getUnitId()))!=null?_a15:{}).map(value=>({label:value.name,value:value.id})),formatUrl=__name((type2,payload2)=>{if(type2===sheetsHyperLink.SheetHyperLinkType.URL)return serializeUrl(payload2);if(type2===sheetsHyperLink.SheetHyperLinkType.RANGE){const info=engineFormula.deserializeRangeWithSheet(payload2),worksheet=workbook.getSheetBySheetName(info.sheetName);if(worksheet)return`#gid=${worksheet.getSheetId()}&range=${engineFormula.serializeRange(info.range)}`}return`#${type2}=${payload2}`},"formatUrl"),handleRangeChange=ui.useEvent(rangeText=>{var _a16;const range=rangeText.split(",").map(engineFormula.deserializeRangeWithSheet)[0];if(!range||!core.isValidRange(range.range))return;range.sheetName||(range.sheetName=((_a16=workbook.getActiveSheet())==null?void 0:_a16.getName())||"");const newPayload=engineFormula.serializeRangeToRefString(range);setPayload(newPayload),newPayload&&(setByPayload.current||!display)&&(setDisplay(newPayload),setByPayload.current=!0)}),handleSubmit=__name(async()=>{if(showLabel&&!display||!payload||type===sheetsHyperLink.SheetHyperLinkType.URL&&!isLegalLink(payload)){setShowError(!0);return}if(editing)if(id){const commandId=editing.type===HyperLinkEditSourceType.ZEN_EDITOR||editing.type===HyperLinkEditSourceType.EDITING?UpdateRichHyperLinkCommand.id:UpdateHyperLinkCommand.id;await commandService.executeCommand(commandId,{id,unitId:editing.unitId,subUnitId:editing.subUnitId,payload:{display:showLabel?display:"",payload:formatUrl(type,payload)},row:editing.row,column:editing.col,documentId:editing.type===HyperLinkEditSourceType.ZEN_EDITOR?core.DOCS_ZEN_EDITOR_UNIT_ID_KEY:editorBridgeService.getCurrentEditorId()})}else{const commandId=editing.type===HyperLinkEditSourceType.ZEN_EDITOR||editing.type===HyperLinkEditSourceType.EDITING?AddRichHyperLinkCommand.id:AddHyperLinkCommand.id;await commandService.executeCommand(commandId,{unitId:editing.unitId,subUnitId:editing.subUnitId,link:{id:core.generateRandomId(),row:editing.row,column:editing.col,payload:formatUrl(type,payload),display:showLabel?display:""},documentId:editing.type===HyperLinkEditSourceType.ZEN_EDITOR?core.DOCS_ZEN_EDITOR_UNIT_ID_KEY:editorBridgeService.getCurrentEditorId()})}if((editing==null?void 0:editing.type)===HyperLinkEditSourceType.VIEWING){await commandService.executeCommand(sheets.SetWorksheetActiveOperation.id,{unitId:editing.unitId,subUnitId:editing.subUnitId});const GAP=1;await commandService.executeCommand(sheetsUi.ScrollToRangeOperation.id,{range:{startRow:Math.max(editing.row-GAP,0),endRow:editing.row+GAP,startColumn:Math.max(editing.col-GAP,0),endColumn:editing.col+GAP}})}commandService.executeCommand(CloseHyperLinkPopupOperation.id)},"handleSubmit"),handlePanelClick=__name(e=>{var _a16;if(type!==sheetsHyperLink.SheetHyperLinkType.RANGE)return;const handleOutClick=(_a16=rangeSelectorActionsRef.current)==null?void 0:_a16.handleOutClick;handleOutClick&&handleOutClick(e,isFocusRangeSelectorSet)},"handlePanelClick");return editing?jsxRuntimeExports.jsxs("div",{className:styles$1.cellLinkEdit,style:{display:hide?"none":"block"},onClick:handlePanelClick,children:[showLabel?jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("hyperLink.form.label"),error:showError&&!display?localeService.t("hyperLink.form.inputError"):"",children:jsxRuntimeExports.jsx(design.Input,{value:display,onChange:__name(v=>{setDisplay(v),setByPayload.current=!1},"onChange"),placeholder:localeService.t("hyperLink.form.labelPlaceholder"),autoFocus:!0,onKeyDown:__name(e=>{e.keyCode===ui.KeyCode.ENTER&&handleSubmit()},"onKeyDown")})}):null,jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("hyperLink.form.type"),contentStyle:{marginBottom:0},children:jsxRuntimeExports.jsx(design.Select,{options:linkTypeOptions,value:type,onChange:__name(newType=>{setType(newType),setPayload("")},"onChange")})}),type===sheetsHyperLink.SheetHyperLinkType.URL&&jsxRuntimeExports.jsx(design.FormLayout,{error:showError?payload?isLegalLink(payload)?"":localeService.t("hyperLink.form.linkError"):localeService.t("hyperLink.form.inputError"):"",children:jsxRuntimeExports.jsx(design.Input,{value:payload,onChange:__name(newLink=>{setPayload(newLink),newLink&&(setByPayload.current||!display||display===payload)&&(setDisplay(newLink),setByPayload.current=!0)},"onChange"),placeholder:localeService.t("hyperLink.form.linkPlaceholder"),autoFocus:!showLabel,onKeyDown:__name(e=>{e.keyCode===ui.KeyCode.ENTER&&handleSubmit()},"onKeyDown")})}),type===sheetsHyperLink.SheetHyperLinkType.RANGE&&jsxRuntimeExports.jsx(design.FormLayout,{error:showError&&!payload?localeService.t("hyperLink.form.inputError"):"",children:jsxRuntimeExports.jsx(sheetsFormulaUi.RangeSelector,{unitId:workbook.getUnitId(),subUnitId,isOnlyOneRange:!0,isSupportAcrossSheet:!0,initValue:payloadInitial,onChange:handleRangeChange,isFocus:isFocusRangeSelector,onBlur:__name(()=>{isFocusRangeSelectorSet(!1)},"onBlur"),actions:rangeSelectorActionsRef.current,onRangeSelectorDialogVisibleChange:__name(async visible=>{var _a16,_b;if(visible)editing.type===HyperLinkEditSourceType.ZEN_EDITOR&&(zenZoneService.hide(),contextService.setContextValue(core.FOCUSING_SHEET,!0)),editing.type!==HyperLinkEditSourceType.VIEWING&&editorBridgeService.enableForceKeepVisible(),setHide(!0);else{if(await resolverService.navigateToRange(editing.unitId,editing.subUnitId,{startRow:editing.row,endRow:editing.row,startColumn:editing.col,endColumn:editing.col}),editing.type===HyperLinkEditSourceType.ZEN_EDITOR){await commandService.executeCommand(sheets.SetSelectionsOperation.id,{unitId:editing.unitId,subUnitId:editing.subUnitId,selections:[{range:{startRow:editing.row,endRow:editing.row,startColumn:editing.col,endColumn:editing.col}}]}),zenZoneService.show(),contextService.setContextValue(core.FOCUSING_SHEET,!1);const docBackScrollRenderController=(_a16=renderManagerService.getRenderById(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:_a16.with(docsUi.DocBackScrollRenderController),range=(_b=docSelectionManagerService.getTextRanges({unitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))==null?void 0:_b[0];docBackScrollRenderController&&range&&setTimeout(()=>{docBackScrollRenderController.scrollToRange(range),docSelectionManagerService.refreshSelection({unitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY})},100)}editorBridgeService.disableForceKeepVisible(),setHide(!1)}},"onRangeSelectorDialogVisibleChange")})}),type===sheetsHyperLink.SheetHyperLinkType.SHEET&&jsxRuntimeExports.jsx(design.FormLayout,{error:showError&&!payload?localeService.t("hyperLink.form.selectError"):"",children:jsxRuntimeExports.jsx(design.Select,{options:sheetsOption,value:payload,onChange:__name(newPayload=>{var _a16,_b;setPayload(newPayload);const label=(_a16=sheetsOption.find(i=>i.value===newPayload))==null?void 0:_a16.label,oldLabel=(_b=sheetsOption.find(i=>i.value===payload))==null?void 0:_b.label;label&&(setByPayload.current||!display||display===oldLabel)&&(setDisplay(label),setByPayload.current=!0)},"onChange")})}),type===sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME&&jsxRuntimeExports.jsx(design.FormLayout,{error:showError&&!payload?localeService.t("hyperLink.form.selectError"):"",children:jsxRuntimeExports.jsx(design.Select,{options:definedNames,value:payload,onChange:__name(newValue=>{var _a16,_b;setPayload(newValue);const label=(_a16=definedNames.find(i=>i.value===newValue))==null?void 0:_a16.label,oldLabel=(_b=definedNames.find(i=>i.value===payload))==null?void 0:_b.label;label&&(setByPayload.current||!display||display===oldLabel)&&(setDisplay(label),setByPayload.current=!0)},"onChange")})}),(customHyperLinkSidePanel==null?void 0:customHyperLinkSidePanel.Form)&&jsxRuntimeExports.jsx(customHyperLinkSidePanel.Form,{linkId:id,payload,display,showError,setByPayload,setDisplay:__name(newLink=>{setDisplay(newLink),setByPayload.current=!0},"setDisplay"),setPayload}),jsxRuntimeExports.jsxs("div",{className:styles$1.cellLinkEditButtons,children:[jsxRuntimeExports.jsx(design.Button,{onClick:__name(()=>{editing&&resolverService.navigateToRange(editing.unitId,editing.subUnitId,{startRow:editing.row,endRow:editing.row,startColumn:editing.col,endColumn:editing.col}),commandService.executeCommand(CloseHyperLinkPopupOperation.id)},"onClick"),children:localeService.t("hyperLink.form.cancel")}),jsxRuntimeExports.jsx(design.Button,{type:"primary",style:{marginLeft:8},onClick:__name(async()=>{handleSubmit()},"onClick"),children:localeService.t("hyperLink.form.ok")})]})]}):null},"CellLinkEdit");CellLinkEdit.componentKey="univer.sheet.cell-link-edit";var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a15){var key=_a15[0],value=_a15[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a15,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a15=node.children)===null||_a15===void 0)&&_a15.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$5={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"}}]},AllBorderSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"all-border-single",ref,icon:element$5}))});AllBorderSingle.displayName="AllBorderSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CopySingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"copy-single",ref,icon:element$4}))});CopySingle.displayName="CopySingle";var element$3={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"}}]},LinkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"link-single",ref,icon:element$3}))});LinkSingle.displayName="LinkSingle";var element$2={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"}}]},UnlinkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"unlink-single",ref,icon:element$2}))});UnlinkSingle.displayName="UnlinkSingle";var element$1={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"}}]},WriteSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"write-single",ref,icon:element$1}))});WriteSingle.displayName="WriteSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.4535 1.12549C2.7002 1.12549 2.08954 1.73615 2.08954 2.48945V13.5104C2.08954 14.2637 2.7002 14.8744 3.4535 14.8744H12.5465C13.2998 14.8744 13.9105 14.2637 13.9105 13.5104V5.0992L10.0091 1.12549H3.4535Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M10.0075 1.12549L13.9104 5.09842H10.6742C10.306 5.09842 10.0075 4.79994 10.0075 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.8088 10.2949L6.3764 12.403C6.26259 12.5705 6.03455 12.614 5.86705 12.5002C5.69955 12.3864 5.65603 12.1584 5.76984 11.9909L7.3655 9.64252L5.94042 7.54519C5.82661 7.37769 5.87013 7.14964 6.03763 7.03583C6.20512 6.92202 6.43317 6.96555 6.54698 7.13304L7.8088 8.9901L9.07062 7.13304C9.18443 6.96555 9.41248 6.92202 9.57997 7.03583C9.74747 7.14964 9.79099 7.37769 9.67718 7.54519L8.2521 9.64252L9.84776 11.9909C9.96157 12.1584 9.91805 12.3864 9.75055 12.5002C9.58305 12.614 9.35501 12.5705 9.2412 12.403L7.8088 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Xlsx=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"xlsx",ref,icon:element}))});Xlsx.displayName="Xlsx";function r(e){var t,f2,n2="";if(typeof e=="string"||typeof e=="number")n2+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f2=r(e[t]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e)e[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx(){for(var e,t,f2=0,n2="",o=arguments.length;f2<o;f2++)(e=arguments[f2])&&(t=r(e))&&(n2&&(n2+=" "),n2+=t);return n2}__name(clsx,"clsx");const CancelHyperLinkCommand={type:core.CommandType.COMMAND,id:"sheets.command.cancel-hyper-link",handler(accessor,params){var _a15,_b,_c;if(!params)return!1;const commandService=accessor.get(core.ICommandService),undoRedoService=accessor.get(core.IUndoRedoService),renderManagerService=accessor.get(engineRender.IRenderManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),hyperLinkModel=accessor.get(sheetsHyperLink.HyperLinkModel),{unitId,subUnitId,row,column,id}=params,workbook=univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),currentRender=renderManagerService.getRenderById(unitId);if(!currentRender||!workbook)return!1;const worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId),skeleton=(_a15=currentRender.with(sheetsUi.SheetSkeletonManagerService).getCurrent())==null?void 0:_a15.skeleton;if(!worksheet||!skeleton)return!1;const cellData=worksheet.getCell(row,column);if(!cellData)return!1;const doc=skeleton.getCellDocumentModelWithFormula(cellData);if(!(doc!=null&&doc.documentModel))return!1;const snapshot=core.Tools.deepClone(doc.documentModel.getSnapshot());if(!((_c=(_b=snapshot.body)==null?void 0:_b.customRanges)==null?void 0:_c.find(range2=>range2.rangeId===id)))return!1;const textX=core.BuildTextUtils.customRange.delete(accessor,{documentDataModel:doc.documentModel,rangeId:id});if(!textX)return!1;const newBody=core.TextX.apply(snapshot.body,textX.serialize()),redos=[],undos=[],setRangeParams={unitId,subUnitId,cellValue:{[row]:{[column]:{p:{...snapshot,body:newBody},t:core.CellValueType.STRING}}}};redos.push({id:sheets.SetRangeValuesMutation.id,params:setRangeParams});const undoParams=sheets.SetRangeValuesUndoMutationFactory(accessor,setRangeParams);undos.push({id:sheets.SetRangeValuesMutation.id,params:undoParams});const link=hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,column);return link&&(redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id}}),undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:{...link}}})),core.sequenceExecute(redos,commandService).result?(undoRedoService.pushUndoRedo({redoMutations:redos,undoMutations:undos,unitID:unitId}),!0):!1}},CancelRichHyperLinkCommand={type:core.CommandType.COMMAND,id:"sheets.command.cancel-rich-hyper-link",handler(accessor,params){var _a15,_b;if(!params)return!1;const{id:linkId,documentId}=params,commandService=accessor.get(core.ICommandService),doc=accessor.get(core.IUniverInstanceService).getUnit(documentId,core.UniverInstanceType.UNIVER_DOC),link=(_b=(_a15=doc==null?void 0:doc.getBody())==null?void 0:_a15.customRanges)==null?void 0:_b.find(i=>i.rangeId===linkId);let insert=null;link&&link.endIndex===doc.getBody().dataStream.length-3&&(insert={dataStream:" "});const doMutation=docsUi.deleteCustomRangeFactory(accessor,{unitId:documentId,rangeId:linkId,insert});return doMutation?commandService.syncExecuteCommand(doMutation.id,doMutation.params):!1}},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",styles={cellLink,cellLinkType,cellLinkContent,cellLinkContentError,cellLinkUrl,cellLinkOperations,cellLinkOperation,cellLinkOperationError},iconsMap={[sheetsHyperLink.SheetHyperLinkType.URL]:jsxRuntimeExports.jsx(LinkSingle,{}),[sheetsHyperLink.SheetHyperLinkType.SHEET]:jsxRuntimeExports.jsx(Xlsx,{}),[sheetsHyperLink.SheetHyperLinkType.RANGE]:jsxRuntimeExports.jsx(AllBorderSingle,{}),[sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME]:jsxRuntimeExports.jsx(AllBorderSingle,{}),[sheetsHyperLink.SheetHyperLinkType.INVALID]:jsxRuntimeExports.jsx(AllBorderSingle,{})},CellLinkPopup=__name(()=>{var _a15,_b;const popupService=core.useDependency(exports.SheetsHyperLinkPopupService),commandService=core.useDependency(core.ICommandService),messageService=core.useDependency(ui.IMessageService),localeService=core.useDependency(core.LocaleService),[currentPopup,setCurrentPopup]=require$$0.useState(null),resolverService=core.useDependency(exports.SheetsHyperLinkResolverService),editorBridgeService=core.useDependency(sheetsUi.IEditorBridgeService),zenZoneService=core.useDependency(ui.IZenZoneService);if(core.useObservable(zenZoneService.visible$),require$$0.useEffect(()=>{setCurrentPopup(popupService.currentPopup);const ob=popupService.currentPopup$.subscribe(popup=>{setCurrentPopup(popup)});return()=>{ob.unsubscribe()}},[popupService.currentPopup,popupService.currentPopup$]),!currentPopup)return null;const{unitId,subUnitId,customRange,row,col}=currentPopup;if(!((_a15=customRange==null?void 0:customRange.properties)!=null&&_a15.url))return null;const linkObj=resolverService.parseHyperLink((_b=customRange.properties.url)!=null?_b:""),isError=linkObj.type===sheetsHyperLink.SheetHyperLinkType.INVALID;return jsxRuntimeExports.jsxs("div",{className:styles.cellLink,onClick:__name(()=>popupService.hideCurrentPopup(),"onClick"),children:[jsxRuntimeExports.jsxs("div",{className:clsx(styles.cellLinkContent,{[styles.cellLinkContentError]:isError}),onClick:__name(()=>{zenZoneService.visible||linkObj.handler()},"onClick"),children:[jsxRuntimeExports.jsx("div",{className:styles.cellLinkType,children:iconsMap[linkObj.type]}),jsxRuntimeExports.jsx(design.Tooltip,{showIfEllipsis:!0,title:linkObj.name,children:jsxRuntimeExports.jsx("span",{className:styles.cellLinkUrl,children:linkObj.name})})]}),jsxRuntimeExports.jsxs("div",{className:styles.cellLinkOperations,children:[currentPopup.copyPermission&&jsxRuntimeExports.jsx("div",{className:clsx(styles.cellLinkOperation,{[styles.cellLinkOperationError]:isError}),onClick:__name(()=>{if(!isError){if(linkObj.type!==sheetsHyperLink.SheetHyperLinkType.URL){const url=new URL(window.location.href);url.hash=linkObj.url.slice(1),navigator.clipboard.writeText(url.href)}else navigator.clipboard.writeText(linkObj.url);messageService.show({content:localeService.t("hyperLink.message.coped"),type:design.MessageType.Info})}},"onClick"),children:jsxRuntimeExports.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("hyperLink.popup.copy"),children:jsxRuntimeExports.jsx(CopySingle,{})})}),currentPopup.editPermission&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:styles.cellLinkOperation,onClick:__name(()=>{commandService.executeCommand(OpenHyperLinkEditPanelOperation.id,{unitId,subUnitId,row,col,customRangeId:customRange.rangeId,type:currentPopup.type})},"onClick"),children:jsxRuntimeExports.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("hyperLink.popup.edit"),children:jsxRuntimeExports.jsx(WriteSingle,{})})}),jsxRuntimeExports.jsx("div",{className:styles.cellLinkOperation,onClick:__name(()=>{const commandId=currentPopup.type===HyperLinkEditSourceType.EDITING||currentPopup.type===HyperLinkEditSourceType.ZEN_EDITOR?CancelRichHyperLinkCommand.id:CancelHyperLinkCommand.id;commandService.syncExecuteCommand(commandId,{unitId,subUnitId,id:customRange.rangeId,row,column:col,documentId:currentPopup.type===HyperLinkEditSourceType.ZEN_EDITOR?core.DOCS_ZEN_EDITOR_UNIT_ID_KEY:editorBridgeService.getCurrentEditorId()})&&popupService.hideCurrentPopup(void 0,!0)},"onClick"),children:jsxRuntimeExports.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("hyperLink.popup.cancel"),children:jsxRuntimeExports.jsx(UnlinkSingle,{})})})]})]})]})},"CellLinkPopup");CellLinkPopup.componentKey="univer.sheet.cell-link-popup";var __defProp$a=Object.defineProperty,__getOwnPropDesc$a=Object.getOwnPropertyDescriptor,__decorateClass$a=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$a(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$a(target,key,result),result},"__decorateClass$a"),__decorateParam$a=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$a");const isEqualLink=__name((a,b)=>{var _a15,_b;return a.unitId===b.unitId&&a.subUnitId===b.subUnitId&&a.row===b.row&&a.col===b.col&&((_a15=a.customRange)==null?void 0:_a15.rangeId)===((_b=b.customRange)==null?void 0:_b.rangeId)&&a.type===b.type},"isEqualLink");var _a3;exports.SheetsHyperLinkPopupService=(_a3=class extends core.Disposable{constructor(_sheetCanvasPopManagerService,_injector,_univerInstanceService,_editorBridgeService,_textSelectionManagerService,_docCanvasPopManagerService,_editorService,_rangeSelectorService,_zenZoneService){super();__publicField(this,"_currentPopup",null);__publicField(this,"_currentPopup$",new rxjs.Subject);__publicField(this,"currentPopup$",this._currentPopup$.asObservable());__publicField(this,"_currentEditingPopup",null);__publicField(this,"_currentEditing$",new rxjs.BehaviorSubject(null));__publicField(this,"currentEditing$",this._currentEditing$.asObservable());__publicField(this,"_isKeepVisible",!1);this._sheetCanvasPopManagerService=_sheetCanvasPopManagerService,this._injector=_injector,this._univerInstanceService=_univerInstanceService,this._editorBridgeService=_editorBridgeService,this._textSelectionManagerService=_textSelectionManagerService,this._docCanvasPopManagerService=_docCanvasPopManagerService,this._editorService=_editorService,this._rangeSelectorService=_rangeSelectorService,this._zenZoneService=_zenZoneService,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}setIsKeepVisible(v){this._isKeepVisible=v}getIsKeepVisible(){return this._isKeepVisible}showPopup(location2){if(this._currentPopup&&isEqualLink(location2,this._currentPopup)||(this.hideCurrentPopup(void 0,!0),location2.type!==HyperLinkEditSourceType.ZEN_EDITOR&&this._zenZoneService.visible))return;const currentEditing=this._currentEditing$.getValue();if(currentEditing&&isEqualLink(location2,currentEditing))return;const{unitId,subUnitId,row,col,customRangeRect,customRange}=location2;if(!customRange)return;let disposable;const popup={componentKey:CellLinkPopup.componentKey,direction:"bottom",onClickOutside:__name(()=>{this.hideCurrentPopup()},"onClickOutside"),onClick:__name(()=>{this.hideCurrentPopup(location2.type,!0)},"onClick")};location2.type===HyperLinkEditSourceType.EDITING?disposable=customRangeRect&&this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(customRangeRect,popup):location2.type===HyperLinkEditSourceType.ZEN_EDITOR?disposable=this._docCanvasPopManagerService.attachPopupToRange({startOffset:customRange.startIndex,endOffset:customRange.endIndex+1,collapsed:!1},popup,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY):disposable=customRangeRect&&this._sheetCanvasPopManagerService.attachPopupByPosition(customRangeRect,popup),disposable&&(this._currentPopup={unitId,subUnitId,disposable,row,col,editPermission:!!location2.editPermission,copyPermission:!!location2.copyPermission,customRange,type:location2.type},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(type,force){var _a15,_b;this._currentPopup&&((!type||type===this._currentPopup.type)&&this._currentPopup.disposable.canDispose()||force)&&((_b=(_a15=this._currentPopup)==null?void 0:_a15.disposable)==null||_b.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}_getEditingRange(){var _a15,_b,_c;const visible=this._editorBridgeService.isVisible().visible,state=this._editorBridgeService.getEditCellState();if(visible&&state){const textRange=this._textSelectionManagerService.getActiveTextRange(),body=(_a15=state.documentLayoutObject.documentModel)==null?void 0:_a15.getBody();if(!body)return null;if(!textRange||textRange.collapsed)return{startOffset:0,endOffset:body.dataStream.length-2,collapsed:body.dataStream.length-2===0,label:core.BuildTextUtils.transform.getPlainText(body.dataStream)};const links=core.BuildTextUtils.customRange.getCustomRangesInterestsWithRange(textRange,(_c=(_b=body.customRanges)==null?void 0:_b.filter(i=>i.rangeType===core.CustomRangeType.HYPERLINK))!=null?_c:[]);let start=textRange.startOffset,end=textRange.endOffset;return links.forEach(link=>{start=Math.min(start,link.startIndex),end=Math.max(end,link.endIndex+1)}),{startOffset:start,endOffset:end,collapsed:start===end,label:core.BuildTextUtils.transform.getPlainText(body.dataStream.slice(start,end))}}return null}get _editPopup(){return{componentKey:CellLinkEdit.componentKey,direction:"bottom",onClickOutside:__name(()=>{this.getIsKeepVisible()||this.endEditing()},"onClickOutside"),onContextMenu:__name(()=>{this.getIsKeepVisible()||this.endEditing()},"onContextMenu"),hiddenType:"hide"}}startAddEditing(link){var _a15,_b,_c,_d,_e;const{unitId,subUnitId,type}=link;if(type===HyperLinkEditSourceType.ZEN_EDITOR){const document=this._univerInstanceService.getUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,core.UniverInstanceType.UNIVER_DOC);if(!document)return;const range=this._textSelectionManagerService.getActiveTextRange();if(!range)return;this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange(range,this._editPopup,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const label=(_a15=document.getBody())==null?void 0:_a15.dataStream.slice(range.startOffset,range.endOffset-1);this._currentEditing$.next({...link,label})}else if(type===HyperLinkEditSourceType.EDITING){const range=this._getEditingRange();range&&this._textSelectionManagerService.replaceTextRanges([{...range}]),this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(link.row,link.col,this._editPopup,unitId,subUnitId),this._currentEditing$.next({...link,label:(_b=range==null?void 0:range.label)!=null?_b:""})}else{this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(link.row,link.col,this._editPopup,unitId,subUnitId);const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId),cell=worksheet==null?void 0:worksheet.getCellRaw(link.row,link.col);this._currentEditing$.next({...link,label:cell!=null&&cell.p?core.BuildTextUtils.transform.getPlainText((_d=(_c=cell.p.body)==null?void 0:_c.dataStream)!=null?_d:""):((_e=cell==null?void 0:cell.v)!=null?_e:"").toString()})}}startEditing(link){var _a15,_b,_c,_d,_e,_f;(_a15=this._currentEditingPopup)==null||_a15.dispose(),this.hideCurrentPopup(void 0,!0);const{unitId,subUnitId}=link;let customRange,label;if(link.type===HyperLinkEditSourceType.ZEN_EDITOR){const document=this._univerInstanceService.getUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,core.UniverInstanceType.UNIVER_DOC);if(customRange=(_c=(_b=document==null?void 0:document.getBody())==null?void 0:_b.customRanges)==null?void 0:_c.find(range=>range.rangeId===link.customRangeId),label=customRange?(_d=document==null?void 0:document.getBody())==null?void 0:_d.dataStream.slice(customRange.startIndex+1,customRange.endIndex):"",!customRange||!label)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:customRange.startIndex,endOffset:customRange.endIndex+1}]),this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange({startOffset:customRange.startIndex,endOffset:customRange.endIndex,collapsed:!1},this._editPopup,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(link.type===HyperLinkEditSourceType.EDITING){const customRangeInfo=sheetsUi.getEditingCustomRangePosition(this._injector,link.unitId,link.subUnitId,link.row,link.col,link.customRangeId);if(!customRangeInfo||!((_e=customRangeInfo.rects)!=null&&_e.length))return;customRange=customRangeInfo.customRange,label=customRangeInfo.label,this._textSelectionManagerService.replaceTextRanges([{startOffset:customRange.startIndex,endOffset:customRange.endIndex+1}]),this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(customRangeInfo.rects.pop(),this._editPopup,unitId,subUnitId)}else{const customRangeInfo=sheetsUi.getCustomRangePosition(this._injector,link.unitId,link.subUnitId,link.row,link.col,link.customRangeId);if(!customRangeInfo||!((_f=customRangeInfo.rects)!=null&&_f.length))return;customRange=customRangeInfo.customRange,label=customRangeInfo.label,this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupByPosition(customRangeInfo.rects.pop(),this._editPopup,unitId,subUnitId)}this._currentEditing$.next({...link,customRange,label})}endEditing(type){var _a15;const current=this._currentEditing$.getValue();current&&(!type||type===current.type)&&((_a15=this._currentEditingPopup)==null||_a15.dispose(),this._currentEditing$.next(null))}},__name(_a3,"SheetsHyperLinkPopupService"),_a3);exports.SheetsHyperLinkPopupService=__decorateClass$a([__decorateParam$a(0,core.Inject(sheetsUi.SheetCanvasPopManagerService)),__decorateParam$a(1,core.Inject(core.Injector)),__decorateParam$a(2,core.IUniverInstanceService),__decorateParam$a(3,sheetsUi.IEditorBridgeService),__decorateParam$a(4,core.Inject(docs.DocSelectionManagerService)),__decorateParam$a(5,core.Inject(docsUi.DocCanvasPopManagerService)),__decorateParam$a(6,docsUi.IEditorService),__decorateParam$a(7,docsUi.IRangeSelectorService),__decorateParam$a(8,ui.IZenZoneService)],exports.SheetsHyperLinkPopupService);const getShouldDisableCellLink=__name((worksheet,row,col)=>{const cell=worksheet.getCell(row,col);if(cell!=null&&cell.f||cell!=null&&cell.si)return!0;const disables=[core.DataValidationType.CHECKBOX,core.DataValidationType.LIST,core.DataValidationType.LIST_MULTIPLE];return!!(cell!=null&&cell.dataValidation&&disables.includes(cell.dataValidation.rule.type))},"getShouldDisableCellLink"),getShouldDisableCurrentCellLink=__name(accessor=>{const unit=accessor.get(core.IUniverInstanceService).getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!unit)return!0;const worksheet=unit.getActiveSheet(),selections=accessor.get(sheets.SheetsSelectionsService).getCurrentSelections();if(!selections.length)return!0;const row=selections[0].range.startRow,col=selections[0].range.startColumn;return getShouldDisableCellLink(worksheet,row,col)},"getShouldDisableCurrentCellLink"),shouldDisableAddLink=__name(accessor=>{var _a15;const textSelectionService=accessor.get(docs.DocSelectionManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),textRanges=textSelectionService.getDocRanges();if(!textRanges.length||textRanges.length>1)return!0;const activeRange=textRanges[0],doc=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC);if(!doc||!activeRange||activeRange.collapsed)return!0;const body=doc.getSelfOrHeaderFooterModel(activeRange.segmentId).getBody(),paragraphs=body==null?void 0:body.paragraphs;if(!paragraphs)return!0;for(let i=0,len=paragraphs.length;i<len;i++){const p2=paragraphs[i];if(activeRange.startOffset<=p2.startIndex&&activeRange.endOffset>p2.startIndex)return!0;if(p2.startIndex>activeRange.endOffset)break}return!core.BuildTextUtils.customRange.getCustomRangesInterestsWithRange(activeRange,(_a15=body.customRanges)!=null?_a15:[]).every(range=>range.rangeType===core.CustomRangeType.HYPERLINK)},"shouldDisableAddLink"),OpenHyperLinkEditPanelOperation={type:core.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-edit-panel",handler(accessor,params){if(!params)return!1;const popupService=accessor.get(exports.SheetsHyperLinkPopupService);return params.customRangeId?popupService.startEditing(params):popupService.startAddEditing(params),!0}},CloseHyperLinkPopupOperation={type:core.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-popup",handler(accessor){return accessor.get(exports.SheetsHyperLinkPopupService).endEditing(),!0}},InsertHyperLinkOperation={type:core.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(accessor){var _a15;const univerInstanceService=accessor.get(core.IUniverInstanceService),target=sheets.getSheetCommandTarget(univerInstanceService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService);if(!target)return!1;const commandService=accessor.get(core.ICommandService),selection=accessor.get(sheets.SheetsSelectionsService).getCurrentLastSelection();if(!selection)return!1;const row=selection.range.startRow,col=selection.range.startColumn,visible=editorBridgeService.isVisible(),isZenEditor=((_a15=univerInstanceService.getFocusedUnit())==null?void 0:_a15.getUnitId())===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY;return commandService.executeCommand(OpenHyperLinkEditPanelOperation.id,{unitId:target.unitId,subUnitId:target.subUnitId,row,col,type:isZenEditor?HyperLinkEditSourceType.ZEN_EDITOR:visible.visible?HyperLinkEditSourceType.EDITING:HyperLinkEditSourceType.VIEWING})}},InsertHyperLinkToolbarOperation={type:core.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(accessor){if(getShouldDisableCurrentCellLink(accessor))return!1;const commandService=accessor.get(core.ICommandService);return accessor.get(exports.SheetsHyperLinkPopupService).currentEditing?commandService.executeCommand(CloseHyperLinkPopupOperation.id):commandService.executeCommand(InsertHyperLinkOperation.id)}},getLinkDisable$=__name(accessor=>{const disableRange$=sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetInsertHyperlinkPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]}),univerInstanceService=accessor.get(core.IUniverInstanceService),sheetSelectionService=accessor.get(sheets.SheetsSelectionsService),disableCell$=univerInstanceService.focused$.pipe(rxjs.map(focused=>focused?univerInstanceService.getUnit(focused,core.UniverInstanceType.UNIVER_SHEET):null),rxjs.mergeMap(unit=>unit?unit.activeSheet$:new rxjs.Observable(sub=>{sub.next(null)})),rxjs.mergeMap(sheet=>sheetSelectionService.selectionMoveEnd$.pipe(rxjs.map(selections=>sheet&&{selections,sheet}))),rxjs.map(sheetWithSelection=>{if(!sheetWithSelection)return!0;const{selections,sheet}=sheetWithSelection;if(!selections.length)return!0;const row=selections[0].range.startRow,col=selections[0].range.startColumn;return getShouldDisableCellLink(sheet,row,col)}));return disableRange$.pipe(rxjs.mergeMap(disableRange=>disableCell$.pipe(rxjs.map(disableCell=>disableRange||disableCell))))},"getLinkDisable$"),getZenLinkDisable$=__name(accessor=>{const univerInstanceService=accessor.get(core.IUniverInstanceService);return univerInstanceService.focused$.pipe(rxjs.mergeMap(focused=>!focused||focused!==core.DOCS_ZEN_EDITOR_UNIT_ID_KEY?new rxjs.Observable(sub=>sub.next(null)):accessor.get(docs.DocSelectionManagerService).textSelection$),rxjs.map(selection=>{if(!selection||selection.unitId!==core.DOCS_ZEN_EDITOR_UNIT_ID_KEY)return!0;const state=accessor.get(sheetsUi.IEditorBridgeService).getEditCellState();if(!state)return!0;const target=sheets.getSheetCommandTarget(univerInstanceService,{unitId:state.unitId,subUnitId:state.sheetId});return!(target!=null&&target.worksheet)||getShouldDisableCellLink(target.worksheet,state.row,state.column)?!0:shouldDisableAddLink(accessor)}))},"getZenLinkDisable$"),linkMenu={commandId:InsertHyperLinkOperation.id,type:ui.MenuItemType.BUTTON,positions:[ui.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",icon:"LinkSingle"},genZenEditorMenuId=__name(id=>`${id}-zen-editor`,"genZenEditorMenuId"),insertLinkMenuFactory=__name(accessor=>({...linkMenu,id:linkMenu.commandId,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:getLinkDisable$(accessor)}),"insertLinkMenuFactory"),zenEditorInsertLinkMenuFactory=__name(accessor=>({...linkMenu,id:genZenEditorMenuId(linkMenu.commandId),hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:getZenLinkDisable$(accessor)}),"zenEditorInsertLinkMenuFactory"),linkToolbarMenu={tooltip:"hyperLink.form.addTitle",positions:ui.MenuPosition.TOOLBAR_START,group:ui.MenuGroup.TOOLBAR_OTHERS,commandId:InsertHyperLinkToolbarOperation.id,type:ui.MenuItemType.BUTTON,icon:"LinkSingle"},insertLinkMenuToolbarFactory=__name(accessor=>({...linkToolbarMenu,id:linkToolbarMenu.commandId,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:getLinkDisable$(accessor)}),"insertLinkMenuToolbarFactory"),zenEditorInsertLinkMenuToolbarFactory=__name(accessor=>({...linkToolbarMenu,id:genZenEditorMenuId(linkToolbarMenu.commandId),hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:getZenLinkDisable$(accessor)}),"zenEditorInsertLinkMenuToolbarFactory"),InsertLinkShortcut={id:InsertHyperLinkToolbarOperation.id,binding:ui.KeyCode.K|ui.MetaKeys.CTRL_COMMAND,preconditions:sheetsUi.whenSheetEditorFocused};var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$9(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$9(target,key,result),result},"__decorateClass$9"),__decorateParam$9=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$9"),_a4;let SheetsHyperLinkAutoFillController=(_a4=class extends core.Disposable{constructor(_autoFillService,_hyperLinkModel){super(),this._autoFillService=_autoFillService,this._hyperLinkModel=_hyperLinkModel,this._initAutoFill()}_initAutoFill(){const noopReturnFunc=__name(()=>({redos:[],undos:[]}),"noopReturnFunc"),generalApplyFunc=__name((location2,applyType)=>{const{source:sourceRange,target:targetRange,unitId,subUnitId}=location2,virtualRange=sheetsUi.virtualizeDiscreteRanges([sourceRange,targetRange]),[vSourceRange,vTargetRange]=virtualRange.ranges,{mapFunc}=virtualRange,sourceStartCell={row:vSourceRange.startRow,col:vSourceRange.startColumn},repeats=sheetsUi.getAutoFillRepeatRange(vSourceRange,vTargetRange),redos=[],undos=[];return repeats.forEach(repeat=>{const targetStartCell=repeat.repeatStartCell,relativeRange=repeat.relativeRange,sourceRange2={startRow:sourceStartCell.row,startColumn:sourceStartCell.col,endColumn:sourceStartCell.col,endRow:sourceStartCell.row},targetRange2={startRow:targetStartCell.row,startColumn:targetStartCell.col,endColumn:targetStartCell.col,endRow:targetStartCell.row};core.Range.foreach(relativeRange,(row,col)=>{const sourcePositionRange=core.Rectangle.getPositionRange({startRow:row,startColumn:col,endColumn:col,endRow:row},sourceRange2),{row:sourceRow,col:sourceCol}=mapFunc(sourcePositionRange.startRow,sourcePositionRange.startColumn),link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,sourceRow,sourceCol),targetPositionRange=core.Rectangle.getPositionRange({startRow:row,startColumn:col,endColumn:col,endRow:row},targetRange2),{row:targetRow,col:targetCol}=mapFunc(targetPositionRange.startRow,targetPositionRange.startColumn),id=core.Tools.generateRandomId(),currentLink=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,targetRow,targetCol);currentLink&&redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:currentLink.id}}),(sheetsUi.APPLY_TYPE.COPY===applyType||sheetsUi.APPLY_TYPE.SERIES===applyType)&&link&&(redos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:{...link,id,row:targetRow,column:targetCol}}}),undos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id}})),currentLink&&undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:currentLink}})})}),{undos,redos}},"generalApplyFunc"),hook={id:SHEET_HYPER_LINK_UI_PLUGIN,onFillData:__name((location2,direction,applyType)=>applyType===sheetsUi.APPLY_TYPE.COPY||applyType===sheetsUi.APPLY_TYPE.ONLY_FORMAT||applyType===sheetsUi.APPLY_TYPE.SERIES?generalApplyFunc(location2,applyType):noopReturnFunc(),"onFillData")};this.disposeWithMe(this._autoFillService.addHook(hook))}},__name(_a4,"SheetsHyperLinkAutoFillController"),_a4);SheetsHyperLinkAutoFillController=__decorateClass$9([__decorateParam$9(0,sheetsUi.IAutoFillService),__decorateParam$9(1,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkAutoFillController);var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$8(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$8(target,key,result),result},"__decorateClass$8"),__decorateParam$8=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$8"),_a5;let SheetsHyperLinkPermissionController=(_a5=class extends core.Disposable{constructor(_localeService,_commandService,_sheetPermissionInterceptorBaseController){super(),this._localeService=_localeService,this._commandService=_commandService,this._sheetPermissionInterceptorBaseController=_sheetPermissionInterceptorBaseController,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(command=>{command.id===InsertLinkShortcut.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookEditablePermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}},__name(_a5,"SheetsHyperLinkPermissionController"),_a5);SheetsHyperLinkPermissionController=__decorateClass$8([__decorateParam$8(0,core.Inject(core.LocaleService)),__decorateParam$8(1,core.ICommandService),__decorateParam$8(2,core.Inject(sheetsUi.SheetPermissionInterceptorBaseController))],SheetsHyperLinkPermissionController);var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$7"),_a6;let SheetsHyperLinkPopupController=(_a6=class extends core.Disposable{constructor(_hoverManagerService,_sheetsHyperLinkPopupService,_renderManagerService,_permissionService,_sheetPermissionInterceptorBaseController,_commandService,_editorBridgeService,_textSelectionManagerService,_univerInstanceService,_zenZoneService){super(),this._hoverManagerService=_hoverManagerService,this._sheetsHyperLinkPopupService=_sheetsHyperLinkPopupService,this._renderManagerService=_renderManagerService,this._permissionService=_permissionService,this._sheetPermissionInterceptorBaseController=_sheetPermissionInterceptorBaseController,this._commandService=_commandService,this._editorBridgeService=_editorBridgeService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this._zenZoneService=_zenZoneService,this._initHoverListener(),this._initCommandListener(),this._initHoverEditingListener(),this._initTextSelectionListener(),this._initZenEditor()}_getLinkPermission(location2){const{unitId,subUnitId,row:currentRow,col:currentCol}=location2,workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET);if(!(workbook==null?void 0:workbook.getSheetBySheetId(subUnitId)))return{viewPermission:!1,editPermission:!1,copyPermission:!1};const viewPermission=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookViewPermission],worksheetTypes:[sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]},[{startRow:currentRow,startColumn:currentCol,endRow:currentRow,endColumn:currentCol}]),editPermission=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetInsertHyperlinkPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]},[{startRow:currentRow,startColumn:currentCol,endRow:currentRow,endColumn:currentCol}]),copyPermission=this._permissionService.composePermission([new sheets.WorkbookCopyPermission(unitId).id,new sheets.WorksheetCopyPermission(unitId,subUnitId).id]).every(permission=>permission.value);return{viewPermission,editPermission,copyPermission}}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentRichText$.pipe(rxjs.debounceTime(200)).subscribe(currentCell=>{var _a15;if(!currentCell){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const{unitId,subUnitId,row,col}=currentCell,renderer=this._renderManagerService.getRenderById(unitId);if(!renderer)return;if(!renderer.with(sheetsUi.HoverRenderController).active){this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);return}const skeleton=(_a15=renderer==null?void 0:renderer.with(sheetsUi.SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId))==null?void 0:_a15.skeleton,currentCol=col,currentRow=row;let targetRow=currentRow,targetCol=currentCol;skeleton&&skeleton.overflowCache.forValue((row2,col2,value)=>{core.Rectangle.contains(value,{startColumn:currentCol,endColumn:currentCol,startRow:currentRow,endRow:currentRow})&&(targetRow=row2,targetCol=col2)});const{viewPermission,editPermission,copyPermission}=this._getLinkPermission(currentCell);if(!viewPermission||!currentCell.customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup({row:targetRow,col:targetCol,editPermission,copyPermission,customRange:currentCell.customRange,customRangeRect:currentCell.rect,type:HyperLinkEditSourceType.VIEWING,unitId,subUnitId})}))}_initHoverEditingListener(){let subscribe=null;this.disposeWithMe(this._editorBridgeService.currentEditCellState$.pipe(rxjs.mergeMap(state=>this._editorBridgeService.visible$.pipe(rxjs.map(visible=>({visible,state}))))).subscribe(({visible,state})=>{if(!state||state.editorUnitId!==core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)return;if(!visible.visible){subscribe==null||subscribe.unsubscribe(),this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING),this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING);return}const{editorUnitId,unitId,sheetId,row,column}=state,renderer=this._renderManagerService.getRenderById(editorUnitId);if(!renderer)return;const{editPermission,viewPermission,copyPermission}=this._getLinkPermission({unitId,subUnitId:sheetId,row,col:column}),docEventService=renderer.with(docsUi.DocEventManagerService);viewPermission&&(subscribe==null||subscribe.unsubscribe(),subscribe=docEventService.hoverCustomRanges$.pipe(rxjs.debounceTime(200)).subscribe(customRanges=>{var _a15,_b;const customRange=customRanges.find(customRange2=>customRange2.range.rangeType===core.CustomRangeType.HYPERLINK);if(!customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const rect=customRange.rects[customRange.rects.length-1];if(!((_b=(_a15=this._renderManagerService.getRenderById(unitId))==null?void 0:_a15.with(sheetsUi.SheetSkeletonManagerService).getWorksheetSkeleton(sheetId))==null?void 0:_b.skeleton)||!rect)return;const canvasClientRect=renderer.engine.getCanvasElement().getBoundingClientRect();this._sheetsHyperLinkPopupService.showPopup({unitId,subUnitId:sheetId,row,col:column,customRange:customRange.range,customRangeRect:{left:rect.left+canvasClientRect.left,top:rect.top+canvasClientRect.top,bottom:rect.bottom+canvasClientRect.top,right:rect.right+canvasClientRect.left},editPermission,copyPermission,type:HyperLinkEditSourceType.EDITING})}))})),this.disposeWithMe(()=>{subscribe==null||subscribe.unsubscribe()})}_initZenEditor(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(visible=>{visible&&(this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING),this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING),this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING),this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING))})),this.disposeWithMe(this._univerInstanceService.focused$.pipe(rxjs.mergeMap(id=>{const render2=id===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY?this._renderManagerService.getRenderById(id):null;return render2?render2.with(docsUi.DocEventManagerService).hoverCustomRanges$.pipe(rxjs.debounceTime(200)):new rxjs.Observable(sub=>{sub.next(null)})})).subscribe(value=>{const range=value==null?void 0:value.find(range2=>range2.range.rangeType===core.CustomRangeType.HYPERLINK),state=this._editorBridgeService.getEditCellState();if(range&&state){const{unitId,sheetId,row,column}=state,{editPermission,viewPermission,copyPermission}=this._getLinkPermission({unitId,subUnitId:sheetId,row,col:column});viewPermission&&this._sheetsHyperLinkPopupService.showPopup({type:HyperLinkEditSourceType.ZEN_EDITOR,unitId,subUnitId:sheetId,row,col:column,customRange:range.range,editPermission,copyPermission})}else this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR)}))}_initTextSelectionListener(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(selection=>{selection&&selection.unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING)}))}_initCommandListener(){const HIDE_COMMAND_LIST=[sheets.ClearSelectionContentCommand.id,sheets.ClearSelectionAllCommand.id,sheets.ClearSelectionFormatCommand.id];this.disposeWithMe(this._commandService.onCommandExecuted(command=>{HIDE_COMMAND_LIST.includes(command.id)&&this._sheetsHyperLinkPopupService.hideCurrentPopup()}))}},__name(_a6,"SheetsHyperLinkPopupController"),_a6);SheetsHyperLinkPopupController=__decorateClass$7([__decorateParam$7(0,core.Inject(sheetsUi.HoverManagerService)),__decorateParam$7(1,core.Inject(exports.SheetsHyperLinkPopupService)),__decorateParam$7(2,core.Inject(engineRender.IRenderManagerService)),__decorateParam$7(3,core.Inject(core.IPermissionService)),__decorateParam$7(4,core.Inject(sheetsUi.SheetPermissionInterceptorBaseController)),__decorateParam$7(5,core.ICommandService),__decorateParam$7(6,sheetsUi.IEditorBridgeService),__decorateParam$7(7,core.Inject(docs.DocSelectionManagerService)),__decorateParam$7(8,core.IUniverInstanceService),__decorateParam$7(9,ui.IZenZoneService)],SheetsHyperLinkPopupController);var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$6"),_a7;let SheetsHyperLinkRemoveSheetController=(_a7=class extends core.Disposable{constructor(_sheetInterceptorService,_univerInstanceService,_hyperLinkModel){super(),this._sheetInterceptorService=_sheetInterceptorService,this._univerInstanceService=_univerInstanceService,this._hyperLinkModel=_hyperLinkModel,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:__name(commandInfo=>{var _a15;if(commandInfo.id===sheets.RemoveSheetCommand.id){const params=commandInfo.params,workbook=params.unitId?this._univerInstanceService.getUnit(params.unitId):this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return{redos:[],undos:[]};const unitId=workbook.getUnitId(),subUnitId=params.subUnitId||((_a15=workbook.getActiveSheet())==null?void 0:_a15.getSheetId());if(!subUnitId)return{redos:[],undos:[]};const links=this._hyperLinkModel.getSubUnit(unitId,subUnitId),redos=links.map(link=>({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:link.id}})),undos=links.map(link=>({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link}}));return{redos,undos}}return{redos:[],undos:[]}},"getMutations")}))}},__name(_a7,"SheetsHyperLinkRemoveSheetController"),_a7);SheetsHyperLinkRemoveSheetController=__decorateClass$6([__decorateParam$6(0,core.Inject(sheets.SheetInterceptorService)),__decorateParam$6(1,core.IUniverInstanceService),__decorateParam$6(2,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkRemoveSheetController);var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5"),_a8;let SheetsHyperLinkRenderController=(_a8=class extends core.Disposable{constructor(_context,_hyperLinkModel){super(),this._context=_context,this._hyperLinkModel=_hyperLinkModel,this._initSkeletonChange()}_initSkeletonChange(){const markSkeletonDirty=__name(()=>{var _a15;(_a15=this._context.mainComponent)==null||_a15.makeForceDirty()},"markSkeletonDirty");this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(rxjs.debounceTime(16)).subscribe(()=>{markSkeletonDirty()}))}},__name(_a8,"SheetsHyperLinkRenderController"),_a8);SheetsHyperLinkRenderController=__decorateClass$5([__decorateParam$5(1,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkRenderController);var _a9;let SheetsHyperLinkRenderManagerController=(_a9=class extends core.Disposable{constructor(_sheetInterceptorService,_hyperLinkModel){super(),this._sheetInterceptorService=_sheetInterceptorService,this._hyperLinkModel=_hyperLinkModel,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(sheets.INTERCEPTOR_POINT.CELL_CONTENT,{effect:core.InterceptorEffectEnum.Value,priority:100,handler:__name((cell,pos,next)=>{const{row,col,unitId,subUnitId}=pos,link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,col);return next(link?{...cell,linkUrl:link.payload,linkId:link.id}:cell)},"handler")}))}},__name(_a9,"SheetsHyperLinkRenderManagerController"),_a9);SheetsHyperLinkRenderManagerController=__decorateClass$5([__decorateParam$5(0,core.Inject(sheets.SheetInterceptorService)),__decorateParam$5(1,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkRenderManagerController);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a10;let SheetsHyperLinkRichTextRefRangeController=(_a10=class extends core.Disposable{constructor(_commandService,_univerInstanceService,_refRangeService){super();__publicField(this,"_refRangeMap",new Map);this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._refRangeService=_refRangeService,this._initWorkbookLoad(),this._initWorkbookUnload(),this._initSetRangesListener()}_enusreMap(unitId,subUnitId){let unitMap=this._refRangeMap.get(unitId);unitMap||(unitMap=new Map,this._refRangeMap.set(unitId,unitMap));let subUnitMap=unitMap.get(subUnitId);return subUnitMap||(subUnitMap=new core.ObjectMatrix,unitMap.set(subUnitId,subUnitMap)),subUnitMap}_isLegalRangeUrl(unitId,payload){var _a15,_b,_c;const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return null;if(payload&&payload.startsWith("#")){const search=new URLSearchParams(payload.slice(1)),searchObj={gid:(_a15=search.get("gid"))!=null?_a15:"",range:(_b=search.get("range"))!=null?_b:"",rangeid:(_c=search.get("rangeid"))!=null?_c:""};if(searchObj.range&&searchObj.gid){const subUnitId=searchObj.gid,worksheet=workbook.getSheetBySheetId(subUnitId);if(!worksheet)return null;const range=engineFormula.deserializeRangeWithSheet(searchObj.range).range;if(core.isValidRange(range,worksheet)&&searchObj.range!==sheetsHyperLink.ERROR_RANGE)return range}}return null}_registerRange(unitId,subUnitId,row,col,p2){var _a15,_b,_c,_d;const map=this._enusreMap(unitId,subUnitId),data=core.Tools.deepClone(p2),handleRangeChange=__name(commandInfo=>{var _a16,_b2;const dataCopy=core.Tools.deepClone(data);(_b2=(_a16=dataCopy.body)==null?void 0:_a16.customRanges)==null||_b2.forEach(customRange=>{var _a17;if(customRange.rangeType===core.CustomRangeType.HYPERLINK){const payload=(_a17=customRange.properties)==null?void 0:_a17.url,range=this._isLegalRangeUrl(unitId,payload);if(range){const resultRange=sheets.handleDefaultRangeChangeWithEffectRefCommands(range,commandInfo),newPayload=`#gid=${subUnitId}&range=${resultRange?engineFormula.serializeRange(resultRange):sheetsHyperLink.ERROR_RANGE}`;customRange.properties.url=newPayload}}});const position=sheets.handleDefaultRangeChangeWithEffectRefCommands({startRow:row,endRow:row,startColumn:col,endColumn:col},commandInfo);return position?{redos:[{id:sheets.SetRangeValuesMutation.id,params:{unitId,subUnitId,cellValue:{[position.startRow]:{[position.startColumn]:{p:dataCopy}}}}}],undos:[{id:sheets.SetRangeValuesMutation.id,params:{unitId,subUnitId,cellValue:{[row]:{[col]:{p:data}}}}}]}:{redos:[],undos:[]}},"handleRangeChange");if((_b=(_a15=p2.body)==null?void 0:_a15.customRanges)!=null&&_b.some(customRange=>{var _a16;return customRange.rangeType===core.CustomRangeType.HYPERLINK&&this._isLegalRangeUrl(unitId,(_a16=customRange.properties)==null?void 0:_a16.url)})){const disposableCollection=new core.DisposableCollection;(_d=(_c=p2.body)==null?void 0:_c.customRanges)==null||_d.forEach(customRange=>{var _a16;if(customRange.rangeType===core.CustomRangeType.HYPERLINK){const payload=(_a16=customRange.properties)==null?void 0:_a16.url,range=this._isLegalRangeUrl(unitId,payload);range&&disposableCollection.add(this._refRangeService.registerRefRange(range,handleRangeChange,unitId,subUnitId))}}),map.setValue(row,col,disposableCollection)}}_initWorkbookLoad(){const handleWorkbook=__name(workbook=>{const unitId=workbook.getUnitId();workbook.getSheets().forEach(sheet=>{const subUnitId=sheet.getSheetId(),map=this._enusreMap(unitId,subUnitId);sheet.getCellMatrix().forValue((row,col,cell)=>{const dispose=map.getValue(row,col);dispose&&dispose.dispose(),cell&&cell.p&&this._registerRange(unitId,subUnitId,row,col,cell.p)})})},"handleWorkbook");this._univerInstanceService.getAllUnitsForType(core.UniverInstanceType.UNIVER_SHEET).forEach(workbook=>{handleWorkbook(workbook)}),this.disposeWithMe(this._univerInstanceService.unitAdded$.subscribe(unit=>{unit.type===core.UniverInstanceType.UNIVER_SHEET&&handleWorkbook(unit)}))}_initWorkbookUnload(){this._univerInstanceService.unitDisposed$.subscribe(unit=>{if(unit.type===core.UniverInstanceType.UNIVER_SHEET){const workbook=unit,unitId=workbook.getUnitId();workbook.getSheets().forEach(sheet=>{const subUnitId=sheet.getSheetId();this._enusreMap(unitId,subUnitId).forValue((row,col,dispose)=>{dispose&&dispose.dispose()})}),this._refRangeMap.delete(unitId)}})}_initSetRangesListener(){this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{if(commandInfo.id===sheets.SetRangeValuesMutation.id){const params=commandInfo.params,{unitId,subUnitId,cellValue}=params,map=this._enusreMap(unitId,subUnitId);cellValue&&new core.ObjectMatrix(cellValue).forValue((row,col,cell)=>{const dispose=map.getValue(row,col);dispose&&dispose.dispose(),cell&&cell.p&&this._registerRange(unitId,subUnitId,row,col,cell.p)})}}))}},__name(_a10,"SheetsHyperLinkRichTextRefRangeController"),_a10);SheetsHyperLinkRichTextRefRangeController=__decorateClass$4([__decorateParam$4(0,core.ICommandService),__decorateParam$4(1,core.IUniverInstanceService),__decorateParam$4(2,core.Inject(sheets.RefRangeService))],SheetsHyperLinkRichTextRefRangeController);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3"),_a11;let SheetHyperLinkSetRangeController=(_a11=class extends core.Disposable{constructor(_sheetInterceptorService,_hyperLinkModel,_selectionManagerService,_univerInstanceService,_editorBridgeService,_renderManagerService){super(),this._sheetInterceptorService=_sheetInterceptorService,this._hyperLinkModel=_hyperLinkModel,this._selectionManagerService=_selectionManagerService,this._univerInstanceService=_univerInstanceService,this._editorBridgeService=_editorBridgeService,this._renderManagerService=_renderManagerService,this._initCommandInterceptor(),this._initAfterEditor()}_initCommandInterceptor(){this._initSetRangeValuesCommandInterceptor(),this._initClearSelectionCommandInterceptor()}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:__name(command=>{if(command.id===sheets.SetRangeValuesCommand.id){const params=command.params,{unitId,subUnitId}=params,redos=[],undos=[];return params.cellValue&&new core.ObjectMatrix(params.cellValue).forValue((row,col)=>{const link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,col);link&&(redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:link.id}}),undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link}}))}),{undos,redos}}return{redos:[],undos:[]}},"getMutations")}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:__name(command=>{if(command.id===sheets.ClearSelectionContentCommand.id||command.id===sheets.ClearSelectionAllCommand.id||command.id===sheets.ClearSelectionFormatCommand.id){const redos=[],undos=[],selection=this._selectionManagerService.getCurrentLastSelection(),target=sheets.getSheetCommandTarget(this._univerInstanceService);if(selection&&target){const{unitId,subUnitId}=target;core.Range.foreach(selection.range,(row,col)=>{const link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,col);link&&(redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:link.id}}),undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link}}))})}return{redos,undos}}return{redos:[],undos:[]}},"getMutations")}))}_initAfterEditor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:__name((cell,context,next)=>{if(!cell||cell.p)return next(cell);if(typeof cell.v=="string"&&core.Tools.isLegalUrl(cell.v)&&cell.v[cell.v.length-1]!==" "){const{unitId,subUnitId}=context,renderer=this._renderManagerService.getRenderById(unitId),skeleton=renderer==null?void 0:renderer.with(sheetsUi.SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);if(!skeleton)return next(cell);const doc=skeleton.skeleton.getBlankCellDocumentModel(cell);if(!doc.documentModel)return next(cell);const textX=core.BuildTextUtils.selection.replace({selection:{startOffset:0,endOffset:cell.v.length,collapsed:!1},body:{dataStream:`${core.DataStreamTreeTokenType.CUSTOM_RANGE_START}${cell.v}${core.DataStreamTreeTokenType.CUSTOM_RANGE_END}`,customRanges:[{startIndex:0,endIndex:cell.v.length+1,rangeId:core.generateRandomId(),rangeType:core.CustomRangeType.HYPERLINK,properties:{url:cell.v}}]},doc:doc.documentModel});if(!textX)return next(cell);const body=doc.documentModel.getBody();return core.TextX.apply(body,textX.serialize()),next({...cell,p:{id:core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,body,documentStyle:{pageSize:{width:1/0,height:1/0}}}})}return next(cell)},"handler")}))}},__name(_a11,"SheetHyperLinkSetRangeController"),_a11);SheetHyperLinkSetRangeController=__decorateClass$3([__decorateParam$3(0,core.Inject(sheets.SheetInterceptorService)),__decorateParam$3(1,core.Inject(sheetsHyperLink.HyperLinkModel)),__decorateParam$3(2,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$3(3,core.IUniverInstanceService),__decorateParam$3(4,sheetsUi.IEditorBridgeService),__decorateParam$3(5,engineRender.IRenderManagerService)],SheetHyperLinkSetRangeController);const menuSchema={[ui.RibbonStartGroup.OTHERS]:{[InsertHyperLinkToolbarOperation.id]:{order:2,menuItemFactory:insertLinkMenuToolbarFactory},[genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]:{order:2,menuItemFactory:zenEditorInsertLinkMenuToolbarFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{order:1,[InsertHyperLinkToolbarOperation.id]:{order:0,menuItemFactory:insertLinkMenuFactory},[genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]:{order:0,menuItemFactory:zenEditorInsertLinkMenuFactory}}}};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a12;let SheetsHyperLinkUIController=(_a12=class extends core.Disposable{constructor(_componentManager,_commandService,_menuManagerService,_injector,_shortcutService){super(),this._componentManager=_componentManager,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._injector=_injector,this._shortcutService=_shortcutService,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[CellLinkPopup,CellLinkPopup.componentKey],[CellLinkEdit,CellLinkEdit.componentKey],[LinkSingle,"LinkSingle"]].forEach(([comp,key])=>{this._componentManager.register(key,comp)})}_initCommands(){[OpenHyperLinkEditPanelOperation,CloseHyperLinkPopupOperation,InsertHyperLinkOperation,InsertHyperLinkToolbarOperation,AddHyperLinkCommand,UpdateHyperLinkCommand,CancelHyperLinkCommand,UpdateRichHyperLinkCommand,CancelRichHyperLinkCommand,AddRichHyperLinkCommand].forEach(command=>{this._commandService.registerCommand(command)})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initShortCut(){this._shortcutService.registerShortcut(InsertLinkShortcut)}},__name(_a12,"SheetsHyperLinkUIController"),_a12);SheetsHyperLinkUIController=__decorateClass$2([__decorateParam$2(0,core.Inject(ui.ComponentManager)),__decorateParam$2(1,core.ICommandService),__decorateParam$2(2,ui.IMenuManagerService),__decorateParam$2(3,core.Inject(core.Injector)),__decorateParam$2(4,core.Inject(ui.IShortcutService))],SheetsHyperLinkUIController);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a13;let SheetHyperLinkUrlController=(_a13=class extends core.Disposable{constructor(_resolverService){super(),this._resolverService=_resolverService,this._handleInitUrl()}_handleInitUrl(){const hash=location.hash;hash&&this._resolverService.parseHyperLink(hash).handler()}},__name(_a13,"SheetHyperLinkUrlController"),_a13);SheetHyperLinkUrlController=__decorateClass$1([__decorateParam$1(0,core.Inject(exports.SheetsHyperLinkResolverService))],SheetHyperLinkUrlController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField"),_a14;exports.UniverSheetsHyperLinkUIPlugin=(_a14=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[exports.SheetsHyperLinkResolverService],[exports.SheetsHyperLinkPopupService],[SheetsHyperLinkSidePanelService],[SheetsHyperLinkRemoveSheetController],[SheetsHyperLinkRenderManagerController],[SheetHyperLinkSetRangeController],[SheetsHyperLinkPopupController],[SheetsHyperLinkUIController],[SheetsHyperLinkAutoFillController],[exports.SheetsHyperLinkCopyPasteController],[SheetsHyperLinkPermissionController],[SheetHyperLinkUrlController],[SheetsHyperLinkRichTextRefRangeController]].forEach(dep=>this._injector.add(dep)),this._injector.get(SheetsHyperLinkRenderManagerController),this._injector.get(SheetsHyperLinkRichTextRefRangeController),this._injector.get(SheetHyperLinkSetRangeController)}onReady(){this._injector.get(engineRender.IRenderManagerService).registerRenderModule(core.UniverInstanceType.UNIVER_SHEET,[SheetsHyperLinkRenderController]),this._injector.get(SheetsHyperLinkAutoFillController),this._injector.get(exports.SheetsHyperLinkCopyPasteController),this._injector.get(SheetsHyperLinkRemoveSheetController),this._injector.get(SheetsHyperLinkUIController)}onRendered(){this._injector.get(SheetsHyperLinkPermissionController),this._injector.get(SheetHyperLinkUrlController),this._injector.get(SheetsHyperLinkPopupController)}},__name(_a14,"UniverSheetsHyperLinkUIPlugin"),_a14);__publicField2(exports.UniverSheetsHyperLinkUIPlugin,"pluginName",SHEET_HYPER_LINK_UI_PLUGIN);__publicField2(exports.UniverSheetsHyperLinkUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsHyperLinkUIPlugin=__decorateClass([core.DependentOn(sheetsHyperLink.UniverSheetsHyperLinkPlugin,docsUi.UniverDocsUIPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports.UniverSheetsHyperLinkUIPlugin);exports.AddHyperLinkCommand=AddHyperLinkCommand;exports.CancelHyperLinkCommand=CancelHyperLinkCommand;exports.CloseHyperLinkPopupOperation=CloseHyperLinkPopupOperation;exports.InsertHyperLinkOperation=InsertHyperLinkOperation;exports.InsertLinkShortcut=InsertLinkShortcut;exports.OpenHyperLinkEditPanelOperation=OpenHyperLinkEditPanelOperation;exports.SheetsHyperLinkSidePanelService=SheetsHyperLinkSidePanelService;exports.UpdateHyperLinkCommand=UpdateHyperLinkCommand;
|
package/lib/locale/en-US.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hyperLink": {
|
|
3
|
-
"form": {
|
|
4
|
-
"editTitle": "Edit Link",
|
|
5
|
-
"addTitle": "Insert Link",
|
|
6
|
-
"label": "Label",
|
|
7
|
-
"type": "Type",
|
|
8
|
-
"link": "Link",
|
|
9
|
-
"linkPlaceholder": "Enter link",
|
|
10
|
-
"range": "Range",
|
|
11
|
-
"worksheet": "Worksheet",
|
|
12
|
-
"definedName": "Defined Name",
|
|
13
|
-
"ok": "Confirm",
|
|
14
|
-
"cancel": "Cancel",
|
|
15
|
-
"labelPlaceholder": "Enter label",
|
|
16
|
-
"inputError": "Please enter",
|
|
17
|
-
"selectError": "Please select",
|
|
18
|
-
"linkError": "Please enter a legal link"
|
|
19
|
-
},
|
|
20
|
-
"menu": {
|
|
21
|
-
"add": "Insert Link"
|
|
22
|
-
},
|
|
23
|
-
"message": {
|
|
24
|
-
"noSheet": "Target sheet has been delete",
|
|
25
|
-
"refError": "Invalid Range",
|
|
26
|
-
"hiddenSheet": "Cannot open the link because the linked sheet is hidden",
|
|
27
|
-
"coped": "Link copied to clipboard"
|
|
28
|
-
},
|
|
29
|
-
"popup": {
|
|
30
|
-
"copy": "Copy Link",
|
|
31
|
-
"edit": "Edit Link",
|
|
32
|
-
"cancel": "Cancel Link"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
package/lib/locale/fa-IR.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hyperLink": {
|
|
3
|
-
"form": {
|
|
4
|
-
"editTitle": "ویرایش لینک",
|
|
5
|
-
"addTitle": "درج لینک",
|
|
6
|
-
"label": "برچسب",
|
|
7
|
-
"type": "نوع",
|
|
8
|
-
"link": "لینک",
|
|
9
|
-
"linkPlaceholder": "لینک را وارد کنید",
|
|
10
|
-
"range": "محدوده",
|
|
11
|
-
"worksheet": "برگ کار",
|
|
12
|
-
"definedName": "نام تعریف شده",
|
|
13
|
-
"ok": "تایید",
|
|
14
|
-
"cancel": "انصراف",
|
|
15
|
-
"labelPlaceholder": "برچسب را وارد کنید",
|
|
16
|
-
"inputError": "لطفا وارد کنید",
|
|
17
|
-
"selectError": "لطفا انتخاب کنید",
|
|
18
|
-
"linkError": "لطفا یک لینک معتبر وارد کنید"
|
|
19
|
-
},
|
|
20
|
-
"menu": {
|
|
21
|
-
"add": "درج لینک"
|
|
22
|
-
},
|
|
23
|
-
"message": {
|
|
24
|
-
"noSheet": "برگ هدف حذف شده است",
|
|
25
|
-
"refError": "محدوده نامعتبر",
|
|
26
|
-
"hiddenSheet": "نمیتوان لینک را باز کرد زیرا برگ مرتبط پنهان است",
|
|
27
|
-
"coped": "لینک به کلیپ بورد کپی شد"
|
|
28
|
-
},
|
|
29
|
-
"popup": {
|
|
30
|
-
"copy": "کپی لینک",
|
|
31
|
-
"edit": "ویرایش لینک",
|
|
32
|
-
"cancel": "لینک را لغو کنید"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
package/lib/locale/ru-RU.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hyperLink": {
|
|
3
|
-
"form": {
|
|
4
|
-
"editTitle": "Редактировать ссылку",
|
|
5
|
-
"addTitle": "Вставить ссылку",
|
|
6
|
-
"label": "Метка",
|
|
7
|
-
"type": "Тип",
|
|
8
|
-
"link": "Ссылка",
|
|
9
|
-
"linkPlaceholder": "Введите ссылку",
|
|
10
|
-
"range": "Диапазон",
|
|
11
|
-
"worksheet": "Лист",
|
|
12
|
-
"definedName": "Определенное имя",
|
|
13
|
-
"ok": "ОК",
|
|
14
|
-
"cancel": "Отмена",
|
|
15
|
-
"labelPlaceholder": "Введите метку",
|
|
16
|
-
"inputError": "Пожалуйста, введите",
|
|
17
|
-
"selectError": "Пожалуйста, выберите",
|
|
18
|
-
"linkError": "Пожалуйста, введите корректную ссылку"
|
|
19
|
-
},
|
|
20
|
-
"menu": {
|
|
21
|
-
"add": "Вставить ссылку"
|
|
22
|
-
},
|
|
23
|
-
"message": {
|
|
24
|
-
"noSheet": "Целевой лист был удален",
|
|
25
|
-
"refError": "Недопустимый диапазон",
|
|
26
|
-
"hiddenSheet": "Невозможно открыть ссылку, так как связанный лист скрыт",
|
|
27
|
-
"coped": "Ссылка скопирована в буфер обмена"
|
|
28
|
-
},
|
|
29
|
-
"popup": {
|
|
30
|
-
"copy": "Копировать ссылку",
|
|
31
|
-
"edit": "Редактировать ссылку",
|
|
32
|
-
"cancel": "Отменить ссылку"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
package/lib/locale/vi-VN.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hyperLink": {
|
|
3
|
-
"form": {
|
|
4
|
-
"editTitle": "Chỉnh sửa liên kết",
|
|
5
|
-
"addTitle": "Chèn liên kết",
|
|
6
|
-
"label": "Văn bản",
|
|
7
|
-
"labelPlaceholder": "Nhập văn bản",
|
|
8
|
-
"type": "Loại",
|
|
9
|
-
"link": "Liên kết",
|
|
10
|
-
"linkPlaceholder": "Nhập địa chỉ liên kết",
|
|
11
|
-
"range": "Ô",
|
|
12
|
-
"worksheet": "Bảng tính",
|
|
13
|
-
"definedName": "Tên đã xác định",
|
|
14
|
-
"ok": "Xác nhận",
|
|
15
|
-
"cancel": "Hủy",
|
|
16
|
-
"inputError": "Vui lòng nhập",
|
|
17
|
-
"selectError": "Vui lòng chọn",
|
|
18
|
-
"linkError": "Vui lòng nhập liên kết hợp lệ"
|
|
19
|
-
},
|
|
20
|
-
"menu": {
|
|
21
|
-
"add": "Thêm liên kết"
|
|
22
|
-
},
|
|
23
|
-
"message": {
|
|
24
|
-
"noSheet": "Bảng con này đã bị xóa",
|
|
25
|
-
"refError": "Tham chiếu lỗi",
|
|
26
|
-
"hiddenSheet": "Không thể mở bảng con bị ẩn",
|
|
27
|
-
"coped": "Liên kết đã được sao chép vào clipboard"
|
|
28
|
-
},
|
|
29
|
-
"popup": {
|
|
30
|
-
"copy": "Sao chép",
|
|
31
|
-
"edit": "Chỉnh sửa",
|
|
32
|
-
"cancel": "Hủy liên kết"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|