@univerjs/sheets-hyper-link-ui 0.17.0 → 0.18.0

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.
Files changed (87) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +32 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -12
  16. package/lib/es/index.js +32 -2006
  17. package/lib/es/locale/ca-ES.js +1 -38
  18. package/lib/es/locale/en-US.js +1 -38
  19. package/lib/es/locale/es-ES.js +1 -38
  20. package/lib/es/locale/fa-IR.js +1 -38
  21. package/lib/es/locale/fr-FR.js +1 -38
  22. package/lib/es/locale/ja-JP.js +1 -38
  23. package/lib/es/locale/ko-KR.js +1 -38
  24. package/lib/es/locale/ru-RU.js +1 -38
  25. package/lib/es/locale/sk-SK.js +1 -38
  26. package/lib/es/locale/vi-VN.js +1 -38
  27. package/lib/es/locale/zh-CN.js +1 -38
  28. package/lib/es/locale/zh-TW.js +1 -38
  29. package/lib/facade.js +1 -12
  30. package/lib/index.css +168 -1
  31. package/lib/index.js +32 -2006
  32. package/lib/locale/ca-ES.js +1 -38
  33. package/lib/locale/en-US.js +1 -38
  34. package/lib/locale/es-ES.js +1 -38
  35. package/lib/locale/fa-IR.js +1 -38
  36. package/lib/locale/fr-FR.js +1 -38
  37. package/lib/locale/ja-JP.js +1 -38
  38. package/lib/locale/ko-KR.js +1 -38
  39. package/lib/locale/ru-RU.js +1 -38
  40. package/lib/locale/sk-SK.js +1 -38
  41. package/lib/locale/vi-VN.js +1 -38
  42. package/lib/locale/zh-CN.js +1 -38
  43. package/lib/locale/zh-TW.js +1 -38
  44. package/lib/types/commands/operations/popup.operations.d.ts +17 -2
  45. package/lib/types/config/config.d.ts +16 -1
  46. package/lib/types/controllers/auto-fill.controller.d.ts +15 -0
  47. package/lib/types/controllers/copy-paste.controller.d.ts +15 -0
  48. package/lib/types/controllers/hyper-link-permission.controller.d.ts +15 -0
  49. package/lib/types/controllers/popup.controller.d.ts +15 -0
  50. package/lib/types/controllers/render-controllers/render.controller.d.ts +18 -2
  51. package/lib/types/controllers/ui.controller.d.ts +15 -0
  52. package/lib/types/controllers/url.controller.d.ts +15 -0
  53. package/lib/types/facade/f-workbook.d.ts +15 -0
  54. package/lib/types/locale/ca-ES.d.ts +16 -1
  55. package/lib/types/locale/es-ES.d.ts +16 -1
  56. package/lib/types/locale/fa-IR.d.ts +16 -1
  57. package/lib/types/locale/fr-FR.d.ts +16 -1
  58. package/lib/types/locale/ja-JP.d.ts +16 -1
  59. package/lib/types/locale/ko-KR.d.ts +16 -1
  60. package/lib/types/locale/ru-RU.d.ts +16 -1
  61. package/lib/types/locale/sk-SK.d.ts +16 -1
  62. package/lib/types/locale/vi-VN.d.ts +16 -1
  63. package/lib/types/locale/zh-CN.d.ts +16 -1
  64. package/lib/types/locale/zh-TW.d.ts +16 -1
  65. package/lib/types/menu/menu.d.ts +22 -6
  66. package/lib/types/menu/schema.d.ts +16 -1
  67. package/lib/types/plugin.d.ts +16 -1
  68. package/lib/types/services/popup.service.d.ts +21 -5
  69. package/lib/types/services/resolver.service.d.ts +18 -2
  70. package/lib/types/services/side-panel.service.d.ts +18 -2
  71. package/lib/types/utils/index.d.ts +16 -1
  72. package/lib/types/views/CellLinkPopup/index.d.ts +16 -1
  73. package/lib/umd/facade.js +1 -1
  74. package/lib/umd/index.js +32 -1
  75. package/lib/umd/locale/ca-ES.js +1 -1
  76. package/lib/umd/locale/en-US.js +1 -1
  77. package/lib/umd/locale/es-ES.js +1 -1
  78. package/lib/umd/locale/fa-IR.js +1 -1
  79. package/lib/umd/locale/fr-FR.js +1 -1
  80. package/lib/umd/locale/ja-JP.js +1 -1
  81. package/lib/umd/locale/ko-KR.js +1 -1
  82. package/lib/umd/locale/ru-RU.js +1 -1
  83. package/lib/umd/locale/sk-SK.js +1 -1
  84. package/lib/umd/locale/vi-VN.js +1 -1
  85. package/lib/umd/locale/zh-CN.js +1 -1
  86. package/lib/umd/locale/zh-TW.js +1 -1
  87. package/package.json +18 -17
package/lib/cjs/facade.js CHANGED
@@ -1 +1 @@
1
- "use strict";const n=require("@univerjs/sheets-hyper-link"),t=require("@univerjs/sheets-hyper-link-ui"),o=require("@univerjs/sheets-hyper-link/facade"),c=require("@univerjs/sheets/facade");class k extends o.FWorkbookHyperLinkMixin{navigateToSheetHyperlink(e){const r=this._injector.get(n.SheetsHyperLinkParserService),i=this._injector.get(t.SheetsHyperLinkResolverService),s=r.parseHyperLink(e);i.navigate(s)}}c.FWorkbook.extend(k);
1
+ let e=require(`@univerjs/sheets-hyper-link`),t=require(`@univerjs/sheets-hyper-link-ui`),n=require(`@univerjs/sheets-hyper-link/facade`),r=require(`@univerjs/sheets/facade`);var i=class extends n.FWorkbookHyperLinkMixin{navigateToSheetHyperlink(n){let r=this._injector.get(e.SheetsHyperLinkParserService),i=this._injector.get(t.SheetsHyperLinkResolverService),a=r.parseHyperLink(n);i.navigate(a)}};r.FWorkbook.extend(i);
package/lib/cjs/index.js CHANGED
@@ -1 +1,32 @@
1
- "use strict";var At=Object.defineProperty;var $t=(t,n,e)=>n in t?At(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var V=(t,n,e)=>$t(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),_=require("@univerjs/sheets"),R=require("@univerjs/sheets-ui"),me=require("@univerjs/docs"),Q=require("@univerjs/docs-ui"),_e=require("@univerjs/engine-render"),S=require("@univerjs/ui"),D=require("rxjs"),y=require("react/jsx-runtime"),T=require("@univerjs/design"),z=require("@univerjs/engine-formula"),Bt=require("@univerjs/sheets-formula-ui"),m=require("@univerjs/sheets-hyper-link"),C=require("react"),mt=require("@univerjs/sheets-data-validation");var f=(t=>(t.EDITING="editing",t.VIEWING="viewing",t.ZEN_EDITOR="zen_mode",t))(f||{});function Le(t){return s.Tools.isLegalUrl(t)}function Vt(t){return/^[a-zA-Z]+:\/\//.test(t)}function Ft(t){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t)}function Zt(t){if(Le(t)){const n=Vt(t)?t:Ft(t)?`mailto://${t}`:`http://${t}`;let e;try{e=new URL(n)}catch{return t}return e.hostname===location.hostname&&e.port===location.port&&e.protocol===location.protocol&&e.pathname===location.pathname&&e.hash&&!e.search?e.hash:n}return t}const Rt="sheets-hyper-link-ui.config",St={};var Kt=Object.getOwnPropertyDescriptor,Wt=(t,n,e,r)=>{for(var i=r>1?void 0:r?Kt(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},ue=(t,n)=>(e,r)=>n(e,r,t);function Yt(t,n){const e=n.getMergeData(),r=n.getMaxColumns()-1,i=n.getMaxRows()-1;if(r<t.endColumn&&(t.endColumn=r),i<t.endRow&&(t.endRow=i),t.rangeType===s.RANGE_TYPE.COLUMN||s.RANGE_TYPE.ROW)return t;const o=[];return e.forEach(a=>{s.Rectangle.intersects(t,a)&&o.push(a)}),s.Rectangle.realUnion(t,...o)}exports.SheetsHyperLinkResolverService=class{constructor(n,e,r,i,o,a){this._univerInstanceService=n,this._commandService=e,this._definedNamesService=r,this._messageService=i,this._localeService=o,this._configService=a}navigate(n){n.type===m.SheetHyperLinkType.URL?this.navigateToOtherWebsite(n.url):this._navigateToUniver(n.searchObj)}_navigateToUniver(n){const{gid:e,range:r,rangeid:i}=n,o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!o)return;const a=o.getUnitId();if(i){const u=this._definedNamesService.getValueById(a,i);if(!u)return;const{formulaOrRefString:l}=u,h=this._definedNamesService.getWorksheetByRef(a,l);if(!h){this._messageService.show({content:this._localeService.t("hyperLink.message.refError"),type:T.MessageType.Error});return}if(h.isSheetHidden()){this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:T.MessageType.Error});return}this.navigateToDefineName(a,i)}if(e){if(r){const u=z.deserializeRangeWithSheet(r);s.isValidRange(u.range)&&r!==m.ERROR_RANGE&&this.navigateToRange(a,e,u.range);return}this.navigateToSheetById(a,e)}}async navigateToRange(n,e,r,i){const o=await this.navigateToSheetById(n,e);if(o){const a=Yt(r,o);await this._commandService.executeCommand(_.SetSelectionsOperation.id,{unitId:n,subUnitId:e,selections:[{range:a,primary:null}]}),await this._commandService.executeCommand(R.ScrollToRangeOperation.id,{range:a,forceTop:i})}}async navigateToSheetById(n,e){const r=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const i=r.getActiveSheet();if(!i)return!1;if(i.getSheetId()===e)return i;const o=r.getSheetBySheetId(e);return o?r.getHiddenWorksheets().indexOf(e)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:T.MessageType.Error}),!1):await this._commandService.executeCommand(_.SetWorksheetActiveOperation.id,{unitId:n,subUnitId:e})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:T.MessageType.Error}),!1)}async navigateToDefineName(n,e){return this._definedNamesService.focusRange(n,e),!0}async navigateToOtherWebsite(n){var r;const e=this._configService.getConfig(Rt);if((r=e==null?void 0:e.urlHandler)!=null&&r.navigateToOtherWebsite)return e.urlHandler.navigateToOtherWebsite(n);window.open(n,"_blank","noopener noreferrer")}};exports.SheetsHyperLinkResolverService=Wt([ue(0,s.IUniverInstanceService),ue(1,s.ICommandService),ue(2,z.IDefinedNamesService),ue(3,S.IMessageService),ue(4,s.Inject(s.LocaleService)),ue(5,s.IConfigService)],exports.SheetsHyperLinkResolverService);class Ge extends s.Disposable{constructor(){super(...arguments);V(this,"_customHyperLinks",new Map)}isBuiltInLinkType(e){return e!==m.SheetHyperLinkType.URL}getOptions(){return Array.from(this._customHyperLinks.values()).map(({option:e})=>e)}findCustomHyperLink(e){return Array.from(this._customHyperLinks.values()).find(i=>i.match(e))}registerCustomHyperLink(e){this._customHyperLinks.set(e.type,e)}getCustomHyperLink(e){return this._customHyperLinks.get(e)}removeCustomHyperLink(e){const{_customHyperLinks:r}=this;r.delete(e)}dispose(){super.dispose(),this._customHyperLinks.clear()}}const Pe=()=>{var nt;const[t,n]=C.useState(""),[e,r]=C.useState(!1),[i,o]=C.useState(""),[a,u]=C.useState(!0),[l,h]=C.useState(m.SheetHyperLinkType.URL),[d,p]=C.useState(""),I=S.useDependency(s.LocaleService),v=S.useDependency(z.IDefinedNamesService),E=S.useDependency(R.IEditorBridgeService),P=S.useDependency(s.IUniverInstanceService),L=S.useDependency(exports.SheetsHyperLinkPopupService),c=S.useObservable(L.currentEditing$),k=S.useDependency(m.SheetsHyperLinkParserService),M=S.useDependency(exports.SheetsHyperLinkResolverService),N=S.useDependency(s.ICommandService),H=S.useDependency(Ge),$=C.useMemo(()=>H.getOptions(),[H]),A=S.useDependency(S.IZenZoneService),Y=S.useDependency(_e.IRenderManagerService),ee=S.useDependency(R.IMarkSelectionService),ye=S.useDependency(me.DocSelectionManagerService),te=S.useDependency(s.IContextService),le=S.useDependency(s.ThemeService),de=S.useDependency(me.DocSelectionManagerService),[pe,fe]=C.useState(!1),oe=S.useDependency(_.SheetsSelectionsService),Nt=C.useMemo(()=>oe.getCurrentSelections(),[]),Ce=C.useMemo(()=>{if(!H.isBuiltInLinkType(l))return H.getCustomHyperLink(l)},[H,l]),[ae,Ht]=C.useState(!1),[he,et]=C.useState(!1),B=C.useRef(!1),F=P.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),Ut=(F==null?void 0:F.getActiveSheet().getSheetId())||"",q=C.useCallback(g=>{o(g.replaceAll(s.DataStreamTreeTokenType.CUSTOM_RANGE_START,"").replaceAll(s.DataStreamTreeTokenType.CUSTOM_RANGE_END,""))},[o]);C.useEffect(()=>{var g,w,b,O,x,Z,rt,it,st,ot,at,ct,ut,lt,dt,pt,ht;if((c==null?void 0:c.row)!==void 0&&c.col!==void 0){const{customRange:ne,row:Fe,col:Ze}=c;let{label:G}=c;typeof G=="number"&&(G=`${G}`);let K;if(ne)K={id:(g=ne==null?void 0:ne.rangeId)!=null?g:"",display:G!=null?G:"",payload:(b=(w=ne==null?void 0:ne.properties)==null?void 0:w.url)!=null?b:"",row:Fe,column:Ze};else if(c.type===f.VIEWING){const U=P.getUnit(c.unitId),J=U==null?void 0:U.getSheetBySheetId(c.subUnitId),j=J==null?void 0:J.getCellRaw(c.row,c.col),ce=(Z=(x=(O=j==null?void 0:j.p)==null?void 0:O.body)==null?void 0:x.customRanges)==null?void 0:Z.find(vt=>{var It;return vt.rangeType===s.CustomRangeType.HYPERLINK&&((It=vt.properties)==null?void 0:It.url)}),ge=j==null?void 0:j.v;j&&(!s.BuildTextUtils.transform.isEmptyDocument((it=(rt=j.p)==null?void 0:rt.body)==null?void 0:it.dataStream)||s.Tools.isDefine(ge))&&u(!1),K={id:"",display:"",payload:(ot=(st=ce==null?void 0:ce.properties)==null?void 0:st.url)!=null?ot:"",row:Fe,column:Ze}}else{const U=P.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),J=ye.getActiveTextRange(),j=U==null?void 0:U.getBody(),ce=J&&j?J:null,ge=ce&&((ct=s.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(ce,(at=j==null?void 0:j.customRanges)!=null?at:[]))==null?void 0:ct[0]);u(!1),K={id:"",display:G!=null?G:"",payload:(lt=(ut=ge==null?void 0:ge.properties)==null?void 0:ut.url)!=null?lt:"",row:Fe,column:Ze}}n(K.id);const gt=H.findCustomHyperLink(K);if(gt){const U=gt.convert(K);h(U.type),p(U.payload),q(U.display);return}q(K.display);const X=k.parseHyperLink(K.payload);switch(h(X.type===m.SheetHyperLinkType.INVALID?m.SheetHyperLinkType.RANGE:X.type),X.type){case m.SheetHyperLinkType.URL:{p(X.url),X.url===K.display&&(B.current=!0);break}case m.SheetHyperLinkType.RANGE:{const U=X.searchObj,J=U.gid&&(ht=(pt=(dt=P.getUnit(c.unitId))==null?void 0:dt.getSheetBySheetId(U.gid))==null?void 0:pt.getName())!=null?ht:"",j=z.serializeRangeWithSheet(J,z.deserializeRangeWithSheet(U.range).range);p(j),j===K.display&&(B.current=!0);break}case m.SheetHyperLinkType.SHEET:{const U=X.searchObj;p(U.gid);break}case m.SheetHyperLinkType.DEFINE_NAME:{const U=X.searchObj;p(U.rangeid);break}default:p("");break}}},[c,M,H,ye,P]),C.useEffect(()=>{let g=null;if(c&&!c.customRangeId&&c.type===f.VIEWING&&s.Tools.isDefine(c.row)&&s.Tools.isDefine(c.col)){const w=P.getUnit(c.unitId,s.UniverInstanceType.UNIVER_SHEET),b=w==null?void 0:w.getSheetBySheetId(c.subUnitId),O=b==null?void 0:b.getMergedCell(c.row,c.col),x=new s.ColorKit(le.getColorFromTheme("primary.600")).toRgb();g=ee.addShape({range:O!=null?O:{startColumn:c.col,endColumn:c.col,startRow:c.row,endRow:c.row},style:{fill:`rgb(${x.r}, ${x.g}, ${x.b}, 0.12)`,strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1)}return()=>{g&&ee.removeShape(g)}},[c,ee,le,P]),C.useEffect(()=>{et(l===m.SheetHyperLinkType.RANGE)},[l]),C.useEffect(()=>{const g=(c==null?void 0:c.type)===f.ZEN_EDITOR?Y.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY):Y.getRenderById(E.getCurrentEditorId()),w=new s.DisposableCollection;if(g){const b=g.with(Q.DocSelectionRenderService);b.setReserveRangesStatus(!0),w.add(()=>{b.setReserveRangesStatus(!1)})}return()=>{E.disableForceKeepVisible(),w.dispose()}},[c==null?void 0:c.type,E,Y]),C.useEffect(()=>(he&&L.setIsKeepVisible(he),L.setIsKeepVisible(pe),()=>{L.setIsKeepVisible(!1)}),[he,pe,L]),C.useEffect(()=>()=>{A.temporaryHidden&&(A.show(),te.setContextValue(s.FOCUSING_SHEET,!1))},[te,A]),C.useEffect(()=>{if(he)return E.enableForceKeepVisible(),()=>{E.disableForceKeepVisible()}},[he,E]);const xt=[{label:I.t("hyperLink.form.link"),value:m.SheetHyperLinkType.URL},{label:I.t("hyperLink.form.range"),value:m.SheetHyperLinkType.RANGE},{label:I.t("hyperLink.form.worksheet"),value:m.SheetHyperLinkType.SHEET},{label:I.t("hyperLink.form.definedName"),value:m.SheetHyperLinkType.DEFINE_NAME},...$];if(!F)return;const Mt=F.getHiddenWorksheets(),$e=F.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>Mt.indexOf(g.value)===-1),Be=Object.values((nt=v.getDefinedNameMap(F.getUnitId()))!=null?nt:{}).map(g=>({label:g.name,value:g.id})),tt=(g,w)=>{if(g===m.SheetHyperLinkType.URL)return Zt(w);if(g===m.SheetHyperLinkType.RANGE){const b=z.deserializeRangeWithSheet(w),O=F.getSheetBySheetName(b.sheetName);if(O)return`#gid=${O.getSheetId()}&range=${z.serializeRange(b.range)}`}return`#${g}=${w}`},jt=S.useEvent(g=>{var x;const b=g.split(",").map(z.deserializeRangeWithSheet)[0];if(!b||!s.isValidRange(b.range))return;b.sheetName||(b.sheetName=((x=F.getActiveSheet())==null?void 0:x.getName())||"");const O=z.serializeRangeToRefString(b);p(O),O&&(B.current||!i)&&(q(O),B.current=!0)}),Ve=async()=>{if(a&&!i||!d||l===m.SheetHyperLinkType.URL&&!Le(d)){Ht(!0);return}if(c)if(t){const g=c.type===f.ZEN_EDITOR||c.type===f.EDITING?m.UpdateRichHyperLinkCommand.id:m.UpdateHyperLinkCommand.id;await N.executeCommand(g,{id:t,unitId:c.unitId,subUnitId:c.subUnitId,payload:{display:a?i:"",payload:tt(l,d)},row:c.row,column:c.col,documentId:c.type===f.ZEN_EDITOR?s.DOCS_ZEN_EDITOR_UNIT_ID_KEY:E.getCurrentEditorId()})}else{const g=c.type===f.ZEN_EDITOR||c.type===f.EDITING?m.AddRichHyperLinkCommand.id:m.AddHyperLinkCommand.id;await N.executeCommand(g,{unitId:c.unitId,subUnitId:c.subUnitId,link:{id:s.generateRandomId(),row:c.row,column:c.col,payload:tt(l,d),display:a?i:""},documentId:c.type===f.ZEN_EDITOR?s.DOCS_ZEN_EDITOR_UNIT_ID_KEY:E.getCurrentEditorId()})}if((c==null?void 0:c.type)===f.VIEWING){await N.executeCommand(_.SetWorksheetActiveOperation.id,{unitId:c.unitId,subUnitId:c.subUnitId});const g=1;await N.executeCommand(R.ScrollToRangeOperation.id,{range:{startRow:Math.max(c.row-g,0),endRow:c.row+g,startColumn:Math.max(c.col-g,0),endColumn:c.col+g}})}N.executeCommand(Se.id)};return c?y.jsxs("div",{className:T.clsx("univer-box-border univer-w-[296px] univer-rounded-xl univer-bg-white univer-p-4 univer-shadow-md dark:!univer-bg-gray-900",T.borderClassName),children:[a?y.jsx(T.FormLayout,{label:I.t("hyperLink.form.label"),error:ae&&!i?I.t("hyperLink.form.inputError"):"",children:y.jsx(T.Input,{value:i,onChange:g=>{q(g),B.current=!1},placeholder:I.t("hyperLink.form.labelPlaceholder"),autoFocus:!0,onKeyDown:g=>{g.keyCode===S.KeyCode.ENTER&&Ve()}})}):null,y.jsx(T.FormLayout,{label:I.t("hyperLink.form.type"),children:y.jsx(T.Select,{className:"univer-w-full",options:xt,value:l,onChange:g=>{h(g),p("")}})}),l===m.SheetHyperLinkType.URL&&y.jsx(T.FormLayout,{error:ae?d?Le(d)?"":I.t("hyperLink.form.linkError"):I.t("hyperLink.form.inputError"):"",children:y.jsx(T.Input,{value:d,onChange:g=>{p(g),g&&(B.current||!i||i===g)&&(q(g),B.current=!0)},placeholder:I.t("hyperLink.form.linkPlaceholder"),autoFocus:!0,onKeyDown:g=>{g.keyCode===S.KeyCode.ENTER&&Ve()}})}),l===m.SheetHyperLinkType.RANGE&&y.jsx(T.FormLayout,{error:ae&&!d?I.t("hyperLink.form.inputError"):"",children:y.jsx(Bt.RangeSelector,{unitId:F.getUnitId(),subUnitId:Ut,maxRangeCount:1,supportAcrossSheet:!0,initialValue:d,resetRange:Nt,onChange:(g,w)=>jt(w),onRangeSelectorDialogVisibleChange:async g=>{var w,b;if(fe(g),g)c.type===f.ZEN_EDITOR&&(A.hide(),te.setContextValue(s.FOCUSING_SHEET,!0)),c.type!==f.VIEWING&&E.enableForceKeepVisible(),r(!0);else{if(await M.navigateToRange(c.unitId,c.subUnitId,{startRow:c.row,endRow:c.row,startColumn:c.col,endColumn:c.col},!0),c.type===f.ZEN_EDITOR){await N.executeCommand(_.SetSelectionsOperation.id,{unitId:c.unitId,subUnitId:c.subUnitId,selections:[{range:{startRow:c.row,endRow:c.row,startColumn:c.col,endColumn:c.col}}]}),A.show(),te.setContextValue(s.FOCUSING_SHEET,!1);const O=(w=Y.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:w.with(Q.DocBackScrollRenderController),x=(b=de.getTextRanges({unitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))==null?void 0:b[0];O&&x&&(O.scrollToRange(x),de.refreshSelection({unitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))}E.disableForceKeepVisible(),r(!1)}},onFocusChange:g=>et(g)})}),l===m.SheetHyperLinkType.SHEET&&y.jsx(T.FormLayout,{error:ae&&!d?I.t("hyperLink.form.selectError"):"",children:y.jsx(T.Select,{className:"univer-w-full",options:$e,value:d,onChange:g=>{var O,x;p(g);const w=(O=$e.find(Z=>Z.value===g))==null?void 0:O.label,b=(x=$e.find(Z=>Z.value===d))==null?void 0:x.label;w&&(B.current||!i||i===b)&&(q(w),B.current=!0)}})}),l===m.SheetHyperLinkType.DEFINE_NAME&&y.jsx(T.FormLayout,{error:ae&&!d?I.t("hyperLink.form.selectError"):"",children:y.jsx(T.Select,{className:"univer-w-full",options:Be,value:d,onChange:g=>{var O,x;p(g);const w=(O=Be.find(Z=>Z.value===g))==null?void 0:O.label,b=(x=Be.find(Z=>Z.value===d))==null?void 0:x.label;w&&(B.current||!i||i===b)&&(q(w),B.current=!0)}})}),(Ce==null?void 0:Ce.Form)&&y.jsx(Ce.Form,{linkId:t,payload:d,display:i,showError:ae,setByPayload:B,setDisplay:g=>{q(g),B.current=!0},setPayload:p}),y.jsxs("div",{className:"univer-flex univer-flex-row univer-justify-end univer-gap-2",children:[y.jsx(T.Button,{onClick:()=>{c&&M.navigateToRange(c.unitId,c.subUnitId,{startRow:c.row,endRow:c.row,startColumn:c.col,endColumn:c.col},!0),N.executeCommand(Se.id)},children:I.t("hyperLink.form.cancel")}),y.jsx(T.Button,{variant:"primary",onClick:async()=>{Ve()},children:I.t("hyperLink.form.ok")})]})]}):null};Pe.componentKey="univer.sheet.cell-link-edit";function se({ref:t,...n}){const{icon:e,id:r,className:i,extend:o,...a}=n,u=`univerjs-icon univerjs-icon-${r} ${i||""}`.trim(),l=C.useRef(`_${qt()}`);return Lt(e,`${r}`,{defIds:e.defIds,idSuffix:l.current},{ref:t,className:u,...a},o)}function Lt(t,n,e,r,i){return C.createElement(t.tag,{key:n,...Gt(t,e,i),...r},(zt(t,e).children||[]).map((o,a)=>Lt(o,`${n}-${t.tag}-${a}`,e,void 0,i)))}function Gt(t,n,e){const r={...t.attrs};e!=null&&e.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=e.colorChannel1),t.tag==="mask"&&r.id&&(r.id=r.id+n.idSuffix),Object.entries(r).forEach(([o,a])=>{o==="mask"&&typeof a=="string"&&(r[o]=a.replace(/url\(#(.*)\)/,`url(#$1${n.idSuffix})`))});const{defIds:i}=n;return!i||i.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+n.idSuffix),Object.entries(r).forEach(([o,a])=>{typeof a=="string"&&(r[o]=a.replace(/url\(#(.*)\)/,`url(#$1${n.idSuffix})`))})),r}function zt(t,n){var r;const{defIds:e}=n;return!e||e.length===0?t:t.tag==="defs"&&((r=t.children)!=null&&r.length)?{...t,children:t.children.map(i=>typeof i.attrs.id=="string"&&e&&e.includes(i.attrs.id)?{...i,attrs:{...i.attrs,id:i.attrs.id+n.idSuffix}}:i)}:t}function qt(){return Math.random().toString(36).substring(2,8)}se.displayName="UniverIcon";const Xt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},Re=C.forwardRef(function(n,e){return C.createElement(se,Object.assign({},n,{id:"all-border-icon",ref:e,icon:Xt}))});Re.displayName="AllBorderIcon";const Jt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},Pt=C.forwardRef(function(n,e){return C.createElement(se,Object.assign({},n,{id:"copy-icon",ref:e,icon:Jt}))});Pt.displayName="CopyIcon";const Qt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},ze=C.forwardRef(function(n,e){return C.createElement(se,Object.assign({},n,{id:"link-icon",ref:e,icon:Qt}))});ze.displayName="LinkIcon";const en={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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.76157C6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449C14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797C11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.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.05395C4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092C3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721C8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332C2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302C13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332Z"}}]},Tt=C.forwardRef(function(n,e){return C.createElement(se,Object.assign({},n,{id:"unlink-icon",ref:e,icon:en}))});Tt.displayName="UnlinkIcon";const tn={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},kt=C.forwardRef(function(n,e){return C.createElement(se,Object.assign({},n,{id:"write-icon",ref:e,icon:tn}))});kt.displayName="WriteIcon";const nn={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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:"white",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"}}]},wt=C.forwardRef(function(n,e){return C.createElement(se,Object.assign({},n,{id:"xlsx-multi-icon",ref:e,icon:nn}))});wt.displayName="XlsxMultiIcon";const rn={[m.SheetHyperLinkType.URL]:y.jsx(ze,{}),[m.SheetHyperLinkType.SHEET]:y.jsx(wt,{className:"univer-text-green-500"}),[m.SheetHyperLinkType.RANGE]:y.jsx(Re,{}),[m.SheetHyperLinkType.DEFINE_NAME]:y.jsx(Re,{}),[m.SheetHyperLinkType.INVALID]:y.jsx(Re,{})},_t=t=>{var M,N;const n=S.useDependency(exports.SheetsHyperLinkPopupService),e=S.useDependency(s.ICommandService),r=S.useDependency(S.IMessageService),i=S.useDependency(s.LocaleService),o=S.useDependency(exports.SheetsHyperLinkResolverService),a=S.useDependency(R.IEditorBridgeService),u=S.useDependency(m.SheetsHyperLinkParserService),l=S.useDependency(S.IZenZoneService),{customRange:h,row:d,col:p,unitId:I,subUnitId:v,editPermission:E,copyPermission:P,type:L}=t;if(!((M=h==null?void 0:h.properties)!=null&&M.url))return null;const c=u.parseHyperLink((N=h.properties.url)!=null?N:""),k=c.type===m.SheetHyperLinkType.INVALID;return y.jsxs("div",{className:T.clsx("univer-mb-1 univer-flex univer-max-w-80 univer-flex-row univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-white univer-p-3 univer-shadow-md dark:!univer-bg-gray-900",T.borderClassName),onClick:()=>n.hideCurrentPopup(),children:[y.jsxs("div",{className:T.clsx("univer-flex univer-h-6 univer-flex-1 univer-cursor-pointer univer-flex-row univer-items-center univer-truncate univer-text-sm univer-leading-5 univer-text-primary-600",{"univer-text-red-500":k}),onClick:()=>{l.visible||k||o.navigate(c)},children:[y.jsx("div",{className:"univer-mr-2 univer-flex univer-size-5 univer-flex-none univer-items-center univer-justify-center univer-text-base univer-text-gray-900 dark:!univer-text-white",children:rn[c.type]}),y.jsx(T.Tooltip,{showIfEllipsis:!0,title:c.name,asChild:!0,children:y.jsx("span",{className:"univer-flex-1 univer-truncate",children:c.name})})]}),y.jsxs("div",{className:"univer-flex univer-h-6 univer-flex-none univer-flex-row univer-items-center univer-justify-center",children:[P&&y.jsx("div",{className:T.clsx("univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-red-500":k}),onClick:()=>{if(!k){if(c.type!==m.SheetHyperLinkType.URL){const H=new URL(window.location.href);H.hash=c.url.slice(1),navigator.clipboard.writeText(H.href)}else navigator.clipboard.writeText(c.url);r.show({content:i.t("hyperLink.message.coped"),type:T.MessageType.Info})}},children:y.jsx(T.Tooltip,{placement:"bottom",title:i.t("hyperLink.popup.copy"),children:y.jsx(Pt,{className:"dark:!univer-text-white"})})}),E&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",onClick:()=>{e.executeCommand(Me.id,{unitId:I,subUnitId:v,row:d,col:p,customRangeId:h.rangeId,type:L})},children:y.jsx(T.Tooltip,{placement:"bottom",title:i.t("hyperLink.popup.edit"),children:y.jsx(kt,{className:"dark:!univer-text-white"})})}),y.jsx("div",{className:"univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",onClick:()=>{const H=L===f.EDITING||L===f.ZEN_EDITOR?m.CancelRichHyperLinkCommand.id:m.CancelHyperLinkCommand.id;e.syncExecuteCommand(H,{unitId:I,subUnitId:v,id:h.rangeId,row:d,column:p,documentId:L===f.ZEN_EDITOR?s.DOCS_ZEN_EDITOR_UNIT_ID_KEY:a.getCurrentEditorId()})&&n.hideCurrentPopup(void 0,!0)},children:y.jsx(T.Tooltip,{placement:"bottom",title:i.t("hyperLink.popup.cancel"),children:y.jsx(Tt,{className:"dark:!univer-text-white"})})})]})]})]})},Te=()=>{var i,o;const t=S.useDependency(exports.SheetsHyperLinkPopupService),[n,e]=C.useState(null),r=S.useDependency(s.IUniverInstanceService);if(C.useEffect(()=>{e(t.currentPopup);const a=t.currentPopup$.subscribe(u=>{e(u)});return()=>{a.unsubscribe()}},[t.currentPopup,t.currentPopup$]),!n)return null;if(n.showAll){const a=r.getUnit(n.unitId,s.UniverInstanceType.UNIVER_SHEET),u=a==null?void 0:a.getSheetBySheetId(n.subUnitId),l=u==null?void 0:u.getCell(n.row,n.col),h=(o=(i=l==null?void 0:l.p)==null?void 0:i.body)==null?void 0:o.customRanges;return h!=null&&h.length?y.jsx("div",{children:h.map(d=>y.jsx(_t,{...n,customRange:d},d.rangeId))}):null}return y.jsx(_t,{...n})};Te.componentKey="univer.sheet.cell-link-popup";var sn=Object.getOwnPropertyDescriptor,on=(t,n,e,r)=>{for(var i=r>1?void 0:r?sn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},re=(t,n)=>(e,r)=>n(e,r,t);const yt=(t,n)=>{var e,r;return t.unitId===n.unitId&&t.subUnitId===n.subUnitId&&t.row===n.row&&t.col===n.col&&((e=t.customRange)==null?void 0:e.rangeId)===((r=n.customRange)==null?void 0:r.rangeId)&&t.type===n.type};exports.SheetsHyperLinkPopupService=class extends s.Disposable{constructor(e,r,i,o,a,u,l){super();V(this,"_currentPopup",null);V(this,"_currentPopup$",new D.Subject);V(this,"currentPopup$",this._currentPopup$.asObservable());V(this,"_currentEditingPopup",null);V(this,"_currentEditing$",new D.BehaviorSubject(null));V(this,"currentEditing$",this._currentEditing$.asObservable());V(this,"_isKeepVisible",!1);this._sheetCanvasPopManagerService=e,this._injector=r,this._univerInstanceService=i,this._editorBridgeService=o,this._textSelectionManagerService=a,this._docCanvasPopManagerService=u,this._zenZoneService=l,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}setIsKeepVisible(e){this._isKeepVisible=e}getIsKeepVisible(){return this._isKeepVisible}showPopup(e){var I;if(this._currentPopup&&yt(e,this._currentPopup)||(this.hideCurrentPopup(void 0,!0),e.type!==f.ZEN_EDITOR&&this._zenZoneService.visible))return;const r=this._currentEditing$.getValue();if(r&&yt(e,r))return;const{unitId:i,subUnitId:o,row:a,col:u,customRangeRect:l,customRange:h}=e;let d;const p={componentKey:Te.componentKey,direction:"bottom",onClickOutside:()=>{this.hideCurrentPopup()},onClick:()=>{this.hideCurrentPopup(e.type,!0)}};if(e.type===f.EDITING){if(!h)return;d=l&&this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(l,p)}else if(e.type===f.ZEN_EDITOR){if(!h)return;d=this._docCanvasPopManagerService.attachPopupToRange({startOffset:h.startIndex,endOffset:h.endIndex+1,collapsed:!1},p,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(e.showAll)d=this._sheetCanvasPopManagerService.attachPopupToCell(e.row,e.col,p,i,o);else{if(!h)return;d=l&&this._sheetCanvasPopManagerService.attachPopupByPosition(l,p,e)}d&&(this._currentPopup&&((I=this._currentPopup.disposable)==null||I.dispose()),this._currentPopup={unitId:i,subUnitId:o,disposable:d,row:a,col:u,editPermission:!!e.editPermission,copyPermission:!!e.copyPermission,customRange:h,type:e.type,showAll:e.showAll},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(e,r){var i,o;this._currentPopup&&((!e||e===this._currentPopup.type)&&this._currentPopup.disposable.canDispose()||r)&&((o=(i=this._currentPopup)==null?void 0:i.disposable)==null||o.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}dispose(){super.dispose(),this.hideCurrentPopup(),this.endEditing(),this._currentPopup$.complete(),this._currentEditing$.complete()}_getEditingRange(){var i,o,a;const e=this._editorBridgeService.isVisible().visible,r=this._editorBridgeService.getEditCellState();if(e&&r){const u=this._textSelectionManagerService.getActiveTextRange(),l=(i=r.documentLayoutObject.documentModel)==null?void 0:i.getBody();if(!l)return null;if(!u||u.collapsed)return{startOffset:0,endOffset:l.dataStream.length-2,collapsed:l.dataStream.length-2===0,label:s.BuildTextUtils.transform.getPlainText(l.dataStream)};const h=s.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(u,(a=(o=l.customRanges)==null?void 0:o.filter(I=>I.rangeType===s.CustomRangeType.HYPERLINK))!=null?a:[]);let d=u.startOffset,p=u.endOffset;return h.forEach(I=>{d=Math.min(d,I.startIndex),p=Math.max(p,I.endIndex+1)}),{startOffset:d,endOffset:p,collapsed:d===p,label:s.BuildTextUtils.transform.getPlainText(l.dataStream.slice(d,p))}}return null}get _editPopup(){return{componentKey:Pe.componentKey,direction:"vertical",onClickOutside:()=>{this.endEditing()},onContextMenu:()=>{this.endEditing()},hiddenType:"hide"}}startAddEditing(e){var a,u,l,h,d;const{unitId:r,subUnitId:i,type:o}=e;if(o===f.ZEN_EDITOR){const p=this._univerInstanceService.getUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,s.UniverInstanceType.UNIVER_DOC);if(!p)return;const I=this._textSelectionManagerService.getActiveTextRange();if(!I)return;this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange(I,this._editPopup,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const v=(a=p.getBody())==null?void 0:a.dataStream.slice(I.startOffset,I.endOffset);this._currentEditing$.next({...e,label:v})}else if(o===f.EDITING){const p=this._getEditingRange();if(!p)return;this._textSelectionManagerService.replaceDocRanges([{...p}],{unitId:s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,subUnitId:s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY});const I=this._injector.get(_e.IRenderManagerService).getRenderById(s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);if(!I)return;const v=Q.calcDocRangePositions(p,I);if(!(v!=null&&v.length))return;this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(v.pop(),this._editPopup,r,i),this._currentEditing$.next({...e,label:(u=p==null?void 0:p.label)!=null?u:""})}else{this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(e.row,e.col,this._editPopup,r,i);const p=this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_SHEET),I=p==null?void 0:p.getSheetBySheetId(i),v=I==null?void 0:I.getCellRaw(e.row,e.col);this._currentEditing$.next({...e,label:v!=null&&v.p?s.BuildTextUtils.transform.getPlainText((h=(l=v.p.body)==null?void 0:l.dataStream)!=null?h:""):((d=v==null?void 0:v.v)!=null?d:"").toString()})}}startEditing(e){var u,l,h,d,p,I;(u=this._currentEditingPopup)==null||u.dispose(),this.hideCurrentPopup(void 0,!0);const{unitId:r,subUnitId:i}=e;let o,a;if(e.type===f.ZEN_EDITOR){const v=this._univerInstanceService.getUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,s.UniverInstanceType.UNIVER_DOC);if(o=(h=(l=v==null?void 0:v.getBody())==null?void 0:l.customRanges)==null?void 0:h.find(E=>E.rangeId===e.customRangeId),a=o?(d=v==null?void 0:v.getBody())==null?void 0:d.dataStream.slice(o.startIndex,o.endIndex+1):"",!o||!a)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:o.startIndex,endOffset:o.endIndex+1}]),this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange({startOffset:o.startIndex,endOffset:o.endIndex,collapsed:!1},this._editPopup,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(e.type===f.EDITING){const v=R.getEditingCustomRangePosition(this._injector,e.unitId,e.subUnitId,e.row,e.col,e.customRangeId);if(!v||!((p=v.rects)!=null&&p.length))return;o=v.customRange,a=v.label,this._textSelectionManagerService.replaceTextRanges([{startOffset:o.startIndex,endOffset:o.endIndex+1}]),this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(v.rects.pop(),this._editPopup,r,i)}else{const v=this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_SHEET),E=v==null?void 0:v.getSheetBySheetId(i),P=E==null?void 0:E.getCellRaw(e.row,e.col),L=v==null?void 0:v.getStyles().getStyleByCell(P),c=L==null?void 0:L.tr,k=R.getCustomRangePosition(this._injector,e.unitId,e.subUnitId,e.row,e.col,e.customRangeId);if(!k||!((I=k.rects)!=null&&I.length))return;o=k.customRange,a=k.label,c?this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(e.row,e.col,this._editPopup,r,i):this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupByPosition(k.rects.pop(),this._editPopup,{unitId:r,subUnitId:i,row:e.row,col:e.col})}this._currentEditing$.next({...e,customRange:o,label:a})}endEditing(e){var i;if(this.getIsKeepVisible())return;const r=this._currentEditing$.getValue();r&&(!e||e===r.type)&&((i=this._currentEditingPopup)==null||i.dispose(),this._currentEditing$.next(null))}};exports.SheetsHyperLinkPopupService=on([re(0,s.Inject(R.SheetCanvasPopManagerService)),re(1,s.Inject(s.Injector)),re(2,s.IUniverInstanceService),re(3,R.IEditorBridgeService),re(4,s.Inject(me.DocSelectionManagerService)),re(5,s.Inject(Q.DocCanvasPopManagerService)),re(6,S.IZenZoneService)],exports.SheetsHyperLinkPopupService);var Ie=(t=>(t[t.ALLOWED=0]="ALLOWED",t[t.DISABLED_BY_CELL=1]="DISABLED_BY_CELL",t[t.ALLOW_ON_EDITING=2]="ALLOW_ON_EDITING",t))(Ie||{});const an=new Set([s.DataValidationType.CHECKBOX,s.DataValidationType.LIST,s.DataValidationType.LIST_MULTIPLE]),qe=(t,n,e,r)=>{var u,l,h,d,p;const i=n.getCell(e,r);if(i!=null&&i.f||i!=null&&i.si||(h=(l=(u=i==null?void 0:i.p)==null?void 0:u.body)==null?void 0:l.customBlocks)!=null&&h.length)return 1;const o=t.has(mt.SheetDataValidationModel)?t.get(mt.SheetDataValidationModel):null,a=o==null?void 0:o.getRuleByLocation(n.getUnitId(),n.getSheetId(),e,r);return a&&an.has(a.type)?!0:(p=(d=i==null?void 0:i.p)==null?void 0:d.drawingsOrder)!=null&&p.length?2:0},cn=t=>{const n=t.get(s.IUniverInstanceService).getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!n)return!0;const e=n.getActiveSheet(),r=t.get(_.SheetsSelectionsService).getCurrentSelections();if(!r.length)return!0;const i=r[0].range.startRow,o=r[0].range.startColumn;return qe(t,e,i,o)===1},un=t=>{const n=t.get(me.DocSelectionManagerService),e=t.get(s.IUniverInstanceService),r=n.getTextRanges();if(!(r!=null&&r.length))return!0;const i=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);return!!(!i||r.every(a=>a.collapsed)||!i.getSelfOrHeaderFooterModel(r[0].segmentId).getBody())},Me={type:s.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-edit-panel",handler(t,n){if(!n)return!1;const e=t.get(exports.SheetsHyperLinkPopupService);return n.customRangeId?e.startEditing(n):e.startAddEditing(n),!0}},Se={type:s.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-popup",handler(t){return t.get(exports.SheetsHyperLinkPopupService).endEditing(),!0}},je={type:s.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(t){var p;const n=t.get(s.IUniverInstanceService),e=_.getSheetCommandTarget(n),r=t.get(R.IEditorBridgeService);if(!e)return!1;const i=t.get(s.ICommandService),a=t.get(_.SheetsSelectionsService).getCurrentLastSelection();if(!a)return!1;const u=a.range.startRow,l=a.range.startColumn,h=r.isVisible(),d=((p=n.getFocusedUnit())==null?void 0:p.getUnitId())===s.DOCS_ZEN_EDITOR_UNIT_ID_KEY;return i.executeCommand(Me.id,{unitId:e.unitId,subUnitId:e.subUnitId,row:u,col:l,type:d?f.ZEN_EDITOR:h.visible?f.EDITING:f.VIEWING})}},ie={type:s.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(t){if(cn(t))return!1;const n=t.get(s.ICommandService);return t.get(exports.SheetsHyperLinkPopupService).currentEditing?n.executeCommand(Se.id):n.executeCommand(je.id)}},Xe="SHEET_HYPER_LINK_UI_PLUGIN";var ln=Object.getOwnPropertyDescriptor,dn=(t,n,e,r)=>{for(var i=r>1?void 0:r?ln(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},Ee=(t,n)=>(e,r)=>n(e,r,t);exports.SheetsHyperLinkCopyPasteController=class extends s.Disposable{constructor(e,r,i,o){super();V(this,"_plainTextFilter",new Set);V(this,"_copyInfo");this._sheetClipboardService=e,this._hyperLinkModel=r,this._injector=i,this._resolverService=o,this._initCopyPaste(),this.disposeWithMe(()=>{this._plainTextFilter.clear()})}registerPlainTextFilter(e){this._plainTextFilter.add(e)}removePlainTextFilter(e){this._plainTextFilter.delete(e)}_filterPlainText(e){return Array.from(this._plainTextFilter).every(r=>r(e))}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:Xe,onBeforeCopy:(e,r,i)=>this._collect(e,r,i),onPasteCells:(e,r,i,o)=>{const{copyType:a=R.COPY_TYPE.COPY,pasteType:u}=o,{range:l}=e||{},{range:h,unitId:d,subUnitId:p}=r;return this._generateMutations(h,{copyType:a,pasteType:u,copyRange:l,unitId:d,subUnitId:p})},onPastePlainText:(e,r)=>{const i=this._filterPlainText(r);if(Le(r)&&i){const{range:o,unitId:a,subUnitId:u}=e,{ranges:[l],mapFunc:h}=R.virtualizeDiscreteRanges([o]),d=[],p=[];return s.Range.foreach(l,(I,v)=>{const{row:E,col:P}=h(I,v),L=this._hyperLinkModel.getHyperLinkByLocation(a,u,E,P);L&&d.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:a,subUnitId:u,id:L.id}}),L&&p.push({id:m.AddHyperLinkMutation.id,params:{unitId:a,subUnitId:u,link:L}})}),{redos:d,undos:p}}return{undos:[],redos:[]}},priority:99})}_collect(e,r,i){const o=new s.ObjectMatrix;this._copyInfo={unitId:e,subUnitId:r,matrix:o};const a=this._injector.invoke(h=>_.rangeToDiscreteRange(i,h,e,r));if(!a)return;const{rows:u,cols:l}=a;u.forEach((h,d)=>{l.forEach((p,I)=>{var E;const v=this._hyperLinkModel.getHyperLinkByLocation(e,r,h,p);o.setValue(d,I,(E=v==null?void 0:v.id)!=null?E:"")})})}_generateMutations(e,r){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!r.copyRange)return{redos:[],undos:[]};if([R.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH,R.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE,R.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,R.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA].includes(r.pasteType))return{redos:[],undos:[]};const{unitId:o,subUnitId:a}=this._copyInfo,u=[],l=[],{ranges:[h,d],mapFunc:p}=R.virtualizeDiscreteRanges([r.copyRange,e]);return R.getRepeatRange(h,d,!0).forEach(({startRange:v})=>{var E;(E=this._copyInfo)==null||E.matrix.forValue((P,L,c)=>{const k=s.Rectangle.getPositionRange({startRow:P,endRow:P,startColumn:L,endColumn:L},v),M=this._hyperLinkModel.getHyperLink(o,a,c),{row:N,col:H}=p(k.startRow,k.startColumn),$=this._hyperLinkModel.getHyperLinkByLocation(r.unitId,r.subUnitId,N,H),A=s.generateRandomId();$&&u.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,id:$.id}}),M&&(u.push({id:m.AddHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,link:{...M,id:A,row:N,column:H}}}),l.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,id:A}})),$&&l.push({id:m.AddHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,link:$}})})}),{redos:u,undos:l}}};exports.SheetsHyperLinkCopyPasteController=dn([Ee(0,R.ISheetClipboardService),Ee(1,s.Inject(m.HyperLinkModel)),Ee(2,s.Inject(s.Injector)),Ee(3,s.Inject(exports.SheetsHyperLinkResolverService))],exports.SheetsHyperLinkCopyPasteController);const Je=(t,n=s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)=>{var i;const e=t.get(s.IUniverInstanceService),r=(i=t.get(_e.IRenderManagerService).getRenderById(n))==null?void 0:i.with(Q.DocSelectionRenderService);return r?r.textSelectionInner$.pipe(D.map(()=>{const a=t.get(R.IEditorBridgeService).getEditCellState();if(!a)return!0;const u=_.getSheetCommandTarget(e,{unitId:a.unitId,subUnitId:a.sheetId});return!(u!=null&&u.worksheet)||qe(t,u.worksheet,a.row,a.column)===1?!0:un(t)})):D.of(!0)},bt=t=>{var i;const n=t.get(s.IUniverInstanceService),e=t.has(R.IEditorBridgeService)?t.get(R.IEditorBridgeService):null;return((i=e==null?void 0:e.currentEditCellState$.pipe(D.map(o=>{if(!o)return Ie.DISABLED_BY_CELL;const a=_.getSheetCommandTarget(n,{unitId:o.unitId,subUnitId:o.sheetId});return a?qe(t,a.worksheet,o.row,o.column):Ie.DISABLED_BY_CELL}),D.switchMap(o=>{if(o===Ie.DISABLED_BY_CELL)return D.of(!0);const a=e?e.visible$:D.of(null);return D.combineLatest([a,n.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC)]).pipe(D.switchMap(([u,l])=>u!=null&&u.visible?(l==null?void 0:l.getUnitId())===s.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY?D.of(!0):Je(t,s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY):D.of(o!==Ie.ALLOWED)))})))!=null?i:D.of(!0)).pipe(D.switchMap(o=>o?D.of(!0):R.getCurrentRangeDisable$(t,{workbookTypes:[_.WorkbookEditablePermission],worksheetTypes:[_.WorksheetEditPermission,_.WorksheetSetCellValuePermission,_.WorksheetInsertHyperlinkPermission],rangeTypes:[_.RangeProtectionPermissionEditPoint]},!0)))},ke={commandId:je.id,type:S.MenuItemType.BUTTON,title:"hyperLink.menu.add",icon:"LinkIcon"},we=t=>`${t}-zen-editor`,pn=t=>({...ke,id:ke.commandId,hidden$:S.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_SHEET),disabled$:bt(t)}),hn=t=>({...ke,id:we(ke.commandId),hidden$:S.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_DOC,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:Je(t)}),be={tooltip:"hyperLink.form.addTitle",commandId:ie.id,type:S.MenuItemType.BUTTON,icon:"LinkIcon"},gn=t=>({...be,id:be.commandId,hidden$:S.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_SHEET),disabled$:bt(t)}),vn=t=>({...be,id:we(be.commandId),hidden$:S.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_DOC,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:Je(t)}),Qe={id:ie.id,binding:S.KeyCode.K|S.MetaKeys.CTRL_COMMAND,preconditions:R.whenSheetEditorFocused},In="@univerjs/sheets-hyper-link-ui",mn="0.17.0",Dt={name:In,version:mn};var Sn=Object.getOwnPropertyDescriptor,_n=(t,n,e,r)=>{for(var i=r>1?void 0:r?Sn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},ft=(t,n)=>(e,r)=>n(e,r,t);let De=class extends s.Disposable{constructor(t,n){super(),this._autoFillService=t,this._hyperLinkModel=n,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),n=(r,i)=>{const{source:o,target:a,unitId:u,subUnitId:l}=r,h=R.virtualizeDiscreteRanges([o,a]),[d,p]=h.ranges,{mapFunc:I}=h,v={row:d.startRow,col:d.startColumn},E=_.AutoFillTools.getAutoFillRepeatRange(d,p),P=[],L=[];return E.forEach(c=>{const k=c.repeatStartCell,M=c.relativeRange,N={startRow:v.row,startColumn:v.col,endColumn:v.col,endRow:v.row},H={startRow:k.row,startColumn:k.col,endColumn:k.col,endRow:k.row};s.Range.foreach(M,($,A)=>{const Y=s.Rectangle.getPositionRange({startRow:$,startColumn:A,endColumn:A,endRow:$},N),{row:ee,col:ye}=I(Y.startRow,Y.startColumn),te=this._hyperLinkModel.getHyperLinkByLocation(u,l,ee,ye),le=s.Rectangle.getPositionRange({startRow:$,startColumn:A,endColumn:A,endRow:$},H),{row:de,col:pe}=I(le.startRow,le.startColumn),fe=s.generateRandomId(),oe=this._hyperLinkModel.getHyperLinkByLocation(u,l,de,pe);oe&&P.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:u,subUnitId:l,id:oe.id}}),(_.AUTO_FILL_APPLY_TYPE.COPY===i||_.AUTO_FILL_APPLY_TYPE.SERIES===i)&&te&&(P.push({id:m.AddHyperLinkMutation.id,params:{unitId:u,subUnitId:l,link:{...te,id:fe,row:de,column:pe}}}),L.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:u,subUnitId:l,id:fe}})),oe&&L.push({id:m.AddHyperLinkMutation.id,params:{unitId:u,subUnitId:l,link:oe}})})}),{undos:L,redos:P}},e={id:Xe,onFillData:(r,i,o)=>o===_.AUTO_FILL_APPLY_TYPE.COPY||o===_.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||o===_.AUTO_FILL_APPLY_TYPE.SERIES?n(r,o):t()};this.disposeWithMe(this._autoFillService.addHook(e))}};De=_n([ft(0,_.IAutoFillService),ft(1,s.Inject(m.HyperLinkModel))],De);var yn=Object.getOwnPropertyDescriptor,fn=(t,n,e,r)=>{for(var i=r>1?void 0:r?yn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},Ke=(t,n)=>(e,r)=>n(e,r,t);let Oe=class extends s.Disposable{constructor(t,n,e){super(),this._localeService=t,this._commandService=n,this._sheetPermissionCheckController=e,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===Qe.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[_.WorkbookEditablePermission],rangeTypes:[_.RangeProtectionPermissionEditPoint],worksheetTypes:[_.WorksheetEditPermission,_.WorksheetSetCellValuePermission,_.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};Oe=fn([Ke(0,s.Inject(s.LocaleService)),Ke(1,s.ICommandService),Ke(2,s.Inject(_.SheetPermissionCheckController))],Oe);var Cn=Object.getOwnPropertyDescriptor,En=(t,n,e,r)=>{for(var i=r>1?void 0:r?Cn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},W=(t,n)=>(e,r)=>n(e,r,t);let Ne=class extends s.Disposable{constructor(t,n,e,r,i,o,a,u,l,h){super(),this._hoverManagerService=t,this._sheetsHyperLinkPopupService=n,this._renderManagerService=e,this._permissionService=r,this._sheetPermissionCheckController=i,this._commandService=o,this._editorBridgeService=a,this._textSelectionManagerService=u,this._univerInstanceService=l,this._zenZoneService=h,this._initHoverListener(),this._initCommandListener(),this._initHoverEditingListener(),this._initTextSelectionListener(),this._initZenEditor()}_getLinkPermission(t){const{unitId:n,subUnitId:e,row:r,col:i}=t,o=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET),a=o==null?void 0:o.getSheetBySheetId(e);if(!a)return{viewPermission:!1,editPermission:!1,copyPermission:!1};const u=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[_.WorkbookViewPermission],worksheetTypes:[_.WorksheetViewPermission],rangeTypes:[_.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:i,endRow:r,endColumn:i}],n,e);let l=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[_.WorkbookEditablePermission],worksheetTypes:[_.WorksheetEditPermission,_.WorksheetInsertHyperlinkPermission],rangeTypes:[_.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:i,endRow:r,endColumn:i}],n,e);const h=a.getCellRaw(r,i);h!=null&&h.f&&h.f.startsWith("=HYPERLINK(")&&(l=!1);const d=this._permissionService.composePermission([new _.WorkbookCopyPermission(n).id,new _.WorksheetCopyPermission(n,e).id]).every(p=>p.value);return{viewPermission:u,editPermission:l,copyPermission:d}}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentRichText$.pipe(D.debounceTime(200)).subscribe(t=>{var N,H,$;if(!t||((N=t.customRange)==null?void 0:N.rangeType)!==s.CustomRangeType.HYPERLINK){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const{unitId:n,subUnitId:e,row:r,col:i}=t,o=this._renderManagerService.getRenderById(n);if(!o)return;const a=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET),u=a==null?void 0:a.getSheetBySheetId(e);if(!u)return;if(!o.with(R.HoverRenderController).active){this._sheetsHyperLinkPopupService.hideCurrentPopup(f.VIEWING);return}const h=(H=o==null?void 0:o.with(R.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:H.skeleton,d=i,p=r;let I=p,v=d;h&&h.overflowCache.forValue((A,Y,ee)=>{s.Rectangle.contains(ee,{startColumn:d,endColumn:d,startRow:p,endRow:p})&&(I=A,v=Y)});const{viewPermission:E,editPermission:P,copyPermission:L}=this._getLinkPermission(t);if(!E){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const c=u.getCellStyleOnly(I,v),k=a.getStyles().getStyleByCell(c),M=($=k==null?void 0:k.tr)==null?void 0:$.a;if(!M&&!t.customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup({row:I,col:v,editPermission:P,copyPermission:L,customRange:t.customRange,customRangeRect:t.rect,type:f.VIEWING,unitId:n,subUnitId:e,showAll:!!M})}))}_initHoverEditingListener(){let t=null;this.disposeWithMe(this._editorBridgeService.currentEditCellState$.pipe(D.switchMap(n=>this._editorBridgeService.visible$.pipe(D.map(e=>({visible:e,state:n}))))).subscribe(({visible:n,state:e})=>{if(!e||e.editorUnitId!==s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)return;if(!n.visible){t==null||t.unsubscribe(),this._sheetsHyperLinkPopupService.hideCurrentPopup(f.EDITING),this._sheetsHyperLinkPopupService.endEditing(f.EDITING);return}const{editorUnitId:r,unitId:i,sheetId:o,row:a,column:u}=e,l=this._renderManagerService.getRenderById(r);if(!l)return;const{editPermission:h,viewPermission:d,copyPermission:p}=this._getLinkPermission({unitId:i,subUnitId:o,row:a,col:u}),I=l.with(Q.DocEventManagerService);d&&(t==null||t.unsubscribe(),t=I.hoverCustomRanges$.pipe(D.debounceTime(200)).subscribe(v=>{var k,M;const E=v.find(N=>N.range.rangeType===s.CustomRangeType.HYPERLINK);if(!E){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const P=E.rects[E.rects.length-1];if(!((M=(k=this._renderManagerService.getRenderById(i))==null?void 0:k.with(R.SheetSkeletonManagerService).getSkeletonParam(o))==null?void 0:M.skeleton)||!P)return;const c=l.engine.getCanvasElement().getBoundingClientRect();this._sheetsHyperLinkPopupService.showPopup({unitId:i,subUnitId:o,row:a,col:u,customRange:E.range,customRangeRect:{left:P.left+c.left,top:P.top+c.top,bottom:P.bottom+c.top,right:P.right+c.left},editPermission:h,copyPermission:p,type:f.EDITING})}))})),this.disposeWithMe(()=>{t==null||t.unsubscribe()})}_initZenEditor(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(t=>{t?(this._sheetsHyperLinkPopupService.hideCurrentPopup(f.VIEWING),this._sheetsHyperLinkPopupService.hideCurrentPopup(f.EDITING),this._sheetsHyperLinkPopupService.endEditing(f.EDITING),this._sheetsHyperLinkPopupService.hideCurrentPopup(f.VIEWING)):(this._sheetsHyperLinkPopupService.hideCurrentPopup(f.ZEN_EDITOR),this._sheetsHyperLinkPopupService.endEditing(f.ZEN_EDITOR))})),this.disposeWithMe(this._univerInstanceService.focused$.pipe(D.switchMap(t=>{const n=t===s.DOCS_ZEN_EDITOR_UNIT_ID_KEY?this._renderManagerService.getRenderById(t):null;return n?n.with(Q.DocEventManagerService).hoverCustomRanges$.pipe(D.debounceTime(200)):new D.Observable(e=>{e.next(null)})})).subscribe(t=>{const n=t==null?void 0:t.find(r=>r.range.rangeType===s.CustomRangeType.HYPERLINK),e=this._editorBridgeService.getEditCellState();if(n&&e){const{unitId:r,sheetId:i,row:o,column:a}=e,{editPermission:u,viewPermission:l,copyPermission:h}=this._getLinkPermission({unitId:r,subUnitId:i,row:o,col:a});l&&this._sheetsHyperLinkPopupService.showPopup({type:f.ZEN_EDITOR,unitId:r,subUnitId:i,row:o,col:a,customRange:n.range,editPermission:u,copyPermission:h})}else this._sheetsHyperLinkPopupService.hideCurrentPopup(f.ZEN_EDITOR)}))}_initTextSelectionListener(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(t=>{t&&t.unitId===s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._sheetsHyperLinkPopupService.endEditing(f.EDITING)}))}_initCommandListener(){const t=[_.ClearSelectionContentCommand.id,_.ClearSelectionAllCommand.id,_.ClearSelectionFormatCommand.id];this.disposeWithMe(this._commandService.onCommandExecuted(n=>{t.includes(n.id)&&this._sheetsHyperLinkPopupService.hideCurrentPopup()}))}};Ne=En([W(0,s.Inject(R.HoverManagerService)),W(1,s.Inject(exports.SheetsHyperLinkPopupService)),W(2,s.Inject(_e.IRenderManagerService)),W(3,s.Inject(s.IPermissionService)),W(4,s.Inject(_.SheetPermissionCheckController)),W(5,s.ICommandService),W(6,R.IEditorBridgeService),W(7,s.Inject(me.DocSelectionManagerService)),W(8,s.IUniverInstanceService),W(9,S.IZenZoneService)],Ne);var Rn=Object.getOwnPropertyDescriptor,Ot=(t,n,e,r)=>{for(var i=r>1?void 0:r?Rn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},We=(t,n)=>(e,r)=>n(e,r,t);let Ye=class extends s.Disposable{constructor(t,n){super(),this._context=t,this._hyperLinkModel=n,this._initSkeletonChange()}_initSkeletonChange(){const t=()=>{var n;(n=this._context.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(D.debounceTime(16)).subscribe(()=>{t()}))}};Ye=Ot([We(1,s.Inject(m.HyperLinkModel))],Ye);let He=class extends s.Disposable{constructor(t,n){super(),this._sheetInterceptorService=t,this._hyperLinkModel=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(_.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Value,priority:100,handler:(t,n,e)=>{const{row:r,col:i,unitId:o,subUnitId:a}=n,u=this._hyperLinkModel.getHyperLinkByLocation(o,a,r,i);return u&&t&&(t===n.rawData&&(t={...n.rawData}),t.linkUrl=u.payload,t.linkId=u.id),e(t)}}))}};He=Ot([We(0,s.Inject(_.SheetInterceptorService)),We(1,s.Inject(m.HyperLinkModel))],He);const Ln={[S.RibbonInsertGroup.MEDIA]:{[ie.id]:{order:1,menuItemFactory:gn},[we(ie.id)]:{order:1,menuItemFactory:vn}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.OTHERS]:{order:1,[ie.id]:{order:0,menuItemFactory:pn},[we(ie.id)]:{order:0,menuItemFactory:hn}}}};var Pn=Object.getOwnPropertyDescriptor,Tn=(t,n,e,r)=>{for(var i=r>1?void 0:r?Pn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},ve=(t,n)=>(e,r)=>n(e,r,t);let Ue=class extends s.Disposable{constructor(t,n,e,r,i){super(),this._componentManager=t,this._commandService=n,this._menuManagerService=e,this._injector=r,this._shortcutService=i,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[Te.componentKey,Te],[Pe.componentKey,Pe],["LinkIcon",ze]].forEach(([t,n])=>{this._componentManager.register(t,n)})}_initCommands(){[Me,Se,je,ie].forEach(t=>{this._commandService.registerCommand(t)})}_initMenus(){this._menuManagerService.mergeMenu(Ln)}_initShortCut(){this._shortcutService.registerShortcut(Qe)}};Ue=Tn([ve(0,s.Inject(S.ComponentManager)),ve(1,s.ICommandService),ve(2,S.IMenuManagerService),ve(3,s.Inject(s.Injector)),ve(4,s.Inject(S.IShortcutService))],Ue);var kn=Object.getOwnPropertyDescriptor,wn=(t,n,e,r)=>{for(var i=r>1?void 0:r?kn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},Ct=(t,n)=>(e,r)=>n(e,r,t);let xe=class extends s.Disposable{constructor(t,n){super(),this._parserService=t,this._resolverService=n,this._handleInitUrl()}_handleInitUrl(){const t=location.hash;if(t){const n=this._parserService.parseHyperLink(t);this._resolverService.navigate(n)}}};xe=wn([Ct(0,s.Inject(m.SheetsHyperLinkParserService)),Ct(1,s.Inject(exports.SheetsHyperLinkResolverService))],xe);var bn=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,On=(t,n,e)=>n in t?bn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,Nn=(t,n,e,r)=>{for(var i=r>1?void 0:r?Dn(n,e):n,o=t.length-1,a;o>=0;o--)(a=t[o])&&(i=a(i)||i);return i},Et=(t,n)=>(e,r)=>n(e,r,t),Ae=(t,n,e)=>On(t,typeof n!="symbol"?n+"":n,e);exports.UniverSheetsHyperLinkUIPlugin=class extends s.Plugin{constructor(n=St,e,r){super(),this._config=n,this._injector=e,this._configService=r;const{menu:i,...o}=s.merge({},St,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Rt,o)}onStarting(){[[exports.SheetsHyperLinkResolverService],[exports.SheetsHyperLinkPopupService],[Ge],[He],[Ne],[Ue],[De],[exports.SheetsHyperLinkCopyPasteController],[Oe],[xe]].forEach(e=>this._injector.add(e)),this._injector.get(He)}onReady(){this._injector.get(_e.IRenderManagerService).registerRenderModule(s.UniverInstanceType.UNIVER_SHEET,[Ye]),this._injector.get(De),this._injector.get(exports.SheetsHyperLinkCopyPasteController),this._injector.get(Ue)}onRendered(){this._injector.get(Oe),this._injector.get(xe),this._injector.get(Ne)}};Ae(exports.UniverSheetsHyperLinkUIPlugin,"pluginName",Xe);Ae(exports.UniverSheetsHyperLinkUIPlugin,"packageName",Dt.name);Ae(exports.UniverSheetsHyperLinkUIPlugin,"version",Dt.version);Ae(exports.UniverSheetsHyperLinkUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsHyperLinkUIPlugin=Nn([s.DependentOn(m.UniverSheetsHyperLinkPlugin,Q.UniverDocsUIPlugin),Et(1,s.Inject(s.Injector)),Et(2,s.IConfigService)],exports.UniverSheetsHyperLinkUIPlugin);exports.CloseHyperLinkPopupOperation=Se;exports.InsertHyperLinkOperation=je;exports.InsertLinkShortcut=Qe;exports.OpenHyperLinkEditPanelOperation=Me;exports.SheetsHyperLinkSidePanelService=Ge;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@univerjs/core`),t=require(`@univerjs/sheets`),n=require(`@univerjs/sheets-ui`),r=require(`@univerjs/docs`),i=require(`@univerjs/docs-ui`),a=require(`@univerjs/engine-render`),o=require(`@univerjs/ui`),s=require(`rxjs`),c=require(`@univerjs/design`),l=require(`@univerjs/engine-formula`),u=require(`@univerjs/sheets-formula-ui`),d=require(`@univerjs/sheets-hyper-link`),f=require(`react`),p=require(`react/jsx-runtime`),m=require(`@univerjs/icons`),h=require(`@univerjs/sheets-data-validation`),g=function(e){return e.EDITING=`editing`,e.VIEWING=`viewing`,e.ZEN_EDITOR=`zen_mode`,e}({});function _(t){return e.Tools.isLegalUrl(t)}function v(e){return/^[a-zA-Z]+:\/\//.test(e)}function y(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function b(e){if(_(e)){let t=v(e)?e:y(e)?`mailto://${e}`:`http://${e}`,n;try{n=new URL(t)}catch{return e}return n.hostname===location.hostname&&n.port===location.port&&n.protocol===location.protocol&&n.pathname===location.pathname&&n.hash&&!n.search?n.hash:t}return e}const x=`sheets-hyper-link-ui.config`;Symbol(x);const S={};function C(e,t){return function(n,r){t(n,r,e)}}function w(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function T(t,n){let r=n.getMergeData(),i=n.getMaxColumns()-1,a=n.getMaxRows()-1;if(i<t.endColumn&&(t.endColumn=i),a<t.endRow&&(t.endRow=a),t.rangeType===e.RANGE_TYPE.COLUMN||e.RANGE_TYPE.ROW)return t;let o=[];return r.forEach(n=>{e.Rectangle.intersects(t,n)&&o.push(n)}),e.Rectangle.realUnion(t,...o)}let E=class{constructor(e,t,n,r,i,a){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=i,this._configService=a}navigate(e){switch(e.type){case d.SheetHyperLinkType.URL:this.navigateToOtherWebsite(e.url);break;default:this._navigateToUniver(e.searchObj)}}_navigateToUniver(t){let{gid:n,range:r,rangeid:i}=t,a=this._univerInstanceService.getCurrentUnitForType(e.UniverInstanceType.UNIVER_SHEET);if(!a)return;let o=a.getUnitId();if(i){let e=this._definedNamesService.getValueById(o,i);if(!e)return;let{formulaOrRefString:t}=e,n=this._definedNamesService.getWorksheetByRef(o,t);if(!n){this._messageService.show({content:this._localeService.t(`hyperLink.message.refError`),type:c.MessageType.Error});return}if(n.isSheetHidden()){this._messageService.show({content:this._localeService.t(`hyperLink.message.hiddenSheet`),type:c.MessageType.Error});return}this.navigateToDefineName(o,i)}if(n){if(r){let t=(0,l.deserializeRangeWithSheet)(r);(0,e.isValidRange)(t.range)&&r!==d.ERROR_RANGE&&this.navigateToRange(o,n,t.range);return}this.navigateToSheetById(o,n)}}async navigateToRange(e,r,i,a){let o=await this.navigateToSheetById(e,r);if(o){let s=T(i,o);await this._commandService.executeCommand(t.SetSelectionsOperation.id,{unitId:e,subUnitId:r,selections:[{range:s,primary:null}]}),await this._commandService.executeCommand(n.ScrollToRangeOperation.id,{range:s,forceTop:a})}}async navigateToSheetById(n,r){let i=this._univerInstanceService.getUnit(n,e.UniverInstanceType.UNIVER_SHEET);if(!i)return!1;let a=i.getActiveSheet();if(!a)return!1;if(a.getSheetId()===r)return a;let o=i.getSheetBySheetId(r);return o?i.getHiddenWorksheets().indexOf(r)>-1?(this._messageService.show({content:this._localeService.t(`hyperLink.message.hiddenSheet`),type:c.MessageType.Error}),!1):await this._commandService.executeCommand(t.SetWorksheetActiveOperation.id,{unitId:n,subUnitId:r})?o:!1:(this._messageService.show({content:this._localeService.t(`hyperLink.message.noSheet`),type:c.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){var t;let n=this._configService.getConfig(x);if(!(n==null||(t=n.urlHandler)==null)&&t.navigateToOtherWebsite)return n.urlHandler.navigateToOtherWebsite(e);window.open(e,`_blank`,`noopener noreferrer`)}};E=w([C(0,e.IUniverInstanceService),C(1,e.ICommandService),C(2,l.IDefinedNamesService),C(3,o.IMessageService),C(4,(0,e.Inject)(e.LocaleService)),C(5,e.IConfigService)],E);function D(e){"@babel/helpers - typeof";return D=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},D(e)}function O(e,t){if(D(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(D(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function k(e){var t=O(e,`string`);return D(t)==`symbol`?t:t+``}function A(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ee=class extends e.Disposable{constructor(...e){super(...e),A(this,`_customHyperLinks`,new Map)}isBuiltInLinkType(e){return e!==d.SheetHyperLinkType.URL}getOptions(){return Array.from(this._customHyperLinks.values()).map(({option:e})=>e)}findCustomHyperLink(e){return Array.from(this._customHyperLinks.values()).find(t=>t.match(e))}registerCustomHyperLink(e){this._customHyperLinks.set(e.type,e)}getCustomHyperLink(e){return this._customHyperLinks.get(e)}removeCustomHyperLink(e){let{_customHyperLinks:t}=this;t.delete(e)}dispose(){super.dispose(),this._customHyperLinks.clear()}};const te=()=>{var s;let[m,h]=(0,f.useState)(``),[v,y]=(0,f.useState)(!1),[x,S]=(0,f.useState)(``),[C,w]=(0,f.useState)(!0),[T,D]=(0,f.useState)(d.SheetHyperLinkType.URL),[O,k]=(0,f.useState)(``),A=(0,o.useDependency)(e.LocaleService),te=(0,o.useDependency)(l.IDefinedNamesService),j=(0,o.useDependency)(n.IEditorBridgeService),M=(0,o.useDependency)(e.IUniverInstanceService),N=(0,o.useDependency)(F),P=(0,o.useObservable)(N.currentEditing$),I=(0,o.useDependency)(d.SheetsHyperLinkParserService),ne=(0,o.useDependency)(E),L=(0,o.useDependency)(e.ICommandService),R=(0,o.useDependency)(ee),re=(0,f.useMemo)(()=>R.getOptions(),[R]),z=(0,o.useDependency)(o.IZenZoneService),B=(0,o.useDependency)(a.IRenderManagerService),V=(0,o.useDependency)(n.IMarkSelectionService),ae=(0,o.useDependency)(r.DocSelectionManagerService),H=(0,o.useDependency)(e.IContextService),oe=(0,o.useDependency)(e.ThemeService),se=(0,o.useDependency)(r.DocSelectionManagerService),[U,ce]=(0,f.useState)(!1),le=(0,o.useDependency)(t.SheetsSelectionsService),ue=(0,f.useMemo)(()=>le.getCurrentSelections(),[]),W=(0,f.useMemo)(()=>{if(!R.isBuiltInLinkType(T))return R.getCustomHyperLink(T)},[R,T]),[G,de]=(0,f.useState)(!1),[K,fe]=(0,f.useState)(!1),q=(0,f.useRef)(!1),J=M.getCurrentUnitForType(e.UniverInstanceType.UNIVER_SHEET),pe=(J==null?void 0:J.getActiveSheet().getSheetId())||``,Y=(0,f.useCallback)(t=>{S(t.replaceAll(e.DataStreamTreeTokenType.CUSTOM_RANGE_START,``).replaceAll(e.DataStreamTreeTokenType.CUSTOM_RANGE_END,``))},[S]);(0,f.useEffect)(()=>{if((P==null?void 0:P.row)!==void 0&&P.col!==void 0){let{customRange:b,row:x,col:S}=P,{label:C}=P;typeof C==`number`&&(C=`${C}`);let T;if(b){var t,n,r,i;T={id:(t=b==null?void 0:b.rangeId)==null?``:t,display:(n=C)==null?``:n,payload:(r=b==null||(i=b.properties)==null?void 0:i.url)==null?``:r,row:x,column:S}}else if(P.type===g.VIEWING){var a,o,s,c;let t=M.getUnit(P.unitId),n=t==null?void 0:t.getSheetBySheetId(P.subUnitId),r=n==null?void 0:n.getCellRaw(P.row,P.col),i=r==null||(a=r.p)==null||(a=a.body)==null||(a=a.customRanges)==null?void 0:a.find(t=>{var n;return t.rangeType===e.CustomRangeType.HYPERLINK&&((n=t.properties)==null?void 0:n.url)}),l=r==null?void 0:r.v;r&&(!e.BuildTextUtils.transform.isEmptyDocument((o=r.p)==null||(o=o.body)==null?void 0:o.dataStream)||e.Tools.isDefine(l))&&w(!1),T={id:``,display:``,payload:(s=i==null||(c=i.properties)==null?void 0:c.url)==null?``:s,row:x,column:S}}else{var u,f,p,m,_;let t=M.getCurrentUnitForType(e.UniverInstanceType.UNIVER_DOC),n=ae.getActiveTextRange(),r=t==null?void 0:t.getBody(),i=n&&r?n:null,a=i&&((u=e.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(i,(f=r==null?void 0:r.customRanges)==null?[]:f))==null?void 0:u[0]);w(!1),T={id:``,display:(p=C)==null?``:p,payload:(m=a==null||(_=a.properties)==null?void 0:_.url)==null?``:m,row:x,column:S}}h(T.id);let E=R.findCustomHyperLink(T);if(E){let e=E.convert(T);D(e.type),k(e.payload),Y(e.display);return}Y(T.display);let O=I.parseHyperLink(T.payload);switch(D(O.type===d.SheetHyperLinkType.INVALID?d.SheetHyperLinkType.RANGE:O.type),O.type){case d.SheetHyperLinkType.URL:k(O.url),O.url===T.display&&(q.current=!0);break;case d.SheetHyperLinkType.RANGE:{var v,y;let e=O.searchObj,t=(0,l.serializeRangeWithSheet)(e.gid?(v=(y=M.getUnit(P.unitId))==null||(y=y.getSheetBySheetId(e.gid))==null?void 0:y.getName())==null?``:v:``,(0,l.deserializeRangeWithSheet)(e.range).range);k(t),t===T.display&&(q.current=!0);break}case d.SheetHyperLinkType.SHEET:{let e=O.searchObj;k(e.gid);break}case d.SheetHyperLinkType.DEFINE_NAME:{let e=O.searchObj;k(e.rangeid);break}default:k(``);break}}},[P,ne,R,ae,M]),(0,f.useEffect)(()=>{let t=null;if(P&&!P.customRangeId&&P.type===g.VIEWING&&e.Tools.isDefine(P.row)&&e.Tools.isDefine(P.col)){let n=M.getUnit(P.unitId,e.UniverInstanceType.UNIVER_SHEET),r=n==null?void 0:n.getSheetBySheetId(P.subUnitId),i=r==null?void 0:r.getMergedCell(P.row,P.col),a=new e.ColorKit(oe.getColorFromTheme(`primary.600`)).toRgb();t=V.addShape({range:i==null?{startColumn:P.col,endColumn:P.col,startRow:P.row,endRow:P.row}:i,style:{fill:`rgb(${a.r}, ${a.g}, ${a.b}, 0.12)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null},[],-1)}return()=>{t&&V.removeShape(t)}},[P,V,oe,M]),(0,f.useEffect)(()=>{fe(T===d.SheetHyperLinkType.RANGE)},[T]),(0,f.useEffect)(()=>{let t=(P==null?void 0:P.type)===g.ZEN_EDITOR?B.getRenderById(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY):B.getRenderById(j.getCurrentEditorId()),n=new e.DisposableCollection;if(t){let e=t.with(i.DocSelectionRenderService);e.setReserveRangesStatus(!0),n.add(()=>{e.setReserveRangesStatus(!1)})}return()=>{j.disableForceKeepVisible(),n.dispose()}},[P==null?void 0:P.type,j,B]),(0,f.useEffect)(()=>(K&&N.setIsKeepVisible(K),N.setIsKeepVisible(U),()=>{N.setIsKeepVisible(!1)}),[K,U,N]),(0,f.useEffect)(()=>()=>{z.temporaryHidden&&(z.show(),H.setContextValue(e.FOCUSING_SHEET,!1))},[H,z]),(0,f.useEffect)(()=>{if(K)return j.enableForceKeepVisible(),()=>{j.disableForceKeepVisible()}},[K,j]);let me=[{label:A.t(`hyperLink.form.link`),value:d.SheetHyperLinkType.URL},{label:A.t(`hyperLink.form.range`),value:d.SheetHyperLinkType.RANGE},{label:A.t(`hyperLink.form.worksheet`),value:d.SheetHyperLinkType.SHEET},{label:A.t(`hyperLink.form.definedName`),value:d.SheetHyperLinkType.DEFINE_NAME},...re];if(!J)return;let X=J.getHiddenWorksheets(),he=J.getSheets().map(e=>({label:e.getName(),value:e.getSheetId()})).filter(e=>X.indexOf(e.value)===-1),Z=Object.values((s=te.getDefinedNameMap(J.getUnitId()))==null?{}:s).map(e=>({label:e.name,value:e.id})),Q=(e,t)=>{if(e===d.SheetHyperLinkType.URL)return b(t);if(e===d.SheetHyperLinkType.RANGE){let e=(0,l.deserializeRangeWithSheet)(t),n=J.getSheetBySheetName(e.sheetName);if(n)return`#gid=${n.getSheetId()}&range=${(0,l.serializeRange)(e.range)}`}return`#${e}=${t}`},$=(0,o.useEvent)(t=>{let n=t.split(`,`).map(l.deserializeRangeWithSheet)[0];if(!n||!(0,e.isValidRange)(n.range))return;if(!n.sheetName){var r;n.sheetName=((r=J.getActiveSheet())==null?void 0:r.getName())||``}let i=(0,l.serializeRangeToRefString)(n);k(i),i&&(q.current||!x)&&(Y(i),q.current=!0)}),ge=async()=>{if(C&&!x||!O||T===d.SheetHyperLinkType.URL&&!_(O)){de(!0);return}if(P)if(m){let t=P.type===g.ZEN_EDITOR||P.type===g.EDITING?d.UpdateRichHyperLinkCommand.id:d.UpdateHyperLinkCommand.id;await L.executeCommand(t,{id:m,unitId:P.unitId,subUnitId:P.subUnitId,payload:{display:C?x:``,payload:Q(T,O)},row:P.row,column:P.col,documentId:P.type===g.ZEN_EDITOR?e.DOCS_ZEN_EDITOR_UNIT_ID_KEY:j.getCurrentEditorId()})}else{let t=P.type===g.ZEN_EDITOR||P.type===g.EDITING?d.AddRichHyperLinkCommand.id:d.AddHyperLinkCommand.id;await L.executeCommand(t,{unitId:P.unitId,subUnitId:P.subUnitId,link:{id:(0,e.generateRandomId)(),row:P.row,column:P.col,payload:Q(T,O),display:C?x:``},documentId:P.type===g.ZEN_EDITOR?e.DOCS_ZEN_EDITOR_UNIT_ID_KEY:j.getCurrentEditorId()})}(P==null?void 0:P.type)===g.VIEWING&&(await L.executeCommand(t.SetWorksheetActiveOperation.id,{unitId:P.unitId,subUnitId:P.subUnitId}),await L.executeCommand(n.ScrollToRangeOperation.id,{range:{startRow:Math.max(P.row-1,0),endRow:P.row+1,startColumn:Math.max(P.col-1,0),endColumn:P.col+1}})),L.executeCommand(ie.id)};return P?(0,p.jsxs)(`div`,{className:(0,c.clsx)(`
2
+ univer-box-border univer-w-[296px] univer-rounded-xl univer-bg-white univer-p-4 univer-shadow-md
3
+ dark:!univer-bg-gray-900
4
+ `,c.borderClassName),children:[C?(0,p.jsx)(c.FormLayout,{label:A.t(`hyperLink.form.label`),error:G&&!x?A.t(`hyperLink.form.inputError`):``,children:(0,p.jsx)(c.Input,{value:x,onChange:e=>{Y(e),q.current=!1},placeholder:A.t(`hyperLink.form.labelPlaceholder`),autoFocus:!0,onKeyDown:e=>{e.keyCode===o.KeyCode.ENTER&&ge()}})}):null,(0,p.jsx)(c.FormLayout,{label:A.t(`hyperLink.form.type`),children:(0,p.jsx)(c.Select,{className:`univer-w-full`,options:me,value:T,onChange:e=>{D(e),k(``)}})}),T===d.SheetHyperLinkType.URL&&(0,p.jsx)(c.FormLayout,{error:G?O?_(O)?``:A.t(`hyperLink.form.linkError`):A.t(`hyperLink.form.inputError`):``,children:(0,p.jsx)(c.Input,{value:O,onChange:e=>{k(e),e&&(q.current||!x||x===e)&&(Y(e),q.current=!0)},placeholder:A.t(`hyperLink.form.linkPlaceholder`),autoFocus:!0,onKeyDown:e=>{e.keyCode===o.KeyCode.ENTER&&ge()}})}),T===d.SheetHyperLinkType.RANGE&&(0,p.jsx)(c.FormLayout,{error:G&&!O?A.t(`hyperLink.form.inputError`):``,children:(0,p.jsx)(u.RangeSelector,{unitId:J.getUnitId(),subUnitId:pe,maxRangeCount:1,supportAcrossSheet:!0,initialValue:O,resetRange:ue,onChange:(e,t)=>$(t),onRangeSelectorDialogVisibleChange:async n=>{if(ce(n),n)P.type===g.ZEN_EDITOR&&(z.hide(),H.setContextValue(e.FOCUSING_SHEET,!0)),P.type!==g.VIEWING&&j.enableForceKeepVisible(),y(!0);else{if(await ne.navigateToRange(P.unitId,P.subUnitId,{startRow:P.row,endRow:P.row,startColumn:P.col,endColumn:P.col},!0),P.type===g.ZEN_EDITOR){var r,a;await L.executeCommand(t.SetSelectionsOperation.id,{unitId:P.unitId,subUnitId:P.subUnitId,selections:[{range:{startRow:P.row,endRow:P.row,startColumn:P.col,endColumn:P.col}}]}),z.show(),H.setContextValue(e.FOCUSING_SHEET,!1);let n=(r=B.getRenderById(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(i.DocBackScrollRenderController),o=(a=se.getTextRanges({unitId:e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:e.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))==null?void 0:a[0];n&&o&&(n.scrollToRange(o),se.refreshSelection({unitId:e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:e.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))}j.disableForceKeepVisible(),y(!1)}},onFocusChange:e=>fe(e)})}),T===d.SheetHyperLinkType.SHEET&&(0,p.jsx)(c.FormLayout,{error:G&&!O?A.t(`hyperLink.form.selectError`):``,children:(0,p.jsx)(c.Select,{className:`univer-w-full`,options:he,value:O,onChange:e=>{var t,n;k(e);let r=(t=he.find(t=>t.value===e))==null?void 0:t.label,i=(n=he.find(e=>e.value===O))==null?void 0:n.label;r&&(q.current||!x||x===i)&&(Y(r),q.current=!0)}})}),T===d.SheetHyperLinkType.DEFINE_NAME&&(0,p.jsx)(c.FormLayout,{error:G&&!O?A.t(`hyperLink.form.selectError`):``,children:(0,p.jsx)(c.Select,{className:`univer-w-full`,options:Z,value:O,onChange:e=>{var t,n;k(e);let r=(t=Z.find(t=>t.value===e))==null?void 0:t.label,i=(n=Z.find(e=>e.value===O))==null?void 0:n.label;r&&(q.current||!x||x===i)&&(Y(r),q.current=!0)}})}),(W==null?void 0:W.Form)&&(0,p.jsx)(W.Form,{linkId:m,payload:O,display:x,showError:G,setByPayload:q,setDisplay:e=>{Y(e),q.current=!0},setPayload:k}),(0,p.jsxs)(`div`,{className:`univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[(0,p.jsx)(c.Button,{onClick:()=>{P&&ne.navigateToRange(P.unitId,P.subUnitId,{startRow:P.row,endRow:P.row,startColumn:P.col,endColumn:P.col},!0),L.executeCommand(ie.id)},children:A.t(`hyperLink.form.cancel`)}),(0,p.jsx)(c.Button,{variant:`primary`,onClick:async()=>{ge()},children:A.t(`hyperLink.form.ok`)})]})]}):null};te.componentKey=`univer.sheet.cell-link-edit`;const j={[d.SheetHyperLinkType.URL]:(0,p.jsx)(m.LinkIcon,{}),[d.SheetHyperLinkType.SHEET]:(0,p.jsx)(m.XlsxMultiIcon,{className:`univer-text-green-500`}),[d.SheetHyperLinkType.RANGE]:(0,p.jsx)(m.AllBorderIcon,{}),[d.SheetHyperLinkType.DEFINE_NAME]:(0,p.jsx)(m.AllBorderIcon,{}),[d.SheetHyperLinkType.INVALID]:(0,p.jsx)(m.AllBorderIcon,{})},M=t=>{var r,i;let a=(0,o.useDependency)(F),s=(0,o.useDependency)(e.ICommandService),l=(0,o.useDependency)(o.IMessageService),u=(0,o.useDependency)(e.LocaleService),f=(0,o.useDependency)(E),h=(0,o.useDependency)(n.IEditorBridgeService),_=(0,o.useDependency)(d.SheetsHyperLinkParserService),v=(0,o.useDependency)(o.IZenZoneService),{customRange:y,row:b,col:x,unitId:S,subUnitId:C,editPermission:w,copyPermission:T,type:D}=t;if(!(!(y==null||(r=y.properties)==null)&&r.url))return null;let O=_.parseHyperLink((i=y.properties.url)==null?``:i),k=O.type===d.SheetHyperLinkType.INVALID;return(0,p.jsxs)(`div`,{className:(0,c.clsx)(`
5
+ univer-mb-1 univer-flex univer-max-w-80 univer-flex-row univer-items-center univer-justify-between
6
+ univer-overflow-hidden univer-rounded-lg univer-bg-white univer-p-3 univer-shadow-md
7
+ dark:!univer-bg-gray-900
8
+ `,c.borderClassName),onClick:()=>a.hideCurrentPopup(),children:[(0,p.jsxs)(`div`,{className:(0,c.clsx)(`
9
+ univer-flex univer-h-6 univer-flex-1 univer-cursor-pointer univer-flex-row univer-items-center
10
+ univer-truncate univer-text-sm univer-leading-5 univer-text-primary-600
11
+ `,{"univer-text-red-500":k}),onClick:()=>{v.visible||k||f.navigate(O)},children:[(0,p.jsx)(`div`,{className:`
12
+ univer-mr-2 univer-flex univer-size-5 univer-flex-none univer-items-center univer-justify-center
13
+ univer-text-base univer-text-gray-900
14
+ dark:!univer-text-white
15
+ `,children:j[O.type]}),(0,p.jsx)(c.Tooltip,{showIfEllipsis:!0,title:O.name,asChild:!0,children:(0,p.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:O.name})})]}),(0,p.jsxs)(`div`,{className:`
16
+ univer-flex univer-h-6 univer-flex-none univer-flex-row univer-items-center univer-justify-center
17
+ `,children:[T&&(0,p.jsx)(`div`,{className:(0,c.clsx)(`
18
+ univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row
19
+ univer-items-center univer-justify-center univer-rounded univer-text-base
20
+ hover:univer-bg-gray-100
21
+ dark:hover:!univer-bg-gray-700
22
+ `,{"univer-text-red-500":k}),onClick:()=>{if(!k){if(O.type!==d.SheetHyperLinkType.URL){let e=new URL(window.location.href);e.hash=O.url.slice(1),navigator.clipboard.writeText(e.href)}else navigator.clipboard.writeText(O.url);l.show({content:u.t(`hyperLink.message.coped`),type:c.MessageType.Info})}},children:(0,p.jsx)(c.Tooltip,{placement:`bottom`,title:u.t(`hyperLink.popup.copy`),children:(0,p.jsx)(m.CopyIcon,{className:`dark:!univer-text-white`})})}),w&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`
23
+ univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row
24
+ univer-items-center univer-justify-center univer-rounded univer-text-base
25
+ hover:univer-bg-gray-100
26
+ dark:hover:!univer-bg-gray-700
27
+ `,onClick:()=>{s.executeCommand(z.id,{unitId:S,subUnitId:C,row:b,col:x,customRangeId:y.rangeId,type:D})},children:(0,p.jsx)(c.Tooltip,{placement:`bottom`,title:u.t(`hyperLink.popup.edit`),children:(0,p.jsx)(m.WriteIcon,{className:`dark:!univer-text-white`})})}),(0,p.jsx)(`div`,{className:`
28
+ univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-flex-row
29
+ univer-items-center univer-justify-center univer-rounded univer-text-base
30
+ hover:univer-bg-gray-100
31
+ dark:hover:!univer-bg-gray-700
32
+ `,onClick:()=>{let t=D===g.EDITING||D===g.ZEN_EDITOR?d.CancelRichHyperLinkCommand.id:d.CancelHyperLinkCommand.id;s.syncExecuteCommand(t,{unitId:S,subUnitId:C,id:y.rangeId,row:b,column:x,documentId:D===g.ZEN_EDITOR?e.DOCS_ZEN_EDITOR_UNIT_ID_KEY:h.getCurrentEditorId()})&&a.hideCurrentPopup(void 0,!0)},children:(0,p.jsx)(c.Tooltip,{placement:`bottom`,title:u.t(`hyperLink.popup.cancel`),children:(0,p.jsx)(m.UnlinkIcon,{className:`dark:!univer-text-white`})})})]})]})]})},N=()=>{let t=(0,o.useDependency)(F),[n,r]=(0,f.useState)(null),i=(0,o.useDependency)(e.IUniverInstanceService);if((0,f.useEffect)(()=>{r(t.currentPopup);let e=t.currentPopup$.subscribe(e=>{r(e)});return()=>{e.unsubscribe()}},[t.currentPopup,t.currentPopup$]),!n)return null;if(n.showAll){var a;let t=i.getUnit(n.unitId,e.UniverInstanceType.UNIVER_SHEET),r=t==null?void 0:t.getSheetBySheetId(n.subUnitId),o=r==null?void 0:r.getCell(n.row,n.col),s=o==null||(a=o.p)==null||(a=a.body)==null?void 0:a.customRanges;return s!=null&&s.length?(0,p.jsx)(`div`,{children:s.map(e=>(0,p.jsx)(M,{...n,customRange:e},e.rangeId))}):null}return(0,p.jsx)(M,{...n})};N.componentKey=`univer.sheet.cell-link-popup`;const P=(e,t)=>{var n,r;return e.unitId===t.unitId&&e.subUnitId===t.subUnitId&&e.row===t.row&&e.col===t.col&&((n=e.customRange)==null?void 0:n.rangeId)===((r=t.customRange)==null?void 0:r.rangeId)&&e.type===t.type};let F=class extends e.Disposable{get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}constructor(e,t,n,r,i,a,o){super(),this._sheetCanvasPopManagerService=e,this._injector=t,this._univerInstanceService=n,this._editorBridgeService=r,this._textSelectionManagerService=i,this._docCanvasPopManagerService=a,this._zenZoneService=o,A(this,`_currentPopup`,null),A(this,`_currentPopup$`,new s.Subject),A(this,`currentPopup$`,this._currentPopup$.asObservable()),A(this,`_currentEditingPopup`,null),A(this,`_currentEditing$`,new s.BehaviorSubject(null)),A(this,`currentEditing$`,this._currentEditing$.asObservable()),A(this,`_isKeepVisible`,!1),this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}setIsKeepVisible(e){this._isKeepVisible=e}getIsKeepVisible(){return this._isKeepVisible}showPopup(t){if(this._currentPopup&&P(t,this._currentPopup)||(this.hideCurrentPopup(void 0,!0),t.type!==g.ZEN_EDITOR&&this._zenZoneService.visible))return;let n=this._currentEditing$.getValue();if(n&&P(t,n))return;let{unitId:r,subUnitId:i,row:a,col:o,customRangeRect:s,customRange:c}=t,l,u={componentKey:N.componentKey,direction:`bottom`,onClickOutside:()=>{this.hideCurrentPopup()},onClick:()=>{this.hideCurrentPopup(t.type,!0)}};if(t.type===g.EDITING){if(!c)return;l=s&&this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(s,u)}else if(t.type===g.ZEN_EDITOR){if(!c)return;l=this._docCanvasPopManagerService.attachPopupToRange({startOffset:c.startIndex,endOffset:c.endIndex+1,collapsed:!1},u,e.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(t.showAll)l=this._sheetCanvasPopManagerService.attachPopupToCell(t.row,t.col,u,r,i);else{if(!c)return;l=s&&this._sheetCanvasPopManagerService.attachPopupByPosition(s,u,t)}if(l){if(this._currentPopup){var d;(d=this._currentPopup.disposable)==null||d.dispose()}this._currentPopup={unitId:r,subUnitId:i,disposable:l,row:a,col:o,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission,customRange:c,type:t.type,showAll:t.showAll},this._currentPopup$.next(this._currentPopup)}}hideCurrentPopup(e,t){if(this._currentPopup&&((!e||e===this._currentPopup.type)&&this._currentPopup.disposable.canDispose()||t)){var n;(n=this._currentPopup)==null||(n=n.disposable)==null||n.dispose(),this._currentPopup=null,this._currentPopup$.next(null)}}dispose(){super.dispose(),this.hideCurrentPopup(),this.endEditing(),this._currentPopup$.complete(),this._currentEditing$.complete()}_getEditingRange(){let t=this._editorBridgeService.isVisible().visible,n=this._editorBridgeService.getEditCellState();if(t&&n){var r,i,a;let t=this._textSelectionManagerService.getActiveTextRange(),o=(r=n.documentLayoutObject.documentModel)==null?void 0:r.getBody();if(!o)return null;if(!t||t.collapsed)return{startOffset:0,endOffset:o.dataStream.length-2,collapsed:o.dataStream.length-2==0,label:e.BuildTextUtils.transform.getPlainText(o.dataStream)};let s=e.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(t,(i=(a=o.customRanges)==null?void 0:a.filter(t=>t.rangeType===e.CustomRangeType.HYPERLINK))==null?[]:i),c=t.startOffset,l=t.endOffset;return s.forEach(e=>{c=Math.min(c,e.startIndex),l=Math.max(l,e.endIndex+1)}),{startOffset:c,endOffset:l,collapsed:c===l,label:e.BuildTextUtils.transform.getPlainText(o.dataStream.slice(c,l))}}return null}get _editPopup(){return{componentKey:te.componentKey,direction:`vertical`,onClickOutside:()=>{this.endEditing()},onContextMenu:()=>{this.endEditing()},hiddenType:`hide`}}startAddEditing(t){let{unitId:n,subUnitId:r,type:o}=t;if(o===g.ZEN_EDITOR){var s;let n=this._univerInstanceService.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,e.UniverInstanceType.UNIVER_DOC);if(!n)return;let r=this._textSelectionManagerService.getActiveTextRange();if(!r)return;this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange(r,this._editPopup,e.DOCS_ZEN_EDITOR_UNIT_ID_KEY);let i=(s=n.getBody())==null?void 0:s.dataStream.slice(r.startOffset,r.endOffset);this._currentEditing$.next({...t,label:i})}else if(o===g.EDITING){var c;let o=this._getEditingRange();if(!o)return;this._textSelectionManagerService.replaceDocRanges([{...o}],{unitId:e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,subUnitId:e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY});let s=this._injector.get(a.IRenderManagerService).getRenderById(e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);if(!s)return;let l=(0,i.calcDocRangePositions)(o,s);if(!(l!=null&&l.length))return;this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(l.pop(),this._editPopup,n,r),this._currentEditing$.next({...t,label:(c=o==null?void 0:o.label)==null?``:c})}else{var l,u,d;this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(t.row,t.col,this._editPopup,n,r);let i=this._univerInstanceService.getUnit(n,e.UniverInstanceType.UNIVER_SHEET),a=i==null?void 0:i.getSheetBySheetId(r),o=a==null?void 0:a.getCellRaw(t.row,t.col);this._currentEditing$.next({...t,label:o!=null&&o.p?e.BuildTextUtils.transform.getPlainText((l=(u=o.p.body)==null?void 0:u.dataStream)==null?``:l):((d=o==null?void 0:o.v)==null?``:d).toString()})}}startEditing(t){var r;(r=this._currentEditingPopup)==null||r.dispose(),this.hideCurrentPopup(void 0,!0);let{unitId:i,subUnitId:a}=t,o,s;if(t.type===g.ZEN_EDITOR){var c,l;let n=this._univerInstanceService.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY,e.UniverInstanceType.UNIVER_DOC);if(o=n==null||(c=n.getBody())==null||(c=c.customRanges)==null?void 0:c.find(e=>e.rangeId===t.customRangeId),s=o?n==null||(l=n.getBody())==null?void 0:l.dataStream.slice(o.startIndex,o.endIndex+1):``,!o||!s)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:o.startIndex,endOffset:o.endIndex+1}]),this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange({startOffset:o.startIndex,endOffset:o.endIndex,collapsed:!1},this._editPopup,e.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(t.type===g.EDITING){var u;let e=(0,n.getEditingCustomRangePosition)(this._injector,t.unitId,t.subUnitId,t.row,t.col,t.customRangeId);if(!e||!((u=e.rects)!=null&&u.length))return;o=e.customRange,s=e.label,this._textSelectionManagerService.replaceTextRanges([{startOffset:o.startIndex,endOffset:o.endIndex+1}]),this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(e.rects.pop(),this._editPopup,i,a)}else{var d;let r=this._univerInstanceService.getUnit(i,e.UniverInstanceType.UNIVER_SHEET),c=r==null?void 0:r.getSheetBySheetId(a),l=c==null?void 0:c.getCellRaw(t.row,t.col),u=r==null?void 0:r.getStyles().getStyleByCell(l),f=u==null?void 0:u.tr,p=(0,n.getCustomRangePosition)(this._injector,t.unitId,t.subUnitId,t.row,t.col,t.customRangeId);if(!p||!((d=p.rects)!=null&&d.length))return;o=p.customRange,s=p.label,f?this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(t.row,t.col,this._editPopup,i,a):this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupByPosition(p.rects.pop(),this._editPopup,{unitId:i,subUnitId:a,row:t.row,col:t.col})}this._currentEditing$.next({...t,customRange:o,label:s})}endEditing(e){if(this.getIsKeepVisible())return;let t=this._currentEditing$.getValue();if(t&&(!e||e===t.type)){var n;(n=this._currentEditingPopup)==null||n.dispose(),this._currentEditing$.next(null)}}};F=w([C(0,(0,e.Inject)(n.SheetCanvasPopManagerService)),C(1,(0,e.Inject)(e.Injector)),C(2,e.IUniverInstanceService),C(3,n.IEditorBridgeService),C(4,(0,e.Inject)(r.DocSelectionManagerService)),C(5,(0,e.Inject)(i.DocCanvasPopManagerService)),C(6,o.IZenZoneService)],F);let I=function(e){return e[e.ALLOWED=0]=`ALLOWED`,e[e.DISABLED_BY_CELL=1]=`DISABLED_BY_CELL`,e[e.ALLOW_ON_EDITING=2]=`ALLOW_ON_EDITING`,e}({});const ne=new Set([e.DataValidationType.CHECKBOX,e.DataValidationType.LIST,e.DataValidationType.LIST_MULTIPLE]),L=(e,t,n,r)=>{var i,a;let o=t.getCell(n,r);if(o!=null&&o.f||o!=null&&o.si||!(o==null||(i=o.p)==null||(i=i.body)==null||(i=i.customBlocks)==null)&&i.length)return I.DISABLED_BY_CELL;let s=e.has(h.SheetDataValidationModel)?e.get(h.SheetDataValidationModel):null,c=s==null?void 0:s.getRuleByLocation(t.getUnitId(),t.getSheetId(),n,r);return c&&ne.has(c.type)?!0:!(o==null||(a=o.p)==null||(a=a.drawingsOrder)==null)&&a.length?I.ALLOW_ON_EDITING:I.ALLOWED},R=n=>{let r=n.get(e.IUniverInstanceService).getCurrentUnitForType(e.UniverInstanceType.UNIVER_SHEET);if(!r)return!0;let i=r.getActiveSheet(),a=n.get(t.SheetsSelectionsService).getCurrentSelections();if(!a.length)return!0;let o=a[0].range.startRow,s=a[0].range.startColumn;return L(n,i,o,s)===I.DISABLED_BY_CELL},re=t=>{let n=t.get(r.DocSelectionManagerService),i=t.get(e.IUniverInstanceService),a=n.getTextRanges();if(!(a!=null&&a.length))return!0;let o=i.getCurrentUnitForType(e.UniverInstanceType.UNIVER_DOC);return!!(!o||a.every(e=>e.collapsed)||!o.getSelfOrHeaderFooterModel(a[0].segmentId).getBody())},z={type:e.CommandType.OPERATION,id:`sheet.operation.open-hyper-link-edit-panel`,handler(e,t){if(!t)return!1;let n=e.get(F);return t.customRangeId?n.startEditing(t):n.startAddEditing(t),!0}},ie={type:e.CommandType.OPERATION,id:`sheet.operation.close-hyper-link-popup`,handler(e){return e.get(F).endEditing(),!0}},B={type:e.CommandType.OPERATION,id:`sheet.operation.insert-hyper-link`,handler(r){var i;let a=r.get(e.IUniverInstanceService),o=(0,t.getSheetCommandTarget)(a),s=r.get(n.IEditorBridgeService);if(!o)return!1;let c=r.get(e.ICommandService),l=r.get(t.SheetsSelectionsService).getCurrentLastSelection();if(!l)return!1;let u=l.range.startRow,d=l.range.startColumn,f=s.isVisible(),p=((i=a.getFocusedUnit())==null?void 0:i.getUnitId())===e.DOCS_ZEN_EDITOR_UNIT_ID_KEY;return c.executeCommand(z.id,{unitId:o.unitId,subUnitId:o.subUnitId,row:u,col:d,type:p?g.ZEN_EDITOR:f.visible?g.EDITING:g.VIEWING})}},V={type:e.CommandType.OPERATION,id:`sheet.operation.insert-hyper-link-toolbar`,handler(t){if(R(t))return!1;let n=t.get(e.ICommandService);return t.get(F).currentEditing?n.executeCommand(ie.id):n.executeCommand(B.id)}},ae=`SHEET_HYPER_LINK_UI_PLUGIN`;let H=class extends e.Disposable{registerPlainTextFilter(e){this._plainTextFilter.add(e)}removePlainTextFilter(e){this._plainTextFilter.delete(e)}_filterPlainText(e){return Array.from(this._plainTextFilter).every(t=>t(e))}constructor(e,t,n,r){super(),this._sheetClipboardService=e,this._hyperLinkModel=t,this._injector=n,this._resolverService=r,A(this,`_plainTextFilter`,new Set),A(this,`_copyInfo`,void 0),this._initCopyPaste(),this.disposeWithMe(()=>{this._plainTextFilter.clear()})}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:ae,onBeforeCopy:(e,t,n)=>this._collect(e,t,n),onPasteCells:(e,t,r,i)=>{let{copyType:a=n.COPY_TYPE.COPY,pasteType:o}=i,{range:s}=e||{},{range:c,unitId:l,subUnitId:u}=t;return this._generateMutations(c,{copyType:a,pasteType:o,copyRange:s,unitId:l,subUnitId:u})},onPastePlainText:(t,r)=>{let i=this._filterPlainText(r);if(_(r)&&i){let{range:r,unitId:i,subUnitId:a}=t,{ranges:[o],mapFunc:s}=(0,n.virtualizeDiscreteRanges)([r]),c=[],l=[];return e.Range.foreach(o,(e,t)=>{let{row:n,col:r}=s(e,t),o=this._hyperLinkModel.getHyperLinkByLocation(i,a,n,r);o&&c.push({id:d.RemoveHyperLinkMutation.id,params:{unitId:i,subUnitId:a,id:o.id}}),o&&l.push({id:d.AddHyperLinkMutation.id,params:{unitId:i,subUnitId:a,link:o}})}),{redos:c,undos:l}}return{undos:[],redos:[]}},priority:99})}_collect(n,r,i){let a=new e.ObjectMatrix;this._copyInfo={unitId:n,subUnitId:r,matrix:a};let o=this._injector.invoke(e=>(0,t.rangeToDiscreteRange)(i,e,n,r));if(!o)return;let{rows:s,cols:c}=o;s.forEach((e,t)=>{c.forEach((i,o)=>{var s;let c=this._hyperLinkModel.getHyperLinkByLocation(n,r,e,i);a.setValue(t,o,(s=c==null?void 0:c.id)==null?``:s)})})}_generateMutations(t,r){if(!this._copyInfo||!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!r.copyRange||[n.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH,n.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE,n.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,n.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA].includes(r.pasteType))return{redos:[],undos:[]};let{unitId:i,subUnitId:a}=this._copyInfo,o=[],s=[],{ranges:[c,l],mapFunc:u}=(0,n.virtualizeDiscreteRanges)([r.copyRange,t]);return(0,n.getRepeatRange)(c,l,!0).forEach(({startRange:t})=>{var n;(n=this._copyInfo)==null||n.matrix.forValue((n,c,l)=>{let f=e.Rectangle.getPositionRange({startRow:n,endRow:n,startColumn:c,endColumn:c},t),p=this._hyperLinkModel.getHyperLink(i,a,l),{row:m,col:h}=u(f.startRow,f.startColumn),g=this._hyperLinkModel.getHyperLinkByLocation(r.unitId,r.subUnitId,m,h),_=(0,e.generateRandomId)();g&&o.push({id:d.RemoveHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,id:g.id}}),p&&(o.push({id:d.AddHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,link:{...p,id:_,row:m,column:h}}}),s.push({id:d.RemoveHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,id:_}})),g&&s.push({id:d.AddHyperLinkMutation.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,link:g}})})}),{redos:o,undos:s}}};H=w([C(0,n.ISheetClipboardService),C(1,(0,e.Inject)(d.HyperLinkModel)),C(2,(0,e.Inject)(e.Injector)),C(3,(0,e.Inject)(E))],H);const oe=(r,o=e.DOCS_ZEN_EDITOR_UNIT_ID_KEY)=>{var c;let l=r.get(e.IUniverInstanceService),u=(c=r.get(a.IRenderManagerService).getRenderById(o))==null?void 0:c.with(i.DocSelectionRenderService);return u?u.textSelectionInner$.pipe((0,s.map)(()=>{let e=r.get(n.IEditorBridgeService).getEditCellState();if(!e)return!0;let i=(0,t.getSheetCommandTarget)(l,{unitId:e.unitId,subUnitId:e.sheetId});return!(i!=null&&i.worksheet)||L(r,i.worksheet,e.row,e.column)===1?!0:re(r)})):(0,s.of)(!0)},se=r=>{var i;let a=r.get(e.IUniverInstanceService),o=r.has(n.IEditorBridgeService)?r.get(n.IEditorBridgeService):null;return((i=o==null?void 0:o.currentEditCellState$.pipe((0,s.map)(e=>{if(!e)return I.DISABLED_BY_CELL;let n=(0,t.getSheetCommandTarget)(a,{unitId:e.unitId,subUnitId:e.sheetId});return n?L(r,n.worksheet,e.row,e.column):I.DISABLED_BY_CELL}),(0,s.switchMap)(t=>t===I.DISABLED_BY_CELL?(0,s.of)(!0):(0,s.combineLatest)([o?o.visible$:(0,s.of)(null),a.getCurrentTypeOfUnit$(e.UniverInstanceType.UNIVER_DOC)]).pipe((0,s.switchMap)(([n,i])=>n!=null&&n.visible?(i==null?void 0:i.getUnitId())===e.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY?(0,s.of)(!0):oe(r,e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY):(0,s.of)(t!==I.ALLOWED))))))==null?(0,s.of)(!0):i).pipe((0,s.switchMap)(e=>e?(0,s.of)(!0):(0,n.getCurrentRangeDisable$)(r,{workbookTypes:[t.WorkbookEditablePermission],worksheetTypes:[t.WorksheetEditPermission,t.WorksheetSetCellValuePermission,t.WorksheetInsertHyperlinkPermission],rangeTypes:[t.RangeProtectionPermissionEditPoint]},!0)))},U={commandId:B.id,type:o.MenuItemType.BUTTON,title:`hyperLink.menu.add`,icon:`LinkIcon`},ce=e=>`${e}-zen-editor`,le=t=>({...U,id:U.commandId,hidden$:(0,o.getMenuHiddenObservable)(t,e.UniverInstanceType.UNIVER_SHEET),disabled$:se(t)}),ue=t=>({...U,id:ce(U.commandId),hidden$:(0,o.getMenuHiddenObservable)(t,e.UniverInstanceType.UNIVER_DOC,e.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:oe(t)}),W={tooltip:`hyperLink.form.addTitle`,commandId:V.id,type:o.MenuItemType.BUTTON,icon:`LinkIcon`},G=t=>({...W,id:W.commandId,hidden$:(0,o.getMenuHiddenObservable)(t,e.UniverInstanceType.UNIVER_SHEET),disabled$:se(t)}),de=t=>({...W,id:ce(W.commandId),hidden$:(0,o.getMenuHiddenObservable)(t,e.UniverInstanceType.UNIVER_DOC,e.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:oe(t)}),K={id:V.id,binding:o.KeyCode.K|o.MetaKeys.CTRL_COMMAND,preconditions:n.whenSheetEditorFocused};var fe=`@univerjs/sheets-hyper-link-ui`,q=`0.18.0`;let J=class extends e.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){let r=()=>({redos:[],undos:[]}),i=(r,i)=>{let{source:a,target:o,unitId:s,subUnitId:c}=r,l=(0,n.virtualizeDiscreteRanges)([a,o]),[u,f]=l.ranges,{mapFunc:p}=l,m={row:u.startRow,col:u.startColumn},h=t.AutoFillTools.getAutoFillRepeatRange(u,f),g=[],_=[];return h.forEach(n=>{let r=n.repeatStartCell,a=n.relativeRange,o={startRow:m.row,startColumn:m.col,endColumn:m.col,endRow:m.row},l={startRow:r.row,startColumn:r.col,endColumn:r.col,endRow:r.row};e.Range.foreach(a,(n,r)=>{let a=e.Rectangle.getPositionRange({startRow:n,startColumn:r,endColumn:r,endRow:n},o),{row:u,col:f}=p(a.startRow,a.startColumn),m=this._hyperLinkModel.getHyperLinkByLocation(s,c,u,f),h=e.Rectangle.getPositionRange({startRow:n,startColumn:r,endColumn:r,endRow:n},l),{row:v,col:y}=p(h.startRow,h.startColumn),b=(0,e.generateRandomId)(),x=this._hyperLinkModel.getHyperLinkByLocation(s,c,v,y);x&&g.push({id:d.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:x.id}}),(t.AUTO_FILL_APPLY_TYPE.COPY===i||t.AUTO_FILL_APPLY_TYPE.SERIES===i)&&m&&(g.push({id:d.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{...m,id:b,row:v,column:y}}}),_.push({id:d.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:b}})),x&&_.push({id:d.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:x}})})}),{undos:_,redos:g}},a={id:ae,onFillData:(e,n,a)=>a===t.AUTO_FILL_APPLY_TYPE.COPY||a===t.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||a===t.AUTO_FILL_APPLY_TYPE.SERIES?i(e,a):r()};this.disposeWithMe(this._autoFillService.addHook(a))}};J=w([C(0,t.IAutoFillService),C(1,(0,e.Inject)(d.HyperLinkModel))],J);let pe=class extends e.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===K.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[t.WorkbookEditablePermission],rangeTypes:[t.RangeProtectionPermissionEditPoint],worksheetTypes:[t.WorksheetEditPermission,t.WorksheetSetCellValuePermission,t.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.hyperLinkErr`)))}))}};pe=w([C(0,(0,e.Inject)(e.LocaleService)),C(1,e.ICommandService),C(2,(0,e.Inject)(t.SheetPermissionCheckController))],pe);let Y=class extends e.Disposable{constructor(e,t,n,r,i,a,o,s,c,l){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionCheckController=i,this._commandService=a,this._editorBridgeService=o,this._textSelectionManagerService=s,this._univerInstanceService=c,this._zenZoneService=l,this._initHoverListener(),this._initCommandListener(),this._initHoverEditingListener(),this._initTextSelectionListener(),this._initZenEditor()}_getLinkPermission(n){let{unitId:r,subUnitId:i,row:a,col:o}=n,s=this._univerInstanceService.getUnit(r,e.UniverInstanceType.UNIVER_SHEET),c=s==null?void 0:s.getSheetBySheetId(i);if(!c)return{viewPermission:!1,editPermission:!1,copyPermission:!1};let l=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[t.WorkbookViewPermission],worksheetTypes:[t.WorksheetViewPermission],rangeTypes:[t.RangeProtectionPermissionViewPoint]},[{startRow:a,startColumn:o,endRow:a,endColumn:o}],r,i),u=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[t.WorkbookEditablePermission],worksheetTypes:[t.WorksheetEditPermission,t.WorksheetInsertHyperlinkPermission],rangeTypes:[t.RangeProtectionPermissionEditPoint]},[{startRow:a,startColumn:o,endRow:a,endColumn:o}],r,i),d=c.getCellRaw(a,o);d!=null&&d.f&&d.f.startsWith(`=HYPERLINK(`)&&(u=!1);let f=this._permissionService.composePermission([new t.WorkbookCopyPermission(r).id,new t.WorksheetCopyPermission(r,i).id]).every(e=>e.value);return{viewPermission:l,editPermission:u,copyPermission:f}}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentRichText$.pipe((0,s.debounceTime)(200)).subscribe(t=>{var r,i,a;if(!t||((r=t.customRange)==null?void 0:r.rangeType)!==e.CustomRangeType.HYPERLINK){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}let{unitId:o,subUnitId:s,row:c,col:l}=t,u=this._renderManagerService.getRenderById(o);if(!u)return;let d=this._univerInstanceService.getUnit(o,e.UniverInstanceType.UNIVER_SHEET),f=d==null?void 0:d.getSheetBySheetId(s);if(!f)return;if(!u.with(n.HoverRenderController).active){this._sheetsHyperLinkPopupService.hideCurrentPopup(g.VIEWING);return}let p=u==null||(i=u.with(n.SheetSkeletonManagerService).getSkeletonParam(s))==null?void 0:i.skeleton,m=l,h=c,_=h,v=m;p&&p.overflowCache.forValue((t,n,r)=>{e.Rectangle.contains(r,{startColumn:m,endColumn:m,startRow:h,endRow:h})&&(_=t,v=n)});let{viewPermission:y,editPermission:b,copyPermission:x}=this._getLinkPermission(t);if(!y){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}let S=f.getCellStyleOnly(_,v),C=d.getStyles().getStyleByCell(S),w=C==null||(a=C.tr)==null?void 0:a.a;if(!w&&!t.customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup({row:_,col:v,editPermission:b,copyPermission:x,customRange:t.customRange,customRangeRect:t.rect,type:g.VIEWING,unitId:o,subUnitId:s,showAll:!!w})}))}_initHoverEditingListener(){let t=null;this.disposeWithMe(this._editorBridgeService.currentEditCellState$.pipe((0,s.switchMap)(e=>this._editorBridgeService.visible$.pipe((0,s.map)(t=>({visible:t,state:e}))))).subscribe(({visible:r,state:a})=>{if(!a||a.editorUnitId!==e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)return;if(!r.visible){t==null||t.unsubscribe(),this._sheetsHyperLinkPopupService.hideCurrentPopup(g.EDITING),this._sheetsHyperLinkPopupService.endEditing(g.EDITING);return}let{editorUnitId:o,unitId:c,sheetId:l,row:u,column:d}=a,f=this._renderManagerService.getRenderById(o);if(!f)return;let{editPermission:p,viewPermission:m,copyPermission:h}=this._getLinkPermission({unitId:c,subUnitId:l,row:u,col:d}),_=f.with(i.DocEventManagerService);m&&(t==null||t.unsubscribe(),t=_.hoverCustomRanges$.pipe((0,s.debounceTime)(200)).subscribe(t=>{var r;let i=t.find(t=>t.range.rangeType===e.CustomRangeType.HYPERLINK);if(!i){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}let a=i.rects[i.rects.length-1];if(!(!((r=this._renderManagerService.getRenderById(c))==null||(r=r.with(n.SheetSkeletonManagerService).getSkeletonParam(l))==null)&&r.skeleton)||!a)return;let o=f.engine.getCanvasElement().getBoundingClientRect();this._sheetsHyperLinkPopupService.showPopup({unitId:c,subUnitId:l,row:u,col:d,customRange:i.range,customRangeRect:{left:a.left+o.left,top:a.top+o.top,bottom:a.bottom+o.top,right:a.right+o.left},editPermission:p,copyPermission:h,type:g.EDITING})}))})),this.disposeWithMe(()=>{t==null||t.unsubscribe()})}_initZenEditor(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e?(this._sheetsHyperLinkPopupService.hideCurrentPopup(g.VIEWING),this._sheetsHyperLinkPopupService.hideCurrentPopup(g.EDITING),this._sheetsHyperLinkPopupService.endEditing(g.EDITING),this._sheetsHyperLinkPopupService.hideCurrentPopup(g.VIEWING)):(this._sheetsHyperLinkPopupService.hideCurrentPopup(g.ZEN_EDITOR),this._sheetsHyperLinkPopupService.endEditing(g.ZEN_EDITOR))})),this.disposeWithMe(this._univerInstanceService.focused$.pipe((0,s.switchMap)(t=>{let n=t===e.DOCS_ZEN_EDITOR_UNIT_ID_KEY?this._renderManagerService.getRenderById(t):null;return n?n.with(i.DocEventManagerService).hoverCustomRanges$.pipe((0,s.debounceTime)(200)):new s.Observable(e=>{e.next(null)})})).subscribe(t=>{let n=t==null?void 0:t.find(t=>t.range.rangeType===e.CustomRangeType.HYPERLINK),r=this._editorBridgeService.getEditCellState();if(n&&r){let{unitId:e,sheetId:t,row:i,column:a}=r,{editPermission:o,viewPermission:s,copyPermission:c}=this._getLinkPermission({unitId:e,subUnitId:t,row:i,col:a});s&&this._sheetsHyperLinkPopupService.showPopup({type:g.ZEN_EDITOR,unitId:e,subUnitId:t,row:i,col:a,customRange:n.range,editPermission:o,copyPermission:c})}else this._sheetsHyperLinkPopupService.hideCurrentPopup(g.ZEN_EDITOR)}))}_initTextSelectionListener(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(t=>{t&&t.unitId===e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._sheetsHyperLinkPopupService.endEditing(g.EDITING)}))}_initCommandListener(){let e=[t.ClearSelectionContentCommand.id,t.ClearSelectionAllCommand.id,t.ClearSelectionFormatCommand.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{e.includes(t.id)&&this._sheetsHyperLinkPopupService.hideCurrentPopup()}))}};Y=w([C(0,(0,e.Inject)(n.HoverManagerService)),C(1,(0,e.Inject)(F)),C(2,(0,e.Inject)(a.IRenderManagerService)),C(3,(0,e.Inject)(e.IPermissionService)),C(4,(0,e.Inject)(t.SheetPermissionCheckController)),C(5,e.ICommandService),C(6,n.IEditorBridgeService),C(7,(0,e.Inject)(r.DocSelectionManagerService)),C(8,e.IUniverInstanceService),C(9,o.IZenZoneService)],Y);let me=class extends e.Disposable{constructor(e,t){super(),this._context=e,this._hyperLinkModel=t,this._initSkeletonChange()}_initSkeletonChange(){let e=()=>{var e;(e=this._context.mainComponent)==null||e.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe((0,s.debounceTime)(16)).subscribe(()=>{e()}))}};me=w([C(1,(0,e.Inject)(d.HyperLinkModel))],me);let X=class extends e.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._hyperLinkModel=t,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(t.INTERCEPTOR_POINT.CELL_CONTENT,{effect:e.InterceptorEffectEnum.Value,priority:100,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t,s=this._hyperLinkModel.getHyperLinkByLocation(a,o,r,i);return s&&e?(e===t.rawData&&(e={...t.rawData}),e.linkUrl=s.payload,e.linkId=s.id,n(e)):n(e)}}))}};X=w([C(0,(0,e.Inject)(t.SheetInterceptorService)),C(1,(0,e.Inject)(d.HyperLinkModel))],X);const he={[o.RibbonInsertGroup.MEDIA]:{[V.id]:{order:1,menuItemFactory:G},[ce(V.id)]:{order:1,menuItemFactory:de}},[o.ContextMenuPosition.MAIN_AREA]:{[o.ContextMenuGroup.OTHERS]:{order:1,[V.id]:{order:0,menuItemFactory:le},[ce(V.id)]:{order:0,menuItemFactory:ue}}}};let Z=class extends e.Disposable{constructor(e,t,n,r,i){super(),this._componentManager=e,this._commandService=t,this._menuManagerService=n,this._injector=r,this._shortcutService=i,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[N.componentKey,N],[te.componentKey,te],[`LinkIcon`,m.LinkIcon]].forEach(([e,t])=>{this._componentManager.register(e,t)})}_initCommands(){[z,ie,B,V].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){this._menuManagerService.mergeMenu(he)}_initShortCut(){this._shortcutService.registerShortcut(K)}};Z=w([C(0,(0,e.Inject)(o.ComponentManager)),C(1,e.ICommandService),C(2,o.IMenuManagerService),C(3,(0,e.Inject)(e.Injector)),C(4,(0,e.Inject)(o.IShortcutService))],Z);let Q=class extends e.Disposable{constructor(e,t){super(),this._parserService=e,this._resolverService=t,this._handleInitUrl()}_handleInitUrl(){let e=location.hash;if(e){let t=this._parserService.parseHyperLink(e);this._resolverService.navigate(t)}}};Q=w([C(0,(0,e.Inject)(d.SheetsHyperLinkParserService)),C(1,(0,e.Inject)(E))],Q);let $=class extends e.Plugin{constructor(t=S,n,r){super(),this._config=t,this._injector=n,this._configService=r;let{menu:i,...a}=(0,e.merge)({},S,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(x,a)}onStarting(){[[E],[F],[ee],[X],[Y],[Z],[J],[H],[pe],[Q]].forEach(e=>this._injector.add(e)),this._injector.get(X)}onReady(){this._injector.get(a.IRenderManagerService).registerRenderModule(e.UniverInstanceType.UNIVER_SHEET,[me]),this._injector.get(J),this._injector.get(H),this._injector.get(Z)}onRendered(){this._injector.get(pe),this._injector.get(Q),this._injector.get(Y)}};A($,`pluginName`,ae),A($,`packageName`,fe),A($,`version`,q),A($,`type`,e.UniverInstanceType.UNIVER_SHEET),$=w([(0,e.DependentOn)(d.UniverSheetsHyperLinkPlugin,i.UniverDocsUIPlugin),C(1,(0,e.Inject)(e.Injector)),C(2,e.IConfigService)],$),exports.CloseHyperLinkPopupOperation=ie,exports.InsertHyperLinkOperation=B,exports.InsertLinkShortcut=K,exports.OpenHyperLinkEditPanelOperation=z,Object.defineProperty(exports,`SheetsHyperLinkCopyPasteController`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`SheetsHyperLinkPopupService`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`SheetsHyperLinkResolverService`,{enumerable:!0,get:function(){return E}}),exports.SheetsHyperLinkSidePanelService=ee,Object.defineProperty(exports,`UniverSheetsHyperLinkUIPlugin`,{enumerable:!0,get:function(){return $}});
@@ -1 +1 @@
1
- "use strict";const l={hyperLink:{form:{editTitle:"Edita l'enllaç",addTitle:"Insereix enllaç",label:"Etiqueta",type:"Tipus",link:"Enllaç",linkPlaceholder:"Introdueix l'enllaç",range:"Interval",worksheet:"Full de càlcul",definedName:"Nom definit",ok:"Confirmar",cancel:"Cancel·lar",labelPlaceholder:"Introdueix l'etiqueta",inputError:"Si us plau, introdueix",selectError:"Si us plau, selecciona",linkError:"Si us plau, introdueix un enllaç vàlid"},menu:{add:"Insereix enllaç"},message:{noSheet:"El full de destinació ha estat eliminat",refError:"Interval no vàlid",hiddenSheet:"No es pot obrir l'enllaç perquè el full enllaçat està amagat",coped:"Enllaç copiat al porta-retalls"},popup:{copy:"Copia l'enllaç",edit:"Edita l'enllaç",cancel:"Cancel·la l'enllaç"}}};module.exports=l;
1
+ const e={hyperLink:{form:{editTitle:`Edita l'enllaç`,addTitle:`Insereix enllaç`,label:`Etiqueta`,type:`Tipus`,link:`Enllaç`,linkPlaceholder:`Introdueix l'enllaç`,range:`Interval`,worksheet:`Full de càlcul`,definedName:`Nom definit`,ok:`Confirmar`,cancel:`Cancel·lar`,labelPlaceholder:`Introdueix l'etiqueta`,inputError:`Si us plau, introdueix`,selectError:`Si us plau, selecciona`,linkError:`Si us plau, introdueix un enllaç vàlid`},menu:{add:`Insereix enllaç`},message:{noSheet:`El full de destinació ha estat eliminat`,refError:`Interval no vàlid`,hiddenSheet:`No es pot obrir l'enllaç perquè el full enllaçat està amagat`,coped:`Enllaç copiat al porta-retalls`},popup:{copy:`Copia l'enllaç`,edit:`Edita l'enllaç`,cancel:`Cancel·la l'enllaç`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"Edit Link",addTitle:"Insert Link",label:"Label",type:"Type",link:"Link",linkPlaceholder:"Enter link",range:"Range",worksheet:"Worksheet",definedName:"Defined Name",ok:"Confirm",cancel:"Cancel",labelPlaceholder:"Enter label",inputError:"Please enter",selectError:"Please select",linkError:"Please enter a legal link"},menu:{add:"Insert Link"},message:{noSheet:"Target sheet has been delete",refError:"Invalid Range",hiddenSheet:"Cannot open the link because the linked sheet is hidden",coped:"Link copied to clipboard"},popup:{copy:"Copy Link",edit:"Edit Link",cancel:"Cancel Link"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`Edit Link`,addTitle:`Insert Link`,label:`Label`,type:`Type`,link:`Link`,linkPlaceholder:`Enter link`,range:`Range`,worksheet:`Worksheet`,definedName:`Defined Name`,ok:`Confirm`,cancel:`Cancel`,labelPlaceholder:`Enter label`,inputError:`Please enter`,selectError:`Please select`,linkError:`Please enter a legal link`},menu:{add:`Insert Link`},message:{noSheet:`Target sheet has been delete`,refError:`Invalid Range`,hiddenSheet:`Cannot open the link because the linked sheet is hidden`,coped:`Link copied to clipboard`},popup:{copy:`Copy Link`,edit:`Edit Link`,cancel:`Cancel Link`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"Editar enlace",addTitle:"Insertar enlace",label:"Etiqueta",type:"Tipo",link:"Enlace",linkPlaceholder:"Introduce el enlace",range:"Rango",worksheet:"Hoja de cálculo",definedName:"Nombre definido",ok:"Confirmar",cancel:"Cancelar",labelPlaceholder:"Introduce la etiqueta",inputError:"Por favor, introduce",selectError:"Por favor, selecciona",linkError:"Por favor, introduce un enlace válido"},menu:{add:"Insertar enlace"},message:{noSheet:"La hoja de destino ha sido eliminada",refError:"Rango no válido",hiddenSheet:"No se puede abrir el enlace porque la hoja enlazada está oculta",coped:"Enlace copiado al portapapeles"},popup:{copy:"Copiar enlace",edit:"Editar enlace",cancel:"Cancelar enlace"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`Editar enlace`,addTitle:`Insertar enlace`,label:`Etiqueta`,type:`Tipo`,link:`Enlace`,linkPlaceholder:`Introduce el enlace`,range:`Rango`,worksheet:`Hoja de cálculo`,definedName:`Nombre definido`,ok:`Confirmar`,cancel:`Cancelar`,labelPlaceholder:`Introduce la etiqueta`,inputError:`Por favor, introduce`,selectError:`Por favor, selecciona`,linkError:`Por favor, introduce un enlace válido`},menu:{add:`Insertar enlace`},message:{noSheet:`La hoja de destino ha sido eliminada`,refError:`Rango no válido`,hiddenSheet:`No se puede abrir el enlace porque la hoja enlazada está oculta`,coped:`Enlace copiado al portapapeles`},popup:{copy:`Copiar enlace`,edit:`Editar enlace`,cancel:`Cancelar enlace`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"ویرایش لینک",addTitle:"درج لینک",label:"برچسب",type:"نوع",link:"لینک",linkPlaceholder:"لینک را وارد کنید",range:"محدوده",worksheet:"برگ کار",definedName:"نام تعریف شده",ok:"تایید",cancel:"انصراف",labelPlaceholder:"برچسب را وارد کنید",inputError:"لطفا وارد کنید",selectError:"لطفا انتخاب کنید",linkError:"لطفا یک لینک معتبر وارد کنید"},menu:{add:"درج لینک"},message:{noSheet:"برگ هدف حذف شده است",refError:"محدوده نامعتبر",hiddenSheet:"نمی‌توان لینک را باز کرد زیرا برگ مرتبط پنهان است",coped:"لینک به کلیپ بورد کپی شد"},popup:{copy:"کپی لینک",edit:"ویرایش لینک",cancel:"لینک را لغو کنید"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`ویرایش لینک`,addTitle:`درج لینک`,label:`برچسب`,type:`نوع`,link:`لینک`,linkPlaceholder:`لینک را وارد کنید`,range:`محدوده`,worksheet:`برگ کار`,definedName:`نام تعریف شده`,ok:`تایید`,cancel:`انصراف`,labelPlaceholder:`برچسب را وارد کنید`,inputError:`لطفا وارد کنید`,selectError:`لطفا انتخاب کنید`,linkError:`لطفا یک لینک معتبر وارد کنید`},menu:{add:`درج لینک`},message:{noSheet:`برگ هدف حذف شده است`,refError:`محدوده نامعتبر`,hiddenSheet:`نمی‌توان لینک را باز کرد زیرا برگ مرتبط پنهان است`,coped:`لینک به کلیپ بورد کپی شد`},popup:{copy:`کپی لینک`,edit:`ویرایش لینک`,cancel:`لینک را لغو کنید`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"Modifier le lien",addTitle:"Insérer un lien",label:"Titre",type:"Type",link:"Lien",linkPlaceholder:"Entrez le lien",range:"Plage",worksheet:"Feuille de calcul",definedName:"Nom défini",ok:"Confirmer",cancel:"Annuler",labelPlaceholder:"Entrez le titre",inputError:"Veuillez entrer",selectError:"Veuillez sélectionner",linkError:"Veuillez entrer un lien valide"},menu:{add:"Insérer un lien"},message:{noSheet:"La feuille cible a été supprimée",refError:"Plage invalide",hiddenSheet:"Impossible d'ouvrir le lien car la feuille liée est masquée",coped:"Lien copié dans le presse-papiers"},popup:{copy:"Copier le lien",edit:"Modifier le lien",cancel:"Annuler le lien"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`Modifier le lien`,addTitle:`Insérer un lien`,label:`Titre`,type:`Type`,link:`Lien`,linkPlaceholder:`Entrez le lien`,range:`Plage`,worksheet:`Feuille de calcul`,definedName:`Nom défini`,ok:`Confirmer`,cancel:`Annuler`,labelPlaceholder:`Entrez le titre`,inputError:`Veuillez entrer`,selectError:`Veuillez sélectionner`,linkError:`Veuillez entrer un lien valide`},menu:{add:`Insérer un lien`},message:{noSheet:`La feuille cible a été supprimée`,refError:`Plage invalide`,hiddenSheet:`Impossible d'ouvrir le lien car la feuille liée est masquée`,coped:`Lien copié dans le presse-papiers`},popup:{copy:`Copier le lien`,edit:`Modifier le lien`,cancel:`Annuler le lien`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"リンクの編集",addTitle:"リンクの挿入",label:"表示文字列",type:"種類",link:"リンク",linkPlaceholder:"リンクを入力",range:"範囲",worksheet:"ワークシート",definedName:"定義済みの名前",ok:"OK",cancel:"キャンセル",labelPlaceholder:"表示する文字列を入力",inputError:"値を入力してください",selectError:"選択してください",linkError:"有効なリンクを入力してください"},menu:{add:"リンクの挿入"},message:{noSheet:"対象のワークシートが削除されました",refError:"無効な範囲です",hiddenSheet:"リンクを開けません。参照先のワークシートが非表示です",coped:"リンクがクリップボードにコピーされました"},popup:{copy:"リンクをコピー",edit:"リンクの編集",cancel:"リンク解除"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`リンクの編集`,addTitle:`リンクの挿入`,label:`表示文字列`,type:`種類`,link:`リンク`,linkPlaceholder:`リンクを入力`,range:`範囲`,worksheet:`ワークシート`,definedName:`定義済みの名前`,ok:`OK`,cancel:`キャンセル`,labelPlaceholder:`表示する文字列を入力`,inputError:`値を入力してください`,selectError:`選択してください`,linkError:`有効なリンクを入力してください`},menu:{add:`リンクの挿入`},message:{noSheet:`対象のワークシートが削除されました`,refError:`無効な範囲です`,hiddenSheet:`リンクを開けません。参照先のワークシートが非表示です`,coped:`リンクがクリップボードにコピーされました`},popup:{copy:`リンクをコピー`,edit:`リンクの編集`,cancel:`リンク解除`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"링크 편집",addTitle:"링크 삽입",label:"표시 텍스트",type:"유형",link:"링크",linkPlaceholder:"링크 입력",range:"범위",worksheet:"워크시트",definedName:"정의된 이름",ok:"확인",cancel:"취소",labelPlaceholder:"표시할 텍스트 입력",inputError:"값을 입력하세요",selectError:"선택하세요",linkError:"유효한 링크를 입력하세요"},menu:{add:"링크 삽입"},message:{noSheet:"대상 워크시트가 삭제되었습니다",refError:"잘못된 범위입니다",hiddenSheet:"링크를 열 수 없습니다. 연결된 워크시트가 숨겨져 있습니다",coped:"링크가 클립보드에 복사되었습니다"},popup:{copy:"링크 복사",edit:"링크 편집",cancel:"링크 취소"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`링크 편집`,addTitle:`링크 삽입`,label:`표시 텍스트`,type:`유형`,link:`링크`,linkPlaceholder:`링크 입력`,range:`범위`,worksheet:`워크시트`,definedName:`정의된 이름`,ok:`확인`,cancel:`취소`,labelPlaceholder:`표시할 텍스트 입력`,inputError:`값을 입력하세요`,selectError:`선택하세요`,linkError:`유효한 링크를 입력하세요`},menu:{add:`링크 삽입`},message:{noSheet:`대상 워크시트가 삭제되었습니다`,refError:`잘못된 범위입니다`,hiddenSheet:`링크를 열 수 없습니다. 연결된 워크시트가 숨겨져 있습니다`,coped:`링크가 클립보드에 복사되었습니다`},popup:{copy:`링크 복사`,edit:`링크 편집`,cancel:`링크 취소`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"Редактировать ссылку",addTitle:"Вставить ссылку",label:"Метка",type:"Тип",link:"Ссылка",linkPlaceholder:"Введите ссылку",range:"Диапазон",worksheet:"Лист",definedName:"Определенное имя",ok:"ОК",cancel:"Отмена",labelPlaceholder:"Введите метку",inputError:"Пожалуйста, введите",selectError:"Пожалуйста, выберите",linkError:"Пожалуйста, введите корректную ссылку"},menu:{add:"Вставить ссылку"},message:{noSheet:"Целевой лист был удален",refError:"Недопустимый диапазон",hiddenSheet:"Невозможно открыть ссылку, так как связанный лист скрыт",coped:"Ссылка скопирована в буфер обмена"},popup:{copy:"Копировать ссылку",edit:"Редактировать ссылку",cancel:"Отменить ссылку"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`Редактировать ссылку`,addTitle:`Вставить ссылку`,label:`Метка`,type:`Тип`,link:`Ссылка`,linkPlaceholder:`Введите ссылку`,range:`Диапазон`,worksheet:`Лист`,definedName:`Определенное имя`,ok:`ОК`,cancel:`Отмена`,labelPlaceholder:`Введите метку`,inputError:`Пожалуйста, введите`,selectError:`Пожалуйста, выберите`,linkError:`Пожалуйста, введите корректную ссылку`},menu:{add:`Вставить ссылку`},message:{noSheet:`Целевой лист был удален`,refError:`Недопустимый диапазон`,hiddenSheet:`Невозможно открыть ссылку, так как связанный лист скрыт`,coped:`Ссылка скопирована в буфер обмена`},popup:{copy:`Копировать ссылку`,edit:`Редактировать ссылку`,cancel:`Отменить ссылку`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const o={hyperLink:{form:{editTitle:"Upraviť odkaz",addTitle:"Vložiť odkaz",label:"Popisok",type:"Typ",link:"Odkaz",linkPlaceholder:"Zadajte odkaz",range:"Rozsah",worksheet:"Hárok",definedName:"Definovaný názov",ok:"Potvrdiť",cancel:"Zrušiť",labelPlaceholder:"Zadajte popisok",inputError:"Zadajte hodnotu",selectError:"Vyberte",linkError:"Zadajte platný odkaz"},menu:{add:"Vložiť odkaz"},message:{noSheet:"Cieľový hárok bol odstránený",refError:"Neplatný rozsah",hiddenSheet:"Odkaz nie je možné otvoriť, pretože prepojený hárok je skrytý",coped:"Odkaz skopírovaný do schránky"},popup:{copy:"Kopírovať odkaz",edit:"Upraviť odkaz",cancel:"Zrušiť odkaz"}}};module.exports=o;
1
+ const e={hyperLink:{form:{editTitle:`Upraviť odkaz`,addTitle:`Vložiť odkaz`,label:`Popisok`,type:`Typ`,link:`Odkaz`,linkPlaceholder:`Zadajte odkaz`,range:`Rozsah`,worksheet:`Hárok`,definedName:`Definovaný názov`,ok:`Potvrdiť`,cancel:`Zrušiť`,labelPlaceholder:`Zadajte popisok`,inputError:`Zadajte hodnotu`,selectError:`Vyberte`,linkError:`Zadajte platný odkaz`},menu:{add:`Vložiť odkaz`},message:{noSheet:`Cieľový hárok bol odstránený`,refError:`Neplatný rozsah`,hiddenSheet:`Odkaz nie je možné otvoriť, pretože prepojený hárok je skrytý`,coped:`Odkaz skopírovaný do schránky`},popup:{copy:`Kopírovať odkaz`,edit:`Upraviť odkaz`,cancel:`Zrušiť odkaz`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const n={hyperLink:{form:{editTitle:"Chỉnh sửa liên kết",addTitle:"Chèn liên kết",label:"Văn bản",labelPlaceholder:"Nhập văn bản",type:"Loại",link:"Liên kết",linkPlaceholder:"Nhập địa chỉ liên kết",range:"Ô",worksheet:"Bảng tính",definedName:"Tên đã xác định",ok:"Xác nhận",cancel:"Hủy",inputError:"Vui lòng nhập",selectError:"Vui lòng chọn",linkError:"Vui lòng nhập liên kết hợp lệ"},menu:{add:"Thêm liên kết"},message:{noSheet:"Bảng con này đã bị xóa",refError:"Tham chiếu lỗi",hiddenSheet:"Không thể mở bảng con bị ẩn",coped:"Liên kết đã được sao chép vào clipboard"},popup:{copy:"Sao chép",edit:"Chỉnh sửa",cancel:"Hủy liên kết"}}};module.exports=n;
1
+ const e={hyperLink:{form:{editTitle:`Chỉnh sửa liên kết`,addTitle:`Chèn liên kết`,label:`Văn bản`,labelPlaceholder:`Nhập văn bản`,type:`Loại`,link:`Liên kết`,linkPlaceholder:`Nhập địa chỉ liên kết`,range:`Ô`,worksheet:`Bảng tính`,definedName:`Tên đã xác định`,ok:`Xác nhận`,cancel:`Hủy`,inputError:`Vui lòng nhập`,selectError:`Vui lòng chọn`,linkError:`Vui lòng nhập liên kết hợp lệ`},menu:{add:`Thêm liên kết`},message:{noSheet:`Bảng con này đã bị xóa`,refError:`Tham chiếu lỗi`,hiddenSheet:`Không thể mở bảng con bị ẩn`,coped:`Liên kết đã được sao chép vào clipboard`},popup:{copy:`Sao chép`,edit:`Chỉnh sửa`,cancel:`Hủy liên kết`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"编辑链接",addTitle:"插入链接",label:"文本",labelPlaceholder:"输入文本",type:"类型",link:"链接",linkPlaceholder:"输入链接地址",range:"单元格",worksheet:"工作表",definedName:"定义的名称",ok:"确认",cancel:"取消",inputError:"请输入",selectError:"请选择",linkError:"请输入合法的链接"},menu:{add:"添加链接"},message:{noSheet:"该子表已被删除",refError:"错误的引用",hiddenSheet:"无法打开被隐藏的子表",coped:"链接已被复制到剪贴板"},popup:{copy:"复制",edit:"编辑",cancel:"取消链接"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`编辑链接`,addTitle:`插入链接`,label:`文本`,labelPlaceholder:`输入文本`,type:`类型`,link:`链接`,linkPlaceholder:`输入链接地址`,range:`单元格`,worksheet:`工作表`,definedName:`定义的名称`,ok:`确认`,cancel:`取消`,inputError:`请输入`,selectError:`请选择`,linkError:`请输入合法的链接`},menu:{add:`添加链接`},message:{noSheet:`该子表已被删除`,refError:`错误的引用`,hiddenSheet:`无法打开被隐藏的子表`,coped:`链接已被复制到剪贴板`},popup:{copy:`复制`,edit:`编辑`,cancel:`取消链接`}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={hyperLink:{form:{editTitle:"編輯連結",addTitle:"插入連結",label:"文本",labelPlaceholder:"輸入文字",type:"類型",link:"連結",linkPlaceholder:"輸入連結位址",range:"儲存格",worksheet:"工作表",definedName:"定義的名稱",ok:"確認",cancel:"取消",inputError:"請輸入",selectError:"請選擇",linkError:"請輸入合法的連結"},menu:{add:"新增連結"},message:{noSheet:"該子表已被刪除",refError:"錯誤的引用",hiddenSheet:"無法開啟被隱藏的子表",coped:"連結已複製到剪貼簿"},popup:{copy:"複製",edit:"編輯",cancel:"取消連結"}}};module.exports=e;
1
+ const e={hyperLink:{form:{editTitle:`編輯連結`,addTitle:`插入連結`,label:`文本`,labelPlaceholder:`輸入文字`,type:`類型`,link:`連結`,linkPlaceholder:`輸入連結位址`,range:`儲存格`,worksheet:`工作表`,definedName:`定義的名稱`,ok:`確認`,cancel:`取消`,inputError:`請輸入`,selectError:`請選擇`,linkError:`請輸入合法的連結`},menu:{add:`新增連結`},message:{noSheet:`該子表已被刪除`,refError:`錯誤的引用`,hiddenSheet:`無法開啟被隱藏的子表`,coped:`連結已複製到剪貼簿`},popup:{copy:`複製`,edit:`編輯`,cancel:`取消連結`}}};module.exports=e;
package/lib/es/facade.js CHANGED
@@ -1,12 +1 @@
1
- import { SheetsHyperLinkParserService as t } from "@univerjs/sheets-hyper-link";
2
- import { SheetsHyperLinkResolverService as n } from "@univerjs/sheets-hyper-link-ui";
3
- import { FWorkbookHyperLinkMixin as s } from "@univerjs/sheets-hyper-link/facade";
4
- import { FWorkbook as k } from "@univerjs/sheets/facade";
5
- class p extends s {
6
- // TODO: this should be migrated back to hyperlink ui plugin
7
- navigateToSheetHyperlink(e) {
8
- const r = this._injector.get(t), o = this._injector.get(n), i = r.parseHyperLink(e);
9
- o.navigate(i);
10
- }
11
- }
12
- k.extend(p);
1
+ import{SheetsHyperLinkParserService as e}from"@univerjs/sheets-hyper-link";import{SheetsHyperLinkResolverService as t}from"@univerjs/sheets-hyper-link-ui";import{FWorkbookHyperLinkMixin as n}from"@univerjs/sheets-hyper-link/facade";import{FWorkbook as r}from"@univerjs/sheets/facade";var i=class extends n{navigateToSheetHyperlink(n){let r=this._injector.get(e),i=this._injector.get(t),a=r.parseHyperLink(n);i.navigate(a)}};r.extend(i);export{};