@univerjs/preset-docs-drawing 0.15.3 → 0.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/locales/sk-SK.js +1 -0
- package/lib/es/locales/sk-SK.js +10 -0
- package/lib/locales/sk-SK.js +10 -0
- package/lib/types/locales/sk-SK.d.ts +4 -0
- package/lib/umd/index.js +1 -1
- package/lib/umd/locales/sk-SK.js +10 -0
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("@univerjs/core"),r=require("@univerjs/docs-drawing-ui/locale/sk-SK"),s=require("@univerjs/drawing-ui/locale/sk-SK"),i=e.mergeLocales(r,s);module.exports=i;
|
package/lib/umd/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @univerjs/drawing-ui/index
|
|
2
|
-
(function(y,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing","@univerjs/engine-render","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs"],h):(y=typeof globalThis<"u"?globalThis:y||self,h(y.UniverDrawingUi={},y.UniverCore,y.UniverDrawing,y.UniverEngineRender,y.UniverUi,y.React,y.UniverDesign,y.React,y.rxjs))})(this,(function(y,h,M,b,x,f,B,C,Ee){"use strict";var Et=Object.defineProperty;var Tt=(y,h,M)=>h in y?Et(y,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):y[h]=M;var Q=(y,h,M)=>Tt(y,typeof h!="symbol"?h+"":h,M);var Oe;var R=(s=>(s.default="0",s.left="1",s.center="2",s.right="3",s.top="4",s.middle="5",s.bottom="6",s.horizon="7",s.vertical="8",s))(R||{});const he={id:"sheet.operation.set-image-align",type:h.CommandType.OPERATION,handler:(s,r)=>!0},fe={id:"sheet.operation.open-image-crop",type:h.CommandType.OPERATION,handler:(s,r)=>!0},ee={id:"sheet.operation.close-image-crop",type:h.CommandType.OPERATION,handler:(s,r)=>!0};var L=(s=>(s.FREE="0",s.R1_1="1",s.R16_9="2",s.R9_16="3",s.R5_4="4",s.R4_5="5",s.R4_3="6",s.R3_4="7",s.R3_2="8",s.R2_3="9",s))(L||{});const oe={id:"sheet.operation.Auto-image-crop",type:h.CommandType.OPERATION,handler:(s,r)=>!0},be={id:"sheet.operation.image-reset-size",type:h.CommandType.OPERATION,handler:(s,r)=>!0};function De(s,r,e,t){const n=t.getDrawingByParam(s);if(n==null)return;const i=M.getDrawingShapeKeyByDrawingSearch(s),a=e.getObject(i);if(a&&!(a instanceof b.Group))return;if(a!=null){a.addObject(r);return}const o=new b.Group(i);e.addObject(o,b.DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(o),o.addObject(r);const{transform:c}=n;c&&o.transformByState({left:c.left,top:c.top,angle:c.angle})}function Me(s,r){var i;const e=r?s.getUnit(r):s.getFocusedUnit();if(e==null)return;const t=e.getUnitId();let n;return e.type===h.UniverInstanceType.UNIVER_SHEET?n=(i=e.getActiveSheet())==null?void 0:i.getSheetId():(e.type===h.UniverInstanceType.UNIVER_DOC||e.type===h.UniverInstanceType.UNIVER_SLIDE)&&(n=t),{unitId:t,subUnitId:n,current:e}}const Ze="drawing-ui.config",Te={},Pe="COMPONENT_IMAGE_POPUP_MENU";function F({ref:s,...r}){const{icon:e,id:t,className:n,extend:i,...a}=r,o=`univerjs-icon univerjs-icon-${t} ${n||""}`.trim(),c=C.useRef(`_${Ye()}`);return Ne(e,`${t}`,{defIds:e.defIds,idSuffix:c.current},{ref:s,className:o,...a},i)}function Ne(s,r,e,t,n){return C.createElement(s.tag,{key:r,...Fe(s,e,n),...t},(ze(s,e).children||[]).map((i,a)=>Ne(i,`${r}-${s.tag}-${a}`,e,void 0,n)))}function Fe(s,r,e){const t={...s.attrs};e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1),s.tag==="mask"&&t.id&&(t.id=t.id+r.idSuffix),Object.entries(t).forEach(([i,a])=>{i==="mask"&&typeof a=="string"&&(t[i]=a.replace(/url\(#(.*)\)/,`url(#$1${r.idSuffix})`))});const{defIds:n}=r;return!n||n.length===0||(s.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+r.idSuffix),Object.entries(t).forEach(([i,a])=>{typeof a=="string"&&(t[i]=a.replace(/url\(#(.*)\)/,`url(#$1${r.idSuffix})`))})),t}function ze(s,r){var t;const{defIds:e}=r;return!e||e.length===0?s:s.tag==="defs"&&((t=s.children)!=null&&t.length)?{...s,children:s.children.map(n=>typeof n.attrs.id=="string"&&e&&e.includes(n.attrs.id)?{...n,attrs:{...n.attrs,id:n.attrs.id+r.idSuffix}}:n)}:s}function Ye(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";const Xe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334C15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334C2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045ZM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334C3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999C15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999C2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544ZM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999C3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421C6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641C9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421C11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946C8.64077 14.6502 8.70566 14.6923 8.77482 14.7209C8.84557 14.7502 8.92314 14.7664 9.00449 14.7664C9.08585 14.7664 9.16342 14.7502 9.23416 14.7209C9.30332 14.6923 9.36821 14.6502 9.42482 14.5946"}}]},Ue=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"bottom-icon",ref:e,icon:Xe}))});Ue.displayName="BottomIcon";const qe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.97705 7.51296C5.97705 7.18159 6.24568 6.91296 6.57705 6.91296H8.48632C8.81769 6.91296 9.08632 7.18159 9.08632 7.51296C9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103C5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103C11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.51074 2.37063C3.51074 1.48697 4.22709 0.77063 5.11074 0.77063H9.80318L9.81294 0.770708C9.97168 0.768161 10.1311 0.82824 10.2511 0.95055L14.4317 5.21408C14.5165 5.30049 14.5697 5.406 14.5917 5.51645C14.6041 5.5644 14.6106 5.61467 14.6106 5.66648V11.6406C14.6106 12.5243 13.8943 13.2406 13.0106 13.2406H5.11074C4.22709 13.2406 3.51074 12.5243 3.51074 11.6406V2.37063ZM10.4032 4.66648V2.81964L12.6063 5.06648H10.8032C10.5823 5.06648 10.4032 4.88739 10.4032 4.66648ZM5.11074 1.97063C4.88983 1.97063 4.71074 2.14972 4.71074 2.37063V11.6406C4.71074 11.8615 4.88983 12.0406 5.11074 12.0406H13.0106C13.2316 12.0406 13.4106 11.8615 13.4106 11.6406V6.26648H10.8032C9.91953 6.26648 9.20318 5.55013 9.20318 4.66648V1.97063H5.11074Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.58916 6.6741C2.58916 6.34273 2.32053 6.0741 1.98916 6.0741C1.65779 6.0741 1.38916 6.34273 1.38916 6.6741V12.6294C1.38916 14.0653 2.55322 15.2294 3.98916 15.2294H9.41408C9.74545 15.2294 10.0141 14.9607 10.0141 14.6294C10.0141 14.298 9.74545 14.0294 9.41408 14.0294H3.98916C3.21596 14.0294 2.58916 13.4026 2.58916 12.6294V6.6741Z"}}]},Be=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"create-copy-icon",ref:e,icon:qe}))});Be.displayName="CreateCopyIcon";const Je={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.38125 1.16211C6.49759 1.16211 5.78125 1.87845 5.78125 2.76211V5.6377H2.87783C1.99418 5.6377 1.27783 6.35404 1.27783 7.2377V13.2377C1.27783 14.1214 1.99418 14.8377 2.87783 14.8377H8.87783C9.76149 14.8377 10.4778 14.1214 10.4778 13.2377V10.3621H13.3813C14.2649 10.3621 14.9813 9.64577 14.9813 8.76211V2.76211C14.9813 1.87845 14.2649 1.16211 13.3813 1.16211H7.38125ZM10.4778 9.16211H13.3813C13.6022 9.16211 13.7812 8.98302 13.7812 8.76211V2.76211C13.7812 2.5412 13.6022 2.36211 13.3813 2.36211H7.38125C7.16034 2.36211 6.98125 2.5412 6.98125 2.76211V5.6377H8.87783C9.76149 5.6377 10.4778 6.35404 10.4778 7.2377V9.16211ZM6.98125 6.8377H8.87783C9.09875 6.8377 9.27783 7.01678 9.27783 7.2377V9.16211H7.38125C7.16034 9.16211 6.98125 8.98302 6.98125 8.76211V6.8377ZM5.78125 6.8377V8.76211C5.78125 9.64577 6.49759 10.3621 7.38125 10.3621H9.27783V13.2377C9.27783 13.4586 9.09875 13.6377 8.87783 13.6377H2.87783C2.65692 13.6377 2.47783 13.4586 2.47783 13.2377V7.2377C2.47783 7.01678 2.65692 6.8377 2.87783 6.8377H5.78125Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Re=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"group-icon",ref:e,icon:Je}))});Re.displayName="GroupIcon";const Qe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},je=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"more-down-icon",ref:e,icon:Qe}))});je.displayName="MoreDownIcon";const et={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z"}}]},Ae=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"move-down-icon",ref:e,icon:et}))});Ae.displayName="MoveDownIcon";const tt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z"}}]},Le=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"move-up-icon",ref:e,icon:tt}))});Le.displayName="MoveUpIcon";const rt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9C15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9ZM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9C2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9C13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665C15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665ZM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665C2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665C13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543Z",fillRule:"evenodd",clipRule:"evenodd"}}]},xe=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"topmost-icon",ref:e,icon:rt}))});xe.displayName="TopmostIcon";const nt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.46855 2.83731C7.46855 2.61639 7.64764 2.4373 7.86855 2.4373H13.8603C14.0812 2.4373 14.2603 2.61639 14.2603 2.8373V9.5049C14.2603 9.72581 14.0812 9.90489 13.8603 9.90489H12.866C12.5346 9.90489 12.266 10.1735 12.266 10.5049C12.266 10.8363 12.5346 11.1049 12.866 11.1049H13.8603C14.7439 11.1049 15.4603 10.3886 15.4603 9.5049V2.8373C15.4603 1.95365 14.7439 1.2373 13.8603 1.2373H7.86855C6.9849 1.2373 6.26855 1.95365 6.26855 2.83731V3.48688C6.26855 3.81825 6.53718 4.08688 6.86855 4.08688C7.19993 4.08688 7.46855 3.81825 7.46855 3.48688V2.83731Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.19888 5.56299C2.31522 5.56299 1.59888 6.27933 1.59888 7.16299V13.163C1.59888 14.0466 2.31522 14.763 3.19888 14.763H9.19888C10.0825 14.763 10.7989 14.0466 10.7989 13.163V7.16299C10.7989 6.27933 10.0825 5.56299 9.19888 5.56299H3.19888ZM2.79888 7.16299C2.79888 6.94207 2.97796 6.76299 3.19888 6.76299H9.19888C9.41979 6.76299 9.59888 6.94207 9.59888 7.16299V13.163C9.59888 13.3839 9.41979 13.563 9.19888 13.563H3.19888C2.97796 13.563 2.79888 13.3839 2.79888 13.163V7.16299Z",fillRule:"evenodd",clipRule:"evenodd"}}]},He=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"ungroup-icon",ref:e,icon:nt}))});He.displayName="UngroupIcon";const it={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365ZM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365ZM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635ZM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ke=C.forwardRef(function(r,e){return C.createElement(F,Object.assign({},r,{id:"autofill-double-icon",ref:e,icon:it}))});ke.displayName="AutofillDoubleIcon";function Ge(s){var m;const{popup:r}=s,e=(m=r==null?void 0:r.extraProps)==null?void 0:m.menuItems;if(!e)return null;const t=x.useDependency(h.ICommandService),n=x.useDependency(h.LocaleService),[i,a]=C.useState(!1),[o,c]=C.useState(!1),u=()=>{c(!0)},l=()=>{c(!1)},g=v=>{a(v)},d=v=>{t.executeCommand(v.commandId,v.commandParams),a(!1)},p=i||o,S=e.filter(v=>!v.disable);return f.jsx("div",{onMouseEnter:u,onMouseLeave:l,children:f.jsx(B.DropdownMenu,{align:"start",items:S.map(v=>({type:"item",children:n.t(v.label),onSelect:()=>d(v)})),open:i,onOpenChange:g,children:f.jsxs("div",{className:B.clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800",B.borderClassName,{"univer-bg-gray-100 dark:!univer-bg-gray-800":i,"univer-bg-white dark:!univer-bg-gray-900":!i}),children:[f.jsx(ke,{className:"univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"}),p&&f.jsx(je,{className:"dark:!univer-text-white"})]})})})}var at=Object.getOwnPropertyDescriptor,st=(s,r,e,t)=>{for(var n=t>1?void 0:t?at(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},$e=(s,r)=>(e,t)=>r(e,t,s);let pe=class extends h.Disposable{constructor(s,r){super(),this._componentManager=s,this._commandService=r,this._init()}_initCustomComponents(){const s=this._componentManager;this.disposeWithMe(s.register(Pe,Ge))}_initCommands(){[fe,ee,be,he,oe].forEach(s=>this.disposeWithMe(this._commandService.registerCommand(s)))}_init(){this._initCommands(),this._initCustomComponents()}};pe=st([$e(0,h.Inject(x.ComponentManager)),$e(1,h.ICommandService)],pe);function ce(s,r){const e=[];return s.forEach(t=>{const{oKey:n,left:i,top:a,height:o,width:c,angle:u}=t,l=r.getDrawingOKey(n);if(l==null)return e.push(null),!0;const{unitId:g,subUnitId:d,drawingId:p,drawingType:S}=l,m={unitId:g,subUnitId:d,drawingId:p,drawingType:S,transform:{left:i,top:a,height:o,width:c,angle:u}};S===h.DrawingTypeEnum.DRAWING_IMAGE&&(m.srcRect=t.srcRect),e.push(m)}),e}var ot=Object.getOwnPropertyDescriptor,ct=(s,r,e,t)=>{for(var n=t>1?void 0:t?ot(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},me=(s,r)=>(e,t)=>r(e,t,s);let ve=class extends h.Disposable{constructor(r,e,t,n){super();Q(this,"_sceneListenerOnDrawingMap",new WeakSet);this._currentUniverService=r,this._commandService=e,this._renderManagerService=t,this._drawingManagerService=n,this._initialize()}dispose(){super.dispose()}_initialize(){this._recoveryImages(),this._drawingAddListener(),this._drawingRemoveListener(),this._drawingUpdateListener(),this._commandExecutedListener(),this._drawingArrangeListener(),this._drawingGroupListener(),this._drawingRefreshListener(),this._drawingVisibleListener()}_recoveryImages(){const r=this._drawingManagerService.drawingManagerData,e=Me(this._currentUniverService);if(e==null)return;const{unitId:t,subUnitId:n}=e;Object.keys(r).forEach(i=>{Object.keys(r[i]).forEach(a=>{const o=r[i][a].data;o==null||i!==t||a!==n||Object.keys(o).forEach(c=>{o[c]&&this._insertDrawing([{unitId:i,subUnitId:a,drawingId:c}])})})})}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{if(r.id===he.id){const e=r.params;if(e==null)return;this._drawingAlign(e)}}))}_drawingGroupListener(){this.disposeWithMe(this._drawingManagerService.group$.subscribe(r=>{this._groupDrawings(r)})),this.disposeWithMe(this._drawingManagerService.ungroup$.subscribe(r=>{this._ungroupDrawings(r)}))}_getSceneAndTransformerByDrawingSearch(r){if(r==null)return;const e=this._renderManagerService.getRenderById(r),t=e==null?void 0:e.scene;if(t==null)return null;const n=t.getTransformerByCreate();return{scene:t,transformer:n}}_groupDrawings(r){r.forEach(e=>{this._groupDrawing(e)})}_groupDrawing(r){const{parent:e,children:t}=r,{unitId:n,subUnitId:i,drawingId:a}=e,o=this._getSceneAndTransformerByDrawingSearch(e.unitId);if(o==null)return;const{scene:c,transformer:u}=o;this._commandService.syncExecuteCommand(ee.id);const l=[];if(t.forEach(p=>{const S=M.getDrawingShapeKeyByDrawingSearch(p),m=c.getObjectIncludeInGroup(S);if(m==null||l.includes(m))return;l.push(m);const{transform:v}=p;v!=null&&(m.classType===b.RENDER_CLASS_TYPE.GROUP?m.transformByState({left:v.left,top:v.top}):m.transformByState(v))}),l.length===0)return;const g=M.getDrawingShapeKeyByDrawingSearch({unitId:n,subUnitId:i,drawingId:a}),d=new b.Group(g);c.addObject(d,b.DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(d),d.addObjects(...l),e.transform&&d.transformByState({left:e.transform.left,top:e.transform.top}),u.clearSelectedObjects(),u.setSelectedControl(d)}_ungroupDrawings(r){r.forEach(e=>{this._ungroupDrawing(e)})}_ungroupDrawing(r){const{parent:e,children:t}=r,n=this._getSceneAndTransformerByDrawingSearch(e.unitId);if(n==null)return;const{scene:i,transformer:a}=n;t.forEach(g=>{const d=M.getDrawingShapeKeyByDrawingSearch(g),p=i.getObjectIncludeInGroup(d);if(p==null)return!0;if(p==null)return;const{transform:S}=g;S!=null&&(p.classType===b.RENDER_CLASS_TYPE.GROUP?p.transformByState({left:S.left,top:S.top}):p.transformByState(S))});const o=M.getDrawingShapeKeyByDrawingSearch(e),c=i.getObject(o),{width:u,height:l}=c;c.getObjects().forEach(g=>{c.removeSelfObjectAndTransform(g.oKey,u,l)}),c.dispose(),a.clearSelectedObjects()}_drawingAlign(r){const{alignType:e}=r,t=this._drawingManagerService.getFocusDrawings();if(e===R.default)return;const n=[];let i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=0;t.forEach(l=>{const{unitId:g,subUnitId:d,drawingId:p,drawingType:S}=l,m=this._drawingManagerService.getDrawingByParam({unitId:g,subUnitId:d,drawingId:p});if(m==null||m.transform==null)return;n.push({unitId:g,subUnitId:d,drawingId:p,drawingType:S,transform:m.transform});const{left:v=0,top:_=0,width:I=0,height:O=0}=m.transform;i=Math.min(i,v),a=Math.min(a,_),o=Math.max(o,v+I),c=Math.max(c,_+O),u++}),u!==0&&(this._sortDrawingTransform(n,e),this._applyAlignType(n,e,i,a,o,c,u))}_applyAlignType(r,e,t,n,i,a,o){const c=Math.round((i-t)/o*10)/10,u=Math.round((a-n)/o*10)/10,l=[],g=this._getSceneAndTransformerByDrawingSearch(r[0].unitId);if(g==null)return;const{scene:d,transformer:p}=g;r.forEach((S,m)=>{const{unitId:v,subUnitId:_,drawingId:I,transform:O,drawingType:N}=S,{left:j=0,top:D=0,width:T=0,height:E=0}=O;let U=j,P=D;switch(e){case R.left:U=t;break;case R.center:U=t+(i-t)/2-T/2;break;case R.right:U=i-T;break;case R.top:P=n;break;case R.middle:P=n+(a-n)/2-E/2;break;case R.bottom:P=a-E;break;case R.horizon:U=t+c*m;break;case R.vertical:P=n+u*m;break}(U!==j||P!==D)&&l.push({unitId:v,subUnitId:_,drawingId:I,drawingType:N,transform:{left:U,top:P}})}),this._drawingManagerService.featurePluginUpdateNotification(l),p.refreshControls().changeNotification()}_sortDrawingTransform(r,e){r.sort((t,n)=>{const i=t.transform,a=n.transform,{left:o=0,top:c=0,width:u=0,height:l=0}=i,{left:g=0,top:d=0,width:p=0,height:S=0}=a;switch(e){case R.left:return o-g;case R.center:return o+u/2-(g+p/2);case R.right:return o+u-(g+p);case R.top:return c-d;case R.middle:return c+l/2-(d+S/2);case R.bottom:return c+l-(d+S);case R.horizon:return o+u/2-(g+p/2);case R.vertical:return c+l/2-(d+S/2);default:return 0}})}_drawingArrangeListener(){this.disposeWithMe(this._drawingManagerService.order$.subscribe(r=>{this._drawingArrange(r)}))}_drawingArrange(r){const{unitId:e,subUnitId:t,drawingIds:n}=r,i=this._getSceneAndTransformerByDrawingSearch(e);if(i==null)return;const{scene:a}=i;n.forEach(o=>{const c=M.getDrawingShapeKeyByDrawingSearch({unitId:e,subUnitId:t,drawingId:o}),u=a.fuzzyMathObjects(c,!0);if(u==null||u.length===0)return;const l=this._drawingManagerService.getDrawingOrder(e,t).indexOf(o);for(const g of u)g.setProps({zIndex:l}),g.makeDirty()})}_drawingAddListener(){this.disposeWithMe(this._drawingManagerService.add$.subscribe(r=>{this._insertDrawing(r)}))}_insertDrawing(r){const e=[];r.forEach(t=>{const{unitId:n}=t;if(this._drawingManagerService.getDrawingByParam(t)==null)return;const a=this._getSceneAndTransformerByDrawingSearch(n);if(a==null)return;const{scene:o}=a;e.includes(o)||e.push(o)}),e.forEach(t=>{this._sceneListenerOnDrawingMap.has(t)||(this._addListenerOnDrawing(t),this._sceneListenerOnDrawingMap.add(t))})}_drawingRemoveListener(){this.disposeWithMe(this._drawingManagerService.remove$.subscribe(r=>{r.forEach(e=>{var l;const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._getSceneAndTransformerByDrawingSearch(t);if(a==null)return;const{scene:o}=a,c=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),u=o.fuzzyMathObjects(c,!0);if(u.length>0){for(const g of u)g.dispose();(l=o.getTransformer())==null||l.clearSelectedObjects()}})}))}_drawingUpdateListener(){this.disposeWithMe(this._drawingManagerService.update$.subscribe(r=>{r.forEach(e=>{var T;const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._drawingManagerService.getDrawingByParam(e);if(a==null)return;const{transform:o,drawingType:c}=a,u=this._getSceneAndTransformerByDrawingSearch(t);if(u==null)return;const{scene:l,transformer:g}=u;if(o==null)return!0;const{left:d=0,top:p=0,width:S=0,height:m=0,angle:v=0,flipX:_=!1,flipY:I=!1,skewX:O=0,skewY:N=0}=o,j=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),D=l.getObject(j);if(D==null)return!0;D.transformByState({left:d,top:p,width:S,height:m,angle:v,flipX:_,flipY:I,skewX:O,skewY:N}),(T=l.getTransformer())==null||T.debounceRefreshControls()})}))}_drawingRefreshListener(){this.disposeWithMe(this._drawingManagerService.refreshTransform$.subscribe(r=>{r.forEach(e=>{const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._getSceneAndTransformerByDrawingSearch(t);if(a==null)return;const o=this._drawingManagerService.getDrawingByParam(e);if(o==null)return;const{transform:c}=o,{scene:u}=a,l=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),g=u.getObject(l);if(g==null||c==null)return!0;const{left:d=0,top:p=0,width:S=0,height:m=0,angle:v=0,flipX:_=!1,flipY:I=!1,skewX:O=0,skewY:N=0}=c;g.transformByState({left:d,top:p,width:S,height:m,angle:v,flipX:_,flipY:I,skewX:O,skewY:N})})}))}_drawingVisibleListener(){this.disposeWithMe(this._drawingManagerService.visible$.subscribe(r=>{r.forEach(e=>{const{unitId:t,subUnitId:n,drawingId:i,visible:a}=e,o=this._getSceneAndTransformerByDrawingSearch(t);if(o==null)return;const{scene:c}=o,u=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),l=c.getObject(u);if(l==null)return!0;a?l.show():l.hide()})}))}_filterUpdateParams(r,e){return r.filter((t,n)=>{if(t==null)return!1;const{transform:i}=t;return h.checkIfMove(i,e==null?void 0:e[n])})}_addListenerOnDrawing(r){const e=r.getTransformerByCreate();let t=null;this.disposeWithMe(h.toDisposable(e.changeStart$.subscribe(n=>{const{objects:i}=n,a=Array.from(i.values()),o=[];t=a.map(c=>{const{left:u,top:l,height:g,width:d,angle:p,oKey:S,isInGroup:m}=c,v=this._drawingManagerService.getDrawingOKey(S);if(m||c instanceof b.Group){let _=c.ancestorGroup;if(_==null&&c instanceof b.Group&&(_=c),_==null)return null;const I=this._drawingManagerService.getDrawingOKey(_.oKey);if(I){const{unitId:O,subUnitId:N,drawingId:j}=I;o.push({unitId:O,subUnitId:N,drawingId:j});const{left:D,top:T,height:E,width:U,angle:P}=_;return{left:D,top:T,height:E,width:U,angle:P}}}else if(v!=null){const{unitId:_,subUnitId:I,drawingId:O}=v;return o.push({unitId:_,subUnitId:I,drawingId:O}),{left:u,top:l,height:g,width:d,angle:p}}return null}).filter(c=>c!=null),o.length>0?this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,o):this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,[])}))),this.disposeWithMe(h.toDisposable(e.changeEnd$.subscribe(n=>{const{objects:i}=n,a=this._filterUpdateParams(ce(i,this._drawingManagerService),t);a.length>0&&this._drawingManagerService.featurePluginUpdateNotification(a)})))}};ve=ct([me(0,h.IUniverInstanceService),me(1,h.ICommandService),me(2,b.IRenderManagerService),me(3,M.IDrawingManagerService)],ve);class le extends b.Shape{constructor(e,t){t==null&&(t={}),t.transformerConfig={keepRatio:!1,isCropper:!0,anchorFill:"rgb(0, 0, 0)",anchorStroke:"rgb(255, 255, 255)",anchorSize:24};super(e,t);Q(this,"_srcRect");Q(this,"_prstGeom");Q(this,"_applyTransform");Q(this,"_dragPadding",8);Q(this,"_cacheCanvas");t!=null&&t.srcRect&&(this._srcRect=t.srcRect),t!=null&&t.prstGeom&&(this._prstGeom=t.prstGeom),t!=null&&t.applyTransform&&(this._applyTransform=t.applyTransform),t!=null&&t.dragPadding&&(this._dragPadding=t.dragPadding),this._applyProps()}refreshSrcRect(e,t){this._srcRect=e,this._applyTransform=t,this._applyProps()}get srcRect(){return this._srcRect}dispose(){var e;super.dispose(),(e=this._cacheCanvas)==null||e.dispose(),this._srcRect=null}isHit(e){const t=this.getInverseCoord(e);return t.x>=-this.strokeWidth/2&&t.x<=this.width+this.strokeWidth/2&&t.y>=-this.strokeWidth/2&&t.y<=this.height+this.strokeWidth/2&&!this._inSurround(t)}_inSurround(e){const t=this._dragPadding;return e.x>=t-this.strokeWidth/2&&e.x<=this.width+this.strokeWidth/2-t&&e.y>=t-this.strokeWidth/2&&e.y<=this.height+this.strokeWidth/2-t}render(e,t){return this.visible?(e.save(),this._draw(e),e.restore(),this.makeDirty(!1),this):(this.makeDirty(!1),this)}_draw(e){var c,u;const n=this.getScene().getEngine(),{width:i,height:a}=n;this._initialCacheCanvas(),(c=this._cacheCanvas)==null||c.clear();const o=(u=this._cacheCanvas)==null?void 0:u.getContext();o!=null&&(o.save(),b.Rect.drawWith(o,{left:0,top:0,width:i,height:a,fill:"rgba(0, 0, 0, 0.5)"}),o.setTransform(e.getTransform()),this._clipForApplyObject(o),this._applyCache(e),o.restore())}_clipForApplyObject(e){let t=0;if(this._prstGeom!=null&&(t=1),e.globalCompositeOperation="destination-out",e.beginPath(),t===0){const n=this.transform.getMatrix();e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),e.rect(0,0,this.width,this.height),e.fill()}}_applyProps(){if(this._applyTransform==null)return;let e=0,t=0,n=0,i=0;const{left:a=0,top:o=0,width:c=0,height:u=0,angle:l}=this._applyTransform;if(this._srcRect!=null){const{left:p=0,top:S=0,right:m=0,bottom:v=0}=this._srcRect;e=p,t=S,n=m,i=v}const g=a+e,d=o+t;this.transformByState({left:g,top:d,width:a+c-n-g,height:o+u-i-d,angle:l})}_applyCache(e){if(!e||this._cacheCanvas==null)return;const t=this._cacheCanvas.getContext();t.save(),e.save(),e.setTransform(1,0,0,1,0,0),t.setTransform(1,0,0,1,0,0),e.drawImage(this._cacheCanvas.getCanvasEle(),0,0),e.restore(),t.restore()}_initialCacheCanvas(){if(this._cacheCanvas!=null)return;const e=this.getScene();if(e==null)return;this._cacheCanvas=new b.Canvas;const t=e.getEngine();this._cacheCanvas.setSize(t.width,t.height),t.onTransformChange$.subscribeEvent(()=>{var n;(n=this._cacheCanvas)==null||n.setSize(t.width,t.height),this.makeDirty(!0)})}}var lt=Object.getOwnPropertyDescriptor,ut=(s,r,e,t)=>{for(var n=t>1?void 0:t?lt(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},ae=(s,r)=>(e,t)=>r(e,t,s);let we=class extends h.Disposable{constructor(r,e,t,n,i,a){super();Q(this,"_sceneListenerOnImageMap",new WeakSet);this._commandService=r,this._drawingManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._messageService=i,this._localeService=a,this._init()}_init(){this._initOpenCrop(),this._initCloseCrop(),this._initAutoCrop()}_initAutoCrop(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{if(r.id!==oe.id)return;const e=r.params;if(e==null)return;const{cropType:t}=e,n=this._drawingManagerService.getFocusDrawings();if(n.length!==1)return;const i=n[0],{unitId:a,subUnitId:o,drawingId:c}=i,u=this._renderManagerService.getRenderById(a),l=u==null?void 0:u.scene;if(l==null)return!0;this._searchCropObject(l)!=null&&this._commandService.syncExecuteCommand(ee.id,{isAuto:!0});const d=M.getDrawingShapeKeyByDrawingSearch({unitId:a,subUnitId:o,drawingId:c}),p=l.getObject(d);if(!(p instanceof b.Image)){this._messageService.show({type:B.MessageType.Error,content:this._localeService.t("image-cropper.error")});return}p!=null&&(this._updateCropperObject(t,p),this._commandService.executeCommand(fe.id,{unitId:a,subUnitId:o,drawingId:c}))}))}_calculateSrcRectByRatio(r,e,t,n,i,a){const o=t/n,c=i/a;let u=t,l=n;o>c?u=n*c:l=t/c;const g=(t-u)/2,d=(n-l)/2;return{left:b.precisionTo(g,1),top:b.precisionTo(d,1),right:b.precisionTo(t-(g+u),1),bottom:b.precisionTo(n-(d+l),1)}}_updateCropperObject(r,e){const{left:t,top:n,width:i,height:a}=e.calculateTransformWithSrcRect();let o;switch(r){case L.R1_1:o=this._calculateSrcRectByRatio(t,n,i,a,1,1);break;case L.R16_9:o=this._calculateSrcRectByRatio(t,n,i,a,16,9);break;case L.R9_16:o=this._calculateSrcRectByRatio(t,n,i,a,9,16);break;case L.R5_4:o=this._calculateSrcRectByRatio(t,n,i,a,5,4);break;case L.R4_5:o=this._calculateSrcRectByRatio(t,n,i,a,4,5);break;case L.R4_3:o=this._calculateSrcRectByRatio(t,n,i,a,4,3);break;case L.R3_4:o=this._calculateSrcRectByRatio(t,n,i,a,3,4);break;case L.R3_2:o=this._calculateSrcRectByRatio(t,n,i,a,3,2);break;case L.R2_3:o=this._calculateSrcRectByRatio(t,n,i,a,2,3);break;case L.FREE:}if(o==null)return;e.setSrcRect(o);const{left:c=0,top:u=0,bottom:l=0,right:g=0}=o;e.transformByStateCloseCropper({left:t+c,top:n+u,width:i-g-c,height:a-l-u})}_initOpenCrop(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{if(r.id!==fe.id)return;const e=r.params;if(e==null)return;const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._renderManagerService.getRenderById(t),o=a==null?void 0:a.scene;if(o==null)return!0;if(this._sceneListenerOnImageMap.has(o)||(this._addListenerOnImage(o),this._sceneListenerOnImageMap.add(o)),this._drawingManagerService.getDrawingByParam({unitId:t,subUnitId:n,drawingId:i})==null)return;const u=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),l=o.getObject(u);if(l==null)return;if(!(l instanceof b.Image)){this._messageService.show({type:B.MessageType.Error,content:this._localeService.t("image-cropper.error")});return}const g=o.getTransformer();g==null||g.clearControls();const d=new le(`${u}-crop`,{srcRect:l.srcRect,prstGeom:l.prstGeom,applyTransform:l.calculateTransformWithSrcRect()});o.addObject(d,l.getLayerIndex()+1).attachTransformerTo(d),g==null||g.createControlForCopper(d),this._addHoverForImageCopper(d),l.openRenderByCropper(),g==null||g.refreshControls(),d.makeDirty(!0),this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,[{unitId:t,subUnitId:n,drawingId:i}])}))}_searchCropObject(r){const e=r.getAllObjectsByOrder();for(const t of e)if(t instanceof le)return t}_initCloseCrop(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id!==ee.id)return;const t=this._univerInstanceService.getFocusedUnit();if(t==null)return;const n=t.getUnitId(),i=this._renderManagerService.getRenderById(n),a=i==null?void 0:i.scene;if(a==null)return!0;const o=this._searchCropObject(a);if(o==null)return;const c=this._getApplyObjectByCropObject(o);if(c==null)return;const u=a.getTransformerByCreate();u.detachFrom(o),u.clearCopperControl();const l=this._getSrcRectByTransformState(c,o),g=this._drawingManagerService.getDrawingOKey(c.oKey);if(g!=null){const{left:d,top:p,height:S,width:m}=o;this._drawingManagerService.featurePluginUpdateNotification([{...g,transform:{...g.transform,left:d,top:p,height:S,width:m},srcRect:l.srcRectAngle}])}c.setSrcRect({...l.srcRectAngle}),c.closeRenderByCropper(),c.makeDirty(!0),o==null||o.dispose()}));const r=this._univerInstanceService.getCurrentTypeOfUnit$(h.UniverInstanceType.UNIVER_SHEET).pipe(Ee.switchMap(e=>e?e.activeSheet$:Ee.of(null)));this.disposeWithMe(r.subscribe(()=>{this._commandService.syncExecuteCommand(ee.id)}))}_getApplyObjectByCropObject(r){const e=r.oKey,t=e.slice(0,e.length-5),n=r.getScene();if(!n)return null;const i=n.getObject(t);return i==null?null:i}_addListenerOnImage(r){const e=r.getTransformerByCreate();let t=null;this.disposeWithMe(e.changeStart$.subscribe(n=>{const{objects:i}=n,a=i.values().next().value;if(a==null||!(a instanceof le))return;const{left:o,top:c,height:u,width:l,angle:g}=a;t={left:o,top:c,height:u,width:l,angle:g},e.clearCopperControl()})),this.disposeWithMe(e.changeEnd$.subscribe(n=>{const{objects:i}=n,a=i.values().next().value;if(a==null||!(a instanceof le))return;const{left:o,top:c,height:u,width:l,angle:g}=a;if(!h.checkIfMove({left:o,top:c,height:u,width:l,angle:g},t))return;const d=this._getApplyObjectByCropObject(a);if(d==null)return;const p=this._getSrcRectByTransformState(d,a);a.refreshSrcRect(p.srcRect,d.getState()),e.createControlForCopper(a)})),this._endCropListener(r)}_addHoverForImageCopper(r){this.disposeWithMe(r.onPointerEnter$.subscribeEvent(()=>{r.cursor=b.CURSOR_TYPE.MOVE})),this.disposeWithMe(r.onPointerLeave$.subscribeEvent(()=>{r.cursor=b.CURSOR_TYPE.DEFAULT}))}_endCropListener(r){const e=r.getTransformerByCreate();this.disposeWithMe(e.clearControl$.subscribe(t=>{t===!0&&this._commandService.syncExecuteCommand(ee.id)}))}_getSrcRectByTransformState(r,e){const{left:t,top:n,height:i,width:a,strokeWidth:o,angle:c}=e,{left:u,top:l,width:g,height:d,angle:p,strokeWidth:S}=r,m=t-u,v=n-l,_={left:m,top:v,right:g-m-a,bottom:d-v-i},I={..._};if(p!==0){const O=t+a/2,N=n+i/2,j=new b.Vector2(O,N),D=g/2+u,T=d/2+l,E=new b.Vector2(D,T),U=new b.Vector2(u,l);U.rotateByPoint(b.degToRad(p),E);const P=U.clone();P.rotateByPoint(b.degToRad(-p),j);const G=t-P.x,H=n-P.y;I.left=G,I.top=H,I.right=g-G-a,I.bottom=d-H-i}return{srcRect:_,srcRectAngle:I}}};we=ut([ae(0,h.ICommandService),ae(1,M.IDrawingManagerService),ae(2,b.IRenderManagerService),ae(3,h.IUniverInstanceService),ae(4,x.IMessageService),ae(5,h.Inject(h.LocaleService))],we);var gt=Object.getOwnPropertyDescriptor,dt=(s,r,e,t)=>{for(var n=t>1?void 0:t?gt(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},Se=(s,r)=>(e,t)=>r(e,t,s);y.DrawingRenderService=class{constructor(r,e,t,n){this._drawingManagerService=r,this._imageIoService=e,this._galleryService=t,this._urlImageService=n}async renderImages(r,e){const{transform:t,drawingType:n,source:i,imageSourceType:a,srcRect:o,prstGeom:c,groupId:u,unitId:l,subUnitId:g,drawingId:d,isMultiTransform:p,transforms:S}=r;if(n!==h.DrawingTypeEnum.DRAWING_IMAGE||!this._drawingManagerService.getDrawingVisible()||t==null)return;const m=p&&S?S:[t],v=[];for(const _ of m){const{left:I,top:O,width:N,height:j,angle:D,flipX:T,flipY:E,skewX:U,skewY:P}=_,G=m.indexOf(_),H=M.getDrawingShapeKeyByDrawingSearch({unitId:l,subUnitId:g,drawingId:d},p?G:void 0),V=e.getObject(H);if(V!=null){V.transformByState({left:I,top:O,width:N,height:j,angle:D,flipX:T,flipY:E,skewX:U,skewY:P});continue}const Y=this._drawingManagerService.getDrawingOrder(l,g),se=Y.indexOf(d),X={..._,zIndex:se===-1?Y.length-1:se},re=this._imageIoService.getImageSourceCache(i,a);let ne=!1;if(re!=null)X.image=re;else if(a===M.ImageSourceType.UUID)try{X.url=await this._imageIoService.getImage(i)}catch(ue){console.error(ue);continue}else if(a===M.ImageSourceType.URL){try{X.url=await this._urlImageService.getImage(i)}catch(ue){console.error(ue),X.url=i}ne=!0}else X.url=i,ne=!0;if(e.getObject(H))continue;X.printable=!0;const q=new b.Image(H,X);ne&&this._imageIoService.addImageSourceCache(i,a,q.getNative()),this._drawingManagerService.getDrawingVisible()&&(e.addObject(q,b.DRAWING_OBJECT_LAYER_INDEX),this._drawingManagerService.getDrawingEditable()&&e.attachTransformerTo(q),u&&De({drawingId:u,unitId:l,subUnitId:g},q,e,this._drawingManagerService),c!=null&&q.setPrstGeom(c),o!=null&&q.setSrcRect(o),v.push(q))}return v}renderFloatDom(r,e){const{transform:t,drawingType:n,groupId:i,unitId:a,subUnitId:o,drawingId:c,isMultiTransform:u,transforms:l}=r;if(n!==h.DrawingTypeEnum.DRAWING_DOM||!this._drawingManagerService.getDrawingVisible()||t==null)return;const g=u&&l?l:[t],d=[];for(const p of g){const{left:S,top:m,width:v,height:_,angle:I,flipX:O,flipY:N,skewX:j,skewY:D}=p,T=g.indexOf(p),E=M.getDrawingShapeKeyByDrawingSearch({unitId:a,subUnitId:o,drawingId:c},u?T:void 0),U=e.getObject(E);if(U!=null){U.transformByState({left:S,top:m,width:v,height:_,angle:I,flipX:O,flipY:N,skewX:j,skewY:D});continue}const P=this._drawingManagerService.getDrawingOrder(a,o),G=P.indexOf(c),H={...p,zIndex:G===-1?P.length-1:G};if(e.getObject(E))continue;H.printable=!1;const V=new b.Rect(E,H);this._drawingManagerService.getDrawingVisible()&&(e.addObject(V,b.DRAWING_OBJECT_LAYER_INDEX),this._drawingManagerService.getDrawingEditable()&&r.allowTransform!==!1&&e.attachTransformerTo(V),i&&De({drawingId:i,unitId:a,subUnitId:o},V,e,this._drawingManagerService),d.push(V))}return d}renderDrawing(r,e){const t=this._drawingManagerService.getDrawingByParam(r);if(t!=null&&t.drawingType===h.DrawingTypeEnum.DRAWING_IMAGE)return this.renderImages(t,e)}previewImage(r,e,t,n){this._galleryService.open({images:[e],onOpenChange:i=>{i||this._galleryService.close()}})}_adjustImageSize(r,e,t,n){if(r<=t&&e<=n)return{width:r,height:e};const i=t/r,a=n/e,o=Math.min(i,a);return{width:Math.floor(r*o),height:Math.floor(e*o)}}},y.DrawingRenderService=dt([Se(0,M.IDrawingManagerService),Se(1,M.IImageIoService),Se(2,x.IGalleryService),Se(3,h.IURLImageService)],y.DrawingRenderService);var ht=Object.getOwnPropertyDescriptor,ft=(s,r,e,t)=>{for(var n=t>1?void 0:t?ht(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},te=(s,r)=>(e,t)=>r(e,t,s);let Ce=class extends h.Disposable{constructor(s,r,e,t,n,i,a){super(),this._commandService=s,this._renderManagerService=r,this._drawingManagerService=e,this._dialogService=t,this._imageIoService=n,this._currentUniverService=i,this._drawingRenderService=a,this._initialize()}dispose(){super.dispose()}_initialize(){this._drawingAddListener(),this._commandExecutedListener(),this._imageUpdateListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(s=>{if(s.id===be.id){const r=s.params;if(r==null)return;this._resetImageSize(r)}}))}_getSceneAndTransformerByDrawingSearch(s){if(s==null)return;const r=this._renderManagerService.getRenderById(s),e=r==null?void 0:r.scene;if(e==null)return null;const t=e.getTransformerByCreate();return{scene:e,transformer:t}}_resetImageSize(s){const r=[],e=[];s.forEach(t=>{const{unitId:n,subUnitId:i,drawingId:a}=t,o=this._getSceneAndTransformerByDrawingSearch(n);if(o==null)return;const{scene:c}=o,u=M.getDrawingShapeKeyByDrawingSearch({unitId:n,subUnitId:i,drawingId:a}),l=c.getObject(u);if(l==null)return!0;const g=this._drawingManagerService.getDrawingByParam(t);if(g==null)return!0;if(g.drawingType!==h.DrawingTypeEnum.DRAWING_IMAGE)return;l.resetSize();const{width:d,height:p}=l.getNativeSize();e.includes(c)===!1&&e.push(c),r.push({...g,transform:{...g.transform,height:p,width:d,angle:0},srcRect:null,prstGeom:null})}),this._drawingManagerService.featurePluginUpdateNotification(r),e.forEach(t=>{t.getTransformerByCreate().refreshControls().changeNotification()}),this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,s)}_drawingAddListener(){this.disposeWithMe(this._drawingManagerService.add$.subscribe(s=>{this._insertImages(s)}))}_insertImages(s){s.forEach(async r=>{var c;const{unitId:e,subUnitId:t}=r,n=this._getSceneAndTransformerByDrawingSearch(e),i=(c=Me(this._currentUniverService,e))==null?void 0:c.subUnitId;if(n==null||i!==t)return;const a=this._drawingManagerService.getDrawingByParam(r);if(a==null)return;const o=await this._drawingRenderService.renderImages(a,n.scene);if(this._drawingManagerService.refreshTransform([a]),!(o==null||o.length===0))for(const u of o)this._addHoverForImage(u),this._addDialogForImage(u)})}_imageUpdateListener(){this.disposeWithMe(this._drawingManagerService.update$.subscribe(s=>{s.forEach(r=>{const{unitId:e,subUnitId:t,drawingId:n}=r,i=this._drawingManagerService.getDrawingByParam(r);if(i==null)return;const{transform:a,drawingType:o,srcRect:c,prstGeom:u,source:l,imageSourceType:g}=i;if(o!==h.DrawingTypeEnum.DRAWING_IMAGE)return;const d=this._getSceneAndTransformerByDrawingSearch(e);if(d==null)return;const{scene:p,transformer:S}=d;if(a==null)return!0;const m=M.getDrawingShapeKeyByDrawingSearch({unitId:e,subUnitId:t,drawingId:n}),v=p.getObject(m);if(v==null)return!0;v.setSrcRect(c),v.setPrstGeom(u),l!=null&&l.length>0&&(g===h.ImageSourceType.BASE64||g===h.ImageSourceType.URL)&&v.changeSource(l)})}))}_addHoverForImage(s){this.disposeWithMe(h.toDisposable(s.onPointerEnter$.subscribeEvent(()=>{s.cursor=b.CURSOR_TYPE.GRAB}))),this.disposeWithMe(h.toDisposable(s.onPointerLeave$.subscribeEvent(()=>{s.cursor=b.CURSOR_TYPE.DEFAULT})))}_addDialogForImage(s){this.disposeWithMe(h.toDisposable(s.onDblclick$.subscribeEvent(()=>{const r=`${s.oKey}-viewer-dialog`;this._drawingRenderService.previewImage(r,s.getNative().src,s.getNativeSize().width,s.getNativeSize().height)})))}};Ce=ft([te(0,h.ICommandService),te(1,b.IRenderManagerService),te(2,M.IDrawingManagerService),te(3,x.IDialogService),te(4,M.IImageIoService),te(5,h.IUniverInstanceService),te(6,h.Inject(y.DrawingRenderService))],Ce);var pt=Object.getOwnPropertyDescriptor,mt=(s,r,e,t)=>{for(var n=t>1?void 0:t?pt(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},Ve=(s,r)=>(e,t)=>r(e,t,s);const vt="UNIVER_DRAWING_UI_PLUGIN";y.UniverDrawingUIPlugin=(Oe=class extends h.Plugin{constructor(r=Te,e,t){super(),this._config=r,this._injector=e,this._configService=t;const{menu:n,...i}=h.merge({},Te,this._config);n&&this._configService.setConfig("menu",n,{merge:!0}),this._configService.setConfig(Ze,i)}onStarting(){this._initDependencies()}onRendered(){this._injector.get(ve),this._injector.get(pe),this._injector.get(we),this._injector.get(Ce)}_initDependencies(){[[y.DrawingRenderService],[ve],[pe],[we],[Ce]].forEach(e=>this._injector.add(e))}},Q(Oe,"pluginName",vt),Oe),y.UniverDrawingUIPlugin=mt([Ve(1,h.Inject(h.Injector)),Ve(2,h.IConfigService)],y.UniverDrawingUIPlugin);const wt=s=>{const r=x.useDependency(h.ICommandService),e=x.useDependency(h.LocaleService),{alignShow:t}=s,[n,i]=C.useState(R.default),a=[{label:e.t("image-panel.align.default"),value:R.default},{options:[{label:e.t("image-panel.align.left"),value:R.left},{label:e.t("image-panel.align.center"),value:R.center},{label:e.t("image-panel.align.right"),value:R.right}]},{options:[{label:e.t("image-panel.align.top"),value:R.top},{label:e.t("image-panel.align.middle"),value:R.middle},{label:e.t("image-panel.align.bottom"),value:R.bottom}]},{options:[{label:e.t("image-panel.align.horizon"),value:R.horizon},{label:e.t("image-panel.align.vertical"),value:R.vertical}]}];function o(c){i(c),r.executeCommand(he.id,{alignType:c})}return f.jsxs("div",{className:B.clsx("univer-relative univer-w-full",{"univer-hidden":!t}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:e.t("image-panel.align.title")})}),f.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:f.jsx("div",{className:"univer-w-full univer-text-gray-900 dark:!univer-text-white",children:f.jsx(B.Select,{value:n,options:a,onChange:o})})})]})},St=s=>{const{arrangeShow:r,drawings:e}=s,t=x.useDependency(h.LocaleService),n=x.useDependency(M.IDrawingManagerService),[i,a]=C.useState(e);C.useEffect(()=>{const c=n.focus$.subscribe(u=>{a(u)});return()=>{c.unsubscribe()}},[]);const o=c=>{const u=i[0].unitId,l=i[0].subUnitId,g=i.map(d=>d.drawingId);n.featurePluginOrderUpdateNotification({unitId:u,subUnitId:l,drawingIds:g,arrangeType:c})};return f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":!r}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:t.t("image-panel.arrange.title")})}),f.jsxs("div",{className:"univer-grid univer-grid-cols-2 univer-gap-2",children:[f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.forward)},children:[f.jsx(Le,{}),t.t("image-panel.arrange.forward")]}),f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.backward)},children:[f.jsx(Ae,{}),t.t("image-panel.arrange.backward")]}),f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.front)},children:[f.jsx(xe,{}),t.t("image-panel.arrange.front")]}),f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.back)},children:[f.jsx(Ue,{}),t.t("image-panel.arrange.back")]})]})]})},Ct=s=>{const r=x.useDependency(h.LocaleService),e=x.useDependency(b.IRenderManagerService),t=x.useDependency(M.IDrawingManagerService),{hasGroup:n,drawings:i}=s,[a,o]=C.useState(!1),[c,u]=C.useState(!0),[l,g]=C.useState(!0),d=()=>{const m=t.getFocusDrawings(),{unitId:v,subUnitId:_}=m[0],I=h.generateRandomId(10),O=b.getGroupState(0,0,m.map(D=>D.transform||{})),N={unitId:v,subUnitId:_,drawingId:I,drawingType:h.DrawingTypeEnum.DRAWING_GROUP,transform:O},j=m.map(D=>{const T=D.transform||{left:0,top:0},{unitId:E,subUnitId:U,drawingId:P}=D;return{unitId:E,subUnitId:U,drawingId:P,transform:{...T,left:T.left-O.left,top:T.top-O.top},groupId:I}});t.featurePluginGroupUpdateNotification([{parent:N,children:j}])},p=m=>{if(m.drawingType!==h.DrawingTypeEnum.DRAWING_GROUP)return;const{unitId:v,subUnitId:_,drawingId:I,transform:O={width:0,height:0}}=m;if(O==null)return;const N=t.getDrawingsByGroup({unitId:v,subUnitId:_,drawingId:I});if(N.length===0)return;const j=N.map(D=>{const{transform:T}=D,{unitId:E,subUnitId:U,drawingId:P}=D,G=b.transformObjectOutOfGroup(T||{},O,O.width||0,O.height||0);return{unitId:E,subUnitId:U,drawingId:P,transform:{...T,...G},groupId:void 0}});return{parent:m,children:j}},S=()=>{const v=t.getFocusDrawings().map(_=>p(_)).filter(_=>_!=null);v.length!==0&&t.featurePluginUngroupUpdateNotification(v)};return C.useEffect(()=>{const m=i[0];if(m==null)return;const{unitId:v}=m,_=e.getRenderById(v),I=_==null?void 0:_.scene;if(I==null)return;const O=I.getTransformerByCreate(),N=O.clearControl$.subscribe(D=>{D===!0&&o(!1)}),j=O.changeStart$.subscribe(D=>{const{objects:T}=D,E=ce(T,t),U=E.filter(V=>(V==null?void 0:V.drawingType)===h.DrawingTypeEnum.DRAWING_GROUP);let P=!1,G=!1;E.length>1&&(P=!0),U.length>0&&(G=!0),o(P||G),u(P),g(G)});return()=>{j.unsubscribe(),N.unsubscribe()}},[]),f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":n===!0&&a===!1||n===!1}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:r.t("image-panel.group.title")})}),f.jsxs("div",{className:"univer-flex univer-items-center univer-justify-center univer-gap-2",children:[f.jsxs(B.Button,{className:B.clsx({"univer-hidden":!c}),onClick:d,children:[f.jsx(Re,{}),r.t("image-panel.group.group")]}),f.jsxs(B.Button,{className:B.clsx({"univer-hidden":!l}),onClick:S,children:[f.jsx(He,{}),r.t("image-panel.group.unGroup")]})]})]})},_e=20,Ie=20,We=[-360,360],ye=300,_t=s=>{var Ke;const r=x.useDependency(h.LocaleService),e=x.useDependency(M.IDrawingManagerService),t=x.useDependency(b.IRenderManagerService),{drawings:n,transformShow:i}=s,a=n[0];if(a==null)return;const o=a.transform;if(o==null)return;const{unitId:c,subUnitId:u,drawingId:l,drawingType:g}=a,d=t.getRenderById(c),p=d==null?void 0:d.scene;if(p==null)return;const S=(Ke=p.getEngine())==null?void 0:Ke.activeScene;if(S==null)return;const m=p.getTransformerByCreate(),{width:v=0,height:_=0,left:I=0,top:O=0,angle:N=0}=o,[j,D]=C.useState(v),[T,E]=C.useState(_),[U,P]=C.useState(I),[G,H]=C.useState(O),[V,Y]=C.useState(N),[se,X]=C.useState(m.keepRatio),re=(w,A,$,W)=>{const{width:k,height:J}=S,{ancestorLeft:K,ancestorTop:Z}=p;let z=w,ie=A,ge=$,de=W;return w+K<0&&(z=-K),A+Z<0&&(ie=-Z),ge=k-z-K,ge<_e&&(ge=_e),de=J-ie-Z,de<Ie&&(de=Ie),w+ge+K>k&&(z=k-$-K),A+de+Z>J&&(ie=J-W-Z),{limitLeft:z,limitTop:ie,limitWidth:ge,limitHeight:de}},ne=w=>{const{objects:A}=w,$=ce(A,e);if($.length!==1)return;const W=$[0];if(W==null)return;const{transform:k}=W;if(k==null)return;const{width:J,height:K,left:Z,top:z,angle:ie}=k;J!=null&&D(J),K!=null&&E(K),Z!=null&&P(Z),z!=null&&H(z),ie!=null&&Y(ie)};C.useEffect(()=>{const w=[m.changeStart$.subscribe(A=>{ne(A)}),m.changing$.subscribe(A=>{ne(A)}),m.changeEnd$.subscribe(A=>{ne(A)}),e.focus$.subscribe(A=>{if(A.length!==1)return;const $=e.getDrawingByParam(A[0]);if($==null)return;const W=$.transform;if(W==null)return;const{width:k,height:J,left:K,top:Z,angle:z}=W;k!=null&&D(k),J!=null&&E(J),K!=null&&P(K),Z!=null&&H(Z),z!=null&&Y(z)})];return()=>{w.forEach(A=>A.unsubscribe())}},[]);const q=h.debounce(w=>{if(w==null)return;const{limitWidth:A,limitHeight:$}=re(U,G,w,T);w=Math.min(w,A);const W={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{width:w}};if(se){let k=w/j*T;if(k=Math.max(k,Ie),k>$)return;E(k),W.transform.height=k}D(w),e.featurePluginUpdateNotification([W]),m.refreshControls().changeNotification()},ye),ue=h.debounce(w=>{if(w==null)return;const{limitHeight:A,limitWidth:$}=re(U,G,j,w);w=Math.min(w,A);const W={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{height:w}};if(se){let k=w/T*j;if(k=Math.max(k,_e),k>$)return;D(k),W.transform.width=k}E(w),e.featurePluginUpdateNotification([W]),m.refreshControls().changeNotification()},ye),bt=h.debounce(w=>{if(w==null)return;const{limitLeft:A}=re(w,G,j,T);w=A;const $={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{left:w}};P(w),e.featurePluginUpdateNotification([$]),m.refreshControls().changeNotification()},ye),Dt=h.debounce(w=>{if(w==null)return;const{limitTop:A}=re(U,w,j,T);w=A;const $={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{top:w}};H(w),e.featurePluginUpdateNotification([$]),m.refreshControls().changeNotification()},ye),Mt=w=>{if(w==null)return;const A={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{angle:w}};Y(w),e.featurePluginUpdateNotification([A]),m.refreshControls().changeNotification()},Ot=w=>{X(w),m.keepRatio=w};return f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":!i}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:r.t("image-panel.transform.title")})}),f.jsxs("div",{className:"univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",children:[f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.width")}),f.jsx(B.InputNumber,{precision:1,value:j,min:_e,onChange:w=>{q(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.height")}),f.jsx(B.InputNumber,{precision:1,value:T,min:Ie,onChange:w=>{ue(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.lock")}),f.jsx("div",{className:"univer-text-center",children:f.jsx(B.Checkbox,{checked:se,onChange:Ot})})]})]}),f.jsxs("div",{className:"univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",children:[f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.x")}),f.jsx(B.InputNumber,{precision:1,value:U,onChange:w=>{bt(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.y")}),f.jsx(B.InputNumber,{precision:1,value:G,onChange:w=>{Dt(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.rotate")}),f.jsx(B.InputNumber,{precision:1,value:V,min:We[0],max:We[1],onChange:Mt})]})]})]})},It=s=>{const r=x.useDependency(h.ICommandService),e=x.useDependency(h.LocaleService),{drawings:t,cropperShow:n}=s;if(t[0]==null)return;const[a,o]=C.useState(L.FREE),c=C.useRef(!1),u=[{label:e.t("image-panel.crop.mode"),value:L.FREE},{label:"1:1",value:L.R1_1},{label:"16:9",value:L.R16_9},{label:"9:16",value:L.R9_16},{label:"5:4",value:L.R5_4},{label:"4:5",value:L.R4_5},{label:"4:3",value:L.R4_3},{label:"3:4",value:L.R3_4},{label:"3:2",value:L.R3_2},{label:"2:3",value:L.R2_3}];C.useEffect(()=>{const d=r.onCommandExecuted(p=>{if(p.id===ee.id){const S=p.params;S!=null&&S.isAuto||(c.current=!1)}});return()=>{d==null||d.dispose()}},[]);function l(d){o(d),c.current&&r.executeCommand(oe.id,{cropType:d})}const g=d=>{r.executeCommand(oe.id,{cropType:d}),c.current=!0};return f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":!n}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:e.t("image-panel.crop.title")})}),f.jsxs("div",{className:"univer-flex univer-items-center univer-justify-center univer-gap-2",children:[f.jsxs(B.Button,{onClick:()=>{g(a)},children:[f.jsx(Be,{}),e.t("image-panel.crop.start")]}),f.jsx(B.Select,{value:a,options:u,onChange:l})]})]})},yt=s=>{const r=x.useDependency(M.IDrawingManagerService),e=x.useDependency(b.IRenderManagerService),t=x.useDependency(h.LocaleService),{drawings:n,hasArrange:i=!0,hasTransform:a=!0,hasAlign:o=!0,hasCropper:c=!0,hasGroup:u=!0}=s,l=n[0];if(l==null)return;const{unitId:g}=l,d=e.getRenderById(g),p=d==null?void 0:d.scene;if(p==null)return;const S=p.getTransformerByCreate(),[m,v]=C.useState(!0),[_,I]=C.useState(!0),[O,N]=C.useState(!1),[j,D]=C.useState(!0),[T,E]=C.useState(!1);return C.useEffect(()=>{const U=S.clearControl$.subscribe(H=>{H===!0&&(v(!1),I(!1),N(!1),D(!1),E(!0))}),P=S.changeStart$.subscribe(H=>{const{objects:V}=H,Y=ce(V,r);Y.length===0?(v(!1),I(!1),N(!1),D(!1),E(!0)):Y.length===1?(v(!0),I(!0),N(!1),D(!0),E(!1)):(v(!0),I(!1),N(!0),D(!1),E(!1))}),G=r.focus$.subscribe(H=>{H.length===0?(v(!1),I(!1),N(!1),D(!1),E(!0)):H.length===1?(v(!0),I(!0),N(!1),D(!0),E(!1)):(v(!0),I(!1),N(!0),D(!1),E(!1))});return()=>{P.unsubscribe(),U.unsubscribe(),G.unsubscribe()}},[]),f.jsxs(f.Fragment,{children:[f.jsx("div",{className:B.clsx("univer-h-full",{"univer-hidden":!T}),children:f.jsx("div",{className:"univer-flex univer-h-full univer-items-center univer-justify-center",children:f.jsx("span",{children:t.t("image-panel.null")})})}),f.jsx(St,{arrangeShow:i===!0?m:!1,drawings:n}),f.jsx(_t,{transformShow:a===!0?_:!1,drawings:n}),f.jsx(wt,{alignShow:o===!0?O:!1,drawings:n}),f.jsx(It,{cropperShow:c===!0?j:!1,drawings:n}),f.jsx(Ct,{hasGroup:u,drawings:n})]})};y.AutoImageCropOperation=oe,y.COMPONENT_IMAGE_POPUP_MENU=Pe,y.CloseImageCropOperation=ee,y.DrawingCommonPanel=yt,y.ImageCropperObject=le,y.ImagePopupMenu=Ge,y.ImageResetSizeOperation=be,y.OpenImageCropOperation=fe,y.SetDrawingAlignOperation=he,y.getCurrentUnitInfo=Me,y.getUpdateParams=ce,y.insertGroupObject=De,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
(function(y,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing","@univerjs/engine-render","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs"],h):(y=typeof globalThis<"u"?globalThis:y||self,h(y.UniverDrawingUi={},y.UniverCore,y.UniverDrawing,y.UniverEngineRender,y.UniverUi,y.React,y.UniverDesign,y.React,y.rxjs))})(this,(function(y,h,M,b,H,f,B,_,te){"use strict";var Et=Object.defineProperty;var Tt=(y,h,M)=>h in y?Et(y,h,{enumerable:!0,configurable:!0,writable:!0,value:M}):y[h]=M;var Q=(y,h,M)=>Tt(y,typeof h!="symbol"?h+"":h,M);var Ee;var R=(s=>(s.default="0",s.left="1",s.center="2",s.right="3",s.top="4",s.middle="5",s.bottom="6",s.horizon="7",s.vertical="8",s))(R||{});const pe={id:"sheet.operation.set-image-align",type:h.CommandType.OPERATION,handler:(s,r)=>!0},me={id:"sheet.operation.open-image-crop",type:h.CommandType.OPERATION,handler:(s,r)=>!0},ee={id:"sheet.operation.close-image-crop",type:h.CommandType.OPERATION,handler:(s,r)=>!0};var L=(s=>(s.FREE="0",s.R1_1="1",s.R16_9="2",s.R9_16="3",s.R5_4="4",s.R4_5="5",s.R4_3="6",s.R3_4="7",s.R3_2="8",s.R2_3="9",s))(L||{});const ce={id:"sheet.operation.Auto-image-crop",type:h.CommandType.OPERATION,handler:(s,r)=>!0},De={id:"sheet.operation.image-reset-size",type:h.CommandType.OPERATION,handler:(s,r)=>!0};function Me(s,r,e,t){const n=t.getDrawingByParam(s);if(n==null)return;const i=M.getDrawingShapeKeyByDrawingSearch(s),a=e.getObject(i);if(a&&!(a instanceof b.Group))return;if(a!=null){a.addObject(r);return}const o=new b.Group(i);e.addObject(o,b.DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(o),o.addObject(r);const{transform:c}=n;c&&o.transformByState({left:c.left,top:c.top,angle:c.angle})}function Oe(s,r){var i;const e=r?s.getUnit(r):s.getFocusedUnit();if(e==null)return;const t=e.getUnitId();let n;return e.type===h.UniverInstanceType.UNIVER_SHEET?n=(i=e.getActiveSheet())==null?void 0:i.getSheetId():(e.type===h.UniverInstanceType.UNIVER_DOC||e.type===h.UniverInstanceType.UNIVER_SLIDE)&&(n=t),{unitId:t,subUnitId:n,current:e}}const Ze="drawing-ui.config",Te={},Ue="COMPONENT_IMAGE_POPUP_MENU";function F({ref:s,...r}){const{icon:e,id:t,className:n,extend:i,...a}=r,o=`univerjs-icon univerjs-icon-${t} ${n||""}`.trim(),c=_.useRef(`_${Ye()}`);return Pe(e,`${t}`,{defIds:e.defIds,idSuffix:c.current},{ref:s,className:o,...a},i)}function Pe(s,r,e,t,n){return _.createElement(s.tag,{key:r,...Fe(s,e,n),...t},(ze(s,e).children||[]).map((i,a)=>Pe(i,`${r}-${s.tag}-${a}`,e,void 0,n)))}function Fe(s,r,e){const t={...s.attrs};e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1),s.tag==="mask"&&t.id&&(t.id=t.id+r.idSuffix),Object.entries(t).forEach(([i,a])=>{i==="mask"&&typeof a=="string"&&(t[i]=a.replace(/url\(#(.*)\)/,`url(#$1${r.idSuffix})`))});const{defIds:n}=r;return!n||n.length===0||(s.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+r.idSuffix),Object.entries(t).forEach(([i,a])=>{typeof a=="string"&&(t[i]=a.replace(/url\(#(.*)\)/,`url(#$1${r.idSuffix})`))})),t}function ze(s,r){var t;const{defIds:e}=r;return!e||e.length===0?s:s.tag==="defs"&&((t=s.children)!=null&&t.length)?{...s,children:s.children.map(n=>typeof n.attrs.id=="string"&&e&&e.includes(n.attrs.id)?{...n,attrs:{...n.attrs,id:n.attrs.id+r.idSuffix}}:n)}:s}function Ye(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";const Xe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334C15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334C2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045ZM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334C3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999C15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999C2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544ZM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999C3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421C6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641C9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421C11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946C8.64077 14.6502 8.70566 14.6923 8.77482 14.7209C8.84557 14.7502 8.92314 14.7664 9.00449 14.7664C9.08585 14.7664 9.16342 14.7502 9.23416 14.7209C9.30332 14.6923 9.36821 14.6502 9.42482 14.5946"}}]},Ne=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"bottom-icon",ref:e,icon:Xe}))});Ne.displayName="BottomIcon";const qe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.97705 7.51296C5.97705 7.18159 6.24568 6.91296 6.57705 6.91296H8.48632C8.81769 6.91296 9.08632 7.18159 9.08632 7.51296C9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103C5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103C11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.51074 2.37063C3.51074 1.48697 4.22709 0.77063 5.11074 0.77063H9.80318L9.81294 0.770708C9.97168 0.768161 10.1311 0.82824 10.2511 0.95055L14.4317 5.21408C14.5165 5.30049 14.5697 5.406 14.5917 5.51645C14.6041 5.5644 14.6106 5.61467 14.6106 5.66648V11.6406C14.6106 12.5243 13.8943 13.2406 13.0106 13.2406H5.11074C4.22709 13.2406 3.51074 12.5243 3.51074 11.6406V2.37063ZM10.4032 4.66648V2.81964L12.6063 5.06648H10.8032C10.5823 5.06648 10.4032 4.88739 10.4032 4.66648ZM5.11074 1.97063C4.88983 1.97063 4.71074 2.14972 4.71074 2.37063V11.6406C4.71074 11.8615 4.88983 12.0406 5.11074 12.0406H13.0106C13.2316 12.0406 13.4106 11.8615 13.4106 11.6406V6.26648H10.8032C9.91953 6.26648 9.20318 5.55013 9.20318 4.66648V1.97063H5.11074Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.58916 6.6741C2.58916 6.34273 2.32053 6.0741 1.98916 6.0741C1.65779 6.0741 1.38916 6.34273 1.38916 6.6741V12.6294C1.38916 14.0653 2.55322 15.2294 3.98916 15.2294H9.41408C9.74545 15.2294 10.0141 14.9607 10.0141 14.6294C10.0141 14.298 9.74545 14.0294 9.41408 14.0294H3.98916C3.21596 14.0294 2.58916 13.4026 2.58916 12.6294V6.6741Z"}}]},Be=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"create-copy-icon",ref:e,icon:qe}))});Be.displayName="CreateCopyIcon";const Je={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.38125 1.16211C6.49759 1.16211 5.78125 1.87845 5.78125 2.76211V5.6377H2.87783C1.99418 5.6377 1.27783 6.35404 1.27783 7.2377V13.2377C1.27783 14.1214 1.99418 14.8377 2.87783 14.8377H8.87783C9.76149 14.8377 10.4778 14.1214 10.4778 13.2377V10.3621H13.3813C14.2649 10.3621 14.9813 9.64577 14.9813 8.76211V2.76211C14.9813 1.87845 14.2649 1.16211 13.3813 1.16211H7.38125ZM10.4778 9.16211H13.3813C13.6022 9.16211 13.7812 8.98302 13.7812 8.76211V2.76211C13.7812 2.5412 13.6022 2.36211 13.3813 2.36211H7.38125C7.16034 2.36211 6.98125 2.5412 6.98125 2.76211V5.6377H8.87783C9.76149 5.6377 10.4778 6.35404 10.4778 7.2377V9.16211ZM6.98125 6.8377H8.87783C9.09875 6.8377 9.27783 7.01678 9.27783 7.2377V9.16211H7.38125C7.16034 9.16211 6.98125 8.98302 6.98125 8.76211V6.8377ZM5.78125 6.8377V8.76211C5.78125 9.64577 6.49759 10.3621 7.38125 10.3621H9.27783V13.2377C9.27783 13.4586 9.09875 13.6377 8.87783 13.6377H2.87783C2.65692 13.6377 2.47783 13.4586 2.47783 13.2377V7.2377C2.47783 7.01678 2.65692 6.8377 2.87783 6.8377H5.78125Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Re=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"group-icon",ref:e,icon:Je}))});Re.displayName="GroupIcon";const Qe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},je=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"more-down-icon",ref:e,icon:Qe}))});je.displayName="MoreDownIcon";const et={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z"}}]},Ae=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"move-down-icon",ref:e,icon:et}))});Ae.displayName="MoveDownIcon";const tt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z"}}]},Le=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"move-up-icon",ref:e,icon:tt}))});Le.displayName="MoveUpIcon";const rt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9C15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9ZM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9C2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9C13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665C15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665ZM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665C2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665C13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543Z",fillRule:"evenodd",clipRule:"evenodd"}}]},He=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"topmost-icon",ref:e,icon:rt}))});He.displayName="TopmostIcon";const nt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.46855 2.83731C7.46855 2.61639 7.64764 2.4373 7.86855 2.4373H13.8603C14.0812 2.4373 14.2603 2.61639 14.2603 2.8373V9.5049C14.2603 9.72581 14.0812 9.90489 13.8603 9.90489H12.866C12.5346 9.90489 12.266 10.1735 12.266 10.5049C12.266 10.8363 12.5346 11.1049 12.866 11.1049H13.8603C14.7439 11.1049 15.4603 10.3886 15.4603 9.5049V2.8373C15.4603 1.95365 14.7439 1.2373 13.8603 1.2373H7.86855C6.9849 1.2373 6.26855 1.95365 6.26855 2.83731V3.48688C6.26855 3.81825 6.53718 4.08688 6.86855 4.08688C7.19993 4.08688 7.46855 3.81825 7.46855 3.48688V2.83731Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M3.19888 5.56299C2.31522 5.56299 1.59888 6.27933 1.59888 7.16299V13.163C1.59888 14.0466 2.31522 14.763 3.19888 14.763H9.19888C10.0825 14.763 10.7989 14.0466 10.7989 13.163V7.16299C10.7989 6.27933 10.0825 5.56299 9.19888 5.56299H3.19888ZM2.79888 7.16299C2.79888 6.94207 2.97796 6.76299 3.19888 6.76299H9.19888C9.41979 6.76299 9.59888 6.94207 9.59888 7.16299V13.163C9.59888 13.3839 9.41979 13.563 9.19888 13.563H3.19888C2.97796 13.563 2.79888 13.3839 2.79888 13.163V7.16299Z",fillRule:"evenodd",clipRule:"evenodd"}}]},xe=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"ungroup-icon",ref:e,icon:nt}))});xe.displayName="UngroupIcon";const it={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365ZM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365ZM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635ZM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ke=_.forwardRef(function(r,e){return _.createElement(F,Object.assign({},r,{id:"autofill-double-icon",ref:e,icon:it}))});ke.displayName="AutofillDoubleIcon";function $e(s){var m;const{popup:r}=s,e=(m=r==null?void 0:r.extraProps)==null?void 0:m.menuItems;if(!e)return null;const t=H.useDependency(h.ICommandService),n=H.useDependency(h.LocaleService),[i,a]=_.useState(!1),[o,c]=_.useState(!1),u=()=>{c(!0)},l=()=>{c(!1)},g=v=>{a(v)},d=v=>{t.executeCommand(v.commandId,v.commandParams),a(!1)},p=i||o,S=e.filter(v=>!v.disable);return f.jsx("div",{onMouseEnter:u,onMouseLeave:l,children:f.jsx(B.DropdownMenu,{align:"start",items:S.map(v=>({type:"item",children:n.t(v.label),onSelect:()=>d(v)})),open:i,onOpenChange:g,children:f.jsxs("div",{className:B.clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800",B.borderClassName,{"univer-bg-gray-100 dark:!univer-bg-gray-800":i,"univer-bg-white dark:!univer-bg-gray-900":!i}),children:[f.jsx(ke,{className:"univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"}),p&&f.jsx(je,{className:"dark:!univer-text-white"})]})})})}var at=Object.getOwnPropertyDescriptor,st=(s,r,e,t)=>{for(var n=t>1?void 0:t?at(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},Ge=(s,r)=>(e,t)=>r(e,t,s);let ve=class extends h.Disposable{constructor(s,r){super(),this._componentManager=s,this._commandService=r,this._init()}_initCustomComponents(){const s=this._componentManager;this.disposeWithMe(s.register(Ue,$e))}_initCommands(){[me,ee,De,pe,ce].forEach(s=>this.disposeWithMe(this._commandService.registerCommand(s)))}_init(){this._initCommands(),this._initCustomComponents()}};ve=st([Ge(0,h.Inject(H.ComponentManager)),Ge(1,h.ICommandService)],ve);function le(s,r){const e=[];return s.forEach(t=>{const{oKey:n,left:i,top:a,height:o,width:c,angle:u}=t,l=r.getDrawingOKey(n);if(l==null)return e.push(null),!0;const{unitId:g,subUnitId:d,drawingId:p,drawingType:S}=l,m={unitId:g,subUnitId:d,drawingId:p,drawingType:S,transform:{left:i,top:a,height:o,width:c,angle:u}};S===h.DrawingTypeEnum.DRAWING_IMAGE&&(m.srcRect=t.srcRect),e.push(m)}),e}var ot=Object.getOwnPropertyDescriptor,ct=(s,r,e,t)=>{for(var n=t>1?void 0:t?ot(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},we=(s,r)=>(e,t)=>r(e,t,s);let Se=class extends h.Disposable{constructor(r,e,t,n){super();Q(this,"_sceneListenerOnDrawingMap",new WeakSet);this._currentUniverService=r,this._commandService=e,this._renderManagerService=t,this._drawingManagerService=n,this._initialize()}dispose(){super.dispose()}_initialize(){this._recoveryImages(),this._drawingAddListener(),this._drawingRemoveListener(),this._drawingUpdateListener(),this._commandExecutedListener(),this._drawingArrangeListener(),this._drawingGroupListener(),this._drawingRefreshListener(),this._drawingVisibleListener()}_recoveryImages(){const r=this._drawingManagerService.drawingManagerData,e=Oe(this._currentUniverService);if(e==null)return;const{unitId:t,subUnitId:n}=e;Object.keys(r).forEach(i=>{Object.keys(r[i]).forEach(a=>{const o=r[i][a].data;o==null||i!==t||a!==n||Object.keys(o).forEach(c=>{o[c]&&this._insertDrawing([{unitId:i,subUnitId:a,drawingId:c}])})})})}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{if(r.id===pe.id){const e=r.params;if(e==null)return;this._drawingAlign(e)}}))}_drawingGroupListener(){this.disposeWithMe(this._drawingManagerService.group$.subscribe(r=>{this._groupDrawings(r)})),this.disposeWithMe(this._drawingManagerService.ungroup$.subscribe(r=>{this._ungroupDrawings(r)}))}_getSceneAndTransformerByDrawingSearch(r){if(r==null)return;const e=this._renderManagerService.getRenderById(r),t=e==null?void 0:e.scene;if(t==null)return null;const n=t.getTransformerByCreate();return{scene:t,transformer:n}}_groupDrawings(r){r.forEach(e=>{this._groupDrawing(e)})}_groupDrawing(r){const{parent:e,children:t}=r,{unitId:n,subUnitId:i,drawingId:a}=e,o=this._getSceneAndTransformerByDrawingSearch(e.unitId);if(o==null)return;const{scene:c,transformer:u}=o;this._commandService.syncExecuteCommand(ee.id);const l=[];if(t.forEach(p=>{const S=M.getDrawingShapeKeyByDrawingSearch(p),m=c.getObjectIncludeInGroup(S);if(m==null||l.includes(m))return;l.push(m);const{transform:v}=p;v!=null&&(m.classType===b.RENDER_CLASS_TYPE.GROUP?m.transformByState({left:v.left,top:v.top}):m.transformByState(v))}),l.length===0)return;const g=M.getDrawingShapeKeyByDrawingSearch({unitId:n,subUnitId:i,drawingId:a}),d=new b.Group(g);c.addObject(d,b.DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(d),d.addObjects(...l),e.transform&&d.transformByState({left:e.transform.left,top:e.transform.top}),u.clearSelectedObjects(),u.setSelectedControl(d)}_ungroupDrawings(r){r.forEach(e=>{this._ungroupDrawing(e)})}_ungroupDrawing(r){const{parent:e,children:t}=r,n=this._getSceneAndTransformerByDrawingSearch(e.unitId);if(n==null)return;const{scene:i,transformer:a}=n;t.forEach(g=>{const d=M.getDrawingShapeKeyByDrawingSearch(g),p=i.getObjectIncludeInGroup(d);if(p==null)return!0;if(p==null)return;const{transform:S}=g;S!=null&&(p.classType===b.RENDER_CLASS_TYPE.GROUP?p.transformByState({left:S.left,top:S.top}):p.transformByState(S))});const o=M.getDrawingShapeKeyByDrawingSearch(e),c=i.getObject(o),{width:u,height:l}=c;c.getObjects().forEach(g=>{c.removeSelfObjectAndTransform(g.oKey,u,l)}),c.dispose(),a.clearSelectedObjects()}_drawingAlign(r){const{alignType:e}=r,t=this._drawingManagerService.getFocusDrawings();if(e===R.default)return;const n=[];let i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=0;t.forEach(l=>{const{unitId:g,subUnitId:d,drawingId:p,drawingType:S}=l,m=this._drawingManagerService.getDrawingByParam({unitId:g,subUnitId:d,drawingId:p});if(m==null||m.transform==null)return;n.push({unitId:g,subUnitId:d,drawingId:p,drawingType:S,transform:m.transform});const{left:v=0,top:C=0,width:I=0,height:O=0}=m.transform;i=Math.min(i,v),a=Math.min(a,C),o=Math.max(o,v+I),c=Math.max(c,C+O),u++}),u!==0&&(this._sortDrawingTransform(n,e),this._applyAlignType(n,e,i,a,o,c,u))}_applyAlignType(r,e,t,n,i,a,o){const c=Math.round((i-t)/o*10)/10,u=Math.round((a-n)/o*10)/10,l=[],g=this._getSceneAndTransformerByDrawingSearch(r[0].unitId);if(g==null)return;const{scene:d,transformer:p}=g;r.forEach((S,m)=>{const{unitId:v,subUnitId:C,drawingId:I,transform:O,drawingType:P}=S,{left:j=0,top:D=0,width:T=0,height:E=0}=O;let N=j,U=D;switch(e){case R.left:N=t;break;case R.center:N=t+(i-t)/2-T/2;break;case R.right:N=i-T;break;case R.top:U=n;break;case R.middle:U=n+(a-n)/2-E/2;break;case R.bottom:U=a-E;break;case R.horizon:N=t+c*m;break;case R.vertical:U=n+u*m;break}(N!==j||U!==D)&&l.push({unitId:v,subUnitId:C,drawingId:I,drawingType:P,transform:{left:N,top:U}})}),this._drawingManagerService.featurePluginUpdateNotification(l),p.refreshControls().changeNotification()}_sortDrawingTransform(r,e){r.sort((t,n)=>{const i=t.transform,a=n.transform,{left:o=0,top:c=0,width:u=0,height:l=0}=i,{left:g=0,top:d=0,width:p=0,height:S=0}=a;switch(e){case R.left:return o-g;case R.center:return o+u/2-(g+p/2);case R.right:return o+u-(g+p);case R.top:return c-d;case R.middle:return c+l/2-(d+S/2);case R.bottom:return c+l-(d+S);case R.horizon:return o+u/2-(g+p/2);case R.vertical:return c+l/2-(d+S/2);default:return 0}})}_drawingArrangeListener(){this.disposeWithMe(this._drawingManagerService.order$.subscribe(r=>{this._drawingArrange(r)}))}_drawingArrange(r){const{unitId:e,subUnitId:t,drawingIds:n}=r,i=this._getSceneAndTransformerByDrawingSearch(e);if(i==null)return;const{scene:a}=i;n.forEach(o=>{const c=M.getDrawingShapeKeyByDrawingSearch({unitId:e,subUnitId:t,drawingId:o}),u=a.fuzzyMathObjects(c,!0);if(u==null||u.length===0)return;const l=this._drawingManagerService.getDrawingOrder(e,t).indexOf(o);for(const g of u)g.setProps({zIndex:l}),g.makeDirty()})}_drawingAddListener(){this.disposeWithMe(this._drawingManagerService.add$.subscribe(r=>{this._insertDrawing(r)}))}_insertDrawing(r){const e=[];r.forEach(t=>{const{unitId:n}=t;if(this._drawingManagerService.getDrawingByParam(t)==null)return;const a=this._getSceneAndTransformerByDrawingSearch(n);if(a==null)return;const{scene:o}=a;e.includes(o)||e.push(o)}),e.forEach(t=>{this._sceneListenerOnDrawingMap.has(t)||(this._addListenerOnDrawing(t),this._sceneListenerOnDrawingMap.add(t))})}_drawingRemoveListener(){this.disposeWithMe(this._drawingManagerService.remove$.subscribe(r=>{r.forEach(e=>{var l;const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._getSceneAndTransformerByDrawingSearch(t);if(a==null)return;const{scene:o}=a,c=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),u=o.fuzzyMathObjects(c,!0);if(u.length>0){for(const g of u)g.dispose();(l=o.getTransformer())==null||l.clearSelectedObjects()}})}))}_drawingUpdateListener(){this.disposeWithMe(this._drawingManagerService.update$.subscribe(r=>{r.forEach(e=>{var T;const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._drawingManagerService.getDrawingByParam(e);if(a==null)return;const{transform:o,drawingType:c}=a,u=this._getSceneAndTransformerByDrawingSearch(t);if(u==null)return;const{scene:l,transformer:g}=u;if(o==null)return!0;const{left:d=0,top:p=0,width:S=0,height:m=0,angle:v=0,flipX:C=!1,flipY:I=!1,skewX:O=0,skewY:P=0}=o,j=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),D=l.getObject(j);if(D==null)return!0;D.transformByState({left:d,top:p,width:S,height:m,angle:v,flipX:C,flipY:I,skewX:O,skewY:P}),(T=l.getTransformer())==null||T.debounceRefreshControls()})}))}_drawingRefreshListener(){this.disposeWithMe(this._drawingManagerService.refreshTransform$.subscribe(r=>{r.forEach(e=>{const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._getSceneAndTransformerByDrawingSearch(t);if(a==null)return;const o=this._drawingManagerService.getDrawingByParam(e);if(o==null)return;const{transform:c}=o,{scene:u}=a,l=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),g=u.getObject(l);if(g==null||c==null)return!0;const{left:d=0,top:p=0,width:S=0,height:m=0,angle:v=0,flipX:C=!1,flipY:I=!1,skewX:O=0,skewY:P=0}=c;g.transformByState({left:d,top:p,width:S,height:m,angle:v,flipX:C,flipY:I,skewX:O,skewY:P})})}))}_drawingVisibleListener(){this.disposeWithMe(this._drawingManagerService.visible$.subscribe(r=>{r.forEach(e=>{const{unitId:t,subUnitId:n,drawingId:i,visible:a}=e,o=this._getSceneAndTransformerByDrawingSearch(t);if(o==null)return;const{scene:c}=o,u=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),l=c.getObject(u);if(l==null)return!0;a?l.show():l.hide()})}))}_filterUpdateParams(r,e){return r.filter((t,n)=>{if(t==null)return!1;const{transform:i}=t;return h.checkIfMove(i,e==null?void 0:e[n])})}_addListenerOnDrawing(r){const e=r.getTransformerByCreate();let t=null;this.disposeWithMe(h.toDisposable(e.changeStart$.subscribe(n=>{const{objects:i}=n,a=Array.from(i.values()),o=[];t=a.map(c=>{const{left:u,top:l,height:g,width:d,angle:p,oKey:S,isInGroup:m}=c,v=this._drawingManagerService.getDrawingOKey(S);if(m||c instanceof b.Group){let C=c.ancestorGroup;if(C==null&&c instanceof b.Group&&(C=c),C==null)return null;const I=this._drawingManagerService.getDrawingOKey(C.oKey);if(I){const{unitId:O,subUnitId:P,drawingId:j}=I;o.push({unitId:O,subUnitId:P,drawingId:j});const{left:D,top:T,height:E,width:N,angle:U}=C;return{left:D,top:T,height:E,width:N,angle:U}}}else if(v!=null){const{unitId:C,subUnitId:I,drawingId:O}=v;return o.push({unitId:C,subUnitId:I,drawingId:O}),{left:u,top:l,height:g,width:d,angle:p}}return null}).filter(c=>c!=null),o.length>0?this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,o):this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,[])}))),this.disposeWithMe(h.toDisposable(e.changeEnd$.subscribe(n=>{const{objects:i}=n,a=this._filterUpdateParams(le(i,this._drawingManagerService),t);a.length>0&&this._drawingManagerService.featurePluginUpdateNotification(a)})))}};Se=ct([we(0,h.IUniverInstanceService),we(1,h.ICommandService),we(2,b.IRenderManagerService),we(3,M.IDrawingManagerService)],Se);class ue extends b.Shape{constructor(e,t){t==null&&(t={}),t.transformerConfig={keepRatio:!1,isCropper:!0,anchorFill:"rgb(0, 0, 0)",anchorStroke:"rgb(255, 255, 255)",anchorSize:24};super(e,t);Q(this,"_srcRect");Q(this,"_prstGeom");Q(this,"_applyTransform");Q(this,"_dragPadding",8);Q(this,"_cacheCanvas");t!=null&&t.srcRect&&(this._srcRect=t.srcRect),t!=null&&t.prstGeom&&(this._prstGeom=t.prstGeom),t!=null&&t.applyTransform&&(this._applyTransform=t.applyTransform),t!=null&&t.dragPadding&&(this._dragPadding=t.dragPadding),this._applyProps()}refreshSrcRect(e,t){this._srcRect=e,this._applyTransform=t,this._applyProps()}get srcRect(){return this._srcRect}dispose(){var e;super.dispose(),(e=this._cacheCanvas)==null||e.dispose(),this._srcRect=null}isHit(e){const t=this.getInverseCoord(e);return t.x>=-this.strokeWidth/2&&t.x<=this.width+this.strokeWidth/2&&t.y>=-this.strokeWidth/2&&t.y<=this.height+this.strokeWidth/2&&!this._inSurround(t)}_inSurround(e){const t=this._dragPadding;return e.x>=t-this.strokeWidth/2&&e.x<=this.width+this.strokeWidth/2-t&&e.y>=t-this.strokeWidth/2&&e.y<=this.height+this.strokeWidth/2-t}render(e,t){return this.visible?(e.save(),this._draw(e),e.restore(),this.makeDirty(!1),this):(this.makeDirty(!1),this)}_draw(e){var c,u;const n=this.getScene().getEngine(),{width:i,height:a}=n;this._initialCacheCanvas(),(c=this._cacheCanvas)==null||c.clear();const o=(u=this._cacheCanvas)==null?void 0:u.getContext();o!=null&&(o.save(),b.Rect.drawWith(o,{left:0,top:0,width:i,height:a,fill:"rgba(0, 0, 0, 0.5)"}),o.setTransform(e.getTransform()),this._clipForApplyObject(o),this._applyCache(e),o.restore())}_clipForApplyObject(e){let t=0;if(this._prstGeom!=null&&(t=1),e.globalCompositeOperation="destination-out",e.beginPath(),t===0){const n=this.transform.getMatrix();e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),e.rect(0,0,this.width,this.height),e.fill()}}_applyProps(){if(this._applyTransform==null)return;let e=0,t=0,n=0,i=0;const{left:a=0,top:o=0,width:c=0,height:u=0,angle:l}=this._applyTransform;if(this._srcRect!=null){const{left:p=0,top:S=0,right:m=0,bottom:v=0}=this._srcRect;e=p,t=S,n=m,i=v}const g=a+e,d=o+t;this.transformByState({left:g,top:d,width:a+c-n-g,height:o+u-i-d,angle:l})}_applyCache(e){if(!e||this._cacheCanvas==null)return;const t=this._cacheCanvas.getContext();t.save(),e.save(),e.setTransform(1,0,0,1,0,0),t.setTransform(1,0,0,1,0,0),e.drawImage(this._cacheCanvas.getCanvasEle(),0,0),e.restore(),t.restore()}_initialCacheCanvas(){if(this._cacheCanvas!=null)return;const e=this.getScene();if(e==null)return;this._cacheCanvas=new b.Canvas;const t=e.getEngine();this._cacheCanvas.setSize(t.width,t.height),t.onTransformChange$.subscribeEvent(()=>{var n;(n=this._cacheCanvas)==null||n.setSize(t.width,t.height),this.makeDirty(!0)})}}var lt=Object.getOwnPropertyDescriptor,ut=(s,r,e,t)=>{for(var n=t>1?void 0:t?lt(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},se=(s,r)=>(e,t)=>r(e,t,s);let _e=class extends h.Disposable{constructor(r,e,t,n,i,a){super();Q(this,"_sceneListenerOnImageMap",new WeakSet);this._commandService=r,this._drawingManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._messageService=i,this._localeService=a,this._init()}_init(){this._initOpenCrop(),this._initCloseCrop(),this._initAutoCrop()}_initAutoCrop(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{if(r.id!==ce.id)return;const e=r.params;if(e==null)return;const{cropType:t}=e,n=this._drawingManagerService.getFocusDrawings();if(n.length!==1)return;const i=n[0],{unitId:a,subUnitId:o,drawingId:c}=i,u=this._renderManagerService.getRenderById(a),l=u==null?void 0:u.scene;if(l==null)return!0;this._searchCropObject(l)!=null&&this._commandService.syncExecuteCommand(ee.id,{isAuto:!0});const d=M.getDrawingShapeKeyByDrawingSearch({unitId:a,subUnitId:o,drawingId:c}),p=l.getObject(d);if(!(p instanceof b.Image)){this._messageService.show({type:B.MessageType.Error,content:this._localeService.t("image-cropper.error")});return}p!=null&&(this._updateCropperObject(t,p),this._commandService.executeCommand(me.id,{unitId:a,subUnitId:o,drawingId:c}))}))}_calculateSrcRectByRatio(r,e,t,n,i,a){const o=t/n,c=i/a;let u=t,l=n;o>c?u=n*c:l=t/c;const g=(t-u)/2,d=(n-l)/2;return{left:b.precisionTo(g,1),top:b.precisionTo(d,1),right:b.precisionTo(t-(g+u),1),bottom:b.precisionTo(n-(d+l),1)}}_updateCropperObject(r,e){const{left:t,top:n,width:i,height:a}=e.calculateTransformWithSrcRect();let o;switch(r){case L.R1_1:o=this._calculateSrcRectByRatio(t,n,i,a,1,1);break;case L.R16_9:o=this._calculateSrcRectByRatio(t,n,i,a,16,9);break;case L.R9_16:o=this._calculateSrcRectByRatio(t,n,i,a,9,16);break;case L.R5_4:o=this._calculateSrcRectByRatio(t,n,i,a,5,4);break;case L.R4_5:o=this._calculateSrcRectByRatio(t,n,i,a,4,5);break;case L.R4_3:o=this._calculateSrcRectByRatio(t,n,i,a,4,3);break;case L.R3_4:o=this._calculateSrcRectByRatio(t,n,i,a,3,4);break;case L.R3_2:o=this._calculateSrcRectByRatio(t,n,i,a,3,2);break;case L.R2_3:o=this._calculateSrcRectByRatio(t,n,i,a,2,3);break;case L.FREE:}if(o==null)return;e.setSrcRect(o);const{left:c=0,top:u=0,bottom:l=0,right:g=0}=o;e.transformByStateCloseCropper({left:t+c,top:n+u,width:i-g-c,height:a-l-u})}_initOpenCrop(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{if(r.id!==me.id)return;const e=r.params;if(e==null)return;const{unitId:t,subUnitId:n,drawingId:i}=e,a=this._renderManagerService.getRenderById(t),o=a==null?void 0:a.scene;if(o==null)return!0;if(this._sceneListenerOnImageMap.has(o)||(this._addListenerOnImage(o),this._sceneListenerOnImageMap.add(o)),this._drawingManagerService.getDrawingByParam({unitId:t,subUnitId:n,drawingId:i})==null)return;const u=M.getDrawingShapeKeyByDrawingSearch({unitId:t,subUnitId:n,drawingId:i}),l=o.getObject(u);if(l==null)return;if(!(l instanceof b.Image)){this._messageService.show({type:B.MessageType.Error,content:this._localeService.t("image-cropper.error")});return}const g=o.getTransformer();g==null||g.clearControls();const d=new ue(`${u}-crop`,{srcRect:l.srcRect,prstGeom:l.prstGeom,applyTransform:l.calculateTransformWithSrcRect()});o.addObject(d,l.getLayerIndex()+1).attachTransformerTo(d),g==null||g.createControlForCopper(d),this._addHoverForImageCopper(d),l.openRenderByCropper(),g==null||g.refreshControls(),d.makeDirty(!0),this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,[{unitId:t,subUnitId:n,drawingId:i}])}))}_searchCropObject(r){const e=r.getAllObjectsByOrder();for(const t of e)if(t instanceof ue)return t}_initCloseCrop(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id!==ee.id)return;const t=this._univerInstanceService.getFocusedUnit();if(t==null)return;const n=t.getUnitId(),i=this._renderManagerService.getRenderById(n),a=i==null?void 0:i.scene;if(a==null)return!0;const o=this._searchCropObject(a);if(o==null)return;const c=this._getApplyObjectByCropObject(o);if(c==null)return;const u=a.getTransformerByCreate();u.detachFrom(o),u.clearCopperControl();const l=this._getSrcRectByTransformState(c,o),g=this._drawingManagerService.getDrawingOKey(c.oKey);if(g!=null){const{left:d,top:p,height:S,width:m}=o;this._drawingManagerService.featurePluginUpdateNotification([{...g,transform:{...g.transform,left:d,top:p,height:S,width:m},srcRect:l.srcRectAngle}])}c.setSrcRect({...l.srcRectAngle}),c.closeRenderByCropper(),c.makeDirty(!0),o==null||o.dispose()}));const r=this._univerInstanceService.getCurrentTypeOfUnit$(h.UniverInstanceType.UNIVER_SHEET).pipe(te.switchMap(e=>e?e.activeSheet$:te.of(null)));this.disposeWithMe(r.subscribe(()=>{this._commandService.syncExecuteCommand(ee.id)}))}_getApplyObjectByCropObject(r){const e=r.oKey,t=e.slice(0,e.length-5),n=r.getScene();if(!n)return null;const i=n.getObject(t);return i==null?null:i}_addListenerOnImage(r){const e=r.getTransformerByCreate();let t=null;this.disposeWithMe(e.changeStart$.subscribe(n=>{const{objects:i}=n,a=i.values().next().value;if(a==null||!(a instanceof ue))return;const{left:o,top:c,height:u,width:l,angle:g}=a;t={left:o,top:c,height:u,width:l,angle:g},e.clearCopperControl()})),this.disposeWithMe(e.changeEnd$.subscribe(n=>{const{objects:i}=n,a=i.values().next().value;if(a==null||!(a instanceof ue))return;const{left:o,top:c,height:u,width:l,angle:g}=a;if(!h.checkIfMove({left:o,top:c,height:u,width:l,angle:g},t))return;const d=this._getApplyObjectByCropObject(a);if(d==null)return;const p=this._getSrcRectByTransformState(d,a);a.refreshSrcRect(p.srcRect,d.getState()),e.createControlForCopper(a)})),this._endCropListener(r)}_addHoverForImageCopper(r){this.disposeWithMe(r.onPointerEnter$.subscribeEvent(()=>{r.cursor=b.CURSOR_TYPE.MOVE})),this.disposeWithMe(r.onPointerLeave$.subscribeEvent(()=>{r.cursor=b.CURSOR_TYPE.DEFAULT}))}_endCropListener(r){const e=r.getTransformerByCreate();this.disposeWithMe(e.clearControl$.subscribe(t=>{t===!0&&this._commandService.syncExecuteCommand(ee.id)}))}_getSrcRectByTransformState(r,e){const{left:t,top:n,height:i,width:a,strokeWidth:o,angle:c}=e,{left:u,top:l,width:g,height:d,angle:p,strokeWidth:S}=r,m=t-u,v=n-l,C={left:m,top:v,right:g-m-a,bottom:d-v-i},I={...C};if(p!==0){const O=t+a/2,P=n+i/2,j=new b.Vector2(O,P),D=g/2+u,T=d/2+l,E=new b.Vector2(D,T),N=new b.Vector2(u,l);N.rotateByPoint(b.degToRad(p),E);const U=N.clone();U.rotateByPoint(b.degToRad(-p),j);const $=t-U.x,x=n-U.y;I.left=$,I.top=x,I.right=g-$-a,I.bottom=d-x-i}return{srcRect:C,srcRectAngle:I}}};_e=ut([se(0,h.ICommandService),se(1,M.IDrawingManagerService),se(2,b.IRenderManagerService),se(3,h.IUniverInstanceService),se(4,H.IMessageService),se(5,h.Inject(h.LocaleService))],_e);var gt=Object.getOwnPropertyDescriptor,dt=(s,r,e,t)=>{for(var n=t>1?void 0:t?gt(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},ge=(s,r)=>(e,t)=>r(e,t,s);y.DrawingRenderService=class{constructor(r,e,t,n,i){this._drawingManagerService=r,this._imageIoService=e,this._galleryService=t,this._urlImageService=n,this._univerInstanceService=i}async renderImages(r,e){const{transform:t,drawingType:n,source:i,imageSourceType:a,srcRect:o,prstGeom:c,groupId:u,unitId:l,subUnitId:g,drawingId:d,isMultiTransform:p,transforms:S}=r;if(n!==h.DrawingTypeEnum.DRAWING_IMAGE||!this._drawingManagerService.getDrawingVisible()||t==null)return;const m=p&&S?S:[t],v=[];for(const C of m){const{left:I,top:O,width:P,height:j,angle:D,flipX:T,flipY:E,skewX:N,skewY:U}=C,$=m.indexOf(C),x=M.getDrawingShapeKeyByDrawingSearch({unitId:l,subUnitId:g,drawingId:d},p?$:void 0),V=e.getObject(x);if(V!=null){V.transformByState({left:I,top:O,width:P,height:j,angle:D,flipX:T,flipY:E,skewX:N,skewY:U});continue}if(!this._drawingManagerService.getDrawingVisible()||g!==this._getActiveSheetId())continue;const Y=this._drawingManagerService.getDrawingOrder(l,g),oe=Y.indexOf(d),X={...C,zIndex:oe===-1?Y.length-1:oe},ne=this._imageIoService.getImageSourceCache(i,a);let ie=!1;if(ne!=null)X.image=ne;else if(a===M.ImageSourceType.UUID)try{X.url=await this._imageIoService.getImage(i)}catch(de){console.error(de);continue}else if(a===M.ImageSourceType.URL){try{X.url=await this._urlImageService.getImage(i)}catch(de){console.error(de),X.url=i}ie=!0}else X.url=i,ie=!0;if(e.getObject(x))continue;X.printable=!0;const q=new b.Image(x,X);ie&&this._imageIoService.addImageSourceCache(i,a,q.getNative()),e.addObject(q,b.DRAWING_OBJECT_LAYER_INDEX),this._drawingManagerService.getDrawingEditable()&&e.attachTransformerTo(q),u&&Me({drawingId:u,unitId:l,subUnitId:g},q,e,this._drawingManagerService),c!=null&&q.setPrstGeom(c),o!=null&&q.setSrcRect(o),v.push(q)}return v}_getActiveSheetId(){var r,e;return(e=(r=this._univerInstanceService.getCurrentUnitOfType(h.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getActiveSheet())==null?void 0:e.getSheetId()}renderFloatDom(r,e){const{transform:t,drawingType:n,groupId:i,unitId:a,subUnitId:o,drawingId:c,isMultiTransform:u,transforms:l}=r;if(n!==h.DrawingTypeEnum.DRAWING_DOM||!this._drawingManagerService.getDrawingVisible()||t==null)return;const g=u&&l?l:[t],d=[];for(const p of g){const{left:S,top:m,width:v,height:C,angle:I,flipX:O,flipY:P,skewX:j,skewY:D}=p,T=g.indexOf(p),E=M.getDrawingShapeKeyByDrawingSearch({unitId:a,subUnitId:o,drawingId:c},u?T:void 0),N=e.getObject(E);if(N!=null){N.transformByState({left:S,top:m,width:v,height:C,angle:I,flipX:O,flipY:P,skewX:j,skewY:D});continue}const U=this._drawingManagerService.getDrawingOrder(a,o),$=U.indexOf(c),x={...p,zIndex:$===-1?U.length-1:$};if(e.getObject(E))continue;x.printable=!1;const V=new b.Rect(E,x);this._drawingManagerService.getDrawingVisible()&&(e.addObject(V,b.DRAWING_OBJECT_LAYER_INDEX),this._drawingManagerService.getDrawingEditable()&&r.allowTransform!==!1&&e.attachTransformerTo(V),i&&Me({drawingId:i,unitId:a,subUnitId:o},V,e,this._drawingManagerService),d.push(V))}return d}renderDrawing(r,e){const t=this._drawingManagerService.getDrawingByParam(r);if(t!=null&&t.drawingType===h.DrawingTypeEnum.DRAWING_IMAGE)return this.renderImages(t,e)}previewImage(r,e,t,n){this._galleryService.open({images:[e],onOpenChange:i=>{i||this._galleryService.close()}})}_adjustImageSize(r,e,t,n){if(r<=t&&e<=n)return{width:r,height:e};const i=t/r,a=n/e,o=Math.min(i,a);return{width:Math.floor(r*o),height:Math.floor(e*o)}}},y.DrawingRenderService=dt([ge(0,M.IDrawingManagerService),ge(1,M.IImageIoService),ge(2,H.IGalleryService),ge(3,h.IURLImageService),ge(4,h.IUniverInstanceService)],y.DrawingRenderService);var ht=Object.getOwnPropertyDescriptor,ft=(s,r,e,t)=>{for(var n=t>1?void 0:t?ht(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},re=(s,r)=>(e,t)=>r(e,t,s);let Ce=class extends h.Disposable{constructor(s,r,e,t,n,i,a){super(),this._commandService=s,this._renderManagerService=r,this._drawingManagerService=e,this._dialogService=t,this._imageIoService=n,this._currentUniverService=i,this._drawingRenderService=a,this._initialize()}dispose(){super.dispose()}_initialize(){this._drawingAddListener(),this._commandExecutedListener(),this._imageUpdateListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(s=>{if(s.id===De.id){const r=s.params;if(r==null)return;this._resetImageSize(r)}}))}_getSceneAndTransformerByDrawingSearch(s){if(s==null)return;const r=this._renderManagerService.getRenderById(s),e=r==null?void 0:r.scene;if(e==null)return null;const t=e.getTransformerByCreate();return{scene:e,transformer:t}}_resetImageSize(s){const r=[],e=[];s.forEach(t=>{const{unitId:n,subUnitId:i,drawingId:a}=t,o=this._getSceneAndTransformerByDrawingSearch(n);if(o==null)return;const{scene:c}=o,u=M.getDrawingShapeKeyByDrawingSearch({unitId:n,subUnitId:i,drawingId:a}),l=c.getObject(u);if(l==null)return!0;const g=this._drawingManagerService.getDrawingByParam(t);if(g==null)return!0;if(g.drawingType!==h.DrawingTypeEnum.DRAWING_IMAGE)return;l.resetSize();const{width:d,height:p}=l.getNativeSize();e.includes(c)===!1&&e.push(c),r.push({...g,transform:{...g.transform,height:p,width:d,angle:0},srcRect:null,prstGeom:null})}),this._drawingManagerService.featurePluginUpdateNotification(r),e.forEach(t=>{t.getTransformerByCreate().refreshControls().changeNotification()}),this._commandService.syncExecuteCommand(M.SetDrawingSelectedOperation.id,s)}_drawingAddListener(){this.disposeWithMe(this._drawingManagerService.add$.pipe(te.bufferTime(33),te.filter(s=>s.length>0),te.map(s=>s.flat()),te.map(s=>{const r=new Map;for(const e of s)r.set(`${e.unitId}|${e.subUnitId}|${e.drawingId}`,e);return[...r.values()]}),te.filter(s=>s.length>0)).subscribe(s=>{this._insertImages(s)}))}_insertImages(s){s.forEach(async r=>{var c;const{unitId:e,subUnitId:t}=r,n=this._getSceneAndTransformerByDrawingSearch(e),i=(c=Oe(this._currentUniverService,e))==null?void 0:c.subUnitId;if(n==null||i!==t)return;const a=this._drawingManagerService.getDrawingByParam(r);if(a==null)return;const o=await this._drawingRenderService.renderImages(a,n.scene);if(this._drawingManagerService.refreshTransform([a]),!(o==null||o.length===0))for(const u of o)this._addHoverForImage(u),this._addDialogForImage(u)})}_imageUpdateListener(){this.disposeWithMe(this._drawingManagerService.update$.subscribe(s=>{s.forEach(r=>{const{unitId:e,subUnitId:t,drawingId:n}=r,i=this._drawingManagerService.getDrawingByParam(r);if(i==null)return;const{transform:a,drawingType:o,srcRect:c,prstGeom:u,source:l,imageSourceType:g}=i;if(o!==h.DrawingTypeEnum.DRAWING_IMAGE)return;const d=this._getSceneAndTransformerByDrawingSearch(e);if(d==null)return;const{scene:p,transformer:S}=d;if(a==null)return!0;const m=M.getDrawingShapeKeyByDrawingSearch({unitId:e,subUnitId:t,drawingId:n}),v=p.getObject(m);if(v==null)return!0;v.setSrcRect(c),v.setPrstGeom(u),l!=null&&l.length>0&&(g===h.ImageSourceType.BASE64||g===h.ImageSourceType.URL)&&v.changeSource(l)})}))}_addHoverForImage(s){this.disposeWithMe(h.toDisposable(s.onPointerEnter$.subscribeEvent(()=>{s.cursor=b.CURSOR_TYPE.GRAB}))),this.disposeWithMe(h.toDisposable(s.onPointerLeave$.subscribeEvent(()=>{s.cursor=b.CURSOR_TYPE.DEFAULT})))}_addDialogForImage(s){this.disposeWithMe(h.toDisposable(s.onDblclick$.subscribeEvent(()=>{const r=`${s.oKey}-viewer-dialog`;this._drawingRenderService.previewImage(r,s.getNative().src,s.getNativeSize().width,s.getNativeSize().height)})))}};Ce=ft([re(0,h.ICommandService),re(1,b.IRenderManagerService),re(2,M.IDrawingManagerService),re(3,H.IDialogService),re(4,M.IImageIoService),re(5,h.IUniverInstanceService),re(6,h.Inject(y.DrawingRenderService))],Ce);var pt=Object.getOwnPropertyDescriptor,mt=(s,r,e,t)=>{for(var n=t>1?void 0:t?pt(r,e):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(n=a(n)||n);return n},Ve=(s,r)=>(e,t)=>r(e,t,s);const vt="UNIVER_DRAWING_UI_PLUGIN";y.UniverDrawingUIPlugin=(Ee=class extends h.Plugin{constructor(r=Te,e,t){super(),this._config=r,this._injector=e,this._configService=t;const{menu:n,...i}=h.merge({},Te,this._config);n&&this._configService.setConfig("menu",n,{merge:!0}),this._configService.setConfig(Ze,i)}onStarting(){this._initDependencies()}onRendered(){this._injector.get(Se),this._injector.get(ve),this._injector.get(_e),this._injector.get(Ce)}_initDependencies(){[[y.DrawingRenderService],[Se],[ve],[_e],[Ce]].forEach(e=>this._injector.add(e))}},Q(Ee,"pluginName",vt),Ee),y.UniverDrawingUIPlugin=mt([Ve(1,h.Inject(h.Injector)),Ve(2,h.IConfigService)],y.UniverDrawingUIPlugin);const wt=s=>{const r=H.useDependency(h.ICommandService),e=H.useDependency(h.LocaleService),{alignShow:t}=s,[n,i]=_.useState(R.default),a=[{label:e.t("image-panel.align.default"),value:R.default},{options:[{label:e.t("image-panel.align.left"),value:R.left},{label:e.t("image-panel.align.center"),value:R.center},{label:e.t("image-panel.align.right"),value:R.right}]},{options:[{label:e.t("image-panel.align.top"),value:R.top},{label:e.t("image-panel.align.middle"),value:R.middle},{label:e.t("image-panel.align.bottom"),value:R.bottom}]},{options:[{label:e.t("image-panel.align.horizon"),value:R.horizon},{label:e.t("image-panel.align.vertical"),value:R.vertical}]}];function o(c){i(c),r.executeCommand(pe.id,{alignType:c})}return f.jsxs("div",{className:B.clsx("univer-relative univer-w-full",{"univer-hidden":!t}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:e.t("image-panel.align.title")})}),f.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:f.jsx("div",{className:"univer-w-full univer-text-gray-900 dark:!univer-text-white",children:f.jsx(B.Select,{value:n,options:a,onChange:o})})})]})},St=s=>{const{arrangeShow:r,drawings:e}=s,t=H.useDependency(h.LocaleService),n=H.useDependency(M.IDrawingManagerService),[i,a]=_.useState(e);_.useEffect(()=>{const c=n.focus$.subscribe(u=>{a(u)});return()=>{c.unsubscribe()}},[]);const o=c=>{const u=i[0].unitId,l=i[0].subUnitId,g=i.map(d=>d.drawingId);n.featurePluginOrderUpdateNotification({unitId:u,subUnitId:l,drawingIds:g,arrangeType:c})};return f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":!r}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:t.t("image-panel.arrange.title")})}),f.jsxs("div",{className:"univer-grid univer-grid-cols-2 univer-gap-2",children:[f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.forward)},children:[f.jsx(Le,{}),t.t("image-panel.arrange.forward")]}),f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.backward)},children:[f.jsx(Ae,{}),t.t("image-panel.arrange.backward")]}),f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.front)},children:[f.jsx(He,{}),t.t("image-panel.arrange.front")]}),f.jsxs(B.Button,{onClick:()=>{o(h.ArrangeTypeEnum.back)},children:[f.jsx(Ne,{}),t.t("image-panel.arrange.back")]})]})]})},_t=s=>{const r=H.useDependency(h.LocaleService),e=H.useDependency(b.IRenderManagerService),t=H.useDependency(M.IDrawingManagerService),{hasGroup:n,drawings:i}=s,[a,o]=_.useState(!1),[c,u]=_.useState(!0),[l,g]=_.useState(!0),d=()=>{const m=t.getFocusDrawings(),{unitId:v,subUnitId:C}=m[0],I=h.generateRandomId(10),O=b.getGroupState(0,0,m.map(D=>D.transform||{})),P={unitId:v,subUnitId:C,drawingId:I,drawingType:h.DrawingTypeEnum.DRAWING_GROUP,transform:O},j=m.map(D=>{const T=D.transform||{left:0,top:0},{unitId:E,subUnitId:N,drawingId:U}=D;return{unitId:E,subUnitId:N,drawingId:U,transform:{...T,left:T.left-O.left,top:T.top-O.top},groupId:I}});t.featurePluginGroupUpdateNotification([{parent:P,children:j}])},p=m=>{if(m.drawingType!==h.DrawingTypeEnum.DRAWING_GROUP)return;const{unitId:v,subUnitId:C,drawingId:I,transform:O={width:0,height:0}}=m;if(O==null)return;const P=t.getDrawingsByGroup({unitId:v,subUnitId:C,drawingId:I});if(P.length===0)return;const j=P.map(D=>{const{transform:T}=D,{unitId:E,subUnitId:N,drawingId:U}=D,$=b.transformObjectOutOfGroup(T||{},O,O.width||0,O.height||0);return{unitId:E,subUnitId:N,drawingId:U,transform:{...T,...$},groupId:void 0}});return{parent:m,children:j}},S=()=>{const v=t.getFocusDrawings().map(C=>p(C)).filter(C=>C!=null);v.length!==0&&t.featurePluginUngroupUpdateNotification(v)};return _.useEffect(()=>{const m=i[0];if(m==null)return;const{unitId:v}=m,C=e.getRenderById(v),I=C==null?void 0:C.scene;if(I==null)return;const O=I.getTransformerByCreate(),P=O.clearControl$.subscribe(D=>{D===!0&&o(!1)}),j=O.changeStart$.subscribe(D=>{const{objects:T}=D,E=le(T,t),N=E.filter(V=>(V==null?void 0:V.drawingType)===h.DrawingTypeEnum.DRAWING_GROUP);let U=!1,$=!1;E.length>1&&(U=!0),N.length>0&&($=!0),o(U||$),u(U),g($)});return()=>{j.unsubscribe(),P.unsubscribe()}},[]),f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":n===!0&&a===!1||n===!1}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:r.t("image-panel.group.title")})}),f.jsxs("div",{className:"univer-flex univer-items-center univer-justify-center univer-gap-2",children:[f.jsxs(B.Button,{className:B.clsx({"univer-hidden":!c}),onClick:d,children:[f.jsx(Re,{}),r.t("image-panel.group.group")]}),f.jsxs(B.Button,{className:B.clsx({"univer-hidden":!l}),onClick:S,children:[f.jsx(xe,{}),r.t("image-panel.group.unGroup")]})]})]})},Ie=20,ye=20,We=[-360,360],be=300,Ct=s=>{var Ke;const r=H.useDependency(h.LocaleService),e=H.useDependency(M.IDrawingManagerService),t=H.useDependency(b.IRenderManagerService),{drawings:n,transformShow:i}=s,a=n[0];if(a==null)return;const o=a.transform;if(o==null)return;const{unitId:c,subUnitId:u,drawingId:l,drawingType:g}=a,d=t.getRenderById(c),p=d==null?void 0:d.scene;if(p==null)return;const S=(Ke=p.getEngine())==null?void 0:Ke.activeScene;if(S==null)return;const m=p.getTransformerByCreate(),{width:v=0,height:C=0,left:I=0,top:O=0,angle:P=0}=o,[j,D]=_.useState(v),[T,E]=_.useState(C),[N,U]=_.useState(I),[$,x]=_.useState(O),[V,Y]=_.useState(P),[oe,X]=_.useState(m.keepRatio),ne=(w,A,G,W)=>{const{width:k,height:J}=S,{ancestorLeft:K,ancestorTop:Z}=p;let z=w,ae=A,he=G,fe=W;return w+K<0&&(z=-K),A+Z<0&&(ae=-Z),he=k-z-K,he<Ie&&(he=Ie),fe=J-ae-Z,fe<ye&&(fe=ye),w+he+K>k&&(z=k-G-K),A+fe+Z>J&&(ae=J-W-Z),{limitLeft:z,limitTop:ae,limitWidth:he,limitHeight:fe}},ie=w=>{const{objects:A}=w,G=le(A,e);if(G.length!==1)return;const W=G[0];if(W==null)return;const{transform:k}=W;if(k==null)return;const{width:J,height:K,left:Z,top:z,angle:ae}=k;J!=null&&D(J),K!=null&&E(K),Z!=null&&U(Z),z!=null&&x(z),ae!=null&&Y(ae)};_.useEffect(()=>{const w=[m.changeStart$.subscribe(A=>{ie(A)}),m.changing$.subscribe(A=>{ie(A)}),m.changeEnd$.subscribe(A=>{ie(A)}),e.focus$.subscribe(A=>{if(A.length!==1)return;const G=e.getDrawingByParam(A[0]);if(G==null)return;const W=G.transform;if(W==null)return;const{width:k,height:J,left:K,top:Z,angle:z}=W;k!=null&&D(k),J!=null&&E(J),K!=null&&U(K),Z!=null&&x(Z),z!=null&&Y(z)})];return()=>{w.forEach(A=>A.unsubscribe())}},[]);const q=h.debounce(w=>{if(w==null)return;const{limitWidth:A,limitHeight:G}=ne(N,$,w,T);w=Math.min(w,A);const W={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{width:w}};if(oe){let k=w/j*T;if(k=Math.max(k,ye),k>G)return;E(k),W.transform.height=k}D(w),e.featurePluginUpdateNotification([W]),m.refreshControls().changeNotification()},be),de=h.debounce(w=>{if(w==null)return;const{limitHeight:A,limitWidth:G}=ne(N,$,j,w);w=Math.min(w,A);const W={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{height:w}};if(oe){let k=w/T*j;if(k=Math.max(k,Ie),k>G)return;D(k),W.transform.width=k}E(w),e.featurePluginUpdateNotification([W]),m.refreshControls().changeNotification()},be),bt=h.debounce(w=>{if(w==null)return;const{limitLeft:A}=ne(w,$,j,T);w=A;const G={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{left:w}};U(w),e.featurePluginUpdateNotification([G]),m.refreshControls().changeNotification()},be),Dt=h.debounce(w=>{if(w==null)return;const{limitTop:A}=ne(N,w,j,T);w=A;const G={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{top:w}};x(w),e.featurePluginUpdateNotification([G]),m.refreshControls().changeNotification()},be),Mt=w=>{if(w==null)return;const A={unitId:c,subUnitId:u,drawingId:l,drawingType:g,transform:{angle:w}};Y(w),e.featurePluginUpdateNotification([A]),m.refreshControls().changeNotification()},Ot=w=>{X(w),m.keepRatio=w};return f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":!i}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:r.t("image-panel.transform.title")})}),f.jsxs("div",{className:"univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",children:[f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.width")}),f.jsx(B.InputNumber,{precision:1,value:j,min:Ie,onChange:w=>{q(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.height")}),f.jsx(B.InputNumber,{precision:1,value:T,min:ye,onChange:w=>{de(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.lock")}),f.jsx("div",{className:"univer-text-center",children:f.jsx(B.Checkbox,{checked:oe,onChange:Ot})})]})]}),f.jsxs("div",{className:"univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",children:[f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.x")}),f.jsx(B.InputNumber,{precision:1,value:N,onChange:w=>{bt(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.y")}),f.jsx(B.InputNumber,{precision:1,value:$,onChange:w=>{Dt(w)}})]}),f.jsxs("div",{children:[f.jsx("span",{children:r.t("image-panel.transform.rotate")}),f.jsx(B.InputNumber,{precision:1,value:V,min:We[0],max:We[1],onChange:Mt})]})]})]})},It=s=>{const r=H.useDependency(h.ICommandService),e=H.useDependency(h.LocaleService),{drawings:t,cropperShow:n}=s;if(t[0]==null)return;const[a,o]=_.useState(L.FREE),c=_.useRef(!1),u=[{label:e.t("image-panel.crop.mode"),value:L.FREE},{label:"1:1",value:L.R1_1},{label:"16:9",value:L.R16_9},{label:"9:16",value:L.R9_16},{label:"5:4",value:L.R5_4},{label:"4:5",value:L.R4_5},{label:"4:3",value:L.R4_3},{label:"3:4",value:L.R3_4},{label:"3:2",value:L.R3_2},{label:"2:3",value:L.R2_3}];_.useEffect(()=>{const d=r.onCommandExecuted(p=>{if(p.id===ee.id){const S=p.params;S!=null&&S.isAuto||(c.current=!1)}});return()=>{d==null||d.dispose()}},[]);function l(d){o(d),c.current&&r.executeCommand(ce.id,{cropType:d})}const g=d=>{r.executeCommand(ce.id,{cropType:d}),c.current=!0};return f.jsxs("div",{className:B.clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400",{"univer-hidden":!n}),children:[f.jsx("header",{className:"univer-text-gray-600 dark:!univer-text-gray-200",children:f.jsx("div",{children:e.t("image-panel.crop.title")})}),f.jsxs("div",{className:"univer-flex univer-items-center univer-justify-center univer-gap-2",children:[f.jsxs(B.Button,{onClick:()=>{g(a)},children:[f.jsx(Be,{}),e.t("image-panel.crop.start")]}),f.jsx(B.Select,{value:a,options:u,onChange:l})]})]})},yt=s=>{const r=H.useDependency(M.IDrawingManagerService),e=H.useDependency(b.IRenderManagerService),t=H.useDependency(h.LocaleService),{drawings:n,hasArrange:i=!0,hasTransform:a=!0,hasAlign:o=!0,hasCropper:c=!0,hasGroup:u=!0}=s,l=n[0];if(l==null)return;const{unitId:g}=l,d=e.getRenderById(g),p=d==null?void 0:d.scene;if(p==null)return;const S=p.getTransformerByCreate(),[m,v]=_.useState(!0),[C,I]=_.useState(!0),[O,P]=_.useState(!1),[j,D]=_.useState(!0),[T,E]=_.useState(!1);return _.useEffect(()=>{const N=S.clearControl$.subscribe(x=>{x===!0&&(v(!1),I(!1),P(!1),D(!1),E(!0))}),U=S.changeStart$.subscribe(x=>{const{objects:V}=x,Y=le(V,r);Y.length===0?(v(!1),I(!1),P(!1),D(!1),E(!0)):Y.length===1?(v(!0),I(!0),P(!1),D(!0),E(!1)):(v(!0),I(!1),P(!0),D(!1),E(!1))}),$=r.focus$.subscribe(x=>{x.length===0?(v(!1),I(!1),P(!1),D(!1),E(!0)):x.length===1?(v(!0),I(!0),P(!1),D(!0),E(!1)):(v(!0),I(!1),P(!0),D(!1),E(!1))});return()=>{U.unsubscribe(),N.unsubscribe(),$.unsubscribe()}},[]),f.jsxs(f.Fragment,{children:[f.jsx("div",{className:B.clsx("univer-h-full",{"univer-hidden":!T}),children:f.jsx("div",{className:"univer-flex univer-h-full univer-items-center univer-justify-center",children:f.jsx("span",{children:t.t("image-panel.null")})})}),f.jsx(St,{arrangeShow:i===!0?m:!1,drawings:n}),f.jsx(Ct,{transformShow:a===!0?C:!1,drawings:n}),f.jsx(wt,{alignShow:o===!0?O:!1,drawings:n}),f.jsx(It,{cropperShow:c===!0?j:!1,drawings:n}),f.jsx(_t,{hasGroup:u,drawings:n})]})};y.AutoImageCropOperation=ce,y.COMPONENT_IMAGE_POPUP_MENU=Ue,y.CloseImageCropOperation=ee,y.DrawingCommonPanel=yt,y.ImageCropperObject=ue,y.ImagePopupMenu=$e,y.ImageResetSizeOperation=De,y.OpenImageCropOperation=me,y.SetDrawingAlignOperation=pe,y.getCurrentUnitInfo=Oe,y.getUpdateParams=le,y.insertGroupObject=Me,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/docs-drawing/index
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @univerjs/drawing-ui/locale/sk-SK
|
|
2
|
+
(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDrawingUiSkSK=o())})(this,(function(){"use strict";return{"image-popup":{replace:"Nahradiť",delete:"Odstrániť",edit:"Upraviť",crop:"Orezať",reset:"Obnoviť veľkosť"},"image-cropper":{error:"Nedá sa orezať neobrázkový objekt."},"image-panel":{arrange:{title:"Usporiadať",forward:"Posunúť dopredu",backward:"Posunúť dozadu",front:"Presunúť do popredia",back:"Presunúť do pozadia"},transform:{title:"Transformovať",rotate:"Otočiť (°)",x:"X (px)",y:"Y (px)",width:"Šírka (px)",height:"Výška (px)",lock:"Uzamknúť pomer (%)"},crop:{title:"Orezanie",start:"Začať orezanie",mode:"Voľne"},group:{title:"Zoskupiť",group:"Zoskupiť",reGroup:"Znovu zoskupiť",unGroup:"Zrušiť zoskupenie"},align:{title:"Zarovnať",default:"Vyberte typ zarovnania",left:"Zarovnať doľava",center:"Zarovnať na stred",right:"Zarovnať doprava",top:"Zarovnať hore",middle:"Zarovnať na stred",bottom:"Zarovnať dole",horizon:"Rozložiť vodorovne",vertical:"Rozložiť zvisle"},null:"Nie je vybraný žiadny objekt"},"drawing-view":"Kresba",shortcut:{"drawing-move-down":"Posunúť kresbu nadol","drawing-move-up":"Posunúť kresbu nahor","drawing-move-left":"Posunúť kresbu doľava","drawing-move-right":"Posunúť kresbu doprava","drawing-delete":"Odstrániť kresbu"}}}));
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// @univerjs/docs-drawing-ui/locale/sk-SK
|
|
6
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverDocsDrawingUiSkSK=t())})(this,(function(){"use strict";return{docImage:{title:"Obrázok",upload:{float:"Vložiť obrázok"},panel:{title:"Upraviť obrázok"}},"image-popup":{replace:"Nahradiť",delete:"Odstrániť",edit:"Upraviť",crop:"Orezať",reset:"Obnoviť veľkosť"},"image-text-wrap":{title:"Obtekanie textu",wrappingStyle:"Štýl obtekania",square:"Obdĺžnikové",topAndBottom:"Hore a dole",inline:"V riadku s textom",behindText:"Za textom",inFrontText:"Pred textom",wrapText:"Obtekať text",bothSide:"Obe strany",leftOnly:"Len ľavá",rightOnly:"Len pravá",distanceFromText:"Vzdialenosť od textu",top:"Hore (px)",left:"Vľavo (px)",bottom:"Dole (px)",right:"Vpravo (px)"},"image-position":{title:"Pozícia",horizontal:"Vodorovne",vertical:"Zvisle",absolutePosition:"Absolútna pozícia (px)",relativePosition:"Relatívna pozícia",toTheRightOf:"vpravo od",relativeTo:"vzhľadom na",bellow:"pod",options:"Možnosti",moveObjectWithText:"Presunúť objekt s textom",column:"Stĺpec",margin:"Okraj",page:"Strana",line:"Riadok",paragraph:"Odsek"},"update-status":{exceedMaxSize:"Veľkosť obrázka prekračuje limit, limit je {0}M",invalidImageType:"Neplatný typ obrázka",exceedMaxCount:"Naraz možno nahrať iba {0} obrázkov",invalidImage:"Neplatný obrázok"}}}));
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// locale/sk-SK
|
|
10
|
+
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/docs-drawing-ui/locale/sk-SK"),require("@univerjs/drawing-ui/locale/sk-SK")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/docs-drawing-ui/locale/sk-SK","@univerjs/drawing-ui/locale/sk-SK"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetDocsDrawingSkSK=i(e.UniverCore,e.UniverDocsDrawingUiSkSK,e.UniverDrawingUiSkSK))})(this,(function(e,i,n){"use strict";return e.mergeLocales(i,n)}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-docs-drawing",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,18 +58,18 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/docs-drawing": "0.15.
|
|
62
|
-
"@univerjs/docs-drawing-ui": "0.15.
|
|
63
|
-
"@univerjs/drawing": "0.15.
|
|
64
|
-
"@univerjs/drawing-ui": "0.15.
|
|
61
|
+
"@univerjs/docs-drawing": "0.15.4",
|
|
62
|
+
"@univerjs/docs-drawing-ui": "0.15.4",
|
|
63
|
+
"@univerjs/drawing": "0.15.4",
|
|
64
|
+
"@univerjs/drawing-ui": "0.15.4"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@univerjs/core": "0.15.
|
|
67
|
+
"@univerjs/core": "0.15.4",
|
|
68
68
|
"react": "18.3.1",
|
|
69
69
|
"react-dom": "18.3.1",
|
|
70
70
|
"rxjs": "7.8.2",
|
|
71
71
|
"typescript": "^5.9.3",
|
|
72
|
-
"@univerjs-infra/shared": "0.15.
|
|
72
|
+
"@univerjs-infra/shared": "0.15.4"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"prebuild:preset": "tsx prepare.ts",
|