@univerjs/sheets-drawing-ui 0.5.0 → 0.5.1
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/cjs/index.js +2 -2
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/es/index.js +1323 -1023
- package/lib/es/locale/fr-FR.js +44 -0
- package/lib/types/basics/transform-position.d.ts +1 -2
- package/lib/types/commands/commands/insert-image.command.d.ts +1 -0
- package/lib/types/commands/commands/set-drawing-arrange.command.d.ts +2 -2
- package/lib/types/commands/operations/edit-sheet-drawing.operation.d.ts +1 -2
- package/lib/types/controllers/config.schema.d.ts +2 -2
- package/lib/types/controllers/sheet-cell-image-autofill.controller.d.ts +8 -0
- package/lib/types/controllers/sheet-cell-image.controller.d.ts +20 -0
- package/lib/types/controllers/sheet-celll-image-hover.controller.d.ts +15 -0
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +2 -2
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +11 -4
- package/lib/types/index.d.ts +2 -1
- package/lib/types/locale/fr-FR.d.ts +3 -0
- package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -2
- package/lib/types/views/menu/image.menu.d.ts +3 -2
- package/lib/types/views/sheet-image-panel/SheetDrawingAnchor.d.ts +1 -1
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/fr-FR.js +1 -0
- package/package.json +20 -16
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ct=Object.defineProperty;var dt=(i,n,t)=>n in i?ct(i,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[n]=t;var H=(i,n,t)=>dt(i,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@univerjs/core"),A=require("@univerjs/drawing"),Q=require("@univerjs/drawing-ui"),P=require("@univerjs/engine-render"),p=require("@univerjs/sheets-drawing"),N=require("@univerjs/sheets-ui"),G=require("@univerjs/ui"),L=require("rxjs"),_=require("@univerjs/sheets"),Y=require("react"),lt=require("@univerjs/docs-drawing"),qe=require("@univerjs/docs-ui"),K=require("@univerjs/design"),ut="sheets-drawing-ui.config",gt={},x={id:"sheet.operation.clear-drawing-transformer",type:u.CommandType.MUTATION,handler:(i,n)=>{const t=i.get(P.IRenderManagerService);return n.forEach(e=>{var r,o;(o=(r=t.getRenderById(e))==null?void 0:r.scene.getTransformer())==null||o.debounceRefreshControls()}),!0}},ae={id:"sheet.command.remove-sheet-image",type:u.CommandType.COMMAND,handler:(i,n)=>{var y,C,T;const t=i.get(u.ICommandService),e=i.get(u.IUndoRedoService),r=i.get(_.SheetInterceptorService),o=i.get(p.ISheetDrawingService);if(!n)return!1;const{drawings:s}=n,c=[];s.forEach(I=>{const{unitId:M}=I;c.push(M)});const d=o.getBatchRemoveOp(s),{unitId:m,subUnitId:l,undo:a,redo:g,objects:h}=d,f=r.onCommandExecute({id:ae.id,params:n}),w={id:p.SetDrawingApplyMutation.id,params:{unitId:m,subUnitId:l,op:g,objects:h,type:p.DrawingApplyType.REMOVE}},S={id:p.SetDrawingApplyMutation.id,params:{unitId:m,subUnitId:l,op:a,objects:h,type:p.DrawingApplyType.INSERT}};return u.sequenceExecute([...(y=f.preRedos)!=null?y:[],w,...f.redos],t)?(e.pushUndoRedo({unitID:m,undoMutations:[...(C=f.preUndos)!=null?C:[],S,...f.undos,{id:x.id,params:c}],redoMutations:[...(T=f.preRedos)!=null?T:[],w,...f.redos,{id:x.id,params:c}]}),!0):!1}},Je="COMPONENT_SHEET_DRAWING_PANEL",je={id:"sidebar.operation.sheet-image",type:u.CommandType.COMMAND,handler:async(i,n)=>{const t=i.get(G.ISidebarService),e=i.get(u.LocaleService),r=i.get(u.IUniverInstanceService),o=i.get(A.IDrawingManagerService);if(!_.getSheetCommandTarget(r))return!1;switch(n.value){case"open":t.open({header:{title:e.t("sheetImage.panel.title")},children:{label:Je},onClose:()=>{o.focusDrawing(null)},width:360});break;case"close":default:t.close();break}return!0}},We={id:"sheet.operation.edit-sheet-image",type:u.CommandType.OPERATION,handler:(i,n)=>{const t=i.get(A.IDrawingManagerService),e=i.get(u.ICommandService);return n==null?!1:(t.focusDrawing([n]),e.executeCommand(je.id,{value:"open"}),!0)}};var be={exports:{}},ie={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var tt=H,nt=Symbol.for("react.element"),rt=Symbol.for("react.fragment"),it=Object.prototype.hasOwnProperty,ot=tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,st={key:!0,ref:!0,__self:!0,__source:!0};function Ge(i,n,r){var e,t={},o=null,s=null;r!==void 0&&(o=""+r),n.key!==void 0&&(o=""+n.key),n.ref!==void 0&&(s=n.ref);for(e in n)it.call(n,e)&&!st.hasOwnProperty(e)&&(t[e]=n[e]);if(i&&i.defaultProps)for(e in n=i.defaultProps,n)t[e]===void 0&&(t[e]=n[e]);return{$$typeof:nt,type:i,key:o,ref:s,props:t,_owner:ot.current}}ve.Fragment=rt;ve.jsx=Ge;ve.jsxs=Ge;$e.exports=ve;var k=$e.exports;const at="univer-upload-loading",ct="univer-upload-loading-body",dt="univer-upload-loading-body-animation",lt="univer-UniverCircleAnimation",ut="univer-upload-loading-body-text",ce={uploadLoading:at,uploadLoadingBody:ct,uploadLoadingBodyAnimation:dt,univerCircleAnimation:lt,uploadLoadingBodyText:ut},gt=()=>{const i=m.useDependency(O.IImageIoService),n=m.useDependency(m.LocaleService),[r,e]=H.useState(0);return H.useEffect(()=>{const t=i.change$.subscribe(o=>{e(o)});return()=>{t.unsubscribe()}},[i]),k.jsx("div",{style:{display:r>0?"block":"none"},className:ce.uploadLoading,children:k.jsxs("div",{className:ce.uploadLoadingBody,children:[k.jsx("div",{className:ce.uploadLoadingBodyAnimation}),k.jsx("div",{className:ce.uploadLoadingBodyText,children:`${n.t("uploadLoading.loading")}: ${r}`})]})})};var ht=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,pt=(i,n,r,e)=>{for(var t=e>1?void 0:e?mt(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&ht(n,r,t),t},Q=(i,n)=>(r,e)=>n(r,e,i);let he=class extends m.RxDisposable{constructor(n,r,e,t,o,s,c){super();Y(this,"_initImagePopupMenu",new Set);this._injector=n,this._drawingManagerService=r,this._canvasPopManagerService=e,this._renderManagerService=t,this._univerInstanceService=o,this._contextService=s,this._uiPartsService=c,this._init()}_init(){this._univerInstanceService.getCurrentTypeOfUnit$(m.UniverInstanceType.UNIVER_SHEET).pipe(L.takeUntil(this.dispose$)).subscribe(n=>this._create(n)),this._univerInstanceService.getTypeOfUnitDisposed$(m.UniverInstanceType.UNIVER_SHEET).pipe(L.takeUntil(this.dispose$)).subscribe(n=>this._dispose(n)),this._univerInstanceService.getAllUnitsForType(m.UniverInstanceType.UNIVER_SHEET).forEach(n=>this._create(n)),this._uiPartsService.registerComponent(G.BuiltInUIPart.CONTENT,()=>m.connectInjector(gt,this._injector))}_dispose(n){const r=n.getUnitId();this._renderManagerService.removeRender(r)}_create(n){if(!n)return;const r=n.getUnitId();this._renderManagerService.has(r)&&!this._initImagePopupMenu.has(r)&&(this._popupMenuListener(r),this._initImagePopupMenu.add(r))}_hasCropObject(n){const r=n.getAllObjectsByOrder();for(const e of r)if(e instanceof te.ImageCropperObject)return!0;return!1}_popupMenuListener(n){var o;const r=(o=this._renderManagerService.getRenderById(n))==null?void 0:o.scene;if(!r)return;const e=r.getTransformerByCreate();if(!e)return;let t;this.disposeWithMe(m.toDisposable(e.createControl$.subscribe(()=>{if(this._contextService.setContextValue(m.FOCUSING_COMMON_DRAWINGS,!0),this._hasCropObject(r))return;const s=e.getSelectedObjectMap();if(s.size>1){t==null||t.dispose();return}const c=s.values().next().value;if(!c)return;const d=c.oKey,h=this._drawingManagerService.getDrawingOKey(d);if(!h)return;const{unitId:l,subUnitId:a,drawingId:u,drawingType:g}=h,f=h.data;if(f&&f.disablePopup)return;t==null||t.dispose();const w=this._canvasPopManagerService.getFeatureMenu(l,a,u,g);t=this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(c,{componentKey:te.COMPONENT_IMAGE_POPUP_MENU,direction:"horizontal",offset:[2,0],extraProps:{menuItems:w||this._getImageMenuItems(l,a,u,g)}})),this._drawingManagerService.focusDrawing([{unitId:l,subUnitId:a,drawingId:u}])}))),this.disposeWithMe(e.clearControl$.subscribe(()=>{t==null||t.dispose(),this._contextService.setContextValue(m.FOCUSING_COMMON_DRAWINGS,!1),this._drawingManagerService.focusDrawing(null)})),this.disposeWithMe(e.changing$.subscribe(()=>{t==null||t.dispose()}))}_getImageMenuItems(n,r,e,t){return[{label:"image-popup.edit",index:0,commandId:Oe.id,commandParams:{unitId:n,subUnitId:r,drawingId:e},disable:t===O.DrawingTypeEnum.DRAWING_DOM},{label:"image-popup.delete",index:1,commandId:ie.id,commandParams:{unitId:n,drawings:[{unitId:n,subUnitId:r,drawingId:e}]},disable:!1},{label:"image-popup.crop",index:2,commandId:te.OpenImageCropOperation.id,commandParams:{unitId:n,subUnitId:r,drawingId:e},disable:t===O.DrawingTypeEnum.DRAWING_DOM},{label:"image-popup.reset",index:3,commandId:te.ImageResetSizeOperation.id,commandParams:[{unitId:n,subUnitId:r,drawingId:e}],disable:t===O.DrawingTypeEnum.DRAWING_DOM}]}};he=pt([Q(0,m.Inject(m.Injector)),Q(1,O.IDrawingManagerService),Q(2,m.Inject(U.SheetCanvasPopManagerService)),Q(3,N.IRenderManagerService),Q(4,m.IUniverInstanceService),Q(5,m.IContextService),Q(6,m.Inject(G.IUIPartsService))],he);function V(i,n,r){const{from:e,to:t,flipY:o=!1,flipX:s=!1,angle:c=0,skewX:d=0,skewY:h=0}=i,{column:l,columnOffset:a,row:u,rowOffset:g}=e,{column:f,columnOffset:w,row:S,rowOffset:C}=t,y=r.getCurrentSkeleton(),I=U.attachRangeWithCoord(y,{startColumn:l,endColumn:l,startRow:u,endRow:u});if(I==null)return;const T=U.attachRangeWithCoord(y,{startColumn:f,endColumn:f,startRow:S,endRow:S});if(T==null)return;const{startX:_,startY:M}=I,{startX:v,startY:P}=T;let b=N.precisionTo(_+a,1),j=N.precisionTo(M+g,1),A=N.precisionTo(v+w-b,1),E=N.precisionTo(P+C-j,1);I.startX===T.endX&&(A=0),I.startY===T.endY&&(E=0);const R=y.rowHeaderWidth+y.columnTotalWidth,W=y.columnHeaderHeight+y.rowTotalHeight;return b+A>R&&(b=R-A),j+E>W&&(j=W-E),{flipY:o,flipX:s,angle:c,skewX:d,skewY:h,left:b,top:j,width:A,height:E}}function $(i,n){const{left:r=0,top:e=0,width:t=0,height:o=0,flipY:s=!1,flipX:c=!1,angle:d=0,skewX:h=0,skewY:l=0}=i,a=n.getCellWithCoordByOffset(r,e);if(a==null)return;const u={column:a.actualColumn,columnOffset:N.precisionTo(r-a.startX,1),row:a.actualRow,rowOffset:N.precisionTo(e-a.startY,1)},g=n.getCellWithCoordByOffset(r+t,e+o);if(g==null)return;const f={column:g.actualColumn,columnOffset:N.precisionTo(r+t-g.startX,1),row:g.actualRow,rowOffset:N.precisionTo(e+o-g.startY,1)};return{flipY:s,flipX:c,angle:d,skewX:h,skewY:l,from:u,to:f}}var ft=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,St=(i,n,r,e)=>{for(var t=e>1?void 0:e?wt(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&ft(n,r,t),t},de=(i,n)=>(r,e)=>n(r,e,i);let Re=class extends m.Disposable{constructor(i,n,r,e,t){super(),this._context=i,this._sheetDrawingService=n,this._drawingManagerService=r,this._sheetSelectionRenderService=e,this._sheetSkeletonManagerService=t,this._init()}_init(){this._drawingInitializeListener()}_drawingInitializeListener(){this._sheetDrawingService.initializeNotification(this._context.unitId);const i=this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);for(const n in i){const r=i[n];for(const e in r.data){const t=r.data[e];t.transform=V(t.sheetTransform,this._sheetSelectionRenderService,this._sheetSkeletonManagerService)}}this._drawingManagerService.registerDrawingData(this._context.unitId,this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)),this._drawingManagerService.initializeNotification(this._context.unitId)}};Re=St([de(1,p.ISheetDrawingService),de(2,O.IDrawingManagerService),de(3,m.Inject(U.ISheetSelectionRenderService)),de(4,m.Inject(U.SheetSkeletonManagerService))],Re);var X=function(){return X=Object.assign||function(i){for(var n,r=1,e=arguments.length;r<e;r++){n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(i[t]=n[t])}return i},X.apply(this,arguments)},vt=function(i,n){var r={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&n.indexOf(e)<0&&(r[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,e=Object.getOwnPropertySymbols(i);t<e.length;t++)n.indexOf(e[t])<0&&Object.prototype.propertyIsEnumerable.call(i,e[t])&&(r[e[t]]=i[e[t]]);return r},ke=H.forwardRef(function(i,n){var r=i.icon,e=i.id,t=i.className,o=i.extend,s=vt(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(t||"").trim(),d=H.useRef("_".concat(It()));return Ve(r,"".concat(e),{defIds:r.defIds,idSuffix:d.current},X({ref:n,className:c},s),o)});function Ve(i,n,r,e,t){return H.createElement(i.tag,X(X({key:n},_t(i,r,t)),e),(Dt(i,r).children||[]).map(function(o,s){return Ve(o,"".concat(n,"-").concat(i.tag,"-").concat(s),r,void 0,t)}))}function _t(i,n,r){var e=X({},i.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1);var t=n.defIds;return!t||t.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+n.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),e}function Dt(i,n){var r,e=n.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((r=i.children)===null||r===void 0)&&r.length)?X(X({},i),{children:i.children.map(function(t){return typeof t.attrs.id=="string"&&e&&e.indexOf(t.attrs.id)>-1?X(X({},t),{attrs:X(X({},t.attrs),{id:t.attrs.id+n.idSuffix})}):t})}):i}function It(){return Math.random().toString(36).substring(2,8)}ke.displayName="UniverIcon";var Ct={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"}}]},Fe=H.forwardRef(function(i,n){return H.createElement(ke,Object.assign({},i,{id:"add-image-single",ref:n,icon:Ct}))});Fe.displayName="AddImageSingle";const Ee={id:"sheet.command.delete-drawing",type:m.CommandType.COMMAND,handler:i=>{const n=i.get(m.ICommandService),e=i.get(p.ISheetDrawingService).getFocusDrawings();if(e.length===0)return!1;const t=e[0].unitId,o=e.map(s=>{const{unitId:c,subUnitId:d,drawingId:h,drawingType:l}=s;return{unitId:c,subUnitId:d,drawingId:h,drawingType:l}});return n.executeCommand(ie.id,{unitId:t,drawings:o})}};function yt(i){const n=[];return i.forEach(r=>{const{parent:e,children:t}=r,{unitId:o,subUnitId:s,drawingId:c}=e,d=N.getGroupState(0,0,t.map(a=>a.transform||{})),h=t.map(a=>{const u=a.transform||{left:0,top:0},{unitId:g,subUnitId:f,drawingId:w}=a;return{unitId:g,subUnitId:f,drawingId:w,transform:{...u,left:u.left-d.left,top:u.top-d.top},groupId:c}}),l={unitId:o,subUnitId:s,drawingId:c,drawingType:O.DrawingTypeEnum.DRAWING_GROUP,transform:d};n.push({parent:l,children:h})}),n}function Mt(i){const n=[];return i.forEach(r=>{const{parent:e,children:t}=r,{unitId:o,subUnitId:s,drawingId:c,transform:d={width:0,height:0}}=e;if(d==null)return;const h=t.map(a=>{const{transform:u}=a,{unitId:g,subUnitId:f,drawingId:w}=a,S=N.transformObjectOutOfGroup(u||{},d,d.width||0,d.height||0);return{unitId:g,subUnitId:f,drawingId:w,transform:S,groupId:void 0}}),l={unitId:o,subUnitId:s,drawingId:c,drawingType:O.DrawingTypeEnum.DRAWING_GROUP,transform:{left:0,top:0}};n.push({parent:l,children:h})}),n}const Pe={id:"sheet.command.group-sheet-image",type:m.CommandType.COMMAND,handler:(i,n)=>{const r=i.get(m.ICommandService),e=i.get(m.IUndoRedoService),t=i.get(p.ISheetDrawingService);if(!n)return!1;const o=[];n.forEach(({parent:g,children:f})=>{o.push(g.unitId),f.forEach(w=>{o.push(w.unitId)})});const s=t.getGroupDrawingOp(n),{unitId:c,subUnitId:d,undo:h,redo:l,objects:a}=s;return r.syncExecuteCommand(p.SetDrawingApplyMutation.id,{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.GROUP})?(e.pushUndoRedo({unitID:c,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:h,unitId:c,subUnitId:d,objects:Mt(a),type:p.DrawingApplyType.UNGROUP}},{id:x.id,params:o}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.GROUP}},{id:x.id,params:o}]}),!0):!1}},oe={id:"sheet.command.insert-sheet-image",type:m.CommandType.COMMAND,handler:(i,n)=>{var y,I,T;const r=i.get(m.ICommandService),e=i.get(m.IUndoRedoService),t=i.get(p.ISheetDrawingService),o=i.get(D.SheetInterceptorService);if(!n)return!1;const s=n.drawings,c=s.map(_=>_.unitId),d=t.getBatchAddOp(s),{unitId:h,subUnitId:l,undo:a,redo:u,objects:g}=d,f=o.onCommandExecute({id:oe.id,params:n}),w={id:p.SetDrawingApplyMutation.id,params:{op:u,unitId:h,subUnitId:l,objects:g,type:p.DrawingApplyType.INSERT}},S={id:p.SetDrawingApplyMutation.id,params:{op:a,unitId:h,subUnitId:l,objects:g,type:p.DrawingApplyType.REMOVE}};return m.sequenceExecute([...(y=f.preRedos)!=null?y:[],w,...f.redos],r)?(e.pushUndoRedo({unitID:h,undoMutations:[...(I=f.preUndos)!=null?I:[],S,...f.undos,{id:x.id,params:c}],redoMutations:[...(T=f.preRedos)!=null?T:[],w,...f.redos,{id:x.id,params:c}]}),!0):!1}},Ae={id:"sheet.command.set-drawing-arrange",type:m.CommandType.COMMAND,handler:(i,n)=>{const r=i.get(m.ICommandService),e=i.get(m.IUndoRedoService);if(!n)return!1;const t=i.get(p.ISheetDrawingService),{unitId:o,subUnitId:s,drawingIds:c,arrangeType:d}=n,h={unitId:o,subUnitId:s,drawingIds:c};let l;if(d===O.ArrangeTypeEnum.forward?l=t.getForwardDrawingsOp(h):d===O.ArrangeTypeEnum.backward?l=t.getBackwardDrawingOp(h):d===O.ArrangeTypeEnum.front?l=t.getFrontDrawingsOp(h):d===O.ArrangeTypeEnum.back&&(l=t.getBackDrawingsOp(h)),l==null)return!1;const{objects:a,redo:u,undo:g}=l;return r.syncExecuteCommand(p.SetDrawingApplyMutation.id,{op:u,unitId:o,subUnitId:s,objects:a,type:p.DrawingApplyType.ARRANGE})?(e.pushUndoRedo({unitID:o,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:g,unitId:o,subUnitId:s,objects:a,type:p.DrawingApplyType.ARRANGE}}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:u,unitId:o,subUnitId:s,objects:a,type:p.DrawingApplyType.ARRANGE}}]}),!0):!1}},se={id:"sheet.command.set-sheet-image",type:m.CommandType.COMMAND,handler:(i,n)=>{const r=i.get(m.ICommandService),e=i.get(m.IUndoRedoService),t=i.get(p.ISheetDrawingService);if(!n)return!1;const{drawings:o}=n,s=t.getBatchUpdateOp(o),{unitId:c,subUnitId:d,undo:h,redo:l,objects:a}=s;return r.syncExecuteCommand(p.SetDrawingApplyMutation.id,{unitId:c,subUnitId:d,op:l,objects:a,type:p.DrawingApplyType.UPDATE})?(e.pushUndoRedo({unitID:c,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{unitId:c,subUnitId:d,op:h,objects:a,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[c]}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{unitId:c,subUnitId:d,op:l,objects:a,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[c]}]}),!0):!1}},Ue={id:"sheet.command.ungroup-sheet-image",type:m.CommandType.COMMAND,handler:(i,n)=>{const r=i.get(m.ICommandService),e=i.get(m.IUndoRedoService),t=i.get(p.ISheetDrawingService);if(!n)return!1;const o=[];n.forEach(({parent:g,children:f})=>{o.push(g.unitId),f.forEach(w=>{o.push(w.unitId)})});const s=t.getUngroupDrawingOp(n),{unitId:c,subUnitId:d,undo:h,redo:l,objects:a}=s;return r.syncExecuteCommand(p.SetDrawingApplyMutation.id,{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.UNGROUP})?(e.pushUndoRedo({unitID:c,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:h,unitId:c,subUnitId:d,objects:yt(a),type:p.DrawingApplyType.GROUP}},{id:x.id,params:o}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.UNGROUP}},{id:x.id,params:o}]}),!0):!1}};var Rt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,bt=(i,n,r,e)=>{for(var t=e>1?void 0:e?Tt(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&Rt(n,r,t),t},K=(i,n)=>(r,e)=>n(r,e,i);let me=class extends m.Disposable{constructor(n,r,e,t,o,s,c,d,h,l,a,u){super();Y(this,"_workbookSelections");this._context=n,this._skeletonManagerService=r,this._commandService=e,this._selectionRenderService=t,this._imageIoService=o,this._fileOpenerService=s,this._sheetDrawingService=c,this._drawingManagerService=d,this._contextService=h,this._messageService=l,this._localeService=a,this._workbookSelections=u.getWorkbookSelections(this._context.unitId),this._updateImageListener(),this._updateOrderListener(),this._groupDrawingListener(),this._focusDrawingListener()}async insertFloatImage(){const n=await this._fileOpenerService.openFile({multiple:!0,accept:O.DRAWING_IMAGE_ALLOW_IMAGE_LIST.map(e=>`.${e.replace("image/","")}`).join(",")}),r=n.length;return r>O.DRAWING_IMAGE_COUNT_LIMIT?(this._messageService.show({type:Z.MessageType.Error,content:this._localeService.t("update-status.exceedMaxCount",String(O.DRAWING_IMAGE_COUNT_LIMIT))}),!1):r===0?!1:(n.forEach(async e=>await this._insertFloatImage(e)),!0)}async _insertFloatImage(n){let r;try{r=await this._imageIoService.saveImage(n)}catch(y){const I=y.message;I===O.ImageUploadStatusType.ERROR_EXCEED_SIZE?this._messageService.show({type:Z.MessageType.Error,content:this._localeService.t("update-status.exceedMaxSize",String(O.DRAWING_IMAGE_ALLOW_SIZE/(1024*1024)))}):I===O.ImageUploadStatusType.ERROR_IMAGE_TYPE?this._messageService.show({type:Z.MessageType.Error,content:this._localeService.t("update-status.invalidImageType")}):I===O.ImageUploadStatusType.ERROR_IMAGE&&this._messageService.show({type:Z.MessageType.Error,content:this._localeService.t("update-status.invalidImage")})}if(r==null)return;const e=this._getUnitInfo(),{unitId:t,subUnitId:o}=e,{imageId:s,imageSourceType:c,source:d,base64Cache:h}=r,{width:l,height:a,image:u}=await O.getImageSize(h||""),{width:g,height:f}=this._context.scene;this._imageIoService.addImageSourceCache(d,c,u);let w=1;if(l>O.DRAWING_IMAGE_WIDTH_LIMIT||a>O.DRAWING_IMAGE_HEIGHT_LIMIT){const y=O.DRAWING_IMAGE_WIDTH_LIMIT/l,I=O.DRAWING_IMAGE_HEIGHT_LIMIT/a;w=Math.max(y,I)}const S=this._getImagePosition(l*w,a*w,g,f);if(S==null)return;const C={unitId:t,subUnitId:o,drawingId:s,drawingType:O.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:c,source:d,transform:V(S,this._selectionRenderService,this._skeletonManagerService),sheetTransform:S};this._commandService.executeCommand(oe.id,{unitId:t,drawings:[C]})}_getUnitInfo(){const n=this._context.unit,r=n.getActiveSheet(),e=n.getUnitId(),t=r.getSheetId();return{unitId:e,subUnitId:t}}_getImagePosition(n,r,e,t){const o=this._workbookSelections.getCurrentSelections();let s={startRow:0,endRow:0,startColumn:0,endColumn:0};o&&o.length>0&&(s=o[o.length-1].range);const c=U.attachRangeWithCoord(this._skeletonManagerService.getCurrent().skeleton,s);if(c==null)return;let{startColumn:d,startRow:h,startX:l,startY:a}=c,u=!1;if(l+n>e&&(l=e-n,l<0&&(l=0,n=e),u=!0),a+r>t&&(a=t-r,a<0&&(a=0,r=t),u=!0),u){const S=this._selectionRenderService.getCellWithCoordByOffset(l,a);if(S==null)return;l=S.startX,a=S.startY,d=S.actualColumn,h=S.actualRow}const g={column:d,columnOffset:0,row:h,rowOffset:0},f=this._selectionRenderService.getCellWithCoordByOffset(l+n,a+r);if(f==null)return;const w={column:f.actualColumn,columnOffset:l+n-f.startX,row:f.actualRow,rowOffset:a+r-f.startY};return{from:g,to:w}}_updateOrderListener(){this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe(n=>{const{unitId:r,subUnitId:e,drawingIds:t,arrangeType:o}=n;this._commandService.executeCommand(Ae.id,{unitId:r,subUnitId:e,drawingIds:t,arrangeType:o})}))}_updateImageListener(){this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe(n=>{const r=[];n.length!==0&&(n.forEach(e=>{const{unitId:t,subUnitId:o,drawingId:s,drawingType:c,transform:d}=e;if(d==null)return;const h=this._sheetDrawingService.getDrawingByParam({unitId:t,subUnitId:o,drawingId:s});if(h==null||h.unitId!==this._context.unitId)return;const l=$({...h.transform,...d},this._selectionRenderService);if(l==null)return;const a={...e,transform:{...h.transform,...d,...V(l,this._selectionRenderService,this._skeletonManagerService)},sheetTransform:{...l}};r.push(a)}),r.length>0&&this._commandService.executeCommand(se.id,{unitId:n[0].unitId,drawings:r}))}))}_groupDrawingListener(){this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe(n=>{this._commandService.executeCommand(Pe.id,n);const{unitId:r,subUnitId:e,drawingId:t}=n[0].parent;this._drawingManagerService.focusDrawing([{unitId:r,subUnitId:e,drawingId:t}])})),this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe(n=>{this._commandService.executeCommand(Ue.id,n)}))}_focusDrawingListener(){this.disposeWithMe(this._drawingManagerService.focus$.subscribe(n=>{n==null||n.length===0?(this._contextService.setContextValue(m.FOCUSING_COMMON_DRAWINGS,!1),this._sheetDrawingService.focusDrawing([])):(this._contextService.setContextValue(m.FOCUSING_COMMON_DRAWINGS,!0),this._sheetDrawingService.focusDrawing(n))}))}};me=bt([K(1,m.Inject(U.SheetSkeletonManagerService)),K(2,m.ICommandService),K(3,U.ISheetSelectionRenderService),K(4,O.IImageIoService),K(5,G.ILocalFileService),K(6,p.ISheetDrawingService),K(7,O.IDrawingManagerService),K(8,m.IContextService),K(9,G.IMessageService),K(10,m.Inject(m.LocaleService)),K(11,m.Inject(D.SheetsSelectionsService))],me);const _e={id:"sheet.command.insert-float-image",type:m.CommandType.COMMAND,handler:i=>{var r,e;return(e=(r=i.get(N.IRenderManagerService).getCurrentTypeOfRenderer(m.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.with(me).insertFloatImage())!=null?e:!1}},ne={id:"sheet.command.move-drawing",type:m.CommandType.COMMAND,handler:(i,n)=>{const r=i.get(m.ICommandService),e=i.get(p.ISheetDrawingService),t=i.get(U.ISheetSelectionRenderService),{direction:o}=n,s=e.getFocusDrawings();if(s.length===0)return!1;const c=s[0].unitId,d=s.map(l=>{const{transform:a}=l;if(a==null)return null;const u={...a},{left:g=0,top:f=0}=a;return o===m.Direction.UP?u.top=f-1:o===m.Direction.DOWN?u.top=f+1:o===m.Direction.LEFT?u.left=g-1:o===m.Direction.RIGHT&&(u.left=g+1),{...l,transform:u,sheetTransform:$(u,t)}}).filter(l=>l!=null);return r.syncExecuteCommand(se.id,{unitId:c,drawings:d})?(r.syncExecuteCommand(x.id,[c]),!0):!1}},Ye="addition-and-subtraction-single",Ne="sheet.menu.image";function Ot(i){return{id:Ne,type:G.MenuItemType.SUBITEMS,icon:Ye,tooltip:"sheetImage.title",hidden$:G.getMenuHiddenObservable(i,m.UniverInstanceType.UNIVER_SHEET),disabled$:U.getCurrentRangeDisable$(i,{workbookTypes:[D.WorkbookEditablePermission],worksheetTypes:[D.WorksheetEditPermission],rangeTypes:[D.RangeProtectionPermissionEditPoint]})}}function Et(i){return{id:_e.id,title:"sheetImage.upload.float",type:G.MenuItemType.BUTTON,hidden$:G.getMenuHiddenObservable(i,m.UniverInstanceType.UNIVER_SHEET)}}const Pt="univer-image-common-panel",At="univer-image-common-panel-grid",Ut="univer-image-common-panel-border",Nt="univer-image-common-panel-title",jt="univer-image-common-panel-subtitle",Wt="univer-image-common-panel-row",Lt="univer-image-common-panel-row-vertical",xt="univer-image-common-panel-column",Bt="univer-image-common-panel-column-center",$t="univer-image-common-panel-inline",Gt="univer-image-common-panel-span2",kt="univer-image-common-panel-span3",Vt="univer-image-common-panel-input",Ft="univer-sheet-image-menu",Yt="univer-sheet-image-menu-input",J={imageCommonPanel:Pt,imageCommonPanelGrid:At,imageCommonPanelBorder:Ut,imageCommonPanelTitle:Nt,imageCommonPanelSubtitle:jt,imageCommonPanelRow:Wt,imageCommonPanelRowVertical:Lt,imageCommonPanelColumn:xt,imageCommonPanelColumnCenter:Bt,imageCommonPanelInline:$t,imageCommonPanelSpan2:Gt,imageCommonPanelSpan3:kt,imageCommonPanelInput:Vt,sheetImageMenu:Ft,sheetImageMenuInput:Yt};function He(i){var n,r,e="";if(typeof i=="string"||typeof i=="number")e+=i;else if(typeof i=="object")if(Array.isArray(i)){var t=i.length;for(n=0;n<t;n++)i[n]&&(r=He(i[n]))&&(e&&(e+=" "),e+=r)}else for(r in i)i[r]&&(e&&(e+=" "),e+=r);return e}function le(){for(var i,n,r=0,e="",t=arguments.length;r<t;r++)(i=arguments[r])&&(n=He(i))&&(e&&(e+=" "),e+=n);return e}const Ht=i=>{var I;const n=m.useDependency(m.ICommandService),r=m.useDependency(m.LocaleService),e=m.useDependency(O.IDrawingManagerService),t=m.useDependency(N.IRenderManagerService),{drawings:o}=i,s=o[0];if(s==null)return;const{unitId:c}=s,d=t.getRenderById(c),h=d==null?void 0:d.scene;if(h==null)return;const l=h.getTransformerByCreate(),[a,u]=H.useState(!0),g=(I=s.anchorType)!=null?I:p.SheetDrawingAnchorType.Position,[f,w]=H.useState(g);function S(T,_){const M=[];return T.forEach(v=>{const{oKey:P}=v,b=_.getDrawingOKey(P);if(b==null)return M.push(null),!0;const{unitId:j,subUnitId:A,drawingId:E,drawingType:R,anchorType:W,sheetTransform:B}=b;M.push({unitId:j,subUnitId:A,drawingId:E,anchorType:W,sheetTransform:B,drawingType:R})}),M}H.useEffect(()=>{const T=l.clearControl$.subscribe(M=>{M===!0&&u(!1)}),_=l.changeStart$.subscribe(M=>{var b;const{objects:v}=M,P=S(v,e);if(P.length===0)u(!1);else if(P.length>=1){u(!0);const j=((b=P[0])==null?void 0:b.anchorType)||p.SheetDrawingAnchorType.Position;w(j)}});return()=>{_.unsubscribe(),T.unsubscribe()}},[]);function C(T){w(T);const _=e.getFocusDrawings();if(_.length===0)return;const M=_.map(v=>({unitId:v.unitId,subUnitId:v.subUnitId,drawingId:v.drawingId,anchorType:T}));n.executeCommand(se.id,{unitId:_[0].unitId,drawings:M})}const y=T=>T?"block":"none";return k.jsxs("div",{className:le(J.imageCommonPanelGrid,J.imageCommonPanelBorder),style:{display:y(a)},children:[k.jsx("div",{className:J.imageCommonPanelRow,children:k.jsx("div",{className:le(J.imageCommonPanelColumn,J.imageCommonPanelTitle),children:k.jsx("div",{children:r.t("drawing-anchor.title")})})}),k.jsx("div",{className:le(J.imageCommonPanelRow),children:k.jsx("div",{className:le(J.imageCommonPanelColumn),children:k.jsxs(Z.RadioGroup,{value:f,onChange:C,direction:"vertical",children:[k.jsx(Z.Radio,{value:p.SheetDrawingAnchorType.Both,children:r.t("drawing-anchor.both")}),k.jsx(Z.Radio,{value:p.SheetDrawingAnchorType.Position,children:r.t("drawing-anchor.position")}),k.jsx(Z.Radio,{value:p.SheetDrawingAnchorType.None,children:r.t("drawing-anchor.none")})]})})})]})},Xt=()=>{const i=m.useDependency(O.IDrawingManagerService),n=i.getFocusDrawings(),[r,e]=H.useState(n);return H.useEffect(()=>{const t=i.focus$.subscribe(o=>{e(o)});return()=>{t.unsubscribe()}},[]),!!(r!=null&&r.length)&&k.jsxs("div",{className:J.imageCommonPanel,children:[k.jsx(te.DrawingCommonPanel,{drawings:r}),k.jsx(Ht,{drawings:r})]})},Kt={[G.RibbonStartGroup.FORMULAS_INSERT]:{[Ne]:{order:3,menuItemFactory:Ot,[_e.id]:{order:0,menuItemFactory:Et}}}};function ae(i){return!i.getContextValue(m.FOCUSING_FX_BAR_EDITOR)&&!i.getContextValue(m.EDITOR_ACTIVATED)&&!i.getContextValue(m.FOCUSING_PANEL_EDITOR)&&i.getContextValue(m.FOCUSING_COMMON_DRAWINGS)}const zt={id:ne.id,description:"shortcut.sheet.drawing-move-down",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_DOWN,priority:100,preconditions:ae,staticParameters:{direction:m.Direction.DOWN}},qt={id:ne.id,description:"shortcut.sheet.drawing-move-up",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_UP,priority:100,preconditions:ae,staticParameters:{direction:m.Direction.UP}},Jt={id:ne.id,description:"shortcut.sheet.drawing-move-left",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_LEFT,priority:100,preconditions:ae,staticParameters:{direction:m.Direction.LEFT}},Zt={id:ne.id,description:"shortcut.sheet.drawing-move-right",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_RIGHT,priority:100,preconditions:ae,staticParameters:{direction:m.Direction.RIGHT}},Qt={id:Ee.id,description:"shortcut.sheet.drawing-delete",group:"4_sheet-drawing-view",preconditions:ae,binding:G.KeyCode.DELETE,mac:G.KeyCode.BACKSPACE};var en=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,nn=(i,n,r,e)=>{for(var t=e>1?void 0:e?tn(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&en(n,r,t),t},ue=(i,n)=>(r,e)=>n(r,e,i);let pe=class extends m.Disposable{constructor(i,n,r,e){super(),this._componentManager=i,this._menuManagerService=n,this._commandService=r,this._shortcutService=e,this._init()}_initCustomComponents(){const i=this._componentManager;this.disposeWithMe(i.register(Ye,Fe)),this.disposeWithMe(i.register(Be,Xt))}_initMenus(){this._menuManagerService.mergeMenu(Kt)}_initCommands(){[_e,oe,ie,se,be,x,Oe,Pe,Ue,ne,Ee,Ae].forEach(i=>this.disposeWithMe(this._commandService.registerCommand(i)))}_initShortcuts(){[zt,qt,Jt,Zt,Qt].forEach(i=>{this.disposeWithMe(this._shortcutService.registerShortcut(i))})}_init(){this._initCommands(),this._initCustomComponents(),this._initMenus(),this._initShortcuts()}};pe=nn([ue(0,m.Inject(G.ComponentManager)),ue(1,G.IMenuManagerService),ue(2,m.ICommandService),ue(3,G.IShortcutService)],pe);var rn=Object.defineProperty,on=Object.getOwnPropertyDescriptor,sn=(i,n,r,e)=>{for(var t=e>1?void 0:e?on(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&rn(n,r,t),t},Ce=(i,n)=>(r,e)=>n(r,e,i);let fe=class extends m.Disposable{constructor(n,r,e){super();Y(this,"_copyInfo");this._sheetClipboardService=n,this._renderManagerService=r,this._sheetDrawingService=e,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:"SHEET_IMAGE_UI_PLUGIN",onBeforeCopy:(n,r,e)=>this._collect(n,r,e),onPasteCells:(n,r,e,t)=>{const{copyType:o=U.COPY_TYPE.COPY,pasteType:s}=t,{range:c}=n||{},{range:d,unitId:h,subUnitId:l}=r;return this._generateMutations(d,{copyType:o,pasteType:s,copyRange:c,unitId:h,subUnitId:l})},onPastePlainText:(n,r)=>({undos:[],redos:[]})})}_collect(n,r,e){var u;const t=(u=this._renderManagerService.getRenderById(n))==null?void 0:u.with(U.SheetSkeletonManagerService);if(!t)return;const o=t.attachRangeWithCoord(e);if(!o)return;const{startX:s,endX:c,startY:d,endY:h}=o,l=this._sheetDrawingService.getDrawingData(n,r),a=[];Object.keys(l).forEach(g=>{const f=l[g],{transform:w}=f;if(f.anchorType!==p.SheetDrawingAnchorType.Both||!w)return;const{left:S=0,top:C=0,width:y=0,height:I=0}=w,{drawingStartX:T,drawingEndX:_,drawingStartY:M,drawingEndY:v}={drawingStartX:S,drawingEndX:S+y,drawingStartY:C,drawingEndY:C+I};s<=T&&_<=c&&d<=M&&v<=h&&a.push(f)}),a.length&&(this._copyInfo={drawings:a,unitId:n,subUnitId:r})}_generateMutations(n,r){var b;if(!this._copyInfo)return{redos:[],undos:[]};if([U.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,U.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,U.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,U.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(r.pasteType))return{redos:[],undos:[]};const{copyRange:e}=r;if(!e)return{redos:[],undos:[]};const{drawings:t,unitId:o,subUnitId:s}=this._copyInfo,{ranges:[c,d],mapFunc:h}=U.virtualizeDiscreteRanges([e,n]),{row:l,col:a}=h(c.startRow,c.startColumn),{row:u,col:g}=h(d.startRow,d.startColumn),f=(b=this._renderManagerService.getRenderById(o))==null?void 0:b.with(U.SheetSkeletonManagerService);if(!f)return{redos:[],undos:[]};const w=f.attachRangeWithCoord({startRow:l,endRow:l,startColumn:a,endColumn:a}),S=f.attachRangeWithCoord({startRow:u,endRow:u,startColumn:g,endColumn:g});if(!w||!S)return{redos:[],undos:[]};const C=[],y=[],I=S.startX-w.startX,T=S.startY-w.startY,_=u-l,M=g-a,v=r.copyType===U.COPY_TYPE.CUT,{_sheetDrawingService:P}=this;return t.forEach(j=>{const{transform:A,sheetTransform:E}=j;if(!A)return;const R={...j,unitId:o,subUnitId:s,drawingId:v?j.drawingId:m.Tools.generateRandomId(),transform:{...A,left:A.left+I,top:A.top+T},sheetTransform:{to:{...E.to,row:E.to.row+_,column:E.to.column+M},from:{...E.from,row:E.from.row+_,column:E.from.column+M}}};if(v){const{undo:W,redo:B,objects:z}=P.getBatchUpdateOp([R]);C.push({id:p.SetDrawingApplyMutation.id,params:{unitId:o,subUnitId:s,type:p.DrawingApplyType.UPDATE,op:B,objects:z}}),y.push({id:p.SetDrawingApplyMutation.id,params:{unitId:o,subUnitId:s,type:p.DrawingApplyType.UPDATE,op:W,objects:z}})}else{const{undo:W,redo:B,objects:z}=P.getBatchAddOp([R]);C.push({id:p.SetDrawingApplyMutation.id,params:{op:B,unitId:o,subUnitId:s,objects:z,type:p.DrawingApplyType.INSERT}}),y.push({id:p.SetDrawingApplyMutation.id,params:{op:W,unitId:o,subUnitId:s,objects:z,type:p.DrawingApplyType.REMOVE}})}}),{redos:C,undos:y}}};fe=sn([Ce(0,U.ISheetClipboardService),Ce(1,N.IRenderManagerService),Ce(2,p.ISheetDrawingService)],fe);var an=Object.defineProperty,cn=Object.getOwnPropertyDescriptor,dn=(i,n,r,e)=>{for(var t=e>1?void 0:e?cn(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&an(n,r,t),t},re=(i,n)=>(r,e)=>n(r,e,i);let we=class extends m.Disposable{constructor(i,n,r,e,t){super(),this._drawingManagerService=i,this._renderManagerService=n,this._permissionService=r,this._univerInstanceService=e,this._userManagerService=t,this._initDrawingVisible(),this._initDrawingEditable(),this._initViewPermissionChange(),this._initEditPermissionChange()}_initDrawingVisible(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(m.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,r])=>{if(!n){this._drawingManagerService.setDrawingVisible(!1);return}n.activeSheet$.subscribe(e=>{if(!e){this._drawingManagerService.setDrawingVisible(!1);return}const t=n.getUnitId(),o=e.getSheetId();if(this._permissionService.composePermission([new D.WorkbookViewPermission(t).id,new D.WorksheetViewPermission(t,o).id]).every(c=>c.value))this._drawingManagerService.setDrawingVisible(!0);else{this._drawingManagerService.setDrawingVisible(!1);const c=n.getUnitId(),d=e.getSheetId(),h=this._drawingManagerService.getDrawingData(c,d),l=Object.values(h),a=this._renderManagerService.getRenderById(c),u=a==null?void 0:a.scene;if(u==null)return;u.getAllObjectsByOrder().forEach(f=>{f.classType===N.RENDER_CLASS_TYPE.IMAGE&&l.some(w=>f.oKey.includes(w.drawingId))&&u.removeObject(f)})}})}))}_initDrawingEditable(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(m.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,r])=>{if(!n){this._drawingManagerService.setDrawingEditable(!1);return}n.activeSheet$.subscribe(e=>{if(!e){this._drawingManagerService.setDrawingEditable(!1);return}const t=n.getUnitId(),o=e.getSheetId();if(this._permissionService.composePermission([new D.WorkbookEditablePermission(t).id,new D.WorksheetEditPermission(t,o).id]).every(c=>c.value))this._drawingManagerService.setDrawingEditable(!0);else{this._drawingManagerService.setDrawingEditable(!1);const c=n.getUnitId(),d=e.getSheetId(),h=this._drawingManagerService.getDrawingData(c,d),l=Object.values(h),a=this._renderManagerService.getRenderById(c),u=a==null?void 0:a.scene;if(u==null)return;u.getAllObjectsByOrder().forEach(f=>{f.classType===N.RENDER_CLASS_TYPE.IMAGE&&l.some(w=>f.oKey.includes(w.drawingId))&&u.detachTransformerFrom(f)})}})}))}_initViewPermissionChange(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(m.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,r])=>{n&&n.activeSheet$.subscribe(e=>{var a;if(!e)return;const t=n.getUnitId(),o=e.getSheetId();let s=!0;const c=this._renderManagerService.getRenderById(t),d=c==null?void 0:c.scene;if(d==null)return;const h=d.getTransformerByCreate(),l=this._permissionService.composePermission$([new D.WorkbookViewPermission(t).id,new D.WorksheetViewPermission(t,o).id]).pipe(L.map(u=>u.every(g=>g.value)));l==null||l.pipe(L.filter(u=>u!==s),L.distinctUntilChanged()).subscribe({next:u=>{s=u,this._drawingManagerService.setDrawingVisible(u);const g=d.getAllObjectsByOrder(),f=this._drawingManagerService.getDrawingData(t,o),w=Object.values(f);u?this._drawingManagerService.addNotification(w):(g.forEach(S=>{S.classType===N.RENDER_CLASS_TYPE.IMAGE&&w.some(C=>S.oKey.includes(C.drawingId))&&d.removeObject(S)}),h.clearSelectedObjects())}}),(a=this._permissionService.getPermissionPoint$(new D.WorksheetViewPermission(t,o).id))==null||a.pipe(L.filter(u=>u.value!==s),L.distinctUntilChanged()).subscribe({complete:()=>{s=!0,this._drawingManagerService.setDrawingVisible(!0);const u=this._drawingManagerService.getDrawingData(t,o),g=Object.values(u);this._drawingManagerService.addNotification(g)}})})}))}_initEditPermissionChange(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(m.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,r])=>{n&&n.activeSheet$.subscribe(e=>{var a;if(!e)return;const t=n.getUnitId(),o=e.getSheetId();let s=!0;const c=this._renderManagerService.getRenderById(t),d=c==null?void 0:c.scene;if(d==null)return;const h=d.getTransformerByCreate(),l=this._permissionService.composePermission$([new D.WorkbookEditablePermission(t).id,new D.WorksheetEditPermission(t,o).id]).pipe(L.map(u=>u.every(g=>g.value)));l==null||l.pipe(L.filter(u=>u!==s),L.distinctUntilChanged()).subscribe({next:u=>{s=u,this._drawingManagerService.setDrawingEditable(u);const g=d.getAllObjectsByOrder(),f=this._drawingManagerService.getDrawingData(t,o),w=Object.values(f);u?(g.forEach(S=>{S.classType===N.RENDER_CLASS_TYPE.IMAGE&&w.some(C=>S.oKey.includes(C.drawingId))&&d.attachTransformerTo(S)}),this._drawingManagerService.addNotification(w)):(g.forEach(S=>{S.classType===N.RENDER_CLASS_TYPE.IMAGE&&w.some(C=>S.oKey.includes(C.drawingId))&&d.detachTransformerFrom(S)}),h.clearSelectedObjects())}}),(a=this._permissionService.getPermissionPoint$(new D.WorksheetEditPermission(t,o).id))==null||a.pipe(L.filter(u=>u.value!==s),L.distinctUntilChanged()).subscribe({complete:()=>{s=!0;const u=n.getUnitId(),g=e.getSheetId(),f=this._drawingManagerService.getDrawingData(u,g),w=Object.values(f),S=this._renderManagerService.getRenderById(u),C=S==null?void 0:S.scene;if(C==null)return;this._drawingManagerService.setDrawingEditable(!0),C.getAllObjectsByOrder().forEach(I=>{I.classType===N.RENDER_CLASS_TYPE.IMAGE&&w.some(T=>I.oKey.includes(T.drawingId))&&C.detachTransformerFrom(I)})}})})}))}};we=dn([re(0,O.IDrawingManagerService),re(1,N.IRenderManagerService),re(2,m.IPermissionService),re(3,m.IUniverInstanceService),re(4,m.Inject(m.UserManagerService))],we);var ln=Object.defineProperty,un=Object.getOwnPropertyDescriptor,gn=(i,n,r,e)=>{for(var t=e>1?void 0:e?un(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&ln(n,r,t),t},ge=(i,n)=>(r,e)=>n(r,e,i);let Se=class extends m.Disposable{constructor(i,n,r,e){super(),this._sheetPrintInterceptorService=i,this._drawingRenderService=n,this._drawingManagerService=r,this._renderManagerService=e,this._initPrinting()}_initPrinting(){this.disposeWithMe(this._sheetPrintInterceptorService.interceptor.intercept(this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,{handler:(i,n,r)=>{const{unitId:e,scene:t,subUnitId:o}=n,s=this._drawingManagerService.getDrawingDataForUnit(e),c=s==null?void 0:s[o];return c&&c.order.forEach(d=>{this._drawingRenderService.renderDrawing(c.data[d],t)}),r()}})),this.disposeWithMe(this._sheetPrintInterceptorService.interceptor.intercept(this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,{handler:(i,n,r)=>{const{unitId:e,subUnitId:t}=n,o=this._renderManagerService.getRenderById(e);if(!o)return r(i);const s=o.with(U.SheetSkeletonManagerService).getWorksheetSkeleton(t);if(!s)return r(i);const c=this._drawingManagerService.getDrawingDataForUnit(e),d=c==null?void 0:c[n.subUnitId];if(!d)return r(i);const{scaleX:h,scaleY:l}=o.scene,a=i?{...i}:{startColumn:0,endColumn:0,endRow:0,startRow:0},u=d.order.map(g=>d.data[g]).filter(g=>g.drawingType!==O.DrawingTypeEnum.DRAWING_DOM);return u.length?(u.forEach(g=>{if(!g.groupId&&g.transform&&m.Tools.isDefine(g.transform.left)&&m.Tools.isDefine(g.transform.top)&&m.Tools.isDefine(g.transform.width)&&m.Tools.isDefine(g.transform.height)){const f=s.skeleton.getCellIndexByOffset(g.transform.left,g.transform.top,h,l,{x:0,y:0}),w=s.skeleton.getCellIndexByOffset(g.transform.left+g.transform.width,g.transform.top+g.transform.height,h,l,{x:0,y:0});f.column<a.startColumn&&(a.startColumn=f.column),f.row<a.startRow&&(a.startRow=f.row),a.endRow<w.row&&(a.endRow=w.row),a.endColumn<w.column&&(a.endColumn=w.column)}}),r(a)):r(i)}}))}};Se=gn([ge(0,m.Inject(U.SheetPrintInterceptorService)),ge(1,m.Inject(te.DrawingRenderService)),ge(2,O.IDrawingManagerService),ge(3,N.IRenderManagerService)],Se);var hn=Object.defineProperty,mn=Object.getOwnPropertyDescriptor,pn=(i,n,r,e)=>{for(var t=e>1?void 0:e?mn(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&hn(n,r,t),t},q=(i,n)=>(r,e)=>n(r,e,i);const fn=[D.InsertRowCommand.id,D.InsertColCommand.id,D.RemoveRowCommand.id,D.RemoveColCommand.id,D.DeleteRangeMoveLeftCommand.id,D.DeleteRangeMoveUpCommand.id,D.InsertRangeMoveDownCommand.id,D.InsertRangeMoveRightCommand.id,D.DeltaRowHeightCommand.id,D.SetRowHeightCommand.id,D.DeltaColumnWidthCommand.id,D.SetColWidthCommand.id,D.SetRowHiddenCommand.id,D.SetSpecificRowsVisibleCommand.id,D.SetSpecificColsVisibleCommand.id,D.SetColHiddenCommand.id,D.MoveColsCommand.id,D.MoveRowsCommand.id,D.MoveRangeCommand.id],wn=[D.SetRowVisibleMutation.id,D.SetRowHiddenMutation.id,D.SetColVisibleMutation.id,D.SetColHiddenMutation.id,D.SetWorksheetRowHeightMutation.id,D.SetWorksheetColWidthMutation.id];let Te=class extends m.Disposable{constructor(i,n,r,e,t,o,s,c,d){super(),this._context=i,this._renderManagerService=n,this._commandService=r,this._selectionRenderService=e,this._skeletonManagerService=t,this._sheetInterceptorService=o,this._sheetDrawingService=s,this._drawingManagerService=c,this._univerInstanceService=d,this._sheetInterceptorListener(),this._commandListener(),this._sheetRefreshListener()}_sheetInterceptorListener(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{if(!fn.includes(i.id))return{redos:[],undos:[]};if(i.params==null)return{redos:[],undos:[]};const n=i.id;if(n===D.InsertRowCommand.id)return this._moveRowInterceptor(i.params,"insert");if([D.MoveColsCommand.id,D.MoveRowsCommand.id,D.MoveRangeCommand.id].includes(n))return this._moveRangeInterceptor(i.params);if(n===D.InsertColCommand.id)return this._moveColInterceptor(i.params,"insert");if(n===D.RemoveRowCommand.id)return this._moveRowInterceptor(i.params,"remove");if(n===D.RemoveColCommand.id)return this._moveColInterceptor(i.params,"remove");if(n===D.DeleteRangeMoveLeftCommand.id){const{range:r}=i.params;return this._getRangeMoveUndo(r,0)}else if(n===D.DeleteRangeMoveUpCommand.id){const{range:r}=i.params;return this._getRangeMoveUndo(r,1)}else if(n===D.InsertRangeMoveDownCommand.id){const{range:r}=i.params;return this._getRangeMoveUndo(r,2)}else if(n===D.InsertRangeMoveRightCommand.id){const{range:r}=i.params;return this._getRangeMoveUndo(r,3)}else if(n===D.SetRowHiddenCommand.id||n===D.SetSpecificRowsVisibleCommand.id){const r=i.params,{unitId:e,subUnitId:t,ranges:o}=r;return this._getDrawingUndoForRowVisible(e,t,o)}else if(n===D.SetSpecificColsVisibleCommand.id||n===D.SetColHiddenCommand.id){const r=i.params,{unitId:e,subUnitId:t,ranges:o}=r;return this._getDrawingUndoForColVisible(e,t,o)}else if(n===D.DeltaRowHeightCommand.id||n===D.SetRowHeightCommand.id||n===D.DeltaColumnWidthCommand.id||n===D.SetColWidthCommand.id){const r=i.params,{unitId:e,subUnitId:t,ranges:o}=r,s=n===D.DeltaRowHeightCommand.id||n===D.SetRowHeightCommand.id;return this._getDrawingUndoForRowAndColSize(e,t,o,s)}return{redos:[],undos:[]}}}))}_getRangeMoveUndo(i,n){const r=D.getSheetCommandTarget(this._univerInstanceService);if(r==null)return{redos:[],undos:[]};const e=r.unitId,t=r.subUnitId,o=[],s=[],c=this._sheetDrawingService.getDrawingData(e,t),d=[],h=[];if(Object.keys(c).forEach(l=>{const a=c[l],{updateDrawings:u,deleteDrawings:g}=this._getUpdateOrDeleteDrawings(i,n,a);d.push(...u),h.push(...g)}),d.length===0&&h.length===0)return{redos:[],undos:[]};if(d.length>0){const l=this._sheetDrawingService.getBatchUpdateOp(d),{undo:a,redo:u,objects:g}=l;o.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:u,objects:g,type:p.DrawingApplyType.UPDATE}}),s.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:a,objects:g,type:p.DrawingApplyType.UPDATE}})}if(h.length>0){const l=this._sheetDrawingService.getBatchRemoveOp(h),a=l.undo,u=l.redo,g=l.objects;o.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:u,objects:g,type:p.DrawingApplyType.REMOVE}}),s.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:a,objects:g,type:p.DrawingApplyType.INSERT}})}return o.push({id:x.id,params:[e]}),s.push({id:x.id,params:[e]}),{redos:o,undos:s}}_getUpdateOrDeleteDrawings(i,n,r){const e=[],t=[],{sheetTransform:o,anchorType:s=p.SheetDrawingAnchorType.Position,transform:c,unitId:d,subUnitId:h,drawingId:l}=r,{from:a,to:u}=o,{row:g,column:f}=a,{row:w,column:S}=u;if(o==null||c==null)return{updateDrawings:e,deleteDrawings:t};const{startRow:C,endRow:y,startColumn:I,endColumn:T}=i;let _=null,M=null;if(n===0&&g>=C&&w<=y)if(f>=I&&S<=T)t.push({unitId:d,subUnitId:h,drawingId:l});else{const v=this._shrinkCol(o,c,I,T,s);_=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}else if(n===1&&f>=I&&S<=T)if(g>=C&&w<=y)t.push({unitId:d,subUnitId:h,drawingId:l});else{const v=this._shrinkRow(o,c,C,y,s);_=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}else if(n===2){const v=this._expandRow(o,c,C,y,s);_=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}else if(n===3){const v=this._expandCol(o,c,I,T,s);_=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}if(_!=null&&M!=null){const v=V(_,this._selectionRenderService,this._skeletonManagerService);e.push({...r,sheetTransform:_,transform:v})}return{updateDrawings:e,deleteDrawings:t}}_remainDrawingSize(i,n,r){const e=$({...i},this._selectionRenderService);e!=null&&n.push({...r,sheetTransform:e})}_getDrawingUndoForColVisible(i,n,r){const e=this._drawingManagerService.getDrawingData(i,n),t=[],o=[];if(Object.keys(e).forEach(l=>{const a=e[l],{sheetTransform:u,transform:g,anchorType:f=p.SheetDrawingAnchorType.Position}=a;if(f===p.SheetDrawingAnchorType.None)this._remainDrawingSize(g,t,a);else{const{from:w,to:S}=u,{row:C,column:y}=w,{row:I,column:T}=S;for(let _=0;_<r.length;_++){const M=r[_],{startRow:v,endRow:P,startColumn:b,endColumn:j}=M;if(T<b)continue;if(f===p.SheetDrawingAnchorType.Position){let R=null,W=null;if(y>=b&&y<=j){const B=this._skeletonManagerService.attachRangeWithCoord({startColumn:y,endColumn:j,startRow:w.row,endRow:S.row});if(B==null)return;W={...g,left:B.startX}}if(W!=null&&(R=$(W,this._selectionRenderService),R!=null&&W!=null)){t.push({...a,sheetTransform:R,transform:W});break}this._remainDrawingSize(g,t,a);continue}if(y>=b&&T<=j)continue;let A=null,E=null;if(y>=b&&y<=j){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:y,endColumn:j,startRow:w.row,endRow:S.row});if(R==null)return;E={...g,left:(R==null?void 0:R.startX)||0,width:((g==null?void 0:g.width)||0)-R.endX+R.startX}}else if(T>=b&&T<=j){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:b,endColumn:T,startRow:w.row,endRow:S.row});if(R==null)return;E={...g,left:R.startX-((g==null?void 0:g.width)||0)}}else{const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:b,endColumn:j,startRow:w.row,endRow:S.row});if(R==null)return;if(E={...g,width:((g==null?void 0:g.width)||0)-R.endX+R.startX},A=$(E,this._selectionRenderService),A!=null&&E!=null){o.push({...a,sheetTransform:A,transform:E});break}}if(E!=null&&(A=$(E,this._selectionRenderService)),E!=null&&A!=null){t.push({...a,sheetTransform:A,transform:E});break}else this._remainDrawingSize(g,t,a)}}}),t.length===0&&o.length===0)return{redos:[],undos:[]};const{redos:s,undos:c}=this._createUndoAndRedoMutation(i,n,t),d=[],h=[];if(o.length>0){const{redos:l,undos:a}=this._createUndoAndRedoMutation(i,n,o);d.push(...l),h.push(...a)}return{redos:s,undos:c,preRedos:d,preUndos:h}}_createUndoAndRedoMutation(i,n,r){const e=this._sheetDrawingService.getBatchUpdateOp(r),{undo:t,redo:o,objects:s}=e,c=[{id:p.SetDrawingApplyMutation.id,params:{unitId:i,subUnitId:n,op:o,objects:s,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[i]}],d=[{id:p.SetDrawingApplyMutation.id,params:{unitId:i,subUnitId:n,op:t,objects:s,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[i]}];return{redos:c,undos:d}}_getDrawingUndoForRowVisible(i,n,r){const e=this._drawingManagerService.getDrawingData(i,n),t=[],o=[];if(Object.keys(e).forEach(l=>{const a=e[l],{sheetTransform:u,transform:g,anchorType:f=p.SheetDrawingAnchorType.Position}=a;if(f===p.SheetDrawingAnchorType.None)this._remainDrawingSize(g,t,a);else{const{from:w,to:S}=u,{row:C,column:y}=w,{row:I,column:T}=S;for(let _=0;_<r.length;_++){const M=r[_],{startRow:v,endRow:P,startColumn:b,endColumn:j}=M;if(I<v)continue;if(f===p.SheetDrawingAnchorType.Position){let R=null,W=null;if(C>=v&&C<=P){const B=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:C,endRow:P});if(B==null)return;W={...g,top:B.startY}}if(W!=null&&(R=$(W,this._selectionRenderService),R!=null&&W!=null)){t.push({...a,sheetTransform:R,transform:W});break}this._remainDrawingSize(g,t,a);continue}if(C>=v&&I<=P)continue;let A=null,E=null;if(C>=v&&C<=P){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:C,endRow:P});if(R==null)return;E={...g,top:(R==null?void 0:R.startY)||0,height:((g==null?void 0:g.height)||0)-R.endY+R.startY}}else if(I>=v&&I<=P){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:v,endRow:I});if(R==null)return;E={...g,top:R.startY-((g==null?void 0:g.height)||0)}}else{const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:v,endRow:P});if(R==null)return;if(E={...g,height:((g==null?void 0:g.height)||0)-R.endY+R.startY},A=$(E,this._selectionRenderService),A!=null&&E!=null){o.push({...a,sheetTransform:A,transform:E});break}}if(E!=null&&(A=$(E,this._selectionRenderService)),E!=null&&A!=null){t.push({...a,sheetTransform:A,transform:E});break}else this._remainDrawingSize(g,t,a)}}}),t.length===0&&o.length===0)return{redos:[],undos:[]};const{redos:s,undos:c}=this._createUndoAndRedoMutation(i,n,t),d=[],h=[];if(o.length>0){const{redos:l,undos:a}=this._createUndoAndRedoMutation(i,n,o);d.push(...l),h.push(...a)}return{redos:s,undos:c,preRedos:d,preUndos:h}}_getDrawingUndoForRowAndColSize(i,n,r,e){const t=this._drawingManagerService.getDrawingData(i,n),o=[];return Object.keys(t).forEach(s=>{const c=t[s],{sheetTransform:d,transform:h,anchorType:l=p.SheetDrawingAnchorType.Position}=c;if(l===p.SheetDrawingAnchorType.None)this._remainDrawingSize(h,o,c);else{const{from:a,to:u}=d,{row:g,column:f}=a,{row:w,column:S}=u;for(let C=0;C<r.length;C++){const y=r[C],{startRow:I,endRow:T,startColumn:_,endColumn:M}=y;if(w<I||S<_)continue;if(l===p.SheetDrawingAnchorType.Position&&(g<=I&&w>=T||f<=_&&S>=M)){this._remainDrawingSize(h,o,c);continue}const v=V({...d},this._selectionRenderService,this._skeletonManagerService);if(v!=null){o.push({...c,transform:v});break}}}}),o.length===0?{redos:[],undos:[]}:this._createUndoAndRedoMutation(i,n,o)}_getUnitIdAndSubUnitId(i,n){let r,e;if(n==="insert")r=i.unitId,e=i.subUnitId;else{const t=D.getSheetCommandTarget(this._univerInstanceService);if(t==null)return;r=t.unitId,e=t.subUnitId}return{unitId:r,subUnitId:e}}_moveRangeInterceptor(i){var I,T;const{toRange:n,fromRange:r}=i,e=D.getSheetCommandTarget(this._univerInstanceService);if(!e)return{redos:[],undos:[]};const{unitId:t,subUnitId:o}=e,s=(T=(I=this._renderManagerService.getRenderById(t))==null?void 0:I.with(U.SheetSkeletonManagerService))==null?void 0:T.getCurrentSkeleton();if(!s)return{redos:[],undos:[]};const c=U.attachRangeWithCoord(s,r);if(!c)return{redos:[],undos:[]};const{startX:d,endX:h,startY:l,endY:a}=c,u=this._sheetDrawingService.getDrawingData(t,o),g=[];Object.keys(u).forEach(_=>{const M=u[_];if(M.anchorType!==p.SheetDrawingAnchorType.Both)return;const{transform:v}=M;if(!v)return;const{left:P=0,top:b=0,width:j=0,height:A=0}=v,{drawingStartX:E,drawingEndX:R,drawingStartY:W,drawingEndY:B}={drawingStartX:P,drawingEndX:P+j,drawingStartY:b,drawingEndY:b+A};d<=E&&R<=h&&l<=W&&B<=a&&g.push(M)});const f=[],w=[],S=n.startRow-r.startRow,C=n.startColumn-r.startColumn,y=g.map(_=>{const M=_.sheetTransform,v={to:{...M.to,row:M.to.row+S,column:M.to.column+C},from:{...M.from,row:M.from.row+S,column:M.from.column+C}},P=V(v,this._selectionRenderService,this._skeletonManagerService);return{unitId:t,subUnitId:o,drawingId:_.drawingId,transform:P,sheetTransform:v}});if(y.length){const _=this._sheetDrawingService.getBatchUpdateOp(y),{undo:M,redo:v,objects:P}=_;f.push({id:p.SetDrawingApplyMutation.id,params:{unitId:t,subUnitId:o,op:v,objects:P,type:p.DrawingApplyType.UPDATE}}),w.push({id:p.SetDrawingApplyMutation.id,params:{unitId:t,subUnitId:o,op:M,objects:P,type:p.DrawingApplyType.UPDATE}})}return{redos:f,undos:w}}_moveRowInterceptor(i,n){const r=this._getUnitIdAndSubUnitId(i,n);if(r==null)return{redos:[],undos:[]};const{unitId:e,subUnitId:t}=r,{range:o}=i,s=o.startRow,c=o.endRow,d=[],h=[],l=this._sheetDrawingService.getDrawingData(e,t),a=[],u=[];if(Object.keys(l).forEach(g=>{const f=l[g],{sheetTransform:w,transform:S,anchorType:C=p.SheetDrawingAnchorType.Position}=f;if(w==null||S==null)return;let y,I;if(n==="insert"){const _=this._expandRow(w,S,s,c,C);y=_==null?void 0:_.newSheetTransform,I=_==null?void 0:_.newTransform}else{const{from:_,to:M}=w,{row:v}=_,{row:P}=M;if(C===p.SheetDrawingAnchorType.Both&&v>=s&&P<=c)u.push({unitId:e,subUnitId:t,drawingId:g});else{const b=this._shrinkRow(w,S,s,c,C);y=b==null?void 0:b.newSheetTransform,I=b==null?void 0:b.newTransform}}if(!y||!I)return;const T={unitId:e,subUnitId:t,drawingId:g,transform:I,sheetTransform:y};a.push(T)}),a.length===0&&u.length===0)return{redos:[],undos:[]};if(a.length>0){const g=this._sheetDrawingService.getBatchUpdateOp(a),{undo:f,redo:w,objects:S}=g;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:w,objects:S,type:p.DrawingApplyType.UPDATE}}),h.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:f,objects:S,type:p.DrawingApplyType.UPDATE}})}if(u.length>0){const g=this._sheetDrawingService.getBatchRemoveOp(u),f=g.undo,w=g.redo,S=g.objects;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:w,objects:S,type:p.DrawingApplyType.REMOVE}}),h.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:f,objects:S,type:p.DrawingApplyType.INSERT}})}return d.push({id:x.id,params:[e]}),h.push({id:x.id,params:[e]}),{redos:d,undos:h}}_moveColInterceptor(i,n){const r=this._getUnitIdAndSubUnitId(i,n);if(r==null)return{redos:[],undos:[]};const{unitId:e,subUnitId:t}=r,{range:o}=i,s=o.startColumn,c=o.endColumn,d=[],h=[],l=this._sheetDrawingService.getDrawingData(e,t),a=[],u=[];if(Object.keys(l).forEach(g=>{const f=l[g],{sheetTransform:w,transform:S,anchorType:C=p.SheetDrawingAnchorType.Position}=f;if(w==null||S==null)return;let y,I;if(n==="insert"){const _=this._expandCol(w,S,s,c,C);y=_==null?void 0:_.newSheetTransform,I=_==null?void 0:_.newTransform}else{const{from:_,to:M}=w,{column:v}=_,{column:P}=M;if(C===p.SheetDrawingAnchorType.Both&&v>=s&&P<=c)u.push({unitId:e,subUnitId:t,drawingId:g});else{const b=this._shrinkCol(w,S,s,c,C);y=b==null?void 0:b.newSheetTransform,I=b==null?void 0:b.newTransform}}if(!y||!I)return;const T={unitId:e,subUnitId:t,drawingId:g,transform:I,sheetTransform:y};a.push(T)}),a.length===0&&u.length===0)return{redos:[],undos:[]};if(a.length>0){const g=this._sheetDrawingService.getBatchUpdateOp(a),{undo:f,redo:w,objects:S}=g;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:w,objects:S,type:p.DrawingApplyType.UPDATE}}),h.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:f,objects:S,type:p.DrawingApplyType.UPDATE}})}if(u.length>0){const g=this._sheetDrawingService.getBatchRemoveOp(u),f=g.undo,w=g.redo,S=g.objects;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:w,objects:S,type:p.DrawingApplyType.REMOVE}}),h.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:t,op:f,objects:S,type:p.DrawingApplyType.INSERT}})}return d.push({id:x.id,params:[e]}),h.push({id:x.id,params:[e]}),{redos:d,undos:h}}_expandCol(i,n,r,e,t=p.SheetDrawingAnchorType.Position){const o=e-r+1,{from:s,to:c}=i,{column:d}=s,{column:h}=c;if(t===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>=r){const u=this._skeletonManagerService.attachRangeWithCoord({startColumn:r,endColumn:e,startRow:s.row,endRow:c.row});if(u==null)return;a={...n,left:(n.left||0)+u.endX-u.startX},l=$(a,this._selectionRenderService)}else if(h>=e)if(t===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,column:h+o}},a=V(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_shrinkCol(i,n,r,e,t=p.SheetDrawingAnchorType.Position){const o=e-r+1,{from:s,to:c}=i,{column:d}=s,{column:h}=c;if(t===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>e)l={from:{...s,column:d-o},to:{...c,column:h-o}},a=V(l,this._selectionRenderService,this._skeletonManagerService);else{if(d>=r&&h<=e)return null;if(d<r&&h>e)if(t===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,column:h-o}},a=V(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};else if(d>=r&&d<=e){if(d===r)a={...n,left:(n.left||0)-i.from.columnOffset};else{const u=this._skeletonManagerService.attachRangeWithCoord({startColumn:r,endColumn:d-1,startRow:s.row,endRow:c.row});if(u==null)return;a={...n,left:(n.left||0)-u.endX+u.startX-i.from.columnOffset}}l=$(a,this._selectionRenderService)}else if(h>=r&&h<=e&&t===p.SheetDrawingAnchorType.Both){const u=this._skeletonManagerService.attachRangeWithCoord({startColumn:r-1,endColumn:r-1,startRow:s.row,endRow:c.row});if(u==null)return;l={from:{...s},to:{...c,column:r-1,columnOffset:u.endX-u.startX}},a=V(l,this._selectionRenderService,this._skeletonManagerService)}}return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_expandRow(i,n,r,e,t=p.SheetDrawingAnchorType.Position){const o=e-r+1,{from:s,to:c}=i,{row:d}=s,{row:h}=c;if(t===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>=r){const u=this._skeletonManagerService.attachRangeWithCoord({startRow:r,endRow:e,startColumn:s.column,endColumn:c.column});if(u==null)return;a={...n,top:(n.top||0)+u.endY-u.startY},l=$(a,this._selectionRenderService)}else if(h>=e)if(t===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,row:h+o}},a=V(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_shrinkRow(i,n,r,e,t=p.SheetDrawingAnchorType.Position){const o=e-r+1,{from:s,to:c}=i,{row:d}=s,{row:h}=c;if(t===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>e)l={from:{...s,row:d-o},to:{...c,row:h-o}},a=V(l,this._selectionRenderService,this._skeletonManagerService);else{if(d>=r&&h<=e)return null;if(d<r&&h>e)if(t===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,row:h-o}},a=V(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};else if(d>=r&&d<=e){if(d===r)a={...n,top:(n.top||0)-i.from.rowOffset};else{const u=this._skeletonManagerService.attachRangeWithCoord({startRow:r,endRow:d-1,startColumn:s.column,endColumn:c.column});if(u==null)return;a={...n,top:(n.top||0)-u.endY+u.startY-i.from.rowOffset}}l=$(a,this._selectionRenderService)}else if(h>=r&&h<=e&&t===p.SheetDrawingAnchorType.Both){const u=this._skeletonManagerService.attachRangeWithCoord({startColumn:s.column,endColumn:s.column,startRow:r-1,endRow:r-1});if(u==null)return;l={from:{...s},to:{...c,row:r-1,rowOffset:u.endY-u.startY}},a=V(l,this._selectionRenderService,this._skeletonManagerService)}}return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_commandListener(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{i.id===D.SetWorksheetActiveOperation.id&&setTimeout(()=>{const n=i.params,{unitId:r,subUnitId:e}=n,t=this._drawingManagerService.drawingManagerData,o=[],s=[];Object.keys(t).forEach(c=>{const d=t[c];d!=null&&Object.keys(d).forEach(h=>{const l=d[h].data;l!=null&&Object.keys(l).forEach(a=>{if(c===r&&h===e){const u=l[a];u.transform=V(u.sheetTransform,this._selectionRenderService,this._skeletonManagerService),o.push(l[a])}else s.push(l[a])})})}),this._drawingManagerService.removeNotification(s),this._drawingManagerService.addNotification(o)},0)}))}_sheetRefreshListener(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{wn.includes(i.id)&&requestIdleCallback(()=>{const n=i.params,{unitId:r,subUnitId:e,ranges:t}=n;this._refreshDrawingTransform(r,e,t)})}))}_refreshDrawingTransform(i,n,r){const e=this._drawingManagerService.getDrawingData(i,n),t=[];Object.keys(e).forEach(o=>{const s=e[o],{sheetTransform:c,transform:d,anchorType:h=p.SheetDrawingAnchorType.Position}=s;if(h===p.SheetDrawingAnchorType.None)return!0;const{from:l,to:a}=c,{row:u,column:g}=l,{row:f,column:w}=a;for(let S=0;S<r.length;S++){const C=r[S],{startRow:y,endRow:I,startColumn:T,endColumn:_}=C;if(m.Rectangle.intersects({startRow:y,endRow:I,startColumn:T,endColumn:_},{startRow:u,endRow:f,startColumn:g,endColumn:w})||u>I||g>_){const M=h===p.SheetDrawingAnchorType.Position,v=V(c,this._selectionRenderService,this._skeletonManagerService);t.push({...s,transform:{...v,width:M?d==null?void 0:d.width:v==null?void 0:v.width,height:M?d==null?void 0:d.height:v==null?void 0:v.height}});break}}}),t.length!==0&&(this._drawingManagerService.refreshTransform(t),this._commandService.syncExecuteCommand(x.id,[i]))}};Te=pn([q(1,N.IRenderManagerService),q(2,m.ICommandService),q(3,U.ISheetSelectionRenderService),q(4,m.Inject(U.SheetSkeletonManagerService)),q(5,m.Inject(D.SheetInterceptorService)),q(6,p.ISheetDrawingService),q(7,O.IDrawingManagerService),q(8,m.IUniverInstanceService)],Te);var Sn=Object.defineProperty,vn=Object.getOwnPropertyDescriptor,_n=(i,n,r,e)=>{for(var t=e>1?void 0:e?vn(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&Sn(n,r,t),t},ee=(i,n)=>(r,e)=>n(r,e,i);function Dn(i,n,r,e){const{scaleX:t,scaleY:o}=n.getAncestorScale(),s=n.getViewport(N.SHEET_VIEWPORT_KEY.VIEW_MAIN),c={left:!0,top:!0};if(!s)return{...i,absolute:c};const{left:d,right:h,top:l,bottom:a}=i,u=e.getFreeze(),{startColumn:g,startRow:f,xSplit:w,ySplit:S}=u,C=r.getNoMergeCellPositionByIndexWithNoHeader(f-S,g-w),y=r.getNoMergeCellPositionByIndexWithNoHeader(f,g),{rowHeaderWidth:I,columnHeaderHeight:T}=r,_=y.startX-C.startX,M=y.startY-C.startY,{top:v,left:P,viewportScrollX:b,viewportScrollY:j}=s;let A,E;d<P?(c.left=!0,A=(_+I+(d-P))*t,E=Math.max(Math.min((_+I+(h-P))*t,(_+I)*t),(h-b)*t)):(c.left=!1,A=Math.max((d-b)*t,(_+I)*t),E=Math.max((h-b)*t,(_+I)*t));let R,W;return l<v?(c.top=!0,R=(M+T+(l-v))*o,W=Math.max(Math.min((M+T+(h-v))*o,(M+T)*o),(a-j)*o)):(c.top=!1,R=Math.max((l-j)*o,(M+T)*o),W=Math.max((a-j)*o,(M+T)*o)),{left:A,right:E,top:R,bottom:W,absolute:c}}const ye=(i,n,r,e)=>{const{scene:t}=n,{left:o,top:s,width:c,height:d,angle:h}=i,l={left:o,right:o+c,top:s,bottom:s+d},a=Dn(l,t,r,e),{scaleX:u,scaleY:g}=t.getAncestorScale();return{startX:a.left,endX:a.right,startY:a.top,endY:a.bottom,rotate:h,width:c*u,height:d*g,absolute:a.absolute}};exports.SheetCanvasFloatDomManagerService=class extends m.Disposable{constructor(r,e,t,o,s,c,d){super();Y(this,"_domLayerMap",new Map);Y(this,"_domLayerInfoMap",new Map);Y(this,"_transformChange$",new L.Subject);Y(this,"transformChange$",this._transformChange$.asObservable());Y(this,"_add$",new L.Subject);Y(this,"add$",this._add$.asObservable());Y(this,"_remove$",new L.Subject);Y(this,"remove$",this._remove$.asObservable());Y(this,"_hooks",[]);this._renderManagerService=r,this._univerInstanceService=e,this._commandService=t,this._drawingManagerService=o,this._canvasFloatDomService=s,this._sheetDrawingService=c,this._lifecycleService=d,this._drawingAddListener(),this._featureUpdateListener(),this._deleteListener(),this._bindScrollEvent()}_bindScrollEvent(){this._lifecycleService.lifecycle$.pipe(L.filter(r=>r===m.LifecycleStages.Rendered),L.take(1)).subscribe(()=>{this._scrollUpdateListener()})}_ensureMap(r,e){let t=this._domLayerMap.get(r);t||(t=new Map,this._domLayerMap.set(r,t));let o=t.get(e);return o||(o=new Map,t.set(e,o)),o}getFloatDomInfo(r){return this._domLayerInfoMap.get(r)}_getSceneAndTransformerByDrawingSearch(r){if(r==null)return;const e=this._renderManagerService.getRenderById(r),t=e==null?void 0:e.scene;if(e==null||t==null)return null;const o=t.getTransformerByCreate(),s=e.engine.getCanvasElement();return{scene:t,transformer:o,renderObject:e,canvas:s}}_getFloatDomProps(r){let e;return this._hooks.forEach(t=>{e=t.onGetFloatDomProps(r)}),e}_drawingAddListener(){this.disposeWithMe(this._drawingManagerService.add$.subscribe(r=>{r.forEach(e=>{var We,Le,xe;const{unitId:t,subUnitId:o,drawingId:s}=e,c=D.getSheetCommandTarget(this._univerInstanceService,{unitId:t,subUnitId:o}),d=this._drawingManagerService.getDrawingByParam(e),h=this._univerInstanceService.getUnit(t);if(!h)return;const l=h.getActiveSheet().getSheetId();if(!d||!c)return;const a=(We=this._renderManagerService.getRenderById(t))==null?void 0:We.with(U.SheetSkeletonManagerService).getWorksheetSkeleton(o);if(!a)return;const{transform:u,drawingType:g,data:f}=d;if(g!==O.DrawingTypeEnum.DRAWING_DOM&&g!==O.DrawingTypeEnum.DRAWING_CHART)return;const w=this._getSceneAndTransformerByDrawingSearch(t);if(w==null)return;const{scene:S,canvas:C}=w;if(u==null)return!0;if(l!==o)return;const{left:y,top:I,width:T,height:_,angle:M,flipX:v,flipY:P,skewX:b,skewY:j}=u,A=O.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:o,drawingId:s}),E=S.getObject(A);if(E!=null){E.transformByState({left:y,top:I,width:T,height:_,angle:M,flipX:v,flipY:P,skewX:b,skewY:j});return}const R={left:y,top:I,width:T,height:_,zIndex:this._drawingManagerService.getDrawingOrder(t,o).length-1},W=g===O.DrawingTypeEnum.DRAWING_CHART;W&&(R.fill="white",R.rotateEnabled=!1,f&&f.border&&(R.stroke=f.border),R.paintFirst="stroke",R.strokeWidth=1,R.borderEnabled=!1,R.radius=8);const B=new N.Rect(A,R);W&&B.setObjectType(N.ObjectType.CHART),S.addObject(B,N.DRAWING_OBJECT_LAYER_INDEX),d.allowTransform!==!1&&S.attachTransformerTo(B);const z=this._ensureMap(t,o),De=new m.DisposableCollection,ze=ye(B,w.renderObject,a.skeleton,c.worksheet),Ie=new L.BehaviorSubject(ze),qe={dispose:De,rect:B,position$:Ie,unitId:t,subUnitId:o};this._canvasFloatDomService.addFloatDom({position$:Ie,id:s,componentKey:d.componentKey,onPointerDown:F=>{C.dispatchEvent(new PointerEvent(F.type,F))},onPointerMove:F=>{C.dispatchEvent(new PointerEvent(F.type,F))},onPointerUp:F=>{C.dispatchEvent(new PointerEvent(F.type,F))},onWheel:F=>{C.dispatchEvent(new WheelEvent(F.type,F))},props:(xe=(Le=z.get(s))==null?void 0:Le.props)!=null?xe:this._getFloatDomProps(s),data:f,unitId:t});const je=B.onTransformChange$.subscribeEvent(()=>{const F=ye(B,w.renderObject,a.skeleton,c.worksheet);Ie.next(F)});De.add(()=>{this._canvasFloatDomService.removeFloatDom(s)}),je&&De.add(je),this._domLayerInfoMap.set(s,qe),z.set(s,{...z.get(s)})})})),this.disposeWithMe(this._drawingManagerService.remove$.subscribe(r=>{r.forEach(e=>{const{unitId:t,subUnitId:o,drawingId:s}=e,c=O.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:o,drawingId:s}),d=this._getSceneAndTransformerByDrawingSearch(t);if(d==null)return;const{transformer:h,scene:l}=d,a=l.getObject(c);a!=null&&a.oKey&&h.clearControlByIds([a==null?void 0:a.oKey])})}))}_scrollUpdateListener(){const r=(e,t)=>{var l;const o=this._getSceneAndTransformerByDrawingSearch(e),s=this._ensureMap(e,t),c=Array.from(s.keys()),d=D.getSheetCommandTarget(this._univerInstanceService,{unitId:e,subUnitId:t}),h=(l=this._renderManagerService.getRenderById(e))==null?void 0:l.with(U.SheetSkeletonManagerService).getWorksheetSkeleton(t);!o||!d||!h||c.forEach(a=>{const u=this._domLayerInfoMap.get(a);if(u){const g=ye(u.rect,o.renderObject,h.skeleton,d.worksheet);u.position$.next(g)}})};this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(m.UniverInstanceType.UNIVER_SHEET).pipe(L.filter(e=>!!e),L.switchMap(e=>e.activeSheet$),L.filter(e=>!!e),L.map(e=>{const t=this._renderManagerService.getRenderById(e.getUnitId());return t?{render:t,unitId:e.getUnitId(),subUnitId:e.getSheetId()}:null}),L.filter(e=>!!e),L.switchMap(e=>m.fromEventSubject(e.render.scene.getViewport(U.VIEWPORT_KEY.VIEW_MAIN).onScrollAfter$).pipe(L.map(()=>({unitId:e.unitId,subUnitId:e.subUnitId}))))).subscribe(({unitId:e,subUnitId:t})=>{r(e,t)})),this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var t,o;if(e.id===U.SetZoomRatioOperation.id){const s=e.params,{unitId:c}=s;Array.from((o=(t=this._domLayerMap.get(c))==null?void 0:t.keys())!=null?o:[]).forEach(h=>{r(c,h)})}else if(e.id===D.SetFrozenMutation.id){const{unitId:s,subUnitId:c}=e.params;r(s,c)}}))}_getPosition(r,e){var g;const{startX:t,endX:o,startY:s,endY:c}=r,d=(g=this._renderManagerService.getRenderById(e))==null?void 0:g.with(U.ISheetSelectionRenderService);if(d==null)return;const h=d.getCellWithCoordByOffset(t,s);if(h==null)return;const l={column:h.actualColumn,columnOffset:t-h.startX,row:h.actualRow,rowOffset:s-h.startY},a=d.getCellWithCoordByOffset(o,c);if(a==null)return;const u={column:a.actualColumn,columnOffset:o-a.startX,row:a.actualRow,rowOffset:c-a.startY};return{from:l,to:u}}_featureUpdateListener(){this.disposeWithMe(this._drawingManagerService.update$.subscribe(r=>{r.forEach(e=>{const t=this._drawingManagerService.getDrawingByParam(e);if(!t||t.drawingType!==O.DrawingTypeEnum.DRAWING_DOM&&t.drawingType!==O.DrawingTypeEnum.DRAWING_CHART)return;const o={...t.transform};this._transformChange$.next({id:e.drawingId,value:o})})}))}_deleteListener(){this.disposeWithMe(this._drawingManagerService.remove$.subscribe(r=>{r.forEach(e=>{this._removeDom(e.drawingId)})}))}updateFloatDomProps(r,e,t,o){const s=this._domLayerInfoMap.get(t),c=this._getSceneAndTransformerByDrawingSearch(r);if(s&&c){const{scene:d}=c,h=O.getDrawingShapeKeyByDrawingSearch({unitId:r,subUnitId:e,drawingId:t}),l=d.getObject(h);l&&l instanceof N.Rect&&l.setProps(o)}}addFloatDomToPosition(r,e){const t=D.getSheetCommandTarget(this._univerInstanceService,{unitId:r.unitId,subUnitId:r.subUnitId});if(!t)throw new Error("cannot find current target!");const{unitId:o,subUnitId:s}=t,{initPosition:c,componentKey:d,data:h,allowTransform:l=!0}=r,a=e!=null?e:m.generateRandomId(),u=this._getPosition(c,o);if(u==null)return;this._ensureMap(o,s).set(a,r);const f={unitId:o,subUnitId:s,drawingId:a,drawingType:r.type||O.DrawingTypeEnum.DRAWING_DOM,componentKey:d,sheetTransform:u,transform:{left:c.startX,top:c.startY,width:c.endX-c.startX,height:c.endY-c.startY},data:h,allowTransform:l};return this._commandService.executeCommand(oe.id,{unitId:o,drawings:[f]}),this._add$.next({unitId:o,subUnitId:s,id:a}),{id:a,dispose:()=>{this._removeDom(a,!0)}}}_removeDom(r,e=!1){const t=this._domLayerInfoMap.get(r);if(!t)return;const{unitId:o,subUnitId:s}=t;this._domLayerInfoMap.delete(r),t.dispose.dispose();const c=this._getSceneAndTransformerByDrawingSearch(o);if(c&&c.scene.removeObject(t.rect),e){this._ensureMap(o,s).delete(r);const h=this._drawingManagerService.getDrawingByParam({unitId:o,subUnitId:s,drawingId:r});if(!h)return;const l=this._sheetDrawingService.getBatchRemoveOp([h]),{redo:a,objects:u}=l;this._commandService.syncExecuteCommand(p.SetDrawingApplyMutation.id,{unitId:o,subUnitId:s,op:a,objects:u,type:p.DrawingApplyType.REMOVE})}}addHook(r){return this._hooks.push(r),{dispose:()=>{const e=this._hooks.findIndex(t=>t===r);this._hooks.splice(e,1)}}}};exports.SheetCanvasFloatDomManagerService=_n([ee(0,m.Inject(N.IRenderManagerService)),ee(1,m.IUniverInstanceService),ee(2,m.Inject(m.ICommandService)),ee(3,O.IDrawingManagerService),ee(4,m.Inject(G.CanvasFloatDomService)),ee(5,p.ISheetDrawingService),ee(6,m.Inject(m.LifecycleService))],exports.SheetCanvasFloatDomManagerService);var Xe=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Cn=(i,n,r)=>n in i?Xe(i,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[n]=r,yn=(i,n,r,e)=>{for(var t=e>1?void 0:e?In(n,r):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(t=(e?s(n,r,t):s(t))||t);return e&&t&&Xe(n,r,t),t},Me=(i,n)=>(r,e)=>n(r,e,i),Ke=(i,n,r)=>Cn(i,typeof n!="symbol"?n+"":n,r);const Mn="SHEET_IMAGE_UI_PLUGIN";exports.UniverSheetsDrawingUIPlugin=class extends m.Plugin{constructor(n=et,r,e,t){super(),this._config=n,this._injector=r,this._renderManagerService=e,this._configService=t;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Qe,s)}onStarting(){m.registerDependencies(this._injector,[[exports.SheetCanvasFloatDomManagerService],[pe],[he],[Se],[we],[fe]]),m.touchDependencies(this._injector,[[exports.SheetCanvasFloatDomManagerService]])}onReady(){m.touchDependencies(this._injector,[[fe]])}onRendered(){this._registerRenderModules(),m.touchDependencies(this._injector,[[we],[Se],[pe]])}onSteady(){this._injector.get(he)}_registerRenderModules(){[[me],[Te],[Re]].forEach(n=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(m.UniverInstanceType.UNIVER_SHEET,n))})}};Ke(exports.UniverSheetsDrawingUIPlugin,"type",m.UniverInstanceType.UNIVER_SHEET);Ke(exports.UniverSheetsDrawingUIPlugin,"pluginName",Mn);exports.UniverSheetsDrawingUIPlugin=yn([m.DependentOn(O.UniverDrawingPlugin,te.UniverDrawingUIPlugin,p.UniverSheetsDrawingPlugin),Me(1,m.Inject(m.Injector)),Me(2,N.IRenderManagerService),Me(3,m.IConfigService)],exports.UniverSheetsDrawingUIPlugin);exports.ClearSheetDrawingTransformerOperation=x;exports.DeleteDrawingsCommand=Ee;exports.EditSheetDrawingOperation=Oe;exports.GroupSheetDrawingCommand=Pe;exports.IMAGE_MENU_ID=Ne;exports.InsertFloatImageCommand=_e;exports.InsertSheetDrawingCommand=oe;exports.MoveDrawingsCommand=ne;exports.RemoveSheetDrawingCommand=ie;exports.SetDrawingArrangeCommand=Ae;exports.SetSheetDrawingCommand=se;exports.SidebarSheetDrawingOperation=be;exports.UngroupSheetDrawingCommand=Ue;
|
|
9
|
+
*/var Xe;function ht(){if(Xe)return ie;Xe=1;var i=Y,n=Symbol.for("react.element"),t=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(c,d,m){var l,a={},g=null,h=null;m!==void 0&&(g=""+m),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(h=d.ref);for(l in d)e.call(d,l)&&!o.hasOwnProperty(l)&&(a[l]=d[l]);if(c&&c.defaultProps)for(l in d=c.defaultProps,d)a[l]===void 0&&(a[l]=d[l]);return{$$typeof:n,type:c,key:g,ref:h,props:a,_owner:r.current}}return ie.Fragment=t,ie.jsx=s,ie.jsxs=s,ie}var ze;function mt(){return ze||(ze=1,be.exports=ht()),be.exports}var k=mt();const pt="univer-upload-loading",ft="univer-upload-loading-body",wt="univer-upload-loading-body-animation",St="univer-UniverCircleAnimation",_t="univer-upload-loading-body-text",ue={uploadLoading:pt,uploadLoadingBody:ft,uploadLoadingBodyAnimation:wt,univerCircleAnimation:St,uploadLoadingBodyText:_t},vt=()=>{const i=u.useDependency(A.IImageIoService),n=u.useDependency(u.LocaleService),[t,e]=Y.useState(0);return Y.useEffect(()=>{const r=i.change$.subscribe(o=>{e(o)});return()=>{r.unsubscribe()}},[i]),k.jsx("div",{style:{display:t>0?"block":"none"},className:ue.uploadLoading,children:k.jsxs("div",{className:ue.uploadLoadingBody,children:[k.jsx("div",{className:ue.uploadLoadingBodyAnimation}),k.jsx("div",{className:ue.uploadLoadingBodyText,children:`${n.t("uploadLoading.loading")}: ${t}`})]})})};var It=Object.defineProperty,Dt=Object.getOwnPropertyDescriptor,Ct=(i,n,t,e)=>{for(var r=e>1?void 0:e?Dt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&It(n,t,r),r},ee=(i,n)=>(t,e)=>n(t,e,i);let we=class extends u.RxDisposable{constructor(n,t,e,r,o,s,c){super();H(this,"_initImagePopupMenu",new Set);this._injector=n,this._drawingManagerService=t,this._canvasPopManagerService=e,this._renderManagerService=r,this._univerInstanceService=o,this._contextService=s,this._uiPartsService=c,this._init()}_init(){this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET).pipe(L.takeUntil(this.dispose$)).subscribe(n=>this._create(n)),this._univerInstanceService.getTypeOfUnitDisposed$(u.UniverInstanceType.UNIVER_SHEET).pipe(L.takeUntil(this.dispose$)).subscribe(n=>this._dispose(n)),this._univerInstanceService.getAllUnitsForType(u.UniverInstanceType.UNIVER_SHEET).forEach(n=>this._create(n)),this._uiPartsService.registerComponent(G.BuiltInUIPart.CONTENT,()=>u.connectInjector(vt,this._injector))}_dispose(n){const t=n.getUnitId();this._renderManagerService.removeRender(t)}_create(n){if(!n)return;const t=n.getUnitId();this._renderManagerService.has(t)&&!this._initImagePopupMenu.has(t)&&(this._popupMenuListener(t),this._initImagePopupMenu.add(t))}_hasCropObject(n){const t=n.getAllObjectsByOrder();for(const e of t)if(e instanceof Q.ImageCropperObject)return!0;return!1}_popupMenuListener(n){var o;const t=(o=this._renderManagerService.getRenderById(n))==null?void 0:o.scene;if(!t)return;const e=t.getTransformerByCreate();if(!e)return;let r;this.disposeWithMe(u.toDisposable(e.createControl$.subscribe(()=>{if(this._contextService.setContextValue(u.FOCUSING_COMMON_DRAWINGS,!0),this._hasCropObject(t))return;const s=e.getSelectedObjectMap();if(s.size>1){r==null||r.dispose();return}const c=s.values().next().value;if(!c)return;const d=c.oKey,m=this._drawingManagerService.getDrawingOKey(d);if(!m)return;const{unitId:l,subUnitId:a,drawingId:g,drawingType:h}=m,f=m.data;if(f&&f.disablePopup)return;r==null||r.dispose();const w=this._canvasPopManagerService.getFeatureMenu(l,a,g,h);r=this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(c,{componentKey:Q.COMPONENT_IMAGE_POPUP_MENU,direction:"horizontal",offset:[2,0],extraProps:{menuItems:w||this._getImageMenuItems(l,a,g,h)}})),this._drawingManagerService.focusDrawing([{unitId:l,subUnitId:a,drawingId:g}])}))),this.disposeWithMe(e.clearControl$.subscribe(()=>{r==null||r.dispose(),this._contextService.setContextValue(u.FOCUSING_COMMON_DRAWINGS,!1),this._drawingManagerService.focusDrawing(null)})),this.disposeWithMe(e.changing$.subscribe(()=>{r==null||r.dispose()}))}_getImageMenuItems(n,t,e,r){return[{label:"image-popup.edit",index:0,commandId:We.id,commandParams:{unitId:n,subUnitId:t,drawingId:e},disable:r===u.DrawingTypeEnum.DRAWING_DOM},{label:"image-popup.delete",index:1,commandId:ae.id,commandParams:{unitId:n,drawings:[{unitId:n,subUnitId:t,drawingId:e}]},disable:!1},{label:"image-popup.crop",index:2,commandId:Q.OpenImageCropOperation.id,commandParams:{unitId:n,subUnitId:t,drawingId:e},disable:r===u.DrawingTypeEnum.DRAWING_DOM},{label:"image-popup.reset",index:3,commandId:Q.ImageResetSizeOperation.id,commandParams:[{unitId:n,subUnitId:t,drawingId:e}],disable:r===u.DrawingTypeEnum.DRAWING_DOM}]}};we=Ct([ee(0,u.Inject(u.Injector)),ee(1,A.IDrawingManagerService),ee(2,u.Inject(N.SheetCanvasPopManagerService)),ee(3,P.IRenderManagerService),ee(4,u.IUniverInstanceService),ee(5,u.IContextService),ee(6,u.Inject(G.IUIPartsService))],we);function F(i,n,t){const{from:e,to:r,flipY:o=!1,flipX:s=!1,angle:c=0,skewX:d=0,skewY:m=0}=i,{column:l,columnOffset:a,row:g,rowOffset:h}=e,{column:f,columnOffset:w,row:S,rowOffset:D}=r,y=t.getCurrentSkeleton(),C=N.attachRangeWithCoord(y,{startColumn:l,endColumn:l,startRow:g,endRow:g});if(C==null)return;const T=N.attachRangeWithCoord(y,{startColumn:f,endColumn:f,startRow:S,endRow:S});if(T==null)return;const{startX:I,startY:M}=C,{startX:v,startY:O}=T;let b=P.precisionTo(I+a,1),j=P.precisionTo(M+h,1),U=P.precisionTo(v+w-b,1),E=P.precisionTo(O+D-j,1);C.startX===T.endX&&(U=0),C.startY===T.endY&&(E=0);const R=y.rowHeaderWidth+y.columnTotalWidth,W=y.columnHeaderHeight+y.rowTotalHeight;return b+U>R&&(b=R-U),j+E>W&&(j=W-E),{flipY:o,flipX:s,angle:c,skewX:d,skewY:m,left:b,top:j,width:U,height:E}}function $(i,n){const{left:t=0,top:e=0,width:r=0,height:o=0,flipY:s=!1,flipX:c=!1,angle:d=0,skewX:m=0,skewY:l=0}=i,a=n.getCellWithCoordByOffset(t,e);if(a==null)return;const g={column:a.actualColumn,columnOffset:P.precisionTo(t-a.startX,1),row:a.actualRow,rowOffset:P.precisionTo(e-a.startY,1)},h=n.getCellWithCoordByOffset(t+r,e+o);if(h==null)return;const f={column:h.actualColumn,columnOffset:P.precisionTo(t+r-h.startX,1),row:h.actualRow,rowOffset:P.precisionTo(e+o-h.startY,1)};return{flipY:s,flipX:c,angle:d,skewX:m,skewY:l,from:g,to:f}}var yt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Rt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Mt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&yt(n,t,r),r},ge=(i,n)=>(t,e)=>n(t,e,i);let Pe=class extends u.Disposable{constructor(i,n,t,e,r){super(),this._context=i,this._sheetDrawingService=n,this._drawingManagerService=t,this._sheetSelectionRenderService=e,this._sheetSkeletonManagerService=r,this._init()}_init(){this._drawingInitializeListener()}_drawingInitializeListener(){this._sheetDrawingService.initializeNotification(this._context.unitId);const i=this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);for(const n in i){const t=i[n];for(const e in t.data){const r=t.data[e];r.transform=F(r.sheetTransform,this._sheetSelectionRenderService,this._sheetSkeletonManagerService)}}this._drawingManagerService.registerDrawingData(this._context.unitId,this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)),this._drawingManagerService.initializeNotification(this._context.unitId)}};Pe=Rt([ge(1,p.ISheetDrawingService),ge(2,A.IDrawingManagerService),ge(3,u.Inject(N.ISheetSelectionRenderService)),ge(4,u.Inject(N.SheetSkeletonManagerService))],Pe);function Tt(i){const n=[];return i.forEach(t=>{const{parent:e,children:r}=t,{unitId:o,subUnitId:s,drawingId:c}=e,d=P.getGroupState(0,0,r.map(a=>a.transform||{})),m=r.map(a=>{const g=a.transform||{left:0,top:0},{unitId:h,subUnitId:f,drawingId:w}=a;return{unitId:h,subUnitId:f,drawingId:w,transform:{...g,left:g.left-d.left,top:g.top-d.top},groupId:c}}),l={unitId:o,subUnitId:s,drawingId:c,drawingType:u.DrawingTypeEnum.DRAWING_GROUP,transform:d};n.push({parent:l,children:m})}),n}function bt(i){const n=[];return i.forEach(t=>{const{parent:e,children:r}=t,{unitId:o,subUnitId:s,drawingId:c,transform:d={width:0,height:0}}=e;if(d==null)return;const m=r.map(a=>{const{transform:g}=a,{unitId:h,subUnitId:f,drawingId:w}=a,S=P.transformObjectOutOfGroup(g||{},d,d.width||0,d.height||0);return{unitId:h,subUnitId:f,drawingId:w,transform:S,groupId:void 0}}),l={unitId:o,subUnitId:s,drawingId:c,drawingType:u.DrawingTypeEnum.DRAWING_GROUP,transform:{left:0,top:0}};n.push({parent:l,children:m})}),n}const Le={id:"sheet.command.group-sheet-image",type:u.CommandType.COMMAND,handler:(i,n)=>{const t=i.get(u.ICommandService),e=i.get(u.IUndoRedoService),r=i.get(p.ISheetDrawingService);if(!n)return!1;const o=[];n.forEach(({parent:h,children:f})=>{o.push(h.unitId),f.forEach(w=>{o.push(w.unitId)})});const s=r.getGroupDrawingOp(n),{unitId:c,subUnitId:d,undo:m,redo:l,objects:a}=s;return t.syncExecuteCommand(p.SetDrawingApplyMutation.id,{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.GROUP})?(e.pushUndoRedo({unitID:c,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:m,unitId:c,subUnitId:d,objects:bt(a),type:p.DrawingApplyType.UNGROUP}},{id:x.id,params:o}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.GROUP}},{id:x.id,params:o}]}),!0):!1}},ce={id:"sheet.command.insert-sheet-image",type:u.CommandType.COMMAND,handler:(i,n)=>{var y,C,T;const t=i.get(u.ICommandService),e=i.get(u.IUndoRedoService),r=i.get(p.ISheetDrawingService),o=i.get(_.SheetInterceptorService);if(!n)return!1;const s=n.drawings,c=s.map(I=>I.unitId),d=r.getBatchAddOp(s),{unitId:m,subUnitId:l,undo:a,redo:g,objects:h}=d,f=o.onCommandExecute({id:ce.id,params:n}),w={id:p.SetDrawingApplyMutation.id,params:{op:g,unitId:m,subUnitId:l,objects:h,type:p.DrawingApplyType.INSERT}},S={id:p.SetDrawingApplyMutation.id,params:{op:a,unitId:m,subUnitId:l,objects:h,type:p.DrawingApplyType.REMOVE}};return u.sequenceExecute([...(y=f.preRedos)!=null?y:[],w,...f.redos],t)?(e.pushUndoRedo({unitID:m,undoMutations:[...(C=f.preUndos)!=null?C:[],S,...f.undos,{id:x.id,params:c}],redoMutations:[...(T=f.preRedos)!=null?T:[],w,...f.redos,{id:x.id,params:c}]}),!0):!1}},xe={id:"sheet.command.set-drawing-arrange",type:u.CommandType.COMMAND,handler:(i,n)=>{const t=i.get(u.ICommandService),e=i.get(u.IUndoRedoService);if(!n)return!1;const r=i.get(p.ISheetDrawingService),{unitId:o,subUnitId:s,drawingIds:c,arrangeType:d}=n,m={unitId:o,subUnitId:s,drawingIds:c};let l;if(d===u.ArrangeTypeEnum.forward?l=r.getForwardDrawingsOp(m):d===u.ArrangeTypeEnum.backward?l=r.getBackwardDrawingOp(m):d===u.ArrangeTypeEnum.front?l=r.getFrontDrawingsOp(m):d===u.ArrangeTypeEnum.back&&(l=r.getBackDrawingsOp(m)),l==null)return!1;const{objects:a,redo:g,undo:h}=l;return t.syncExecuteCommand(p.SetDrawingApplyMutation.id,{op:g,unitId:o,subUnitId:s,objects:a,type:p.DrawingApplyType.ARRANGE})?(e.pushUndoRedo({unitID:o,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:h,unitId:o,subUnitId:s,objects:a,type:p.DrawingApplyType.ARRANGE}}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:g,unitId:o,subUnitId:s,objects:a,type:p.DrawingApplyType.ARRANGE}}]}),!0):!1}},de={id:"sheet.command.set-sheet-image",type:u.CommandType.COMMAND,handler:(i,n)=>{const t=i.get(u.ICommandService),e=i.get(u.IUndoRedoService),r=i.get(p.ISheetDrawingService);if(!n)return!1;const{drawings:o}=n,s=r.getBatchUpdateOp(o),{unitId:c,subUnitId:d,undo:m,redo:l,objects:a}=s;return t.syncExecuteCommand(p.SetDrawingApplyMutation.id,{unitId:c,subUnitId:d,op:l,objects:a,type:p.DrawingApplyType.UPDATE})?(e.pushUndoRedo({unitID:c,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{unitId:c,subUnitId:d,op:m,objects:a,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[c]}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{unitId:c,subUnitId:d,op:l,objects:a,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[c]}]}),!0):!1}},Be={id:"sheet.command.ungroup-sheet-image",type:u.CommandType.COMMAND,handler:(i,n)=>{const t=i.get(u.ICommandService),e=i.get(u.IUndoRedoService),r=i.get(p.ISheetDrawingService);if(!n)return!1;const o=[];n.forEach(({parent:h,children:f})=>{o.push(h.unitId),f.forEach(w=>{o.push(w.unitId)})});const s=r.getUngroupDrawingOp(n),{unitId:c,subUnitId:d,undo:m,redo:l,objects:a}=s;return t.syncExecuteCommand(p.SetDrawingApplyMutation.id,{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.UNGROUP})?(e.pushUndoRedo({unitID:c,undoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:m,unitId:c,subUnitId:d,objects:Tt(a),type:p.DrawingApplyType.GROUP}},{id:x.id,params:o}],redoMutations:[{id:p.SetDrawingApplyMutation.id,params:{op:l,unitId:c,subUnitId:d,objects:a,type:p.DrawingApplyType.UNGROUP}},{id:x.id,params:o}]}),!0):!1}};var Et=Object.defineProperty,Ot=Object.getOwnPropertyDescriptor,At=(i,n,t,e)=>{for(var r=e>1?void 0:e?Ot(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Et(n,t,r),r},X=(i,n)=>(t,e)=>n(t,e,i);function Pt(i,n,t){const e=t*Math.PI/180,r=Math.abs(i*Math.cos(e))+Math.abs(n*Math.sin(e)),o=Math.abs(i*Math.sin(e))+Math.abs(n*Math.cos(e));return{rotatedWidth:r,rotatedHeight:o}}function Ze(i,n,t,e,r){var y;const{rotatedHeight:o,rotatedWidth:s}=Pt(t,e,r),d=i.get(P.IRenderManagerService).getRenderById(n.unitId);if(!d)return!1;const l=(y=d.with(N.SheetSkeletonManagerService).getWorksheetSkeleton(n.subUnitId))==null?void 0:y.skeleton;if(l==null)return!1;const a=l.getCellByIndex(n.row,n.col),g=a.mergeInfo.endX-a.mergeInfo.startX-2,h=a.mergeInfo.endY-a.mergeInfo.startY-2,f=s/o,S=Math.ceil(Math.min(g,h*f))/s,D=!S||Number.isNaN(S)?.001:S;return{width:t*D,height:e*D}}let se=class extends u.Disposable{constructor(n,t,e,r,o,s,c,d,m,l,a,g,h){super();H(this,"_workbookSelections");this._context=n,this._skeletonManagerService=t,this._commandService=e,this._selectionRenderService=r,this._imageIoService=o,this._fileOpenerService=s,this._sheetDrawingService=c,this._drawingManagerService=d,this._contextService=m,this._messageService=l,this._localeService=a,this._injector=h,this._workbookSelections=g.getWorkbookSelections(this._context.unitId),this._updateImageListener(),this._updateOrderListener(),this._groupDrawingListener(),this._focusDrawingListener()}async insertFloatImage(){const n=await this._fileOpenerService.openFile({multiple:!0,accept:A.DRAWING_IMAGE_ALLOW_IMAGE_LIST.map(e=>`.${e.replace("image/","")}`).join(",")}),t=n.length;return t>A.DRAWING_IMAGE_COUNT_LIMIT?(this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.exceedMaxCount",String(A.DRAWING_IMAGE_COUNT_LIMIT))}),!1):t===0?!1:(n.forEach(async e=>await this._insertFloatImage(e)),!0)}async insertCellImage(){const t=(await this._fileOpenerService.openFile({multiple:!1,accept:A.DRAWING_IMAGE_ALLOW_IMAGE_LIST.map(e=>`.${e.replace("image/","")}`).join(",")}))[0];return t?(await this._insertCellImage(t),!0):!1}async _insertFloatImage(n){let t;try{t=await this._imageIoService.saveImage(n)}catch(y){const C=y.message;C===A.ImageUploadStatusType.ERROR_EXCEED_SIZE?this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.exceedMaxSize",String(A.DRAWING_IMAGE_ALLOW_SIZE/(1024*1024)))}):C===A.ImageUploadStatusType.ERROR_IMAGE_TYPE?this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.invalidImageType")}):C===A.ImageUploadStatusType.ERROR_IMAGE&&this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.invalidImage")})}if(t==null)return;const e=this._getUnitInfo(),{unitId:r,subUnitId:o}=e,{imageId:s,imageSourceType:c,source:d,base64Cache:m}=t,{width:l,height:a,image:g}=await A.getImageSize(m||""),{width:h,height:f}=this._context.scene;this._imageIoService.addImageSourceCache(d,c,g);let w=1;if(l>A.DRAWING_IMAGE_WIDTH_LIMIT||a>A.DRAWING_IMAGE_HEIGHT_LIMIT){const y=A.DRAWING_IMAGE_WIDTH_LIMIT/l,C=A.DRAWING_IMAGE_HEIGHT_LIMIT/a;w=Math.max(y,C)}const S=this._getImagePosition(l*w,a*w,h,f);if(S==null)return;const D={unitId:r,subUnitId:o,drawingId:s,drawingType:u.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:c,source:d,transform:F(S,this._selectionRenderService,this._skeletonManagerService),sheetTransform:S};this._commandService.executeCommand(ce.id,{unitId:r,drawings:[D]})}async _insertCellImage(n){let t;try{t=await this._imageIoService.saveImage(n)}catch(S){const D=S.message;D===A.ImageUploadStatusType.ERROR_EXCEED_SIZE?this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.exceedMaxSize",String(A.DRAWING_IMAGE_ALLOW_SIZE/(1024*1024)))}):D===A.ImageUploadStatusType.ERROR_IMAGE_TYPE?this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.invalidImageType")}):D===A.ImageUploadStatusType.ERROR_IMAGE&&this._messageService.show({type:K.MessageType.Error,content:this._localeService.t("update-status.invalidImage")})}if(t==null)return;const{imageId:e,imageSourceType:r,source:o,base64Cache:s}=t,{width:c,height:d,image:m}=await A.getImageSize(s||"");this._imageIoService.addImageSourceCache(o,r,m);const l=this._workbookSelections.getCurrentLastSelection();if(!l)return!1;const a=u.createDocumentModelWithStyle("",{}),g=Ze(this._injector,{unitId:this._context.unitId,subUnitId:this._context.unit.getActiveSheet().getSheetId(),row:l.primary.actualRow,col:l.primary.actualColumn},c,d,0);if(!g)return!1;const h={size:{width:g.width,height:g.height},positionH:{relativeFrom:u.ObjectRelativeFromH.PAGE,posOffset:0},positionV:{relativeFrom:u.ObjectRelativeFromV.PARAGRAPH,posOffset:0},angle:0},f={unitId:a.getUnitId(),subUnitId:a.getUnitId(),drawingId:e,drawingType:u.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:r,source:o,transform:qe.docDrawingPositionToTransform(h),docTransform:h,behindDoc:u.BooleanNumber.FALSE,title:"",description:"",layoutType:u.PositionedObjectLayoutType.INLINE,wrapText:u.WrapTextType.BOTH_SIDES,distB:0,distL:0,distR:0,distT:0},w=u.BuildTextUtils.drawing.add({documentDataModel:a,drawings:[f],selection:{collapsed:!0,startOffset:0,endOffset:0}});return w?(a.apply(w),this._commandService.syncExecuteCommand(_.SetRangeValuesCommand.id,{value:{[l.primary.actualRow]:{[l.primary.actualColumn]:{p:a.getSnapshot(),t:1}}}})):!1}_getUnitInfo(){const n=this._context.unit,t=n.getActiveSheet(),e=n.getUnitId(),r=t.getSheetId();return{unitId:e,subUnitId:r}}_getImagePosition(n,t,e,r){const o=this._workbookSelections.getCurrentSelections();let s={startRow:0,endRow:0,startColumn:0,endColumn:0};o&&o.length>0&&(s=o[o.length-1].range);const c=N.attachRangeWithCoord(this._skeletonManagerService.getCurrent().skeleton,s);if(c==null)return;let{startColumn:d,startRow:m,startX:l,startY:a}=c,g=!1;if(l+n>e&&(l=e-n,l<0&&(l=0,n=e),g=!0),a+t>r&&(a=r-t,a<0&&(a=0,t=r),g=!0),g){const S=this._selectionRenderService.getCellWithCoordByOffset(l,a);if(S==null)return;l=S.startX,a=S.startY,d=S.actualColumn,m=S.actualRow}const h={column:d,columnOffset:0,row:m,rowOffset:0},f=this._selectionRenderService.getCellWithCoordByOffset(l+n,a+t);if(f==null)return;const w={column:f.actualColumn,columnOffset:l+n-f.startX,row:f.actualRow,rowOffset:a+t-f.startY};return{from:h,to:w}}_updateOrderListener(){this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe(n=>{const{unitId:t,subUnitId:e,drawingIds:r,arrangeType:o}=n;this._commandService.executeCommand(xe.id,{unitId:t,subUnitId:e,drawingIds:r,arrangeType:o})}))}_updateImageListener(){this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe(n=>{const t=[];n.length!==0&&(n.forEach(e=>{const{unitId:r,subUnitId:o,drawingId:s,drawingType:c,transform:d}=e;if(d==null)return;const m=this._sheetDrawingService.getDrawingByParam({unitId:r,subUnitId:o,drawingId:s});if(m==null||m.unitId!==this._context.unitId)return;const l=$({...m.transform,...d},this._selectionRenderService);if(l==null)return;const a={...e,transform:{...m.transform,...d,...F(l,this._selectionRenderService,this._skeletonManagerService)},sheetTransform:{...l}};t.push(a)}),t.length>0&&this._commandService.executeCommand(de.id,{unitId:n[0].unitId,drawings:t}))}))}_groupDrawingListener(){this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe(n=>{this._commandService.executeCommand(Le.id,n);const{unitId:t,subUnitId:e,drawingId:r}=n[0].parent;this._drawingManagerService.focusDrawing([{unitId:t,subUnitId:e,drawingId:r}])})),this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe(n=>{this._commandService.executeCommand(Be.id,n)}))}_focusDrawingListener(){this.disposeWithMe(this._drawingManagerService.focus$.subscribe(n=>{n==null||n.length===0?(this._contextService.setContextValue(u.FOCUSING_COMMON_DRAWINGS,!1),this._sheetDrawingService.focusDrawing([])):(this._contextService.setContextValue(u.FOCUSING_COMMON_DRAWINGS,!0),this._sheetDrawingService.focusDrawing(n))}))}};se=At([X(1,u.Inject(N.SheetSkeletonManagerService)),X(2,u.ICommandService),X(3,N.ISheetSelectionRenderService),X(4,A.IImageIoService),X(5,G.ILocalFileService),X(6,p.ISheetDrawingService),X(7,A.IDrawingManagerService),X(8,u.IContextService),X(9,G.IMessageService),X(10,u.Inject(u.LocaleService)),X(11,u.Inject(_.SheetsSelectionsService)),X(12,u.Inject(u.Injector))],se);var Ut=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,jt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Nt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Ut(n,t,r),r},te=(i,n)=>(t,e)=>n(t,e,i);function Ue(i,n,t){var e,r,o,s;if(((r=(e=t==null?void 0:t.p)==null?void 0:e.body)==null?void 0:r.dataStream.length)===3&&((s=(o=t.p)==null?void 0:o.drawingsOrder)==null?void 0:s.length)===1){const c=t.p.drawings[t.p.drawingsOrder[0]],d=Ze(i,{unitId:n.unitId,subUnitId:n.subUnitId,row:n.row,col:n.col},c.docTransform.size.width,c.docTransform.size.height,c.docTransform.angle);if(d)return c.transform.width=d.width,c.transform.height=d.height,c.docTransform.size.width=d.width,c.docTransform.size.height=d.height,c.transform.left=0,c.transform.top=0,c.docTransform.positionH.posOffset=0,c.docTransform.positionV.posOffset=0,t.p.documentStyle.pageSize.width=1/0,t.p.documentStyle.pageSize.height=1/0,!0}return!1}let Se=class extends u.Disposable{constructor(i,n,t,e,r,o,s){super(),this._commandService=i,this._sheetInterceptorService=n,this._univerInstanceService=t,this._injector=e,this._drawingManagerService=r,this._docDrawingController=o,this._editorBridgeService=s,this._initHandleResize(),this._handleInitEditor(),this._handleWriteCell(),this._initCellContentInterceptor()}_initHandleResize(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{let n,t=[];if(i.id===_.SetWorksheetRowHeightMutation.id){const e=i.params;t=e.ranges,n=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e.unitId,subUnitId:e.subUnitId})}else if(i.id===_.SetWorksheetColWidthMutation.id){const e=i.params;t=e.ranges,n=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e.unitId,subUnitId:e.subUnitId})}else if(i.id===_.SetWorksheetRowIsAutoHeightMutation.id){const e=i.params;t=e.ranges,n=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e.unitId,subUnitId:e.subUnitId})}else if(i.id===_.SetWorksheetRowAutoHeightMutation.id){const e=i.params;n=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e.unitId,subUnitId:e.subUnitId}),t=e.rowsAutoHeightInfo.map(r=>({startRow:r.row,endRow:r.row,startColumn:0,endColumn:9999}))}else if(i.id===_.AddWorksheetMergeMutation.id){const e=i.params;t=e.ranges,n=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e.unitId,subUnitId:e.subUnitId})}else if(i.id===_.RemoveWorksheetMergeMutation.id){const e=i.params;t=e.ranges,n=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e.unitId,subUnitId:e.subUnitId})}n&&t.length&&t.forEach(e=>{const r=u.Range.transformRange(e,n.worksheet);for(let o=r.startRow;o<=r.endRow;o++)for(let s=r.startColumn;s<=r.endColumn;s++)Ue(this._injector,{unitId:n.unitId,subUnitId:n.subUnitId,row:o,col:s},n.worksheet.getCellRaw(o,s))})}))}_handleInitEditor(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(i=>{i.visible?i.visible&&(this._drawingManagerService.removeDrawingDataForUnit(u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY),this._docDrawingController.loadDrawingDataForUnit(u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY),this._drawingManagerService.initializeNotification(u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)):this._drawingManagerService.removeDrawingDataForUnit(u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)})),this.disposeWithMe(this._commandService.onCommandExecuted(i=>{i.id===qe.ReplaceSnapshotCommand.id&&i.params.unitId===u.DOCS_ZEN_EDITOR_UNIT_ID_KEY&&(this._drawingManagerService.removeDrawingDataForUnit(u.DOCS_ZEN_EDITOR_UNIT_ID_KEY),this._docDrawingController.loadDrawingDataForUnit(u.DOCS_ZEN_EDITOR_UNIT_ID_KEY),this._drawingManagerService.initializeNotification(u.DOCS_ZEN_EDITOR_UNIT_ID_KEY))}))}_handleWriteCell(){this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(_.AFTER_CELL_EDIT,{priority:9999,handler:(i,n,t)=>(Ue(this._injector,{unitId:n.unitId,subUnitId:n.subUnitId,row:n.row,col:n.col},i),t(i))}))}_initCellContentInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(_.INTERCEPTOR_POINT.CELL_CONTENT,{effect:u.InterceptorEffectEnum.Style,priority:_.InterceptCellContentPriority.CELL_IMAGE,handler:(i,n,t)=>{var e;return i!=null&&i.p&&((e=i.p.drawingsOrder)!=null&&e.length)&&(i.interceptorStyle||(i.interceptorStyle={}),i.interceptorStyle.tr={a:0}),t(i)}}))}};Se=jt([te(0,u.ICommandService),te(1,u.Inject(_.SheetInterceptorService)),te(2,u.IUniverInstanceService),te(3,u.Inject(u.Injector)),te(4,A.IDrawingManagerService),te(5,u.Inject(lt.DocDrawingController)),te(6,u.Inject(N.IEditorBridgeService))],Se);var Wt=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,xt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Lt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Wt(n,t,r),r},Ke=(i,n)=>(t,e)=>n(t,e,i);let _e=class extends u.Disposable{constructor(i,n){super(),this._autoFillService=i,this._injector=n,this._initAutoFillHooks()}_initAutoFillHooks(){this.disposeWithMe(this._autoFillService.addHook({id:"sheet-cell-image-autofill",onBeforeSubmit:(i,n,t,e)=>{new u.ObjectMatrix(e).forValue((r,o,s)=>{Ue(this._injector,{unitId:i.unitId,subUnitId:i.subUnitId,row:r,col:o},s)})}}))}};_e=xt([Ke(0,u.Inject(N.IAutoFillService)),Ke(1,u.Inject(u.Injector))],_e);var Bt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Gt=(i,n,t,e)=>{for(var r=e>1?void 0:e?$t(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Bt(n,t,r),r},he=(i,n)=>(t,e)=>n(t,e,i);let ve=class extends u.Disposable{constructor(n,t,e,r){super();H(this,"_isSetCursor",!1);this._hoverManagerService=n,this._renderManagerService=t,this._selectionsService=e,this._drawingRenderService=r}_initHover(){}_initImageClick(){}};ve=Gt([he(0,u.Inject(N.HoverManagerService)),he(1,u.Inject(P.IRenderManagerService)),he(2,u.Inject(_.SheetsSelectionsService)),he(3,u.Inject(Q.DrawingRenderService))],ve);var kt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,Ht=(i,n,t,e)=>{for(var r=e>1?void 0:e?Ft(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&kt(n,t,r),r},Ee=(i,n)=>(t,e)=>n(t,e,i);let Ie=class extends u.Disposable{constructor(n,t,e){super();H(this,"_copyInfo");this._sheetClipboardService=n,this._renderManagerService=t,this._sheetDrawingService=e,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:"SHEET_IMAGE_UI_PLUGIN",onBeforeCopy:(n,t,e)=>this._collect(n,t,e),onPasteCells:(n,t,e,r)=>{const{copyType:o=N.COPY_TYPE.COPY,pasteType:s}=r,{range:c}=n||{},{range:d,unitId:m,subUnitId:l}=t;return this._generateMutations(d,{copyType:o,pasteType:s,copyRange:c,unitId:m,subUnitId:l})},onPastePlainText:(n,t)=>({undos:[],redos:[]})})}_collect(n,t,e){var g;const r=(g=this._renderManagerService.getRenderById(n))==null?void 0:g.with(N.SheetSkeletonManagerService);if(!r)return;const o=r.attachRangeWithCoord(e);if(!o)return;const{startX:s,endX:c,startY:d,endY:m}=o,l=this._sheetDrawingService.getDrawingData(n,t),a=[];Object.keys(l).forEach(h=>{const f=l[h],{transform:w}=f;if(f.anchorType!==p.SheetDrawingAnchorType.Both||!w)return;const{left:S=0,top:D=0,width:y=0,height:C=0}=w,{drawingStartX:T,drawingEndX:I,drawingStartY:M,drawingEndY:v}={drawingStartX:S,drawingEndX:S+y,drawingStartY:D,drawingEndY:D+C};s<=T&&I<=c&&d<=M&&v<=m&&a.push(f)}),a.length&&(this._copyInfo={drawings:a,unitId:n,subUnitId:t})}_generateMutations(n,t){var b;if(!this._copyInfo)return{redos:[],undos:[]};if([N.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,N.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,N.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,N.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(t.pasteType))return{redos:[],undos:[]};const{copyRange:e}=t;if(!e)return{redos:[],undos:[]};const{drawings:r,unitId:o,subUnitId:s}=this._copyInfo,{ranges:[c,d],mapFunc:m}=N.virtualizeDiscreteRanges([e,n]),{row:l,col:a}=m(c.startRow,c.startColumn),{row:g,col:h}=m(d.startRow,d.startColumn),f=(b=this._renderManagerService.getRenderById(o))==null?void 0:b.with(N.SheetSkeletonManagerService);if(!f)return{redos:[],undos:[]};const w=f.attachRangeWithCoord({startRow:l,endRow:l,startColumn:a,endColumn:a}),S=f.attachRangeWithCoord({startRow:g,endRow:g,startColumn:h,endColumn:h});if(!w||!S)return{redos:[],undos:[]};const D=[],y=[],C=S.startX-w.startX,T=S.startY-w.startY,I=g-l,M=h-a,v=t.copyType===N.COPY_TYPE.CUT,{_sheetDrawingService:O}=this;return r.forEach(j=>{const{transform:U,sheetTransform:E}=j;if(!U)return;const R={...j,unitId:o,subUnitId:s,drawingId:v?j.drawingId:u.Tools.generateRandomId(),transform:{...U,left:U.left+C,top:U.top+T},sheetTransform:{to:{...E.to,row:E.to.row+I,column:E.to.column+M},from:{...E.from,row:E.from.row+I,column:E.from.column+M}}};if(v){const{undo:W,redo:B,objects:q}=O.getBatchUpdateOp([R]);D.push({id:p.SetDrawingApplyMutation.id,params:{unitId:o,subUnitId:s,type:p.DrawingApplyType.UPDATE,op:B,objects:q}}),y.push({id:p.SetDrawingApplyMutation.id,params:{unitId:o,subUnitId:s,type:p.DrawingApplyType.UPDATE,op:W,objects:q}})}else{const{undo:W,redo:B,objects:q}=O.getBatchAddOp([R]);D.push({id:p.SetDrawingApplyMutation.id,params:{op:B,unitId:o,subUnitId:s,objects:q,type:p.DrawingApplyType.INSERT}}),y.push({id:p.SetDrawingApplyMutation.id,params:{op:W,unitId:o,subUnitId:s,objects:q,type:p.DrawingApplyType.REMOVE}})}}),{redos:D,undos:y}}};Ie=Ht([Ee(0,N.ISheetClipboardService),Ee(1,P.IRenderManagerService),Ee(2,p.ISheetDrawingService)],Ie);var Vt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Xt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Yt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Vt(n,t,r),r},oe=(i,n)=>(t,e)=>n(t,e,i);let De=class extends u.Disposable{constructor(i,n,t,e,r){super(),this._drawingManagerService=i,this._renderManagerService=n,this._permissionService=t,this._univerInstanceService=e,this._userManagerService=r,this._initDrawingVisible(),this._initDrawingEditable(),this._initViewPermissionChange(),this._initEditPermissionChange()}_initDrawingVisible(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,t])=>{if(!n){this._drawingManagerService.setDrawingVisible(!1);return}n.activeSheet$.subscribe(e=>{if(!e){this._drawingManagerService.setDrawingVisible(!1);return}const r=n.getUnitId(),o=e.getSheetId();if(this._permissionService.composePermission([new _.WorkbookViewPermission(r).id,new _.WorksheetViewPermission(r,o).id]).every(c=>c.value))this._drawingManagerService.setDrawingVisible(!0);else{this._drawingManagerService.setDrawingVisible(!1);const c=n.getUnitId(),d=e.getSheetId(),m=this._drawingManagerService.getDrawingData(c,d),l=Object.values(m),a=this._renderManagerService.getRenderById(c),g=a==null?void 0:a.scene;if(g==null)return;g.getAllObjectsByOrder().forEach(f=>{f.classType===P.RENDER_CLASS_TYPE.IMAGE&&l.some(w=>f.oKey.includes(w.drawingId))&&g.removeObject(f)})}})}))}_initDrawingEditable(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,t])=>{if(!n){this._drawingManagerService.setDrawingEditable(!1);return}n.activeSheet$.subscribe(e=>{if(!e){this._drawingManagerService.setDrawingEditable(!1);return}const r=n.getUnitId(),o=e.getSheetId();if(this._permissionService.composePermission([new _.WorkbookEditablePermission(r).id,new _.WorksheetEditPermission(r,o).id]).every(c=>c.value))this._drawingManagerService.setDrawingEditable(!0);else{this._drawingManagerService.setDrawingEditable(!1);const c=n.getUnitId(),d=e.getSheetId(),m=this._drawingManagerService.getDrawingData(c,d),l=Object.values(m),a=this._renderManagerService.getRenderById(c),g=a==null?void 0:a.scene;if(g==null)return;g.getAllObjectsByOrder().forEach(f=>{f.classType===P.RENDER_CLASS_TYPE.IMAGE&&l.some(w=>f.oKey.includes(w.drawingId))&&g.detachTransformerFrom(f)})}})}))}_initViewPermissionChange(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,t])=>{n&&n.activeSheet$.subscribe(e=>{var a;if(!e)return;const r=n.getUnitId(),o=e.getSheetId();let s=!0;const c=this._renderManagerService.getRenderById(r),d=c==null?void 0:c.scene;if(d==null)return;const m=d.getTransformerByCreate(),l=this._permissionService.composePermission$([new _.WorkbookViewPermission(r).id,new _.WorksheetViewPermission(r,o).id]).pipe(L.map(g=>g.every(h=>h.value)));l==null||l.pipe(L.filter(g=>g!==s),L.distinctUntilChanged()).subscribe({next:g=>{s=g,this._drawingManagerService.setDrawingVisible(g);const h=d.getAllObjectsByOrder(),f=this._drawingManagerService.getDrawingData(r,o),w=Object.values(f);g?this._drawingManagerService.addNotification(w):(h.forEach(S=>{S.classType===P.RENDER_CLASS_TYPE.IMAGE&&w.some(D=>S.oKey.includes(D.drawingId))&&d.removeObject(S)}),m.clearSelectedObjects())}}),(a=this._permissionService.getPermissionPoint$(new _.WorksheetViewPermission(r,o).id))==null||a.pipe(L.filter(g=>g.value!==s),L.distinctUntilChanged()).subscribe({complete:()=>{s=!0,this._drawingManagerService.setDrawingVisible(!0);const g=this._drawingManagerService.getDrawingData(r,o),h=Object.values(g);this._drawingManagerService.addNotification(h)}})})}))}_initEditPermissionChange(){const i=this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET);this.disposeWithMe(L.combineLatest([i,this._userManagerService.currentUser$]).subscribe(([n,t])=>{n&&n.activeSheet$.subscribe(e=>{var a;if(!e)return;const r=n.getUnitId(),o=e.getSheetId();let s=!0;const c=this._renderManagerService.getRenderById(r),d=c==null?void 0:c.scene;if(d==null)return;const m=d.getTransformerByCreate(),l=this._permissionService.composePermission$([new _.WorkbookEditablePermission(r).id,new _.WorksheetEditPermission(r,o).id]).pipe(L.map(g=>g.every(h=>h.value)));l==null||l.pipe(L.filter(g=>g!==s),L.distinctUntilChanged()).subscribe({next:g=>{s=g,this._drawingManagerService.setDrawingEditable(g);const h=d.getAllObjectsByOrder(),f=this._drawingManagerService.getDrawingData(r,o),w=Object.values(f);g?(h.forEach(S=>{S.classType===P.RENDER_CLASS_TYPE.IMAGE&&w.some(D=>S.oKey.includes(D.drawingId))&&d.attachTransformerTo(S)}),this._drawingManagerService.addNotification(w)):(h.forEach(S=>{S.classType===P.RENDER_CLASS_TYPE.IMAGE&&w.some(D=>S.oKey.includes(D.drawingId))&&d.detachTransformerFrom(S)}),m.clearSelectedObjects())}}),(a=this._permissionService.getPermissionPoint$(new _.WorksheetEditPermission(r,o).id))==null||a.pipe(L.filter(g=>g.value!==s),L.distinctUntilChanged()).subscribe({complete:()=>{s=!0;const g=n.getUnitId(),h=e.getSheetId(),f=this._drawingManagerService.getDrawingData(g,h),w=Object.values(f),S=this._renderManagerService.getRenderById(g),D=S==null?void 0:S.scene;if(D==null)return;this._drawingManagerService.setDrawingEditable(!0),D.getAllObjectsByOrder().forEach(C=>{C.classType===P.RENDER_CLASS_TYPE.IMAGE&&w.some(T=>C.oKey.includes(T.drawingId))&&D.detachTransformerFrom(C)})}})})}))}};De=Xt([oe(0,A.IDrawingManagerService),oe(1,P.IRenderManagerService),oe(2,u.IPermissionService),oe(3,u.IUniverInstanceService),oe(4,u.Inject(u.UserManagerService))],De);var zt=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,qt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Kt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&zt(n,t,r),r},me=(i,n)=>(t,e)=>n(t,e,i);let Ce=class extends u.Disposable{constructor(i,n,t,e){super(),this._sheetPrintInterceptorService=i,this._drawingRenderService=n,this._drawingManagerService=t,this._renderManagerService=e,this._initPrinting()}_initPrinting(){this.disposeWithMe(this._sheetPrintInterceptorService.interceptor.intercept(this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,{handler:(i,n,t)=>{const{unitId:e,scene:r,subUnitId:o}=n,s=this._drawingManagerService.getDrawingDataForUnit(e),c=s==null?void 0:s[o];return c&&c.order.forEach(d=>{this._drawingRenderService.renderDrawing(c.data[d],r)}),t()}})),this.disposeWithMe(this._sheetPrintInterceptorService.interceptor.intercept(this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,{handler:(i,n,t)=>{const{unitId:e,subUnitId:r}=n,o=this._renderManagerService.getRenderById(e);if(!o)return t(i);const s=o.with(N.SheetSkeletonManagerService).getWorksheetSkeleton(r);if(!s)return t(i);const c=this._drawingManagerService.getDrawingDataForUnit(e),d=c==null?void 0:c[n.subUnitId];if(!d)return t(i);const{scaleX:m,scaleY:l}=o.scene,a=i?{...i}:{startColumn:0,endColumn:0,endRow:0,startRow:0},g=d.order.map(h=>d.data[h]).filter(h=>h.drawingType!==u.DrawingTypeEnum.DRAWING_DOM);return g.length?(g.forEach(h=>{if(!h.groupId&&h.transform&&u.Tools.isDefine(h.transform.left)&&u.Tools.isDefine(h.transform.top)&&u.Tools.isDefine(h.transform.width)&&u.Tools.isDefine(h.transform.height)){const f=s.skeleton.getCellIndexByOffset(h.transform.left,h.transform.top,m,l,{x:0,y:0}),w=s.skeleton.getCellIndexByOffset(h.transform.left+h.transform.width,h.transform.top+h.transform.height,m,l,{x:0,y:0});f.column<a.startColumn&&(a.startColumn=f.column),f.row<a.startRow&&(a.startRow=f.row),a.endRow<w.row&&(a.endRow=w.row),a.endColumn<w.column&&(a.endColumn=w.column)}}),t(a)):t(i)}}))}};Ce=qt([me(0,u.Inject(N.SheetPrintInterceptorService)),me(1,u.Inject(Q.DrawingRenderService)),me(2,A.IDrawingManagerService),me(3,P.IRenderManagerService)],Ce);var Jt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,Qt=(i,n,t,e)=>{for(var r=e>1?void 0:e?Zt(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Jt(n,t,r),r},J=(i,n)=>(t,e)=>n(t,e,i);const en=[_.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],tn=[_.SetRowVisibleMutation.id,_.SetRowHiddenMutation.id,_.SetColVisibleMutation.id,_.SetColHiddenMutation.id,_.SetWorksheetRowHeightMutation.id,_.SetWorksheetColWidthMutation.id];let Ne=class extends u.Disposable{constructor(i,n,t,e,r,o,s,c,d){super(),this._context=i,this._renderManagerService=n,this._commandService=t,this._selectionRenderService=e,this._skeletonManagerService=r,this._sheetInterceptorService=o,this._sheetDrawingService=s,this._drawingManagerService=c,this._univerInstanceService=d,this._sheetInterceptorListener(),this._commandListener(),this._sheetRefreshListener()}_sheetInterceptorListener(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{if(!en.includes(i.id))return{redos:[],undos:[]};if(i.params==null)return{redos:[],undos:[]};const n=i.id;if(n===_.InsertRowCommand.id)return this._moveRowInterceptor(i.params,"insert");if([_.MoveColsCommand.id,_.MoveRowsCommand.id,_.MoveRangeCommand.id].includes(n))return this._moveRangeInterceptor(i.params);if(n===_.InsertColCommand.id)return this._moveColInterceptor(i.params,"insert");if(n===_.RemoveRowCommand.id)return this._moveRowInterceptor(i.params,"remove");if(n===_.RemoveColCommand.id)return this._moveColInterceptor(i.params,"remove");if(n===_.DeleteRangeMoveLeftCommand.id){const{range:t}=i.params;return this._getRangeMoveUndo(t,0)}else if(n===_.DeleteRangeMoveUpCommand.id){const{range:t}=i.params;return this._getRangeMoveUndo(t,1)}else if(n===_.InsertRangeMoveDownCommand.id){const{range:t}=i.params;return this._getRangeMoveUndo(t,2)}else if(n===_.InsertRangeMoveRightCommand.id){const{range:t}=i.params;return this._getRangeMoveUndo(t,3)}else if(n===_.SetRowHiddenCommand.id||n===_.SetSpecificRowsVisibleCommand.id){const t=i.params,{unitId:e,subUnitId:r,ranges:o}=t;return this._getDrawingUndoForRowVisible(e,r,o)}else if(n===_.SetSpecificColsVisibleCommand.id||n===_.SetColHiddenCommand.id){const t=i.params,{unitId:e,subUnitId:r,ranges:o}=t;return this._getDrawingUndoForColVisible(e,r,o)}else if(n===_.DeltaRowHeightCommand.id||n===_.SetRowHeightCommand.id||n===_.DeltaColumnWidthCommand.id||n===_.SetColWidthCommand.id){const t=i.params,{unitId:e,subUnitId:r,ranges:o}=t,s=n===_.DeltaRowHeightCommand.id||n===_.SetRowHeightCommand.id;return this._getDrawingUndoForRowAndColSize(e,r,o,s)}return{redos:[],undos:[]}}}))}_getRangeMoveUndo(i,n){const t=_.getSheetCommandTarget(this._univerInstanceService);if(t==null)return{redos:[],undos:[]};const e=t.unitId,r=t.subUnitId,o=[],s=[],c=this._sheetDrawingService.getDrawingData(e,r),d=[],m=[];if(Object.keys(c).forEach(l=>{const a=c[l],{updateDrawings:g,deleteDrawings:h}=this._getUpdateOrDeleteDrawings(i,n,a);d.push(...g),m.push(...h)}),d.length===0&&m.length===0)return{redos:[],undos:[]};if(d.length>0){const l=this._sheetDrawingService.getBatchUpdateOp(d),{undo:a,redo:g,objects:h}=l;o.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:g,objects:h,type:p.DrawingApplyType.UPDATE}}),s.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:a,objects:h,type:p.DrawingApplyType.UPDATE}})}if(m.length>0){const l=this._sheetDrawingService.getBatchRemoveOp(m),a=l.undo,g=l.redo,h=l.objects;o.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:g,objects:h,type:p.DrawingApplyType.REMOVE}}),s.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:a,objects:h,type:p.DrawingApplyType.INSERT}})}return o.push({id:x.id,params:[e]}),s.push({id:x.id,params:[e]}),{redos:o,undos:s}}_getUpdateOrDeleteDrawings(i,n,t){const e=[],r=[],{sheetTransform:o,anchorType:s=p.SheetDrawingAnchorType.Position,transform:c,unitId:d,subUnitId:m,drawingId:l}=t,{from:a,to:g}=o,{row:h,column:f}=a,{row:w,column:S}=g;if(o==null||c==null)return{updateDrawings:e,deleteDrawings:r};const{startRow:D,endRow:y,startColumn:C,endColumn:T}=i;let I=null,M=null;if(n===0&&h>=D&&w<=y)if(f>=C&&S<=T)r.push({unitId:d,subUnitId:m,drawingId:l});else{const v=this._shrinkCol(o,c,C,T,s);I=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}else if(n===1&&f>=C&&S<=T)if(h>=D&&w<=y)r.push({unitId:d,subUnitId:m,drawingId:l});else{const v=this._shrinkRow(o,c,D,y,s);I=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}else if(n===2){const v=this._expandRow(o,c,D,y,s);I=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}else if(n===3){const v=this._expandCol(o,c,C,T,s);I=v==null?void 0:v.newSheetTransform,M=v==null?void 0:v.newTransform}if(I!=null&&M!=null){const v=F(I,this._selectionRenderService,this._skeletonManagerService);e.push({...t,sheetTransform:I,transform:v})}return{updateDrawings:e,deleteDrawings:r}}_remainDrawingSize(i,n,t){const e=$({...i},this._selectionRenderService);e!=null&&n.push({...t,sheetTransform:e})}_getDrawingUndoForColVisible(i,n,t){const e=this._drawingManagerService.getDrawingData(i,n),r=[],o=[];if(Object.keys(e).forEach(l=>{const a=e[l],{sheetTransform:g,transform:h,anchorType:f=p.SheetDrawingAnchorType.Position}=a;if(f===p.SheetDrawingAnchorType.None)this._remainDrawingSize(h,r,a);else{const{from:w,to:S}=g,{row:D,column:y}=w,{row:C,column:T}=S;for(let I=0;I<t.length;I++){const M=t[I],{startRow:v,endRow:O,startColumn:b,endColumn:j}=M;if(T<b)continue;if(f===p.SheetDrawingAnchorType.Position){let R=null,W=null;if(y>=b&&y<=j){const B=this._skeletonManagerService.attachRangeWithCoord({startColumn:y,endColumn:j,startRow:w.row,endRow:S.row});if(B==null)return;W={...h,left:B.startX}}if(W!=null&&(R=$(W,this._selectionRenderService),R!=null&&W!=null)){r.push({...a,sheetTransform:R,transform:W});break}this._remainDrawingSize(h,r,a);continue}if(y>=b&&T<=j)continue;let U=null,E=null;if(y>=b&&y<=j){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:y,endColumn:j,startRow:w.row,endRow:S.row});if(R==null)return;E={...h,left:(R==null?void 0:R.startX)||0,width:((h==null?void 0:h.width)||0)-R.endX+R.startX}}else if(T>=b&&T<=j){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:b,endColumn:T,startRow:w.row,endRow:S.row});if(R==null)return;E={...h,left:R.startX-((h==null?void 0:h.width)||0)}}else{const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:b,endColumn:j,startRow:w.row,endRow:S.row});if(R==null)return;if(E={...h,width:((h==null?void 0:h.width)||0)-R.endX+R.startX},U=$(E,this._selectionRenderService),U!=null&&E!=null){o.push({...a,sheetTransform:U,transform:E});break}}if(E!=null&&(U=$(E,this._selectionRenderService)),E!=null&&U!=null){r.push({...a,sheetTransform:U,transform:E});break}else this._remainDrawingSize(h,r,a)}}}),r.length===0&&o.length===0)return{redos:[],undos:[]};const{redos:s,undos:c}=this._createUndoAndRedoMutation(i,n,r),d=[],m=[];if(o.length>0){const{redos:l,undos:a}=this._createUndoAndRedoMutation(i,n,o);d.push(...l),m.push(...a)}return{redos:s,undos:c,preRedos:d,preUndos:m}}_createUndoAndRedoMutation(i,n,t){const e=this._sheetDrawingService.getBatchUpdateOp(t),{undo:r,redo:o,objects:s}=e,c=[{id:p.SetDrawingApplyMutation.id,params:{unitId:i,subUnitId:n,op:o,objects:s,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[i]}],d=[{id:p.SetDrawingApplyMutation.id,params:{unitId:i,subUnitId:n,op:r,objects:s,type:p.DrawingApplyType.UPDATE}},{id:x.id,params:[i]}];return{redos:c,undos:d}}_getDrawingUndoForRowVisible(i,n,t){const e=this._drawingManagerService.getDrawingData(i,n),r=[],o=[];if(Object.keys(e).forEach(l=>{const a=e[l],{sheetTransform:g,transform:h,anchorType:f=p.SheetDrawingAnchorType.Position}=a;if(f===p.SheetDrawingAnchorType.None)this._remainDrawingSize(h,r,a);else{const{from:w,to:S}=g,{row:D,column:y}=w,{row:C,column:T}=S;for(let I=0;I<t.length;I++){const M=t[I],{startRow:v,endRow:O,startColumn:b,endColumn:j}=M;if(C<v)continue;if(f===p.SheetDrawingAnchorType.Position){let R=null,W=null;if(D>=v&&D<=O){const B=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:D,endRow:O});if(B==null)return;W={...h,top:B.startY}}if(W!=null&&(R=$(W,this._selectionRenderService),R!=null&&W!=null)){r.push({...a,sheetTransform:R,transform:W});break}this._remainDrawingSize(h,r,a);continue}if(D>=v&&C<=O)continue;let U=null,E=null;if(D>=v&&D<=O){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:D,endRow:O});if(R==null)return;E={...h,top:(R==null?void 0:R.startY)||0,height:((h==null?void 0:h.height)||0)-R.endY+R.startY}}else if(C>=v&&C<=O){const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:v,endRow:C});if(R==null)return;E={...h,top:R.startY-((h==null?void 0:h.height)||0)}}else{const R=this._skeletonManagerService.attachRangeWithCoord({startColumn:w.column,endColumn:S.column,startRow:v,endRow:O});if(R==null)return;if(E={...h,height:((h==null?void 0:h.height)||0)-R.endY+R.startY},U=$(E,this._selectionRenderService),U!=null&&E!=null){o.push({...a,sheetTransform:U,transform:E});break}}if(E!=null&&(U=$(E,this._selectionRenderService)),E!=null&&U!=null){r.push({...a,sheetTransform:U,transform:E});break}else this._remainDrawingSize(h,r,a)}}}),r.length===0&&o.length===0)return{redos:[],undos:[]};const{redos:s,undos:c}=this._createUndoAndRedoMutation(i,n,r),d=[],m=[];if(o.length>0){const{redos:l,undos:a}=this._createUndoAndRedoMutation(i,n,o);d.push(...l),m.push(...a)}return{redos:s,undos:c,preRedos:d,preUndos:m}}_getDrawingUndoForRowAndColSize(i,n,t,e){const r=this._drawingManagerService.getDrawingData(i,n),o=[];return Object.keys(r).forEach(s=>{const c=r[s],{sheetTransform:d,transform:m,anchorType:l=p.SheetDrawingAnchorType.Position}=c;if(l===p.SheetDrawingAnchorType.None)this._remainDrawingSize(m,o,c);else{const{from:a,to:g}=d,{row:h,column:f}=a,{row:w,column:S}=g;for(let D=0;D<t.length;D++){const y=t[D],{startRow:C,endRow:T,startColumn:I,endColumn:M}=y;if(w<C||S<I)continue;if(l===p.SheetDrawingAnchorType.Position&&(h<=C&&w>=T||f<=I&&S>=M)){this._remainDrawingSize(m,o,c);continue}const v=F({...d},this._selectionRenderService,this._skeletonManagerService);if(v!=null){o.push({...c,transform:v});break}}}}),o.length===0?{redos:[],undos:[]}:this._createUndoAndRedoMutation(i,n,o)}_getUnitIdAndSubUnitId(i,n){let t,e;if(n==="insert")t=i.unitId,e=i.subUnitId;else{const r=_.getSheetCommandTarget(this._univerInstanceService);if(r==null)return;t=r.unitId,e=r.subUnitId}return{unitId:t,subUnitId:e}}_moveRangeInterceptor(i){var C,T;const{toRange:n,fromRange:t}=i,e=_.getSheetCommandTarget(this._univerInstanceService);if(!e)return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=e,s=(T=(C=this._renderManagerService.getRenderById(r))==null?void 0:C.with(N.SheetSkeletonManagerService))==null?void 0:T.getCurrentSkeleton();if(!s)return{redos:[],undos:[]};const c=N.attachRangeWithCoord(s,t);if(!c)return{redos:[],undos:[]};const{startX:d,endX:m,startY:l,endY:a}=c,g=this._sheetDrawingService.getDrawingData(r,o),h=[];Object.keys(g).forEach(I=>{const M=g[I];if(M.anchorType!==p.SheetDrawingAnchorType.Both)return;const{transform:v}=M;if(!v)return;const{left:O=0,top:b=0,width:j=0,height:U=0}=v,{drawingStartX:E,drawingEndX:R,drawingStartY:W,drawingEndY:B}={drawingStartX:O,drawingEndX:O+j,drawingStartY:b,drawingEndY:b+U};d<=E&&R<=m&&l<=W&&B<=a&&h.push(M)});const f=[],w=[],S=n.startRow-t.startRow,D=n.startColumn-t.startColumn,y=h.map(I=>{const M=I.sheetTransform,v={to:{...M.to,row:M.to.row+S,column:M.to.column+D},from:{...M.from,row:M.from.row+S,column:M.from.column+D}},O=F(v,this._selectionRenderService,this._skeletonManagerService);return{unitId:r,subUnitId:o,drawingId:I.drawingId,transform:O,sheetTransform:v}});if(y.length){const I=this._sheetDrawingService.getBatchUpdateOp(y),{undo:M,redo:v,objects:O}=I;f.push({id:p.SetDrawingApplyMutation.id,params:{unitId:r,subUnitId:o,op:v,objects:O,type:p.DrawingApplyType.UPDATE}}),w.push({id:p.SetDrawingApplyMutation.id,params:{unitId:r,subUnitId:o,op:M,objects:O,type:p.DrawingApplyType.UPDATE}})}return{redos:f,undos:w}}_moveRowInterceptor(i,n){const t=this._getUnitIdAndSubUnitId(i,n);if(t==null)return{redos:[],undos:[]};const{unitId:e,subUnitId:r}=t,{range:o}=i,s=o.startRow,c=o.endRow,d=[],m=[],l=this._sheetDrawingService.getDrawingData(e,r),a=[],g=[];if(Object.keys(l).forEach(h=>{const f=l[h],{sheetTransform:w,transform:S,anchorType:D=p.SheetDrawingAnchorType.Position}=f;if(w==null||S==null)return;let y,C;if(n==="insert"){const I=this._expandRow(w,S,s,c,D);y=I==null?void 0:I.newSheetTransform,C=I==null?void 0:I.newTransform}else{const{from:I,to:M}=w,{row:v}=I,{row:O}=M;if(D===p.SheetDrawingAnchorType.Both&&v>=s&&O<=c)g.push({unitId:e,subUnitId:r,drawingId:h});else{const b=this._shrinkRow(w,S,s,c,D);y=b==null?void 0:b.newSheetTransform,C=b==null?void 0:b.newTransform}}if(!y||!C)return;const T={unitId:e,subUnitId:r,drawingId:h,transform:C,sheetTransform:y};a.push(T)}),a.length===0&&g.length===0)return{redos:[],undos:[]};if(a.length>0){const h=this._sheetDrawingService.getBatchUpdateOp(a),{undo:f,redo:w,objects:S}=h;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:w,objects:S,type:p.DrawingApplyType.UPDATE}}),m.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:f,objects:S,type:p.DrawingApplyType.UPDATE}})}if(g.length>0){const h=this._sheetDrawingService.getBatchRemoveOp(g),f=h.undo,w=h.redo,S=h.objects;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:w,objects:S,type:p.DrawingApplyType.REMOVE}}),m.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:f,objects:S,type:p.DrawingApplyType.INSERT}})}return d.push({id:x.id,params:[e]}),m.push({id:x.id,params:[e]}),{redos:d,undos:m}}_moveColInterceptor(i,n){const t=this._getUnitIdAndSubUnitId(i,n);if(t==null)return{redos:[],undos:[]};const{unitId:e,subUnitId:r}=t,{range:o}=i,s=o.startColumn,c=o.endColumn,d=[],m=[],l=this._sheetDrawingService.getDrawingData(e,r),a=[],g=[];if(Object.keys(l).forEach(h=>{const f=l[h],{sheetTransform:w,transform:S,anchorType:D=p.SheetDrawingAnchorType.Position}=f;if(w==null||S==null)return;let y,C;if(n==="insert"){const I=this._expandCol(w,S,s,c,D);y=I==null?void 0:I.newSheetTransform,C=I==null?void 0:I.newTransform}else{const{from:I,to:M}=w,{column:v}=I,{column:O}=M;if(D===p.SheetDrawingAnchorType.Both&&v>=s&&O<=c)g.push({unitId:e,subUnitId:r,drawingId:h});else{const b=this._shrinkCol(w,S,s,c,D);y=b==null?void 0:b.newSheetTransform,C=b==null?void 0:b.newTransform}}if(!y||!C)return;const T={unitId:e,subUnitId:r,drawingId:h,transform:C,sheetTransform:y};a.push(T)}),a.length===0&&g.length===0)return{redos:[],undos:[]};if(a.length>0){const h=this._sheetDrawingService.getBatchUpdateOp(a),{undo:f,redo:w,objects:S}=h;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:w,objects:S,type:p.DrawingApplyType.UPDATE}}),m.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:f,objects:S,type:p.DrawingApplyType.UPDATE}})}if(g.length>0){const h=this._sheetDrawingService.getBatchRemoveOp(g),f=h.undo,w=h.redo,S=h.objects;d.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:w,objects:S,type:p.DrawingApplyType.REMOVE}}),m.push({id:p.SetDrawingApplyMutation.id,params:{unitId:e,subUnitId:r,op:f,objects:S,type:p.DrawingApplyType.INSERT}})}return d.push({id:x.id,params:[e]}),m.push({id:x.id,params:[e]}),{redos:d,undos:m}}_expandCol(i,n,t,e,r=p.SheetDrawingAnchorType.Position){const o=e-t+1,{from:s,to:c}=i,{column:d}=s,{column:m}=c;if(r===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>=t){const g=this._skeletonManagerService.attachRangeWithCoord({startColumn:t,endColumn:e,startRow:s.row,endRow:c.row});if(g==null)return;a={...n,left:(n.left||0)+g.endX-g.startX},l=$(a,this._selectionRenderService)}else if(m>=e)if(r===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,column:m+o}},a=F(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_shrinkCol(i,n,t,e,r=p.SheetDrawingAnchorType.Position){const o=e-t+1,{from:s,to:c}=i,{column:d}=s,{column:m}=c;if(r===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>e)l={from:{...s,column:d-o},to:{...c,column:m-o}},a=F(l,this._selectionRenderService,this._skeletonManagerService);else{if(d>=t&&m<=e)return null;if(d<t&&m>e)if(r===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,column:m-o}},a=F(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};else if(d>=t&&d<=e){if(d===t)a={...n,left:(n.left||0)-i.from.columnOffset};else{const g=this._skeletonManagerService.attachRangeWithCoord({startColumn:t,endColumn:d-1,startRow:s.row,endRow:c.row});if(g==null)return;a={...n,left:(n.left||0)-g.endX+g.startX-i.from.columnOffset}}l=$(a,this._selectionRenderService)}else if(m>=t&&m<=e&&r===p.SheetDrawingAnchorType.Both){const g=this._skeletonManagerService.attachRangeWithCoord({startColumn:t-1,endColumn:t-1,startRow:s.row,endRow:c.row});if(g==null)return;l={from:{...s},to:{...c,column:t-1,columnOffset:g.endX-g.startX}},a=F(l,this._selectionRenderService,this._skeletonManagerService)}}return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_expandRow(i,n,t,e,r=p.SheetDrawingAnchorType.Position){const o=e-t+1,{from:s,to:c}=i,{row:d}=s,{row:m}=c;if(r===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>=t){const g=this._skeletonManagerService.attachRangeWithCoord({startRow:t,endRow:e,startColumn:s.column,endColumn:c.column});if(g==null)return;a={...n,top:(n.top||0)+g.endY-g.startY},l=$(a,this._selectionRenderService)}else if(m>=e)if(r===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,row:m+o}},a=F(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_shrinkRow(i,n,t,e,r=p.SheetDrawingAnchorType.Position){const o=e-t+1,{from:s,to:c}=i,{row:d}=s,{row:m}=c;if(r===p.SheetDrawingAnchorType.None)return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};let l=null,a=null;if(d>e)l={from:{...s,row:d-o},to:{...c,row:m-o}},a=F(l,this._selectionRenderService,this._skeletonManagerService);else{if(d>=t&&m<=e)return null;if(d<t&&m>e)if(r===p.SheetDrawingAnchorType.Both)l={from:{...s},to:{...c,row:m-o}},a=F(l,this._selectionRenderService,this._skeletonManagerService);else return{newSheetTransform:$({...n},this._selectionRenderService),newTransform:n};else if(d>=t&&d<=e){if(d===t)a={...n,top:(n.top||0)-i.from.rowOffset};else{const g=this._skeletonManagerService.attachRangeWithCoord({startRow:t,endRow:d-1,startColumn:s.column,endColumn:c.column});if(g==null)return;a={...n,top:(n.top||0)-g.endY+g.startY-i.from.rowOffset}}l=$(a,this._selectionRenderService)}else if(m>=t&&m<=e&&r===p.SheetDrawingAnchorType.Both){const g=this._skeletonManagerService.attachRangeWithCoord({startColumn:s.column,endColumn:s.column,startRow:t-1,endRow:t-1});if(g==null)return;l={from:{...s},to:{...c,row:t-1,rowOffset:g.endY-g.startY}},a=F(l,this._selectionRenderService,this._skeletonManagerService)}}return l!=null&&a!=null?{newSheetTransform:l,newTransform:a}:null}_commandListener(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{i.id===_.SetWorksheetActiveOperation.id&&setTimeout(()=>{const n=i.params,{unitId:t,subUnitId:e}=n,r=this._drawingManagerService.drawingManagerData,o=[],s=[];Object.keys(r).forEach(c=>{const d=r[c];d!=null&&Object.keys(d).forEach(m=>{const l=d[m].data;l!=null&&Object.keys(l).forEach(a=>{if(c===t&&m===e){const g=l[a];g.transform=F(g.sheetTransform,this._selectionRenderService,this._skeletonManagerService),o.push(l[a])}else s.push(l[a])})})}),this._drawingManagerService.removeNotification(s),this._drawingManagerService.addNotification(o)},0)}))}_sheetRefreshListener(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{tn.includes(i.id)&&requestIdleCallback(()=>{const n=i.params,{unitId:t,subUnitId:e,ranges:r}=n;this._refreshDrawingTransform(t,e,r)})}))}_refreshDrawingTransform(i,n,t){const e=this._drawingManagerService.getDrawingData(i,n),r=[];Object.keys(e).forEach(o=>{const s=e[o],{sheetTransform:c,transform:d,anchorType:m=p.SheetDrawingAnchorType.Position}=s;if(m===p.SheetDrawingAnchorType.None)return!0;const{from:l,to:a}=c,{row:g,column:h}=l,{row:f,column:w}=a;for(let S=0;S<t.length;S++){const D=t[S],{startRow:y,endRow:C,startColumn:T,endColumn:I}=D;if(u.Rectangle.intersects({startRow:y,endRow:C,startColumn:T,endColumn:I},{startRow:g,endRow:f,startColumn:h,endColumn:w})||g>C||h>I){const M=m===p.SheetDrawingAnchorType.Position,v=F(c,this._selectionRenderService,this._skeletonManagerService);r.push({...s,transform:{...v,width:M?d==null?void 0:d.width:v==null?void 0:v.width,height:M?d==null?void 0:d.height:v==null?void 0:v.height}});break}}}),r.length!==0&&(this._drawingManagerService.refreshTransform(r),this._commandService.syncExecuteCommand(x.id,[i]))}};Ne=Qt([J(1,P.IRenderManagerService),J(2,u.ICommandService),J(3,N.ISheetSelectionRenderService),J(4,u.Inject(N.SheetSkeletonManagerService)),J(5,u.Inject(_.SheetInterceptorService)),J(6,p.ISheetDrawingService),J(7,A.IDrawingManagerService),J(8,u.IUniverInstanceService)],Ne);var z=function(){return z=Object.assign||function(i){for(var n,t=1,e=arguments.length;t<e;t++){n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i[r]=n[r])}return i},z.apply(this,arguments)},nn=function(i,n){var t={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&n.indexOf(e)<0&&(t[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)n.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(t[e[r]]=i[e[r]]);return t},Qe=Y.forwardRef(function(i,n){var t=i.icon,e=i.id,r=i.className,o=i.extend,s=nn(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),d=Y.useRef("_".concat(sn()));return et(t,"".concat(e),{defIds:t.defIds,idSuffix:d.current},z({ref:n,className:c},s),o)});function et(i,n,t,e,r){return Y.createElement(i.tag,z(z({key:n},rn(i,t,r)),e),(on(i,t).children||[]).map(function(o,s){return et(o,"".concat(n,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function rn(i,n,t){var e=z({},i.attrs);t!=null&&t.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=t.colorChannel1);var r=n.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+n.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),e}function on(i,n){var t,e=n.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?z(z({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?z(z({},r),{attrs:z(z({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):i}function sn(){return Math.random().toString(36).substring(2,8)}Qe.displayName="UniverIcon";var an={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"}}]},tt=Y.forwardRef(function(i,n){return Y.createElement(Qe,Object.assign({},i,{id:"add-image-single",ref:n,icon:an}))});tt.displayName="AddImageSingle";const $e={id:"sheet.command.delete-drawing",type:u.CommandType.COMMAND,handler:i=>{const n=i.get(u.ICommandService),e=i.get(p.ISheetDrawingService).getFocusDrawings();if(e.length===0)return!1;const r=e[0].unitId,o=e.map(s=>{const{unitId:c,subUnitId:d,drawingId:m,drawingType:l}=s;return{unitId:c,subUnitId:d,drawingId:m,drawingType:l}});return n.executeCommand(ae.id,{unitId:r,drawings:o})}},Me={id:"sheet.command.insert-float-image",type:u.CommandType.COMMAND,handler:i=>{var t,e;return(e=(t=i.get(P.IRenderManagerService).getCurrentTypeOfRenderer(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:t.with(se).insertFloatImage())!=null?e:!1}},Ge={id:"sheet.command.insert-cell-image",type:u.CommandType.COMMAND,handler:i=>{var t,e;return(e=(t=i.get(P.IRenderManagerService).getCurrentTypeOfRenderer(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:t.with(se).insertCellImage())!=null?e:!1}},re={id:"sheet.command.move-drawing",type:u.CommandType.COMMAND,handler:(i,n)=>{const t=i.get(u.ICommandService),e=i.get(p.ISheetDrawingService),r=i.get(N.ISheetSelectionRenderService),{direction:o}=n,s=e.getFocusDrawings();if(s.length===0)return!1;const c=s[0].unitId,d=s.map(l=>{const{transform:a}=l;if(a==null)return null;const g={...a},{left:h=0,top:f=0}=a;return o===u.Direction.UP?g.top=f-1:o===u.Direction.DOWN?g.top=f+1:o===u.Direction.LEFT?g.left=h-1:o===u.Direction.RIGHT&&(g.left=h+1),{...l,transform:g,sheetTransform:$(g,r)}}).filter(l=>l!=null);return t.syncExecuteCommand(de.id,{unitId:c,drawings:d})?(t.syncExecuteCommand(x.id,[c]),!0):!1}},nt="addition-and-subtraction-single",ke="sheet.menu.image";function cn(i){return{id:ke,type:G.MenuItemType.SUBITEMS,icon:nt,tooltip:"sheetImage.title",hidden$:G.getMenuHiddenObservable(i,u.UniverInstanceType.UNIVER_SHEET),disabled$:N.getCurrentRangeDisable$(i,{workbookTypes:[_.WorkbookEditablePermission],worksheetTypes:[_.WorksheetEditPermission],rangeTypes:[_.RangeProtectionPermissionEditPoint]})}}function dn(i){return{id:Me.id,title:"sheetImage.upload.float",type:G.MenuItemType.BUTTON,hidden$:G.getMenuHiddenObservable(i,u.UniverInstanceType.UNIVER_SHEET)}}function ln(i){return{id:Ge.id,title:"sheetImage.upload.cell",type:G.MenuItemType.BUTTON}}const un="univer-image-common-panel",gn="univer-image-common-panel-grid",hn="univer-image-common-panel-border",mn="univer-image-common-panel-title",pn="univer-image-common-panel-subtitle",fn="univer-image-common-panel-row",wn="univer-image-common-panel-row-vertical",Sn="univer-image-common-panel-column",_n="univer-image-common-panel-column-center",vn="univer-image-common-panel-inline",In="univer-image-common-panel-span2",Dn="univer-image-common-panel-span3",Cn="univer-image-common-panel-input",yn="univer-sheet-image-menu",Mn="univer-sheet-image-menu-input",Z={imageCommonPanel:un,imageCommonPanelGrid:gn,imageCommonPanelBorder:hn,imageCommonPanelTitle:mn,imageCommonPanelSubtitle:pn,imageCommonPanelRow:fn,imageCommonPanelRowVertical:wn,imageCommonPanelColumn:Sn,imageCommonPanelColumnCenter:_n,imageCommonPanelInline:vn,imageCommonPanelSpan2:In,imageCommonPanelSpan3:Dn,imageCommonPanelInput:Cn,sheetImageMenu:yn,sheetImageMenuInput:Mn};function rt(i){var n,t,e="";if(typeof i=="string"||typeof i=="number")e+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(n=0;n<r;n++)i[n]&&(t=rt(i[n]))&&(e&&(e+=" "),e+=t)}else for(t in i)i[t]&&(e&&(e+=" "),e+=t);return e}function pe(){for(var i,n,t=0,e="",r=arguments.length;t<r;t++)(i=arguments[t])&&(n=rt(i))&&(e&&(e+=" "),e+=n);return e}const Rn=i=>{var C;const n=u.useDependency(u.ICommandService),t=u.useDependency(u.LocaleService),e=u.useDependency(A.IDrawingManagerService),r=u.useDependency(P.IRenderManagerService),{drawings:o}=i,s=o[0];if(s==null)return;const{unitId:c}=s,d=r.getRenderById(c),m=d==null?void 0:d.scene;if(m==null)return;const l=m.getTransformerByCreate(),[a,g]=Y.useState(!0),h=(C=s.anchorType)!=null?C:p.SheetDrawingAnchorType.Position,[f,w]=Y.useState(h);function S(T,I){const M=[];return T.forEach(v=>{const{oKey:O}=v,b=I.getDrawingOKey(O);if(b==null)return M.push(null),!0;const{unitId:j,subUnitId:U,drawingId:E,drawingType:R,anchorType:W,sheetTransform:B}=b;M.push({unitId:j,subUnitId:U,drawingId:E,anchorType:W,sheetTransform:B,drawingType:R})}),M}Y.useEffect(()=>{const T=l.clearControl$.subscribe(M=>{M===!0&&g(!1)}),I=l.changeStart$.subscribe(M=>{var b;const{objects:v}=M,O=S(v,e);if(O.length===0)g(!1);else if(O.length>=1){g(!0);const j=((b=O[0])==null?void 0:b.anchorType)||p.SheetDrawingAnchorType.Position;w(j)}});return()=>{I.unsubscribe(),T.unsubscribe()}},[]);function D(T){w(T);const I=e.getFocusDrawings();if(I.length===0)return;const M=I.map(v=>({unitId:v.unitId,subUnitId:v.subUnitId,drawingId:v.drawingId,anchorType:T}));n.executeCommand(de.id,{unitId:I[0].unitId,drawings:M})}const y=T=>T?"block":"none";return k.jsxs("div",{className:pe(Z.imageCommonPanelGrid,Z.imageCommonPanelBorder),style:{display:y(a)},children:[k.jsx("div",{className:Z.imageCommonPanelRow,children:k.jsx("div",{className:pe(Z.imageCommonPanelColumn,Z.imageCommonPanelTitle),children:k.jsx("div",{children:t.t("drawing-anchor.title")})})}),k.jsx("div",{className:pe(Z.imageCommonPanelRow),children:k.jsx("div",{className:pe(Z.imageCommonPanelColumn),children:k.jsxs(K.RadioGroup,{value:f,onChange:D,direction:"vertical",children:[k.jsx(K.Radio,{value:p.SheetDrawingAnchorType.Both,children:t.t("drawing-anchor.both")}),k.jsx(K.Radio,{value:p.SheetDrawingAnchorType.Position,children:t.t("drawing-anchor.position")}),k.jsx(K.Radio,{value:p.SheetDrawingAnchorType.None,children:t.t("drawing-anchor.none")})]})})})]})},Tn=()=>{const i=u.useDependency(A.IDrawingManagerService),n=i.getFocusDrawings(),[t,e]=Y.useState(n);return Y.useEffect(()=>{const r=i.focus$.subscribe(o=>{e(o)});return()=>{r.unsubscribe()}},[]),!!(t!=null&&t.length)&&k.jsxs("div",{className:Z.imageCommonPanel,children:[k.jsx(Q.DrawingCommonPanel,{drawings:t}),k.jsx(Rn,{drawings:t})]})},bn={[G.RibbonStartGroup.FORMULAS_INSERT]:{[ke]:{order:3,menuItemFactory:cn,[Me.id]:{order:0,menuItemFactory:dn},[Ge.id]:{order:1,menuItemFactory:ln}}}};function le(i){return!i.getContextValue(u.FOCUSING_FX_BAR_EDITOR)&&!i.getContextValue(u.EDITOR_ACTIVATED)&&!i.getContextValue(u.FOCUSING_PANEL_EDITOR)&&i.getContextValue(u.FOCUSING_COMMON_DRAWINGS)}const En={id:re.id,description:"shortcut.sheet.drawing-move-down",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_DOWN,priority:100,preconditions:le,staticParameters:{direction:u.Direction.DOWN}},On={id:re.id,description:"shortcut.sheet.drawing-move-up",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_UP,priority:100,preconditions:le,staticParameters:{direction:u.Direction.UP}},An={id:re.id,description:"shortcut.sheet.drawing-move-left",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_LEFT,priority:100,preconditions:le,staticParameters:{direction:u.Direction.LEFT}},Pn={id:re.id,description:"shortcut.sheet.drawing-move-right",group:"4_sheet-drawing-view",binding:G.KeyCode.ARROW_RIGHT,priority:100,preconditions:le,staticParameters:{direction:u.Direction.RIGHT}},Un={id:$e.id,description:"shortcut.sheet.drawing-delete",group:"4_sheet-drawing-view",preconditions:le,binding:G.KeyCode.DELETE,mac:G.KeyCode.BACKSPACE};var Nn=Object.defineProperty,jn=Object.getOwnPropertyDescriptor,Wn=(i,n,t,e)=>{for(var r=e>1?void 0:e?jn(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Nn(n,t,r),r},fe=(i,n)=>(t,e)=>n(t,e,i);let ye=class extends u.Disposable{constructor(i,n,t,e){super(),this._componentManager=i,this._menuManagerService=n,this._commandService=t,this._shortcutService=e,this._init()}_initCustomComponents(){const i=this._componentManager;this.disposeWithMe(i.register(nt,tt)),this.disposeWithMe(i.register(Je,Tn))}_initMenus(){this._menuManagerService.mergeMenu(bn)}_initCommands(){[Me,Ge,ce,ae,de,je,x,We,Le,Be,re,$e,xe].forEach(i=>this.disposeWithMe(this._commandService.registerCommand(i)))}_initShortcuts(){[En,On,An,Pn,Un].forEach(i=>{this.disposeWithMe(this._shortcutService.registerShortcut(i))})}_init(){this._initCommands(),this._initCustomComponents(),this._initMenus(),this._initShortcuts()}};ye=Wn([fe(0,u.Inject(G.ComponentManager)),fe(1,G.IMenuManagerService),fe(2,u.ICommandService),fe(3,G.IShortcutService)],ye);var Ln=Object.defineProperty,xn=Object.getOwnPropertyDescriptor,Bn=(i,n,t,e)=>{for(var r=e>1?void 0:e?xn(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&Ln(n,t,r),r},ne=(i,n)=>(t,e)=>n(t,e,i);function $n(i,n,t,e){const{scaleX:r,scaleY:o}=n.getAncestorScale(),s=n.getViewport(P.SHEET_VIEWPORT_KEY.VIEW_MAIN),c={left:!0,top:!0};if(!s)return{...i,absolute:c};const{left:d,right:m,top:l,bottom:a}=i,g=e.getFreeze(),{startColumn:h,startRow:f,xSplit:w,ySplit:S}=g,D=t.getNoMergeCellPositionByIndexWithNoHeader(f-S,h-w),y=t.getNoMergeCellPositionByIndexWithNoHeader(f,h),{rowHeaderWidth:C,columnHeaderHeight:T}=t,I=y.startX-D.startX,M=y.startY-D.startY,{top:v,left:O,viewportScrollX:b,viewportScrollY:j}=s;let U,E;d<O?(c.left=!0,U=(I+C+(d-O))*r,E=Math.max(Math.min((I+C+(m-O))*r,(I+C)*r),(m-b)*r)):(c.left=!1,U=Math.max((d-b)*r,(I+C)*r),E=Math.max((m-b)*r,(I+C)*r));let R,W;return l<v?(c.top=!0,R=(M+T+(l-v))*o,W=Math.max(Math.min((M+T+(m-v))*o,(M+T)*o),(a-j)*o)):(c.top=!1,R=Math.max((l-j)*o,(M+T)*o),W=Math.max((a-j)*o,(M+T)*o)),{left:U,right:E,top:R,bottom:W,absolute:c}}const Oe=(i,n,t,e)=>{const{scene:r}=n,{left:o,top:s,width:c,height:d,angle:m}=i,l={left:o,right:o+c,top:s,bottom:s+d},a=$n(l,r,t,e),{scaleX:g,scaleY:h}=r.getAncestorScale();return{startX:a.left,endX:a.right,startY:a.top,endY:a.bottom,rotate:m,width:c*g,height:d*h,absolute:a.absolute}};exports.SheetCanvasFloatDomManagerService=class extends u.Disposable{constructor(t,e,r,o,s,c,d){super();H(this,"_domLayerMap",new Map);H(this,"_domLayerInfoMap",new Map);H(this,"_transformChange$",new L.Subject);H(this,"transformChange$",this._transformChange$.asObservable());H(this,"_add$",new L.Subject);H(this,"add$",this._add$.asObservable());H(this,"_remove$",new L.Subject);H(this,"remove$",this._remove$.asObservable());H(this,"_hooks",[]);this._renderManagerService=t,this._univerInstanceService=e,this._commandService=r,this._drawingManagerService=o,this._canvasFloatDomService=s,this._sheetDrawingService=c,this._lifecycleService=d,this._drawingAddListener(),this._featureUpdateListener(),this._deleteListener(),this._bindScrollEvent()}_bindScrollEvent(){this._lifecycleService.lifecycle$.pipe(L.filter(t=>t===u.LifecycleStages.Rendered),L.take(1)).subscribe(()=>{this._scrollUpdateListener()})}_ensureMap(t,e){let r=this._domLayerMap.get(t);r||(r=new Map,this._domLayerMap.set(t,r));let o=r.get(e);return o||(o=new Map,r.set(e,o)),o}getFloatDomInfo(t){return this._domLayerInfoMap.get(t)}_getSceneAndTransformerByDrawingSearch(t){if(t==null)return;const e=this._renderManagerService.getRenderById(t),r=e==null?void 0:e.scene;if(e==null||r==null)return null;const o=r.getTransformerByCreate(),s=e.engine.getCanvasElement();return{scene:r,transformer:o,renderObject:e,canvas:s}}_getFloatDomProps(t){let e;return this._hooks.forEach(r=>{e=r.onGetFloatDomProps(t)}),e}_drawingAddListener(){this.disposeWithMe(this._drawingManagerService.add$.subscribe(t=>{t.forEach(e=>{var He,Ve,Ye;const{unitId:r,subUnitId:o,drawingId:s}=e,c=_.getSheetCommandTarget(this._univerInstanceService,{unitId:r,subUnitId:o}),d=this._drawingManagerService.getDrawingByParam(e),m=this._univerInstanceService.getUnit(r,u.UniverInstanceType.UNIVER_SHEET);if(!m)return;const l=m.getActiveSheet().getSheetId();if(!d||!c)return;const a=(He=this._renderManagerService.getRenderById(r))==null?void 0:He.with(N.SheetSkeletonManagerService).getWorksheetSkeleton(o);if(!a)return;const{transform:g,drawingType:h,data:f}=d;if(h!==u.DrawingTypeEnum.DRAWING_DOM&&h!==u.DrawingTypeEnum.DRAWING_CHART)return;const w=this._getSceneAndTransformerByDrawingSearch(r);if(w==null)return;const{scene:S,canvas:D}=w;if(g==null)return!0;if(l!==o)return;const{left:y,top:C,width:T,height:I,angle:M,flipX:v,flipY:O,skewX:b,skewY:j}=g,U=A.getDrawingShapeKeyByDrawingSearch({unitId:r,subUnitId:o,drawingId:s}),E=S.getObject(U);if(E!=null){E.transformByState({left:y,top:C,width:T,height:I,angle:M,flipX:v,flipY:O,skewX:b,skewY:j});return}const R={left:y,top:C,width:T,height:I,zIndex:this._drawingManagerService.getDrawingOrder(r,o).length-1},W=h===u.DrawingTypeEnum.DRAWING_CHART;W&&(R.fill="white",R.rotateEnabled=!1,f&&f.border&&(R.stroke=f.border),R.paintFirst="stroke",R.strokeWidth=1,R.borderEnabled=!1,R.radius=8);const B=new P.Rect(U,R);W&&B.setObjectType(P.ObjectType.CHART),S.addObject(B,P.DRAWING_OBJECT_LAYER_INDEX),d.allowTransform!==!1&&S.attachTransformerTo(B);const q=this._ensureMap(r,o),Re=new u.DisposableCollection,st=Oe(B,w.renderObject,a.skeleton,c.worksheet),Te=new L.BehaviorSubject(st),at={dispose:Re,rect:B,position$:Te,unitId:r,subUnitId:o};this._canvasFloatDomService.addFloatDom({position$:Te,id:s,componentKey:d.componentKey,onPointerDown:V=>{D.dispatchEvent(new PointerEvent(V.type,V))},onPointerMove:V=>{D.dispatchEvent(new PointerEvent(V.type,V))},onPointerUp:V=>{D.dispatchEvent(new PointerEvent(V.type,V))},onWheel:V=>{D.dispatchEvent(new WheelEvent(V.type,V))},props:(Ye=(Ve=q.get(s))==null?void 0:Ve.props)!=null?Ye:this._getFloatDomProps(s),data:f,unitId:r});const Fe=B.onTransformChange$.subscribeEvent(()=>{const V=Oe(B,w.renderObject,a.skeleton,c.worksheet);Te.next(V)});Re.add(()=>{this._canvasFloatDomService.removeFloatDom(s)}),Fe&&Re.add(Fe),this._domLayerInfoMap.set(s,at),q.set(s,{...q.get(s)})})})),this.disposeWithMe(this._drawingManagerService.remove$.subscribe(t=>{t.forEach(e=>{const{unitId:r,subUnitId:o,drawingId:s}=e,c=A.getDrawingShapeKeyByDrawingSearch({unitId:r,subUnitId:o,drawingId:s}),d=this._getSceneAndTransformerByDrawingSearch(r);if(d==null)return;const{transformer:m,scene:l}=d,a=l.getObject(c);a!=null&&a.oKey&&m.clearControlByIds([a==null?void 0:a.oKey])})}))}_scrollUpdateListener(){const t=(e,r)=>{var l;const o=this._getSceneAndTransformerByDrawingSearch(e),s=this._ensureMap(e,r),c=Array.from(s.keys()),d=_.getSheetCommandTarget(this._univerInstanceService,{unitId:e,subUnitId:r}),m=(l=this._renderManagerService.getRenderById(e))==null?void 0:l.with(N.SheetSkeletonManagerService).getWorksheetSkeleton(r);!o||!d||!m||c.forEach(a=>{const g=this._domLayerInfoMap.get(a);if(g){const h=Oe(g.rect,o.renderObject,m.skeleton,d.worksheet);g.position$.next(h)}})};this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET).pipe(L.filter(e=>!!e),L.switchMap(e=>e.activeSheet$),L.filter(e=>!!e),L.map(e=>{const r=this._renderManagerService.getRenderById(e.getUnitId());return r?{render:r,unitId:e.getUnitId(),subUnitId:e.getSheetId()}:null}),L.filter(e=>!!e),L.switchMap(e=>u.fromEventSubject(e.render.scene.getViewport(P.SHEET_VIEWPORT_KEY.VIEW_MAIN).onScrollAfter$).pipe(L.map(()=>({unitId:e.unitId,subUnitId:e.subUnitId}))))).subscribe(({unitId:e,subUnitId:r})=>{t(e,r)})),this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var r,o;if(e.id===N.SetZoomRatioOperation.id){const s=e.params,{unitId:c}=s;Array.from((o=(r=this._domLayerMap.get(c))==null?void 0:r.keys())!=null?o:[]).forEach(m=>{t(c,m)})}else if(e.id===_.SetFrozenMutation.id){const{unitId:s,subUnitId:c}=e.params;t(s,c)}}))}_getPosition(t,e){var h;const{startX:r,endX:o,startY:s,endY:c}=t,d=(h=this._renderManagerService.getRenderById(e))==null?void 0:h.with(N.ISheetSelectionRenderService);if(d==null)return;const m=d.getCellWithCoordByOffset(r,s);if(m==null)return;const l={column:m.actualColumn,columnOffset:r-m.startX,row:m.actualRow,rowOffset:s-m.startY},a=d.getCellWithCoordByOffset(o,c);if(a==null)return;const g={column:a.actualColumn,columnOffset:o-a.startX,row:a.actualRow,rowOffset:c-a.startY};return{from:l,to:g}}_featureUpdateListener(){this.disposeWithMe(this._drawingManagerService.update$.subscribe(t=>{t.forEach(e=>{const r=this._drawingManagerService.getDrawingByParam(e);if(!r||r.drawingType!==u.DrawingTypeEnum.DRAWING_DOM&&r.drawingType!==u.DrawingTypeEnum.DRAWING_CHART)return;const o={...r.transform};this._transformChange$.next({id:e.drawingId,value:o})})}))}_deleteListener(){this.disposeWithMe(this._drawingManagerService.remove$.subscribe(t=>{t.forEach(e=>{this._removeDom(e.drawingId)})}))}updateFloatDomProps(t,e,r,o){const s=this._domLayerInfoMap.get(r),c=this._getSceneAndTransformerByDrawingSearch(t);if(s&&c){const{scene:d}=c,m=A.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:e,drawingId:r}),l=d.getObject(m);l&&l instanceof P.Rect&&l.setProps(o)}}addFloatDomToPosition(t,e){const r=_.getSheetCommandTarget(this._univerInstanceService,{unitId:t.unitId,subUnitId:t.subUnitId});if(!r)throw new Error("cannot find current target!");const{unitId:o,subUnitId:s}=r,{initPosition:c,componentKey:d,data:m,allowTransform:l=!0}=t,a=e!=null?e:u.generateRandomId(),g=this._getPosition(c,o);if(g==null)return;this._ensureMap(o,s).set(a,t);const f={unitId:o,subUnitId:s,drawingId:a,drawingType:t.type||u.DrawingTypeEnum.DRAWING_DOM,componentKey:d,sheetTransform:g,transform:{left:c.startX,top:c.startY,width:c.endX-c.startX,height:c.endY-c.startY},data:m,allowTransform:l};return this._commandService.executeCommand(ce.id,{unitId:o,drawings:[f]}),this._add$.next({unitId:o,subUnitId:s,id:a}),{id:a,dispose:()=>{this._removeDom(a,!0)}}}_removeDom(t,e=!1){const r=this._domLayerInfoMap.get(t);if(!r)return;const{unitId:o,subUnitId:s}=r;this._domLayerInfoMap.delete(t),r.dispose.dispose();const c=this._getSceneAndTransformerByDrawingSearch(o);if(c&&c.scene.removeObject(r.rect),e){this._ensureMap(o,s).delete(t);const m=this._drawingManagerService.getDrawingByParam({unitId:o,subUnitId:s,drawingId:t});if(!m)return;const l=this._sheetDrawingService.getBatchRemoveOp([m]),{redo:a,objects:g}=l;this._commandService.syncExecuteCommand(p.SetDrawingApplyMutation.id,{unitId:o,subUnitId:s,op:a,objects:g,type:p.DrawingApplyType.REMOVE})}}addHook(t){return this._hooks.push(t),{dispose:()=>{const e=this._hooks.findIndex(r=>r===t);this._hooks.splice(e,1)}}}};exports.SheetCanvasFloatDomManagerService=Bn([ne(0,u.Inject(P.IRenderManagerService)),ne(1,u.IUniverInstanceService),ne(2,u.Inject(u.ICommandService)),ne(3,A.IDrawingManagerService),ne(4,u.Inject(G.CanvasFloatDomService)),ne(5,p.ISheetDrawingService),ne(6,u.Inject(u.LifecycleService))],exports.SheetCanvasFloatDomManagerService);var it=Object.defineProperty,Gn=Object.getOwnPropertyDescriptor,kn=(i,n,t)=>n in i?it(i,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[n]=t,Fn=(i,n,t,e)=>{for(var r=e>1?void 0:e?Gn(n,t):n,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(n,t,r):s(r))||r);return e&&r&&it(n,t,r),r},Ae=(i,n)=>(t,e)=>n(t,e,i),ot=(i,n,t)=>kn(i,typeof n!="symbol"?n+"":n,t);const Hn="SHEET_IMAGE_UI_PLUGIN";exports.UniverSheetsDrawingUIPlugin=class extends u.Plugin{constructor(n=gt,t,e,r){super(),this._config=n,this._injector=t,this._renderManagerService=e,this._configService=r;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(ut,s)}onStarting(){u.registerDependencies(this._injector,[[exports.SheetCanvasFloatDomManagerService],[ye],[we],[Ce],[De],[Ie],[Se],[ve],[_e]]),u.touchDependencies(this._injector,[[exports.SheetCanvasFloatDomManagerService]])}onReady(){u.touchDependencies(this._injector,[[Ie]])}onRendered(){this._registerRenderModules(),u.touchDependencies(this._injector,[[De],[Ce],[ye],[Se],[ve],[_e]])}onSteady(){this._injector.get(we)}_registerRenderModules(){[[se],[Ne],[Pe]].forEach(n=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(u.UniverInstanceType.UNIVER_SHEET,n))})}};ot(exports.UniverSheetsDrawingUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);ot(exports.UniverSheetsDrawingUIPlugin,"pluginName",Hn);exports.UniverSheetsDrawingUIPlugin=Fn([u.DependentOn(A.UniverDrawingPlugin,Q.UniverDrawingUIPlugin,p.UniverSheetsDrawingPlugin),Ae(1,u.Inject(u.Injector)),Ae(2,P.IRenderManagerService),Ae(3,u.IConfigService)],exports.UniverSheetsDrawingUIPlugin);exports.ClearSheetDrawingTransformerOperation=x;exports.DeleteDrawingsCommand=$e;exports.EditSheetDrawingOperation=We;exports.GroupSheetDrawingCommand=Le;exports.InsertFloatImageCommand=Me;exports.InsertSheetDrawingCommand=ce;exports.MoveDrawingsCommand=re;exports.RemoveSheetDrawingCommand=ae;exports.SHEETS_IMAGE_MENU_ID=ke;exports.SetDrawingArrangeCommand=xe;exports.SetSheetDrawingCommand=de;exports.SidebarSheetDrawingOperation=je;exports.UngroupSheetDrawingCommand=Be;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={sheetImage:{title:"Image",upload:{float:"Image flottante",cell:"Image de cellule"},panel:{title:"Modifier l'image"}},"image-popup":{replace:"Remplacer",delete:"Supprimer",edit:"Éditer",crop:"Rogner",reset:"Réinitialiser la taille"},"drawing-anchor":{title:"Propriétés de l'ancre",both:"Déplacer et redimensionner avec les cellules",position:"Déplacer mais ne pas redimensionner avec les cellules",none:"Ne pas déplacer ni redimensionner avec les cellules"},"update-status":{exceedMaxSize:"La taille de l'image dépasse la limite, la limite est de {0}M",invalidImageType:"Type d'image invalide",exceedMaxCount:"Seulement {0} images peuvent être téléchargées à la fois",invalidImage:"Image invalide"},"sheet-drawing-view":"Dessin",shortcut:{sheet:{"drawing-move-down":"Déplacer le dessin vers le bas","drawing-move-up":"Déplacer le dessin vers le haut","drawing-move-left":"Déplacer le dessin vers la gauche","drawing-move-right":"Déplacer le dessin vers la droite","drawing-delete":"Supprimer le dessin"}}};module.exports=e;
|