@univerjs/sheets-drawing-ui 0.3.0-nightly.202410101606 → 0.3.0-nightly.202410111606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1 +1,2502 @@
1
- const _0x3d4902=_0x42a1;(function(_0x2e60ed,_0x341b3d){const _0x7312e2=_0x42a1,_0x2bb6fe=_0x2e60ed();while(!![]){try{const _0x173802=parseInt(_0x7312e2(0x1d7))/0x1+parseInt(_0x7312e2(0x276))/0x2*(parseInt(_0x7312e2(0x2e1))/0x3)+parseInt(_0x7312e2(0x373))/0x4+parseInt(_0x7312e2(0x290))/0x5*(-parseInt(_0x7312e2(0x351))/0x6)+parseInt(_0x7312e2(0x2e4))/0x7*(-parseInt(_0x7312e2(0x20f))/0x8)+parseInt(_0x7312e2(0x24e))/0x9+-parseInt(_0x7312e2(0x394))/0xa;if(_0x173802===_0x341b3d)break;else _0x2bb6fe['push'](_0x2bb6fe['shift']());}catch(_0xc07f6e){_0x2bb6fe['push'](_0x2bb6fe['shift']());}}}(_0x3354,0x56f16));var __defProp=Object[_0x3d4902(0x1c5)],__defNormalProp=(_0x5451ab,_0x2f00a3,_0x433551)=>_0x2f00a3 in _0x5451ab?__defProp(_0x5451ab,_0x2f00a3,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x433551}):_0x5451ab[_0x2f00a3]=_0x433551,__name=(_0x39af59,_0x1b8eab)=>__defProp(_0x39af59,'name',{'value':_0x1b8eab,'configurable':!0x0}),__publicField=(_0x132c1a,_0x118952,_0x35eabe)=>__defNormalProp(_0x132c1a,typeof _0x118952!='symbol'?_0x118952+'':_0x118952,_0x35eabe);import{CommandType,ICommandService,IUndoRedoService,LocaleService,IUniverInstanceService,useDependency,Inject,Injector,IContextService,RxDisposable,UniverInstanceType,connectInjector,toDisposable,FOCUSING_COMMON_DRAWINGS,Disposable,Direction,FOCUSING_FX_BAR_EDITOR,EDITOR_ACTIVATED,Tools,UserManagerService,IPermissionService,Rectangle,DrawingTypeEnum as _0x4c08d0,DisposableCollection,generateRandomId,DependentOn,Plugin,IConfigService}from'@univerjs/core';import{IDrawingManagerService,IImageIoService,DrawingTypeEnum,ArrangeTypeEnum,DRAWING_IMAGE_ALLOW_IMAGE_LIST,DRAWING_IMAGE_COUNT_LIMIT,ImageUploadStatusType,DRAWING_IMAGE_ALLOW_SIZE,getImageSize,DRAWING_IMAGE_WIDTH_LIMIT,DRAWING_IMAGE_HEIGHT_LIMIT,getDrawingShapeKeyByDrawingSearch,UniverDrawingPlugin}from'@univerjs/drawing';import{ImageCropperObject,COMPONENT_IMAGE_POPUP_MENU,OpenImageCropOperation,ImageResetSizeOperation,DrawingCommonPanel,DrawingRenderService,UniverDrawingUIPlugin}from'@univerjs/drawing-ui';import{IRenderManagerService,precisionTo,getGroupState,transformObjectOutOfGroup,RENDER_CLASS_TYPE,Rect,DRAWING_OBJECT_LAYER_INDEX,SHEET_VIEWPORT_KEY}from'@univerjs/engine-render';import{ISheetDrawingService,SetDrawingApplyMutation,DrawingApplyType,SheetDrawingAnchorType,UniverSheetsDrawingPlugin}from'@univerjs/sheets-drawing';import{SheetCanvasPopManagerService,attachRangeWithCoord,ISheetSelectionRenderService,SheetSkeletonManagerService,getCurrentRangeDisable$,COPY_TYPE,PREDEFINED_HOOK_NAME,virtualizeDiscreteRanges,ISheetClipboardService,SheetPrintInterceptorService,SetScrollOperation,SetZoomRatioOperation}from'@univerjs/sheets-ui';import{ISidebarService,IUIPartsService,BuiltInUIPart,ILocalFileService,IMessageService,MenuItemType,getMenuHiddenObservable,RibbonStartGroup,KeyCode,ComponentManager,IMenuManagerService,IShortcutService,CanvasFloatDomService}from'@univerjs/ui';import{takeUntil,combineLatest,map,filter,distinctUntilChanged,Subject,BehaviorSubject}from'rxjs';import{getSheetCommandTarget,SheetsSelectionsService,WorkbookEditablePermission,WorksheetEditPermission,RangeProtectionPermissionEditPoint,WorkbookViewPermission,WorksheetViewPermission,InsertRowCommand,InsertColCommand,RemoveRowCommand,RemoveColCommand,DeleteRangeMoveLeftCommand,DeleteRangeMoveUpCommand,InsertRangeMoveDownCommand,InsertRangeMoveRightCommand,DeltaRowHeightCommand,SetRowHeightCommand,DeltaColumnWidthCommand,SetColWidthCommand,SetRowHiddenCommand,SetSpecificRowsVisibleCommand,SetSpecificColsVisibleCommand,SetColHiddenCommand,MoveColsCommand,MoveRowsCommand,MoveRangeCommand,SetRowVisibleMutation,SetRowHiddenMutation,SetColVisibleMutation,SetColHiddenMutation,SetWorksheetRowHeightMutation,SetWorksheetColWidthMutation,SheetInterceptorService,SetWorksheetActiveOperation,SetFrozenMutation}from'@univerjs/sheets';import _0x2b08c1,{useEffect,forwardRef,useRef,createElement,useState}from'react';import{MessageType,RadioGroup,Radio}from'@univerjs/design';import _0x5733cb from'clsx';const PLUGIN_CONFIG_KEY=_0x3d4902(0x380),defaultPluginConfig={},ClearSheetDrawingTransformerOperation={'id':_0x3d4902(0x390),'type':CommandType[_0x3d4902(0x249)],'handler':__name((_0x451b74,_0x22ec77)=>{const _0x27ead6=_0x3d4902,_0x273001=_0x451b74['get'](IRenderManagerService);return _0x22ec77[_0x27ead6(0x23c)](_0x9e2724=>{const _0x40ff5d=_0x27ead6;var _0x4e4e01,_0x21008d;(_0x21008d=(_0x4e4e01=_0x273001[_0x40ff5d(0x200)](_0x9e2724))==null?void 0x0:_0x4e4e01[_0x40ff5d(0x34f)][_0x40ff5d(0x240)]())==null||_0x21008d['debounceRefreshControls']();}),!0x0;},_0x3d4902(0x312))},RemoveSheetDrawingCommand={'id':_0x3d4902(0x1f2),'type':CommandType['COMMAND'],'handler':__name((_0x461ddf,_0x4606e6)=>{const _0x37c11d=_0x3d4902,_0x3987ee=_0x461ddf[_0x37c11d(0x2c8)](ICommandService),_0x50ec30=_0x461ddf[_0x37c11d(0x2c8)](IUndoRedoService),_0x1ec8e5=_0x461ddf[_0x37c11d(0x2c8)](ISheetDrawingService);if(!_0x4606e6)return!0x1;const {drawings:_0x4d3ee6}=_0x4606e6,_0x4edd0b=[];_0x4d3ee6[_0x37c11d(0x23c)](_0x53c66d=>{const _0x1f2f16=_0x37c11d,{unitId:_0x432de3}=_0x53c66d;_0x4edd0b[_0x1f2f16(0x1dd)](_0x432de3);});const _0x5dbe9c=_0x1ec8e5['getBatchRemoveOp'](_0x4d3ee6),{unitId:_0x14bcd2,subUnitId:_0x4b3a74,undo:_0x58fd71,redo:_0x644b03,objects:_0x161a5d}=_0x5dbe9c;return _0x3987ee[_0x37c11d(0x31c)](SetDrawingApplyMutation['id'],{'unitId':_0x14bcd2,'subUnitId':_0x4b3a74,'op':_0x644b03,'objects':_0x161a5d,'type':DrawingApplyType[_0x37c11d(0x331)]})?(_0x50ec30[_0x37c11d(0x29e)]({'unitID':_0x14bcd2,'undoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x14bcd2,'subUnitId':_0x4b3a74,'op':_0x58fd71,'objects':_0x161a5d,'type':DrawingApplyType[_0x37c11d(0x1ef)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x4edd0b}],'redoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x14bcd2,'subUnitId':_0x4b3a74,'op':_0x644b03,'objects':_0x161a5d,'type':DrawingApplyType['REMOVE']}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x4edd0b}]}),!0x0):!0x1;},'handler')},COMPONENT_SHEET_DRAWING_PANEL='COMPONENT_SHEET_DRAWING_PANEL',SidebarSheetDrawingOperation={'id':_0x3d4902(0x2c6),'type':CommandType[_0x3d4902(0x217)],'handler':__name(async(_0x4c7c1f,_0x591c58)=>{const _0x19829e=_0x3d4902,_0x5710b3=_0x4c7c1f['get'](ISidebarService),_0x592dd9=_0x4c7c1f['get'](LocaleService),_0x3a0202=_0x4c7c1f['get'](IUniverInstanceService),_0x115f7d=_0x4c7c1f[_0x19829e(0x2c8)](IDrawingManagerService);if(!getSheetCommandTarget(_0x3a0202))return!0x1;switch(_0x591c58[_0x19829e(0x216)]){case _0x19829e(0x205):_0x5710b3['open']({'header':{'title':_0x592dd9['t'](_0x19829e(0x32f))},'children':{'label':COMPONENT_SHEET_DRAWING_PANEL},'onClose':__name(()=>{const _0x535691=_0x19829e;_0x115f7d[_0x535691(0x298)](null);},_0x19829e(0x377)),'width':0x168});break;case _0x19829e(0x2e0):default:_0x5710b3[_0x19829e(0x2e0)]();break;}return!0x0;},_0x3d4902(0x312))},EditSheetDrawingOperation={'id':'sheet.operation.edit-sheet-image','type':CommandType[_0x3d4902(0x1fe)],'handler':__name((_0x5bcac4,_0x4b0218)=>{const _0x1e41ca=_0x3d4902,_0x256397=_0x5bcac4[_0x1e41ca(0x2c8)](IDrawingManagerService),_0x43d02a=_0x5bcac4[_0x1e41ca(0x2c8)](ICommandService);return _0x4b0218==null?!0x1:(_0x256397[_0x1e41ca(0x298)]([_0x4b0218]),_0x43d02a['executeCommand'](SidebarSheetDrawingOperation['id'],{'value':_0x1e41ca(0x205)}),!0x0);},_0x3d4902(0x312))},uploadLoading=_0x3d4902(0x285),uploadLoadingBody='univer-upload-loading-body',uploadLoadingBodyAnimation=_0x3d4902(0x25b),univerCircleAnimation=_0x3d4902(0x23e),uploadLoadingBodyText=_0x3d4902(0x392),styles$1={'uploadLoading':uploadLoading,'uploadLoadingBody':uploadLoadingBody,'uploadLoadingBodyAnimation':uploadLoadingBodyAnimation,'univerCircleAnimation':univerCircleAnimation,'uploadLoadingBodyText':uploadLoadingBodyText},UploadLoading=__name(()=>{const _0x43beac=_0x3d4902,_0x3d1d5a=useDependency(IImageIoService),_0x5a0ccc=useDependency(LocaleService),[_0x9d5d2b,_0xf0533]=_0x2b08c1['useState'](0x0);return useEffect(()=>{const _0x5de050=_0x42a1,_0x593ea4=_0x3d1d5a[_0x5de050(0x323)][_0x5de050(0x2c2)](_0x3b6ec2=>{_0xf0533(_0x3b6ec2);});return()=>{const _0x25e755=_0x5de050;_0x593ea4[_0x25e755(0x335)]();};},[_0x3d1d5a]),_0x2b08c1['createElement'](_0x43beac(0x329),{'style':{'display':_0x9d5d2b>0x0?'block':_0x43beac(0x302)},'className':styles$1['uploadLoading']},_0x2b08c1[_0x43beac(0x296)](_0x43beac(0x329),{'className':styles$1[_0x43beac(0x2ca)]},_0x2b08c1[_0x43beac(0x296)](_0x43beac(0x329),{'className':styles$1[_0x43beac(0x383)]}),_0x2b08c1['createElement'](_0x43beac(0x329),{'className':styles$1[_0x43beac(0x333)]},_0x5a0ccc['t']('uploadLoading.loading')+':\x20'+_0x9d5d2b)));},'UploadLoading');var __defProp$9=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$9=Object[_0x3d4902(0x358)],__decorateClass$9=__name((_0x21c12e,_0x2da03,_0x6febfa,_0x4c2528)=>{const _0x1be958=_0x3d4902;for(var _0xbe7261=_0x4c2528>0x1?void 0x0:_0x4c2528?__getOwnPropDesc$9(_0x2da03,_0x6febfa):_0x2da03,_0x2ed1a0=_0x21c12e[_0x1be958(0x307)]-0x1,_0x4779fa;_0x2ed1a0>=0x0;_0x2ed1a0--)(_0x4779fa=_0x21c12e[_0x2ed1a0])&&(_0xbe7261=(_0x4c2528?_0x4779fa(_0x2da03,_0x6febfa,_0xbe7261):_0x4779fa(_0xbe7261))||_0xbe7261);return _0x4c2528&&_0xbe7261&&__defProp$9(_0x2da03,_0x6febfa,_0xbe7261),_0xbe7261;},'__decorateClass$9'),__decorateParam$9=__name((_0x1338de,_0x2b34a5)=>(_0x376824,_0x9acb03)=>_0x2b34a5(_0x376824,_0x9acb03,_0x1338de),_0x3d4902(0x22b)),_a;let DrawingPopupMenuController=(_a=class extends RxDisposable{constructor(_0x4f1503,_0x553d5c,_0x119488,_0x3bf845,_0xb21663,_0x8bf5c7,_0x69d4aa){const _0x1c874b=_0x3d4902;super(),__publicField(this,_0x1c874b(0x263),new Set()),(this[_0x1c874b(0x2e5)]=_0x4f1503,this[_0x1c874b(0x1bd)]=_0x553d5c,this[_0x1c874b(0x2e7)]=_0x119488,this[_0x1c874b(0x2ef)]=_0x3bf845,this['_univerInstanceService']=_0xb21663,this[_0x1c874b(0x2c7)]=_0x8bf5c7,this[_0x1c874b(0x372)]=_0x69d4aa,this[_0x1c874b(0x306)]());}[_0x3d4902(0x306)](){const _0x2ee0a6=_0x3d4902;this['_univerInstanceService'][_0x2ee0a6(0x2ee)](UniverInstanceType['UNIVER_SHEET'])['pipe'](takeUntil(this[_0x2ee0a6(0x2d2)]))[_0x2ee0a6(0x2c2)](_0xa10824=>this[_0x2ee0a6(0x2f1)](_0xa10824)),this[_0x2ee0a6(0x2b7)][_0x2ee0a6(0x314)](UniverInstanceType[_0x2ee0a6(0x1e8)])[_0x2ee0a6(0x1bc)](takeUntil(this[_0x2ee0a6(0x2d2)]))['subscribe'](_0x3d846c=>this[_0x2ee0a6(0x1d8)](_0x3d846c)),this['_univerInstanceService'][_0x2ee0a6(0x2a7)](UniverInstanceType[_0x2ee0a6(0x1e8)])['forEach'](_0x2cc4b8=>this[_0x2ee0a6(0x2f1)](_0x2cc4b8)),this[_0x2ee0a6(0x372)][_0x2ee0a6(0x2f0)](BuiltInUIPart[_0x2ee0a6(0x25d)],()=>connectInjector(UploadLoading,this[_0x2ee0a6(0x2e5)]));}[_0x3d4902(0x1d8)](_0x740a60){const _0x28dab8=_0x3d4902,_0xf0c34b=_0x740a60['getUnitId']();this['_renderManagerService'][_0x28dab8(0x2e3)](_0xf0c34b);}[_0x3d4902(0x2f1)](_0x23b6f1){const _0x3b2db2=_0x3d4902;if(!_0x23b6f1)return;const _0x26904a=_0x23b6f1['getUnitId']();this[_0x3b2db2(0x2ef)][_0x3b2db2(0x1ec)](_0x26904a)&&!this[_0x3b2db2(0x263)]['has'](_0x26904a)&&(this[_0x3b2db2(0x258)](_0x26904a),this[_0x3b2db2(0x263)]['add'](_0x26904a));}[_0x3d4902(0x1d6)](_0xe3215e){const _0x59f4be=_0x3d4902,_0x4fc8bd=_0xe3215e[_0x59f4be(0x2de)]();for(const _0x4d5dfa of _0x4fc8bd)if(_0x4d5dfa instanceof ImageCropperObject)return!0x0;return!0x1;}['_popupMenuListener'](_0x2048f2){const _0x29c0b6=_0x3d4902;var _0x4455a4;const _0x561d25=(_0x4455a4=this[_0x29c0b6(0x2ef)][_0x29c0b6(0x200)](_0x2048f2))==null?void 0x0:_0x4455a4[_0x29c0b6(0x34f)];if(!_0x561d25)return;const _0x42de18=_0x561d25[_0x29c0b6(0x301)]();if(!_0x42de18)return;let _0x19f822;this[_0x29c0b6(0x26e)](toDisposable(_0x42de18['createControl$'][_0x29c0b6(0x2c2)](()=>{const _0x4aecb9=_0x29c0b6;if(this[_0x4aecb9(0x2c7)][_0x4aecb9(0x20d)](FOCUSING_COMMON_DRAWINGS,!0x0),this['_hasCropObject'](_0x561d25))return;const _0x351cac=_0x42de18[_0x4aecb9(0x313)]();if(_0x351cac[_0x4aecb9(0x1e5)]>0x1){_0x19f822==null||_0x19f822[_0x4aecb9(0x272)]();return;}const _0x35f3cf=_0x351cac[_0x4aecb9(0x32b)]()[_0x4aecb9(0x24f)]()['value'];if(!_0x35f3cf)return;const _0x42655f=_0x35f3cf['oKey'],_0x344aac=this[_0x4aecb9(0x1bd)][_0x4aecb9(0x1f1)](_0x42655f);if(!_0x344aac)return;const {unitId:_0xd170dc,subUnitId:_0xa3ebf4,drawingId:_0x30db96,drawingType:_0x2e0223}=_0x344aac;_0x19f822==null||_0x19f822[_0x4aecb9(0x272)](),_0x19f822=this[_0x4aecb9(0x26e)](this['_canvasPopManagerService']['attachPopupToObject'](_0x35f3cf,{'componentKey':COMPONENT_IMAGE_POPUP_MENU,'direction':_0x4aecb9(0x24d),'offset':[0x2,0x0],'extraProps':{'menuItems':this[_0x4aecb9(0x338)](_0xd170dc,_0xa3ebf4,_0x30db96,_0x2e0223)}})),this[_0x4aecb9(0x1bd)][_0x4aecb9(0x298)]([{'unitId':_0xd170dc,'subUnitId':_0xa3ebf4,'drawingId':_0x30db96}]);}))),this['disposeWithMe'](_0x42de18[_0x29c0b6(0x269)][_0x29c0b6(0x2c2)](()=>{const _0x20ab7e=_0x29c0b6;_0x19f822==null||_0x19f822[_0x20ab7e(0x272)](),this[_0x20ab7e(0x2c7)]['setContextValue'](FOCUSING_COMMON_DRAWINGS,!0x1),this[_0x20ab7e(0x1bd)][_0x20ab7e(0x298)](null);})),this[_0x29c0b6(0x26e)](_0x42de18[_0x29c0b6(0x388)][_0x29c0b6(0x2c2)](()=>{_0x19f822==null||_0x19f822['dispose']();}));}[_0x3d4902(0x338)](_0x52cd8f,_0x5634e8,_0x37611a,_0x4aa68f){const _0x489c79=_0x3d4902;return[{'label':'image-popup.edit','index':0x0,'commandId':EditSheetDrawingOperation['id'],'commandParams':{'unitId':_0x52cd8f,'subUnitId':_0x5634e8,'drawingId':_0x37611a},'disable':_0x4aa68f===DrawingTypeEnum[_0x489c79(0x26f)]},{'label':_0x489c79(0x378),'index':0x1,'commandId':RemoveSheetDrawingCommand['id'],'commandParams':{'unitId':_0x52cd8f,'drawings':[{'unitId':_0x52cd8f,'subUnitId':_0x5634e8,'drawingId':_0x37611a}]},'disable':!0x1},{'label':'image-popup.crop','index':0x2,'commandId':OpenImageCropOperation['id'],'commandParams':{'unitId':_0x52cd8f,'subUnitId':_0x5634e8,'drawingId':_0x37611a},'disable':_0x4aa68f===DrawingTypeEnum[_0x489c79(0x26f)]},{'label':_0x489c79(0x221),'index':0x3,'commandId':ImageResetSizeOperation['id'],'commandParams':[{'unitId':_0x52cd8f,'subUnitId':_0x5634e8,'drawingId':_0x37611a}],'disable':_0x4aa68f===DrawingTypeEnum[_0x489c79(0x26f)]}];}},__name(_a,_0x3d4902(0x2a2)),_a);DrawingPopupMenuController=__decorateClass$9([__decorateParam$9(0x0,Inject(Injector)),__decorateParam$9(0x1,IDrawingManagerService),__decorateParam$9(0x2,Inject(SheetCanvasPopManagerService)),__decorateParam$9(0x3,IRenderManagerService),__decorateParam$9(0x4,IUniverInstanceService),__decorateParam$9(0x5,IContextService),__decorateParam$9(0x6,Inject(IUIPartsService))],DrawingPopupMenuController);function drawingPositionToTransform(_0x5f2486,_0x391613,_0x1d76c7){const _0x581115=_0x3d4902,{from:_0x5f4ca2,to:_0x58af36,flipY:flipY=!0x1,flipX:flipX=!0x1,angle:angle=0x0,skewX:skewX=0x0,skewY:skewY=0x0}=_0x5f2486,{column:_0x17aece,columnOffset:_0x413927,row:_0x5f5596,rowOffset:_0x44597c}=_0x5f4ca2,{column:_0x157e51,columnOffset:_0x12b499,row:_0x573a04,rowOffset:_0x5e203c}=_0x58af36,_0x447436=_0x1d76c7[_0x581115(0x253)](),_0x55efa3=attachRangeWithCoord(_0x447436,{'startColumn':_0x17aece,'endColumn':_0x17aece,'startRow':_0x5f5596,'endRow':_0x5f5596});if(_0x55efa3==null)return;const _0x4c78be=attachRangeWithCoord(_0x447436,{'startColumn':_0x157e51,'endColumn':_0x157e51,'startRow':_0x573a04,'endRow':_0x573a04});if(_0x4c78be==null)return;const {startX:_0xd136b2,startY:_0x13b211}=_0x55efa3,{startX:_0x5997e5,startY:_0x1c9e9d}=_0x4c78be;let _0x4a9055=precisionTo(_0xd136b2+_0x413927,0x1),_0x2cd72a=precisionTo(_0x13b211+_0x44597c,0x1),_0x145df2=precisionTo(_0x5997e5+_0x12b499-_0x4a9055,0x1),_0x53db3f=precisionTo(_0x1c9e9d+_0x5e203c-_0x2cd72a,0x1);_0x55efa3['startX']===_0x4c78be[_0x581115(0x295)]&&(_0x145df2=0x0),_0x55efa3['startY']===_0x4c78be['endY']&&(_0x53db3f=0x0);const _0x327b66=_0x447436[_0x581115(0x24c)]+_0x447436['columnTotalWidth'],_0x492d46=_0x447436[_0x581115(0x1c1)]+_0x447436['rowTotalHeight'];return _0x4a9055+_0x145df2>_0x327b66&&(_0x4a9055=_0x327b66-_0x145df2),_0x2cd72a+_0x53db3f>_0x492d46&&(_0x2cd72a=_0x492d46-_0x53db3f),{'flipY':flipY,'flipX':flipX,'angle':angle,'skewX':skewX,'skewY':skewY,'left':_0x4a9055,'top':_0x2cd72a,'width':_0x145df2,'height':_0x53db3f};}__name(drawingPositionToTransform,_0x3d4902(0x34c));function transformToDrawingPosition(_0xbe0078,_0x2bae00){const _0x4ebfa4=_0x3d4902,{left:left=0x0,top:top=0x0,width:width=0x0,height:height=0x0,flipY:flipY=!0x1,flipX:flipX=!0x1,angle:angle=0x0,skewX:skewX=0x0,skewY:skewY=0x0}=_0xbe0078,_0x4ac106=_0x2bae00[_0x4ebfa4(0x248)](left,top);if(_0x4ac106==null)return;const _0x5567ce={'column':_0x4ac106[_0x4ebfa4(0x2a9)],'columnOffset':precisionTo(left-_0x4ac106['startX'],0x1),'row':_0x4ac106[_0x4ebfa4(0x29d)],'rowOffset':precisionTo(top-_0x4ac106[_0x4ebfa4(0x34b)],0x1)},_0x5dd7cc=_0x2bae00[_0x4ebfa4(0x248)](left+width,top+height);if(_0x5dd7cc==null)return;const _0x48888f={'column':_0x5dd7cc['actualColumn'],'columnOffset':precisionTo(left+width-_0x5dd7cc[_0x4ebfa4(0x36e)],0x1),'row':_0x5dd7cc[_0x4ebfa4(0x29d)],'rowOffset':precisionTo(top+height-_0x5dd7cc[_0x4ebfa4(0x34b)],0x1)};return{'flipY':flipY,'flipX':flipX,'angle':angle,'skewX':skewX,'skewY':skewY,'from':_0x5567ce,'to':_0x48888f};}__name(transformToDrawingPosition,_0x3d4902(0x31e));var __defProp$8=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$8=Object[_0x3d4902(0x358)],__decorateClass$8=__name((_0x166393,_0x2c55ca,_0x313c97,_0x23941f)=>{const _0x300778=_0x3d4902;for(var _0x15710a=_0x23941f>0x1?void 0x0:_0x23941f?__getOwnPropDesc$8(_0x2c55ca,_0x313c97):_0x2c55ca,_0x533a37=_0x166393[_0x300778(0x307)]-0x1,_0x5e36f8;_0x533a37>=0x0;_0x533a37--)(_0x5e36f8=_0x166393[_0x533a37])&&(_0x15710a=(_0x23941f?_0x5e36f8(_0x2c55ca,_0x313c97,_0x15710a):_0x5e36f8(_0x15710a))||_0x15710a);return _0x23941f&&_0x15710a&&__defProp$8(_0x2c55ca,_0x313c97,_0x15710a),_0x15710a;},'__decorateClass$8'),__decorateParam$8=__name((_0x30dd0e,_0x2067b2)=>(_0x1f1dbd,_0xfc407)=>_0x2067b2(_0x1f1dbd,_0xfc407,_0x30dd0e),'__decorateParam$8'),_a2;let SheetsDrawingRenderController=(_a2=class extends Disposable{constructor(_0x97d7a5,_0x136c01,_0x2523b6,_0x3ac19f,_0x2fe148){const _0xe93ed3=_0x3d4902;super(),this['_context']=_0x97d7a5,this['_sheetDrawingService']=_0x136c01,this[_0xe93ed3(0x1bd)]=_0x2523b6,this[_0xe93ed3(0x31d)]=_0x3ac19f,this[_0xe93ed3(0x346)]=_0x2fe148,this['_init']();}[_0x3d4902(0x306)](){const _0x3a77a8=_0x3d4902;this[_0x3a77a8(0x1c7)]();}[_0x3d4902(0x1c7)](){const _0x4b6135=_0x3d4902;this[_0x4b6135(0x2cb)][_0x4b6135(0x260)](this['_context'][_0x4b6135(0x291)]);const _0x3a2daf=this[_0x4b6135(0x2cb)][_0x4b6135(0x2f8)](this[_0x4b6135(0x324)][_0x4b6135(0x291)]);for(const _0x472c08 in _0x3a2daf){const _0x3ffd33=_0x3a2daf[_0x472c08];for(const _0x1edee6 in _0x3ffd33['data']){const _0x2788ec=_0x3ffd33[_0x4b6135(0x34d)][_0x1edee6];_0x2788ec[_0x4b6135(0x32e)]=drawingPositionToTransform(_0x2788ec[_0x4b6135(0x2a0)],this[_0x4b6135(0x31d)],this['_sheetSkeletonManagerService']);}}this[_0x4b6135(0x1bd)][_0x4b6135(0x2f2)](this['_context'][_0x4b6135(0x291)],this[_0x4b6135(0x2cb)][_0x4b6135(0x2f8)](this[_0x4b6135(0x324)][_0x4b6135(0x291)])),this[_0x4b6135(0x1bd)]['initializeNotification'](this['_context'][_0x4b6135(0x291)]);}},__name(_a2,_0x3d4902(0x202)),_a2);SheetsDrawingRenderController=__decorateClass$8([__decorateParam$8(0x1,ISheetDrawingService),__decorateParam$8(0x2,IDrawingManagerService),__decorateParam$8(0x3,Inject(ISheetSelectionRenderService)),__decorateParam$8(0x4,Inject(SheetSkeletonManagerService))],SheetsDrawingRenderController);var __assign=function(){const _0x25036f=_0x3d4902;return __assign=Object['assign']||function(_0x213960){const _0x1f4a6a=_0x42a1;for(var _0x2bd2c9,_0x39efd8=0x1,_0x2de415=arguments[_0x1f4a6a(0x307)];_0x39efd8<_0x2de415;_0x39efd8++){_0x2bd2c9=arguments[_0x39efd8];for(var _0x2204f6 in _0x2bd2c9)Object[_0x1f4a6a(0x21e)]['hasOwnProperty'][_0x1f4a6a(0x222)](_0x2bd2c9,_0x2204f6)&&(_0x213960[_0x2204f6]=_0x2bd2c9[_0x2204f6]);}return _0x213960;},__assign[_0x25036f(0x2be)](this,arguments);},__rest=function(_0x1020b0,_0x141bea){const _0x557539=_0x3d4902;var _0x1a0e09={};for(var _0xdf738b in _0x1020b0)Object[_0x557539(0x21e)][_0x557539(0x293)][_0x557539(0x222)](_0x1020b0,_0xdf738b)&&_0x141bea[_0x557539(0x2f7)](_0xdf738b)<0x0&&(_0x1a0e09[_0xdf738b]=_0x1020b0[_0xdf738b]);if(_0x1020b0!=null&&typeof Object[_0x557539(0x315)]==_0x557539(0x2e2)){for(var _0x57c487=0x0,_0xdf738b=Object[_0x557539(0x315)](_0x1020b0);_0x57c487<_0xdf738b['length'];_0x57c487++)_0x141bea[_0x557539(0x2f7)](_0xdf738b[_0x57c487])<0x0&&Object[_0x557539(0x21e)]['propertyIsEnumerable'][_0x557539(0x222)](_0x1020b0,_0xdf738b[_0x57c487])&&(_0x1a0e09[_0xdf738b[_0x57c487]]=_0x1020b0[_0xdf738b[_0x57c487]]);}return _0x1a0e09;},IconBase=forwardRef(function(_0xfdfa98,_0xaa1934){const _0x10f40d=_0x3d4902;var _0x2c7d62=_0xfdfa98[_0x10f40d(0x282)],_0x5c0bb1=_0xfdfa98['id'],_0x497b08=_0xfdfa98[_0x10f40d(0x361)],_0x38d2d6=_0xfdfa98[_0x10f40d(0x2eb)],_0x11722d=__rest(_0xfdfa98,[_0x10f40d(0x282),'id','className',_0x10f40d(0x2eb)]),_0x47241e=_0x10f40d(0x229)[_0x10f40d(0x1c6)](_0x5c0bb1,'\x20')['concat'](_0x497b08||'')[_0x10f40d(0x28e)](),_0x3e5dc5=useRef('_'[_0x10f40d(0x1c6)](generateShortUuid()));return render(_0x2c7d62,''[_0x10f40d(0x1c6)](_0x5c0bb1),{'defIds':_0x2c7d62['defIds'],'idSuffix':_0x3e5dc5[_0x10f40d(0x29b)]},__assign({'ref':_0xaa1934,'className':_0x47241e},_0x11722d),_0x38d2d6);});function render(_0x449194,_0xd1f106,_0x315f46,_0x2c0c4a,_0x2b9800){const _0x9fb30a=_0x3d4902;return createElement(_0x449194[_0x9fb30a(0x261)],__assign(__assign({'key':_0xd1f106},replaceRuntimeIdsAndExtInAttrs(_0x449194,_0x315f46,_0x2b9800)),_0x2c0c4a),(replaceRuntimeIdsInDefs(_0x449194,_0x315f46)[_0x9fb30a(0x2d0)]||[])[_0x9fb30a(0x38d)](function(_0xca6ed1,_0x205b73){const _0x11a564=_0x9fb30a;return render(_0xca6ed1,''[_0x11a564(0x1c6)](_0xd1f106,'-')[_0x11a564(0x1c6)](_0x449194[_0x11a564(0x261)],'-')['concat'](_0x205b73),_0x315f46,void 0x0,_0x2b9800);}));}__name(render,'render');function replaceRuntimeIdsAndExtInAttrs(_0x18e588,_0x5985a5,_0x498aed){const _0x55d31a=_0x3d4902;var _0x1e0dc3=__assign({},_0x18e588[_0x55d31a(0x273)]);_0x498aed!=null&&_0x498aed[_0x55d31a(0x213)]&&_0x1e0dc3[_0x55d31a(0x228)]===_0x55d31a(0x213)&&(_0x1e0dc3[_0x55d31a(0x228)]=_0x498aed[_0x55d31a(0x213)]);var _0x24f6f5=_0x5985a5[_0x55d31a(0x20b)];return!_0x24f6f5||_0x24f6f5[_0x55d31a(0x307)]===0x0||(_0x18e588[_0x55d31a(0x261)]===_0x55d31a(0x37b)&&_0x1e0dc3[_0x55d31a(0x1ee)]&&(_0x1e0dc3['xlink:href']=_0x1e0dc3[_0x55d31a(0x1ee)]+_0x5985a5[_0x55d31a(0x277)]),Object[_0x55d31a(0x254)](_0x1e0dc3)[_0x55d31a(0x23c)](function(_0xf1c11a){const _0x97c0c6=_0x55d31a;var _0x1b7577=_0xf1c11a[0x0],_0x423403=_0xf1c11a[0x1];typeof _0x423403=='string'&&(_0x1e0dc3[_0x1b7577]=_0x423403[_0x97c0c6(0x328)](/url\(#(.*)\)/,_0x97c0c6(0x36d)[_0x97c0c6(0x1c6)](_0x5985a5[_0x97c0c6(0x277)],')')));})),_0x1e0dc3;}__name(replaceRuntimeIdsAndExtInAttrs,_0x3d4902(0x1f5));function replaceRuntimeIdsInDefs(_0x27ac55,_0x165fb5){const _0x3a268a=_0x3d4902;var _0x3a471a,_0x263c52=_0x165fb5['defIds'];return!_0x263c52||_0x263c52[_0x3a268a(0x307)]===0x0?_0x27ac55:_0x27ac55['tag']===_0x3a268a(0x30a)&&(!((_0x3a471a=_0x27ac55[_0x3a268a(0x2d0)])===null||_0x3a471a===void 0x0)&&_0x3a471a[_0x3a268a(0x307)])?__assign(__assign({},_0x27ac55),{'children':_0x27ac55[_0x3a268a(0x2d0)][_0x3a268a(0x38d)](function(_0x1f46eb){const _0x307baf=_0x3a268a;return typeof _0x1f46eb[_0x307baf(0x273)]['id']==_0x307baf(0x287)&&_0x263c52&&_0x263c52['indexOf'](_0x1f46eb[_0x307baf(0x273)]['id'])>-0x1?__assign(__assign({},_0x1f46eb),{'attrs':__assign(__assign({},_0x1f46eb['attrs']),{'id':_0x1f46eb[_0x307baf(0x273)]['id']+_0x165fb5['idSuffix']})}):_0x1f46eb;})}):_0x27ac55;}__name(replaceRuntimeIdsInDefs,_0x3d4902(0x2c3));function generateShortUuid(){const _0x16473f=_0x3d4902;return Math[_0x16473f(0x2b4)]()[_0x16473f(0x268)](0x24)[_0x16473f(0x33b)](0x2,0x8);}__name(generateShortUuid,_0x3d4902(0x283)),IconBase[_0x3d4902(0x1bb)]=_0x3d4902(0x22e);var element={'tag':_0x3d4902(0x2ac),'attrs':{'fill':_0x3d4902(0x302),'viewBox':_0x3d4902(0x266),'width':_0x3d4902(0x244),'height':'1em'},'children':[{'tag':_0x3d4902(0x2bf),'attrs':{'fill':_0x3d4902(0x2c9),'d':_0x3d4902(0x343),'fillRule':_0x3d4902(0x1cb),'clipRule':'evenodd'}},{'tag':_0x3d4902(0x2bf),'attrs':{'fill':_0x3d4902(0x2c9),'d':_0x3d4902(0x368)}}]},AddImageSingle=forwardRef(function(_0x107ad2,_0x1a4556){const _0x178195=_0x3d4902;return createElement(IconBase,Object['assign']({},_0x107ad2,{'id':_0x178195(0x30e),'ref':_0x1a4556,'icon':element}));});AddImageSingle[_0x3d4902(0x1bb)]=_0x3d4902(0x251);const DeleteDrawingsCommand={'id':'sheet.command.delete-drawing','type':CommandType[_0x3d4902(0x217)],'handler':__name(_0x5f10e5=>{const _0x7819c7=_0x3d4902,_0xed6f24=_0x5f10e5[_0x7819c7(0x2c8)](ICommandService),_0x4c876b=_0x5f10e5[_0x7819c7(0x2c8)](ISheetDrawingService)[_0x7819c7(0x28c)]();if(_0x4c876b['length']===0x0)return!0x1;const _0x52a954=_0x4c876b[0x0][_0x7819c7(0x291)],_0x477d91=_0x4c876b[_0x7819c7(0x38d)](_0x2791b0=>{const {unitId:_0x3bcb3c,subUnitId:_0x2ba849,drawingId:_0x5481da,drawingType:_0x1c963e}=_0x2791b0;return{'unitId':_0x3bcb3c,'subUnitId':_0x2ba849,'drawingId':_0x5481da,'drawingType':_0x1c963e};});return _0xed6f24[_0x7819c7(0x234)](RemoveSheetDrawingCommand['id'],{'unitId':_0x52a954,'drawings':_0x477d91});},_0x3d4902(0x312))};function ungroupToGroup(_0x397724){const _0x125486=_0x3d4902,_0x488bae=[];return _0x397724[_0x125486(0x23c)](_0x2362ff=>{const _0x276b83=_0x125486,{parent:_0x567da0,children:_0x2bae71}=_0x2362ff,{unitId:_0x9caec3,subUnitId:_0x4245d6,drawingId:_0x295691}=_0x567da0,_0x318a00=getGroupState(0x0,0x0,_0x2bae71[_0x276b83(0x38d)](_0x24d821=>_0x24d821[_0x276b83(0x32e)]||{})),_0x3cdb34=_0x2bae71['map'](_0x326f97=>{const _0x22690d=_0x276b83,_0x536270=_0x326f97['transform']||{'left':0x0,'top':0x0},{unitId:_0x3a8904,subUnitId:_0x3ae124,drawingId:_0x20c879}=_0x326f97;return{'unitId':_0x3a8904,'subUnitId':_0x3ae124,'drawingId':_0x20c879,'transform':{..._0x536270,'left':_0x536270['left']-_0x318a00[_0x22690d(0x242)],'top':_0x536270['top']-_0x318a00[_0x22690d(0x326)]},'groupId':_0x295691};}),_0xdf9f2e={'unitId':_0x9caec3,'subUnitId':_0x4245d6,'drawingId':_0x295691,'drawingType':DrawingTypeEnum[_0x276b83(0x1d1)],'transform':_0x318a00};_0x488bae[_0x276b83(0x1dd)]({'parent':_0xdf9f2e,'children':_0x3cdb34});}),_0x488bae;}__name(ungroupToGroup,'ungroupToGroup');function groupToUngroup(_0x44e57c){const _0x491771=[];return _0x44e57c['forEach'](_0x22f850=>{const _0x3b1147=_0x42a1,{parent:_0x33183f,children:_0x160957}=_0x22f850,{unitId:_0x2abb01,subUnitId:_0x436c17,drawingId:_0x5c0e76,transform:_0xb8dfd6={'width':0x0,'height':0x0}}=_0x33183f;if(_0xb8dfd6==null)return;const _0x5e5356=_0x160957[_0x3b1147(0x38d)](_0x1aa6cb=>{const _0x4fedbb=_0x3b1147,{transform:_0x2d0c36}=_0x1aa6cb,{unitId:_0x12a6a2,subUnitId:_0x3f9e41,drawingId:_0x3d73cd}=_0x1aa6cb,_0x17a8e7=transformObjectOutOfGroup(_0x2d0c36||{},_0xb8dfd6,_0xb8dfd6[_0x4fedbb(0x259)]||0x0,_0xb8dfd6[_0x4fedbb(0x241)]||0x0);return{'unitId':_0x12a6a2,'subUnitId':_0x3f9e41,'drawingId':_0x3d73cd,'transform':_0x17a8e7,'groupId':void 0x0};}),_0x4ec85f={'unitId':_0x2abb01,'subUnitId':_0x436c17,'drawingId':_0x5c0e76,'drawingType':DrawingTypeEnum[_0x3b1147(0x1d1)],'transform':{'left':0x0,'top':0x0}};_0x491771[_0x3b1147(0x1dd)]({'parent':_0x4ec85f,'children':_0x5e5356});}),_0x491771;}__name(groupToUngroup,_0x3d4902(0x212));const GroupSheetDrawingCommand={'id':'sheet.command.group-sheet-image','type':CommandType['COMMAND'],'handler':__name((_0x31f349,_0x11f5a1)=>{const _0x3414b8=_0x3d4902,_0x3c43e0=_0x31f349[_0x3414b8(0x2c8)](ICommandService),_0x1fd24f=_0x31f349['get'](IUndoRedoService),_0x3dfc00=_0x31f349[_0x3414b8(0x2c8)](ISheetDrawingService);if(!_0x11f5a1)return!0x1;const _0x3d6bd3=[];_0x11f5a1['forEach'](({parent:_0x2ba760,children:_0x2436a3})=>{const _0x2d669b=_0x3414b8;_0x3d6bd3[_0x2d669b(0x1dd)](_0x2ba760[_0x2d669b(0x291)]),_0x2436a3[_0x2d669b(0x23c)](_0x13cf0c=>{const _0x532be1=_0x2d669b;_0x3d6bd3['push'](_0x13cf0c[_0x532be1(0x291)]);});});const _0x5c4701=_0x3dfc00['getGroupDrawingOp'](_0x11f5a1),{unitId:_0x6c454f,subUnitId:_0x40fb92,undo:_0x8b542e,redo:_0x26e12a,objects:_0x488a04}=_0x5c4701;return _0x3c43e0[_0x3414b8(0x31c)](SetDrawingApplyMutation['id'],{'op':_0x26e12a,'unitId':_0x6c454f,'subUnitId':_0x40fb92,'objects':_0x488a04,'type':DrawingApplyType[_0x3414b8(0x1cc)]})?(_0x1fd24f[_0x3414b8(0x29e)]({'unitID':_0x6c454f,'undoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x8b542e,'unitId':_0x6c454f,'subUnitId':_0x40fb92,'objects':groupToUngroup(_0x488a04),'type':DrawingApplyType[_0x3414b8(0x2dc)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x3d6bd3}],'redoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x26e12a,'unitId':_0x6c454f,'subUnitId':_0x40fb92,'objects':_0x488a04,'type':DrawingApplyType['GROUP']}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x3d6bd3}]}),!0x0):!0x1;},'handler')},InsertSheetDrawingCommand={'id':_0x3d4902(0x38f),'type':CommandType[_0x3d4902(0x217)],'handler':__name((_0x53505d,_0xda3078)=>{const _0x2dab6a=_0x3d4902,_0x3aa55e=_0x53505d[_0x2dab6a(0x2c8)](ICommandService),_0x43de6c=_0x53505d[_0x2dab6a(0x2c8)](IUndoRedoService),_0xd437b3=_0x53505d[_0x2dab6a(0x2c8)](ISheetDrawingService);if(!_0xda3078)return!0x1;const _0x928cfb=_0xda3078['drawings'],_0x23c9a0=_0x928cfb[_0x2dab6a(0x38d)](_0x19c94c=>_0x19c94c['unitId']),_0x45114=_0xd437b3[_0x2dab6a(0x2fc)](_0x928cfb),{unitId:_0x5bd424,subUnitId:_0x2a0215,undo:_0x507ddb,redo:_0x2af079,objects:_0x38b65a}=_0x45114;return _0x3aa55e[_0x2dab6a(0x31c)](SetDrawingApplyMutation['id'],{'op':_0x2af079,'unitId':_0x5bd424,'subUnitId':_0x2a0215,'objects':_0x38b65a,'type':DrawingApplyType[_0x2dab6a(0x1ef)]})?(_0x43de6c[_0x2dab6a(0x29e)]({'unitID':_0x5bd424,'undoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x507ddb,'unitId':_0x5bd424,'subUnitId':_0x2a0215,'objects':_0x38b65a,'type':DrawingApplyType[_0x2dab6a(0x331)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x23c9a0}],'redoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x2af079,'unitId':_0x5bd424,'subUnitId':_0x2a0215,'objects':_0x38b65a,'type':DrawingApplyType['INSERT']}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x23c9a0}]}),!0x0):!0x1;},_0x3d4902(0x312))},SetDrawingArrangeCommand={'id':_0x3d4902(0x2ab),'type':CommandType['COMMAND'],'handler':__name((_0x1abeea,_0x50062c)=>{const _0x16780d=_0x3d4902,_0x1194a1=_0x1abeea[_0x16780d(0x2c8)](ICommandService),_0x433d0e=_0x1abeea[_0x16780d(0x2c8)](IUndoRedoService);if(!_0x50062c)return!0x1;const _0x596246=_0x1abeea[_0x16780d(0x2c8)](ISheetDrawingService),{unitId:_0x51062a,subUnitId:_0x48e1c9,drawingIds:_0x3f0631,arrangeType:_0x80c59d}=_0x50062c,_0x35b09f={'unitId':_0x51062a,'subUnitId':_0x48e1c9,'drawingIds':_0x3f0631};let _0x81e6b5;if(_0x80c59d===ArrangeTypeEnum['forward']?_0x81e6b5=_0x596246[_0x16780d(0x2a3)](_0x35b09f):_0x80c59d===ArrangeTypeEnum[_0x16780d(0x1e0)]?_0x81e6b5=_0x596246['getBackwardDrawingOp'](_0x35b09f):_0x80c59d===ArrangeTypeEnum[_0x16780d(0x1ca)]?_0x81e6b5=_0x596246[_0x16780d(0x262)](_0x35b09f):_0x80c59d===ArrangeTypeEnum['back']&&(_0x81e6b5=_0x596246['getBackDrawingsOp'](_0x35b09f)),_0x81e6b5==null)return!0x1;const {objects:_0x4abc48,redo:_0x4e80c6,undo:_0x286a21}=_0x81e6b5;return _0x1194a1['syncExecuteCommand'](SetDrawingApplyMutation['id'],{'op':_0x4e80c6,'unitId':_0x51062a,'subUnitId':_0x48e1c9,'objects':_0x4abc48,'type':DrawingApplyType[_0x16780d(0x356)]})?(_0x433d0e[_0x16780d(0x29e)]({'unitID':_0x51062a,'undoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x286a21,'unitId':_0x51062a,'subUnitId':_0x48e1c9,'objects':_0x4abc48,'type':DrawingApplyType['ARRANGE']}}],'redoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x4e80c6,'unitId':_0x51062a,'subUnitId':_0x48e1c9,'objects':_0x4abc48,'type':DrawingApplyType[_0x16780d(0x356)]}}]}),!0x0):!0x1;},_0x3d4902(0x312))},SetSheetDrawingCommand={'id':_0x3d4902(0x345),'type':CommandType['COMMAND'],'handler':__name((_0x11a7b5,_0x1d19cb)=>{const _0x1c7b56=_0x3d4902,_0x4a1a4b=_0x11a7b5[_0x1c7b56(0x2c8)](ICommandService),_0x563c7c=_0x11a7b5[_0x1c7b56(0x2c8)](IUndoRedoService),_0x220568=_0x11a7b5[_0x1c7b56(0x2c8)](ISheetDrawingService);if(!_0x1d19cb)return!0x1;const {drawings:_0x32d7ca}=_0x1d19cb,_0x1dfa8c=_0x220568['getBatchUpdateOp'](_0x32d7ca),{unitId:_0x1b16d3,subUnitId:_0x19a8cb,undo:_0x5e4b37,redo:_0x355ef,objects:_0x4c5f82}=_0x1dfa8c;return _0x4a1a4b[_0x1c7b56(0x31c)](SetDrawingApplyMutation['id'],{'unitId':_0x1b16d3,'subUnitId':_0x19a8cb,'op':_0x355ef,'objects':_0x4c5f82,'type':DrawingApplyType[_0x1c7b56(0x1cd)]})?(_0x563c7c[_0x1c7b56(0x29e)]({'unitID':_0x1b16d3,'undoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x1b16d3,'subUnitId':_0x19a8cb,'op':_0x5e4b37,'objects':_0x4c5f82,'type':DrawingApplyType[_0x1c7b56(0x1cd)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x1b16d3]}],'redoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x1b16d3,'subUnitId':_0x19a8cb,'op':_0x355ef,'objects':_0x4c5f82,'type':DrawingApplyType[_0x1c7b56(0x1cd)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x1b16d3]}]}),!0x0):!0x1;},_0x3d4902(0x312))},UngroupSheetDrawingCommand={'id':_0x3d4902(0x2f9),'type':CommandType[_0x3d4902(0x217)],'handler':__name((_0x58d1f4,_0x3174c0)=>{const _0x1c4860=_0x3d4902,_0x52b6ce=_0x58d1f4[_0x1c4860(0x2c8)](ICommandService),_0xadf93a=_0x58d1f4[_0x1c4860(0x2c8)](IUndoRedoService),_0x29d091=_0x58d1f4[_0x1c4860(0x2c8)](ISheetDrawingService);if(!_0x3174c0)return!0x1;const _0x27f5b6=[];_0x3174c0[_0x1c4860(0x23c)](({parent:_0x1afea4,children:_0xfa40f0})=>{const _0x43e7c0=_0x1c4860;_0x27f5b6['push'](_0x1afea4['unitId']),_0xfa40f0[_0x43e7c0(0x23c)](_0x245e4d=>{const _0x2783d0=_0x43e7c0;_0x27f5b6[_0x2783d0(0x1dd)](_0x245e4d[_0x2783d0(0x291)]);});});const _0x225966=_0x29d091[_0x1c4860(0x2ed)](_0x3174c0),{unitId:_0x35a094,subUnitId:_0xe4ea93,undo:_0x131616,redo:_0x523852,objects:_0x360025}=_0x225966;return _0x52b6ce['syncExecuteCommand'](SetDrawingApplyMutation['id'],{'op':_0x523852,'unitId':_0x35a094,'subUnitId':_0xe4ea93,'objects':_0x360025,'type':DrawingApplyType[_0x1c4860(0x2dc)]})?(_0xadf93a[_0x1c4860(0x29e)]({'unitID':_0x35a094,'undoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x131616,'unitId':_0x35a094,'subUnitId':_0xe4ea93,'objects':ungroupToGroup(_0x360025),'type':DrawingApplyType[_0x1c4860(0x1cc)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x27f5b6}],'redoMutations':[{'id':SetDrawingApplyMutation['id'],'params':{'op':_0x523852,'unitId':_0x35a094,'subUnitId':_0xe4ea93,'objects':_0x360025,'type':DrawingApplyType[_0x1c4860(0x2dc)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':_0x27f5b6}]}),!0x0):!0x1;},_0x3d4902(0x312))};var __defProp$7=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$7=Object[_0x3d4902(0x358)],__decorateClass$7=__name((_0x4b6657,_0x56e850,_0x51cd21,_0x58e0dc)=>{const _0x25318c=_0x3d4902;for(var _0x2766bd=_0x58e0dc>0x1?void 0x0:_0x58e0dc?__getOwnPropDesc$7(_0x56e850,_0x51cd21):_0x56e850,_0x1c929a=_0x4b6657[_0x25318c(0x307)]-0x1,_0x3974c1;_0x1c929a>=0x0;_0x1c929a--)(_0x3974c1=_0x4b6657[_0x1c929a])&&(_0x2766bd=(_0x58e0dc?_0x3974c1(_0x56e850,_0x51cd21,_0x2766bd):_0x3974c1(_0x2766bd))||_0x2766bd);return _0x58e0dc&&_0x2766bd&&__defProp$7(_0x56e850,_0x51cd21,_0x2766bd),_0x2766bd;},_0x3d4902(0x33f)),__decorateParam$7=__name((_0x1cbb0c,_0x70c96a)=>(_0x3919c7,_0x98efe5)=>_0x70c96a(_0x3919c7,_0x98efe5,_0x1cbb0c),_0x3d4902(0x23a)),_a3;let SheetDrawingUpdateController=(_a3=class extends Disposable{constructor(_0x12e714,_0x2110fb,_0x2a57c1,_0x5e58d8,_0x1858fc,_0x3779d4,_0x11e454,_0x17c4a3,_0x4fd33d,_0x125ca2,_0x5b04c7,_0x947012){const _0x40a9e0=_0x3d4902;super(),__publicField(this,_0x40a9e0(0x1ce)),(this[_0x40a9e0(0x324)]=_0x12e714,this[_0x40a9e0(0x2d4)]=_0x2110fb,this[_0x40a9e0(0x208)]=_0x2a57c1,this[_0x40a9e0(0x36b)]=_0x5e58d8,this[_0x40a9e0(0x243)]=_0x1858fc,this[_0x40a9e0(0x219)]=_0x3779d4,this[_0x40a9e0(0x2cb)]=_0x11e454,this[_0x40a9e0(0x1bd)]=_0x17c4a3,this['_contextService']=_0x4fd33d,this[_0x40a9e0(0x362)]=_0x125ca2,this[_0x40a9e0(0x2fa)]=_0x5b04c7,this[_0x40a9e0(0x1ce)]=_0x947012['getWorkbookSelections'](this['_context'][_0x40a9e0(0x291)]),this[_0x40a9e0(0x29a)](),this[_0x40a9e0(0x24b)](),this[_0x40a9e0(0x33e)](),this['_focusDrawingListener']());}async[_0x3d4902(0x25f)](){const _0x1a570c=_0x3d4902,_0x14f08f=await this[_0x1a570c(0x219)][_0x1a570c(0x1fb)]({'multiple':!0x0,'accept':DRAWING_IMAGE_ALLOW_IMAGE_LIST[_0x1a570c(0x38d)](_0x29af6d=>'.'+_0x29af6d[_0x1a570c(0x328)](_0x1a570c(0x1fa),''))['join'](',')}),_0x43adc1=_0x14f08f[_0x1a570c(0x307)];return _0x43adc1>DRAWING_IMAGE_COUNT_LIMIT?(this[_0x1a570c(0x362)]['show']({'type':MessageType[_0x1a570c(0x27b)],'content':this['_localeService']['t'](_0x1a570c(0x236),String(DRAWING_IMAGE_COUNT_LIMIT))}),!0x1):_0x43adc1===0x0?!0x1:(_0x14f08f['forEach'](async _0x499487=>await this[_0x1a570c(0x2c0)](_0x499487)),!0x0);}async[_0x3d4902(0x2c0)](_0x58b542){const _0x1cadc5=_0x3d4902;let _0x146c15;try{_0x146c15=await this[_0x1cadc5(0x243)][_0x1cadc5(0x252)](_0x58b542);}catch(_0x5c3b1f){const _0x3223f6=_0x5c3b1f['message'];_0x3223f6===ImageUploadStatusType[_0x1cadc5(0x348)]?this['_messageService'][_0x1cadc5(0x27d)]({'type':MessageType['Error'],'content':this[_0x1cadc5(0x2fa)]['t'](_0x1cadc5(0x1fd),String(DRAWING_IMAGE_ALLOW_SIZE/(0x400*0x400)))}):_0x3223f6===ImageUploadStatusType[_0x1cadc5(0x271)]?this[_0x1cadc5(0x362)][_0x1cadc5(0x27d)]({'type':MessageType[_0x1cadc5(0x27b)],'content':this[_0x1cadc5(0x2fa)]['t']('update-status.invalidImageType')}):_0x3223f6===ImageUploadStatusType[_0x1cadc5(0x214)]&&this[_0x1cadc5(0x362)][_0x1cadc5(0x27d)]({'type':MessageType[_0x1cadc5(0x27b)],'content':this[_0x1cadc5(0x2fa)]['t'](_0x1cadc5(0x23d))});}if(_0x146c15==null)return;const _0x467026=this[_0x1cadc5(0x1e6)](),{unitId:_0x1fc7ec,subUnitId:_0xa4c669}=_0x467026,{imageId:_0x516143,imageSourceType:_0x2746a3,source:_0x3d802c,base64Cache:_0x3a39d3}=_0x146c15,{width:_0x1fec69,height:_0x453403,image:_0xb195fd}=await getImageSize(_0x3a39d3||''),{width:_0x4520f5,height:_0x5a22e5}=this[_0x1cadc5(0x324)][_0x1cadc5(0x34f)];this['_imageIoService']['addImageSourceCache'](_0x3d802c,_0x2746a3,_0xb195fd);let _0x13f978=0x1;if(_0x1fec69>DRAWING_IMAGE_WIDTH_LIMIT||_0x453403>DRAWING_IMAGE_HEIGHT_LIMIT){const _0x1abb6a=DRAWING_IMAGE_WIDTH_LIMIT/_0x1fec69,_0x250d86=DRAWING_IMAGE_HEIGHT_LIMIT/_0x453403;_0x13f978=Math[_0x1cadc5(0x211)](_0x1abb6a,_0x250d86);}const _0x216b9a=this[_0x1cadc5(0x381)](_0x1fec69*_0x13f978,_0x453403*_0x13f978,_0x4520f5,_0x5a22e5);if(_0x216b9a==null)return;const _0xf3674={'unitId':_0x1fc7ec,'subUnitId':_0xa4c669,'drawingId':_0x516143,'drawingType':DrawingTypeEnum[_0x1cadc5(0x1ff)],'imageSourceType':_0x2746a3,'source':_0x3d802c,'transform':drawingPositionToTransform(_0x216b9a,this[_0x1cadc5(0x36b)],this['_skeletonManagerService']),'sheetTransform':_0x216b9a};this[_0x1cadc5(0x208)][_0x1cadc5(0x234)](InsertSheetDrawingCommand['id'],{'unitId':_0x1fc7ec,'drawings':[_0xf3674]});}[_0x3d4902(0x1e6)](){const _0x1afffc=_0x3d4902,_0x1cf479=this[_0x1afffc(0x324)][_0x1afffc(0x1f3)],_0x232846=_0x1cf479[_0x1afffc(0x31f)](),_0x4ebf6c=_0x1cf479[_0x1afffc(0x33a)](),_0x186db1=_0x232846['getSheetId']();return{'unitId':_0x4ebf6c,'subUnitId':_0x186db1};}[_0x3d4902(0x381)](_0x4a1d8b,_0x5cc99d,_0x1ca68e,_0x46b862){const _0xe1f0f4=_0x3d4902,_0x28f1e7=this[_0xe1f0f4(0x1ce)][_0xe1f0f4(0x2a1)]();let _0x104ea8={'startRow':0x0,'endRow':0x0,'startColumn':0x0,'endColumn':0x0};_0x28f1e7&&_0x28f1e7[_0xe1f0f4(0x307)]>0x0&&(_0x104ea8=_0x28f1e7[_0x28f1e7[_0xe1f0f4(0x307)]-0x1][_0xe1f0f4(0x227)]);const _0x288c9c=attachRangeWithCoord(this[_0xe1f0f4(0x2d4)][_0xe1f0f4(0x1c9)]()[_0xe1f0f4(0x300)],_0x104ea8);if(_0x288c9c==null)return;let {startColumn:_0x8a43da,startRow:_0x5ac242,startX:_0x564a3f,startY:_0x566137}=_0x288c9c,_0x48071=!0x1;if(_0x564a3f+_0x4a1d8b>_0x1ca68e&&(_0x564a3f=_0x1ca68e-_0x4a1d8b,_0x564a3f<0x0&&(_0x564a3f=0x0,_0x4a1d8b=_0x1ca68e),_0x48071=!0x0),_0x566137+_0x5cc99d>_0x46b862&&(_0x566137=_0x46b862-_0x5cc99d,_0x566137<0x0&&(_0x566137=0x0,_0x5cc99d=_0x46b862),_0x48071=!0x0),_0x48071){const _0x797597=this['_selectionRenderService'][_0xe1f0f4(0x248)](_0x564a3f,_0x566137);if(_0x797597==null)return;_0x564a3f=_0x797597[_0xe1f0f4(0x36e)],_0x566137=_0x797597[_0xe1f0f4(0x34b)],_0x8a43da=_0x797597[_0xe1f0f4(0x2a9)],_0x5ac242=_0x797597[_0xe1f0f4(0x29d)];}const _0x12fb59={'column':_0x8a43da,'columnOffset':0x0,'row':_0x5ac242,'rowOffset':0x0},_0x4f2d51=this[_0xe1f0f4(0x36b)][_0xe1f0f4(0x248)](_0x564a3f+_0x4a1d8b,_0x566137+_0x5cc99d);if(_0x4f2d51==null)return;const _0x2b7ea7={'column':_0x4f2d51[_0xe1f0f4(0x2a9)],'columnOffset':_0x564a3f+_0x4a1d8b-_0x4f2d51['startX'],'row':_0x4f2d51[_0xe1f0f4(0x29d)],'rowOffset':_0x566137+_0x5cc99d-_0x4f2d51[_0xe1f0f4(0x34b)]};return{'from':_0x12fb59,'to':_0x2b7ea7};}[_0x3d4902(0x24b)](){const _0x8f2534=_0x3d4902;this[_0x8f2534(0x1bd)][_0x8f2534(0x1e9)][_0x8f2534(0x2c2)](_0x4167d0=>{const _0x2cc814=_0x8f2534,{unitId:_0xe4afd6,subUnitId:_0x1944b3,drawingIds:_0x4b4baa,arrangeType:_0x4b91d7}=_0x4167d0;this[_0x2cc814(0x208)][_0x2cc814(0x234)](SetDrawingArrangeCommand['id'],{'unitId':_0xe4afd6,'subUnitId':_0x1944b3,'drawingIds':_0x4b4baa,'arrangeType':_0x4b91d7});});}[_0x3d4902(0x29a)](){const _0xa038d8=_0x3d4902;this['_drawingManagerService'][_0xa038d8(0x35b)][_0xa038d8(0x2c2)](_0x397474=>{const _0x58caea=_0xa038d8,_0x514555=[];_0x397474[_0x58caea(0x307)]!==0x0&&(_0x397474['forEach'](_0x3c2a69=>{const _0x50237a=_0x58caea,{unitId:_0x344555,subUnitId:_0x1addc4,drawingId:_0x5b0232,drawingType:_0x30d386,transform:_0x331d5e}=_0x3c2a69;if(_0x331d5e==null)return;const _0xe49963=this[_0x50237a(0x2cb)][_0x50237a(0x1fc)]({'unitId':_0x344555,'subUnitId':_0x1addc4,'drawingId':_0x5b0232});if(_0xe49963==null||_0xe49963['unitId']!==this[_0x50237a(0x324)][_0x50237a(0x291)])return;const _0xf66de=transformToDrawingPosition({..._0xe49963['transform'],..._0x331d5e},this['_selectionRenderService']);if(_0xf66de==null)return;const _0x2ed75a={..._0x3c2a69,'transform':{..._0xe49963['transform'],..._0x331d5e,...drawingPositionToTransform(_0xf66de,this[_0x50237a(0x36b)],this[_0x50237a(0x2d4)])},'sheetTransform':{..._0xf66de}};_0x514555[_0x50237a(0x1dd)](_0x2ed75a);}),_0x514555['length']>0x0&&this[_0x58caea(0x208)][_0x58caea(0x234)](SetSheetDrawingCommand['id'],{'unitId':_0x397474[0x0]['unitId'],'drawings':_0x514555}));});}[_0x3d4902(0x33e)](){const _0x4c08f7=_0x3d4902;this[_0x4c08f7(0x1bd)][_0x4c08f7(0x2fb)][_0x4c08f7(0x2c2)](_0x19ba9d=>{const _0x59d318=_0x4c08f7;this[_0x59d318(0x208)][_0x59d318(0x234)](GroupSheetDrawingCommand['id'],_0x19ba9d);const {unitId:_0x3da15a,subUnitId:_0x5265bd,drawingId:_0x534779}=_0x19ba9d[0x0][_0x59d318(0x375)];this[_0x59d318(0x1bd)]['focusDrawing']([{'unitId':_0x3da15a,'subUnitId':_0x5265bd,'drawingId':_0x534779}]);}),this['_drawingManagerService'][_0x4c08f7(0x340)]['subscribe'](_0x5cd806=>{const _0xe1b7db=_0x4c08f7;this['_commandService'][_0xe1b7db(0x234)](UngroupSheetDrawingCommand['id'],_0x5cd806);});}[_0x3d4902(0x28d)](){const _0x5b0506=_0x3d4902;this[_0x5b0506(0x26e)](this['_drawingManagerService'][_0x5b0506(0x28a)]['subscribe'](_0x2bddf1=>{const _0x32f03f=_0x5b0506;_0x2bddf1==null||_0x2bddf1[_0x32f03f(0x307)]===0x0?(this[_0x32f03f(0x2c7)]['setContextValue'](FOCUSING_COMMON_DRAWINGS,!0x1),this[_0x32f03f(0x2cb)]['focusDrawing']([])):(this['_contextService'][_0x32f03f(0x20d)](FOCUSING_COMMON_DRAWINGS,!0x0),this[_0x32f03f(0x2cb)][_0x32f03f(0x298)](_0x2bddf1));}));}},__name(_a3,_0x3d4902(0x308)),_a3);SheetDrawingUpdateController=__decorateClass$7([__decorateParam$7(0x1,Inject(SheetSkeletonManagerService)),__decorateParam$7(0x2,ICommandService),__decorateParam$7(0x3,ISheetSelectionRenderService),__decorateParam$7(0x4,IImageIoService),__decorateParam$7(0x5,ILocalFileService),__decorateParam$7(0x6,ISheetDrawingService),__decorateParam$7(0x7,IDrawingManagerService),__decorateParam$7(0x8,IContextService),__decorateParam$7(0x9,IMessageService),__decorateParam$7(0xa,Inject(LocaleService)),__decorateParam$7(0xb,Inject(SheetsSelectionsService))],SheetDrawingUpdateController);const InsertFloatImageCommand={'id':_0x3d4902(0x207),'type':CommandType['COMMAND'],'handler':__name(_0xdfb341=>{const _0x31365=_0x3d4902;var _0x86946c,_0x1c3118;return(_0x1c3118=(_0x86946c=_0xdfb341[_0x31365(0x2c8)](IRenderManagerService)[_0x31365(0x1c3)](UniverInstanceType[_0x31365(0x1e8)]))==null?void 0x0:_0x86946c[_0x31365(0x1f7)](SheetDrawingUpdateController)[_0x31365(0x25f)]())!=null?_0x1c3118:!0x1;},'handler')},MoveDrawingsCommand={'id':'sheet.command.move-drawing','type':CommandType[_0x3d4902(0x217)],'handler':__name((_0x15031c,_0x1ec317)=>{const _0x5aef94=_0x3d4902,_0x2e6961=_0x15031c['get'](ICommandService),_0x3150df=_0x15031c[_0x5aef94(0x2c8)](ISheetDrawingService),_0x2b5402=_0x15031c[_0x5aef94(0x2c8)](ISheetSelectionRenderService),{direction:_0x1db143}=_0x1ec317,_0x4a92bc=_0x3150df['getFocusDrawings']();if(_0x4a92bc['length']===0x0)return!0x1;const _0x2e6df1=_0x4a92bc[0x0][_0x5aef94(0x291)],_0x6e9b2d=_0x4a92bc['map'](_0x1e5ee0=>{const _0x4d2b8e=_0x5aef94,{transform:_0x440d20}=_0x1e5ee0;if(_0x440d20==null)return null;const _0x12d373={..._0x440d20},{left:left=0x0,top:top=0x0}=_0x440d20;return _0x1db143===Direction['UP']?_0x12d373['top']=top-0x1:_0x1db143===Direction[_0x4d2b8e(0x1e1)]?_0x12d373[_0x4d2b8e(0x326)]=top+0x1:_0x1db143===Direction[_0x4d2b8e(0x21a)]?_0x12d373[_0x4d2b8e(0x242)]=left-0x1:_0x1db143===Direction[_0x4d2b8e(0x2b9)]&&(_0x12d373[_0x4d2b8e(0x242)]=left+0x1),{..._0x1e5ee0,'transform':_0x12d373,'sheetTransform':transformToDrawingPosition(_0x12d373,_0x2b5402)};})[_0x5aef94(0x1e3)](_0x3cc3f1=>_0x3cc3f1!=null);return _0x2e6961[_0x5aef94(0x31c)](SetSheetDrawingCommand['id'],{'unitId':_0x2e6df1,'drawings':_0x6e9b2d})?(_0x2e6961[_0x5aef94(0x31c)](ClearSheetDrawingTransformerOperation['id'],[_0x2e6df1]),!0x0):!0x1;},_0x3d4902(0x312))},IMAGE_UPLOAD_ICON=_0x3d4902(0x35d),IMAGE_MENU_ID=_0x3d4902(0x1d4);function ImageMenuFactory(_0x4ef23a){const _0x3cd2bd=_0x3d4902;return{'id':IMAGE_MENU_ID,'type':MenuItemType[_0x3cd2bd(0x304)],'icon':IMAGE_UPLOAD_ICON,'tooltip':_0x3cd2bd(0x34a),'hidden$':getMenuHiddenObservable(_0x4ef23a,UniverInstanceType[_0x3cd2bd(0x1e8)]),'disabled$':getCurrentRangeDisable$(_0x4ef23a,{'workbookTypes':[WorkbookEditablePermission],'worksheetTypes':[WorksheetEditPermission],'rangeTypes':[RangeProtectionPermissionEditPoint]})};}__name(ImageMenuFactory,_0x3d4902(0x30b));function UploadFloatImageMenuFactory(_0x3fbbf1){const _0x48fb4e=_0x3d4902;return{'id':InsertFloatImageCommand['id'],'title':'sheetImage.upload.float','type':MenuItemType[_0x48fb4e(0x387)],'hidden$':getMenuHiddenObservable(_0x3fbbf1,UniverInstanceType[_0x48fb4e(0x1e8)])};}__name(UploadFloatImageMenuFactory,_0x3d4902(0x311));const imageCommonPanel=_0x3d4902(0x35a),imageCommonPanelGrid='univer-image-common-panel-grid',imageCommonPanelBorder='univer-image-common-panel-border',imageCommonPanelTitle=_0x3d4902(0x25c),imageCommonPanelSubtitle=_0x3d4902(0x36a),imageCommonPanelRow=_0x3d4902(0x209),imageCommonPanelRowVertical=_0x3d4902(0x2a6),imageCommonPanelColumn='univer-image-common-panel-column',imageCommonPanelColumnCenter='univer-image-common-panel-column-center',imageCommonPanelInline='univer-image-common-panel-inline',imageCommonPanelSpan2=_0x3d4902(0x317),imageCommonPanelSpan3=_0x3d4902(0x1f4),imageCommonPanelInput=_0x3d4902(0x22c),sheetImageMenu=_0x3d4902(0x35e),sheetImageMenuInput=_0x3d4902(0x2c5),styles={'imageCommonPanel':imageCommonPanel,'imageCommonPanelGrid':imageCommonPanelGrid,'imageCommonPanelBorder':imageCommonPanelBorder,'imageCommonPanelTitle':imageCommonPanelTitle,'imageCommonPanelSubtitle':imageCommonPanelSubtitle,'imageCommonPanelRow':imageCommonPanelRow,'imageCommonPanelRowVertical':imageCommonPanelRowVertical,'imageCommonPanelColumn':imageCommonPanelColumn,'imageCommonPanelColumnCenter':imageCommonPanelColumnCenter,'imageCommonPanelInline':imageCommonPanelInline,'imageCommonPanelSpan2':imageCommonPanelSpan2,'imageCommonPanelSpan3':imageCommonPanelSpan3,'imageCommonPanelInput':imageCommonPanelInput,'sheetImageMenu':sheetImageMenu,'sheetImageMenuInput':sheetImageMenuInput},SheetDrawingAnchor=__name(_0x24f134=>{const _0x363a31=_0x3d4902;var _0x4a992f;const _0x163606=useDependency(ICommandService),_0x375f28=useDependency(LocaleService),_0x3ebc62=useDependency(IDrawingManagerService),_0x222f38=useDependency(IRenderManagerService),{drawings:_0x1039bb}=_0x24f134,_0x13683a=_0x1039bb[0x0];if(_0x13683a==null)return;const {unitId:_0x928ff3}=_0x13683a,_0x39ee2e=_0x222f38[_0x363a31(0x200)](_0x928ff3),_0x1d5002=_0x39ee2e==null?void 0x0:_0x39ee2e['scene'];if(_0x1d5002==null)return;const _0x286910=_0x1d5002[_0x363a31(0x301)](),[_0x357fdc,_0xd66395]=useState(!0x0),_0x4a0f2c=(_0x4a992f=_0x13683a[_0x363a31(0x391)])!=null?_0x4a992f:SheetDrawingAnchorType[_0x363a31(0x352)],[_0x554c75,_0x2b1439]=useState(_0x4a0f2c);function _0x4e4407(_0x381a6e,_0x1e7ec6){const _0x2f9d00=_0x363a31,_0x2240c8=[];return _0x381a6e[_0x2f9d00(0x23c)](_0x4a1765=>{const _0x5a515d=_0x2f9d00,{oKey:_0x4cc7a8}=_0x4a1765,_0x2bc70d=_0x1e7ec6[_0x5a515d(0x1f1)](_0x4cc7a8);if(_0x2bc70d==null)return _0x2240c8[_0x5a515d(0x1dd)](null),!0x0;const {unitId:_0x4ea7e8,subUnitId:_0x3fb710,drawingId:_0x3463b9,drawingType:_0x3a0f95,anchorType:_0x175f29,sheetTransform:_0x52a4b4}=_0x2bc70d;_0x2240c8[_0x5a515d(0x1dd)]({'unitId':_0x4ea7e8,'subUnitId':_0x3fb710,'drawingId':_0x3463b9,'anchorType':_0x175f29,'sheetTransform':_0x52a4b4,'drawingType':_0x3a0f95});}),_0x2240c8;}__name(_0x4e4407,_0x363a31(0x279)),useEffect(()=>{const _0x2aa40a=_0x363a31,_0x203066=_0x286910[_0x2aa40a(0x269)]['subscribe'](_0x1f544e=>{_0x1f544e===!0x0&&_0xd66395(!0x1);}),_0xdfefef=_0x286910['changeStart$']['subscribe'](_0x23719f=>{const _0x365988=_0x2aa40a;var _0x285e18;const {objects:_0x34b11f}=_0x23719f,_0x511746=_0x4e4407(_0x34b11f,_0x3ebc62);if(_0x511746[_0x365988(0x307)]===0x0)_0xd66395(!0x1);else{if(_0x511746[_0x365988(0x307)]>=0x1){_0xd66395(!0x0);const _0x422386=((_0x285e18=_0x511746[0x0])==null?void 0x0:_0x285e18[_0x365988(0x391)])||SheetDrawingAnchorType[_0x365988(0x352)];_0x2b1439(_0x422386);}}});return()=>{_0xdfefef['unsubscribe'](),_0x203066['unsubscribe']();};},[]);function _0x4ab113(_0x29f1a4){const _0xe16b78=_0x363a31;_0x2b1439(_0x29f1a4);const _0x1162b9=_0x3ebc62[_0xe16b78(0x28c)]();if(_0x1162b9[_0xe16b78(0x307)]===0x0)return;const _0x34dcf4=_0x1162b9['map'](_0x1e23a0=>({'unitId':_0x1e23a0['unitId'],'subUnitId':_0x1e23a0[_0xe16b78(0x2f3)],'drawingId':_0x1e23a0[_0xe16b78(0x1be)],'anchorType':_0x29f1a4}));_0x163606[_0xe16b78(0x234)](SetSheetDrawingCommand['id'],{'unitId':_0x1162b9[0x0][_0xe16b78(0x291)],'drawings':_0x34dcf4});}__name(_0x4ab113,_0x363a31(0x38c));const _0x17706d=__name(_0x2fd476=>_0x2fd476?'block':_0x363a31(0x302),_0x363a31(0x2b8));return _0x2b08c1[_0x363a31(0x296)](_0x363a31(0x329),{'className':_0x5733cb(styles[_0x363a31(0x2ae)],styles['imageCommonPanelBorder']),'style':{'display':_0x17706d(_0x357fdc)}},_0x2b08c1[_0x363a31(0x296)]('div',{'className':styles[_0x363a31(0x29f)]},_0x2b08c1[_0x363a31(0x296)]('div',{'className':_0x5733cb(styles[_0x363a31(0x350)],styles[_0x363a31(0x2c1)])},_0x2b08c1[_0x363a31(0x296)](_0x363a31(0x329),null,_0x375f28['t']('drawing-anchor.title')))),_0x2b08c1[_0x363a31(0x296)]('div',{'className':_0x5733cb(styles['imageCommonPanelRow'])},_0x2b08c1[_0x363a31(0x296)](_0x363a31(0x329),{'className':_0x5733cb(styles['imageCommonPanelColumn'])},_0x2b08c1[_0x363a31(0x296)](RadioGroup,{'value':_0x554c75,'onChange':_0x4ab113,'direction':_0x363a31(0x359)},_0x2b08c1['createElement'](Radio,{'value':SheetDrawingAnchorType[_0x363a31(0x341)]},_0x375f28['t']('drawing-anchor.both')),_0x2b08c1[_0x363a31(0x296)](Radio,{'value':SheetDrawingAnchorType['Position']},_0x375f28['t'](_0x363a31(0x38a))),_0x2b08c1[_0x363a31(0x296)](Radio,{'value':SheetDrawingAnchorType[_0x363a31(0x37d)]},_0x375f28['t'](_0x363a31(0x232)))))));},_0x3d4902(0x21d)),SheetDrawingPanel=__name(()=>{const _0x36a5b5=_0x3d4902,_0x39183d=useDependency(IDrawingManagerService),_0x4b8d3e=_0x39183d[_0x36a5b5(0x28c)](),[_0x34b092,_0xaa20a1]=useState(_0x4b8d3e);return useEffect(()=>{const _0x1c99f7=_0x36a5b5,_0x3b695f=_0x39183d[_0x1c99f7(0x28a)]['subscribe'](_0x2dd7d5=>{_0xaa20a1(_0x2dd7d5);});return()=>{const _0x3b3463=_0x1c99f7;_0x3b695f[_0x3b3463(0x335)]();};},[]),!!(_0x34b092!=null&&_0x34b092[_0x36a5b5(0x307)])&&_0x2b08c1['createElement'](_0x36a5b5(0x329),{'className':styles[_0x36a5b5(0x30f)]},_0x2b08c1[_0x36a5b5(0x296)](DrawingCommonPanel,{'drawings':_0x34b092}),_0x2b08c1[_0x36a5b5(0x296)](SheetDrawingAnchor,{'drawings':_0x34b092}));},_0x3d4902(0x337)),menuSchema={[RibbonStartGroup[_0x3d4902(0x37e)]]:{[IMAGE_MENU_ID]:{'order':0x3,'menuItemFactory':ImageMenuFactory,[InsertFloatImageCommand['id']]:{'order':0x0,'menuItemFactory':UploadFloatImageMenuFactory}}}};function whenSheetDrawingFocused(_0x214776){const _0x2b4b92=_0x3d4902;return!_0x214776[_0x2b4b92(0x2a4)](FOCUSING_FX_BAR_EDITOR)&&!_0x214776[_0x2b4b92(0x2a4)](EDITOR_ACTIVATED)&&_0x214776['getContextValue'](FOCUSING_COMMON_DRAWINGS);}__name(whenSheetDrawingFocused,_0x3d4902(0x303));const MoveDrawingDownShortcutItem={'id':MoveDrawingsCommand['id'],'description':_0x3d4902(0x245),'group':_0x3d4902(0x247),'binding':KeyCode[_0x3d4902(0x1de)],'priority':0x64,'preconditions':whenSheetDrawingFocused,'staticParameters':{'direction':Direction['DOWN']}},MoveDrawingUpShortcutItem={'id':MoveDrawingsCommand['id'],'description':'shortcut.sheet.drawing-move-up','group':_0x3d4902(0x247),'binding':KeyCode['ARROW_UP'],'priority':0x64,'preconditions':whenSheetDrawingFocused,'staticParameters':{'direction':Direction['UP']}},MoveDrawingLeftShortcutItem={'id':MoveDrawingsCommand['id'],'description':_0x3d4902(0x2f5),'group':_0x3d4902(0x247),'binding':KeyCode['ARROW_LEFT'],'priority':0x64,'preconditions':whenSheetDrawingFocused,'staticParameters':{'direction':Direction[_0x3d4902(0x21a)]}},MoveDrawingRightShortcutItem={'id':MoveDrawingsCommand['id'],'description':_0x3d4902(0x2d7),'group':_0x3d4902(0x247),'binding':KeyCode[_0x3d4902(0x2c4)],'priority':0x64,'preconditions':whenSheetDrawingFocused,'staticParameters':{'direction':Direction[_0x3d4902(0x2b9)]}},DeleteDrawingsShortcutItem={'id':DeleteDrawingsCommand['id'],'description':_0x3d4902(0x371),'group':_0x3d4902(0x247),'preconditions':whenSheetDrawingFocused,'binding':KeyCode['DELETE'],'mac':KeyCode[_0x3d4902(0x288)]};var __defProp$6=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$6=Object[_0x3d4902(0x358)],__decorateClass$6=__name((_0x3a00cf,_0x30d4e5,_0xf3de13,_0x2e8636)=>{for(var _0x231a38=_0x2e8636>0x1?void 0x0:_0x2e8636?__getOwnPropDesc$6(_0x30d4e5,_0xf3de13):_0x30d4e5,_0x3accd8=_0x3a00cf['length']-0x1,_0x389062;_0x3accd8>=0x0;_0x3accd8--)(_0x389062=_0x3a00cf[_0x3accd8])&&(_0x231a38=(_0x2e8636?_0x389062(_0x30d4e5,_0xf3de13,_0x231a38):_0x389062(_0x231a38))||_0x231a38);return _0x2e8636&&_0x231a38&&__defProp$6(_0x30d4e5,_0xf3de13,_0x231a38),_0x231a38;},_0x3d4902(0x2e6)),__decorateParam$6=__name((_0x28471d,_0x30860d)=>(_0x377239,_0x1991e)=>_0x30860d(_0x377239,_0x1991e,_0x28471d),_0x3d4902(0x2cc)),_a4;let SheetDrawingUIController=(_a4=class extends Disposable{constructor(_0x393aea,_0x248da4,_0x236c74,_0x2bce2e){const _0x521d8a=_0x3d4902;super(),this['_componentManager']=_0x393aea,this['_menuManagerService']=_0x248da4,this[_0x521d8a(0x208)]=_0x236c74,this[_0x521d8a(0x20c)]=_0x2bce2e,this[_0x521d8a(0x306)]();}[_0x3d4902(0x35c)](){const _0x41e9a2=_0x3d4902,_0x4c2dc1=this[_0x41e9a2(0x364)];this[_0x41e9a2(0x26e)](_0x4c2dc1[_0x41e9a2(0x206)](IMAGE_UPLOAD_ICON,AddImageSingle)),this['disposeWithMe'](_0x4c2dc1[_0x41e9a2(0x206)](COMPONENT_SHEET_DRAWING_PANEL,SheetDrawingPanel));}[_0x3d4902(0x1c8)](){const _0x51848e=_0x3d4902;this['_menuManagerService'][_0x51848e(0x233)](menuSchema);}[_0x3d4902(0x2d5)](){const _0x35fcdc=_0x3d4902;[InsertFloatImageCommand,InsertSheetDrawingCommand,RemoveSheetDrawingCommand,SetSheetDrawingCommand,SidebarSheetDrawingOperation,ClearSheetDrawingTransformerOperation,EditSheetDrawingOperation,GroupSheetDrawingCommand,UngroupSheetDrawingCommand,MoveDrawingsCommand,DeleteDrawingsCommand,SetDrawingArrangeCommand][_0x35fcdc(0x23c)](_0xa0acfb=>this[_0x35fcdc(0x26e)](this[_0x35fcdc(0x208)][_0x35fcdc(0x1da)](_0xa0acfb)));}['_initShortcuts'](){const _0x578724=_0x3d4902;[MoveDrawingDownShortcutItem,MoveDrawingUpShortcutItem,MoveDrawingLeftShortcutItem,MoveDrawingRightShortcutItem,DeleteDrawingsShortcutItem][_0x578724(0x23c)](_0x560dba=>{const _0x53e4e6=_0x578724;this[_0x53e4e6(0x26e)](this['_shortcutService'][_0x53e4e6(0x1bf)](_0x560dba));});}[_0x3d4902(0x306)](){const _0x204b4c=_0x3d4902;this[_0x204b4c(0x2d5)](),this[_0x204b4c(0x35c)](),this[_0x204b4c(0x1c8)](),this[_0x204b4c(0x2bd)]();}},__name(_a4,'SheetDrawingUIController'),_a4);SheetDrawingUIController=__decorateClass$6([__decorateParam$6(0x0,Inject(ComponentManager)),__decorateParam$6(0x1,IMenuManagerService),__decorateParam$6(0x2,ICommandService),__decorateParam$6(0x3,IShortcutService)],SheetDrawingUIController);var __defProp$5=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$5=Object[_0x3d4902(0x358)],__decorateClass$5=__name((_0xff5b6c,_0x5066af,_0xd8166a,_0x3c0b07)=>{const _0x2c25f8=_0x3d4902;for(var _0x5299fb=_0x3c0b07>0x1?void 0x0:_0x3c0b07?__getOwnPropDesc$5(_0x5066af,_0xd8166a):_0x5066af,_0x1f26f9=_0xff5b6c[_0x2c25f8(0x307)]-0x1,_0x549e57;_0x1f26f9>=0x0;_0x1f26f9--)(_0x549e57=_0xff5b6c[_0x1f26f9])&&(_0x5299fb=(_0x3c0b07?_0x549e57(_0x5066af,_0xd8166a,_0x5299fb):_0x549e57(_0x5299fb))||_0x5299fb);return _0x3c0b07&&_0x5299fb&&__defProp$5(_0x5066af,_0xd8166a,_0x5299fb),_0x5299fb;},'__decorateClass$5'),__decorateParam$5=__name((_0x5828e4,_0x2d9936)=>(_0x25a92c,_0x32ea7b)=>_0x2d9936(_0x25a92c,_0x32ea7b,_0x5828e4),_0x3d4902(0x210)),_a5;let SheetsDrawingCopyPasteController=(_a5=class extends Disposable{constructor(_0x54135f,_0x4da44f,_0x38361f){const _0x2004ff=_0x3d4902;super(),__publicField(this,_0x2004ff(0x2ec)),(this[_0x2004ff(0x1db)]=_0x54135f,this[_0x2004ff(0x2ef)]=_0x4da44f,this[_0x2004ff(0x2cb)]=_0x38361f,this[_0x2004ff(0x34e)]());}['_initCopyPaste'](){const _0xc54e10=_0x3d4902;this[_0xc54e10(0x1db)]['addClipboardHook']({'id':_0xc54e10(0x2b3),'onBeforeCopy':__name((_0x15ea26,_0x14110b,_0x7f17fa)=>this['_collect'](_0x15ea26,_0x14110b,_0x7f17fa),_0xc54e10(0x365)),'onPasteCells':__name((_0xb078de,_0x4e3918,_0x29119e,_0x4da668)=>{const {copyType:copyType=COPY_TYPE['COPY'],pasteType:_0x3c0dad}=_0x4da668,{range:_0x16e83e}=_0xb078de||{},{range:_0x11f5e5,unitId:_0x3b598d,subUnitId:_0x9dd343}=_0x4e3918;return this['_generateMutations'](_0x11f5e5,{'copyType':copyType,'pasteType':_0x3c0dad,'copyRange':_0x16e83e,'unitId':_0x3b598d,'subUnitId':_0x9dd343});},_0xc54e10(0x2b2)),'onPastePlainText':__name((_0x5e57de,_0x581101)=>({'undos':[],'redos':[]}),_0xc54e10(0x389))});}['_collect'](_0x24524c,_0x2c9bf7,_0x2395c6){const _0x4a9009=_0x3d4902;var _0x439d2e;const _0x511319=(_0x439d2e=this[_0x4a9009(0x2ef)]['getRenderById'](_0x24524c))==null?void 0x0:_0x439d2e[_0x4a9009(0x1f7)](SheetSkeletonManagerService);if(!_0x511319)return;const _0x2c18f9=_0x511319[_0x4a9009(0x366)](_0x2395c6);if(!_0x2c18f9)return;const {startX:_0xce00d7,endX:_0x4c14bf,startY:_0x1e0142,endY:_0x22c259}=_0x2c18f9,_0x5a51f3=this['_sheetDrawingService'][_0x4a9009(0x257)](_0x24524c,_0x2c9bf7),_0x177013=[];Object['keys'](_0x5a51f3)['forEach'](_0x452ee1=>{const _0x4c4a49=_0x4a9009,_0x421286=_0x5a51f3[_0x452ee1],{transform:_0x2e40da}=_0x421286;if(_0x421286[_0x4c4a49(0x391)]!==SheetDrawingAnchorType[_0x4c4a49(0x341)]||!_0x2e40da)return;const {left:left=0x0,top:top=0x0,width:width=0x0,height:height=0x0}=_0x2e40da,{drawingStartX:_0x16cd0d,drawingEndX:_0x49a4a6,drawingStartY:_0xe1741d,drawingEndY:_0x412aa1}={'drawingStartX':left,'drawingEndX':left+width,'drawingStartY':top,'drawingEndY':top+height};_0xce00d7<=_0x16cd0d&&_0x49a4a6<=_0x4c14bf&&_0x1e0142<=_0xe1741d&&_0x412aa1<=_0x22c259&&_0x177013[_0x4c4a49(0x1dd)](_0x421286);}),_0x177013[_0x4a9009(0x307)]&&(this[_0x4a9009(0x2ec)]={'drawings':_0x177013,'unitId':_0x24524c,'subUnitId':_0x2c9bf7});}[_0x3d4902(0x342)](_0x67af04,_0x387f17){const _0x578e82=_0x3d4902;var _0x1844ee;if(!this[_0x578e82(0x2ec)])return{'redos':[],'undos':[]};if([PREDEFINED_HOOK_NAME[_0x578e82(0x21c)],PREDEFINED_HOOK_NAME[_0x578e82(0x264)],PREDEFINED_HOOK_NAME['SPECIAL_PASTE_FORMAT'],PREDEFINED_HOOK_NAME['SPECIAL_PASTE_FORMULA']]['includes'](_0x387f17[_0x578e82(0x37c)]))return{'redos':[],'undos':[]};const {copyRange:_0x30970f}=_0x387f17;if(!_0x30970f)return{'redos':[],'undos':[]};const {drawings:_0x6413,unitId:_0x54790b,subUnitId:_0x3b349e}=this[_0x578e82(0x2ec)],{ranges:[_0x593328,_0x475a4e],mapFunc:_0x12a656}=virtualizeDiscreteRanges([_0x30970f,_0x67af04]),{row:_0x3e646b,col:_0x150fe9}=_0x12a656(_0x593328[_0x578e82(0x360)],_0x593328['startColumn']),{row:_0xedee3f,col:_0x228ce4}=_0x12a656(_0x475a4e[_0x578e82(0x360)],_0x475a4e['startColumn']),_0x1e82e3=(_0x1844ee=this[_0x578e82(0x2ef)]['getRenderById'](_0x54790b))==null?void 0x0:_0x1844ee[_0x578e82(0x1f7)](SheetSkeletonManagerService);if(!_0x1e82e3)return{'redos':[],'undos':[]};const _0x30be63=_0x1e82e3[_0x578e82(0x366)]({'startRow':_0x3e646b,'endRow':_0x3e646b,'startColumn':_0x150fe9,'endColumn':_0x150fe9}),_0x4c9066=_0x1e82e3[_0x578e82(0x366)]({'startRow':_0xedee3f,'endRow':_0xedee3f,'startColumn':_0x228ce4,'endColumn':_0x228ce4});if(!_0x30be63||!_0x4c9066)return{'redos':[],'undos':[]};const _0x21da1=[],_0x264e5a=[],_0x1feaaf=_0x4c9066[_0x578e82(0x36e)]-_0x30be63[_0x578e82(0x36e)],_0x4c2fe1=_0x4c9066[_0x578e82(0x34b)]-_0x30be63[_0x578e82(0x34b)],_0x44e52d=_0xedee3f-_0x3e646b,_0x350319=_0x228ce4-_0x150fe9,_0x4def01=_0x387f17[_0x578e82(0x370)]===COPY_TYPE[_0x578e82(0x27f)],{_sheetDrawingService:_0x1335fb}=this;return _0x6413[_0x578e82(0x23c)](_0x4a54fa=>{const _0x57f9b1=_0x578e82,{transform:_0x42f0e6,sheetTransform:_0x1d5c98}=_0x4a54fa;if(!_0x42f0e6)return;const _0x39a31d={..._0x4a54fa,'unitId':_0x54790b,'subUnitId':_0x3b349e,'drawingId':_0x4def01?_0x4a54fa[_0x57f9b1(0x1be)]:Tools[_0x57f9b1(0x322)](),'transform':{..._0x42f0e6,'left':_0x42f0e6[_0x57f9b1(0x242)]+_0x1feaaf,'top':_0x42f0e6[_0x57f9b1(0x326)]+_0x4c2fe1},'sheetTransform':{'to':{..._0x1d5c98['to'],'row':_0x1d5c98['to']['row']+_0x44e52d,'column':_0x1d5c98['to'][_0x57f9b1(0x2ad)]+_0x350319},'from':{..._0x1d5c98[_0x57f9b1(0x237)],'row':_0x1d5c98[_0x57f9b1(0x237)]['row']+_0x44e52d,'column':_0x1d5c98[_0x57f9b1(0x237)][_0x57f9b1(0x2ad)]+_0x350319}}};if(_0x4def01){const {undo:_0x19d518,redo:_0x486fee,objects:_0x108ff1}=_0x1335fb[_0x57f9b1(0x255)]([_0x39a31d]);_0x21da1[_0x57f9b1(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x54790b,'subUnitId':_0x3b349e,'type':DrawingApplyType[_0x57f9b1(0x1cd)],'op':_0x486fee,'objects':_0x108ff1}}),_0x264e5a[_0x57f9b1(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x54790b,'subUnitId':_0x3b349e,'type':DrawingApplyType[_0x57f9b1(0x1cd)],'op':_0x19d518,'objects':_0x108ff1}});}else{const {undo:_0x5efd6f,redo:_0x112f86,objects:_0x42bac1}=_0x1335fb[_0x57f9b1(0x2fc)]([_0x39a31d]);_0x21da1[_0x57f9b1(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'op':_0x112f86,'unitId':_0x54790b,'subUnitId':_0x3b349e,'objects':_0x42bac1,'type':DrawingApplyType['INSERT']}}),_0x264e5a[_0x57f9b1(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'op':_0x5efd6f,'unitId':_0x54790b,'subUnitId':_0x3b349e,'objects':_0x42bac1,'type':DrawingApplyType[_0x57f9b1(0x331)]}});}}),{'redos':_0x21da1,'undos':_0x264e5a};}},__name(_a5,'SheetsDrawingCopyPasteController'),_a5);SheetsDrawingCopyPasteController=__decorateClass$5([__decorateParam$5(0x0,ISheetClipboardService),__decorateParam$5(0x1,IRenderManagerService),__decorateParam$5(0x2,ISheetDrawingService)],SheetsDrawingCopyPasteController);var __defProp$4=Object['defineProperty'],__getOwnPropDesc$4=Object[_0x3d4902(0x358)],__decorateClass$4=__name((_0x540221,_0x57512c,_0xf7c78b,_0x1ae8d6)=>{for(var _0x34d57f=_0x1ae8d6>0x1?void 0x0:_0x1ae8d6?__getOwnPropDesc$4(_0x57512c,_0xf7c78b):_0x57512c,_0x2fbe27=_0x540221['length']-0x1,_0x4c8957;_0x2fbe27>=0x0;_0x2fbe27--)(_0x4c8957=_0x540221[_0x2fbe27])&&(_0x34d57f=(_0x1ae8d6?_0x4c8957(_0x57512c,_0xf7c78b,_0x34d57f):_0x4c8957(_0x34d57f))||_0x34d57f);return _0x1ae8d6&&_0x34d57f&&__defProp$4(_0x57512c,_0xf7c78b,_0x34d57f),_0x34d57f;},_0x3d4902(0x2dd)),__decorateParam$4=__name((_0x172d15,_0x48be39)=>(_0x419598,_0x13fd85)=>_0x48be39(_0x419598,_0x13fd85,_0x172d15),_0x3d4902(0x1c2)),_a6;let SheetDrawingPermissionController=(_a6=class extends Disposable{constructor(_0x1b3060,_0x57e27e,_0x31e851,_0x4f23cd,_0xefc3b4){const _0xe0bd46=_0x3d4902;super(),this['_drawingManagerService']=_0x1b3060,this[_0xe0bd46(0x2ef)]=_0x57e27e,this['_permissionService']=_0x31e851,this['_univerInstanceService']=_0x4f23cd,this['_userManagerService']=_0xefc3b4,this[_0xe0bd46(0x27e)](),this[_0xe0bd46(0x22d)](),this[_0xe0bd46(0x1cf)](),this[_0xe0bd46(0x27a)]();}[_0x3d4902(0x27e)](){const _0x7d55db=_0x3d4902,_0x2845e6=this['_univerInstanceService']['getCurrentTypeOfUnit$'](UniverInstanceType[_0x7d55db(0x1e8)]);this[_0x7d55db(0x26e)](combineLatest([_0x2845e6,this[_0x7d55db(0x256)]['currentUser$']])[_0x7d55db(0x2c2)](([_0x580cd4,_0xea6f18])=>{const _0x1596a1=_0x7d55db;if(!_0x580cd4){this['_drawingManagerService']['setDrawingVisible'](!0x1);return;}_0x580cd4[_0x1596a1(0x339)][_0x1596a1(0x2c2)](_0x3540b9=>{const _0x46a4b5=_0x1596a1;if(!_0x3540b9){this['_drawingManagerService'][_0x46a4b5(0x218)](!0x1);return;}const _0x4f7ec0=_0x580cd4['getUnitId'](),_0x249097=_0x3540b9[_0x46a4b5(0x2df)]();if(this[_0x46a4b5(0x1e4)][_0x46a4b5(0x2b0)]([new WorkbookViewPermission(_0x4f7ec0)['id'],new WorksheetViewPermission(_0x4f7ec0,_0x249097)['id']])[_0x46a4b5(0x32c)](_0x3fd922=>_0x3fd922[_0x46a4b5(0x216)]))this[_0x46a4b5(0x1bd)][_0x46a4b5(0x218)](!0x0);else{this[_0x46a4b5(0x1bd)][_0x46a4b5(0x218)](!0x1);const _0x4971f6=_0x580cd4[_0x46a4b5(0x33a)](),_0x3ee739=_0x3540b9[_0x46a4b5(0x2df)](),_0x20b928=this[_0x46a4b5(0x1bd)][_0x46a4b5(0x257)](_0x4971f6,_0x3ee739),_0x1770f4=Object['values'](_0x20b928),_0x1b1209=this['_renderManagerService'][_0x46a4b5(0x200)](_0x4971f6),_0x42a557=_0x1b1209==null?void 0x0:_0x1b1209['scene'];if(_0x42a557==null)return;_0x42a557[_0x46a4b5(0x2de)]()['forEach'](_0xcbd9eb=>{const _0x28f11a=_0x46a4b5;_0xcbd9eb[_0x28f11a(0x20e)]===RENDER_CLASS_TYPE['IMAGE']&&_0x1770f4[_0x28f11a(0x1d0)](_0x42ccf3=>_0xcbd9eb[_0x28f11a(0x355)][_0x28f11a(0x2a8)](_0x42ccf3[_0x28f11a(0x1be)]))&&_0x42a557[_0x28f11a(0x250)](_0xcbd9eb);});}});}));}[_0x3d4902(0x22d)](){const _0x3f18ca=_0x3d4902,_0x230a07=this[_0x3f18ca(0x2b7)][_0x3f18ca(0x2ee)](UniverInstanceType[_0x3f18ca(0x1e8)]);this[_0x3f18ca(0x26e)](combineLatest([_0x230a07,this['_userManagerService'][_0x3f18ca(0x1e2)]])['subscribe'](([_0x382075,_0x34110f])=>{const _0x2a39d4=_0x3f18ca;if(!_0x382075){this[_0x2a39d4(0x1bd)]['setDrawingEditable'](!0x1);return;}_0x382075['activeSheet$'][_0x2a39d4(0x2c2)](_0x53cc73=>{const _0x8acfef=_0x2a39d4;if(!_0x53cc73){this[_0x8acfef(0x1bd)]['setDrawingEditable'](!0x1);return;}const _0x2faf3c=_0x382075[_0x8acfef(0x33a)](),_0x18b69f=_0x53cc73[_0x8acfef(0x2df)]();if(this[_0x8acfef(0x1e4)][_0x8acfef(0x2b0)]([new WorkbookEditablePermission(_0x2faf3c)['id'],new WorksheetEditPermission(_0x2faf3c,_0x18b69f)['id']])[_0x8acfef(0x32c)](_0xa144b2=>_0xa144b2[_0x8acfef(0x216)]))this[_0x8acfef(0x1bd)][_0x8acfef(0x30d)](!0x0);else{this['_drawingManagerService']['setDrawingEditable'](!0x1);const _0x35813e=_0x382075[_0x8acfef(0x33a)](),_0x43ea0c=_0x53cc73[_0x8acfef(0x2df)](),_0x2b7028=this[_0x8acfef(0x1bd)][_0x8acfef(0x257)](_0x35813e,_0x43ea0c),_0x493863=Object[_0x8acfef(0x32b)](_0x2b7028),_0x5651e6=this[_0x8acfef(0x2ef)]['getRenderById'](_0x35813e),_0xed1673=_0x5651e6==null?void 0x0:_0x5651e6[_0x8acfef(0x34f)];if(_0xed1673==null)return;_0xed1673[_0x8acfef(0x2de)]()[_0x8acfef(0x23c)](_0x1f7d92=>{const _0x4702a3=_0x8acfef;_0x1f7d92[_0x4702a3(0x20e)]===RENDER_CLASS_TYPE[_0x4702a3(0x27c)]&&_0x493863[_0x4702a3(0x1d0)](_0x36ab5d=>_0x1f7d92[_0x4702a3(0x355)][_0x4702a3(0x2a8)](_0x36ab5d['drawingId']))&&_0xed1673[_0x4702a3(0x22a)](_0x1f7d92);});}});}));}['_initViewPermissionChange'](){const _0x3dd344=_0x3d4902,_0x32405b=this[_0x3dd344(0x2b7)]['getCurrentTypeOfUnit$'](UniverInstanceType[_0x3dd344(0x1e8)]);this[_0x3dd344(0x26e)](combineLatest([_0x32405b,this[_0x3dd344(0x256)][_0x3dd344(0x1e2)]])[_0x3dd344(0x2c2)](([_0x550c89,_0x4b38b4])=>{const _0x4da286=_0x3dd344;_0x550c89&&_0x550c89[_0x4da286(0x339)][_0x4da286(0x2c2)](_0x4066d3=>{const _0x4c6afe=_0x4da286;var _0x31f559;if(!_0x4066d3)return;const _0x3a994e=_0x550c89[_0x4c6afe(0x33a)](),_0x4b9b13=_0x4066d3[_0x4c6afe(0x2df)]();let _0x5cb980=!0x0;const _0x2f48af=this[_0x4c6afe(0x2ef)][_0x4c6afe(0x200)](_0x3a994e),_0x5ada29=_0x2f48af==null?void 0x0:_0x2f48af[_0x4c6afe(0x34f)];if(_0x5ada29==null)return;const _0x3abea2=_0x5ada29['getTransformerByCreate'](),_0x17fd5c=this[_0x4c6afe(0x1e4)][_0x4c6afe(0x223)]([new WorkbookViewPermission(_0x3a994e)['id'],new WorksheetViewPermission(_0x3a994e,_0x4b9b13)['id']])[_0x4c6afe(0x1bc)](map(_0x5e98f3=>_0x5e98f3[_0x4c6afe(0x32c)](_0xe9f69=>_0xe9f69[_0x4c6afe(0x216)])));_0x17fd5c==null||_0x17fd5c[_0x4c6afe(0x1bc)](filter(_0x1d25cb=>_0x1d25cb!==_0x5cb980),distinctUntilChanged())[_0x4c6afe(0x2c2)]({'next':__name(_0x44a5a9=>{const _0x59f59f=_0x4c6afe;_0x5cb980=_0x44a5a9,this[_0x59f59f(0x1bd)][_0x59f59f(0x218)](_0x44a5a9);const _0x5068c5=_0x5ada29['getAllObjectsByOrder'](),_0x2dca7b=this[_0x59f59f(0x1bd)][_0x59f59f(0x257)](_0x3a994e,_0x4b9b13),_0x245abe=Object[_0x59f59f(0x32b)](_0x2dca7b);_0x44a5a9?this[_0x59f59f(0x1bd)][_0x59f59f(0x36c)](_0x245abe):(_0x5068c5[_0x59f59f(0x23c)](_0xa3f35d=>{const _0x579630=_0x59f59f;_0xa3f35d[_0x579630(0x20e)]===RENDER_CLASS_TYPE[_0x579630(0x27c)]&&_0x245abe[_0x579630(0x1d0)](_0xb38cab=>_0xa3f35d[_0x579630(0x355)][_0x579630(0x2a8)](_0xb38cab['drawingId']))&&_0x5ada29['removeObject'](_0xa3f35d);}),_0x3abea2['clearSelectedObjects']());},_0x4c6afe(0x24f))}),(_0x31f559=this['_permissionService'][_0x4c6afe(0x2f6)](new WorksheetViewPermission(_0x3a994e,_0x4b9b13)['id']))==null||_0x31f559[_0x4c6afe(0x1bc)](filter(_0x14ef0f=>_0x14ef0f['value']!==_0x5cb980),distinctUntilChanged())[_0x4c6afe(0x2c2)]({'complete':__name(()=>{const _0x1b441c=_0x4c6afe;_0x5cb980=!0x0,this[_0x1b441c(0x1bd)][_0x1b441c(0x218)](!0x0);const _0x3ee8b4=this[_0x1b441c(0x1bd)][_0x1b441c(0x257)](_0x3a994e,_0x4b9b13),_0xd05938=Object[_0x1b441c(0x32b)](_0x3ee8b4);this[_0x1b441c(0x1bd)][_0x1b441c(0x36c)](_0xd05938);},_0x4c6afe(0x2f4))});});}));}['_initEditPermissionChange'](){const _0x2cd0ec=_0x3d4902,_0x2f331a=this[_0x2cd0ec(0x2b7)]['getCurrentTypeOfUnit$'](UniverInstanceType['UNIVER_SHEET']);this[_0x2cd0ec(0x26e)](combineLatest([_0x2f331a,this[_0x2cd0ec(0x256)]['currentUser$']])['subscribe'](([_0x2bd971,_0x18c240])=>{const _0x4874c1=_0x2cd0ec;_0x2bd971&&_0x2bd971[_0x4874c1(0x339)][_0x4874c1(0x2c2)](_0x4fc68f=>{const _0x54ead9=_0x4874c1;var _0x250124;if(!_0x4fc68f)return;const _0x516459=_0x2bd971[_0x54ead9(0x33a)](),_0x104e68=_0x4fc68f[_0x54ead9(0x2df)]();let _0x6ab435=!0x0;const _0x4bb2da=this[_0x54ead9(0x2ef)][_0x54ead9(0x200)](_0x516459),_0x29235d=_0x4bb2da==null?void 0x0:_0x4bb2da[_0x54ead9(0x34f)];if(_0x29235d==null)return;const _0x37c4b6=_0x29235d['getTransformerByCreate'](),_0x1da58c=this[_0x54ead9(0x1e4)][_0x54ead9(0x223)]([new WorkbookEditablePermission(_0x516459)['id'],new WorksheetEditPermission(_0x516459,_0x104e68)['id']])[_0x54ead9(0x1bc)](map(_0x264e94=>_0x264e94[_0x54ead9(0x32c)](_0x1f1198=>_0x1f1198[_0x54ead9(0x216)])));_0x1da58c==null||_0x1da58c[_0x54ead9(0x1bc)](filter(_0x585489=>_0x585489!==_0x6ab435),distinctUntilChanged())[_0x54ead9(0x2c2)]({'next':__name(_0x440929=>{const _0x26019f=_0x54ead9;_0x6ab435=_0x440929,this['_drawingManagerService'][_0x26019f(0x30d)](_0x440929);const _0x3d79d5=_0x29235d[_0x26019f(0x2de)](),_0x395b70=this[_0x26019f(0x1bd)]['getDrawingData'](_0x516459,_0x104e68),_0x1db495=Object['values'](_0x395b70);_0x440929?(_0x3d79d5[_0x26019f(0x23c)](_0x408cef=>{const _0x356c45=_0x26019f;_0x408cef[_0x356c45(0x20e)]===RENDER_CLASS_TYPE[_0x356c45(0x27c)]&&_0x1db495[_0x356c45(0x1d0)](_0x23bc8d=>_0x408cef[_0x356c45(0x355)][_0x356c45(0x2a8)](_0x23bc8d[_0x356c45(0x1be)]))&&_0x29235d['attachTransformerTo'](_0x408cef);}),this[_0x26019f(0x1bd)]['addNotification'](_0x1db495)):(_0x3d79d5[_0x26019f(0x23c)](_0x498897=>{const _0x4ec5ad=_0x26019f;_0x498897['classType']===RENDER_CLASS_TYPE['IMAGE']&&_0x1db495[_0x4ec5ad(0x1d0)](_0x4b43e5=>_0x498897[_0x4ec5ad(0x355)]['includes'](_0x4b43e5[_0x4ec5ad(0x1be)]))&&_0x29235d[_0x4ec5ad(0x22a)](_0x498897);}),_0x37c4b6['clearSelectedObjects']());},_0x54ead9(0x24f))}),(_0x250124=this[_0x54ead9(0x1e4)][_0x54ead9(0x2f6)](new WorksheetEditPermission(_0x516459,_0x104e68)['id']))==null||_0x250124[_0x54ead9(0x1bc)](filter(_0x3fd5de=>_0x3fd5de[_0x54ead9(0x216)]!==_0x6ab435),distinctUntilChanged())['subscribe']({'complete':__name(()=>{const _0x28ab56=_0x54ead9;_0x6ab435=!0x0;const _0x51be31=_0x2bd971[_0x28ab56(0x33a)](),_0x2dd013=_0x4fc68f['getSheetId'](),_0x51563c=this['_drawingManagerService'][_0x28ab56(0x257)](_0x51be31,_0x2dd013),_0x57d266=Object[_0x28ab56(0x32b)](_0x51563c),_0x561ec3=this[_0x28ab56(0x2ef)][_0x28ab56(0x200)](_0x51be31),_0xafffae=_0x561ec3==null?void 0x0:_0x561ec3[_0x28ab56(0x34f)];if(_0xafffae==null)return;this['_drawingManagerService'][_0x28ab56(0x30d)](!0x0),_0xafffae[_0x28ab56(0x2de)]()[_0x28ab56(0x23c)](_0x25de94=>{const _0x3351fd=_0x28ab56;_0x25de94[_0x3351fd(0x20e)]===RENDER_CLASS_TYPE[_0x3351fd(0x27c)]&&_0x57d266[_0x3351fd(0x1d0)](_0x1ed654=>_0x25de94[_0x3351fd(0x355)][_0x3351fd(0x2a8)](_0x1ed654[_0x3351fd(0x1be)]))&&_0xafffae[_0x3351fd(0x22a)](_0x25de94);});},_0x54ead9(0x2f4))});});}));}},__name(_a6,'SheetDrawingPermissionController'),_a6);SheetDrawingPermissionController=__decorateClass$4([__decorateParam$4(0x0,IDrawingManagerService),__decorateParam$4(0x1,IRenderManagerService),__decorateParam$4(0x2,IPermissionService),__decorateParam$4(0x3,IUniverInstanceService),__decorateParam$4(0x4,Inject(UserManagerService))],SheetDrawingPermissionController);var __defProp$3=Object['defineProperty'],__getOwnPropDesc$3=Object[_0x3d4902(0x358)],__decorateClass$3=__name((_0x152c37,_0x5d884b,_0xed789e,_0x209923)=>{for(var _0x464141=_0x209923>0x1?void 0x0:_0x209923?__getOwnPropDesc$3(_0x5d884b,_0xed789e):_0x5d884b,_0x27a6be=_0x152c37['length']-0x1,_0x1f711f;_0x27a6be>=0x0;_0x27a6be--)(_0x1f711f=_0x152c37[_0x27a6be])&&(_0x464141=(_0x209923?_0x1f711f(_0x5d884b,_0xed789e,_0x464141):_0x1f711f(_0x464141))||_0x464141);return _0x209923&&_0x464141&&__defProp$3(_0x5d884b,_0xed789e,_0x464141),_0x464141;},_0x3d4902(0x32a)),__decorateParam$3=__name((_0x2e38e4,_0x456c7c)=>(_0x16628a,_0x57677a)=>_0x456c7c(_0x16628a,_0x57677a,_0x2e38e4),'__decorateParam$3'),_a7;let SheetDrawingPrintingController=(_a7=class extends Disposable{constructor(_0xdddca5,_0x48119d,_0x27d572,_0x6fd15d){const _0x1c3e73=_0x3d4902;super(),this['_sheetPrintInterceptorService']=_0xdddca5,this['_drawingRenderService']=_0x48119d,this[_0x1c3e73(0x1bd)]=_0x27d572,this[_0x1c3e73(0x2ef)]=_0x6fd15d,this['_initPrinting']();}[_0x3d4902(0x369)](){const _0x2b0964=_0x3d4902;this[_0x2b0964(0x26e)](this[_0x2b0964(0x26a)]['interceptor'][_0x2b0964(0x2cf)](this['_sheetPrintInterceptorService'][_0x2b0964(0x2fd)][_0x2b0964(0x24a)]()[_0x2b0964(0x21b)],{'handler':__name((_0x2646d9,_0x5767f6,_0x4ed500)=>{const _0x48d1ce=_0x2b0964,{unitId:_0x24e3ee,scene:_0x5856d1,subUnitId:_0x1311e5}=_0x5767f6,_0x4eaf35=this[_0x48d1ce(0x1bd)]['getDrawingDataForUnit'](_0x24e3ee),_0x13e2ac=_0x4eaf35==null?void 0x0:_0x4eaf35[_0x1311e5];return _0x13e2ac&&_0x13e2ac[_0x48d1ce(0x320)]['forEach'](_0x2a1433=>{const _0x507e60=_0x48d1ce;this['_drawingRenderService'][_0x507e60(0x270)](_0x13e2ac[_0x507e60(0x34d)][_0x2a1433],_0x5856d1);}),_0x4ed500();},_0x2b0964(0x312))})),this[_0x2b0964(0x26e)](this[_0x2b0964(0x26a)][_0x2b0964(0x2fd)]['intercept'](this[_0x2b0964(0x26a)]['interceptor']['getInterceptPoints']()['PRINTING_RANGE'],{'handler':__name((_0x5ea998,_0x2edbf2,_0x463211)=>{const _0xf8045e=_0x2b0964,{unitId:_0xdef2a,subUnitId:_0x52b79c}=_0x2edbf2,_0x4dc218=this[_0xf8045e(0x2ef)][_0xf8045e(0x200)](_0xdef2a);if(!_0x4dc218)return _0x463211(_0x5ea998);const _0x2d5cf4=_0x4dc218[_0xf8045e(0x1f7)](SheetSkeletonManagerService)[_0xf8045e(0x395)](_0x52b79c);if(!_0x2d5cf4)return _0x463211(_0x5ea998);const _0x16e4b2=this['_drawingManagerService'][_0xf8045e(0x2f8)](_0xdef2a),_0x112425=_0x16e4b2==null?void 0x0:_0x16e4b2[_0x2edbf2[_0xf8045e(0x2f3)]];if(!_0x112425)return _0x463211(_0x5ea998);const {scaleX:_0x113801,scaleY:_0x5b6809}=_0x4dc218[_0xf8045e(0x34f)],_0x2a6610=_0x5ea998?{..._0x5ea998}:{'startColumn':0x0,'endColumn':0x0,'endRow':0x0,'startRow':0x0},_0x2a2856=_0x112425[_0xf8045e(0x320)][_0xf8045e(0x38d)](_0x1dee80=>_0x112425[_0xf8045e(0x34d)][_0x1dee80])[_0xf8045e(0x1e3)](_0x4d00b3=>_0x4d00b3[_0xf8045e(0x2d8)]!==DrawingTypeEnum[_0xf8045e(0x26f)]);return _0x2a2856['length']?(_0x2a2856[_0xf8045e(0x23c)](_0xb6ca7=>{const _0x3e257d=_0xf8045e;if(!_0xb6ca7[_0x3e257d(0x33c)]&&_0xb6ca7['transform']&&Tools[_0x3e257d(0x321)](_0xb6ca7[_0x3e257d(0x32e)][_0x3e257d(0x242)])&&Tools['isDefine'](_0xb6ca7[_0x3e257d(0x32e)][_0x3e257d(0x326)])&&Tools[_0x3e257d(0x321)](_0xb6ca7['transform'][_0x3e257d(0x259)])&&Tools[_0x3e257d(0x321)](_0xb6ca7['transform'][_0x3e257d(0x241)])){const _0x403546=_0x2d5cf4[_0x3e257d(0x300)]['getCellPositionByOffset'](_0xb6ca7[_0x3e257d(0x32e)][_0x3e257d(0x242)],_0xb6ca7['transform'][_0x3e257d(0x326)],_0x113801,_0x5b6809,{'x':0x0,'y':0x0}),_0x4c38de=_0x2d5cf4[_0x3e257d(0x300)][_0x3e257d(0x354)](_0xb6ca7[_0x3e257d(0x32e)][_0x3e257d(0x242)]+_0xb6ca7[_0x3e257d(0x32e)][_0x3e257d(0x259)],_0xb6ca7[_0x3e257d(0x32e)][_0x3e257d(0x326)]+_0xb6ca7[_0x3e257d(0x32e)]['height'],_0x113801,_0x5b6809,{'x':0x0,'y':0x0});_0x403546[_0x3e257d(0x2ad)]<_0x2a6610[_0x3e257d(0x336)]&&(_0x2a6610[_0x3e257d(0x336)]=_0x403546['column']),_0x403546[_0x3e257d(0x1ed)]<_0x2a6610['startRow']&&(_0x2a6610[_0x3e257d(0x360)]=_0x403546[_0x3e257d(0x1ed)]),_0x2a6610['endRow']<_0x4c38de[_0x3e257d(0x1ed)]&&(_0x2a6610[_0x3e257d(0x278)]=_0x4c38de['row']),_0x2a6610['endColumn']<_0x4c38de[_0x3e257d(0x2ad)]&&(_0x2a6610['endColumn']=_0x4c38de['column']);}}),_0x463211(_0x2a6610)):_0x463211(_0x5ea998);},_0x2b0964(0x312))}));}},__name(_a7,_0x3d4902(0x316)),_a7);SheetDrawingPrintingController=__decorateClass$3([__decorateParam$3(0x0,Inject(SheetPrintInterceptorService)),__decorateParam$3(0x1,Inject(DrawingRenderService)),__decorateParam$3(0x2,IDrawingManagerService),__decorateParam$3(0x3,IRenderManagerService)],SheetDrawingPrintingController);function _0x3354(){const _0x4c5c17=['getNoMergeCellPositionByIndexWithNoHeader','icon','generateShortUuid','_getFloatDomProps','univer-upload-loading','SheetDrawingTransformAffectedController','string','BACKSPACE','rowOffset','focus$','undo','getFocusDrawings','_focusDrawingListener','trim','_initDependencies','30fFjmWR','unitId','getObject','hasOwnProperty','refreshTransform','endX','createElement','subscribeEvent','focusDrawing','onCommandExecuted','_updateImageListener','current','getDrawingOrder','actualRow','pushUndoRedo','imageCommonPanelRow','sheetTransform','getCurrentSelections','DrawingPopupMenuController','getForwardDrawingsOp','getContextValue','rect','univer-image-common-panel-row-vertical','getAllUnitsForType','includes','actualColumn','pluginName','sheet.command.set-drawing-arrange','svg','column','imageCommonPanelGrid','newSheetTransform','composePermission','set','onPasteCells','SHEET_IMAGE_UI_PLUGIN','random','_refreshDrawingTransform','onStarting','_univerInstanceService','gridDisplay','RIGHT','_featureUpdateListener','registerRenderModule','onPointerDown','_initShortcuts','apply','path','_insertFloatImage','imageCommonPanelTitle','subscribe','replaceRuntimeIdsInDefs','ARROW_RIGHT','univer-sheet-image-menu-input','sidebar.operation.sheet-image','_contextService','get','currentColor','uploadLoadingBody','_sheetDrawingService','__decorateParam$6','renderObject','_scrollUpdateListener','intercept','children','transformChange$','dispose$','addHook','_skeletonManagerService','_initCommands','_removeDom','shortcut.sheet.drawing-move-right','drawingType','__decorateParam$2','_getSceneAndTransformerByDrawingSearch','_drawingAddListener','UNGROUP','__decorateClass$4','getAllObjectsByOrder','getSheetId','close','3PTKWSx','function','removeRender','28rKGJjz','_injector','__decorateClass$6','_canvasPopManagerService','worksheet','_getUpdateOrDeleteDrawings','getFreeze','extend','_copyInfo','getUngroupDrawingOp','getCurrentTypeOfUnit$','_renderManagerService','registerComponent','_create','registerDrawingData','subUnitId','complete','shortcut.sheet.drawing-move-left','getPermissionPoint$','indexOf','getDrawingDataForUnit','sheet.command.ungroup-sheet-image','_localeService','featurePluginGroupUpdate$','getBatchAddOp','interceptor','insert','engine','skeleton','getTransformerByCreate','none','whenSheetDrawingFocused','SUBITEMS','removeFloatDom','_init','length','SheetDrawingUpdateController','columnOffset','defs','ImageMenuFactory','intersects','setDrawingEditable','add-image-single','imageCommonPanel','_sheetInterceptorService','UploadFloatImageMenuFactory','handler','getSelectedObjectMap','getTypeOfUnitDisposed$','getOwnPropertySymbols','SheetDrawingPrintingController','univer-image-common-panel-span2','_deleteListener','remove','addFloatDom','asObservable','syncExecuteCommand','_sheetSelectionRenderService','transformToDrawingPosition','getActiveSheet','order','isDefine','generateRandomId','change$','_context','transformByState','top','delete','replace','div','__decorateClass$3','values','every','_config','transform','sheetImage.panel.title','_ensureMap','REMOVE','_getDrawingUndoForRowVisible','uploadLoadingBodyText','redo','unsubscribe','startColumn','SheetDrawingPanel','_getImageMenuItems','activeSheet$','getUnitId','substring','groupId','type','_groupDrawingListener','__decorateClass$7','featurePluginUngroupUpdate$','Both','_generateMutations','M2.2498\x203.65005C2.2498\x202.87685\x202.87661\x202.25005\x203.64981\x202.25005H7.9998C8.33118\x202.25005\x208.5998\x201.98142\x208.5998\x201.65005C8.5998\x201.31868\x208.33118\x201.05005\x207.9998\x201.05005H3.64981C2.21387\x201.05005\x201.0498\x202.21411\x201.0498\x203.65005V12.35C1.0498\x2013.786\x202.21386\x2014.95\x203.6498\x2014.95H12.3498C13.7857\x2014.95\x2014.9498\x2013.786\x2014.9498\x2012.3501V8.00005C14.9498\x207.66868\x2014.6812\x207.40005\x2014.3498\x207.40005C14.0184\x207.40005\x2013.7498\x207.66868\x2013.7498\x208.00005V9.23974L12.2385\x208.1063C11.7252\x207.72129\x2011.0068\x207.7723\x2010.5531\x208.22605L9.00869\x209.77041L6.73916\x207.8251C6.24387\x207.40055\x205.5095\x207.41278\x205.02864\x207.85359L2.2498\x2010.4009V3.65005ZM2.2498\x2012.0287V12.35C2.2498\x2013.1232\x202.87661\x2013.75\x203.6498\x2013.75H12.3498C13.123\x2013.75\x2013.7498\x2013.1232\x2013.7498\x2012.3501V10.7397L11.5186\x209.06631C11.4829\x209.03956\x2011.433\x209.04314\x2011.4016\x209.07458L9.92249\x2010.5537L11.1015\x2011.5642C11.3531\x2011.7799\x2011.3822\x2012.1587\x2011.1666\x2012.4103C10.9509\x2012.6619\x2010.5721\x2012.691\x2010.3205\x2012.4753L5.9582\x208.7362C5.92384\x208.70674\x205.87288\x208.70758\x205.83952\x208.73816L2.2498\x2012.0287Z','add','sheet.command.set-sheet-image','_sheetSkeletonManagerService','_hooks','ERROR_EXCEED_SIZE','_registerRenderModules','sheetImage.title','startY','drawingPositionToTransform','data','_initCopyPaste','scene','imageCommonPanelColumn','2904eKKoAZ','Position','__decorateParam$1','getCellPositionByOffset','oKey','ARRANGE','dispatchEvent','getOwnPropertyDescriptor','vertical','univer-image-common-panel','featurePluginUpdate$','_initCustomComponents','addition-and-subtraction-single','univer-sheet-image-menu','_commandListener','startRow','className','_messageService','endColumn','_componentManager','onBeforeCopy','attachRangeWithCoord','getAncestorScale','M11.8097\x201.14783C12.1411\x201.14783\x2012.4097\x201.41646\x2012.4097\x201.74783V3.297H14.1541C14.4855\x203.297\x2014.7541\x203.56563\x2014.7541\x203.897C14.7541\x204.22837\x2014.4855\x204.497\x2014.1541\x204.497H12.4097V6.24167C12.4097\x206.57304\x2012.1411\x206.84167\x2011.8097\x206.84167C11.4783\x206.84167\x2011.2097\x206.57304\x2011.2097\x206.24167V4.497H9.6603C9.32893\x204.497\x209.0603\x204.22837\x209.0603\x203.897C9.0603\x203.56563\x209.32893\x203.297\x209.6603\x203.297H11.2097V1.74783C11.2097\x201.41646\x2011.4783\x201.14783\x2011.8097\x201.14783Z','_initPrinting','univer-image-common-panel-subtitle','_selectionRenderService','addNotification','url(#$1','startX','_getUnitIdAndSubUnitId','copyType','shortcut.sheet.drawing-delete','_uiPartsService','2753784mWGiyD','setConfig','parent','splice','onClose','image-popup.delete','_createUndoAndRedoMutation','_getDrawingUndoForColVisible','use','pasteType','None','FORMULAS_INSERT','VIEW_MAIN','sheets-drawing-ui.config','_getImagePosition','onWheel','uploadLoadingBodyAnimation','keys','update$','getMutations','BUTTON','changing$','onPastePlainText','drawing-anchor.position','_expandCol','handleChange','map','_sheetRefreshListener','sheet.command.insert-sheet-image','sheet.operation.clear-drawing-transformer','anchorType','univer-upload-loading-body-text','_domLayerMap','13321200hyOfqM','getWorksheetSkeleton','displayName','pipe','_drawingManagerService','drawingId','registerShortcut','allowTransform','columnHeaderHeight','__decorateParam$4','getCurrentTypeOfRenderer','_moveColInterceptor','defineProperty','concat','_drawingInitializeListener','_initMenus','getCurrent','front','evenodd','GROUP','UPDATE','_workbookSelections','_initViewPermissionChange','some','DRAWING_GROUP','_getDrawingUndoForRowAndColSize','_remainDrawingSize','sheet.menu.image','UniverSheetsDrawingUIPlugin','_hasCropObject','659935Gzljml','_dispose','objects','registerCommand','_sheetClipboardService','_getRangeMoveUndo','push','ARROW_DOWN','__decorateClass$1','backward','DOWN','currentUser$','filter','_permissionService','size','_getUnitInfo','calcPosition','UNIVER_SHEET','featurePluginOrderUpdate$','getBatchRemoveOp','symbol','has','row','xlink:href','INSERT','drawingManagerData','getDrawingOKey','sheet.command.remove-sheet-image','unit','univer-image-common-panel-span3','replaceRuntimeIdsAndExtInAttrs','_transformChange$','with','removeNotification','absolute','image/','openFile','getDrawingByParam','update-status.exceedMaxSize','OPERATION','DRAWING_IMAGE','getRenderById','_moveRowInterceptor','SheetsDrawingRenderController','onReady','endY','open','register','sheet.command.insert-float-image','_commandService','univer-image-common-panel-row','_remove$','defIds','_shortcutService','setContextValue','classType','1097912ZLXxTP','__decorateParam$5','max','groupToUngroup','colorChannel1','ERROR_IMAGE','onPointerMove','value','COMMAND','setDrawingVisible','_fileOpenerService','LEFT','PRINTING_COMPONENT_COLLECT','SPECIAL_PASTE_COL_WIDTH','SheetDrawingAnchor','prototype','min','updateSheet','image-popup.reset','call','composePermission$','SheetCanvasFloatDomManagerService','_configService','_shrinkRow','range','fill','univerjs-icon\x20univerjs-icon-','detachTransformerFrom','__decorateParam$9','univer-image-common-panel-input','_initDrawingEditable','UniverIcon','remove$','_domLayerInfoMap','_shrinkCol','drawing-anchor.none','mergeMenu','executeCommand','_sheetInterceptorListener','update-status.exceedMaxCount','from','onTransformChange$','getViewport','__decorateParam$7','attachTransformerTo','forEach','update-status.invalidImage','univer-UniverCircleAnimation','__decorateParam','getTransformer','height','left','_imageIoService','1em','shortcut.sheet.drawing-move-down','__publicField','4_sheet-drawing-view','getSelectionCellByPosition','MUTATION','getInterceptPoints','_updateOrderListener','rowHeaderWidth','horizontal','3891447pLbzmW','next','removeObject','AddImageSingle','saveImage','getCurrentSkeleton','entries','getBatchUpdateOp','_userManagerService','getDrawingData','_popupMenuListener','width','_getPosition','univer-upload-loading-body-animation','univer-image-common-panel-title','CONTENT','add$','insertFloatImage','initializeNotification','tag','getFrontDrawingsOp','_initImagePopupMenu','SPECIAL_PASTE_VALUE','_moveRangeInterceptor','0\x200\x2016\x2016','_canvasFloatDomService','toString','clearControl$','_sheetPrintInterceptorService','findIndex','newTransform','_expandRow','disposeWithMe','DRAWING_DOM','renderDrawing','ERROR_IMAGE_TYPE','dispose','attrs','onPointerUp','transformBound2DOMBound','918668xAdoKJ','idSuffix','endRow','getUpdateParams','_initEditPermissionChange','Error','IMAGE','show','_initDrawingVisible','CUT','params'];_0x3354=function(){return _0x4c5c17;};return _0x3354();}var __defProp$2=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$2=Object[_0x3d4902(0x358)],__decorateClass$2=__name((_0x453a1d,_0x801dc7,_0x1859cb,_0x8fd9fe)=>{const _0x4066a8=_0x3d4902;for(var _0x26df8f=_0x8fd9fe>0x1?void 0x0:_0x8fd9fe?__getOwnPropDesc$2(_0x801dc7,_0x1859cb):_0x801dc7,_0x2b4a08=_0x453a1d[_0x4066a8(0x307)]-0x1,_0xbba711;_0x2b4a08>=0x0;_0x2b4a08--)(_0xbba711=_0x453a1d[_0x2b4a08])&&(_0x26df8f=(_0x8fd9fe?_0xbba711(_0x801dc7,_0x1859cb,_0x26df8f):_0xbba711(_0x26df8f))||_0x26df8f);return _0x8fd9fe&&_0x26df8f&&__defProp$2(_0x801dc7,_0x1859cb,_0x26df8f),_0x26df8f;},'__decorateClass$2'),__decorateParam$2=__name((_0x444deb,_0xb7f9f3)=>(_0x2f30c5,_0x14e040)=>_0xb7f9f3(_0x2f30c5,_0x14e040,_0x444deb),_0x3d4902(0x2d9));const UPDATE_COMMANDS=[InsertRowCommand['id'],InsertColCommand['id'],RemoveRowCommand['id'],RemoveColCommand['id'],DeleteRangeMoveLeftCommand['id'],DeleteRangeMoveUpCommand['id'],InsertRangeMoveDownCommand['id'],InsertRangeMoveRightCommand['id'],DeltaRowHeightCommand['id'],SetRowHeightCommand['id'],DeltaColumnWidthCommand['id'],SetColWidthCommand['id'],SetRowHiddenCommand['id'],SetSpecificRowsVisibleCommand['id'],SetSpecificColsVisibleCommand['id'],SetColHiddenCommand['id'],MoveColsCommand['id'],MoveRowsCommand['id'],MoveRangeCommand['id']],REFRESH_MUTATIONS=[SetRowVisibleMutation['id'],SetRowHiddenMutation['id'],SetColVisibleMutation['id'],SetColHiddenMutation['id'],SetWorksheetRowHeightMutation['id'],SetWorksheetColWidthMutation['id']];var _a8;let SheetDrawingTransformAffectedController=(_a8=class extends Disposable{constructor(_0xa11ad1,_0x4e3fb8,_0x35e151,_0x59307d,_0x56d51e,_0x11c16e,_0x2ab288,_0x5f4204,_0xbd409b){const _0xbedace=_0x3d4902;super(),this[_0xbedace(0x324)]=_0xa11ad1,this[_0xbedace(0x2ef)]=_0x4e3fb8,this[_0xbedace(0x208)]=_0x35e151,this[_0xbedace(0x36b)]=_0x59307d,this[_0xbedace(0x2d4)]=_0x56d51e,this[_0xbedace(0x310)]=_0x11c16e,this['_sheetDrawingService']=_0x2ab288,this[_0xbedace(0x1bd)]=_0x5f4204,this[_0xbedace(0x2b7)]=_0xbd409b,this[_0xbedace(0x235)](),this[_0xbedace(0x35f)](),this[_0xbedace(0x38e)]();}[_0x3d4902(0x235)](){const _0x29ec91=_0x3d4902;this[_0x29ec91(0x26e)](this[_0x29ec91(0x310)]['interceptCommand']({'getMutations':__name(_0x501de5=>{const _0xed6ad=_0x29ec91;if(!UPDATE_COMMANDS[_0xed6ad(0x2a8)](_0x501de5['id']))return{'redos':[],'undos':[]};if(_0x501de5['params']==null)return{'redos':[],'undos':[]};const _0x3fdd11=_0x501de5['id'];if(_0x3fdd11===InsertRowCommand['id'])return this[_0xed6ad(0x201)](_0x501de5['params'],_0xed6ad(0x2fe));if([MoveColsCommand['id'],MoveRowsCommand['id'],MoveRangeCommand['id']][_0xed6ad(0x2a8)](_0x3fdd11))return this[_0xed6ad(0x265)](_0x501de5[_0xed6ad(0x280)]);if(_0x3fdd11===InsertColCommand['id'])return this[_0xed6ad(0x1c4)](_0x501de5[_0xed6ad(0x280)],_0xed6ad(0x2fe));if(_0x3fdd11===RemoveRowCommand['id'])return this['_moveRowInterceptor'](_0x501de5[_0xed6ad(0x280)],_0xed6ad(0x319));if(_0x3fdd11===RemoveColCommand['id'])return this[_0xed6ad(0x1c4)](_0x501de5['params'],_0xed6ad(0x319));if(_0x3fdd11===DeleteRangeMoveLeftCommand['id']){const {range:_0x1ebdd0}=_0x501de5[_0xed6ad(0x280)];return this[_0xed6ad(0x1dc)](_0x1ebdd0,0x0);}else{if(_0x3fdd11===DeleteRangeMoveUpCommand['id']){const {range:_0xb7ca11}=_0x501de5[_0xed6ad(0x280)];return this[_0xed6ad(0x1dc)](_0xb7ca11,0x1);}else{if(_0x3fdd11===InsertRangeMoveDownCommand['id']){const {range:_0x547766}=_0x501de5[_0xed6ad(0x280)];return this[_0xed6ad(0x1dc)](_0x547766,0x2);}else{if(_0x3fdd11===InsertRangeMoveRightCommand['id']){const {range:_0x4dfdf4}=_0x501de5[_0xed6ad(0x280)];return this['_getRangeMoveUndo'](_0x4dfdf4,0x3);}else{if(_0x3fdd11===SetRowHiddenCommand['id']||_0x3fdd11===SetSpecificRowsVisibleCommand['id']){const _0x1f9ee4=_0x501de5['params'],{unitId:_0x54e190,subUnitId:_0x26457a,ranges:_0x4203c8}=_0x1f9ee4;return this['_getDrawingUndoForRowVisible'](_0x54e190,_0x26457a,_0x4203c8);}else{if(_0x3fdd11===SetSpecificColsVisibleCommand['id']||_0x3fdd11===SetColHiddenCommand['id']){const _0x32109b=_0x501de5['params'],{unitId:_0x57d559,subUnitId:_0x321e74,ranges:_0x31b4b0}=_0x32109b;return this['_getDrawingUndoForColVisible'](_0x57d559,_0x321e74,_0x31b4b0);}else{if(_0x3fdd11===DeltaRowHeightCommand['id']||_0x3fdd11===SetRowHeightCommand['id']||_0x3fdd11===DeltaColumnWidthCommand['id']||_0x3fdd11===SetColWidthCommand['id']){const _0x5dfe4e=_0x501de5[_0xed6ad(0x280)],{unitId:_0x420a49,subUnitId:_0xd77743,ranges:_0x2b48bd}=_0x5dfe4e,_0xb6b2b8=_0x3fdd11===DeltaRowHeightCommand['id']||_0x3fdd11===SetRowHeightCommand['id'];return this[_0xed6ad(0x1d2)](_0x420a49,_0xd77743,_0x2b48bd,_0xb6b2b8);}}}}}}}return{'redos':[],'undos':[]};},_0x29ec91(0x386))}));}[_0x3d4902(0x1dc)](_0x3c735e,_0x1468ea){const _0x28cedd=_0x3d4902,_0x1c5521=getSheetCommandTarget(this[_0x28cedd(0x2b7)]);if(_0x1c5521==null)return{'redos':[],'undos':[]};const _0x6e9424=_0x1c5521['unitId'],_0x40d26f=_0x1c5521[_0x28cedd(0x2f3)],_0x2e2d06=[],_0x3a326d=[],_0x1ba97d=this[_0x28cedd(0x2cb)][_0x28cedd(0x257)](_0x6e9424,_0x40d26f),_0x1e2305=[],_0x1a028a=[];if(Object['keys'](_0x1ba97d)[_0x28cedd(0x23c)](_0x1c0a11=>{const _0x29a243=_0x28cedd,_0x4d7256=_0x1ba97d[_0x1c0a11],{updateDrawings:_0x2bae9a,deleteDrawings:_0x5efa6e}=this['_getUpdateOrDeleteDrawings'](_0x3c735e,_0x1468ea,_0x4d7256);_0x1e2305[_0x29a243(0x1dd)](..._0x2bae9a),_0x1a028a['push'](..._0x5efa6e);}),_0x1e2305[_0x28cedd(0x307)]===0x0&&_0x1a028a['length']===0x0)return{'redos':[],'undos':[]};if(_0x1e2305['length']>0x0){const _0x1bbc8a=this[_0x28cedd(0x2cb)][_0x28cedd(0x255)](_0x1e2305),{undo:_0x1d31e1,redo:_0x33ba08,objects:_0x15b714}=_0x1bbc8a;_0x2e2d06[_0x28cedd(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x6e9424,'subUnitId':_0x40d26f,'op':_0x33ba08,'objects':_0x15b714,'type':DrawingApplyType[_0x28cedd(0x1cd)]}}),_0x3a326d[_0x28cedd(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x6e9424,'subUnitId':_0x40d26f,'op':_0x1d31e1,'objects':_0x15b714,'type':DrawingApplyType[_0x28cedd(0x1cd)]}});}if(_0x1a028a[_0x28cedd(0x307)]>0x0){const _0xec87f5=this[_0x28cedd(0x2cb)]['getBatchRemoveOp'](_0x1a028a),_0x4b6eb8=_0xec87f5[_0x28cedd(0x28b)],_0x3da840=_0xec87f5[_0x28cedd(0x334)],_0x10ac45=_0xec87f5[_0x28cedd(0x1d9)];_0x2e2d06[_0x28cedd(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x6e9424,'subUnitId':_0x40d26f,'op':_0x3da840,'objects':_0x10ac45,'type':DrawingApplyType['REMOVE']}}),_0x3a326d['push']({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x6e9424,'subUnitId':_0x40d26f,'op':_0x4b6eb8,'objects':_0x10ac45,'type':DrawingApplyType['INSERT']}});}return _0x2e2d06[_0x28cedd(0x1dd)]({'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x6e9424]}),_0x3a326d[_0x28cedd(0x1dd)]({'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x6e9424]}),{'redos':_0x2e2d06,'undos':_0x3a326d};}[_0x3d4902(0x2e9)](_0x3894d5,_0x2ef4d7,_0x2adbc4){const _0x11c33d=_0x3d4902,_0x50784b=[],_0x53017c=[],{sheetTransform:_0x215adb,anchorType:anchorType=SheetDrawingAnchorType[_0x11c33d(0x352)],transform:_0x443b0e,unitId:_0x30a1b7,subUnitId:_0x30d04b,drawingId:_0x20cdfb}=_0x2adbc4,{from:_0x1a33fc,to:_0x337100}=_0x215adb,{row:_0x410d24,column:_0x19a56f}=_0x1a33fc,{row:_0xb3ddb2,column:_0xb575fb}=_0x337100;if(_0x215adb==null||_0x443b0e==null)return{'updateDrawings':_0x50784b,'deleteDrawings':_0x53017c};const {startRow:_0x9bdc72,endRow:_0x4fe437,startColumn:_0x5efc2f,endColumn:_0x3c5151}=_0x3894d5;let _0x13d5a8=null,_0x32bafe=null;if(_0x2ef4d7===0x0&&_0x410d24>=_0x9bdc72&&_0xb3ddb2<=_0x4fe437){if(_0x19a56f>=_0x5efc2f&&_0xb575fb<=_0x3c5151)_0x53017c[_0x11c33d(0x1dd)]({'unitId':_0x30a1b7,'subUnitId':_0x30d04b,'drawingId':_0x20cdfb});else{const _0x244e60=this['_shrinkCol'](_0x215adb,_0x443b0e,_0x5efc2f,_0x3c5151,anchorType);_0x13d5a8=_0x244e60==null?void 0x0:_0x244e60[_0x11c33d(0x2af)],_0x32bafe=_0x244e60==null?void 0x0:_0x244e60['newTransform'];}}else{if(_0x2ef4d7===0x1&&_0x19a56f>=_0x5efc2f&&_0xb575fb<=_0x3c5151){if(_0x410d24>=_0x9bdc72&&_0xb3ddb2<=_0x4fe437)_0x53017c[_0x11c33d(0x1dd)]({'unitId':_0x30a1b7,'subUnitId':_0x30d04b,'drawingId':_0x20cdfb});else{const _0x43304b=this[_0x11c33d(0x226)](_0x215adb,_0x443b0e,_0x9bdc72,_0x4fe437,anchorType);_0x13d5a8=_0x43304b==null?void 0x0:_0x43304b[_0x11c33d(0x2af)],_0x32bafe=_0x43304b==null?void 0x0:_0x43304b['newTransform'];}}else{if(_0x2ef4d7===0x2){const _0x252f9f=this[_0x11c33d(0x26d)](_0x215adb,_0x443b0e,_0x9bdc72,_0x4fe437,anchorType);_0x13d5a8=_0x252f9f==null?void 0x0:_0x252f9f[_0x11c33d(0x2af)],_0x32bafe=_0x252f9f==null?void 0x0:_0x252f9f['newTransform'];}else{if(_0x2ef4d7===0x3){const _0x345e2c=this[_0x11c33d(0x38b)](_0x215adb,_0x443b0e,_0x5efc2f,_0x3c5151,anchorType);_0x13d5a8=_0x345e2c==null?void 0x0:_0x345e2c['newSheetTransform'],_0x32bafe=_0x345e2c==null?void 0x0:_0x345e2c['newTransform'];}}}}if(_0x13d5a8!=null&&_0x32bafe!=null){const _0x4bf3f2=drawingPositionToTransform(_0x13d5a8,this[_0x11c33d(0x36b)],this[_0x11c33d(0x2d4)]);_0x50784b[_0x11c33d(0x1dd)]({..._0x2adbc4,'sheetTransform':_0x13d5a8,'transform':_0x4bf3f2});}return{'updateDrawings':_0x50784b,'deleteDrawings':_0x53017c};}['_remainDrawingSize'](_0x46b241,_0x59d2e1,_0x567f40){const _0x49b972=_0x3d4902,_0x3b82cd=transformToDrawingPosition({..._0x46b241},this['_selectionRenderService']);_0x3b82cd!=null&&_0x59d2e1[_0x49b972(0x1dd)]({..._0x567f40,'sheetTransform':_0x3b82cd});}[_0x3d4902(0x37a)](_0x4971b5,_0x2fd31b,_0x1c98f1){const _0x44d340=_0x3d4902,_0x344fca=this['_drawingManagerService']['getDrawingData'](_0x4971b5,_0x2fd31b),_0x428c74=[],_0x23077c=[];if(Object[_0x44d340(0x384)](_0x344fca)[_0x44d340(0x23c)](_0x2fe849=>{const _0x5231e2=_0x44d340,_0x20b04d=_0x344fca[_0x2fe849],{sheetTransform:_0x5b2a70,transform:_0x3dcb8e,anchorType:anchorType=SheetDrawingAnchorType[_0x5231e2(0x352)]}=_0x20b04d;if(anchorType===SheetDrawingAnchorType[_0x5231e2(0x37d)])this[_0x5231e2(0x1d3)](_0x3dcb8e,_0x428c74,_0x20b04d);else{const {from:_0x5504ab,to:_0xdedd3a}=_0x5b2a70,{row:_0x498f74,column:_0x2eaa77}=_0x5504ab,{row:_0x16f2f6,column:_0x21ad9a}=_0xdedd3a;for(let _0x6e039e=0x0;_0x6e039e<_0x1c98f1[_0x5231e2(0x307)];_0x6e039e++){const _0x3c73dc=_0x1c98f1[_0x6e039e],{startRow:_0x515018,endRow:_0x356c99,startColumn:_0x577bd1,endColumn:_0x2d330e}=_0x3c73dc;if(_0x21ad9a<_0x577bd1)continue;if(anchorType===SheetDrawingAnchorType[_0x5231e2(0x352)]){let _0x2f13a0=null,_0x406ec8=null;if(_0x2eaa77>=_0x577bd1&&_0x2eaa77<=_0x2d330e){const _0x9e8b94=this['_skeletonManagerService'][_0x5231e2(0x366)]({'startColumn':_0x2eaa77,'endColumn':_0x2d330e,'startRow':_0x5504ab[_0x5231e2(0x1ed)],'endRow':_0xdedd3a[_0x5231e2(0x1ed)]});if(_0x9e8b94==null)return;_0x406ec8={..._0x3dcb8e,'left':_0x9e8b94[_0x5231e2(0x36e)]};}if(_0x406ec8!=null&&(_0x2f13a0=transformToDrawingPosition(_0x406ec8,this[_0x5231e2(0x36b)]),_0x2f13a0!=null&&_0x406ec8!=null)){_0x428c74[_0x5231e2(0x1dd)]({..._0x20b04d,'sheetTransform':_0x2f13a0,'transform':_0x406ec8});break;}this[_0x5231e2(0x1d3)](_0x3dcb8e,_0x428c74,_0x20b04d);continue;}if(_0x2eaa77>=_0x577bd1&&_0x21ad9a<=_0x2d330e)continue;let _0x178f11=null,_0x257645=null;if(_0x2eaa77>=_0x577bd1&&_0x2eaa77<=_0x2d330e){const _0x2474da=this['_skeletonManagerService']['attachRangeWithCoord']({'startColumn':_0x2eaa77,'endColumn':_0x2d330e,'startRow':_0x5504ab['row'],'endRow':_0xdedd3a[_0x5231e2(0x1ed)]});if(_0x2474da==null)return;_0x257645={..._0x3dcb8e,'left':(_0x2474da==null?void 0x0:_0x2474da['startX'])||0x0,'width':((_0x3dcb8e==null?void 0x0:_0x3dcb8e[_0x5231e2(0x259)])||0x0)-_0x2474da['endX']+_0x2474da[_0x5231e2(0x36e)]};}else{if(_0x21ad9a>=_0x577bd1&&_0x21ad9a<=_0x2d330e){const _0x3b2df3=this[_0x5231e2(0x2d4)][_0x5231e2(0x366)]({'startColumn':_0x577bd1,'endColumn':_0x21ad9a,'startRow':_0x5504ab[_0x5231e2(0x1ed)],'endRow':_0xdedd3a[_0x5231e2(0x1ed)]});if(_0x3b2df3==null)return;_0x257645={..._0x3dcb8e,'left':_0x3b2df3[_0x5231e2(0x36e)]-((_0x3dcb8e==null?void 0x0:_0x3dcb8e[_0x5231e2(0x259)])||0x0)};}else{const _0x583a71=this[_0x5231e2(0x2d4)][_0x5231e2(0x366)]({'startColumn':_0x577bd1,'endColumn':_0x2d330e,'startRow':_0x5504ab[_0x5231e2(0x1ed)],'endRow':_0xdedd3a['row']});if(_0x583a71==null)return;if(_0x257645={..._0x3dcb8e,'width':((_0x3dcb8e==null?void 0x0:_0x3dcb8e['width'])||0x0)-_0x583a71['endX']+_0x583a71['startX']},_0x178f11=transformToDrawingPosition(_0x257645,this['_selectionRenderService']),_0x178f11!=null&&_0x257645!=null){_0x23077c[_0x5231e2(0x1dd)]({..._0x20b04d,'sheetTransform':_0x178f11,'transform':_0x257645});break;}}}if(_0x257645!=null&&(_0x178f11=transformToDrawingPosition(_0x257645,this['_selectionRenderService'])),_0x257645!=null&&_0x178f11!=null){_0x428c74[_0x5231e2(0x1dd)]({..._0x20b04d,'sheetTransform':_0x178f11,'transform':_0x257645});break;}else this[_0x5231e2(0x1d3)](_0x3dcb8e,_0x428c74,_0x20b04d);}}}),_0x428c74[_0x44d340(0x307)]===0x0&&_0x23077c['length']===0x0)return{'redos':[],'undos':[]};const {redos:_0x5d355c,undos:_0x630c65}=this[_0x44d340(0x379)](_0x4971b5,_0x2fd31b,_0x428c74),_0x2c3560=[],_0x57977f=[];if(_0x23077c['length']>0x0){const {redos:_0x56f128,undos:_0x149af8}=this[_0x44d340(0x379)](_0x4971b5,_0x2fd31b,_0x23077c);_0x2c3560[_0x44d340(0x1dd)](..._0x56f128),_0x57977f[_0x44d340(0x1dd)](..._0x149af8);}return{'redos':_0x5d355c,'undos':_0x630c65,'preRedos':_0x2c3560,'preUndos':_0x57977f};}[_0x3d4902(0x379)](_0x1e6ee8,_0x21a29c,_0x12de3d){const _0x541fe9=_0x3d4902,_0x518c63=this[_0x541fe9(0x2cb)]['getBatchUpdateOp'](_0x12de3d),{undo:_0x22df6d,redo:_0x3f73c2,objects:_0x1e332d}=_0x518c63,_0x147d85=[{'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x1e6ee8,'subUnitId':_0x21a29c,'op':_0x3f73c2,'objects':_0x1e332d,'type':DrawingApplyType['UPDATE']}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x1e6ee8]}],_0x2f73fa=[{'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x1e6ee8,'subUnitId':_0x21a29c,'op':_0x22df6d,'objects':_0x1e332d,'type':DrawingApplyType[_0x541fe9(0x1cd)]}},{'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x1e6ee8]}];return{'redos':_0x147d85,'undos':_0x2f73fa};}[_0x3d4902(0x332)](_0x302724,_0x367a28,_0x4321d6){const _0x21358d=_0x3d4902,_0x49f2c5=this[_0x21358d(0x1bd)][_0x21358d(0x257)](_0x302724,_0x367a28),_0x49a766=[],_0x3dcd2b=[];if(Object[_0x21358d(0x384)](_0x49f2c5)[_0x21358d(0x23c)](_0x4cbdc7=>{const _0xb4c9e2=_0x21358d,_0x4d19ce=_0x49f2c5[_0x4cbdc7],{sheetTransform:_0x1d0163,transform:_0x38750b,anchorType:anchorType=SheetDrawingAnchorType[_0xb4c9e2(0x352)]}=_0x4d19ce;if(anchorType===SheetDrawingAnchorType[_0xb4c9e2(0x37d)])this['_remainDrawingSize'](_0x38750b,_0x49a766,_0x4d19ce);else{const {from:_0x57dd87,to:_0x3a467c}=_0x1d0163,{row:_0x3388e9,column:_0x7af01e}=_0x57dd87,{row:_0x3fcd8a,column:_0xe81d74}=_0x3a467c;for(let _0xca70d4=0x0;_0xca70d4<_0x4321d6['length'];_0xca70d4++){const _0x438044=_0x4321d6[_0xca70d4],{startRow:_0x55ad25,endRow:_0x4d029f,startColumn:_0x373764,endColumn:_0x14f3bd}=_0x438044;if(_0x3fcd8a<_0x55ad25)continue;if(anchorType===SheetDrawingAnchorType[_0xb4c9e2(0x352)]){let _0x1d9b0b=null,_0x210bf3=null;if(_0x3388e9>=_0x55ad25&&_0x3388e9<=_0x4d029f){const _0x30bc67=this['_skeletonManagerService']['attachRangeWithCoord']({'startColumn':_0x57dd87['column'],'endColumn':_0x3a467c[_0xb4c9e2(0x2ad)],'startRow':_0x3388e9,'endRow':_0x4d029f});if(_0x30bc67==null)return;_0x210bf3={..._0x38750b,'top':_0x30bc67[_0xb4c9e2(0x34b)]};}if(_0x210bf3!=null&&(_0x1d9b0b=transformToDrawingPosition(_0x210bf3,this[_0xb4c9e2(0x36b)]),_0x1d9b0b!=null&&_0x210bf3!=null)){_0x49a766[_0xb4c9e2(0x1dd)]({..._0x4d19ce,'sheetTransform':_0x1d9b0b,'transform':_0x210bf3});break;}this['_remainDrawingSize'](_0x38750b,_0x49a766,_0x4d19ce);continue;}if(_0x3388e9>=_0x55ad25&&_0x3fcd8a<=_0x4d029f)continue;let _0x2cfc79=null,_0x948b5a=null;if(_0x3388e9>=_0x55ad25&&_0x3388e9<=_0x4d029f){const _0x10e84b=this[_0xb4c9e2(0x2d4)][_0xb4c9e2(0x366)]({'startColumn':_0x57dd87['column'],'endColumn':_0x3a467c[_0xb4c9e2(0x2ad)],'startRow':_0x3388e9,'endRow':_0x4d029f});if(_0x10e84b==null)return;_0x948b5a={..._0x38750b,'top':(_0x10e84b==null?void 0x0:_0x10e84b[_0xb4c9e2(0x34b)])||0x0,'height':((_0x38750b==null?void 0x0:_0x38750b[_0xb4c9e2(0x241)])||0x0)-_0x10e84b['endY']+_0x10e84b[_0xb4c9e2(0x34b)]};}else{if(_0x3fcd8a>=_0x55ad25&&_0x3fcd8a<=_0x4d029f){const _0x3a26d4=this[_0xb4c9e2(0x2d4)][_0xb4c9e2(0x366)]({'startColumn':_0x57dd87[_0xb4c9e2(0x2ad)],'endColumn':_0x3a467c[_0xb4c9e2(0x2ad)],'startRow':_0x55ad25,'endRow':_0x3fcd8a});if(_0x3a26d4==null)return;_0x948b5a={..._0x38750b,'top':_0x3a26d4[_0xb4c9e2(0x34b)]-((_0x38750b==null?void 0x0:_0x38750b[_0xb4c9e2(0x241)])||0x0)};}else{const _0x324aaf=this['_skeletonManagerService'][_0xb4c9e2(0x366)]({'startColumn':_0x57dd87[_0xb4c9e2(0x2ad)],'endColumn':_0x3a467c['column'],'startRow':_0x55ad25,'endRow':_0x4d029f});if(_0x324aaf==null)return;if(_0x948b5a={..._0x38750b,'height':((_0x38750b==null?void 0x0:_0x38750b[_0xb4c9e2(0x241)])||0x0)-_0x324aaf[_0xb4c9e2(0x204)]+_0x324aaf['startY']},_0x2cfc79=transformToDrawingPosition(_0x948b5a,this[_0xb4c9e2(0x36b)]),_0x2cfc79!=null&&_0x948b5a!=null){_0x3dcd2b[_0xb4c9e2(0x1dd)]({..._0x4d19ce,'sheetTransform':_0x2cfc79,'transform':_0x948b5a});break;}}}if(_0x948b5a!=null&&(_0x2cfc79=transformToDrawingPosition(_0x948b5a,this['_selectionRenderService'])),_0x948b5a!=null&&_0x2cfc79!=null){_0x49a766[_0xb4c9e2(0x1dd)]({..._0x4d19ce,'sheetTransform':_0x2cfc79,'transform':_0x948b5a});break;}else this['_remainDrawingSize'](_0x38750b,_0x49a766,_0x4d19ce);}}}),_0x49a766[_0x21358d(0x307)]===0x0&&_0x3dcd2b[_0x21358d(0x307)]===0x0)return{'redos':[],'undos':[]};const {redos:_0xe3e194,undos:_0x28a6db}=this['_createUndoAndRedoMutation'](_0x302724,_0x367a28,_0x49a766),_0x1864bb=[],_0x22c977=[];if(_0x3dcd2b[_0x21358d(0x307)]>0x0){const {redos:_0x4ff4b4,undos:_0x53edcf}=this[_0x21358d(0x379)](_0x302724,_0x367a28,_0x3dcd2b);_0x1864bb[_0x21358d(0x1dd)](..._0x4ff4b4),_0x22c977[_0x21358d(0x1dd)](..._0x53edcf);}return{'redos':_0xe3e194,'undos':_0x28a6db,'preRedos':_0x1864bb,'preUndos':_0x22c977};}[_0x3d4902(0x1d2)](_0x3e1cac,_0x20fd92,_0x465a50,_0x31a4bc){const _0x38756b=_0x3d4902,_0x2cac31=this[_0x38756b(0x1bd)][_0x38756b(0x257)](_0x3e1cac,_0x20fd92),_0x4aaceb=[];return Object[_0x38756b(0x384)](_0x2cac31)[_0x38756b(0x23c)](_0x3c24ef=>{const _0x393303=_0x38756b,_0x3ec004=_0x2cac31[_0x3c24ef],{sheetTransform:_0x477274,transform:_0x2a9e81,anchorType:anchorType=SheetDrawingAnchorType[_0x393303(0x352)]}=_0x3ec004;if(anchorType===SheetDrawingAnchorType[_0x393303(0x37d)])this['_remainDrawingSize'](_0x2a9e81,_0x4aaceb,_0x3ec004);else{const {from:_0x39baa2,to:_0x208bde}=_0x477274,{row:_0x5805b4,column:_0x568029}=_0x39baa2,{row:_0x221eb7,column:_0x1fa155}=_0x208bde;for(let _0x676429=0x0;_0x676429<_0x465a50[_0x393303(0x307)];_0x676429++){const _0x194552=_0x465a50[_0x676429],{startRow:_0xfcd296,endRow:_0x212f2f,startColumn:_0x401476,endColumn:_0x54957c}=_0x194552;if(_0x221eb7<_0xfcd296||_0x1fa155<_0x401476)continue;if(anchorType===SheetDrawingAnchorType[_0x393303(0x352)]&&(_0x5805b4<=_0xfcd296&&_0x221eb7>=_0x212f2f||_0x568029<=_0x401476&&_0x1fa155>=_0x54957c)){this[_0x393303(0x1d3)](_0x2a9e81,_0x4aaceb,_0x3ec004);continue;}const _0x4e2990=drawingPositionToTransform({..._0x477274},this[_0x393303(0x36b)],this[_0x393303(0x2d4)]);if(_0x4e2990!=null){_0x4aaceb[_0x393303(0x1dd)]({..._0x3ec004,'transform':_0x4e2990});break;}}}}),_0x4aaceb[_0x38756b(0x307)]===0x0?{'redos':[],'undos':[]}:this[_0x38756b(0x379)](_0x3e1cac,_0x20fd92,_0x4aaceb);}['_getUnitIdAndSubUnitId'](_0x5d5e3d,_0x3f581d){const _0xc176c9=_0x3d4902;let _0x837cf0,_0x684b72;if(_0x3f581d===_0xc176c9(0x2fe))_0x837cf0=_0x5d5e3d['unitId'],_0x684b72=_0x5d5e3d['subUnitId'];else{const _0x405b6f=getSheetCommandTarget(this['_univerInstanceService']);if(_0x405b6f==null)return;_0x837cf0=_0x405b6f[_0xc176c9(0x291)],_0x684b72=_0x405b6f[_0xc176c9(0x2f3)];}return{'unitId':_0x837cf0,'subUnitId':_0x684b72};}[_0x3d4902(0x265)](_0x31c7a2){const _0x420a30=_0x3d4902;var _0x24327e,_0xb36d77;const {toRange:_0x44ae2a,fromRange:_0x210e46}=_0x31c7a2,_0x255250=getSheetCommandTarget(this[_0x420a30(0x2b7)]);if(!_0x255250)return{'redos':[],'undos':[]};const {unitId:_0x1199ce,subUnitId:_0xfb803c}=_0x255250,_0x706d70=(_0xb36d77=(_0x24327e=this['_renderManagerService'][_0x420a30(0x200)](_0x1199ce))==null?void 0x0:_0x24327e['with'](SheetSkeletonManagerService))==null?void 0x0:_0xb36d77[_0x420a30(0x253)]();if(!_0x706d70)return{'redos':[],'undos':[]};const _0x1961d5=attachRangeWithCoord(_0x706d70,_0x210e46);if(!_0x1961d5)return{'redos':[],'undos':[]};const {startX:_0x116231,endX:_0x2bfffd,startY:_0x448968,endY:_0x57cfb0}=_0x1961d5,_0x34ac40=this[_0x420a30(0x2cb)][_0x420a30(0x257)](_0x1199ce,_0xfb803c),_0x47fe65=[];Object[_0x420a30(0x384)](_0x34ac40)[_0x420a30(0x23c)](_0x433314=>{const _0x4538bd=_0x420a30,_0x143d84=_0x34ac40[_0x433314];if(_0x143d84[_0x4538bd(0x391)]!==SheetDrawingAnchorType[_0x4538bd(0x341)])return;const {transform:_0x59ed97}=_0x143d84;if(!_0x59ed97)return;const {left:left=0x0,top:top=0x0,width:width=0x0,height:height=0x0}=_0x59ed97,{drawingStartX:_0x4feaeb,drawingEndX:_0xa1cecf,drawingStartY:_0x4a4d1a,drawingEndY:_0x3b8d21}={'drawingStartX':left,'drawingEndX':left+width,'drawingStartY':top,'drawingEndY':top+height};_0x116231<=_0x4feaeb&&_0xa1cecf<=_0x2bfffd&&_0x448968<=_0x4a4d1a&&_0x3b8d21<=_0x57cfb0&&_0x47fe65['push'](_0x143d84);});const _0x1a634c=[],_0x1f415b=[],_0x12f5d7=_0x44ae2a[_0x420a30(0x360)]-_0x210e46[_0x420a30(0x360)],_0x38ee3e=_0x44ae2a[_0x420a30(0x336)]-_0x210e46[_0x420a30(0x336)],_0x2fdda6=_0x47fe65['map'](_0xbe6215=>{const _0x2f8441=_0x420a30,_0x49285e=_0xbe6215[_0x2f8441(0x2a0)],_0x450725={'to':{..._0x49285e['to'],'row':_0x49285e['to'][_0x2f8441(0x1ed)]+_0x12f5d7,'column':_0x49285e['to'][_0x2f8441(0x2ad)]+_0x38ee3e},'from':{..._0x49285e[_0x2f8441(0x237)],'row':_0x49285e['from']['row']+_0x12f5d7,'column':_0x49285e['from'][_0x2f8441(0x2ad)]+_0x38ee3e}},_0x4046c7=drawingPositionToTransform(_0x450725,this[_0x2f8441(0x36b)],this[_0x2f8441(0x2d4)]);return{'unitId':_0x1199ce,'subUnitId':_0xfb803c,'drawingId':_0xbe6215[_0x2f8441(0x1be)],'transform':_0x4046c7,'sheetTransform':_0x450725};});if(_0x2fdda6[_0x420a30(0x307)]){const _0x2d981f=this['_sheetDrawingService']['getBatchUpdateOp'](_0x2fdda6),{undo:_0x74d17d,redo:_0x49c9bc,objects:_0x5a70dd}=_0x2d981f;_0x1a634c[_0x420a30(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x1199ce,'subUnitId':_0xfb803c,'op':_0x49c9bc,'objects':_0x5a70dd,'type':DrawingApplyType[_0x420a30(0x1cd)]}}),_0x1f415b[_0x420a30(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x1199ce,'subUnitId':_0xfb803c,'op':_0x74d17d,'objects':_0x5a70dd,'type':DrawingApplyType[_0x420a30(0x1cd)]}});}return{'redos':_0x1a634c,'undos':_0x1f415b};}[_0x3d4902(0x201)](_0x43e0fd,_0x19cabf){const _0x333b9f=_0x3d4902,_0x1eaf4d=this[_0x333b9f(0x36f)](_0x43e0fd,_0x19cabf);if(_0x1eaf4d==null)return{'redos':[],'undos':[]};const {unitId:_0x579951,subUnitId:_0x37bd67}=_0x1eaf4d,{range:_0x2e3f92}=_0x43e0fd,_0x1c3085=_0x2e3f92[_0x333b9f(0x360)],_0x1e250c=_0x2e3f92[_0x333b9f(0x278)],_0x4e770f=[],_0x2f8a21=[],_0x1e1ffb=this['_sheetDrawingService'][_0x333b9f(0x257)](_0x579951,_0x37bd67),_0x4d757f=[],_0x165cf7=[];if(Object[_0x333b9f(0x384)](_0x1e1ffb)['forEach'](_0x5ade3=>{const _0x4ccd6b=_0x333b9f,_0x355dd9=_0x1e1ffb[_0x5ade3],{sheetTransform:_0x2a4616,transform:_0x3045fd,anchorType:anchorType=SheetDrawingAnchorType[_0x4ccd6b(0x352)]}=_0x355dd9;if(_0x2a4616==null||_0x3045fd==null)return;let _0x23a560,_0x14dbc8;if(_0x19cabf===_0x4ccd6b(0x2fe)){const _0x5cdeb0=this[_0x4ccd6b(0x26d)](_0x2a4616,_0x3045fd,_0x1c3085,_0x1e250c,anchorType);_0x23a560=_0x5cdeb0==null?void 0x0:_0x5cdeb0[_0x4ccd6b(0x2af)],_0x14dbc8=_0x5cdeb0==null?void 0x0:_0x5cdeb0[_0x4ccd6b(0x26c)];}else{const {from:_0x2eb554,to:_0x42a6d4}=_0x2a4616,{row:_0x3c812f}=_0x2eb554,{row:_0x487273}=_0x42a6d4;if(anchorType===SheetDrawingAnchorType[_0x4ccd6b(0x341)]&&_0x3c812f>=_0x1c3085&&_0x487273<=_0x1e250c)_0x165cf7[_0x4ccd6b(0x1dd)]({'unitId':_0x579951,'subUnitId':_0x37bd67,'drawingId':_0x5ade3});else{const _0x4b470f=this[_0x4ccd6b(0x226)](_0x2a4616,_0x3045fd,_0x1c3085,_0x1e250c,anchorType);_0x23a560=_0x4b470f==null?void 0x0:_0x4b470f[_0x4ccd6b(0x2af)],_0x14dbc8=_0x4b470f==null?void 0x0:_0x4b470f[_0x4ccd6b(0x26c)];}}if(!_0x23a560||!_0x14dbc8)return;const _0x251f57={'unitId':_0x579951,'subUnitId':_0x37bd67,'drawingId':_0x5ade3,'transform':_0x14dbc8,'sheetTransform':_0x23a560};_0x4d757f[_0x4ccd6b(0x1dd)](_0x251f57);}),_0x4d757f['length']===0x0&&_0x165cf7[_0x333b9f(0x307)]===0x0)return{'redos':[],'undos':[]};if(_0x4d757f[_0x333b9f(0x307)]>0x0){const _0x3c60ef=this[_0x333b9f(0x2cb)][_0x333b9f(0x255)](_0x4d757f),{undo:_0x17a6ed,redo:_0x4edd5d,objects:_0x28a733}=_0x3c60ef;_0x4e770f[_0x333b9f(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x579951,'subUnitId':_0x37bd67,'op':_0x4edd5d,'objects':_0x28a733,'type':DrawingApplyType[_0x333b9f(0x1cd)]}}),_0x2f8a21[_0x333b9f(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x579951,'subUnitId':_0x37bd67,'op':_0x17a6ed,'objects':_0x28a733,'type':DrawingApplyType['UPDATE']}});}if(_0x165cf7[_0x333b9f(0x307)]>0x0){const _0x35c4e2=this[_0x333b9f(0x2cb)][_0x333b9f(0x1ea)](_0x165cf7),_0x2db886=_0x35c4e2['undo'],_0x42e451=_0x35c4e2['redo'],_0x177df3=_0x35c4e2[_0x333b9f(0x1d9)];_0x4e770f[_0x333b9f(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x579951,'subUnitId':_0x37bd67,'op':_0x42e451,'objects':_0x177df3,'type':DrawingApplyType[_0x333b9f(0x331)]}}),_0x2f8a21[_0x333b9f(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x579951,'subUnitId':_0x37bd67,'op':_0x2db886,'objects':_0x177df3,'type':DrawingApplyType[_0x333b9f(0x1ef)]}});}return _0x4e770f[_0x333b9f(0x1dd)]({'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x579951]}),_0x2f8a21[_0x333b9f(0x1dd)]({'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x579951]}),{'redos':_0x4e770f,'undos':_0x2f8a21};}[_0x3d4902(0x1c4)](_0x2631f2,_0x21b91f){const _0xa5b4e5=_0x3d4902,_0xc69b62=this['_getUnitIdAndSubUnitId'](_0x2631f2,_0x21b91f);if(_0xc69b62==null)return{'redos':[],'undos':[]};const {unitId:_0x94dbba,subUnitId:_0x49cd57}=_0xc69b62,{range:_0xa8aea1}=_0x2631f2,_0x334122=_0xa8aea1[_0xa5b4e5(0x336)],_0x408b9a=_0xa8aea1[_0xa5b4e5(0x363)],_0x2cd968=[],_0x59134a=[],_0x124810=this[_0xa5b4e5(0x2cb)][_0xa5b4e5(0x257)](_0x94dbba,_0x49cd57),_0x2409b3=[],_0x1e3101=[];if(Object['keys'](_0x124810)[_0xa5b4e5(0x23c)](_0x1c4b05=>{const _0x5dd8eb=_0xa5b4e5,_0x2ce2b7=_0x124810[_0x1c4b05],{sheetTransform:_0x131be1,transform:_0x2d34df,anchorType:anchorType=SheetDrawingAnchorType['Position']}=_0x2ce2b7;if(_0x131be1==null||_0x2d34df==null)return;let _0x43b954,_0x407606;if(_0x21b91f===_0x5dd8eb(0x2fe)){const _0xd0496f=this[_0x5dd8eb(0x38b)](_0x131be1,_0x2d34df,_0x334122,_0x408b9a,anchorType);_0x43b954=_0xd0496f==null?void 0x0:_0xd0496f[_0x5dd8eb(0x2af)],_0x407606=_0xd0496f==null?void 0x0:_0xd0496f[_0x5dd8eb(0x26c)];}else{const {from:_0x32ed8e,to:_0x258248}=_0x131be1,{column:_0xfb7ab2}=_0x32ed8e,{column:_0x3d3958}=_0x258248;if(anchorType===SheetDrawingAnchorType[_0x5dd8eb(0x341)]&&_0xfb7ab2>=_0x334122&&_0x3d3958<=_0x408b9a)_0x1e3101[_0x5dd8eb(0x1dd)]({'unitId':_0x94dbba,'subUnitId':_0x49cd57,'drawingId':_0x1c4b05});else{const _0x55d9de=this[_0x5dd8eb(0x231)](_0x131be1,_0x2d34df,_0x334122,_0x408b9a,anchorType);_0x43b954=_0x55d9de==null?void 0x0:_0x55d9de[_0x5dd8eb(0x2af)],_0x407606=_0x55d9de==null?void 0x0:_0x55d9de[_0x5dd8eb(0x26c)];}}if(!_0x43b954||!_0x407606)return;const _0x359011={'unitId':_0x94dbba,'subUnitId':_0x49cd57,'drawingId':_0x1c4b05,'transform':_0x407606,'sheetTransform':_0x43b954};_0x2409b3['push'](_0x359011);}),_0x2409b3['length']===0x0&&_0x1e3101[_0xa5b4e5(0x307)]===0x0)return{'redos':[],'undos':[]};if(_0x2409b3[_0xa5b4e5(0x307)]>0x0){const _0x157fe9=this[_0xa5b4e5(0x2cb)][_0xa5b4e5(0x255)](_0x2409b3),{undo:_0x428c95,redo:_0x103222,objects:_0x40ff1e}=_0x157fe9;_0x2cd968[_0xa5b4e5(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x94dbba,'subUnitId':_0x49cd57,'op':_0x103222,'objects':_0x40ff1e,'type':DrawingApplyType[_0xa5b4e5(0x1cd)]}}),_0x59134a[_0xa5b4e5(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x94dbba,'subUnitId':_0x49cd57,'op':_0x428c95,'objects':_0x40ff1e,'type':DrawingApplyType[_0xa5b4e5(0x1cd)]}});}if(_0x1e3101[_0xa5b4e5(0x307)]>0x0){const _0x57897e=this[_0xa5b4e5(0x2cb)][_0xa5b4e5(0x1ea)](_0x1e3101),_0x3d655e=_0x57897e[_0xa5b4e5(0x28b)],_0x15073d=_0x57897e['redo'],_0x5bc383=_0x57897e[_0xa5b4e5(0x1d9)];_0x2cd968[_0xa5b4e5(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x94dbba,'subUnitId':_0x49cd57,'op':_0x15073d,'objects':_0x5bc383,'type':DrawingApplyType[_0xa5b4e5(0x331)]}}),_0x59134a[_0xa5b4e5(0x1dd)]({'id':SetDrawingApplyMutation['id'],'params':{'unitId':_0x94dbba,'subUnitId':_0x49cd57,'op':_0x3d655e,'objects':_0x5bc383,'type':DrawingApplyType['INSERT']}});}return _0x2cd968[_0xa5b4e5(0x1dd)]({'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x94dbba]}),_0x59134a[_0xa5b4e5(0x1dd)]({'id':ClearSheetDrawingTransformerOperation['id'],'params':[_0x94dbba]}),{'redos':_0x2cd968,'undos':_0x59134a};}[_0x3d4902(0x38b)](_0x51e538,_0x507b7d,_0x15b86a,_0x2d7431,_0xda0c53=SheetDrawingAnchorType[_0x3d4902(0x352)]){const _0x3d60f5=_0x3d4902,_0x3244b8=_0x2d7431-_0x15b86a+0x1,{from:_0x2cf4ad,to:_0x27b3b0}=_0x51e538,{column:_0x15b474}=_0x2cf4ad,{column:_0x51318a}=_0x27b3b0;if(_0xda0c53===SheetDrawingAnchorType[_0x3d60f5(0x37d)])return{'newSheetTransform':transformToDrawingPosition({..._0x507b7d},this[_0x3d60f5(0x36b)]),'newTransform':_0x507b7d};let _0x53ee0f=null,_0x56b00e=null;if(_0x15b474>=_0x15b86a){const _0x14a10c=this[_0x3d60f5(0x2d4)][_0x3d60f5(0x366)]({'startColumn':_0x15b86a,'endColumn':_0x2d7431,'startRow':_0x2cf4ad[_0x3d60f5(0x1ed)],'endRow':_0x27b3b0['row']});if(_0x14a10c==null)return;_0x56b00e={..._0x507b7d,'left':(_0x507b7d[_0x3d60f5(0x242)]||0x0)+_0x14a10c[_0x3d60f5(0x295)]-_0x14a10c['startX']},_0x53ee0f=transformToDrawingPosition(_0x56b00e,this[_0x3d60f5(0x36b)]);}else{if(_0x51318a>=_0x2d7431){if(_0xda0c53===SheetDrawingAnchorType['Both'])_0x53ee0f={'from':{..._0x2cf4ad},'to':{..._0x27b3b0,'column':_0x51318a+_0x3244b8}},_0x56b00e=drawingPositionToTransform(_0x53ee0f,this['_selectionRenderService'],this['_skeletonManagerService']);else return{'newSheetTransform':transformToDrawingPosition({..._0x507b7d},this[_0x3d60f5(0x36b)]),'newTransform':_0x507b7d};}}return _0x53ee0f!=null&&_0x56b00e!=null?{'newSheetTransform':_0x53ee0f,'newTransform':_0x56b00e}:null;}[_0x3d4902(0x231)](_0x4d0ccd,_0x74134d,_0x4e1e41,_0x46f034,_0x6ad34c=SheetDrawingAnchorType[_0x3d4902(0x352)]){const _0x2aee4f=_0x3d4902,_0x3ae7e3=_0x46f034-_0x4e1e41+0x1,{from:_0x421432,to:_0x35b128}=_0x4d0ccd,{column:_0x213b65}=_0x421432,{column:_0x428dfe}=_0x35b128;if(_0x6ad34c===SheetDrawingAnchorType[_0x2aee4f(0x37d)])return{'newSheetTransform':transformToDrawingPosition({..._0x74134d},this[_0x2aee4f(0x36b)]),'newTransform':_0x74134d};let _0x48637c=null,_0x4b136c=null;if(_0x213b65>_0x46f034)_0x48637c={'from':{..._0x421432,'column':_0x213b65-_0x3ae7e3},'to':{..._0x35b128,'column':_0x428dfe-_0x3ae7e3}},_0x4b136c=drawingPositionToTransform(_0x48637c,this[_0x2aee4f(0x36b)],this[_0x2aee4f(0x2d4)]);else{if(_0x213b65>=_0x4e1e41&&_0x428dfe<=_0x46f034)return null;if(_0x213b65<_0x4e1e41&&_0x428dfe>_0x46f034){if(_0x6ad34c===SheetDrawingAnchorType[_0x2aee4f(0x341)])_0x48637c={'from':{..._0x421432},'to':{..._0x35b128,'column':_0x428dfe-_0x3ae7e3}},_0x4b136c=drawingPositionToTransform(_0x48637c,this[_0x2aee4f(0x36b)],this[_0x2aee4f(0x2d4)]);else return{'newSheetTransform':transformToDrawingPosition({..._0x74134d},this[_0x2aee4f(0x36b)]),'newTransform':_0x74134d};}else{if(_0x213b65>=_0x4e1e41&&_0x213b65<=_0x46f034){if(_0x213b65===_0x4e1e41)_0x4b136c={..._0x74134d,'left':(_0x74134d[_0x2aee4f(0x242)]||0x0)-_0x4d0ccd['from']['columnOffset']};else{const _0x18f595=this[_0x2aee4f(0x2d4)][_0x2aee4f(0x366)]({'startColumn':_0x4e1e41,'endColumn':_0x213b65-0x1,'startRow':_0x421432[_0x2aee4f(0x1ed)],'endRow':_0x35b128['row']});if(_0x18f595==null)return;_0x4b136c={..._0x74134d,'left':(_0x74134d[_0x2aee4f(0x242)]||0x0)-_0x18f595[_0x2aee4f(0x295)]+_0x18f595[_0x2aee4f(0x36e)]-_0x4d0ccd['from'][_0x2aee4f(0x309)]};}_0x48637c=transformToDrawingPosition(_0x4b136c,this[_0x2aee4f(0x36b)]);}else{if(_0x428dfe>=_0x4e1e41&&_0x428dfe<=_0x46f034&&_0x6ad34c===SheetDrawingAnchorType[_0x2aee4f(0x341)]){const _0x110ecf=this['_skeletonManagerService'][_0x2aee4f(0x366)]({'startColumn':_0x4e1e41-0x1,'endColumn':_0x4e1e41-0x1,'startRow':_0x421432[_0x2aee4f(0x1ed)],'endRow':_0x35b128[_0x2aee4f(0x1ed)]});if(_0x110ecf==null)return;_0x48637c={'from':{..._0x421432},'to':{..._0x35b128,'column':_0x4e1e41-0x1,'columnOffset':_0x110ecf[_0x2aee4f(0x295)]-_0x110ecf[_0x2aee4f(0x36e)]}},_0x4b136c=drawingPositionToTransform(_0x48637c,this[_0x2aee4f(0x36b)],this[_0x2aee4f(0x2d4)]);}}}}return _0x48637c!=null&&_0x4b136c!=null?{'newSheetTransform':_0x48637c,'newTransform':_0x4b136c}:null;}[_0x3d4902(0x26d)](_0x3b42a9,_0x19d37b,_0x3f1e24,_0x5b2417,_0xa17e16=SheetDrawingAnchorType[_0x3d4902(0x352)]){const _0x583cd0=_0x3d4902,_0x4437f5=_0x5b2417-_0x3f1e24+0x1,{from:_0x178743,to:_0x3ef237}=_0x3b42a9,{row:_0x5789a5}=_0x178743,{row:_0x2d3650}=_0x3ef237;if(_0xa17e16===SheetDrawingAnchorType[_0x583cd0(0x37d)])return{'newSheetTransform':transformToDrawingPosition({..._0x19d37b},this[_0x583cd0(0x36b)]),'newTransform':_0x19d37b};let _0x28b61f=null,_0x1e1245=null;if(_0x5789a5>=_0x3f1e24){const _0x33a346=this['_skeletonManagerService'][_0x583cd0(0x366)]({'startRow':_0x3f1e24,'endRow':_0x5b2417,'startColumn':_0x178743['column'],'endColumn':_0x3ef237[_0x583cd0(0x2ad)]});if(_0x33a346==null)return;_0x1e1245={..._0x19d37b,'top':(_0x19d37b[_0x583cd0(0x326)]||0x0)+_0x33a346[_0x583cd0(0x204)]-_0x33a346[_0x583cd0(0x34b)]},_0x28b61f=transformToDrawingPosition(_0x1e1245,this[_0x583cd0(0x36b)]);}else{if(_0x2d3650>=_0x5b2417){if(_0xa17e16===SheetDrawingAnchorType[_0x583cd0(0x341)])_0x28b61f={'from':{..._0x178743},'to':{..._0x3ef237,'row':_0x2d3650+_0x4437f5}},_0x1e1245=drawingPositionToTransform(_0x28b61f,this[_0x583cd0(0x36b)],this[_0x583cd0(0x2d4)]);else return{'newSheetTransform':transformToDrawingPosition({..._0x19d37b},this['_selectionRenderService']),'newTransform':_0x19d37b};}}return _0x28b61f!=null&&_0x1e1245!=null?{'newSheetTransform':_0x28b61f,'newTransform':_0x1e1245}:null;}[_0x3d4902(0x226)](_0x24c326,_0x1dc7cb,_0x41b9f0,_0x16d76b,_0x42c820=SheetDrawingAnchorType['Position']){const _0x2c5ca6=_0x3d4902,_0xaed8c0=_0x16d76b-_0x41b9f0+0x1,{from:_0x5707fa,to:_0x53a73b}=_0x24c326,{row:_0x4c4838}=_0x5707fa,{row:_0x17460}=_0x53a73b;if(_0x42c820===SheetDrawingAnchorType[_0x2c5ca6(0x37d)])return{'newSheetTransform':transformToDrawingPosition({..._0x1dc7cb},this[_0x2c5ca6(0x36b)]),'newTransform':_0x1dc7cb};let _0x3ab1ba=null,_0x357433=null;if(_0x4c4838>_0x16d76b)_0x3ab1ba={'from':{..._0x5707fa,'row':_0x4c4838-_0xaed8c0},'to':{..._0x53a73b,'row':_0x17460-_0xaed8c0}},_0x357433=drawingPositionToTransform(_0x3ab1ba,this['_selectionRenderService'],this['_skeletonManagerService']);else{if(_0x4c4838>=_0x41b9f0&&_0x17460<=_0x16d76b)return null;if(_0x4c4838<_0x41b9f0&&_0x17460>_0x16d76b){if(_0x42c820===SheetDrawingAnchorType[_0x2c5ca6(0x341)])_0x3ab1ba={'from':{..._0x5707fa},'to':{..._0x53a73b,'row':_0x17460-_0xaed8c0}},_0x357433=drawingPositionToTransform(_0x3ab1ba,this['_selectionRenderService'],this['_skeletonManagerService']);else return{'newSheetTransform':transformToDrawingPosition({..._0x1dc7cb},this[_0x2c5ca6(0x36b)]),'newTransform':_0x1dc7cb};}else{if(_0x4c4838>=_0x41b9f0&&_0x4c4838<=_0x16d76b){if(_0x4c4838===_0x41b9f0)_0x357433={..._0x1dc7cb,'top':(_0x1dc7cb[_0x2c5ca6(0x326)]||0x0)-_0x24c326[_0x2c5ca6(0x237)]['rowOffset']};else{const _0x1a601c=this[_0x2c5ca6(0x2d4)][_0x2c5ca6(0x366)]({'startRow':_0x41b9f0,'endRow':_0x4c4838-0x1,'startColumn':_0x5707fa[_0x2c5ca6(0x2ad)],'endColumn':_0x53a73b[_0x2c5ca6(0x2ad)]});if(_0x1a601c==null)return;_0x357433={..._0x1dc7cb,'top':(_0x1dc7cb[_0x2c5ca6(0x326)]||0x0)-_0x1a601c[_0x2c5ca6(0x204)]+_0x1a601c[_0x2c5ca6(0x34b)]-_0x24c326[_0x2c5ca6(0x237)][_0x2c5ca6(0x289)]};}_0x3ab1ba=transformToDrawingPosition(_0x357433,this['_selectionRenderService']);}else{if(_0x17460>=_0x41b9f0&&_0x17460<=_0x16d76b&&_0x42c820===SheetDrawingAnchorType[_0x2c5ca6(0x341)]){const _0x16757a=this['_skeletonManagerService'][_0x2c5ca6(0x366)]({'startColumn':_0x5707fa[_0x2c5ca6(0x2ad)],'endColumn':_0x5707fa[_0x2c5ca6(0x2ad)],'startRow':_0x41b9f0-0x1,'endRow':_0x41b9f0-0x1});if(_0x16757a==null)return;_0x3ab1ba={'from':{..._0x5707fa},'to':{..._0x53a73b,'row':_0x41b9f0-0x1,'rowOffset':_0x16757a['endY']-_0x16757a[_0x2c5ca6(0x34b)]}},_0x357433=drawingPositionToTransform(_0x3ab1ba,this[_0x2c5ca6(0x36b)],this[_0x2c5ca6(0x2d4)]);}}}}return _0x3ab1ba!=null&&_0x357433!=null?{'newSheetTransform':_0x3ab1ba,'newTransform':_0x357433}:null;}[_0x3d4902(0x35f)](){const _0x5190b6=_0x3d4902;this[_0x5190b6(0x26e)](this[_0x5190b6(0x208)]['onCommandExecuted'](_0x1018d=>{_0x1018d['id']===SetWorksheetActiveOperation['id']&&setTimeout(()=>{const _0x51e00b=_0x42a1,_0x19ed86=_0x1018d[_0x51e00b(0x280)],{unitId:_0x292871,subUnitId:_0x42eb89}=_0x19ed86,_0x9b29e8=this[_0x51e00b(0x1bd)][_0x51e00b(0x1f0)],_0xdc37c3=[],_0x438377=[];Object[_0x51e00b(0x384)](_0x9b29e8)[_0x51e00b(0x23c)](_0x27def8=>{const _0x1261fc=_0x51e00b,_0xd56554=_0x9b29e8[_0x27def8];_0xd56554!=null&&Object[_0x1261fc(0x384)](_0xd56554)[_0x1261fc(0x23c)](_0x18850e=>{const _0x31df0e=_0x1261fc,_0x330a5a=_0xd56554[_0x18850e][_0x31df0e(0x34d)];_0x330a5a!=null&&Object[_0x31df0e(0x384)](_0x330a5a)['forEach'](_0xe91552=>{const _0x188234=_0x31df0e;if(_0x27def8===_0x292871&&_0x18850e===_0x42eb89){const _0x5b1d8f=_0x330a5a[_0xe91552];_0x5b1d8f[_0x188234(0x32e)]=drawingPositionToTransform(_0x5b1d8f[_0x188234(0x2a0)],this['_selectionRenderService'],this[_0x188234(0x2d4)]),_0xdc37c3['push'](_0x330a5a[_0xe91552]);}else _0x438377[_0x188234(0x1dd)](_0x330a5a[_0xe91552]);});});}),this[_0x51e00b(0x1bd)][_0x51e00b(0x1f8)](_0x438377),this[_0x51e00b(0x1bd)][_0x51e00b(0x36c)](_0xdc37c3);},0x0);}));}['_sheetRefreshListener'](){const _0x3fc302=_0x3d4902;this['disposeWithMe'](this[_0x3fc302(0x208)][_0x3fc302(0x299)](_0x481151=>{REFRESH_MUTATIONS['includes'](_0x481151['id'])&&requestIdleCallback(()=>{const _0x1c5f54=_0x42a1,_0x4c5a59=_0x481151[_0x1c5f54(0x280)],{unitId:_0x39fe28,subUnitId:_0x56c263,ranges:_0x43f3e9}=_0x4c5a59;this[_0x1c5f54(0x2b5)](_0x39fe28,_0x56c263,_0x43f3e9);});}));}[_0x3d4902(0x2b5)](_0x3bff8f,_0x1311b8,_0x12a2d5){const _0x4c7312=_0x3d4902,_0x5d4bbe=this[_0x4c7312(0x1bd)][_0x4c7312(0x257)](_0x3bff8f,_0x1311b8),_0x225582=[];Object[_0x4c7312(0x384)](_0x5d4bbe)[_0x4c7312(0x23c)](_0x42e7ec=>{const _0xde1c9d=_0x4c7312,_0xfda4f6=_0x5d4bbe[_0x42e7ec],{sheetTransform:_0x85f874,transform:_0x277e0f,anchorType:anchorType=SheetDrawingAnchorType[_0xde1c9d(0x352)]}=_0xfda4f6;if(anchorType===SheetDrawingAnchorType[_0xde1c9d(0x37d)])return!0x0;const {from:_0x34e523,to:_0xa87a14}=_0x85f874,{row:_0x2b09d5,column:_0x28ab96}=_0x34e523,{row:_0x3cbff4,column:_0x40ab4c}=_0xa87a14;for(let _0x145fac=0x0;_0x145fac<_0x12a2d5[_0xde1c9d(0x307)];_0x145fac++){const _0x4914ba=_0x12a2d5[_0x145fac],{startRow:_0x43428e,endRow:_0x313bd6,startColumn:_0x5cc201,endColumn:_0x111a0f}=_0x4914ba;if(Rectangle[_0xde1c9d(0x30c)]({'startRow':_0x43428e,'endRow':_0x313bd6,'startColumn':_0x5cc201,'endColumn':_0x111a0f},{'startRow':_0x2b09d5,'endRow':_0x3cbff4,'startColumn':_0x28ab96,'endColumn':_0x40ab4c})||_0x2b09d5>_0x313bd6||_0x28ab96>_0x111a0f){const _0x1461c5=anchorType===SheetDrawingAnchorType[_0xde1c9d(0x352)],_0x1c6674=drawingPositionToTransform(_0x85f874,this[_0xde1c9d(0x36b)],this[_0xde1c9d(0x2d4)]);_0x225582[_0xde1c9d(0x1dd)]({..._0xfda4f6,'transform':{..._0x1c6674,'width':_0x1461c5?_0x277e0f==null?void 0x0:_0x277e0f[_0xde1c9d(0x259)]:_0x1c6674==null?void 0x0:_0x1c6674[_0xde1c9d(0x259)],'height':_0x1461c5?_0x277e0f==null?void 0x0:_0x277e0f['height']:_0x1c6674==null?void 0x0:_0x1c6674[_0xde1c9d(0x241)]}});break;}}}),_0x225582[_0x4c7312(0x307)]!==0x0&&(this['_drawingManagerService'][_0x4c7312(0x294)](_0x225582),this[_0x4c7312(0x208)]['syncExecuteCommand'](ClearSheetDrawingTransformerOperation['id'],[_0x3bff8f]));}},__name(_a8,_0x3d4902(0x286)),_a8);SheetDrawingTransformAffectedController=__decorateClass$2([__decorateParam$2(0x1,IRenderManagerService),__decorateParam$2(0x2,ICommandService),__decorateParam$2(0x3,ISheetSelectionRenderService),__decorateParam$2(0x4,Inject(SheetSkeletonManagerService)),__decorateParam$2(0x5,Inject(SheetInterceptorService)),__decorateParam$2(0x6,ISheetDrawingService),__decorateParam$2(0x7,IDrawingManagerService),__decorateParam$2(0x8,IUniverInstanceService)],SheetDrawingTransformAffectedController);var __defProp$1=Object[_0x3d4902(0x1c5)],__getOwnPropDesc$1=Object['getOwnPropertyDescriptor'],__decorateClass$1=__name((_0x43b065,_0x2420b4,_0xfc3d86,_0x556825)=>{const _0x554c21=_0x3d4902;for(var _0x30708e=_0x556825>0x1?void 0x0:_0x556825?__getOwnPropDesc$1(_0x2420b4,_0xfc3d86):_0x2420b4,_0x49040c=_0x43b065[_0x554c21(0x307)]-0x1,_0x15cf2f;_0x49040c>=0x0;_0x49040c--)(_0x15cf2f=_0x43b065[_0x49040c])&&(_0x30708e=(_0x556825?_0x15cf2f(_0x2420b4,_0xfc3d86,_0x30708e):_0x15cf2f(_0x30708e))||_0x30708e);return _0x556825&&_0x30708e&&__defProp$1(_0x2420b4,_0xfc3d86,_0x30708e),_0x30708e;},_0x3d4902(0x1df)),__decorateParam$1=__name((_0x2ec25d,_0x5e6cb9)=>(_0x465450,_0x15785c)=>_0x5e6cb9(_0x465450,_0x15785c,_0x2ec25d),_0x3d4902(0x353));function transformBound2DOMBound(_0x117ff5,_0x1941c7,_0x5b418f,_0x2cfd31){const _0x84aa1e=_0x3d4902,{scaleX:_0x4dfae4,scaleY:_0x59b154}=_0x1941c7['getAncestorScale'](),_0x535605=_0x1941c7[_0x84aa1e(0x239)](SHEET_VIEWPORT_KEY[_0x84aa1e(0x37f)]),_0x5edb4e={'left':!0x0,'top':!0x0};if(!_0x535605)return{..._0x117ff5,'absolute':_0x5edb4e};const {left:_0x48bf01,right:_0x4783d2,top:_0x49f9c6,bottom:_0x45b23d}=_0x117ff5,_0x2f9692=_0x2cfd31[_0x84aa1e(0x2ea)](),{startColumn:_0x5af3c6,startRow:_0x3a2139,xSplit:_0x22d551,ySplit:_0x286332}=_0x2f9692,_0x2f8403=_0x5b418f[_0x84aa1e(0x281)](_0x3a2139-_0x286332,_0x5af3c6-_0x22d551),_0x181f57=_0x5b418f[_0x84aa1e(0x281)](_0x3a2139,_0x5af3c6),{rowHeaderWidth:_0x23e623,columnHeaderHeight:_0x2653ef}=_0x5b418f,_0x113c26=_0x181f57[_0x84aa1e(0x36e)]-_0x2f8403[_0x84aa1e(0x36e)],_0x360223=_0x181f57[_0x84aa1e(0x34b)]-_0x2f8403[_0x84aa1e(0x34b)],{top:_0x4d4bb3,left:_0x5cb8be,viewportScrollX:_0x253d1f,viewportScrollY:_0xe2c04}=_0x535605;let _0x463d7e,_0x4e54e8;_0x48bf01<_0x5cb8be?(_0x5edb4e['left']=!0x0,_0x463d7e=(_0x113c26+_0x23e623+(_0x48bf01-_0x5cb8be))*_0x4dfae4,_0x4e54e8=Math[_0x84aa1e(0x211)](Math['min']((_0x113c26+_0x23e623+(_0x4783d2-_0x5cb8be))*_0x4dfae4,(_0x113c26+_0x23e623)*_0x4dfae4),(_0x4783d2-_0x253d1f)*_0x4dfae4)):(_0x5edb4e[_0x84aa1e(0x242)]=!0x1,_0x463d7e=Math[_0x84aa1e(0x211)]((_0x48bf01-_0x253d1f)*_0x4dfae4,(_0x113c26+_0x23e623)*_0x4dfae4),_0x4e54e8=Math['max']((_0x4783d2-_0x253d1f)*_0x4dfae4,(_0x113c26+_0x23e623)*_0x4dfae4));let _0x3c2d94,_0x5c2b21;return _0x49f9c6<_0x4d4bb3?(_0x5edb4e[_0x84aa1e(0x326)]=!0x0,_0x3c2d94=(_0x360223+_0x2653ef+(_0x49f9c6-_0x4d4bb3))*_0x59b154,_0x5c2b21=Math[_0x84aa1e(0x211)](Math[_0x84aa1e(0x21f)]((_0x360223+_0x2653ef+(_0x4783d2-_0x4d4bb3))*_0x59b154,(_0x360223+_0x2653ef)*_0x59b154),(_0x45b23d-_0xe2c04)*_0x59b154)):(_0x5edb4e[_0x84aa1e(0x326)]=!0x1,_0x3c2d94=Math[_0x84aa1e(0x211)]((_0x49f9c6-_0xe2c04)*_0x59b154,(_0x360223+_0x2653ef)*_0x59b154),_0x5c2b21=Math[_0x84aa1e(0x211)]((_0x45b23d-_0xe2c04)*_0x59b154,(_0x360223+_0x2653ef)*_0x59b154)),{'left':_0x463d7e,'right':_0x4e54e8,'top':_0x3c2d94,'bottom':_0x5c2b21,'absolute':_0x5edb4e};}__name(transformBound2DOMBound,_0x3d4902(0x275));const calcPosition=__name((_0x263e1c,_0x616a32,_0x2909d2,_0x377d56)=>{const _0x3a240f=_0x3d4902,{scene:_0x17632a}=_0x616a32,{left:_0x15abd7,top:_0x53e5ef,width:_0x26e0e7,height:_0x22c821,angle:_0xf83e5a}=_0x263e1c,_0x3aedf8={'left':_0x15abd7,'right':_0x15abd7+_0x26e0e7,'top':_0x53e5ef,'bottom':_0x53e5ef+_0x22c821},_0x49478f=transformBound2DOMBound(_0x3aedf8,_0x17632a,_0x2909d2,_0x377d56),{scaleX:_0x176533,scaleY:_0x254794}=_0x17632a[_0x3a240f(0x367)]();return{'startX':_0x49478f[_0x3a240f(0x242)],'endX':_0x49478f['right'],'startY':_0x49478f['top'],'endY':_0x49478f['bottom'],'rotate':_0xf83e5a,'width':_0x26e0e7*_0x176533,'height':_0x22c821*_0x254794,'absolute':_0x49478f[_0x3a240f(0x1f9)]};},_0x3d4902(0x1e7));var _a9;let SheetCanvasFloatDomManagerService=(_a9=class extends Disposable{constructor(_0x150930,_0x3c28d9,_0x33c7c4,_0x2b7c70,_0x3b3608,_0x3203c8){const _0x10808b=_0x3d4902;super(),__publicField(this,'_domLayerMap',new Map()),__publicField(this,_0x10808b(0x230),new Map()),__publicField(this,_0x10808b(0x1f6),new Subject()),__publicField(this,_0x10808b(0x2d1),this[_0x10808b(0x1f6)][_0x10808b(0x31b)]()),__publicField(this,_0x10808b(0x20a),new Subject()),__publicField(this,_0x10808b(0x22f),this['_remove$'][_0x10808b(0x31b)]()),__publicField(this,_0x10808b(0x347),[]),(this[_0x10808b(0x2ef)]=_0x150930,this[_0x10808b(0x2b7)]=_0x3c28d9,this[_0x10808b(0x208)]=_0x33c7c4,this[_0x10808b(0x1bd)]=_0x2b7c70,this[_0x10808b(0x267)]=_0x3b3608,this[_0x10808b(0x2cb)]=_0x3203c8,this['_drawingAddListener'](),this[_0x10808b(0x2ce)](),this['_featureUpdateListener'](),this[_0x10808b(0x318)]());}['_ensureMap'](_0x31f462,_0x367117){const _0x42a220=_0x3d4902;let _0x48bb73=this[_0x42a220(0x393)][_0x42a220(0x2c8)](_0x31f462);_0x48bb73||(_0x48bb73=new Map(),this[_0x42a220(0x393)][_0x42a220(0x2b1)](_0x31f462,_0x48bb73));let _0x2bd1f4=_0x48bb73[_0x42a220(0x2c8)](_0x367117);return _0x2bd1f4||(_0x2bd1f4=new Map(),_0x48bb73[_0x42a220(0x2b1)](_0x367117,_0x2bd1f4)),_0x2bd1f4;}[_0x3d4902(0x2da)](_0x559e4e){const _0x1e918e=_0x3d4902;if(_0x559e4e==null)return;const _0x4db5a2=this[_0x1e918e(0x2ef)]['getRenderById'](_0x559e4e),_0xc5ed56=_0x4db5a2==null?void 0x0:_0x4db5a2[_0x1e918e(0x34f)];if(_0x4db5a2==null||_0xc5ed56==null)return null;const _0x1f7fec=_0xc5ed56[_0x1e918e(0x301)](),_0xa5b95c=_0x4db5a2[_0x1e918e(0x2ff)]['getCanvasElement']();return{'scene':_0xc5ed56,'transformer':_0x1f7fec,'renderObject':_0x4db5a2,'canvas':_0xa5b95c};}[_0x3d4902(0x284)](_0x328a53){const _0xd2c5cb=_0x3d4902;let _0x5a8838;return this[_0xd2c5cb(0x347)][_0xd2c5cb(0x23c)](_0x53fa0a=>{_0x5a8838=_0x53fa0a['onGetFloatDomProps'](_0x328a53);}),_0x5a8838;}[_0x3d4902(0x2db)](){const _0x4decf3=_0x3d4902;this[_0x4decf3(0x26e)](this['_drawingManagerService'][_0x4decf3(0x25e)][_0x4decf3(0x2c2)](_0x53eb91=>{const _0x328237=_0x4decf3;_0x53eb91[_0x328237(0x23c)](_0x1cacb4=>{const _0x52478f=_0x328237;var _0x27cf61,_0x43f8b3,_0x2799fa;const {unitId:_0x3e69a8,subUnitId:_0x7d08b,drawingId:_0x368c15}=_0x1cacb4,_0x2dd0ac=getSheetCommandTarget(this[_0x52478f(0x2b7)],{'unitId':_0x3e69a8,'subUnitId':_0x7d08b}),_0x5846e2=this[_0x52478f(0x1bd)][_0x52478f(0x1fc)](_0x1cacb4);if(!_0x5846e2||!_0x2dd0ac)return;const _0x4c18a7=(_0x27cf61=this[_0x52478f(0x2ef)][_0x52478f(0x200)](_0x3e69a8))==null?void 0x0:_0x27cf61[_0x52478f(0x1f7)](SheetSkeletonManagerService)[_0x52478f(0x395)](_0x7d08b);if(!_0x4c18a7)return;const {transform:_0x4b29f2,drawingType:_0x147ca1,data:_0x8cf4fb}=_0x5846e2;if(_0x147ca1!==_0x4c08d0[_0x52478f(0x26f)])return;const _0x3a6403=this[_0x52478f(0x2da)](_0x3e69a8);if(_0x3a6403==null)return;const {scene:_0x11c134,canvas:_0x1978c8}=_0x3a6403;if(_0x4b29f2==null)return!0x0;const {left:_0x11a90e,top:_0x1c0720,width:_0x3dd134,height:_0x7f6789,angle:_0x2c3e78,flipX:_0x91067,flipY:_0x2f9319,skewX:_0x2934a4,skewY:_0x1d265f}=_0x4b29f2,_0x30196f=getDrawingShapeKeyByDrawingSearch({'unitId':_0x3e69a8,'subUnitId':_0x7d08b,'drawingId':_0x368c15}),_0x581625=_0x11c134[_0x52478f(0x292)](_0x30196f);if(_0x581625!=null){_0x581625[_0x52478f(0x325)]({'left':_0x11a90e,'top':_0x1c0720,'width':_0x3dd134,'height':_0x7f6789,'angle':_0x2c3e78,'flipX':_0x91067,'flipY':_0x2f9319,'skewX':_0x2934a4,'skewY':_0x1d265f});return;}const _0x1d712c={'left':_0x11a90e,'top':_0x1c0720,'width':_0x3dd134,'height':_0x7f6789,'zIndex':this[_0x52478f(0x1bd)][_0x52478f(0x29c)](_0x3e69a8,_0x7d08b)[_0x52478f(0x307)]-0x1},_0xda30c9=new Rect(_0x30196f,_0x1d712c);_0x11c134['addObject'](_0xda30c9,DRAWING_OBJECT_LAYER_INDEX),_0x5846e2[_0x52478f(0x1c0)]!==!0x1&&_0x11c134[_0x52478f(0x23b)](_0xda30c9);const _0x48fa72=this[_0x52478f(0x330)](_0x3e69a8,_0x7d08b),_0x5659b0=new DisposableCollection(),_0x25e891=calcPosition(_0xda30c9,_0x3a6403[_0x52478f(0x2cd)],_0x4c18a7[_0x52478f(0x300)],_0x2dd0ac[_0x52478f(0x2e8)]),_0x42e3c4=new BehaviorSubject(_0x25e891),_0x2a8498={'dispose':_0x5659b0,'rect':_0xda30c9,'position$':_0x42e3c4,'unitId':_0x3e69a8,'subUnitId':_0x7d08b};this['_canvasFloatDomService'][_0x52478f(0x31a)]({'position$':_0x42e3c4,'id':_0x368c15,'componentKey':_0x5846e2['componentKey'],'onPointerDown':__name(_0x14d56a=>{const _0x52ca4a=_0x52478f;_0x1978c8[_0x52ca4a(0x357)](new PointerEvent(_0x14d56a[_0x52ca4a(0x33d)],_0x14d56a));},_0x52478f(0x2bc)),'onPointerMove':__name(_0x566dd1=>{const _0x57d9c8=_0x52478f;_0x1978c8[_0x57d9c8(0x357)](new PointerEvent(_0x566dd1['type'],_0x566dd1));},_0x52478f(0x215)),'onPointerUp':__name(_0x1464a3=>{const _0x41380e=_0x52478f;_0x1978c8[_0x41380e(0x357)](new PointerEvent(_0x1464a3[_0x41380e(0x33d)],_0x1464a3));},_0x52478f(0x274)),'onWheel':__name(_0x1a136c=>{const _0x2c2c27=_0x52478f;_0x1978c8[_0x2c2c27(0x357)](new WheelEvent(_0x1a136c[_0x2c2c27(0x33d)],_0x1a136c));},_0x52478f(0x382)),'props':(_0x2799fa=(_0x43f8b3=_0x48fa72[_0x52478f(0x2c8)](_0x368c15))==null?void 0x0:_0x43f8b3['props'])!=null?_0x2799fa:this[_0x52478f(0x284)](_0x368c15),'data':_0x8cf4fb,'unitId':_0x3e69a8});const _0x2f4635=_0xda30c9[_0x52478f(0x238)][_0x52478f(0x297)](()=>{const _0x4fcb83=_0x52478f,_0x11fa7d=calcPosition(_0xda30c9,_0x3a6403['renderObject'],_0x4c18a7[_0x4fcb83(0x300)],_0x2dd0ac[_0x4fcb83(0x2e8)]);_0x42e3c4[_0x4fcb83(0x24f)](_0x11fa7d);});_0x5659b0[_0x52478f(0x344)](()=>{const _0x455608=_0x52478f;this['_canvasFloatDomService'][_0x455608(0x305)](_0x368c15);}),_0x2f4635&&_0x5659b0[_0x52478f(0x344)](_0x2f4635),this[_0x52478f(0x230)][_0x52478f(0x2b1)](_0x368c15,_0x2a8498),_0x48fa72['set'](_0x368c15,{..._0x48fa72[_0x52478f(0x2c8)](_0x368c15)});});}));}[_0x3d4902(0x2ce)](){const _0x3337e9=_0x3d4902;this['disposeWithMe'](this[_0x3337e9(0x208)][_0x3337e9(0x299)](_0x50950b=>{const _0x155fc0=_0x3337e9;var _0x3b9802,_0x14fdbe;const _0x53eb8f=__name((_0x3dbf18,_0x5c590a)=>{const _0x32479c=_0x42a1;var _0x5b82ef;const _0x31a1ef=this[_0x32479c(0x2da)](_0x3dbf18),_0x1b801c=this[_0x32479c(0x330)](_0x3dbf18,_0x5c590a),_0x5bb8a9=Array[_0x32479c(0x237)](_0x1b801c[_0x32479c(0x384)]()),_0x4f91c3=getSheetCommandTarget(this['_univerInstanceService'],{'unitId':_0x3dbf18,'subUnitId':_0x5c590a}),_0x9d53b4=(_0x5b82ef=this[_0x32479c(0x2ef)]['getRenderById'](_0x3dbf18))==null?void 0x0:_0x5b82ef['with'](SheetSkeletonManagerService)[_0x32479c(0x395)](_0x5c590a);!_0x31a1ef||!_0x4f91c3||!_0x9d53b4||_0x5bb8a9['forEach'](_0x5a4d96=>{const _0x42188a=_0x32479c,_0x1d63b0=this[_0x42188a(0x230)][_0x42188a(0x2c8)](_0x5a4d96);if(_0x1d63b0){const _0x2002f7=calcPosition(_0x1d63b0[_0x42188a(0x2a5)],_0x31a1ef[_0x42188a(0x2cd)],_0x9d53b4[_0x42188a(0x300)],_0x4f91c3['worksheet']);_0x1d63b0['position$']['next'](_0x2002f7);}});},_0x155fc0(0x220));if(_0x50950b['id']===SetScrollOperation['id']){const _0x1f3ef4=_0x50950b[_0x155fc0(0x280)],{unitId:_0x5d8433,sheetId:_0xff3404}=_0x1f3ef4;_0x53eb8f(_0x5d8433,_0xff3404);}else{if(_0x50950b['id']===SetZoomRatioOperation['id']){const _0x1c468c=_0x50950b['params'],{unitId:_0x5e83fb}=_0x1c468c;Array[_0x155fc0(0x237)]((_0x14fdbe=(_0x3b9802=this[_0x155fc0(0x393)][_0x155fc0(0x2c8)](_0x5e83fb))==null?void 0x0:_0x3b9802[_0x155fc0(0x384)]())!=null?_0x14fdbe:[])[_0x155fc0(0x23c)](_0x4ba9cd=>{_0x53eb8f(_0x5e83fb,_0x4ba9cd);});}else{if(_0x50950b['id']===SetFrozenMutation['id']){const {unitId:_0x3008fa,subUnitId:_0x1131ec}=_0x50950b['params'];_0x53eb8f(_0x3008fa,_0x1131ec);}}}}));}['_getPosition'](_0x2763fa,_0x55befe){const _0x40bc6f=_0x3d4902;var _0x2ecf3b;const {startX:_0x52b732,endX:_0x2b746d,startY:_0x3bbe91,endY:_0x499587}=_0x2763fa,_0x47d66f=(_0x2ecf3b=this['_renderManagerService'][_0x40bc6f(0x200)](_0x55befe))==null?void 0x0:_0x2ecf3b['with'](ISheetSelectionRenderService);if(_0x47d66f==null)return;const _0x596493=_0x47d66f[_0x40bc6f(0x248)](_0x52b732,_0x3bbe91);if(_0x596493==null)return;const _0x43904e={'column':_0x596493[_0x40bc6f(0x2a9)],'columnOffset':_0x52b732-_0x596493[_0x40bc6f(0x36e)],'row':_0x596493[_0x40bc6f(0x29d)],'rowOffset':_0x3bbe91-_0x596493['startY']},_0x506574=_0x47d66f[_0x40bc6f(0x248)](_0x2b746d,_0x499587);if(_0x506574==null)return;const _0x42022e={'column':_0x506574[_0x40bc6f(0x2a9)],'columnOffset':_0x2b746d-_0x506574[_0x40bc6f(0x36e)],'row':_0x506574[_0x40bc6f(0x29d)],'rowOffset':_0x499587-_0x506574[_0x40bc6f(0x34b)]};return{'from':_0x43904e,'to':_0x42022e};}[_0x3d4902(0x2ba)](){const _0x1a1f94=_0x3d4902;this[_0x1a1f94(0x26e)](this[_0x1a1f94(0x1bd)][_0x1a1f94(0x385)][_0x1a1f94(0x2c2)](_0x38ea27=>{const _0x3671ac=_0x1a1f94;_0x38ea27[_0x3671ac(0x23c)](_0x330b71=>{const _0xb4abda=_0x3671ac,_0x244259=this[_0xb4abda(0x1bd)]['getDrawingByParam'](_0x330b71);if(!_0x244259||_0x244259['drawingType']!==_0x4c08d0['DRAWING_DOM'])return;const _0x5ef806={..._0x244259['transform']};this['_transformChange$'][_0xb4abda(0x24f)]({'id':_0x330b71[_0xb4abda(0x1be)],'value':_0x5ef806});});}));}['_deleteListener'](){const _0x39223c=_0x3d4902;this[_0x39223c(0x26e)](this[_0x39223c(0x1bd)][_0x39223c(0x22f)][_0x39223c(0x2c2)](_0xd71a62=>{const _0x35b09b=_0x39223c;_0xd71a62[_0x35b09b(0x23c)](_0xa801d3=>{const _0x27db38=_0x35b09b;this['_removeDom'](_0xa801d3[_0x27db38(0x1be)]);});}));}['addFloatDomToPosition'](_0x172a07,_0x51d60c){const _0x5f460b=_0x3d4902,_0x2acd9b=getSheetCommandTarget(this[_0x5f460b(0x2b7)],{'unitId':_0x172a07['unitId'],'subUnitId':_0x172a07[_0x5f460b(0x2f3)]});if(!_0x2acd9b)throw new Error('cannot\x20find\x20current\x20target!');const {unitId:_0x25aabb,subUnitId:_0x186f4a}=_0x2acd9b,{initPosition:_0xeda42,componentKey:_0x50844b,data:_0xf0eafe,allowTransform:allowTransform=!0x0}=_0x172a07,_0x5c6a3e=_0x51d60c!=null?_0x51d60c:generateRandomId(),_0x475387=this[_0x5f460b(0x25a)](_0xeda42,_0x25aabb);if(_0x475387==null)return;this[_0x5f460b(0x330)](_0x25aabb,_0x186f4a)[_0x5f460b(0x2b1)](_0x5c6a3e,_0x172a07);const _0x296c24={'unitId':_0x25aabb,'subUnitId':_0x186f4a,'drawingId':_0x5c6a3e,'drawingType':_0x4c08d0['DRAWING_DOM'],'componentKey':_0x50844b,'sheetTransform':_0x475387,'transform':{'left':_0xeda42[_0x5f460b(0x36e)],'top':_0xeda42['startY'],'width':_0xeda42[_0x5f460b(0x295)]-_0xeda42['startX'],'height':_0xeda42[_0x5f460b(0x204)]-_0xeda42[_0x5f460b(0x34b)]},'data':_0xf0eafe,'allowTransform':allowTransform};return this[_0x5f460b(0x208)][_0x5f460b(0x234)](InsertSheetDrawingCommand['id'],{'unitId':_0x25aabb,'drawings':[_0x296c24]}),{'id':_0x5c6a3e,'dispose':__name(()=>{this['_removeDom'](_0x5c6a3e,!0x0);},_0x5f460b(0x272))};}[_0x3d4902(0x2d6)](_0x39c636,_0x517187=!0x1){const _0x10eedf=_0x3d4902,_0x3f88d6=this['_domLayerInfoMap']['get'](_0x39c636);if(!_0x3f88d6)return;const {unitId:_0x32e896,subUnitId:_0x19b527}=_0x3f88d6;this[_0x10eedf(0x230)]['delete'](_0x39c636),_0x3f88d6[_0x10eedf(0x272)]['dispose']();const _0x2eba82=this['_getSceneAndTransformerByDrawingSearch'](_0x32e896);if(_0x2eba82&&_0x2eba82[_0x10eedf(0x34f)][_0x10eedf(0x250)](_0x3f88d6['rect']),_0x517187){this['_ensureMap'](_0x32e896,_0x19b527)[_0x10eedf(0x327)](_0x39c636);const _0x15d324=this['_drawingManagerService'][_0x10eedf(0x1fc)]({'unitId':_0x32e896,'subUnitId':_0x19b527,'drawingId':_0x39c636});if(!_0x15d324)return;const _0x445827=this['_sheetDrawingService'][_0x10eedf(0x1ea)]([_0x15d324]),{redo:_0x3d5fdd,objects:_0x5e8952}=_0x445827;this['_commandService']['syncExecuteCommand'](SetDrawingApplyMutation['id'],{'unitId':_0x32e896,'subUnitId':_0x19b527,'op':_0x3d5fdd,'objects':_0x5e8952,'type':DrawingApplyType[_0x10eedf(0x331)]});}}[_0x3d4902(0x2d3)](_0x5ee835){const _0xf4602f=_0x3d4902;return this[_0xf4602f(0x347)][_0xf4602f(0x1dd)](_0x5ee835),{'dispose':__name(()=>{const _0x3fcfba=_0xf4602f,_0x856a7d=this[_0x3fcfba(0x347)][_0x3fcfba(0x26b)](_0x184d32=>_0x184d32===_0x5ee835);this[_0x3fcfba(0x347)][_0x3fcfba(0x376)](_0x856a7d,0x1);},_0xf4602f(0x272))};}},__name(_a9,_0x3d4902(0x224)),_a9);SheetCanvasFloatDomManagerService=__decorateClass$1([__decorateParam$1(0x0,Inject(IRenderManagerService)),__decorateParam$1(0x1,IUniverInstanceService),__decorateParam$1(0x2,Inject(ICommandService)),__decorateParam$1(0x3,IDrawingManagerService),__decorateParam$1(0x4,Inject(CanvasFloatDomService)),__decorateParam$1(0x5,ISheetDrawingService)],SheetCanvasFloatDomManagerService);var __defProp2=Object[_0x3d4902(0x1c5)],__getOwnPropDesc=Object[_0x3d4902(0x358)],__defNormalProp2=__name((_0x3349cb,_0x116e72,_0x41f727)=>_0x116e72 in _0x3349cb?__defProp2(_0x3349cb,_0x116e72,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x41f727}):_0x3349cb[_0x116e72]=_0x41f727,'__defNormalProp'),__decorateClass=__name((_0x37e2e1,_0x1622b4,_0x1f9e13,_0x52450a)=>{for(var _0x3981cb=_0x52450a>0x1?void 0x0:_0x52450a?__getOwnPropDesc(_0x1622b4,_0x1f9e13):_0x1622b4,_0x31d9e8=_0x37e2e1['length']-0x1,_0x26fd72;_0x31d9e8>=0x0;_0x31d9e8--)(_0x26fd72=_0x37e2e1[_0x31d9e8])&&(_0x3981cb=(_0x52450a?_0x26fd72(_0x1622b4,_0x1f9e13,_0x3981cb):_0x26fd72(_0x3981cb))||_0x3981cb);return _0x52450a&&_0x3981cb&&__defProp2(_0x1622b4,_0x1f9e13,_0x3981cb),_0x3981cb;},'__decorateClass'),__decorateParam=__name((_0x340f45,_0x51bc34)=>(_0x7c8716,_0x2e3568)=>_0x51bc34(_0x7c8716,_0x2e3568,_0x340f45),_0x3d4902(0x23f)),__publicField2=__name((_0x29f744,_0xe07a02,_0x45a335)=>__defNormalProp2(_0x29f744,typeof _0xe07a02!=_0x3d4902(0x1eb)?_0xe07a02+'':_0xe07a02,_0x45a335),_0x3d4902(0x246));const PLUGIN_NAME=_0x3d4902(0x2b3);var _a10;function _0x42a1(_0x30a788,_0x391317){const _0x3354fc=_0x3354();return _0x42a1=function(_0x42a180,_0x1656a5){_0x42a180=_0x42a180-0x1bb;let _0x10d4d8=_0x3354fc[_0x42a180];return _0x10d4d8;},_0x42a1(_0x30a788,_0x391317);}let UniverSheetsDrawingUIPlugin=(_a10=class extends Plugin{constructor(_0x1cac11=defaultPluginConfig,_0x304b46,_0x5d9002,_0x2d7147){const _0x2c8589=_0x3d4902;super(),this[_0x2c8589(0x32d)]=_0x1cac11,this['_injector']=_0x304b46,this[_0x2c8589(0x2ef)]=_0x5d9002,this[_0x2c8589(0x225)]=_0x2d7147;const {menu:_0x26e7c3,..._0x25928b}=this[_0x2c8589(0x32d)];_0x26e7c3&&this[_0x2c8589(0x225)][_0x2c8589(0x374)]('menu',_0x26e7c3,{'merge':!0x0}),this[_0x2c8589(0x225)][_0x2c8589(0x374)](PLUGIN_CONFIG_KEY,_0x25928b);}[_0x3d4902(0x2b6)](){const _0x2d418d=_0x3d4902;this['_initDependencies'](),this[_0x2d418d(0x2e5)][_0x2d418d(0x2c8)](SheetCanvasFloatDomManagerService);}[_0x3d4902(0x203)](){const _0x15587b=_0x3d4902;this[_0x15587b(0x2e5)][_0x15587b(0x2c8)](SheetsDrawingCopyPasteController);}['onRendered'](){const _0x4e5511=_0x3d4902;this[_0x4e5511(0x349)](),this[_0x4e5511(0x2e5)]['get'](SheetDrawingPermissionController),this[_0x4e5511(0x2e5)]['get'](SheetDrawingPrintingController),this[_0x4e5511(0x2e5)]['get'](SheetDrawingUIController);}['onSteady'](){const _0x30b0f8=_0x3d4902;this[_0x30b0f8(0x2e5)][_0x30b0f8(0x2c8)](DrawingPopupMenuController);}[_0x3d4902(0x28f)](){const _0x5c88af=_0x3d4902;[[SheetCanvasFloatDomManagerService],[SheetDrawingUIController],[DrawingPopupMenuController],[SheetDrawingPrintingController],[SheetDrawingPermissionController],[SheetsDrawingCopyPasteController]]['forEach'](_0x98fd7c=>this[_0x5c88af(0x2e5)][_0x5c88af(0x344)](_0x98fd7c));}[_0x3d4902(0x349)](){const _0x1cd9bd=_0x3d4902;[[SheetDrawingUpdateController],[SheetDrawingTransformAffectedController],[SheetsDrawingRenderController]][_0x1cd9bd(0x23c)](_0xdce0ef=>{const _0x4bfe17=_0x1cd9bd;this[_0x4bfe17(0x26e)](this['_renderManagerService'][_0x4bfe17(0x2bb)](UniverInstanceType['UNIVER_SHEET'],_0xdce0ef));});}},__name(_a10,_0x3d4902(0x1d5)),_a10);__publicField2(UniverSheetsDrawingUIPlugin,_0x3d4902(0x33d),UniverInstanceType[_0x3d4902(0x1e8)]),__publicField2(UniverSheetsDrawingUIPlugin,_0x3d4902(0x2aa),PLUGIN_NAME),UniverSheetsDrawingUIPlugin=__decorateClass([DependentOn(UniverDrawingPlugin,UniverDrawingUIPlugin,UniverSheetsDrawingPlugin),__decorateParam(0x1,Inject(Injector)),__decorateParam(0x2,IRenderManagerService),__decorateParam(0x3,IConfigService)],UniverSheetsDrawingUIPlugin);export{ClearSheetDrawingTransformerOperation,DeleteDrawingsCommand,EditSheetDrawingOperation,GroupSheetDrawingCommand,IMAGE_MENU_ID,InsertFloatImageCommand,InsertSheetDrawingCommand,MoveDrawingsCommand,RemoveSheetDrawingCommand,SetDrawingArrangeCommand,SetSheetDrawingCommand,SheetCanvasFloatDomManagerService,SidebarSheetDrawingOperation,UngroupSheetDrawingCommand,UniverSheetsDrawingUIPlugin};
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
+ import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, Inject, Injector, IContextService, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Tools, UserManagerService, IPermissionService, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, DependentOn, Plugin, registerDependencies, touchDependencies, IConfigService } from "@univerjs/core";
6
+ import { IDrawingManagerService, IImageIoService, DrawingTypeEnum, ArrangeTypeEnum, DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, getDrawingShapeKeyByDrawingSearch, UniverDrawingPlugin } from "@univerjs/drawing";
7
+ import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, DrawingCommonPanel, DrawingRenderService, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
8
+ import { IRenderManagerService, precisionTo, getGroupState, transformObjectOutOfGroup, RENDER_CLASS_TYPE, Rect, DRAWING_OBJECT_LAYER_INDEX, SHEET_VIEWPORT_KEY } from "@univerjs/engine-render";
9
+ import { ISheetDrawingService, SetDrawingApplyMutation, DrawingApplyType, SheetDrawingAnchorType, UniverSheetsDrawingPlugin } from "@univerjs/sheets-drawing";
10
+ import { SheetCanvasPopManagerService, attachRangeWithCoord, ISheetSelectionRenderService, SheetSkeletonManagerService, getCurrentRangeDisable$, COPY_TYPE, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, ISheetClipboardService, SheetPrintInterceptorService, SetScrollOperation, SetZoomRatioOperation } from "@univerjs/sheets-ui";
11
+ import { ISidebarService, IUIPartsService, BuiltInUIPart, ILocalFileService, IMessageService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, ComponentManager, IMenuManagerService, IShortcutService, CanvasFloatDomService } from "@univerjs/ui";
12
+ import { takeUntil, combineLatest, map, filter, distinctUntilChanged, Subject, BehaviorSubject } from "rxjs";
13
+ import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, MoveColsCommand, MoveRowsCommand, MoveRangeCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SheetInterceptorService, SetWorksheetActiveOperation, SetFrozenMutation } from "@univerjs/sheets";
14
+ import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
15
+ import { MessageType, RadioGroup, Radio } from "@univerjs/design";
16
+ import clsx from "clsx";
17
+ const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {}, ClearSheetDrawingTransformerOperation = {
18
+ id: "sheet.operation.clear-drawing-transformer",
19
+ type: CommandType.MUTATION,
20
+ handler: /* @__PURE__ */ __name((accessor, params) => {
21
+ const renderManagerService = accessor.get(IRenderManagerService);
22
+ return params.forEach((unitId) => {
23
+ var _a11, _b;
24
+ (_b = (_a11 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene.getTransformer()) == null || _b.debounceRefreshControls();
25
+ }), !0;
26
+ }, "handler")
27
+ }, RemoveSheetDrawingCommand = {
28
+ id: "sheet.command.remove-sheet-image",
29
+ type: CommandType.COMMAND,
30
+ handler: /* @__PURE__ */ __name((accessor, params) => {
31
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
32
+ if (!params) return !1;
33
+ const { drawings } = params, unitIds = [];
34
+ drawings.forEach((param) => {
35
+ const { unitId: unitId2 } = param;
36
+ unitIds.push(unitId2);
37
+ });
38
+ const jsonOp = sheetDrawingService.getBatchRemoveOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
39
+ return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE }) ? (undoRedoService.pushUndoRedo({
40
+ unitID: unitId,
41
+ undoMutations: [
42
+ { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.INSERT } },
43
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
44
+ ],
45
+ redoMutations: [
46
+ { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE } },
47
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
48
+ ]
49
+ }), !0) : !1;
50
+ }, "handler")
51
+ }, COMPONENT_SHEET_DRAWING_PANEL = "COMPONENT_SHEET_DRAWING_PANEL", SidebarSheetDrawingOperation = {
52
+ id: "sidebar.operation.sheet-image",
53
+ type: CommandType.COMMAND,
54
+ handler: /* @__PURE__ */ __name(async (accessor, params) => {
55
+ const sidebarService = accessor.get(ISidebarService), localeService = accessor.get(LocaleService), univerInstanceService = accessor.get(IUniverInstanceService), drawingManagerService = accessor.get(IDrawingManagerService);
56
+ if (!getSheetCommandTarget(univerInstanceService)) return !1;
57
+ switch (params.value) {
58
+ case "open":
59
+ sidebarService.open({
60
+ header: { title: localeService.t("sheetImage.panel.title") },
61
+ children: { label: COMPONENT_SHEET_DRAWING_PANEL },
62
+ onClose: /* @__PURE__ */ __name(() => {
63
+ drawingManagerService.focusDrawing(null);
64
+ }, "onClose"),
65
+ width: 360
66
+ });
67
+ break;
68
+ case "close":
69
+ default:
70
+ sidebarService.close();
71
+ break;
72
+ }
73
+ return !0;
74
+ }, "handler")
75
+ }, EditSheetDrawingOperation = {
76
+ id: "sheet.operation.edit-sheet-image",
77
+ type: CommandType.OPERATION,
78
+ handler: /* @__PURE__ */ __name((accessor, params) => {
79
+ const drawingManagerService = accessor.get(IDrawingManagerService), commandService = accessor.get(ICommandService);
80
+ return params == null ? !1 : (drawingManagerService.focusDrawing([params]), commandService.executeCommand(SidebarSheetDrawingOperation.id, { value: "open" }), !0);
81
+ }, "handler")
82
+ }, uploadLoading = "univer-upload-loading", uploadLoadingBody = "univer-upload-loading-body", uploadLoadingBodyAnimation = "univer-upload-loading-body-animation", univerCircleAnimation = "univer-UniverCircleAnimation", uploadLoadingBodyText = "univer-upload-loading-body-text", styles$1 = {
83
+ uploadLoading,
84
+ uploadLoadingBody,
85
+ uploadLoadingBodyAnimation,
86
+ univerCircleAnimation,
87
+ uploadLoadingBodyText
88
+ }, UploadLoading = /* @__PURE__ */ __name(() => {
89
+ const imageIoService = useDependency(IImageIoService), localeService = useDependency(LocaleService), [remain, setRemain] = React.useState(0);
90
+ return useEffect(() => {
91
+ const sub = imageIoService.change$.subscribe((count) => {
92
+ setRemain(count);
93
+ });
94
+ return () => {
95
+ sub.unsubscribe();
96
+ };
97
+ }, [imageIoService]), /* @__PURE__ */ React.createElement("div", { style: { display: remain > 0 ? "block" : "none" }, className: styles$1.uploadLoading }, /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBody }, /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBodyAnimation }), /* @__PURE__ */ React.createElement("div", { className: styles$1.uploadLoadingBodyText }, `${localeService.t("uploadLoading.loading")}: ${remain}`)));
98
+ }, "UploadLoading");
99
+ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
100
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
101
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
102
+ return kind && result && __defProp$9(target, key, result), result;
103
+ }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a;
104
+ let DrawingPopupMenuController = (_a = class extends RxDisposable {
105
+ constructor(_injector, _drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _uiPartsService) {
106
+ super();
107
+ __publicField(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
108
+ this._injector = _injector, this._drawingManagerService = _drawingManagerService, this._canvasPopManagerService = _canvasPopManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._contextService = _contextService, this._uiPartsService = _uiPartsService, this._init();
109
+ }
110
+ _init() {
111
+ this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._create(workbook)), this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._dispose(workbook)), this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._create(workbook)), this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(UploadLoading, this._injector));
112
+ }
113
+ _dispose(workbook) {
114
+ const unitId = workbook.getUnitId();
115
+ this._renderManagerService.removeRender(unitId);
116
+ }
117
+ _create(workbook) {
118
+ if (!workbook)
119
+ return;
120
+ const unitId = workbook.getUnitId();
121
+ this._renderManagerService.has(unitId) && !this._initImagePopupMenu.has(unitId) && (this._popupMenuListener(unitId), this._initImagePopupMenu.add(unitId));
122
+ }
123
+ _hasCropObject(scene) {
124
+ const objects = scene.getAllObjectsByOrder();
125
+ for (const object of objects)
126
+ if (object instanceof ImageCropperObject)
127
+ return !0;
128
+ return !1;
129
+ }
130
+ _popupMenuListener(unitId) {
131
+ var _a11;
132
+ const scene = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.scene;
133
+ if (!scene)
134
+ return;
135
+ const transformer = scene.getTransformerByCreate();
136
+ if (!transformer)
137
+ return;
138
+ let singletonPopupDisposer;
139
+ this.disposeWithMe(
140
+ toDisposable(
141
+ transformer.createControl$.subscribe(() => {
142
+ if (this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, !0), this._hasCropObject(scene))
143
+ return;
144
+ const selectedObjects = transformer.getSelectedObjectMap();
145
+ if (selectedObjects.size > 1) {
146
+ singletonPopupDisposer == null || singletonPopupDisposer.dispose();
147
+ return;
148
+ }
149
+ const object = selectedObjects.values().next().value;
150
+ if (!object)
151
+ return;
152
+ const oKey = object.oKey, drawingParam = this._drawingManagerService.getDrawingOKey(oKey);
153
+ if (!drawingParam)
154
+ return;
155
+ const { unitId: unitId2, subUnitId, drawingId, drawingType } = drawingParam;
156
+ singletonPopupDisposer == null || singletonPopupDisposer.dispose(), singletonPopupDisposer = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(object, {
157
+ componentKey: COMPONENT_IMAGE_POPUP_MENU,
158
+ direction: "horizontal",
159
+ offset: [2, 0],
160
+ extraProps: {
161
+ menuItems: this._getImageMenuItems(unitId2, subUnitId, drawingId, drawingType)
162
+ }
163
+ })), this._drawingManagerService.focusDrawing([{
164
+ unitId: unitId2,
165
+ subUnitId,
166
+ drawingId
167
+ }]);
168
+ })
169
+ )
170
+ ), this.disposeWithMe(
171
+ transformer.clearControl$.subscribe(() => {
172
+ singletonPopupDisposer == null || singletonPopupDisposer.dispose(), this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, !1), this._drawingManagerService.focusDrawing(null);
173
+ })
174
+ ), this.disposeWithMe(
175
+ transformer.changing$.subscribe(() => {
176
+ singletonPopupDisposer == null || singletonPopupDisposer.dispose();
177
+ })
178
+ );
179
+ }
180
+ _getImageMenuItems(unitId, subUnitId, drawingId, drawingType) {
181
+ return [
182
+ {
183
+ label: "image-popup.edit",
184
+ index: 0,
185
+ commandId: EditSheetDrawingOperation.id,
186
+ commandParams: { unitId, subUnitId, drawingId },
187
+ disable: drawingType === DrawingTypeEnum.DRAWING_DOM
188
+ },
189
+ {
190
+ label: "image-popup.delete",
191
+ index: 1,
192
+ commandId: RemoveSheetDrawingCommand.id,
193
+ commandParams: { unitId, drawings: [{ unitId, subUnitId, drawingId }] },
194
+ disable: !1
195
+ },
196
+ {
197
+ label: "image-popup.crop",
198
+ index: 2,
199
+ commandId: OpenImageCropOperation.id,
200
+ commandParams: { unitId, subUnitId, drawingId },
201
+ disable: drawingType === DrawingTypeEnum.DRAWING_DOM
202
+ },
203
+ {
204
+ label: "image-popup.reset",
205
+ index: 3,
206
+ commandId: ImageResetSizeOperation.id,
207
+ commandParams: [{ unitId, subUnitId, drawingId }],
208
+ disable: drawingType === DrawingTypeEnum.DRAWING_DOM
209
+ }
210
+ ];
211
+ }
212
+ }, __name(_a, "DrawingPopupMenuController"), _a);
213
+ DrawingPopupMenuController = __decorateClass$9([
214
+ __decorateParam$9(0, Inject(Injector)),
215
+ __decorateParam$9(1, IDrawingManagerService),
216
+ __decorateParam$9(2, Inject(SheetCanvasPopManagerService)),
217
+ __decorateParam$9(3, IRenderManagerService),
218
+ __decorateParam$9(4, IUniverInstanceService),
219
+ __decorateParam$9(5, IContextService),
220
+ __decorateParam$9(6, Inject(IUIPartsService))
221
+ ], DrawingPopupMenuController);
222
+ function drawingPositionToTransform(position, selectionRenderService, sheetSkeletonManagerService) {
223
+ const { from, to, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = position, { column: fromColumn, columnOffset: fromColumnOffset, row: fromRow, rowOffset: fromRowOffset } = from, { column: toColumn, columnOffset: toColumnOffset, row: toRow, rowOffset: toRowOffset } = to, skeleton = sheetSkeletonManagerService.getCurrentSkeleton(), startSelectionCell = attachRangeWithCoord(skeleton, {
224
+ startColumn: fromColumn,
225
+ endColumn: fromColumn,
226
+ startRow: fromRow,
227
+ endRow: fromRow
228
+ });
229
+ if (startSelectionCell == null)
230
+ return;
231
+ const endSelectionCell = attachRangeWithCoord(skeleton, {
232
+ startColumn: toColumn,
233
+ endColumn: toColumn,
234
+ startRow: toRow,
235
+ endRow: toRow
236
+ });
237
+ if (endSelectionCell == null)
238
+ return;
239
+ const { startX: startSelectionX, startY: startSelectionY } = startSelectionCell, { startX: endSelectionX, startY: endSelectionY } = endSelectionCell;
240
+ let left = precisionTo(startSelectionX + fromColumnOffset, 1), top = precisionTo(startSelectionY + fromRowOffset, 1), width = precisionTo(endSelectionX + toColumnOffset - left, 1), height = precisionTo(endSelectionY + toRowOffset - top, 1);
241
+ startSelectionCell.startX === endSelectionCell.endX && (width = 0), startSelectionCell.startY === endSelectionCell.endY && (height = 0);
242
+ const sheetWidth = skeleton.rowHeaderWidth + skeleton.columnTotalWidth, sheetHeight = skeleton.columnHeaderHeight + skeleton.rowTotalHeight;
243
+ return left + width > sheetWidth && (left = sheetWidth - width), top + height > sheetHeight && (top = sheetHeight - height), {
244
+ flipY,
245
+ flipX,
246
+ angle,
247
+ skewX,
248
+ skewY,
249
+ left,
250
+ top,
251
+ width,
252
+ height
253
+ };
254
+ }
255
+ __name(drawingPositionToTransform, "drawingPositionToTransform");
256
+ function transformToDrawingPosition(transform, selectionRenderService) {
257
+ const { left = 0, top = 0, width = 0, height = 0, flipY = !1, flipX = !1, angle = 0, skewX = 0, skewY = 0 } = transform, startSelectionCell = selectionRenderService.getSelectionCellByPosition(left, top);
258
+ if (startSelectionCell == null)
259
+ return;
260
+ const from = {
261
+ column: startSelectionCell.actualColumn,
262
+ columnOffset: precisionTo(left - startSelectionCell.startX, 1),
263
+ row: startSelectionCell.actualRow,
264
+ rowOffset: precisionTo(top - startSelectionCell.startY, 1)
265
+ }, endSelectionCell = selectionRenderService.getSelectionCellByPosition(left + width, top + height);
266
+ if (endSelectionCell == null)
267
+ return;
268
+ const to = {
269
+ column: endSelectionCell.actualColumn,
270
+ columnOffset: precisionTo(left + width - endSelectionCell.startX, 1),
271
+ row: endSelectionCell.actualRow,
272
+ rowOffset: precisionTo(top + height - endSelectionCell.startY, 1)
273
+ };
274
+ return {
275
+ flipY,
276
+ flipX,
277
+ angle,
278
+ skewX,
279
+ skewY,
280
+ from,
281
+ to
282
+ };
283
+ }
284
+ __name(transformToDrawingPosition, "transformToDrawingPosition");
285
+ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
286
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
287
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
288
+ return kind && result && __defProp$8(target, key, result), result;
289
+ }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
290
+ let SheetsDrawingRenderController = (_a2 = class extends Disposable {
291
+ constructor(_context, _sheetDrawingService, _drawingManagerService, _sheetSelectionRenderService, _sheetSkeletonManagerService) {
292
+ super(), this._context = _context, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._sheetSelectionRenderService = _sheetSelectionRenderService, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._init();
293
+ }
294
+ _init() {
295
+ this._drawingInitializeListener();
296
+ }
297
+ _drawingInitializeListener() {
298
+ this._sheetDrawingService.initializeNotification(this._context.unitId);
299
+ const data = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
300
+ for (const subUnit in data) {
301
+ const subUnitData = data[subUnit];
302
+ for (const drawingId in subUnitData.data) {
303
+ const drawingData = subUnitData.data[drawingId];
304
+ drawingData.transform = drawingPositionToTransform(drawingData.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
305
+ }
306
+ }
307
+ this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
308
+ }
309
+ }, __name(_a2, "SheetsDrawingRenderController"), _a2);
310
+ SheetsDrawingRenderController = __decorateClass$8([
311
+ __decorateParam$8(1, ISheetDrawingService),
312
+ __decorateParam$8(2, IDrawingManagerService),
313
+ __decorateParam$8(3, Inject(ISheetSelectionRenderService)),
314
+ __decorateParam$8(4, Inject(SheetSkeletonManagerService))
315
+ ], SheetsDrawingRenderController);
316
+ var __assign = function() {
317
+ return __assign = Object.assign || function(t) {
318
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
319
+ s = arguments[i];
320
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
321
+ }
322
+ return t;
323
+ }, __assign.apply(this, arguments);
324
+ }, __rest = function(s, e) {
325
+ var t = {};
326
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
327
+ if (s != null && typeof Object.getOwnPropertySymbols == "function")
328
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
329
+ e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
330
+ return t;
331
+ }, IconBase = forwardRef(function(props, ref) {
332
+ var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
333
+ return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
334
+ });
335
+ function render(node, id, runtimeProps, rootProps, extend) {
336
+ return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
337
+ return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
338
+ }));
339
+ }
340
+ __name(render, "render");
341
+ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
342
+ var attrs = __assign({}, node.attrs);
343
+ extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
344
+ var defIds = runtimeProps.defIds;
345
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a11) {
346
+ var key = _a11[0], value = _a11[1];
347
+ typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
348
+ })), attrs;
349
+ }
350
+ __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
351
+ function replaceRuntimeIdsInDefs(node, runtimeProps) {
352
+ var _a11, defIds = runtimeProps.defIds;
353
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a11 = node.children) === null || _a11 === void 0) && _a11.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
354
+ return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
355
+ }) }) : node;
356
+ }
357
+ __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
358
+ function generateShortUuid() {
359
+ return Math.random().toString(36).substring(2, 8);
360
+ }
361
+ __name(generateShortUuid, "generateShortUuid");
362
+ IconBase.displayName = "UniverIcon";
363
+ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, AddImageSingle = forwardRef(function(props, ref) {
364
+ return createElement(IconBase, Object.assign({}, props, {
365
+ id: "add-image-single",
366
+ ref,
367
+ icon: element
368
+ }));
369
+ });
370
+ AddImageSingle.displayName = "AddImageSingle";
371
+ const DeleteDrawingsCommand = {
372
+ id: "sheet.command.delete-drawing",
373
+ type: CommandType.COMMAND,
374
+ handler: /* @__PURE__ */ __name((accessor) => {
375
+ const commandService = accessor.get(ICommandService), drawings = accessor.get(ISheetDrawingService).getFocusDrawings();
376
+ if (drawings.length === 0)
377
+ return !1;
378
+ const unitId = drawings[0].unitId, newDrawings = drawings.map((drawing) => {
379
+ const { unitId: unitId2, subUnitId, drawingId, drawingType } = drawing;
380
+ return {
381
+ unitId: unitId2,
382
+ subUnitId,
383
+ drawingId,
384
+ drawingType
385
+ };
386
+ });
387
+ return commandService.executeCommand(RemoveSheetDrawingCommand.id, {
388
+ unitId,
389
+ drawings: newDrawings
390
+ });
391
+ }, "handler")
392
+ };
393
+ function ungroupToGroup(ungroupParams) {
394
+ const newGroupParams = [];
395
+ return ungroupParams.forEach((ungroupParam) => {
396
+ const { parent, children } = ungroupParam, { unitId, subUnitId, drawingId: groupId } = parent, groupTransform = getGroupState(0, 0, children.map((o) => o.transform || {})), newChildren = children.map((drawing) => {
397
+ const transform = drawing.transform || { left: 0, top: 0 }, { unitId: unitId2, subUnitId: subUnitId2, drawingId } = drawing;
398
+ return {
399
+ unitId: unitId2,
400
+ subUnitId: subUnitId2,
401
+ drawingId,
402
+ transform: {
403
+ ...transform,
404
+ left: transform.left - groupTransform.left,
405
+ top: transform.top - groupTransform.top
406
+ },
407
+ groupId
408
+ };
409
+ }), groupParam = {
410
+ unitId,
411
+ subUnitId,
412
+ drawingId: groupId,
413
+ drawingType: DrawingTypeEnum.DRAWING_GROUP,
414
+ transform: groupTransform
415
+ };
416
+ newGroupParams.push({
417
+ parent: groupParam,
418
+ children: newChildren
419
+ });
420
+ }), newGroupParams;
421
+ }
422
+ __name(ungroupToGroup, "ungroupToGroup");
423
+ function groupToUngroup(groupParams) {
424
+ const newGroupParams = [];
425
+ return groupParams.forEach((groupParam) => {
426
+ const { parent, children } = groupParam, { unitId, subUnitId, drawingId: groupId, transform: groupTransform = { width: 0, height: 0 } } = parent;
427
+ if (groupTransform == null)
428
+ return;
429
+ const newChildren = children.map((object) => {
430
+ const { transform } = object, { unitId: unitId2, subUnitId: subUnitId2, drawingId } = object, newTransform = transformObjectOutOfGroup(transform || {}, groupTransform, groupTransform.width || 0, groupTransform.height || 0);
431
+ return {
432
+ unitId: unitId2,
433
+ subUnitId: subUnitId2,
434
+ drawingId,
435
+ transform: newTransform,
436
+ groupId: void 0
437
+ };
438
+ }), ungroupParam = {
439
+ unitId,
440
+ subUnitId,
441
+ drawingId: groupId,
442
+ drawingType: DrawingTypeEnum.DRAWING_GROUP,
443
+ transform: {
444
+ left: 0,
445
+ top: 0
446
+ }
447
+ };
448
+ newGroupParams.push({
449
+ parent: ungroupParam,
450
+ children: newChildren
451
+ });
452
+ }), newGroupParams;
453
+ }
454
+ __name(groupToUngroup, "groupToUngroup");
455
+ const GroupSheetDrawingCommand = {
456
+ id: "sheet.command.group-sheet-image",
457
+ type: CommandType.COMMAND,
458
+ handler: /* @__PURE__ */ __name((accessor, params) => {
459
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
460
+ if (!params) return !1;
461
+ const unitIds = [];
462
+ params.forEach(({ parent, children }) => {
463
+ unitIds.push(parent.unitId), children.forEach((child) => {
464
+ unitIds.push(child.unitId);
465
+ });
466
+ });
467
+ const jsonOp = sheetDrawingService.getGroupDrawingOp(params), { unitId, subUnitId, undo, redo, objects } = jsonOp;
468
+ return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.GROUP }) ? (undoRedoService.pushUndoRedo({
469
+ unitID: unitId,
470
+ undoMutations: [
471
+ { id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects: groupToUngroup(objects), type: DrawingApplyType.UNGROUP } },
472
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
473
+ ],
474
+ redoMutations: [
475
+ { id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.GROUP } },
476
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
477
+ ]
478
+ }), !0) : !1;
479
+ }, "handler")
480
+ }, InsertSheetDrawingCommand = {
481
+ id: "sheet.command.insert-sheet-image",
482
+ type: CommandType.COMMAND,
483
+ handler: /* @__PURE__ */ __name((accessor, params) => {
484
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
485
+ if (!params) return !1;
486
+ const drawings = params.drawings, unitIds = drawings.map((param) => param.unitId), jsonOp = sheetDrawingService.getBatchAddOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
487
+ return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT }) ? (undoRedoService.pushUndoRedo({
488
+ unitID: unitId,
489
+ undoMutations: [
490
+ { id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.REMOVE } },
491
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
492
+ ],
493
+ redoMutations: [
494
+ { id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT } },
495
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
496
+ ]
497
+ }), !0) : !1;
498
+ }, "handler")
499
+ }, SetDrawingArrangeCommand = {
500
+ id: "sheet.command.set-drawing-arrange",
501
+ type: CommandType.COMMAND,
502
+ handler: /* @__PURE__ */ __name((accessor, params) => {
503
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService);
504
+ if (!params) return !1;
505
+ const sheetDrawingService = accessor.get(ISheetDrawingService), { unitId, subUnitId, drawingIds, arrangeType } = params, drawingOrderMapParam = { unitId, subUnitId, drawingIds };
506
+ let jsonOp;
507
+ if (arrangeType === ArrangeTypeEnum.forward ? jsonOp = sheetDrawingService.getForwardDrawingsOp(drawingOrderMapParam) : arrangeType === ArrangeTypeEnum.backward ? jsonOp = sheetDrawingService.getBackwardDrawingOp(drawingOrderMapParam) : arrangeType === ArrangeTypeEnum.front ? jsonOp = sheetDrawingService.getFrontDrawingsOp(drawingOrderMapParam) : arrangeType === ArrangeTypeEnum.back && (jsonOp = sheetDrawingService.getBackDrawingsOp(drawingOrderMapParam)), jsonOp == null)
508
+ return !1;
509
+ const { objects, redo, undo } = jsonOp;
510
+ return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE }) ? (undoRedoService.pushUndoRedo({
511
+ unitID: unitId,
512
+ undoMutations: [
513
+ { id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE } }
514
+ ],
515
+ redoMutations: [
516
+ { id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.ARRANGE } }
517
+ ]
518
+ }), !0) : !1;
519
+ }, "handler")
520
+ }, SetSheetDrawingCommand = {
521
+ id: "sheet.command.set-sheet-image",
522
+ type: CommandType.COMMAND,
523
+ handler: /* @__PURE__ */ __name((accessor, params) => {
524
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
525
+ if (!params) return !1;
526
+ const { drawings } = params, jsonOp = sheetDrawingService.getBatchUpdateOp(drawings), { unitId, subUnitId, undo, redo, objects } = jsonOp;
527
+ return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE }) ? (undoRedoService.pushUndoRedo({
528
+ unitID: unitId,
529
+ undoMutations: [
530
+ { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } },
531
+ { id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }
532
+ ],
533
+ redoMutations: [
534
+ { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } },
535
+ { id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }
536
+ ]
537
+ }), !0) : !1;
538
+ }, "handler")
539
+ }, UngroupSheetDrawingCommand = {
540
+ id: "sheet.command.ungroup-sheet-image",
541
+ type: CommandType.COMMAND,
542
+ handler: /* @__PURE__ */ __name((accessor, params) => {
543
+ const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), sheetDrawingService = accessor.get(ISheetDrawingService);
544
+ if (!params) return !1;
545
+ const unitIds = [];
546
+ params.forEach(({ parent, children }) => {
547
+ unitIds.push(parent.unitId), children.forEach((child) => {
548
+ unitIds.push(child.unitId);
549
+ });
550
+ });
551
+ const jsonOp = sheetDrawingService.getUngroupDrawingOp(params), { unitId, subUnitId, undo, redo, objects } = jsonOp;
552
+ return commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.UNGROUP }) ? (undoRedoService.pushUndoRedo({
553
+ unitID: unitId,
554
+ undoMutations: [
555
+ { id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects: ungroupToGroup(objects), type: DrawingApplyType.GROUP } },
556
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
557
+ ],
558
+ redoMutations: [
559
+ { id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.UNGROUP } },
560
+ { id: ClearSheetDrawingTransformerOperation.id, params: unitIds }
561
+ ]
562
+ }), !0) : !1;
563
+ }, "handler")
564
+ };
565
+ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
566
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
567
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
568
+ return kind && result && __defProp$7(target, key, result), result;
569
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a3;
570
+ let SheetDrawingUpdateController = (_a3 = class extends Disposable {
571
+ constructor(_context, _skeletonManagerService, _commandService, _selectionRenderService, _imageIoService, _fileOpenerService, _sheetDrawingService, _drawingManagerService, _contextService, _messageService, _localeService, selectionManagerService) {
572
+ super();
573
+ __publicField(this, "_workbookSelections");
574
+ this._context = _context, this._skeletonManagerService = _skeletonManagerService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._imageIoService = _imageIoService, this._fileOpenerService = _fileOpenerService, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._contextService = _contextService, this._messageService = _messageService, this._localeService = _localeService, this._workbookSelections = selectionManagerService.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
575
+ }
576
+ async insertFloatImage() {
577
+ const files = await this._fileOpenerService.openFile({
578
+ multiple: !0,
579
+ accept: DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(",")
580
+ }), fileLength = files.length;
581
+ return fileLength > DRAWING_IMAGE_COUNT_LIMIT ? (this._messageService.show({
582
+ type: MessageType.Error,
583
+ content: this._localeService.t("update-status.exceedMaxCount", String(DRAWING_IMAGE_COUNT_LIMIT))
584
+ }), !1) : fileLength === 0 ? !1 : (files.forEach(async (file) => await this._insertFloatImage(file)), !0);
585
+ }
586
+ async _insertFloatImage(file) {
587
+ let imageParam;
588
+ try {
589
+ imageParam = await this._imageIoService.saveImage(file);
590
+ } catch (error) {
591
+ const type = error.message;
592
+ type === ImageUploadStatusType.ERROR_EXCEED_SIZE ? this._messageService.show({
593
+ type: MessageType.Error,
594
+ content: this._localeService.t("update-status.exceedMaxSize", String(DRAWING_IMAGE_ALLOW_SIZE / (1024 * 1024)))
595
+ }) : type === ImageUploadStatusType.ERROR_IMAGE_TYPE ? this._messageService.show({
596
+ type: MessageType.Error,
597
+ content: this._localeService.t("update-status.invalidImageType")
598
+ }) : type === ImageUploadStatusType.ERROR_IMAGE && this._messageService.show({
599
+ type: MessageType.Error,
600
+ content: this._localeService.t("update-status.invalidImage")
601
+ });
602
+ }
603
+ if (imageParam == null)
604
+ return;
605
+ const info = this._getUnitInfo(), { unitId, subUnitId } = info, { imageId, imageSourceType, source, base64Cache } = imageParam, { width, height, image } = await getImageSize(base64Cache || ""), { width: sceneWidth, height: sceneHeight } = this._context.scene;
606
+ this._imageIoService.addImageSourceCache(source, imageSourceType, image);
607
+ let scale = 1;
608
+ if (width > DRAWING_IMAGE_WIDTH_LIMIT || height > DRAWING_IMAGE_HEIGHT_LIMIT) {
609
+ const scaleWidth = DRAWING_IMAGE_WIDTH_LIMIT / width, scaleHeight = DRAWING_IMAGE_HEIGHT_LIMIT / height;
610
+ scale = Math.max(scaleWidth, scaleHeight);
611
+ }
612
+ const sheetTransform = this._getImagePosition(width * scale, height * scale, sceneWidth, sceneHeight);
613
+ if (sheetTransform == null)
614
+ return;
615
+ const sheetDrawingParam = {
616
+ unitId,
617
+ subUnitId,
618
+ drawingId: imageId,
619
+ drawingType: DrawingTypeEnum.DRAWING_IMAGE,
620
+ imageSourceType,
621
+ source,
622
+ transform: drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService),
623
+ sheetTransform
624
+ };
625
+ this._commandService.executeCommand(InsertSheetDrawingCommand.id, {
626
+ unitId,
627
+ drawings: [sheetDrawingParam]
628
+ });
629
+ }
630
+ _getUnitInfo() {
631
+ const workbook = this._context.unit, worksheet = workbook.getActiveSheet(), unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId();
632
+ return {
633
+ unitId,
634
+ subUnitId
635
+ };
636
+ }
637
+ _getImagePosition(imageWidth, imageHeight, sceneWidth, sceneHeight) {
638
+ const selections = this._workbookSelections.getCurrentSelections();
639
+ let range = {
640
+ startRow: 0,
641
+ endRow: 0,
642
+ startColumn: 0,
643
+ endColumn: 0
644
+ };
645
+ selections && selections.length > 0 && (range = selections[selections.length - 1].range);
646
+ const rangeWithCoord = attachRangeWithCoord(this._skeletonManagerService.getCurrent().skeleton, range);
647
+ if (rangeWithCoord == null)
648
+ return;
649
+ let { startColumn, startRow, startX, startY } = rangeWithCoord, isChangeStart = !1;
650
+ if (startX + imageWidth > sceneWidth && (startX = sceneWidth - imageWidth, startX < 0 && (startX = 0, imageWidth = sceneWidth), isChangeStart = !0), startY + imageHeight > sceneHeight && (startY = sceneHeight - imageHeight, startY < 0 && (startY = 0, imageHeight = sceneHeight), isChangeStart = !0), isChangeStart) {
651
+ const newCoord = this._selectionRenderService.getSelectionCellByPosition(startX, startY);
652
+ if (newCoord == null)
653
+ return;
654
+ startX = newCoord.startX, startY = newCoord.startY, startColumn = newCoord.actualColumn, startRow = newCoord.actualRow;
655
+ }
656
+ const from = {
657
+ column: startColumn,
658
+ columnOffset: 0,
659
+ row: startRow,
660
+ rowOffset: 0
661
+ }, endSelectionCell = this._selectionRenderService.getSelectionCellByPosition(startX + imageWidth, startY + imageHeight);
662
+ if (endSelectionCell == null)
663
+ return;
664
+ const to = {
665
+ column: endSelectionCell.actualColumn,
666
+ columnOffset: startX + imageWidth - endSelectionCell.startX,
667
+ row: endSelectionCell.actualRow,
668
+ rowOffset: startY + imageHeight - endSelectionCell.startY
669
+ };
670
+ return {
671
+ from,
672
+ to
673
+ };
674
+ }
675
+ _updateOrderListener() {
676
+ this._drawingManagerService.featurePluginOrderUpdate$.subscribe((params) => {
677
+ const { unitId, subUnitId, drawingIds, arrangeType } = params;
678
+ this._commandService.executeCommand(SetDrawingArrangeCommand.id, {
679
+ unitId,
680
+ subUnitId,
681
+ drawingIds,
682
+ arrangeType
683
+ });
684
+ });
685
+ }
686
+ _updateImageListener() {
687
+ this._drawingManagerService.featurePluginUpdate$.subscribe((params) => {
688
+ const drawings = [];
689
+ params.length !== 0 && (params.forEach((param) => {
690
+ const { unitId, subUnitId, drawingId, drawingType, transform } = param;
691
+ if (transform == null)
692
+ return;
693
+ const sheetDrawing = this._sheetDrawingService.getDrawingByParam({ unitId, subUnitId, drawingId });
694
+ if (sheetDrawing == null || sheetDrawing.unitId !== this._context.unitId)
695
+ return;
696
+ const sheetTransform = transformToDrawingPosition({ ...sheetDrawing.transform, ...transform }, this._selectionRenderService);
697
+ if (sheetTransform == null)
698
+ return;
699
+ const newDrawing = {
700
+ ...param,
701
+ transform: { ...sheetDrawing.transform, ...transform, ...drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService) },
702
+ sheetTransform: { ...sheetTransform }
703
+ };
704
+ drawings.push(newDrawing);
705
+ }), drawings.length > 0 && this._commandService.executeCommand(SetSheetDrawingCommand.id, {
706
+ unitId: params[0].unitId,
707
+ drawings
708
+ }));
709
+ });
710
+ }
711
+ _groupDrawingListener() {
712
+ this._drawingManagerService.featurePluginGroupUpdate$.subscribe((params) => {
713
+ this._commandService.executeCommand(GroupSheetDrawingCommand.id, params);
714
+ const { unitId, subUnitId, drawingId } = params[0].parent;
715
+ this._drawingManagerService.focusDrawing([{ unitId, subUnitId, drawingId }]);
716
+ }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((params) => {
717
+ this._commandService.executeCommand(UngroupSheetDrawingCommand.id, params);
718
+ });
719
+ }
720
+ _focusDrawingListener() {
721
+ this.disposeWithMe(
722
+ this._drawingManagerService.focus$.subscribe((params) => {
723
+ params == null || params.length === 0 ? (this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, !0), this._sheetDrawingService.focusDrawing(params));
724
+ })
725
+ );
726
+ }
727
+ }, __name(_a3, "SheetDrawingUpdateController"), _a3);
728
+ SheetDrawingUpdateController = __decorateClass$7([
729
+ __decorateParam$7(1, Inject(SheetSkeletonManagerService)),
730
+ __decorateParam$7(2, ICommandService),
731
+ __decorateParam$7(3, ISheetSelectionRenderService),
732
+ __decorateParam$7(4, IImageIoService),
733
+ __decorateParam$7(5, ILocalFileService),
734
+ __decorateParam$7(6, ISheetDrawingService),
735
+ __decorateParam$7(7, IDrawingManagerService),
736
+ __decorateParam$7(8, IContextService),
737
+ __decorateParam$7(9, IMessageService),
738
+ __decorateParam$7(10, Inject(LocaleService)),
739
+ __decorateParam$7(11, Inject(SheetsSelectionsService))
740
+ ], SheetDrawingUpdateController);
741
+ const InsertFloatImageCommand = {
742
+ id: "sheet.command.insert-float-image",
743
+ type: CommandType.COMMAND,
744
+ handler: /* @__PURE__ */ __name((accessor) => {
745
+ var _a11, _b;
746
+ return (_b = (_a11 = accessor.get(IRenderManagerService).getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a11.with(SheetDrawingUpdateController).insertFloatImage()) != null ? _b : !1;
747
+ }, "handler")
748
+ }, MoveDrawingsCommand = {
749
+ id: "sheet.command.move-drawing",
750
+ type: CommandType.COMMAND,
751
+ handler: /* @__PURE__ */ __name((accessor, params) => {
752
+ const commandService = accessor.get(ICommandService), drawingManagerService = accessor.get(ISheetDrawingService), selectionRenderService = accessor.get(ISheetSelectionRenderService), { direction } = params, drawings = drawingManagerService.getFocusDrawings();
753
+ if (drawings.length === 0)
754
+ return !1;
755
+ const unitId = drawings[0].unitId, newDrawings = drawings.map((drawing) => {
756
+ const { transform } = drawing;
757
+ if (transform == null)
758
+ return null;
759
+ const newTransform = { ...transform }, { left = 0, top = 0 } = transform;
760
+ return direction === Direction.UP ? newTransform.top = top - 1 : direction === Direction.DOWN ? newTransform.top = top + 1 : direction === Direction.LEFT ? newTransform.left = left - 1 : direction === Direction.RIGHT && (newTransform.left = left + 1), {
761
+ ...drawing,
762
+ transform: newTransform,
763
+ sheetTransform: transformToDrawingPosition(newTransform, selectionRenderService)
764
+ };
765
+ }).filter((drawing) => drawing != null);
766
+ return commandService.syncExecuteCommand(SetSheetDrawingCommand.id, {
767
+ unitId,
768
+ drawings: newDrawings
769
+ }) ? (commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]), !0) : !1;
770
+ }, "handler")
771
+ }, IMAGE_UPLOAD_ICON = "addition-and-subtraction-single", IMAGE_MENU_ID = "sheet.menu.image";
772
+ function ImageMenuFactory(accessor) {
773
+ return {
774
+ id: IMAGE_MENU_ID,
775
+ type: MenuItemType.SUBITEMS,
776
+ icon: IMAGE_UPLOAD_ICON,
777
+ tooltip: "sheetImage.title",
778
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
779
+ disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
780
+ };
781
+ }
782
+ __name(ImageMenuFactory, "ImageMenuFactory");
783
+ function UploadFloatImageMenuFactory(_accessor) {
784
+ return {
785
+ id: InsertFloatImageCommand.id,
786
+ title: "sheetImage.upload.float",
787
+ type: MenuItemType.BUTTON,
788
+ hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SHEET)
789
+ };
790
+ }
791
+ __name(UploadFloatImageMenuFactory, "UploadFloatImageMenuFactory");
792
+ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "univer-image-common-panel-grid", imageCommonPanelBorder = "univer-image-common-panel-border", imageCommonPanelTitle = "univer-image-common-panel-title", imageCommonPanelSubtitle = "univer-image-common-panel-subtitle", imageCommonPanelRow = "univer-image-common-panel-row", imageCommonPanelRowVertical = "univer-image-common-panel-row-vertical", imageCommonPanelColumn = "univer-image-common-panel-column", imageCommonPanelColumnCenter = "univer-image-common-panel-column-center", imageCommonPanelInline = "univer-image-common-panel-inline", imageCommonPanelSpan2 = "univer-image-common-panel-span2", imageCommonPanelSpan3 = "univer-image-common-panel-span3", imageCommonPanelInput = "univer-image-common-panel-input", sheetImageMenu = "univer-sheet-image-menu", sheetImageMenuInput = "univer-sheet-image-menu-input", styles = {
793
+ imageCommonPanel,
794
+ imageCommonPanelGrid,
795
+ imageCommonPanelBorder,
796
+ imageCommonPanelTitle,
797
+ imageCommonPanelSubtitle,
798
+ imageCommonPanelRow,
799
+ imageCommonPanelRowVertical,
800
+ imageCommonPanelColumn,
801
+ imageCommonPanelColumnCenter,
802
+ imageCommonPanelInline,
803
+ imageCommonPanelSpan2,
804
+ imageCommonPanelSpan3,
805
+ imageCommonPanelInput,
806
+ sheetImageMenu,
807
+ sheetImageMenuInput
808
+ }, SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
809
+ var _a11;
810
+ const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings } = props, drawingParam = drawings[0];
811
+ if (drawingParam == null)
812
+ return;
813
+ const { unitId } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
814
+ if (scene == null)
815
+ return;
816
+ const transformer = scene.getTransformerByCreate(), [anchorShow, setAnchorShow] = useState(!0), type = (_a11 = drawingParam.anchorType) != null ? _a11 : SheetDrawingAnchorType.Position, [value, setValue] = useState(type);
817
+ function getUpdateParams(objects, drawingManagerService2) {
818
+ const params = [];
819
+ return objects.forEach((object) => {
820
+ const { oKey } = object, searchParam = drawingManagerService2.getDrawingOKey(oKey);
821
+ if (searchParam == null)
822
+ return params.push(null), !0;
823
+ const { unitId: unitId2, subUnitId, drawingId, drawingType, anchorType, sheetTransform } = searchParam;
824
+ params.push({
825
+ unitId: unitId2,
826
+ subUnitId,
827
+ drawingId,
828
+ anchorType,
829
+ sheetTransform,
830
+ drawingType
831
+ });
832
+ }), params;
833
+ }
834
+ __name(getUpdateParams, "getUpdateParams"), useEffect(() => {
835
+ const onClearControlObserver = transformer.clearControl$.subscribe((changeSelf) => {
836
+ changeSelf === !0 && setAnchorShow(!1);
837
+ }), onChangeStartObserver = transformer.changeStart$.subscribe((state) => {
838
+ var _a12;
839
+ const { objects } = state, params = getUpdateParams(objects, drawingManagerService);
840
+ if (params.length === 0)
841
+ setAnchorShow(!1);
842
+ else if (params.length >= 1) {
843
+ setAnchorShow(!0);
844
+ const anchorType = ((_a12 = params[0]) == null ? void 0 : _a12.anchorType) || SheetDrawingAnchorType.Position;
845
+ setValue(anchorType);
846
+ }
847
+ });
848
+ return () => {
849
+ onChangeStartObserver.unsubscribe(), onClearControlObserver.unsubscribe();
850
+ };
851
+ }, []);
852
+ function handleChange(value2) {
853
+ setValue(value2);
854
+ const focusDrawings = drawingManagerService.getFocusDrawings();
855
+ if (focusDrawings.length === 0)
856
+ return;
857
+ const updateParams = focusDrawings.map((drawing) => ({
858
+ unitId: drawing.unitId,
859
+ subUnitId: drawing.subUnitId,
860
+ drawingId: drawing.drawingId,
861
+ anchorType: value2
862
+ }));
863
+ commandService.executeCommand(SetSheetDrawingCommand.id, {
864
+ unitId: focusDrawings[0].unitId,
865
+ drawings: updateParams
866
+ });
867
+ }
868
+ __name(handleChange, "handleChange");
869
+ const gridDisplay = /* @__PURE__ */ __name((isShow) => isShow ? "block" : "none", "gridDisplay");
870
+ return /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelGrid, styles.imageCommonPanelBorder), style: { display: gridDisplay(anchorShow) } }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("drawing-anchor.title")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelRow) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn) }, /* @__PURE__ */ React.createElement(RadioGroup, { value, onChange: handleChange, direction: "vertical" }, /* @__PURE__ */ React.createElement(Radio, { value: SheetDrawingAnchorType.Both }, localeService.t("drawing-anchor.both")), /* @__PURE__ */ React.createElement(Radio, { value: SheetDrawingAnchorType.Position }, localeService.t("drawing-anchor.position")), /* @__PURE__ */ React.createElement(Radio, { value: SheetDrawingAnchorType.None }, localeService.t("drawing-anchor.none"))))));
871
+ }, "SheetDrawingAnchor"), SheetDrawingPanel = /* @__PURE__ */ __name(() => {
872
+ const drawingManagerService = useDependency(IDrawingManagerService), focusDrawings = drawingManagerService.getFocusDrawings(), [drawings, setDrawings] = useState(focusDrawings);
873
+ return useEffect(() => {
874
+ const focusDispose = drawingManagerService.focus$.subscribe((drawings2) => {
875
+ setDrawings(drawings2);
876
+ });
877
+ return () => {
878
+ focusDispose.unsubscribe();
879
+ };
880
+ }, []), !!(drawings != null && drawings.length) && /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanel }, /* @__PURE__ */ React.createElement(DrawingCommonPanel, { drawings }), /* @__PURE__ */ React.createElement(SheetDrawingAnchor, { drawings }));
881
+ }, "SheetDrawingPanel"), menuSchema = {
882
+ [RibbonStartGroup.FORMULAS_INSERT]: {
883
+ [IMAGE_MENU_ID]: {
884
+ order: 3,
885
+ menuItemFactory: ImageMenuFactory,
886
+ [InsertFloatImageCommand.id]: {
887
+ order: 0,
888
+ menuItemFactory: UploadFloatImageMenuFactory
889
+ }
890
+ }
891
+ }
892
+ };
893
+ function whenSheetDrawingFocused(contextService) {
894
+ return !contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) && !contextService.getContextValue(EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
895
+ }
896
+ __name(whenSheetDrawingFocused, "whenSheetDrawingFocused");
897
+ const MoveDrawingDownShortcutItem = {
898
+ id: MoveDrawingsCommand.id,
899
+ description: "shortcut.sheet.drawing-move-down",
900
+ group: "4_sheet-drawing-view",
901
+ binding: KeyCode.ARROW_DOWN,
902
+ priority: 100,
903
+ preconditions: whenSheetDrawingFocused,
904
+ staticParameters: {
905
+ direction: Direction.DOWN
906
+ }
907
+ }, MoveDrawingUpShortcutItem = {
908
+ id: MoveDrawingsCommand.id,
909
+ description: "shortcut.sheet.drawing-move-up",
910
+ group: "4_sheet-drawing-view",
911
+ binding: KeyCode.ARROW_UP,
912
+ priority: 100,
913
+ preconditions: whenSheetDrawingFocused,
914
+ staticParameters: {
915
+ direction: Direction.UP
916
+ }
917
+ }, MoveDrawingLeftShortcutItem = {
918
+ id: MoveDrawingsCommand.id,
919
+ description: "shortcut.sheet.drawing-move-left",
920
+ group: "4_sheet-drawing-view",
921
+ binding: KeyCode.ARROW_LEFT,
922
+ priority: 100,
923
+ preconditions: whenSheetDrawingFocused,
924
+ staticParameters: {
925
+ direction: Direction.LEFT
926
+ }
927
+ }, MoveDrawingRightShortcutItem = {
928
+ id: MoveDrawingsCommand.id,
929
+ description: "shortcut.sheet.drawing-move-right",
930
+ group: "4_sheet-drawing-view",
931
+ binding: KeyCode.ARROW_RIGHT,
932
+ priority: 100,
933
+ preconditions: whenSheetDrawingFocused,
934
+ staticParameters: {
935
+ direction: Direction.RIGHT
936
+ }
937
+ }, DeleteDrawingsShortcutItem = {
938
+ id: DeleteDrawingsCommand.id,
939
+ description: "shortcut.sheet.drawing-delete",
940
+ group: "4_sheet-drawing-view",
941
+ // when focusing on any other input tag do not trigger this shortcut
942
+ preconditions: whenSheetDrawingFocused,
943
+ binding: KeyCode.DELETE,
944
+ mac: KeyCode.BACKSPACE
945
+ };
946
+ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
947
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
948
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
949
+ return kind && result && __defProp$6(target, key, result), result;
950
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a4;
951
+ let SheetDrawingUIController = (_a4 = class extends Disposable {
952
+ constructor(_componentManager, _menuManagerService, _commandService, _shortcutService) {
953
+ super(), this._componentManager = _componentManager, this._menuManagerService = _menuManagerService, this._commandService = _commandService, this._shortcutService = _shortcutService, this._init();
954
+ }
955
+ _initCustomComponents() {
956
+ const componentManager = this._componentManager;
957
+ this.disposeWithMe(componentManager.register(IMAGE_UPLOAD_ICON, AddImageSingle)), this.disposeWithMe(componentManager.register(COMPONENT_SHEET_DRAWING_PANEL, SheetDrawingPanel));
958
+ }
959
+ _initMenus() {
960
+ this._menuManagerService.mergeMenu(menuSchema);
961
+ }
962
+ _initCommands() {
963
+ [
964
+ InsertFloatImageCommand,
965
+ InsertSheetDrawingCommand,
966
+ RemoveSheetDrawingCommand,
967
+ SetSheetDrawingCommand,
968
+ SidebarSheetDrawingOperation,
969
+ ClearSheetDrawingTransformerOperation,
970
+ EditSheetDrawingOperation,
971
+ GroupSheetDrawingCommand,
972
+ UngroupSheetDrawingCommand,
973
+ MoveDrawingsCommand,
974
+ DeleteDrawingsCommand,
975
+ SetDrawingArrangeCommand
976
+ ].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
977
+ }
978
+ _initShortcuts() {
979
+ [
980
+ // sheet drawing shortcuts
981
+ MoveDrawingDownShortcutItem,
982
+ MoveDrawingUpShortcutItem,
983
+ MoveDrawingLeftShortcutItem,
984
+ MoveDrawingRightShortcutItem,
985
+ DeleteDrawingsShortcutItem
986
+ ].forEach((item) => {
987
+ this.disposeWithMe(this._shortcutService.registerShortcut(item));
988
+ });
989
+ }
990
+ _init() {
991
+ this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
992
+ }
993
+ }, __name(_a4, "SheetDrawingUIController"), _a4);
994
+ SheetDrawingUIController = __decorateClass$6([
995
+ __decorateParam$6(0, Inject(ComponentManager)),
996
+ __decorateParam$6(1, IMenuManagerService),
997
+ __decorateParam$6(2, ICommandService),
998
+ __decorateParam$6(3, IShortcutService)
999
+ ], SheetDrawingUIController);
1000
+ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1001
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1002
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1003
+ return kind && result && __defProp$5(target, key, result), result;
1004
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a5;
1005
+ let SheetsDrawingCopyPasteController = (_a5 = class extends Disposable {
1006
+ constructor(_sheetClipboardService, _renderManagerService, _sheetDrawingService) {
1007
+ super();
1008
+ __publicField(this, "_copyInfo");
1009
+ this._sheetClipboardService = _sheetClipboardService, this._renderManagerService = _renderManagerService, this._sheetDrawingService = _sheetDrawingService, this._initCopyPaste();
1010
+ }
1011
+ _initCopyPaste() {
1012
+ this._sheetClipboardService.addClipboardHook({
1013
+ id: "SHEET_IMAGE_UI_PLUGIN",
1014
+ onBeforeCopy: /* @__PURE__ */ __name((unitId, subUnitId, range) => this._collect(unitId, subUnitId, range), "onBeforeCopy"),
1015
+ onPasteCells: /* @__PURE__ */ __name((pasteFrom, pasteTo, data, payload) => {
1016
+ const { copyType = COPY_TYPE.COPY, pasteType } = payload, { range: copyRange } = pasteFrom || {}, { range: pastedRange, unitId, subUnitId } = pasteTo;
1017
+ return this._generateMutations(pastedRange, { copyType, pasteType, copyRange, unitId, subUnitId });
1018
+ }, "onPasteCells"),
1019
+ onPastePlainText: /* @__PURE__ */ __name((pasteTo, clipText) => ({ undos: [], redos: [] }), "onPastePlainText")
1020
+ });
1021
+ }
1022
+ _collect(unitId, subUnitId, range) {
1023
+ var _a11;
1024
+ const skeletonManagerService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
1025
+ if (!skeletonManagerService) return;
1026
+ const selectionRect = skeletonManagerService.attachRangeWithCoord(range);
1027
+ if (!selectionRect)
1028
+ return;
1029
+ const { startX, endX, startY, endY } = selectionRect, drawings = this._sheetDrawingService.getDrawingData(unitId, subUnitId), containedDrawings = [];
1030
+ Object.keys(drawings).forEach((drawingId) => {
1031
+ const drawing = drawings[drawingId], { transform } = drawing;
1032
+ if (drawing.anchorType !== SheetDrawingAnchorType.Both || !transform)
1033
+ return;
1034
+ const { left = 0, top = 0, width = 0, height = 0 } = transform, { drawingStartX, drawingEndX, drawingStartY, drawingEndY } = {
1035
+ drawingStartX: left,
1036
+ drawingEndX: left + width,
1037
+ drawingStartY: top,
1038
+ drawingEndY: top + height
1039
+ };
1040
+ startX <= drawingStartX && drawingEndX <= endX && startY <= drawingStartY && drawingEndY <= endY && containedDrawings.push(drawing);
1041
+ }), containedDrawings.length && (this._copyInfo = {
1042
+ drawings: containedDrawings,
1043
+ unitId,
1044
+ subUnitId
1045
+ });
1046
+ }
1047
+ // eslint-disable-next-line max-lines-per-function
1048
+ _generateMutations(pastedRange, copyInfo) {
1049
+ var _a11;
1050
+ if (!this._copyInfo)
1051
+ return { redos: [], undos: [] };
1052
+ if ([
1053
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,
1054
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,
1055
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,
1056
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA
1057
+ ].includes(
1058
+ copyInfo.pasteType
1059
+ ))
1060
+ return { redos: [], undos: [] };
1061
+ const { copyRange } = copyInfo;
1062
+ if (!copyRange)
1063
+ return { redos: [], undos: [] };
1064
+ const { drawings, unitId, subUnitId } = this._copyInfo, { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyRange, pastedRange]), { row: copyRow, col: copyCol } = mapFunc(vCopyRange.startRow, vCopyRange.startColumn), { row: pasteRow, col: pasteCol } = mapFunc(vPastedRange.startRow, vPastedRange.startColumn), skeletonManagerService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService);
1065
+ if (!skeletonManagerService)
1066
+ return { redos: [], undos: [] };
1067
+ const copyRect = skeletonManagerService.attachRangeWithCoord({
1068
+ startRow: copyRow,
1069
+ endRow: copyRow,
1070
+ startColumn: copyCol,
1071
+ endColumn: copyCol
1072
+ }), pasteRect = skeletonManagerService.attachRangeWithCoord({
1073
+ startRow: pasteRow,
1074
+ endRow: pasteRow,
1075
+ startColumn: pasteCol,
1076
+ endColumn: pasteCol
1077
+ });
1078
+ if (!copyRect || !pasteRect)
1079
+ return { redos: [], undos: [] };
1080
+ const redos = [], undos = [], leftOffset = pasteRect.startX - copyRect.startX, topOffset = pasteRect.startY - copyRect.startY, rowOffset = pasteRow - copyRow, columnOffset = pasteCol - copyCol, isCut = copyInfo.copyType === COPY_TYPE.CUT, { _sheetDrawingService } = this;
1081
+ return drawings.forEach((drawing) => {
1082
+ const { transform, sheetTransform } = drawing;
1083
+ if (!transform)
1084
+ return;
1085
+ const drawingObject = {
1086
+ ...drawing,
1087
+ unitId,
1088
+ subUnitId,
1089
+ drawingId: isCut ? drawing.drawingId : Tools.generateRandomId(),
1090
+ transform: {
1091
+ ...transform,
1092
+ left: transform.left + leftOffset,
1093
+ top: transform.top + topOffset
1094
+ },
1095
+ sheetTransform: {
1096
+ to: { ...sheetTransform.to, row: sheetTransform.to.row + rowOffset, column: sheetTransform.to.column + columnOffset },
1097
+ from: { ...sheetTransform.from, row: sheetTransform.from.row + rowOffset, column: sheetTransform.from.column + columnOffset }
1098
+ }
1099
+ };
1100
+ if (isCut) {
1101
+ const { undo, redo, objects } = _sheetDrawingService.getBatchUpdateOp([drawingObject]);
1102
+ redos.push({
1103
+ id: SetDrawingApplyMutation.id,
1104
+ params: {
1105
+ unitId,
1106
+ subUnitId,
1107
+ type: DrawingApplyType.UPDATE,
1108
+ op: redo,
1109
+ objects
1110
+ }
1111
+ }), undos.push({
1112
+ id: SetDrawingApplyMutation.id,
1113
+ params: {
1114
+ unitId,
1115
+ subUnitId,
1116
+ type: DrawingApplyType.UPDATE,
1117
+ op: undo,
1118
+ objects
1119
+ }
1120
+ });
1121
+ } else {
1122
+ const { undo, redo, objects } = _sheetDrawingService.getBatchAddOp([drawingObject]);
1123
+ redos.push({ id: SetDrawingApplyMutation.id, params: { op: redo, unitId, subUnitId, objects, type: DrawingApplyType.INSERT } }), undos.push({ id: SetDrawingApplyMutation.id, params: { op: undo, unitId, subUnitId, objects, type: DrawingApplyType.REMOVE } });
1124
+ }
1125
+ }), {
1126
+ redos,
1127
+ undos
1128
+ };
1129
+ }
1130
+ }, __name(_a5, "SheetsDrawingCopyPasteController"), _a5);
1131
+ SheetsDrawingCopyPasteController = __decorateClass$5([
1132
+ __decorateParam$5(0, ISheetClipboardService),
1133
+ __decorateParam$5(1, IRenderManagerService),
1134
+ __decorateParam$5(2, ISheetDrawingService)
1135
+ ], SheetsDrawingCopyPasteController);
1136
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1137
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1138
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1139
+ return kind && result && __defProp$4(target, key, result), result;
1140
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a6;
1141
+ let SheetDrawingPermissionController = (_a6 = class extends Disposable {
1142
+ constructor(_drawingManagerService, _renderManagerService, _permissionService, _univerInstanceService, _userManagerService) {
1143
+ super(), this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._univerInstanceService = _univerInstanceService, this._userManagerService = _userManagerService, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
1144
+ }
1145
+ _initDrawingVisible() {
1146
+ const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
1147
+ this.disposeWithMe(
1148
+ combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
1149
+ if (!workbook) {
1150
+ this._drawingManagerService.setDrawingVisible(!1);
1151
+ return;
1152
+ }
1153
+ workbook.activeSheet$.subscribe((sheet) => {
1154
+ if (!sheet) {
1155
+ this._drawingManagerService.setDrawingVisible(!1);
1156
+ return;
1157
+ }
1158
+ const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
1159
+ if (this._permissionService.composePermission([new WorkbookViewPermission(unitId).id, new WorksheetViewPermission(unitId, subUnitId).id]).every((permission) => permission.value))
1160
+ this._drawingManagerService.setDrawingVisible(!0);
1161
+ else {
1162
+ this._drawingManagerService.setDrawingVisible(!1);
1163
+ const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
1164
+ if (scene == null)
1165
+ return;
1166
+ scene.getAllObjectsByOrder().forEach((object) => {
1167
+ object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
1168
+ });
1169
+ }
1170
+ });
1171
+ })
1172
+ );
1173
+ }
1174
+ _initDrawingEditable() {
1175
+ const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
1176
+ this.disposeWithMe(
1177
+ combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
1178
+ if (!workbook) {
1179
+ this._drawingManagerService.setDrawingEditable(!1);
1180
+ return;
1181
+ }
1182
+ workbook.activeSheet$.subscribe((sheet) => {
1183
+ if (!sheet) {
1184
+ this._drawingManagerService.setDrawingEditable(!1);
1185
+ return;
1186
+ }
1187
+ const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
1188
+ if (this._permissionService.composePermission([new WorkbookEditablePermission(unitId).id, new WorksheetEditPermission(unitId, subUnitId).id]).every((permission) => permission.value))
1189
+ this._drawingManagerService.setDrawingEditable(!0);
1190
+ else {
1191
+ this._drawingManagerService.setDrawingEditable(!1);
1192
+ const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject = this._renderManagerService.getRenderById(unitId2), scene = renderObject == null ? void 0 : renderObject.scene;
1193
+ if (scene == null)
1194
+ return;
1195
+ scene.getAllObjectsByOrder().forEach((object) => {
1196
+ object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
1197
+ });
1198
+ }
1199
+ });
1200
+ })
1201
+ );
1202
+ }
1203
+ _initViewPermissionChange() {
1204
+ const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
1205
+ this.disposeWithMe(
1206
+ combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
1207
+ workbook && workbook.activeSheet$.subscribe((sheet) => {
1208
+ var _a11;
1209
+ if (!sheet)
1210
+ return;
1211
+ const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
1212
+ let initialViewPermission = !0;
1213
+ const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
1214
+ if (scene == null)
1215
+ return;
1216
+ const transformer = scene.getTransformerByCreate(), worksheetViewPermission$ = this._permissionService.composePermission$([new WorkbookViewPermission(unitId).id, new WorksheetViewPermission(unitId, subUnitId).id]).pipe(map((permissions) => permissions.every((item) => item.value)));
1217
+ worksheetViewPermission$ == null || worksheetViewPermission$.pipe(
1218
+ filter((permission) => permission !== initialViewPermission),
1219
+ distinctUntilChanged()
1220
+ ).subscribe({
1221
+ next: /* @__PURE__ */ __name((permission) => {
1222
+ initialViewPermission = permission, this._drawingManagerService.setDrawingVisible(permission);
1223
+ const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
1224
+ permission ? this._drawingManagerService.addNotification(drawingDataValues) : (objects.forEach((object) => {
1225
+ object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.removeObject(object);
1226
+ }), transformer.clearSelectedObjects());
1227
+ }, "next")
1228
+ }), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetViewPermission(unitId, subUnitId).id)) == null || _a11.pipe(
1229
+ filter((permission) => permission.value !== initialViewPermission),
1230
+ distinctUntilChanged()
1231
+ ).subscribe({
1232
+ complete: /* @__PURE__ */ __name(() => {
1233
+ initialViewPermission = !0, this._drawingManagerService.setDrawingVisible(!0);
1234
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
1235
+ this._drawingManagerService.addNotification(drawingDataValues);
1236
+ }, "complete")
1237
+ });
1238
+ });
1239
+ })
1240
+ );
1241
+ }
1242
+ _initEditPermissionChange() {
1243
+ const workbook$ = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
1244
+ this.disposeWithMe(
1245
+ combineLatest([workbook$, this._userManagerService.currentUser$]).subscribe(([workbook, _]) => {
1246
+ workbook && workbook.activeSheet$.subscribe((sheet) => {
1247
+ var _a11;
1248
+ if (!sheet)
1249
+ return;
1250
+ const unitId = workbook.getUnitId(), subUnitId = sheet.getSheetId();
1251
+ let initialEditPermission = !0;
1252
+ const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
1253
+ if (scene == null)
1254
+ return;
1255
+ const transformer = scene.getTransformerByCreate(), composeWorksheetEditPermission = this._permissionService.composePermission$([new WorkbookEditablePermission(unitId).id, new WorksheetEditPermission(unitId, subUnitId).id]).pipe(map((permissions) => permissions.every((item) => item.value)));
1256
+ composeWorksheetEditPermission == null || composeWorksheetEditPermission.pipe(
1257
+ filter((permission) => permission !== initialEditPermission),
1258
+ distinctUntilChanged()
1259
+ ).subscribe({
1260
+ next: /* @__PURE__ */ __name((permission) => {
1261
+ initialEditPermission = permission, this._drawingManagerService.setDrawingEditable(permission);
1262
+ const objects = scene.getAllObjectsByOrder(), drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), drawingDataValues = Object.values(drawingData);
1263
+ permission ? (objects.forEach((object) => {
1264
+ object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.attachTransformerTo(object);
1265
+ }), this._drawingManagerService.addNotification(drawingDataValues)) : (objects.forEach((object) => {
1266
+ object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene.detachTransformerFrom(object);
1267
+ }), transformer.clearSelectedObjects());
1268
+ }, "next")
1269
+ }), (_a11 = this._permissionService.getPermissionPoint$(new WorksheetEditPermission(unitId, subUnitId).id)) == null || _a11.pipe(
1270
+ filter((permission) => permission.value !== initialEditPermission),
1271
+ distinctUntilChanged()
1272
+ ).subscribe({
1273
+ complete: /* @__PURE__ */ __name(() => {
1274
+ initialEditPermission = !0;
1275
+ const unitId2 = workbook.getUnitId(), subUnitId2 = sheet.getSheetId(), drawingData = this._drawingManagerService.getDrawingData(unitId2, subUnitId2), drawingDataValues = Object.values(drawingData), renderObject2 = this._renderManagerService.getRenderById(unitId2), scene2 = renderObject2 == null ? void 0 : renderObject2.scene;
1276
+ if (scene2 == null)
1277
+ return;
1278
+ this._drawingManagerService.setDrawingEditable(!0), scene2.getAllObjectsByOrder().forEach((object) => {
1279
+ object.classType === RENDER_CLASS_TYPE.IMAGE && drawingDataValues.some((item) => object.oKey.includes(item.drawingId)) && scene2.detachTransformerFrom(object);
1280
+ });
1281
+ }, "complete")
1282
+ });
1283
+ });
1284
+ })
1285
+ );
1286
+ }
1287
+ }, __name(_a6, "SheetDrawingPermissionController"), _a6);
1288
+ SheetDrawingPermissionController = __decorateClass$4([
1289
+ __decorateParam$4(0, IDrawingManagerService),
1290
+ __decorateParam$4(1, IRenderManagerService),
1291
+ __decorateParam$4(2, IPermissionService),
1292
+ __decorateParam$4(3, IUniverInstanceService),
1293
+ __decorateParam$4(4, Inject(UserManagerService))
1294
+ ], SheetDrawingPermissionController);
1295
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1296
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1297
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1298
+ return kind && result && __defProp$3(target, key, result), result;
1299
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
1300
+ let SheetDrawingPrintingController = (_a7 = class extends Disposable {
1301
+ constructor(_sheetPrintInterceptorService, _drawingRenderService, _drawingManagerService, _renderManagerService) {
1302
+ super(), this._sheetPrintInterceptorService = _sheetPrintInterceptorService, this._drawingRenderService = _drawingRenderService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._initPrinting();
1303
+ }
1304
+ _initPrinting() {
1305
+ this.disposeWithMe(
1306
+ this._sheetPrintInterceptorService.interceptor.intercept(
1307
+ this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
1308
+ {
1309
+ handler: /* @__PURE__ */ __name((_param, pos, next) => {
1310
+ const { unitId, scene, subUnitId } = pos, unitData = this._drawingManagerService.getDrawingDataForUnit(unitId), subUnitData = unitData == null ? void 0 : unitData[subUnitId];
1311
+ return subUnitData && subUnitData.order.forEach((id) => {
1312
+ this._drawingRenderService.renderDrawing(subUnitData.data[id], scene);
1313
+ }), next();
1314
+ }, "handler")
1315
+ }
1316
+ )
1317
+ ), this.disposeWithMe(
1318
+ this._sheetPrintInterceptorService.interceptor.intercept(
1319
+ this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
1320
+ {
1321
+ handler: /* @__PURE__ */ __name((range, pos, next) => {
1322
+ const { unitId, subUnitId } = pos, renderer = this._renderManagerService.getRenderById(unitId);
1323
+ if (!renderer)
1324
+ return next(range);
1325
+ const skeleton = renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1326
+ if (!skeleton)
1327
+ return next(range);
1328
+ const unitData = this._drawingManagerService.getDrawingDataForUnit(unitId), subUnitData = unitData == null ? void 0 : unitData[pos.subUnitId];
1329
+ if (!subUnitData)
1330
+ return next(range);
1331
+ const { scaleX, scaleY } = renderer.scene, newRange = range ? { ...range } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, data = subUnitData.order.map((key) => subUnitData.data[key]).filter((item) => item.drawingType !== DrawingTypeEnum.DRAWING_DOM);
1332
+ return data.length ? (data.forEach((param) => {
1333
+ if (!param.groupId && param.transform && Tools.isDefine(param.transform.left) && Tools.isDefine(param.transform.top) && Tools.isDefine(param.transform.width) && Tools.isDefine(param.transform.height)) {
1334
+ const start = skeleton.skeleton.getCellPositionByOffset(param.transform.left, param.transform.top, scaleX, scaleY, { x: 0, y: 0 }), end = skeleton.skeleton.getCellPositionByOffset(param.transform.left + param.transform.width, param.transform.top + param.transform.height, scaleX, scaleY, { x: 0, y: 0 });
1335
+ start.column < newRange.startColumn && (newRange.startColumn = start.column), start.row < newRange.startRow && (newRange.startRow = start.row), newRange.endRow < end.row && (newRange.endRow = end.row), newRange.endColumn < end.column && (newRange.endColumn = end.column);
1336
+ }
1337
+ }), next(newRange)) : next(range);
1338
+ }, "handler")
1339
+ }
1340
+ )
1341
+ );
1342
+ }
1343
+ }, __name(_a7, "SheetDrawingPrintingController"), _a7);
1344
+ SheetDrawingPrintingController = __decorateClass$3([
1345
+ __decorateParam$3(0, Inject(SheetPrintInterceptorService)),
1346
+ __decorateParam$3(1, Inject(DrawingRenderService)),
1347
+ __decorateParam$3(2, IDrawingManagerService),
1348
+ __decorateParam$3(3, IRenderManagerService)
1349
+ ], SheetDrawingPrintingController);
1350
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1351
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1352
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1353
+ return kind && result && __defProp$2(target, key, result), result;
1354
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2");
1355
+ const UPDATE_COMMANDS = [
1356
+ InsertRowCommand.id,
1357
+ InsertColCommand.id,
1358
+ RemoveRowCommand.id,
1359
+ RemoveColCommand.id,
1360
+ DeleteRangeMoveLeftCommand.id,
1361
+ DeleteRangeMoveUpCommand.id,
1362
+ InsertRangeMoveDownCommand.id,
1363
+ InsertRangeMoveRightCommand.id,
1364
+ DeltaRowHeightCommand.id,
1365
+ SetRowHeightCommand.id,
1366
+ DeltaColumnWidthCommand.id,
1367
+ SetColWidthCommand.id,
1368
+ SetRowHiddenCommand.id,
1369
+ SetSpecificRowsVisibleCommand.id,
1370
+ SetSpecificColsVisibleCommand.id,
1371
+ SetColHiddenCommand.id,
1372
+ MoveColsCommand.id,
1373
+ MoveRowsCommand.id,
1374
+ MoveRangeCommand.id
1375
+ ], REFRESH_MUTATIONS = [
1376
+ SetRowVisibleMutation.id,
1377
+ SetRowHiddenMutation.id,
1378
+ SetColVisibleMutation.id,
1379
+ SetColHiddenMutation.id,
1380
+ SetWorksheetRowHeightMutation.id,
1381
+ SetWorksheetColWidthMutation.id
1382
+ ];
1383
+ var _a8;
1384
+ let SheetDrawingTransformAffectedController = (_a8 = class extends Disposable {
1385
+ constructor(_context, _renderManagerService, _commandService, _selectionRenderService, _skeletonManagerService, _sheetInterceptorService, _sheetDrawingService, _drawingManagerService, _univerInstanceService) {
1386
+ super(), this._context = _context, this._renderManagerService = _renderManagerService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._skeletonManagerService = _skeletonManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._sheetDrawingService = _sheetDrawingService, this._drawingManagerService = _drawingManagerService, this._univerInstanceService = _univerInstanceService, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
1387
+ }
1388
+ _sheetInterceptorListener() {
1389
+ this.disposeWithMe(
1390
+ this._sheetInterceptorService.interceptCommand({
1391
+ getMutations: /* @__PURE__ */ __name((commandInfo) => {
1392
+ if (!UPDATE_COMMANDS.includes(commandInfo.id))
1393
+ return { redos: [], undos: [] };
1394
+ if (commandInfo.params == null)
1395
+ return { redos: [], undos: [] };
1396
+ const cId = commandInfo.id;
1397
+ if (cId === InsertRowCommand.id)
1398
+ return this._moveRowInterceptor(commandInfo.params, "insert");
1399
+ if ([MoveColsCommand.id, MoveRowsCommand.id, MoveRangeCommand.id].includes(cId))
1400
+ return this._moveRangeInterceptor(commandInfo.params);
1401
+ if (cId === InsertColCommand.id)
1402
+ return this._moveColInterceptor(commandInfo.params, "insert");
1403
+ if (cId === RemoveRowCommand.id)
1404
+ return this._moveRowInterceptor(commandInfo.params, "remove");
1405
+ if (cId === RemoveColCommand.id)
1406
+ return this._moveColInterceptor(commandInfo.params, "remove");
1407
+ if (cId === DeleteRangeMoveLeftCommand.id) {
1408
+ const { range } = commandInfo.params;
1409
+ return this._getRangeMoveUndo(
1410
+ range,
1411
+ 0
1412
+ /* deleteLeft */
1413
+ );
1414
+ } else if (cId === DeleteRangeMoveUpCommand.id) {
1415
+ const { range } = commandInfo.params;
1416
+ return this._getRangeMoveUndo(
1417
+ range,
1418
+ 1
1419
+ /* deleteUp */
1420
+ );
1421
+ } else if (cId === InsertRangeMoveDownCommand.id) {
1422
+ const { range } = commandInfo.params;
1423
+ return this._getRangeMoveUndo(
1424
+ range,
1425
+ 2
1426
+ /* insertDown */
1427
+ );
1428
+ } else if (cId === InsertRangeMoveRightCommand.id) {
1429
+ const { range } = commandInfo.params;
1430
+ return this._getRangeMoveUndo(
1431
+ range,
1432
+ 3
1433
+ /* insertRight */
1434
+ );
1435
+ } else if (cId === SetRowHiddenCommand.id || cId === SetSpecificRowsVisibleCommand.id) {
1436
+ const params = commandInfo.params, { unitId, subUnitId, ranges } = params;
1437
+ return this._getDrawingUndoForRowVisible(unitId, subUnitId, ranges);
1438
+ } else if (cId === SetSpecificColsVisibleCommand.id || cId === SetColHiddenCommand.id) {
1439
+ const params = commandInfo.params, { unitId, subUnitId, ranges } = params;
1440
+ return this._getDrawingUndoForColVisible(unitId, subUnitId, ranges);
1441
+ } else if (cId === DeltaRowHeightCommand.id || cId === SetRowHeightCommand.id || cId === DeltaColumnWidthCommand.id || cId === SetColWidthCommand.id) {
1442
+ const params = commandInfo.params, { unitId, subUnitId, ranges } = params, isRow = cId === DeltaRowHeightCommand.id || cId === SetRowHeightCommand.id;
1443
+ return this._getDrawingUndoForRowAndColSize(unitId, subUnitId, ranges, isRow);
1444
+ }
1445
+ return { redos: [], undos: [] };
1446
+ }, "getMutations")
1447
+ })
1448
+ );
1449
+ }
1450
+ _getRangeMoveUndo(range, type) {
1451
+ const newParams = getSheetCommandTarget(this._univerInstanceService);
1452
+ if (newParams == null)
1453
+ return { redos: [], undos: [] };
1454
+ const unitId = newParams.unitId, subUnitId = newParams.subUnitId, redos = [], undos = [], drawingData = this._sheetDrawingService.getDrawingData(unitId, subUnitId), updateDrawings = [], deleteDrawings = [];
1455
+ if (Object.keys(drawingData).forEach((drawingId) => {
1456
+ const drawing = drawingData[drawingId], { updateDrawings: updateDrawingsPart, deleteDrawings: deleteDrawingsPart } = this._getUpdateOrDeleteDrawings(range, type, drawing);
1457
+ updateDrawings.push(...updateDrawingsPart), deleteDrawings.push(...deleteDrawingsPart);
1458
+ }), updateDrawings.length === 0 && deleteDrawings.length === 0)
1459
+ return { redos: [], undos: [] };
1460
+ if (updateDrawings.length > 0) {
1461
+ const updateJsonOp = this._sheetDrawingService.getBatchUpdateOp(updateDrawings), { undo, redo, objects } = updateJsonOp;
1462
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } });
1463
+ }
1464
+ if (deleteDrawings.length > 0) {
1465
+ const deleteJsonOp = this._sheetDrawingService.getBatchRemoveOp(deleteDrawings), deleteUndo = deleteJsonOp.undo, deleteRedo = deleteJsonOp.redo, deleteObjects = deleteJsonOp.objects;
1466
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: deleteRedo, objects: deleteObjects, type: DrawingApplyType.REMOVE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: deleteUndo, objects: deleteObjects, type: DrawingApplyType.INSERT } });
1467
+ }
1468
+ return redos.push({ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }), undos.push({ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }), {
1469
+ redos,
1470
+ undos
1471
+ };
1472
+ }
1473
+ _getUpdateOrDeleteDrawings(range, type, drawing) {
1474
+ const updateDrawings = [], deleteDrawings = [], { sheetTransform, anchorType = SheetDrawingAnchorType.Position, transform, unitId, subUnitId, drawingId } = drawing, { from, to } = sheetTransform, { row: fromRow, column: fromColumn } = from, { row: toRow, column: toColumn } = to;
1475
+ if (sheetTransform == null || transform == null)
1476
+ return {
1477
+ updateDrawings,
1478
+ deleteDrawings
1479
+ };
1480
+ const { startRow, endRow, startColumn, endColumn } = range;
1481
+ let newSheetTransform = null, newTransform = null;
1482
+ if (type === 0 && fromRow >= startRow && toRow <= endRow)
1483
+ if (fromColumn >= startColumn && toColumn <= endColumn)
1484
+ deleteDrawings.push({ unitId, subUnitId, drawingId });
1485
+ else {
1486
+ const param = this._shrinkCol(sheetTransform, transform, startColumn, endColumn, anchorType);
1487
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1488
+ }
1489
+ else if (type === 1 && fromColumn >= startColumn && toColumn <= endColumn)
1490
+ if (fromRow >= startRow && toRow <= endRow)
1491
+ deleteDrawings.push({ unitId, subUnitId, drawingId });
1492
+ else {
1493
+ const param = this._shrinkRow(sheetTransform, transform, startRow, endRow, anchorType);
1494
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1495
+ }
1496
+ else if (type === 2) {
1497
+ const param = this._expandRow(sheetTransform, transform, startRow, endRow, anchorType);
1498
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1499
+ } else if (type === 3) {
1500
+ const param = this._expandCol(sheetTransform, transform, startColumn, endColumn, anchorType);
1501
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1502
+ }
1503
+ if (newSheetTransform != null && newTransform != null) {
1504
+ const newTransform2 = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1505
+ updateDrawings.push({ ...drawing, sheetTransform: newSheetTransform, transform: newTransform2 });
1506
+ }
1507
+ return { updateDrawings, deleteDrawings };
1508
+ }
1509
+ _remainDrawingSize(transform, updateDrawings, drawing) {
1510
+ const newSheetTransform = transformToDrawingPosition({ ...transform }, this._selectionRenderService);
1511
+ newSheetTransform != null && updateDrawings.push({
1512
+ ...drawing,
1513
+ sheetTransform: newSheetTransform
1514
+ });
1515
+ }
1516
+ // eslint-disable-next-line max-lines-per-function
1517
+ _getDrawingUndoForColVisible(unitId, subUnitId, ranges) {
1518
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), updateDrawings = [], preUpdateDrawings = [];
1519
+ if (Object.keys(drawingData).forEach((drawingId) => {
1520
+ const drawing = drawingData[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
1521
+ if (anchorType === SheetDrawingAnchorType.None)
1522
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1523
+ else {
1524
+ const { from, to } = sheetTransform, { row: fromRow, column: fromColumn } = from, { row: toRow, column: toColumn } = to;
1525
+ for (let i = 0; i < ranges.length; i++) {
1526
+ const range = ranges[i], { startRow, endRow, startColumn, endColumn } = range;
1527
+ if (toColumn < startColumn)
1528
+ continue;
1529
+ if (anchorType === SheetDrawingAnchorType.Position) {
1530
+ let newSheetTransform2 = null, newTransform2 = null;
1531
+ if (fromColumn >= startColumn && fromColumn <= endColumn) {
1532
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: fromColumn, endColumn, startRow: from.row, endRow: to.row });
1533
+ if (selectionCell == null)
1534
+ return;
1535
+ newTransform2 = { ...transform, left: selectionCell.startX };
1536
+ }
1537
+ if (newTransform2 != null && (newSheetTransform2 = transformToDrawingPosition(newTransform2, this._selectionRenderService), newSheetTransform2 != null && newTransform2 != null)) {
1538
+ updateDrawings.push({ ...drawing, sheetTransform: newSheetTransform2, transform: newTransform2 });
1539
+ break;
1540
+ }
1541
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1542
+ continue;
1543
+ }
1544
+ if (fromColumn >= startColumn && toColumn <= endColumn)
1545
+ continue;
1546
+ let newSheetTransform = null, newTransform = null;
1547
+ if (fromColumn >= startColumn && fromColumn <= endColumn) {
1548
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: fromColumn, endColumn, startRow: from.row, endRow: to.row });
1549
+ if (selectionCell == null)
1550
+ return;
1551
+ newTransform = {
1552
+ ...transform,
1553
+ left: (selectionCell == null ? void 0 : selectionCell.startX) || 0,
1554
+ width: ((transform == null ? void 0 : transform.width) || 0) - selectionCell.endX + selectionCell.startX
1555
+ };
1556
+ } else if (toColumn >= startColumn && toColumn <= endColumn) {
1557
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn, endColumn: toColumn, startRow: from.row, endRow: to.row });
1558
+ if (selectionCell == null)
1559
+ return;
1560
+ newTransform = {
1561
+ ...transform,
1562
+ left: selectionCell.startX - ((transform == null ? void 0 : transform.width) || 0)
1563
+ };
1564
+ } else {
1565
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn, endColumn, startRow: from.row, endRow: to.row });
1566
+ if (selectionCell == null)
1567
+ return;
1568
+ if (newTransform = {
1569
+ ...transform,
1570
+ width: ((transform == null ? void 0 : transform.width) || 0) - selectionCell.endX + selectionCell.startX
1571
+ }, newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService), newSheetTransform != null && newTransform != null) {
1572
+ preUpdateDrawings.push({ ...drawing, sheetTransform: newSheetTransform, transform: newTransform });
1573
+ break;
1574
+ }
1575
+ }
1576
+ if (newTransform != null && (newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService)), newTransform != null && newSheetTransform != null) {
1577
+ updateDrawings.push({ ...drawing, sheetTransform: newSheetTransform, transform: newTransform });
1578
+ break;
1579
+ } else
1580
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1581
+ }
1582
+ }
1583
+ }), updateDrawings.length === 0 && preUpdateDrawings.length === 0)
1584
+ return { redos: [], undos: [] };
1585
+ const { redos, undos } = this._createUndoAndRedoMutation(unitId, subUnitId, updateDrawings), preRedos = [], preUndos = [];
1586
+ if (preUpdateDrawings.length > 0) {
1587
+ const { redos: redos2, undos: undos2 } = this._createUndoAndRedoMutation(unitId, subUnitId, preUpdateDrawings);
1588
+ preRedos.push(...redos2), preUndos.push(...undos2);
1589
+ }
1590
+ return {
1591
+ redos,
1592
+ undos,
1593
+ preRedos,
1594
+ preUndos
1595
+ };
1596
+ }
1597
+ _createUndoAndRedoMutation(unitId, subUnitId, updateDrawings) {
1598
+ const updateJsonOp = this._sheetDrawingService.getBatchUpdateOp(updateDrawings), { undo, redo, objects } = updateJsonOp, redos = [
1599
+ { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } },
1600
+ { id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }
1601
+ ], undos = [
1602
+ { id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } },
1603
+ { id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }
1604
+ ];
1605
+ return {
1606
+ redos,
1607
+ undos
1608
+ };
1609
+ }
1610
+ // eslint-disable-next-line max-lines-per-function
1611
+ _getDrawingUndoForRowVisible(unitId, subUnitId, ranges) {
1612
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), updateDrawings = [], preUpdateDrawings = [];
1613
+ if (Object.keys(drawingData).forEach((drawingId) => {
1614
+ const drawing = drawingData[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
1615
+ if (anchorType === SheetDrawingAnchorType.None)
1616
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1617
+ else {
1618
+ const { from, to } = sheetTransform, { row: fromRow, column: fromColumn } = from, { row: toRow, column: toColumn } = to;
1619
+ for (let i = 0; i < ranges.length; i++) {
1620
+ const range = ranges[i], { startRow, endRow, startColumn, endColumn } = range;
1621
+ if (toRow < startRow)
1622
+ continue;
1623
+ if (anchorType === SheetDrawingAnchorType.Position) {
1624
+ let newSheetTransform2 = null, newTransform2 = null;
1625
+ if (fromRow >= startRow && fromRow <= endRow) {
1626
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: from.column, endColumn: to.column, startRow: fromRow, endRow });
1627
+ if (selectionCell == null)
1628
+ return;
1629
+ newTransform2 = { ...transform, top: selectionCell.startY };
1630
+ }
1631
+ if (newTransform2 != null && (newSheetTransform2 = transformToDrawingPosition(newTransform2, this._selectionRenderService), newSheetTransform2 != null && newTransform2 != null)) {
1632
+ updateDrawings.push({ ...drawing, sheetTransform: newSheetTransform2, transform: newTransform2 });
1633
+ break;
1634
+ }
1635
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1636
+ continue;
1637
+ }
1638
+ if (fromRow >= startRow && toRow <= endRow)
1639
+ continue;
1640
+ let newSheetTransform = null, newTransform = null;
1641
+ if (fromRow >= startRow && fromRow <= endRow) {
1642
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: from.column, endColumn: to.column, startRow: fromRow, endRow });
1643
+ if (selectionCell == null)
1644
+ return;
1645
+ newTransform = {
1646
+ ...transform,
1647
+ top: (selectionCell == null ? void 0 : selectionCell.startY) || 0,
1648
+ height: ((transform == null ? void 0 : transform.height) || 0) - selectionCell.endY + selectionCell.startY
1649
+ };
1650
+ } else if (toRow >= startRow && toRow <= endRow) {
1651
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: from.column, endColumn: to.column, startRow, endRow: toRow });
1652
+ if (selectionCell == null)
1653
+ return;
1654
+ newTransform = {
1655
+ ...transform,
1656
+ top: selectionCell.startY - ((transform == null ? void 0 : transform.height) || 0)
1657
+ };
1658
+ } else {
1659
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: from.column, endColumn: to.column, startRow, endRow });
1660
+ if (selectionCell == null)
1661
+ return;
1662
+ if (newTransform = {
1663
+ ...transform,
1664
+ height: ((transform == null ? void 0 : transform.height) || 0) - selectionCell.endY + selectionCell.startY
1665
+ }, newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService), newSheetTransform != null && newTransform != null) {
1666
+ preUpdateDrawings.push({ ...drawing, sheetTransform: newSheetTransform, transform: newTransform });
1667
+ break;
1668
+ }
1669
+ }
1670
+ if (newTransform != null && (newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService)), newTransform != null && newSheetTransform != null) {
1671
+ updateDrawings.push({ ...drawing, sheetTransform: newSheetTransform, transform: newTransform });
1672
+ break;
1673
+ } else
1674
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1675
+ }
1676
+ }
1677
+ }), updateDrawings.length === 0 && preUpdateDrawings.length === 0)
1678
+ return { redos: [], undos: [] };
1679
+ const { redos, undos } = this._createUndoAndRedoMutation(unitId, subUnitId, updateDrawings), preRedos = [], preUndos = [];
1680
+ if (preUpdateDrawings.length > 0) {
1681
+ const { redos: redos2, undos: undos2 } = this._createUndoAndRedoMutation(unitId, subUnitId, preUpdateDrawings);
1682
+ preRedos.push(...redos2), preUndos.push(...undos2);
1683
+ }
1684
+ return {
1685
+ redos,
1686
+ undos,
1687
+ preRedos,
1688
+ preUndos
1689
+ };
1690
+ }
1691
+ _getDrawingUndoForRowAndColSize(unitId, subUnitId, ranges, isRow) {
1692
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), updateDrawings = [];
1693
+ return Object.keys(drawingData).forEach((drawingId) => {
1694
+ const drawing = drawingData[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
1695
+ if (anchorType === SheetDrawingAnchorType.None)
1696
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1697
+ else {
1698
+ const { from, to } = sheetTransform, { row: fromRow, column: fromColumn } = from, { row: toRow, column: toColumn } = to;
1699
+ for (let i = 0; i < ranges.length; i++) {
1700
+ const range = ranges[i], { startRow, endRow, startColumn, endColumn } = range;
1701
+ if (toRow < startRow || toColumn < startColumn)
1702
+ continue;
1703
+ if (anchorType === SheetDrawingAnchorType.Position && (fromRow <= startRow && toRow >= endRow || fromColumn <= startColumn && toColumn >= endColumn)) {
1704
+ this._remainDrawingSize(transform, updateDrawings, drawing);
1705
+ continue;
1706
+ }
1707
+ const newTransform = drawingPositionToTransform(
1708
+ { ...sheetTransform },
1709
+ this._selectionRenderService,
1710
+ this._skeletonManagerService
1711
+ );
1712
+ if (newTransform != null) {
1713
+ updateDrawings.push({
1714
+ ...drawing,
1715
+ transform: newTransform
1716
+ });
1717
+ break;
1718
+ }
1719
+ }
1720
+ }
1721
+ }), updateDrawings.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(unitId, subUnitId, updateDrawings);
1722
+ }
1723
+ _getUnitIdAndSubUnitId(params, type) {
1724
+ let unitId, subUnitId;
1725
+ if (type === "insert")
1726
+ unitId = params.unitId, subUnitId = params.subUnitId;
1727
+ else {
1728
+ const newParams = getSheetCommandTarget(this._univerInstanceService);
1729
+ if (newParams == null)
1730
+ return;
1731
+ unitId = newParams.unitId, subUnitId = newParams.subUnitId;
1732
+ }
1733
+ return { unitId, subUnitId };
1734
+ }
1735
+ _moveRangeInterceptor(params) {
1736
+ var _a11, _b;
1737
+ const { toRange, fromRange } = params, target = getSheetCommandTarget(this._univerInstanceService);
1738
+ if (!target)
1739
+ return { redos: [], undos: [] };
1740
+ const { unitId, subUnitId } = target, skeleton = (_b = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService)) == null ? void 0 : _b.getCurrentSkeleton();
1741
+ if (!skeleton)
1742
+ return { redos: [], undos: [] };
1743
+ const selectionRect = attachRangeWithCoord(skeleton, fromRange);
1744
+ if (!selectionRect)
1745
+ return { redos: [], undos: [] };
1746
+ const { startX, endX, startY, endY } = selectionRect, drawings = this._sheetDrawingService.getDrawingData(unitId, subUnitId), containedDrawings = [];
1747
+ Object.keys(drawings).forEach((drawingId) => {
1748
+ const drawing = drawings[drawingId];
1749
+ if (drawing.anchorType !== SheetDrawingAnchorType.Both)
1750
+ return;
1751
+ const { transform } = drawing;
1752
+ if (!transform)
1753
+ return;
1754
+ const { left = 0, top = 0, width = 0, height = 0 } = transform, { drawingStartX, drawingEndX, drawingStartY, drawingEndY } = {
1755
+ drawingStartX: left,
1756
+ drawingEndX: left + width,
1757
+ drawingStartY: top,
1758
+ drawingEndY: top + height
1759
+ };
1760
+ startX <= drawingStartX && drawingEndX <= endX && startY <= drawingStartY && drawingEndY <= endY && containedDrawings.push(drawing);
1761
+ });
1762
+ const redos = [], undos = [], rowOffset = toRange.startRow - fromRange.startRow, colOffset = toRange.startColumn - fromRange.startColumn, updateDrawings = containedDrawings.map((drawing) => {
1763
+ const oldSheetTransform = drawing.sheetTransform, sheetTransform = {
1764
+ to: { ...oldSheetTransform.to, row: oldSheetTransform.to.row + rowOffset, column: oldSheetTransform.to.column + colOffset },
1765
+ from: { ...oldSheetTransform.from, row: oldSheetTransform.from.row + rowOffset, column: oldSheetTransform.from.column + colOffset }
1766
+ }, transform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
1767
+ return {
1768
+ unitId,
1769
+ subUnitId,
1770
+ drawingId: drawing.drawingId,
1771
+ transform,
1772
+ sheetTransform
1773
+ };
1774
+ });
1775
+ if (updateDrawings.length) {
1776
+ const updateJsonOp = this._sheetDrawingService.getBatchUpdateOp(updateDrawings), { undo, redo, objects } = updateJsonOp;
1777
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } });
1778
+ }
1779
+ return { redos, undos };
1780
+ }
1781
+ _moveRowInterceptor(params, type) {
1782
+ const ids = this._getUnitIdAndSubUnitId(params, type);
1783
+ if (ids == null)
1784
+ return { redos: [], undos: [] };
1785
+ const { unitId, subUnitId } = ids, { range } = params, rowStartIndex = range.startRow, rowEndIndex = range.endRow, redos = [], undos = [], data = this._sheetDrawingService.getDrawingData(unitId, subUnitId), updateDrawings = [], deleteDrawings = [];
1786
+ if (Object.keys(data).forEach((drawingId) => {
1787
+ const drawing = data[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
1788
+ if (sheetTransform == null || transform == null)
1789
+ return;
1790
+ let newSheetTransform, newTransform;
1791
+ if (type === "insert") {
1792
+ const param = this._expandRow(sheetTransform, transform, rowStartIndex, rowEndIndex, anchorType);
1793
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1794
+ } else {
1795
+ const { from, to } = sheetTransform, { row: fromRow } = from, { row: toRow } = to;
1796
+ if (anchorType === SheetDrawingAnchorType.Both && fromRow >= rowStartIndex && toRow <= rowEndIndex)
1797
+ deleteDrawings.push({ unitId, subUnitId, drawingId });
1798
+ else {
1799
+ const param = this._shrinkRow(sheetTransform, transform, rowStartIndex, rowEndIndex, anchorType);
1800
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1801
+ }
1802
+ }
1803
+ if (!newSheetTransform || !newTransform)
1804
+ return;
1805
+ const params2 = { unitId, subUnitId, drawingId, transform: newTransform, sheetTransform: newSheetTransform };
1806
+ updateDrawings.push(params2);
1807
+ }), updateDrawings.length === 0 && deleteDrawings.length === 0)
1808
+ return { redos: [], undos: [] };
1809
+ if (updateDrawings.length > 0) {
1810
+ const updateJsonOp = this._sheetDrawingService.getBatchUpdateOp(updateDrawings), { undo, redo, objects } = updateJsonOp;
1811
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } });
1812
+ }
1813
+ if (deleteDrawings.length > 0) {
1814
+ const deleteJsonOp = this._sheetDrawingService.getBatchRemoveOp(deleteDrawings), deleteUndo = deleteJsonOp.undo, deleteRedo = deleteJsonOp.redo, deleteObjects = deleteJsonOp.objects;
1815
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: deleteRedo, objects: deleteObjects, type: DrawingApplyType.REMOVE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: deleteUndo, objects: deleteObjects, type: DrawingApplyType.INSERT } });
1816
+ }
1817
+ return redos.push({ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }), undos.push({ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }), {
1818
+ redos,
1819
+ undos
1820
+ };
1821
+ }
1822
+ _moveColInterceptor(params, type) {
1823
+ const ids = this._getUnitIdAndSubUnitId(params, type);
1824
+ if (ids == null)
1825
+ return { redos: [], undos: [] };
1826
+ const { unitId, subUnitId } = ids, { range } = params, colStartIndex = range.startColumn, colEndIndex = range.endColumn, redos = [], undos = [], data = this._sheetDrawingService.getDrawingData(unitId, subUnitId), updateDrawings = [], deleteDrawings = [];
1827
+ if (Object.keys(data).forEach((drawingId) => {
1828
+ const drawing = data[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
1829
+ if (sheetTransform == null || transform == null)
1830
+ return;
1831
+ let newSheetTransform, newTransform;
1832
+ if (type === "insert") {
1833
+ const param = this._expandCol(sheetTransform, transform, colStartIndex, colEndIndex, anchorType);
1834
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1835
+ } else {
1836
+ const { from, to } = sheetTransform, { column: fromColumn } = from, { column: toColumn } = to;
1837
+ if (anchorType === SheetDrawingAnchorType.Both && fromColumn >= colStartIndex && toColumn <= colEndIndex)
1838
+ deleteDrawings.push({ unitId, subUnitId, drawingId });
1839
+ else {
1840
+ const param = this._shrinkCol(sheetTransform, transform, colStartIndex, colEndIndex, anchorType);
1841
+ newSheetTransform = param == null ? void 0 : param.newSheetTransform, newTransform = param == null ? void 0 : param.newTransform;
1842
+ }
1843
+ }
1844
+ if (!newSheetTransform || !newTransform)
1845
+ return;
1846
+ const params2 = { unitId, subUnitId, drawingId, transform: newTransform, sheetTransform: newSheetTransform };
1847
+ updateDrawings.push(params2);
1848
+ }), updateDrawings.length === 0 && deleteDrawings.length === 0)
1849
+ return { redos: [], undos: [] };
1850
+ if (updateDrawings.length > 0) {
1851
+ const updateJsonOp = this._sheetDrawingService.getBatchUpdateOp(updateDrawings), { undo, redo, objects } = updateJsonOp;
1852
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.UPDATE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: undo, objects, type: DrawingApplyType.UPDATE } });
1853
+ }
1854
+ if (deleteDrawings.length > 0) {
1855
+ const deleteJsonOp = this._sheetDrawingService.getBatchRemoveOp(deleteDrawings), deleteUndo = deleteJsonOp.undo, deleteRedo = deleteJsonOp.redo, deleteObjects = deleteJsonOp.objects;
1856
+ redos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: deleteRedo, objects: deleteObjects, type: DrawingApplyType.REMOVE } }), undos.push({ id: SetDrawingApplyMutation.id, params: { unitId, subUnitId, op: deleteUndo, objects: deleteObjects, type: DrawingApplyType.INSERT } });
1857
+ }
1858
+ return redos.push({ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }), undos.push({ id: ClearSheetDrawingTransformerOperation.id, params: [unitId] }), { redos, undos };
1859
+ }
1860
+ _expandCol(sheetTransform, transform, colStartIndex, colEndIndex, anchorType = SheetDrawingAnchorType.Position) {
1861
+ const colCount = colEndIndex - colStartIndex + 1, { from, to } = sheetTransform, { column: fromColumn } = from, { column: toColumn } = to;
1862
+ if (anchorType === SheetDrawingAnchorType.None)
1863
+ return {
1864
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1865
+ newTransform: transform
1866
+ };
1867
+ let newSheetTransform = null, newTransform = null;
1868
+ if (fromColumn >= colStartIndex) {
1869
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: colStartIndex, endColumn: colEndIndex, startRow: from.row, endRow: to.row });
1870
+ if (selectionCell == null)
1871
+ return;
1872
+ newTransform = { ...transform, left: (transform.left || 0) + selectionCell.endX - selectionCell.startX }, newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService);
1873
+ } else if (toColumn >= colEndIndex)
1874
+ if (anchorType === SheetDrawingAnchorType.Both)
1875
+ newSheetTransform = {
1876
+ from: { ...from },
1877
+ to: { ...to, column: toColumn + colCount }
1878
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1879
+ else
1880
+ return {
1881
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1882
+ newTransform: transform
1883
+ };
1884
+ return newSheetTransform != null && newTransform != null ? {
1885
+ newSheetTransform,
1886
+ newTransform
1887
+ } : null;
1888
+ }
1889
+ _shrinkCol(sheetTransform, transform, colStartIndex, colEndIndex, anchorType = SheetDrawingAnchorType.Position) {
1890
+ const colCount = colEndIndex - colStartIndex + 1, { from, to } = sheetTransform, { column: fromColumn } = from, { column: toColumn } = to;
1891
+ if (anchorType === SheetDrawingAnchorType.None)
1892
+ return {
1893
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1894
+ newTransform: transform
1895
+ };
1896
+ let newSheetTransform = null, newTransform = null;
1897
+ if (fromColumn > colEndIndex)
1898
+ newSheetTransform = {
1899
+ from: { ...from, column: fromColumn - colCount },
1900
+ to: { ...to, column: toColumn - colCount }
1901
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1902
+ else {
1903
+ if (fromColumn >= colStartIndex && toColumn <= colEndIndex)
1904
+ return null;
1905
+ if (fromColumn < colStartIndex && toColumn > colEndIndex)
1906
+ if (anchorType === SheetDrawingAnchorType.Both)
1907
+ newSheetTransform = {
1908
+ from: { ...from },
1909
+ to: { ...to, column: toColumn - colCount }
1910
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1911
+ else
1912
+ return {
1913
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1914
+ newTransform: transform
1915
+ };
1916
+ else if (fromColumn >= colStartIndex && fromColumn <= colEndIndex) {
1917
+ if (fromColumn === colStartIndex)
1918
+ newTransform = { ...transform, left: (transform.left || 0) - sheetTransform.from.columnOffset };
1919
+ else {
1920
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: colStartIndex, endColumn: fromColumn - 1, startRow: from.row, endRow: to.row });
1921
+ if (selectionCell == null)
1922
+ return;
1923
+ newTransform = { ...transform, left: (transform.left || 0) - selectionCell.endX + selectionCell.startX - sheetTransform.from.columnOffset };
1924
+ }
1925
+ newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService);
1926
+ } else if (toColumn >= colStartIndex && toColumn <= colEndIndex && anchorType === SheetDrawingAnchorType.Both) {
1927
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({
1928
+ startColumn: colStartIndex - 1,
1929
+ endColumn: colStartIndex - 1,
1930
+ startRow: from.row,
1931
+ endRow: to.row
1932
+ });
1933
+ if (selectionCell == null)
1934
+ return;
1935
+ newSheetTransform = {
1936
+ from: { ...from },
1937
+ to: { ...to, column: colStartIndex - 1, columnOffset: selectionCell.endX - selectionCell.startX }
1938
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1939
+ }
1940
+ }
1941
+ return newSheetTransform != null && newTransform != null ? {
1942
+ newSheetTransform,
1943
+ newTransform
1944
+ } : null;
1945
+ }
1946
+ _expandRow(sheetTransform, transform, rowStartIndex, rowEndIndex, anchorType = SheetDrawingAnchorType.Position) {
1947
+ const rowCount = rowEndIndex - rowStartIndex + 1, { from, to } = sheetTransform, { row: fromRow } = from, { row: toRow } = to;
1948
+ if (anchorType === SheetDrawingAnchorType.None)
1949
+ return {
1950
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1951
+ newTransform: transform
1952
+ };
1953
+ let newSheetTransform = null, newTransform = null;
1954
+ if (fromRow >= rowStartIndex) {
1955
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startRow: rowStartIndex, endRow: rowEndIndex, startColumn: from.column, endColumn: to.column });
1956
+ if (selectionCell == null)
1957
+ return;
1958
+ newTransform = { ...transform, top: (transform.top || 0) + selectionCell.endY - selectionCell.startY }, newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService);
1959
+ } else if (toRow >= rowEndIndex)
1960
+ if (anchorType === SheetDrawingAnchorType.Both)
1961
+ newSheetTransform = {
1962
+ from: { ...from },
1963
+ to: {
1964
+ ...to,
1965
+ row: toRow + rowCount
1966
+ }
1967
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1968
+ else
1969
+ return {
1970
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1971
+ newTransform: transform
1972
+ };
1973
+ return newSheetTransform != null && newTransform != null ? {
1974
+ newSheetTransform,
1975
+ newTransform
1976
+ } : null;
1977
+ }
1978
+ _shrinkRow(sheetTransform, transform, rowStartIndex, rowEndIndex, anchorType = SheetDrawingAnchorType.Position) {
1979
+ const rowCount = rowEndIndex - rowStartIndex + 1, { from, to } = sheetTransform, { row: fromRow } = from, { row: toRow } = to;
1980
+ if (anchorType === SheetDrawingAnchorType.None)
1981
+ return {
1982
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
1983
+ newTransform: transform
1984
+ };
1985
+ let newSheetTransform = null, newTransform = null;
1986
+ if (fromRow > rowEndIndex)
1987
+ newSheetTransform = {
1988
+ from: { ...from, row: fromRow - rowCount },
1989
+ to: { ...to, row: toRow - rowCount }
1990
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
1991
+ else {
1992
+ if (fromRow >= rowStartIndex && toRow <= rowEndIndex)
1993
+ return null;
1994
+ if (fromRow < rowStartIndex && toRow > rowEndIndex)
1995
+ if (anchorType === SheetDrawingAnchorType.Both)
1996
+ newSheetTransform = {
1997
+ from: { ...from },
1998
+ to: { ...to, row: toRow - rowCount }
1999
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
2000
+ else
2001
+ return {
2002
+ newSheetTransform: transformToDrawingPosition({ ...transform }, this._selectionRenderService),
2003
+ newTransform: transform
2004
+ };
2005
+ else if (fromRow >= rowStartIndex && fromRow <= rowEndIndex) {
2006
+ if (fromRow === rowStartIndex)
2007
+ newTransform = { ...transform, top: (transform.top || 0) - sheetTransform.from.rowOffset };
2008
+ else {
2009
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startRow: rowStartIndex, endRow: fromRow - 1, startColumn: from.column, endColumn: to.column });
2010
+ if (selectionCell == null)
2011
+ return;
2012
+ newTransform = { ...transform, top: (transform.top || 0) - selectionCell.endY + selectionCell.startY - sheetTransform.from.rowOffset };
2013
+ }
2014
+ newSheetTransform = transformToDrawingPosition(newTransform, this._selectionRenderService);
2015
+ } else if (toRow >= rowStartIndex && toRow <= rowEndIndex && anchorType === SheetDrawingAnchorType.Both) {
2016
+ const selectionCell = this._skeletonManagerService.attachRangeWithCoord({ startColumn: from.column, endColumn: from.column, startRow: rowStartIndex - 1, endRow: rowStartIndex - 1 });
2017
+ if (selectionCell == null)
2018
+ return;
2019
+ newSheetTransform = {
2020
+ from: { ...from },
2021
+ to: { ...to, row: rowStartIndex - 1, rowOffset: selectionCell.endY - selectionCell.startY }
2022
+ }, newTransform = drawingPositionToTransform(newSheetTransform, this._selectionRenderService, this._skeletonManagerService);
2023
+ }
2024
+ }
2025
+ return newSheetTransform != null && newTransform != null ? {
2026
+ newSheetTransform,
2027
+ newTransform
2028
+ } : null;
2029
+ }
2030
+ _commandListener() {
2031
+ this.disposeWithMe(
2032
+ this._commandService.onCommandExecuted((command) => {
2033
+ command.id === SetWorksheetActiveOperation.id && setTimeout(() => {
2034
+ const params = command.params, { unitId: showUnitId, subUnitId: showSubunitId } = params, drawingMap = this._drawingManagerService.drawingManagerData, insertDrawings = [], removeDrawings = [];
2035
+ Object.keys(drawingMap).forEach((unitId) => {
2036
+ const subUnitMap = drawingMap[unitId];
2037
+ subUnitMap != null && Object.keys(subUnitMap).forEach((subUnitId) => {
2038
+ const drawingData = subUnitMap[subUnitId].data;
2039
+ drawingData != null && Object.keys(drawingData).forEach((drawingId) => {
2040
+ if (unitId === showUnitId && subUnitId === showSubunitId) {
2041
+ const drawing = drawingData[drawingId];
2042
+ drawing.transform = drawingPositionToTransform(drawing.sheetTransform, this._selectionRenderService, this._skeletonManagerService), insertDrawings.push(drawingData[drawingId]);
2043
+ } else
2044
+ removeDrawings.push(drawingData[drawingId]);
2045
+ });
2046
+ });
2047
+ }), this._drawingManagerService.removeNotification(removeDrawings), this._drawingManagerService.addNotification(insertDrawings);
2048
+ }, 0);
2049
+ })
2050
+ );
2051
+ }
2052
+ _sheetRefreshListener() {
2053
+ this.disposeWithMe(
2054
+ this._commandService.onCommandExecuted((command) => {
2055
+ REFRESH_MUTATIONS.includes(command.id) && requestIdleCallback(() => {
2056
+ const params = command.params, { unitId, subUnitId, ranges } = params;
2057
+ this._refreshDrawingTransform(unitId, subUnitId, ranges);
2058
+ });
2059
+ })
2060
+ );
2061
+ }
2062
+ _refreshDrawingTransform(unitId, subUnitId, ranges) {
2063
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, subUnitId), updateDrawings = [];
2064
+ Object.keys(drawingData).forEach((drawingId) => {
2065
+ const drawing = drawingData[drawingId], { sheetTransform, transform, anchorType = SheetDrawingAnchorType.Position } = drawing;
2066
+ if (anchorType === SheetDrawingAnchorType.None)
2067
+ return !0;
2068
+ const { from, to } = sheetTransform, { row: fromRow, column: fromColumn } = from, { row: toRow, column: toColumn } = to;
2069
+ for (let i = 0; i < ranges.length; i++) {
2070
+ const range = ranges[i], { startRow, endRow, startColumn, endColumn } = range;
2071
+ if (Rectangle.intersects(
2072
+ {
2073
+ startRow,
2074
+ endRow,
2075
+ startColumn,
2076
+ endColumn
2077
+ },
2078
+ {
2079
+ startRow: fromRow,
2080
+ endRow: toRow,
2081
+ startColumn: fromColumn,
2082
+ endColumn: toColumn
2083
+ }
2084
+ ) || fromRow > endRow || fromColumn > endColumn) {
2085
+ const isPositionAnchor = anchorType === SheetDrawingAnchorType.Position, newTransform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);
2086
+ updateDrawings.push({
2087
+ ...drawing,
2088
+ transform: {
2089
+ ...newTransform,
2090
+ width: isPositionAnchor ? transform == null ? void 0 : transform.width : newTransform == null ? void 0 : newTransform.width,
2091
+ height: isPositionAnchor ? transform == null ? void 0 : transform.height : newTransform == null ? void 0 : newTransform.height
2092
+ }
2093
+ });
2094
+ break;
2095
+ }
2096
+ }
2097
+ }), updateDrawings.length !== 0 && (this._drawingManagerService.refreshTransform(updateDrawings), this._commandService.syncExecuteCommand(ClearSheetDrawingTransformerOperation.id, [unitId]));
2098
+ }
2099
+ }, __name(_a8, "SheetDrawingTransformAffectedController"), _a8);
2100
+ SheetDrawingTransformAffectedController = __decorateClass$2([
2101
+ __decorateParam$2(1, IRenderManagerService),
2102
+ __decorateParam$2(2, ICommandService),
2103
+ __decorateParam$2(3, ISheetSelectionRenderService),
2104
+ __decorateParam$2(4, Inject(SheetSkeletonManagerService)),
2105
+ __decorateParam$2(5, Inject(SheetInterceptorService)),
2106
+ __decorateParam$2(6, ISheetDrawingService),
2107
+ __decorateParam$2(7, IDrawingManagerService),
2108
+ __decorateParam$2(8, IUniverInstanceService)
2109
+ ], SheetDrawingTransformAffectedController);
2110
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2111
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2112
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2113
+ return kind && result && __defProp$1(target, key, result), result;
2114
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
2115
+ function transformBound2DOMBound(originBound, scene, skeleton, worksheet) {
2116
+ const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN), absolute = {
2117
+ left: !0,
2118
+ top: !0
2119
+ };
2120
+ if (!viewMain)
2121
+ return {
2122
+ ...originBound,
2123
+ absolute
2124
+ };
2125
+ const { left, right, top, bottom } = originBound, freeze = worksheet.getFreeze(), { startColumn, startRow, xSplit, ySplit } = freeze, startSheetView = skeleton.getNoMergeCellPositionByIndexWithNoHeader(startRow - ySplit, startColumn - xSplit), endSheetView = skeleton.getNoMergeCellPositionByIndexWithNoHeader(startRow, startColumn), { rowHeaderWidth, columnHeaderHeight } = skeleton, freezeWidth = endSheetView.startX - startSheetView.startX, freezeHeight = endSheetView.startY - startSheetView.startY, { top: freezeTop, left: freezeLeft, viewportScrollX: actualScrollX, viewportScrollY: actualScrollY } = viewMain;
2126
+ let offsetLeft, offsetRight;
2127
+ left < freezeLeft ? (absolute.left = !0, offsetLeft = (freezeWidth + rowHeaderWidth + (left - freezeLeft)) * scaleX, offsetRight = Math.max(
2128
+ Math.min(
2129
+ (freezeWidth + rowHeaderWidth + (right - freezeLeft)) * scaleX,
2130
+ (freezeWidth + rowHeaderWidth) * scaleX
2131
+ ),
2132
+ (right - actualScrollX) * scaleX
2133
+ )) : (absolute.left = !1, offsetLeft = Math.max((left - actualScrollX) * scaleX, (freezeWidth + rowHeaderWidth) * scaleX), offsetRight = Math.max((right - actualScrollX) * scaleX, (freezeWidth + rowHeaderWidth) * scaleX));
2134
+ let offsetTop, offsetBottom;
2135
+ return top < freezeTop ? (absolute.top = !0, offsetTop = (freezeHeight + columnHeaderHeight + (top - freezeTop)) * scaleY, offsetBottom = Math.max(
2136
+ Math.min(
2137
+ (freezeHeight + columnHeaderHeight + (right - freezeTop)) * scaleY,
2138
+ (freezeHeight + columnHeaderHeight) * scaleY
2139
+ ),
2140
+ (bottom - actualScrollY) * scaleY
2141
+ )) : (absolute.top = !1, offsetTop = Math.max((top - actualScrollY) * scaleY, (freezeHeight + columnHeaderHeight) * scaleY), offsetBottom = Math.max((bottom - actualScrollY) * scaleY, (freezeHeight + columnHeaderHeight) * scaleY)), {
2142
+ left: offsetLeft,
2143
+ right: offsetRight,
2144
+ top: offsetTop,
2145
+ bottom: offsetBottom,
2146
+ absolute
2147
+ };
2148
+ }
2149
+ __name(transformBound2DOMBound, "transformBound2DOMBound");
2150
+ const calcPosition = /* @__PURE__ */ __name((targetObject, currentRender, skeleton, worksheet) => {
2151
+ const { scene } = currentRender, { left, top, width, height, angle } = targetObject, bound = {
2152
+ left,
2153
+ right: left + width,
2154
+ top,
2155
+ bottom: top + height
2156
+ }, offsetBound = transformBound2DOMBound(bound, scene, skeleton, worksheet), { scaleX, scaleY } = scene.getAncestorScale();
2157
+ return {
2158
+ startX: offsetBound.left,
2159
+ endX: offsetBound.right,
2160
+ startY: offsetBound.top,
2161
+ endY: offsetBound.bottom,
2162
+ rotate: angle,
2163
+ width: width * scaleX,
2164
+ height: height * scaleY,
2165
+ absolute: offsetBound.absolute
2166
+ };
2167
+ }, "calcPosition");
2168
+ var _a9;
2169
+ let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
2170
+ constructor(_renderManagerService, _univerInstanceService, _commandService, _drawingManagerService, _canvasFloatDomService, _sheetDrawingService) {
2171
+ super();
2172
+ __publicField(this, "_domLayerMap", /* @__PURE__ */ new Map());
2173
+ __publicField(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
2174
+ __publicField(this, "_transformChange$", new Subject());
2175
+ __publicField(this, "transformChange$", this._transformChange$.asObservable());
2176
+ __publicField(this, "_remove$", new Subject());
2177
+ __publicField(this, "remove$", this._remove$.asObservable());
2178
+ __publicField(this, "_hooks", []);
2179
+ this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._drawingManagerService = _drawingManagerService, this._canvasFloatDomService = _canvasFloatDomService, this._sheetDrawingService = _sheetDrawingService, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
2180
+ }
2181
+ _ensureMap(unitId, subUnitId) {
2182
+ let unitMap = this._domLayerMap.get(unitId);
2183
+ unitMap || (unitMap = /* @__PURE__ */ new Map(), this._domLayerMap.set(unitId, unitMap));
2184
+ let subUnitMap = unitMap.get(subUnitId);
2185
+ return subUnitMap || (subUnitMap = /* @__PURE__ */ new Map(), unitMap.set(subUnitId, subUnitMap)), subUnitMap;
2186
+ }
2187
+ _getSceneAndTransformerByDrawingSearch(unitId) {
2188
+ if (unitId == null)
2189
+ return;
2190
+ const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
2191
+ if (renderObject == null || scene == null)
2192
+ return null;
2193
+ const transformer = scene.getTransformerByCreate(), canvas = renderObject.engine.getCanvasElement();
2194
+ return { scene, transformer, renderObject, canvas };
2195
+ }
2196
+ _getFloatDomProps(id) {
2197
+ let props;
2198
+ return this._hooks.forEach((hook) => {
2199
+ props = hook.onGetFloatDomProps(id);
2200
+ }), props;
2201
+ }
2202
+ // eslint-disable-next-line max-lines-per-function
2203
+ _drawingAddListener() {
2204
+ this.disposeWithMe(
2205
+ // eslint-disable-next-line max-lines-per-function
2206
+ this._drawingManagerService.add$.subscribe((params) => {
2207
+ params.forEach((param) => {
2208
+ var _a11, _b, _c;
2209
+ const { unitId, subUnitId, drawingId } = param, target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), floatDomParam = this._drawingManagerService.getDrawingByParam(param);
2210
+ if (!floatDomParam || !target)
2211
+ return;
2212
+ const skeleton = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
2213
+ if (!skeleton)
2214
+ return;
2215
+ const { transform, drawingType, data } = floatDomParam;
2216
+ if (drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
2217
+ return;
2218
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2219
+ if (renderObject == null)
2220
+ return;
2221
+ const { scene, canvas } = renderObject;
2222
+ if (transform == null)
2223
+ return !0;
2224
+ const { left, top, width, height, angle, flipX, flipY, skewX, skewY } = transform, rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), rectShape = scene.getObject(rectShapeKey);
2225
+ if (rectShape != null) {
2226
+ rectShape.transformByState({ left, top, width, height, angle, flipX, flipY, skewX, skewY });
2227
+ return;
2228
+ }
2229
+ const imageConfig = {
2230
+ left,
2231
+ top,
2232
+ width,
2233
+ height,
2234
+ zIndex: this._drawingManagerService.getDrawingOrder(unitId, subUnitId).length - 1
2235
+ }, rect = new Rect(rectShapeKey, imageConfig);
2236
+ scene.addObject(rect, DRAWING_OBJECT_LAYER_INDEX), floatDomParam.allowTransform !== !1 && scene.attachTransformerTo(rect);
2237
+ const map2 = this._ensureMap(unitId, subUnitId), disposableCollection = new DisposableCollection(), initPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet), position$ = new BehaviorSubject(initPosition), info = {
2238
+ dispose: disposableCollection,
2239
+ rect,
2240
+ position$,
2241
+ unitId,
2242
+ subUnitId
2243
+ };
2244
+ this._canvasFloatDomService.addFloatDom({
2245
+ position$,
2246
+ id: drawingId,
2247
+ componentKey: floatDomParam.componentKey,
2248
+ onPointerDown: /* @__PURE__ */ __name((evt) => {
2249
+ canvas.dispatchEvent(new PointerEvent(evt.type, evt));
2250
+ }, "onPointerDown"),
2251
+ onPointerMove: /* @__PURE__ */ __name((evt) => {
2252
+ canvas.dispatchEvent(new PointerEvent(evt.type, evt));
2253
+ }, "onPointerMove"),
2254
+ onPointerUp: /* @__PURE__ */ __name((evt) => {
2255
+ canvas.dispatchEvent(new PointerEvent(evt.type, evt));
2256
+ }, "onPointerUp"),
2257
+ onWheel: /* @__PURE__ */ __name((evt) => {
2258
+ canvas.dispatchEvent(new WheelEvent(evt.type, evt));
2259
+ }, "onWheel"),
2260
+ props: (_c = (_b = map2.get(drawingId)) == null ? void 0 : _b.props) != null ? _c : this._getFloatDomProps(drawingId),
2261
+ data,
2262
+ unitId
2263
+ });
2264
+ const listener = rect.onTransformChange$.subscribeEvent(() => {
2265
+ const newPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet);
2266
+ position$.next(
2267
+ newPosition
2268
+ );
2269
+ });
2270
+ disposableCollection.add(() => {
2271
+ this._canvasFloatDomService.removeFloatDom(drawingId);
2272
+ }), listener && disposableCollection.add(listener), this._domLayerInfoMap.set(drawingId, info), map2.set(drawingId, {
2273
+ ...map2.get(drawingId)
2274
+ });
2275
+ });
2276
+ })
2277
+ );
2278
+ }
2279
+ _scrollUpdateListener() {
2280
+ this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
2281
+ var _a11, _b;
2282
+ const updateSheet = /* @__PURE__ */ __name((unitId, subUnitId) => {
2283
+ var _a12;
2284
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), map2 = this._ensureMap(unitId, subUnitId), ids = Array.from(map2.keys()), target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId }), skeleton = (_a12 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a12.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
2285
+ !renderObject || !target || !skeleton || ids.forEach((id) => {
2286
+ const info = this._domLayerInfoMap.get(id);
2287
+ if (info) {
2288
+ const position = calcPosition(info.rect, renderObject.renderObject, skeleton.skeleton, target.worksheet);
2289
+ info.position$.next(position);
2290
+ }
2291
+ });
2292
+ }, "updateSheet");
2293
+ if (commandInfo.id === SetScrollOperation.id) {
2294
+ const params = commandInfo.params, { unitId, sheetId } = params;
2295
+ updateSheet(unitId, sheetId);
2296
+ } else if (commandInfo.id === SetZoomRatioOperation.id) {
2297
+ const params = commandInfo.params, { unitId } = params;
2298
+ Array.from((_b = (_a11 = this._domLayerMap.get(unitId)) == null ? void 0 : _a11.keys()) != null ? _b : []).forEach((subUnitId) => {
2299
+ updateSheet(unitId, subUnitId);
2300
+ });
2301
+ } else if (commandInfo.id === SetFrozenMutation.id) {
2302
+ const { unitId, subUnitId } = commandInfo.params;
2303
+ updateSheet(unitId, subUnitId);
2304
+ }
2305
+ }));
2306
+ }
2307
+ _getPosition(position, unitId) {
2308
+ var _a11;
2309
+ const { startX, endX, startY, endY } = position, selectionRenderService = (_a11 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a11.with(ISheetSelectionRenderService);
2310
+ if (selectionRenderService == null)
2311
+ return;
2312
+ const start = selectionRenderService.getSelectionCellByPosition(startX, startY);
2313
+ if (start == null)
2314
+ return;
2315
+ const from = {
2316
+ column: start.actualColumn,
2317
+ columnOffset: startX - start.startX,
2318
+ row: start.actualRow,
2319
+ rowOffset: startY - start.startY
2320
+ }, end = selectionRenderService.getSelectionCellByPosition(endX, endY);
2321
+ if (end == null)
2322
+ return;
2323
+ const to = {
2324
+ column: end.actualColumn,
2325
+ columnOffset: endX - end.startX,
2326
+ row: end.actualRow,
2327
+ rowOffset: endY - end.startY
2328
+ };
2329
+ return {
2330
+ from,
2331
+ to
2332
+ };
2333
+ }
2334
+ _featureUpdateListener() {
2335
+ this.disposeWithMe(
2336
+ this._drawingManagerService.update$.subscribe((params) => {
2337
+ params.forEach((data) => {
2338
+ const sheetDrawing = this._drawingManagerService.getDrawingByParam(data);
2339
+ if (!sheetDrawing || sheetDrawing.drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
2340
+ return;
2341
+ const newValue = {
2342
+ ...sheetDrawing.transform
2343
+ };
2344
+ this._transformChange$.next({ id: data.drawingId, value: newValue });
2345
+ });
2346
+ })
2347
+ );
2348
+ }
2349
+ _deleteListener() {
2350
+ this.disposeWithMe(
2351
+ this._drawingManagerService.remove$.subscribe((params) => {
2352
+ params.forEach((param) => {
2353
+ this._removeDom(param.drawingId);
2354
+ });
2355
+ })
2356
+ );
2357
+ }
2358
+ addFloatDomToPosition(layer, propId) {
2359
+ const target = getSheetCommandTarget(this._univerInstanceService, {
2360
+ unitId: layer.unitId,
2361
+ subUnitId: layer.subUnitId
2362
+ });
2363
+ if (!target)
2364
+ throw new Error("cannot find current target!");
2365
+ const { unitId, subUnitId } = target, { initPosition, componentKey, data, allowTransform = !0 } = layer, id = propId != null ? propId : generateRandomId(), sheetTransform = this._getPosition(initPosition, unitId);
2366
+ if (sheetTransform == null)
2367
+ return;
2368
+ this._ensureMap(unitId, subUnitId).set(id, layer);
2369
+ const sheetDrawingParam = {
2370
+ unitId,
2371
+ subUnitId,
2372
+ drawingId: id,
2373
+ drawingType: DrawingTypeEnum$1.DRAWING_DOM,
2374
+ componentKey,
2375
+ sheetTransform,
2376
+ transform: {
2377
+ left: initPosition.startX,
2378
+ top: initPosition.startY,
2379
+ width: initPosition.endX - initPosition.startX,
2380
+ height: initPosition.endY - initPosition.startY
2381
+ },
2382
+ data,
2383
+ allowTransform
2384
+ };
2385
+ return this._commandService.executeCommand(InsertSheetDrawingCommand.id, {
2386
+ unitId,
2387
+ drawings: [sheetDrawingParam]
2388
+ }), {
2389
+ id,
2390
+ dispose: /* @__PURE__ */ __name(() => {
2391
+ this._removeDom(id, !0);
2392
+ }, "dispose")
2393
+ };
2394
+ }
2395
+ _removeDom(id, removeDrawing = !1) {
2396
+ const info = this._domLayerInfoMap.get(id);
2397
+ if (!info)
2398
+ return;
2399
+ const { unitId, subUnitId } = info;
2400
+ this._domLayerInfoMap.delete(id), info.dispose.dispose();
2401
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2402
+ if (renderObject && renderObject.scene.removeObject(info.rect), removeDrawing) {
2403
+ this._ensureMap(unitId, subUnitId).delete(id);
2404
+ const param = this._drawingManagerService.getDrawingByParam({ unitId, subUnitId, drawingId: id });
2405
+ if (!param)
2406
+ return;
2407
+ const jsonOp = this._sheetDrawingService.getBatchRemoveOp([param]), { redo, objects } = jsonOp;
2408
+ this._commandService.syncExecuteCommand(SetDrawingApplyMutation.id, { unitId, subUnitId, op: redo, objects, type: DrawingApplyType.REMOVE });
2409
+ }
2410
+ }
2411
+ addHook(hook) {
2412
+ return this._hooks.push(hook), {
2413
+ dispose: /* @__PURE__ */ __name(() => {
2414
+ const index = this._hooks.findIndex((h) => h === hook);
2415
+ this._hooks.splice(index, 1);
2416
+ }, "dispose")
2417
+ };
2418
+ }
2419
+ }, __name(_a9, "SheetCanvasFloatDomManagerService"), _a9);
2420
+ SheetCanvasFloatDomManagerService = __decorateClass$1([
2421
+ __decorateParam$1(0, Inject(IRenderManagerService)),
2422
+ __decorateParam$1(1, IUniverInstanceService),
2423
+ __decorateParam$1(2, Inject(ICommandService)),
2424
+ __decorateParam$1(3, IDrawingManagerService),
2425
+ __decorateParam$1(4, Inject(CanvasFloatDomService)),
2426
+ __decorateParam$1(5, ISheetDrawingService)
2427
+ ], SheetCanvasFloatDomManagerService);
2428
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2429
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2430
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2431
+ return kind && result && __defProp2(target, key, result), result;
2432
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField");
2433
+ const PLUGIN_NAME = "SHEET_IMAGE_UI_PLUGIN";
2434
+ var _a10;
2435
+ let UniverSheetsDrawingUIPlugin = (_a10 = class extends Plugin {
2436
+ constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _configService) {
2437
+ super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._configService = _configService;
2438
+ const { menu, ...rest } = this._config;
2439
+ menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
2440
+ }
2441
+ onStarting() {
2442
+ registerDependencies(this._injector, [
2443
+ [SheetCanvasFloatDomManagerService],
2444
+ [SheetDrawingUIController],
2445
+ [DrawingPopupMenuController],
2446
+ [SheetDrawingPrintingController],
2447
+ [SheetDrawingPermissionController],
2448
+ [SheetsDrawingCopyPasteController]
2449
+ ]), touchDependencies(this._injector, [
2450
+ [SheetCanvasFloatDomManagerService]
2451
+ ]);
2452
+ }
2453
+ onReady() {
2454
+ touchDependencies(this._injector, [
2455
+ [SheetsDrawingCopyPasteController]
2456
+ ]);
2457
+ }
2458
+ onRendered() {
2459
+ this._registerRenderModules(), touchDependencies(this._injector, [
2460
+ [SheetDrawingPermissionController],
2461
+ [SheetDrawingPrintingController],
2462
+ [SheetDrawingUIController]
2463
+ ]);
2464
+ }
2465
+ onSteady() {
2466
+ this._injector.get(DrawingPopupMenuController);
2467
+ }
2468
+ _registerRenderModules() {
2469
+ [
2470
+ [SheetDrawingUpdateController],
2471
+ [SheetDrawingTransformAffectedController],
2472
+ [SheetsDrawingRenderController]
2473
+ ].forEach((m) => {
2474
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
2475
+ });
2476
+ }
2477
+ }, __name(_a10, "UniverSheetsDrawingUIPlugin"), _a10);
2478
+ __publicField2(UniverSheetsDrawingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
2479
+ __publicField2(UniverSheetsDrawingUIPlugin, "pluginName", PLUGIN_NAME);
2480
+ UniverSheetsDrawingUIPlugin = __decorateClass([
2481
+ DependentOn(UniverDrawingPlugin, UniverDrawingUIPlugin, UniverSheetsDrawingPlugin),
2482
+ __decorateParam(1, Inject(Injector)),
2483
+ __decorateParam(2, IRenderManagerService),
2484
+ __decorateParam(3, IConfigService)
2485
+ ], UniverSheetsDrawingUIPlugin);
2486
+ export {
2487
+ ClearSheetDrawingTransformerOperation,
2488
+ DeleteDrawingsCommand,
2489
+ EditSheetDrawingOperation,
2490
+ GroupSheetDrawingCommand,
2491
+ IMAGE_MENU_ID,
2492
+ InsertFloatImageCommand,
2493
+ InsertSheetDrawingCommand,
2494
+ MoveDrawingsCommand,
2495
+ RemoveSheetDrawingCommand,
2496
+ SetDrawingArrangeCommand,
2497
+ SetSheetDrawingCommand,
2498
+ SheetCanvasFloatDomManagerService,
2499
+ SidebarSheetDrawingOperation,
2500
+ UngroupSheetDrawingCommand,
2501
+ UniverSheetsDrawingUIPlugin
2502
+ };