@univerjs/slides-ui 0.8.0-beta.0 → 0.8.0-nightly.202505271607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +642 -649
- package/lib/index.js +642 -649
- package/lib/types/controllers/image.menu.d.ts +0 -1
- package/lib/types/controllers/shape.menu.d.ts +1 -2
- package/lib/types/controllers/text.menu.d.ts +0 -1
- package/lib/types/views/editor-container/EditorContainer.d.ts +16 -6
- package/lib/umd/index.js +2 -2
- package/package.json +10 -10
- package/LICENSE +0 -176
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IAccessor } from '@univerjs/core';
|
|
2
2
|
import { IMenuItem } from '@univerjs/ui';
|
|
3
|
-
export declare const IMAGE_UPLOAD_ICON = "addition-and-subtraction-single";
|
|
4
3
|
export declare const SLIDES_IMAGE_MENU_ID = "slide.menu.image";
|
|
5
4
|
export declare function SlideImageMenuFactory(accessor: IAccessor): IMenuItem;
|
|
6
5
|
export declare function UploadSlideFloatImageMenuFactory(_accessor: IAccessor): IMenuItem;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IMenuButtonItem, IMenuItem } from '@univerjs/ui';
|
|
2
1
|
import { IAccessor } from '@univerjs/core';
|
|
3
|
-
|
|
2
|
+
import { IMenuButtonItem, IMenuItem } from '@univerjs/ui';
|
|
4
3
|
export declare const SHAPE_MENU_ID = "slide.menu.shape";
|
|
5
4
|
export declare function SlideShapeMenuFactory(accessor: IAccessor): IMenuItem;
|
|
6
5
|
export declare function UploadSlideFloatShapeMenuFactory(_accessor: IAccessor): IMenuButtonItem;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
4
16
|
/**
|
|
5
17
|
* Floating editor's container.
|
|
6
|
-
* @returns
|
|
7
18
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
export {};
|
|
19
|
+
export declare function SlideEditorContainer(): import("react/jsx-runtime").JSX.Element;
|
package/lib/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(h,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/slides"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/slides","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs","@univerjs/docs","@univerjs/docs-ui","@univerjs/drawing"],a):(h=typeof globalThis<"u"?globalThis:h||self,a(h.UniverSlidesUi={},h.UniverCore,h.UniverEngineRender,h.UniverSlides,h.UniverUi,h.React,h.UniverDesign,h.React,h.rxjs,h.UniverDocs,h.UniverDocsUi,h.UniverDrawing))})(this,function(h,a,S,W,f,u,w,b,M,ee,N,ge){"use strict";var ln=Object.defineProperty;var dn=(h,a,S)=>a in h?ln(h,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):h[a]=S;var y=(h,a,S)=>dn(h,typeof a!="symbol"?a+"":a,S);var ve;var it=Object.getOwnPropertyDescriptor,rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?it(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},fe=(r,e)=>(t,n)=>e(t,n,r);let q=class extends a.RxDisposable{constructor(e,t,n,i){super();y(this,"_objectProvider",null);y(this,"_refreshThumb",a.debounce(()=>{this.createThumbs()},300));this._renderContext=e,this._injector=t,this._univerInstanceService=n,this._renderManagerService=i,this._objectProvider=this._injector.createInstance(W.ObjectProvider),this._addNewRender()}_addNewRender(){const{unitId:e,engine:t,scene:n}=this._renderContext,i=this._getCurrUnitModel();if(!i)return;const s=t.onTransformChange$.subscribeEvent(()=>{this._scrollToCenter(),s==null||s.unsubscribe()});t.onTransformChange$.subscribeEvent(()=>{setTimeout(()=>{this.createThumbs()},300)});const c=new S.Viewport(W.SLIDE_KEY.VIEW,n,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1,isWheelPreventDefaultX:!0});n.attachControl(),n.onMouseWheel$.subscribeEvent((l,g)=>{const d=l;if(d.ctrlKey){const v=Math.abs(d.deltaX);let _=v<40?.2:v<80?.4:.2;_*=d.deltaY>0?-1:1,n.scaleX<1&&(_/=2),n.scaleX+_>4?n.scale(4,4):n.scaleX+_<.1?n.scale(.1,.1):(d.deltaY>0,d.preventDefault())}else c.onMouseWheel(d,g)}),n.onFileLoaded$.subscribeEvent(()=>{this._refreshThumb()}),S.ScrollBar.attachTo(c);const o=this._createSlide(n);this._renderContext.mainComponent=o,this._createSlidePages(i,o),this.createThumbs(),t.runRenderLoop(()=>{n.render()})}_scrollToCenter(){var l;const e=(l=this._currentRender())==null?void 0:l.scene,t=e==null?void 0:e.getViewport(W.SLIDE_KEY.VIEW),n=this._getCenterPositionViewPort(e);if(!t||!n)return;const{left:i,top:s}=n,{x:c,y:o}=t.transViewportScroll2ScrollValue(i,s);t.scrollToBarPos({x:c,y:o})}_currentRender(){return S.getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_SLIDE,this._univerInstanceService,this._renderManagerService)}_createSlide(e){const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),{width:n,height:i}=e,s=t.getPageSize(),{width:c=100,height:o=100}=s,l=new S.Slide(W.SLIDE_KEY.COMPONENT,{left:(n-c)/2,top:(i-o)/2,width:c,height:o,zIndex:10});return l.enableSelectedClipElement(),e.addObject(l),l}_addBackgroundRect(e,t){const i=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE).getPageSize(),{width:s=0,height:c=0}=i,o=new S.Rect("canvas",{left:0,top:0,width:s,height:c,strokeWidth:1,stroke:"rgba(198,198,198,1)",fill:a.getColorStyle(t)||"rgba(255,255,255,1)",zIndex:0,evented:!1});e.addObject(o,0)}_getCenterPositionViewPort(e){if(!e)return{left:0,top:0};const{width:t,height:n}=e,i=e.getEngine(),s=(i==null?void 0:i.width)||0,c=(i==null?void 0:i.height)||0;return{left:(t-s)/2,top:(n-c)/2}}_thumbSceneRender(e,t){const n=this._renderManagerService.getRenderById(e);if(n==null)return;const{engine:i}=n;if(i==null)return;const{width:s,height:c}=t,{width:o=s,height:l=c}=i,g=i.getCanvas().getContext();t.renderToThumb(g,e,o/s,l/c)}_createSlidePages(e,t){const n=e.getPages(),i=e.getPageOrder();if(!(!n||!i)&&i.length!==0){for(let s=0,c=i.length;s<c;s++){const o=i[s];this.createPageScene(o,n[o]),this._createThumb(o)}t.activeFirstPage()}}_createThumb(e){this._renderManagerService.createRender(e)}_getCurrUnitModel(){return this._renderContext.unit}activePage(e){let t=e;const n=this._getCurrUnitModel();let i;if(t)i=n.getPage(t);else{const l=n.getPages(),g=n.getPageOrder();if(g==null||l==null)return;i=l[g[0]],t=i.id}const s=this._currentRender();if(i==null||s==null||s.mainComponent==null)return;const{id:c}=i,o=s.mainComponent;if(n.setActivePage(i),o!=null&&o.hasPage(c)){o.changePage(c);return}this.createPageScene(c,i)}createThumbs(){const t=this._getCurrUnitModel().getPageOrder(),n=this._currentRender();if(!(!t||!n)&&t.length!==0)for(let i=0,s=t.length;i<s;i++){const c=t[i];this._thumbSceneRender(c,n.mainComponent)}}createPageScene(e,t){const n=this._renderContext;if(!n||!this._objectProvider)return;const{scene:i,mainComponent:s}=n,c=s,{width:o,height:l}=c,g=new S.Scene(e,c,{width:o,height:l});new S.Viewport(`PageViewer_${e}`,g,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1}).closeClip();const{pageElements:v,pageBackgroundFill:_}=t,m=this._objectProvider.convertToRenderObjects(v,i);if(!m||!c)return;this._addBackgroundRect(g,_),g.addObjects(m),g.initTransformer(),m.forEach(C=>{g.attachTransformerTo(C)});const I=g.getTransformer();return I==null||I.changeEnd$.subscribe(()=>{this._thumbSceneRender(e,c)}),I==null||I.clearControl$.subscribe(()=>{this._thumbSceneRender(e,c)}),c.addPageScene(g),g}getPageRenderUnit(e){const n=this._renderContext.mainComponent.getSubScenes().get(e),{engine:i,unit:s}=this._renderContext;return{scene:n,engine:i,unit:s}}createObjectToPage(e,t){const{scene:n}=this.getPageRenderUnit(t);if(!n||!this._objectProvider)return;const i=this._objectProvider.convertToRenderObject(e,n);if(i)return n.addObject(i),n.attachTransformerTo(i),n.getLayer().makeDirty(),i}setObjectActiveByPage(e,t){const{scene:n}=this.getPageRenderUnit(t);if(!n)return;const i=n.getTransformer();i==null||i.activeAnObject(e)}removeObjectById(e,t){const{scene:n}=this.getPageRenderUnit(t);if(!n)return;n.removeObject(e);const i=n.getTransformer();i==null||i.clearControls()}appendPage(){const e=this._getCurrUnitModel(),t=e.getBlankPage(),n=this._currentRender();if(t==null||n==null||n.mainComponent==null)return;const{id:i}=t,s=n.mainComponent,c=this.createPageScene(i,t);s&&c&&s.addPageScene(c),e.appendPage(t),e.setActivePage(t)}};q=rt([fe(1,a.Inject(a.Injector)),fe(2,a.IUniverInstanceService),fe(3,S.IRenderManagerService)],q);var st=Object.getOwnPropertyDescriptor,at=(r,e,t,n)=>{for(var i=n>1?void 0:n?st(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},ct=(r,e)=>(t,n)=>e(t,n,r);h.CanvasView=class extends a.RxDisposable{constructor(e){super(),this._renderManagerService=e}_getSlideRenderControllerFromRenderUnit(e){return this._renderManagerService.getRenderById(e).with(q)}createThumbs(e){this._getSlideRenderControllerFromRenderUnit(e).createThumbs()}activePage(e,t){this._getSlideRenderControllerFromRenderUnit(t).activePage(e)}getRenderUnitByPageId(e,t){return this._getSlideRenderControllerFromRenderUnit(t).getPageRenderUnit(e)}createObjectToPage(e,t,n){return this._getSlideRenderControllerFromRenderUnit(n).createObjectToPage(e,t)}setObjectActiveByPage(e,t,n){return this._getSlideRenderControllerFromRenderUnit(n).setObjectActiveByPage(e,t)}removeObjectById(e,t,n){this._getSlideRenderControllerFromRenderUnit(n).removeObjectById(e,t)}appendPage(e){this._getSlideRenderControllerFromRenderUnit(e).appendPage()}},h.CanvasView=at([ct(0,S.IRenderManagerService)],h.CanvasView);const ot="slides-ui.config",Ve={},pe={id:"slide.operation.delete-element",type:a.CommandType.OPERATION,handler:(r,e)=>{if(!(e!=null&&e.id))return!1;const t=e.unitId,i=r.get(a.IUniverInstanceService).getUnit(t);if(!i)return!1;const s=i.getActivePage();return delete s.pageElements[e.id],i.updatePage(s.id,s),r.get(h.CanvasView).removeObjectById(e.id,s.id,t),!0}};var V=function(){return V=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},V.apply(this,arguments)},lt=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},j=b.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,s=r.extend,c=lt(r,["icon","id","className","extend"]),o="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=b.useRef("_".concat(vt()));return je(t,"".concat(n),{defIds:t.defIds,idSuffix:l.current},V({ref:e,className:o},c),s)});function je(r,e,t,n,i){return b.createElement(r.tag,V(V({key:e},dt(r,t,i)),n),(ut(r,t).children||[]).map(function(s,c){return je(s,"".concat(e,"-").concat(r.tag,"-").concat(c),t,void 0,i)}))}function dt(r,e,t){var n=V({},r.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),r.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(s){var c=s[0],o=s[1];c==="mask"&&typeof o=="string"&&(n[c]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var i=e.defIds;return!i||i.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(s){var c=s[0],o=s[1];typeof o=="string"&&(n[c]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function ut(r,e){var t,n=e.defIds;return!n||n.length===0?r:r.tag==="defs"&&(!((t=r.children)===null||t===void 0)&&t.length)?V(V({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?V(V({},i),{attrs:V(V({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function vt(){return Math.random().toString(36).substring(2,8)}j.displayName="UniverIcon";var ht={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z"}}]},Le=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"add-image-single",ref:e,icon:ht}))});Le.displayName="AddImageSingle";var gt={tag:"svg",attrs:{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.56377zM2.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.83647zM9.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"}}]},Re=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"autofill",ref:e,icon:gt}))});Re.displayName="Autofill";var ft={tag:"svg",attrs:{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.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.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.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.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.9999 3.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.7421 6.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.56641 9.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.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946"}}]},Ae=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"bottom-single",ref:e,icon:ft}))});Ae.displayName="BottomSingle";var pt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{clipPath:"url(#graph-single_clip0_1293_28)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6.29541 11.1896C3.83208 10.7489 1.9624 8.59552 1.9624 6.00544C1.9624 3.09673 4.32036 0.73877 7.22907 0.73877C9.93483 0.73877 12.164 2.77918 12.4619 5.40527H13.5621C14.998 5.40527 16.1621 6.56933 16.1621 8.00527V12.6719C16.1621 14.1079 14.998 15.2719 13.5621 15.2719H8.89541C7.45947 15.2719 6.29541 14.1079 6.29541 12.6719V11.1896ZM3.1624 6.00544C3.1624 3.75947 4.98311 1.93877 7.22907 1.93877C9.27112 1.93877 10.9616 3.44388 11.2518 5.40527H8.89541C7.45947 5.40527 6.29541 6.56933 6.29541 8.00527V9.96442C4.49946 9.5425 3.1624 7.93012 3.1624 6.00544ZM7.49541 8.00527C7.49541 7.23207 8.12221 6.60527 8.89541 6.60527H13.5621C14.3353 6.60527 14.9621 7.23207 14.9621 8.00527V12.6719C14.9621 13.4451 14.3353 14.0719 13.5621 14.0719H8.89541C8.12221 14.0719 7.49541 13.4451 7.49541 12.6719V8.00527Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"graph-single_clip0_1293_28"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.9)"}}]}]}],defIds:["graph-single_clip0_1293_28"]},Be=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"graph-single",ref:e,icon:pt}))});Be.displayName="GraphSingle";var _t={tag:"svg",attrs:{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"}}]},_e=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"more-down-single",ref:e,icon:_t}))});_e.displayName="MoreDownSingle";var St={tag:"svg",attrs:{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"}}]},$e=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"move-down-single",ref:e,icon:St}))});$e.displayName="MoveDownSingle";var It={tag:"svg",attrs:{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"}}]},He=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"move-up-single",ref:e,icon:It}))});He.displayName="MoveUpSingle";var Ct={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},Fe=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"paint-bucket",ref:e,icon:Ct}))});Fe.displayName="PaintBucket";var mt={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.66695 1.33496C2.29968 1.33496 2.00195 1.63269 2.00195 1.99996V3.64439C2.00195 4.01166 2.29968 4.30939 2.66695 4.30939C3.03422 4.30939 3.33195 4.01166 3.33195 3.64439V2.66496H7.33521V13.335H5.3337C4.96643 13.335 4.6687 13.6327 4.6687 14C4.6687 14.3672 4.96643 14.665 5.3337 14.665H10.667C11.0343 14.665 11.332 14.3672 11.332 14C11.332 13.6327 11.0343 13.335 10.667 13.335H8.66521V2.66496H12.6686V3.64439C12.6686 4.01166 12.9664 4.30939 13.3336 4.30939C13.7009 4.30939 13.9986 4.01166 13.9986 3.64439V1.99996C13.9986 1.63269 13.7009 1.33496 13.3336 1.33496H2.66695Z"}}]},We=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"text-single",ref:e,icon:mt}))});We.displayName="TextSingle";var bt={tag:"svg",attrs:{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 9 15.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 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.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.1665 15.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.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z",fillRule:"evenodd",clipRule:"evenodd"}}]},ze=b.forwardRef(function(r,e){return b.createElement(j,Object.assign({},r,{id:"topmost-single",ref:e,icon:bt}))});ze.displayName="TopmostSingle";const L={id:"slide.operation.update-element",type:a.CommandType.OPERATION,handler:(r,e)=>{const{oKey:t,props:n}=e,i=r.get(a.IUniverInstanceService),s=e==null?void 0:e.unitId,c=i.getUnit(s);if(!c)return!1;const o=c.getActivePage();return o.pageElements[t]=a.Tools.deepMerge(o.pageElements[t],n),c.updatePage(o.id,o),!0}};function Et(r){const{pageId:e,unitId:t}=r,n=f.useDependency(a.LocaleService),i=f.useDependency(h.CanvasView),s=f.useDependency(a.ICommandService),c=i.getRenderUnitByPageId(e,t),o=c==null?void 0:c.scene;if(!o)return null;const l=o.getTransformer();if(!l)return null;const d=l.getSelectedObjectMap().values().next().value;if(!d)return null;const v=_=>{const m=o.getAllObjects(),[I,C]=m.reduce(([E,D],T)=>{const U=T.zIndex,P=U<E?U:E,A=U>D?U:D;return[P,A]},[0,0]);let p=d.zIndex;_===3?p=I-1:_===2?p=C+1:_===0?p=d.zIndex+1:_===1&&(p=d.zIndex-1),d.setProps({zIndex:p}),s.executeCommand(L.id,{unitId:t,oKey:d==null?void 0:d.oKey,props:{zIndex:p}})};return u.jsxs("div",{className:"univer-relative univer-w-full",children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",children:u.jsx("div",{children:n.t("image-panel.arrange.title")})})}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/2",children:u.jsx(w.Button,{onClick:()=>{v(0)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx(He,{}),n.t("image-panel.arrange.forward")]})})}),u.jsx("div",{className:"univer-w-1/2",children:u.jsx(w.Button,{onClick:()=>{v(1)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx($e,{}),n.t("image-panel.arrange.backward")]})})})]}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/2",children:u.jsx(w.Button,{onClick:()=>{v(2)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx(ze,{}),n.t("image-panel.arrange.front")]})})}),u.jsx("div",{className:"univer-w-1/2",children:u.jsx(w.Button,{onClick:()=>{v(3)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx(Ae,{}),n.t("image-panel.arrange.back")]})})})]})]})}function Ot(r){var I,C;const{pageId:e,unitId:t}=r,n=f.useDependency(a.LocaleService),i=f.useDependency(h.CanvasView),s=f.useDependency(a.ICommandService),c=i.getRenderUnitByPageId(e,t),o=c==null?void 0:c.scene;if(!o)return null;const l=o.getTransformer();if(!l)return null;const d=l.getSelectedObjectMap().values().next().value;if(!d)return null;const[v,_]=b.useState((C=(I=d.fill)==null?void 0:I.toString())!=null?C:"");function m(p){d==null||d.setProps({fill:p}),s.executeCommand(L.id,{unitId:t,oKey:d==null?void 0:d.oKey,props:{shape:{shapeProperties:{shapeBackgroundFill:{rgb:p}}}}}),_(p)}return u.jsx("div",{className:w.clsx("univer-relative univer-bottom-0 univer-mt-5 univer-w-full",w.borderTopClassName),children:u.jsxs("div",{className:"univer-relative univer-w-full",children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",children:u.jsx("div",{children:n.t("slide.panel.fill.title")})})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-1/2",children:u.jsx(w.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(w.ColorPicker,{value:"#fff",onChange:m})}),children:u.jsxs("a",{className:"univer-flex univer-cursor-pointer univer-items-center univer-gap-1",children:[u.jsx(Fe,{className:"univer-fill-primary-600"}),u.jsx(_e,{})]})})})})]})})}function yt(r){const{pageId:e,unitId:t}=r,n=f.useDependency(a.LocaleService),i=f.useDependency(h.CanvasView),s=f.useDependency(a.ICommandService),c=i.getRenderUnitByPageId(e,t),o=c==null?void 0:c.scene;if(!o)return null;const l=o.getTransformer();if(!l)return null;const d=l.getSelectedObjectMap().values().next().value;if(!d)return null;const{width:v=0,height:_=0,left:m=0,top:I=0,angle:C=0}=d,[p,E]=b.useState(v),[D,T]=b.useState(_),[U,P]=b.useState(m),[A,x]=b.useState(I),[G,$]=b.useState(C),F=O=>{const{objects:J}=O,Q=J.values().next().value,{width:rn=0,height:sn=0,left:an=0,top:cn=0,angle:on=0}=Q;E(rn),T(sn),P(an),x(cn),$(on)};b.useEffect(()=>{const O=l.changeStart$.subscribe(Q=>{F(Q)}),J=l.changing$.subscribe(Q=>{F(Q)});return()=>{J.unsubscribe(),O.unsubscribe()}},[]);function B(O){!O||!d||(s.executeCommand(L.id,{pageId:e,oKey:d.oKey,props:{width:O}}),d==null||d.resize(O,d.height),E(O),l==null||l.refreshControls())}function Y(O){!O||!d||(s.executeCommand(L.id,{pageId:e,oKey:d.oKey,props:{height:O}}),d==null||d.resize(d.width,O),T(O),l==null||l.refreshControls())}function Z(O){!O||!d||(s.executeCommand(L.id,{pageId:e,oKey:d.oKey,props:{left:O}}),d==null||d.translate(O,d.top),P(O),l==null||l.refreshControls())}function k(O){!O||!d||(s.executeCommand(L.id,{pageId:e,oKey:d.oKey,props:{right:O}}),d==null||d.translate(d.left,O),x(O),l==null||l.refreshControls())}function he(O){!O||!d||(s.executeCommand(L.id,{pageId:e,oKey:d.oKey,props:{angle:O}}),d==null||d.transformByState({angle:O}),$(O),l==null||l.refreshControls())}return u.jsxs("div",{className:w.clsx("univer-relative univer-bottom-0 univer-mt-5 univer-w-full",w.borderTopClassName),children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",children:u.jsx("div",{children:n.t("image-panel.transform.title")})})}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.width")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(w.InputNumber,{className:"univer-w-11/12",min:1,value:p,onChange:O=>{B(O)}})})})]})}),u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.height")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(w.InputNumber,{className:"univer-w-11/12",min:1,value:D,onChange:O=>{Y(O)}})})})]})})]}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.x")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(w.InputNumber,{className:"univer-w-11/12",precision:1,min:0,value:U,onChange:O=>{Z(O)}})})})]})}),u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.y")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(w.InputNumber,{className:"univer-w-11/12",precision:1,min:0,value:A,onChange:O=>{k(O)}})})})]})}),u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.rotate")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(w.InputNumber,{className:"univer-w-11/12",precision:1,value:G,onChange:he})})})]})})]})]})}const te="COMPONENT_SLIDE_SIDEBAR";function Tt(){var g,d,v;const r=f.useDependency(a.IUniverInstanceService),e=f.useDependency(h.CanvasView),t=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),n=(g=t==null?void 0:t.getActivePage())==null?void 0:g.id;if(!n)return null;const s=(d=e.getRenderUnitByPageId(n,n).scene)==null?void 0:d.getTransformer();if(!s)return null;const o=s.getSelectedObjectMap().values().next().value;if(!o)return null;const l=((v=r.getFocusedUnit())==null?void 0:v.getUnitId())||"";return u.jsxs("section",{className:"univer-p-2 univer-text-center univer-text-sm",children:[u.jsx(Et,{pageId:n,unitId:l}),u.jsx(yt,{pageId:n,unitId:l}),o.objectType===S.ObjectType.RECT&&u.jsx(Ot,{pageId:n,unitId:l})]})}const ne={id:"slide.command.insert-float-shape",type:a.CommandType.COMMAND,handler:async r=>{var i;const e=r.get(a.ICommandService),n=(i=r.get(a.IUniverInstanceService).getFocusedUnit())==null?void 0:i.getUnitId();return e.executeCommand(Se.id,{unitId:n})}},Se={id:"slide.operation.insert-float-shape",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=a.generateRandomId(6),n=r.get(a.IUniverInstanceService),i=e.unitId,s=n.getUnit(i);if(!s)return!1;const c=s.getActivePage(),o=Object.values(c.pageElements),l=o!=null&&o.length?Math.max(...o.map(_=>_.zIndex)):20,g={id:t,zIndex:l+1,left:378,top:142,width:250,height:250,title:t,description:"",type:a.PageElementType.SHAPE,shape:{shapeType:a.BasicShapes.Rect,text:"",shapeProperties:{shapeBackgroundFill:{rgb:"rgb(0,0,255)"}}}};c.pageElements[t]=g,s.updatePage(c.id,c);const d=r.get(h.CanvasView),v=d.createObjectToPage(g,c.id,i);return v&&d.setObjectActiveByPage(v,c.id,i),!0}},Ie={id:"sidebar.operation.slide-shape",type:a.CommandType.COMMAND,handler:async(r,e)=>{const{visible:t,objectType:n}=e,i=r.get(f.ISidebarService),s=r.get(a.LocaleService);let c="",o="";return n===S.ObjectType.RECT?(c="slide.sidebar.shape",o=te):n===S.ObjectType.IMAGE?(c="slide.sidebar.image",o=te):n===S.ObjectType.RICH_TEXT&&(c="slide.sidebar.text",o=te),t?i.open({header:{title:s.t(c)},children:{label:o},onClose:()=>{},width:360}):i.close(),!0}},ke="COMPONENT_SLIDE_IMAGE_POPUP_MENU";var Dt=Object.getOwnPropertyDescriptor,wt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Dt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},ie=(r,e)=>(t,n)=>e(t,n,r);function xt(r,e){const t=Ke(r.left,r.top,e),n=Ke(r.right,r.bottom,e);return{left:t.x,top:t.y,right:n.x,bottom:n.y}}function Ke(r,e,t){const{scaleX:n,scaleY:i}=t.getAncestorScale(),s=t.getViewport(W.SLIDE_KEY.VIEW);if(!s)return{x:r,y:e};const{viewportScrollX:c,viewportScrollY:o}=s,l=(r-c)*n,g=(e-o)*i;return{x:l,y:g}}h.SlideCanvasPopMangerService=class extends a.Disposable{constructor(e,t,n,i){super(),this._globalPopupManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._commandService=i}_createObjectPositionObserver(e,t){const i=(()=>{var B,Y,Z,k;const{scene:o,engine:l}=t,{left:g,top:d,width:v,height:_}=e,m=(o.width-((Y=(B=t.mainComponent)==null?void 0:B.width)!=null?Y:0))/2,I=(o.height-((k=(Z=t.mainComponent)==null?void 0:Z.height)!=null?k:0))/2,C={left:g,right:g+v,top:d,bottom:d+_},p=l.getCanvasElement(),E=p.getBoundingClientRect(),D=S.pxToNum(p.style.width),{scaleX:T,scaleY:U}=o.getAncestorScale(),P=xt(C,o),{top:A,left:x,width:G}=E,$=G/D;return{left:P.left*$*T+x+m,right:P.right*$*T+x+m,top:P.top*$*U+A+I,bottom:P.bottom*$*U+A+I}})(),s=new M.BehaviorSubject(i),c=new a.DisposableCollection;return{position:i,position$:s,disposable:c}}attachPopupToObject(e,t){const i=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE).getUnitId(),s=this._renderManagerService.getRenderById(i);if(!s)return{dispose:()=>{}};const{position:c,position$:o,disposable:l}=this._createObjectPositionObserver(e,s),g=this._globalPopupManagerService.addPopup({...t,unitId:i,subUnitId:"default",anchorRect:c,anchorRect$:o,canvasElement:s.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(g),o.complete(),l.dispose()}}}},h.SlideCanvasPopMangerService=wt([ie(0,a.Inject(f.ICanvasPopupService)),ie(1,S.IRenderManagerService),ie(2,a.IUniverInstanceService),ie(3,a.ICommandService)],h.SlideCanvasPopMangerService);var Pt=Object.getOwnPropertyDescriptor,Ut=(r,e,t,n)=>{for(var i=n>1?void 0:n?Pt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},z=(r,e)=>(t,n)=>e(t,n,r);let re=class extends a.RxDisposable{constructor(e,t,n,i,s,c,o){super();y(this,"_initImagePopupMenu",new Set);this._canvasPopManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._contextService=i,this._canvasView=s,this._sidebarService=c,this._commandService=o,this._init()}_init(){this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SLIDE).forEach(e=>this._create(e))}_create(e){if(!e)return;const t=e.getUnitId();this._renderManagerService.has(t)&&!this._initImagePopupMenu.has(t)&&(this._popupMenuListener(t),this._initImagePopupMenu.add(t))}_hasCropObject(e){}_popupMenuListener(e){var i;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),n=(i=t==null?void 0:t.getPages())!=null?i:{};Object.keys(n).forEach(s=>{var g;const o=(g=this._canvasView.getRenderUnitByPageId(s,e).scene)==null?void 0:g.getTransformer();if(!o)return;let l;this.disposeWithMe(a.toDisposable(o.createControl$.subscribe(()=>{const d=o.getSelectedObjectMap();if(d.size>1){l==null||l.dispose();return}const v=d.values().next().value;if(!v)return;const _=v.oKey;l==null||l.dispose(),l=this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(v,{componentKey:ke,direction:"horizontal",offset:[2,0],extraProps:{menuItems:this._getMenuItemsByObjectType(v.objectType,_,e)}})),this._sidebarService.visible&&this._commandService.executeCommand(Ie.id,{visible:!0,objectType:v.objectType})}))),this.disposeWithMe(o.clearControl$.subscribe(()=>{l==null||l.dispose(),this._contextService.setContextValue(a.FOCUSING_COMMON_DRAWINGS,!1)})),this.disposeWithMe(o.changing$.subscribe(()=>{l==null||l.dispose();const d=o.getSelectedObjectMap();if(d.size>1){l==null||l.dispose();return}const v=d.values().next().value;v&&this._commandService.executeCommand(L.id,{unitId:e,oKey:v.oKey,props:{width:v.width,height:v.height,left:v.left,top:v.top}})}))})}_getMenuItemsByObjectType(e,t,n){return[{label:"slide.popup.edit",index:0,commandId:Ie.id,commandParams:{visible:!0,objectType:e},disable:!1},{label:"slide.popup.delete",index:5,commandId:pe.id,commandParams:{id:t,unitId:n},disable:!1}]}};re=Ut([z(0,a.Inject(h.SlideCanvasPopMangerService)),z(1,S.IRenderManagerService),z(2,a.IUniverInstanceService),z(3,a.IContextService),z(4,a.Inject(h.CanvasView)),z(5,f.ISidebarService),z(6,a.ICommandService)],re);const se={id:"slide.operation.edit-arrow",type:a.CommandType.OPERATION,handler:()=>!0},K=a.createInternalEditorID("SLIDE_EDITOR");var Mt=Object.getOwnPropertyDescriptor,Nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Mt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},Ce=(r,e)=>(t,n)=>e(t,n,r);const ae=a.createIdentifier("univer.slide-editor-bridge.service");let me=class extends a.Disposable{constructor(e,t,n){super();y(this,"_editorUnitId",K);y(this,"_isForceKeepVisible",!1);y(this,"_editorIsDirty",!1);y(this,"_currentEditRectState",null);y(this,"_currentEditRectState$",new M.BehaviorSubject(null));y(this,"currentEditRectState$",this._currentEditRectState$.asObservable());y(this,"_visibleParam",{visible:!1,eventType:S.DeviceInputEventType.Dblclick,unitId:""});y(this,"_visible$",new M.BehaviorSubject(this._visibleParam));y(this,"visible$",this._visible$.asObservable());y(this,"_afterVisible$",new M.BehaviorSubject(this._visibleParam));y(this,"afterVisible$",this._afterVisible$.asObservable());y(this,"endEditing$",new M.Subject);y(this,"_currentEditRectInfo");this._editorService=e,this._contextService=t,this._renderManagerService=n}dispose(){super.dispose()}getEditorRect(){return this._currentEditRectInfo}setEditorRect(e){this._currentEditRectInfo=e,this._editorService.getFocusEditor()||(this._editorService.focus(K),this._contextService.setContextValue(a.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(a.FOCUSING_EDITOR_STANDALONE,!1),this._contextService.setContextValue(a.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE,!1));const t=this.getEditRectState();this._currentEditRectState=t,this._currentEditRectState$.next(t)}changeVisible(e){this._visibleParam=e,e.visible&&(this._editorIsDirty=!1),this._visible$.next(this._visibleParam),this._afterVisible$.next(this._visibleParam)}getEditRectState(){const e=K,t=this._currentEditRectInfo,n=t.unitId,i=t.richTextObj.documentData;i.id=e,i.documentStyle={...i.documentStyle,pageSize:{width:t.richTextObj.width,height:1/0}};const c={documentModel:new a.DocumentDataModel(i),fontString:"document",textRotation:{a:0,v:0},wrapStrategy:0,verticalAlign:a.VerticalAlign.TOP,horizontalAlign:a.HorizontalAlign.LEFT,paddingData:{t:0,b:1,l:2,r:2}},o=t.richTextObj.width,l=t.richTextObj.height,g=t.richTextObj.left,d=t.richTextObj.top,v={left:0,top:0},_=this._renderManagerService.getRenderById(n),m=_==null?void 0:_.scene,I=m==null?void 0:m.getViewport(W.SLIDE_KEY.VIEW),C=m==null?void 0:m.getObject(W.SLIDE_KEY.COMPONENT),p={x:(C==null?void 0:C.left)||0,y:(C==null?void 0:C.top)||0},E=(I==null?void 0:I.viewportScrollX)||0,D=(I==null?void 0:I.viewportScrollY)||0;return v.left=p.x-E,v.top=p.y-D,{position:{startX:g,startY:d,endX:g+o,endY:d+l},scaleX:1,scaleY:1,slideCardOffset:v,unitId:n,editorUnitId:e,documentLayoutObject:c}}changeEditorDirty(e){this._editorIsDirty=e}isVisible(){return this._visibleParam.visible}getEditorDirty(){return this._editorIsDirty}getCurrentEditorId(){return this._editorUnitId}genDocData(e){const t=this.getCurrentEditorId(),n=e.text,i=e.fs;return{id:t,body:{dataStream:`${n}\r
|
|
2
|
-
`,textRuns:[{st:0,ed:n.length}],paragraphs:[{paragraphStyle:{},startIndex:n.length+1}],sectionBreaks:[{startIndex:n.length+2}]},documentStyle:{marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,pageSize:{width:1/0,height:1/0},textStyle:{fs:i},renderConfig:{verticalAlign:a.VerticalAlign.MIDDLE,centerAngle:0,vertexAngle:0,wrapStrategy:0}},drawings:{},drawingsOrder:[],settings:{zoomRatio:1}}}};me=Nt([Ce(0,N.IEditorService),Ce(1,a.IContextService),Ce(2,S.IRenderManagerService)],me);class Vt{constructor(){y(this,"_state",null);y(this,"_rect",null);y(this,"_state$",new M.BehaviorSubject(null));y(this,"state$",this._state$.asObservable());y(this,"_rect$",new M.BehaviorSubject(null));y(this,"rect$",this._rect$.asObservable());y(this,"_focus",!1);y(this,"_focus$",new M.BehaviorSubject(this._focus));y(this,"focus$",this._focus$.asObservable())}dispose(){this._state$.complete(),this._state=null,this._rect$.complete(),this._rect=null}setState(e){this._state=e,this._refresh(e)}getRect(){return this._rect}setRect(e){this._rect=e,this._rect$.next(e)}getState(){return this._state}setFocus(e=!1){this._focus=e,this._focus$.next(e)}_refresh(e){this._state$.next(e)}}const be=a.createIdentifier("univer.slide-editor-manager.service");var H=(r=>(r[r.InitialState=0]="InitialState",r[r.StartEditor=1]="StartEditor",r[r.CursorChange=2]="CursorChange",r))(H||{}),jt=Object.getOwnPropertyDescriptor,Lt=(r,e,t,n)=>{for(var i=n>1?void 0:n?jt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},R=(r,e)=>(t,n)=>e(t,n,r);const Xe=-1e3,Ge=5,Rt=2;let Ee=class extends a.Disposable{constructor(e,t,n,i,s,c,o,l,g,d,v,_){super();y(this,"_cursorChange",H.InitialState);y(this,"_isUnitEditing",!1);y(this,"_d");this._renderContext=e,this._layoutService=t,this._undoRedoService=n,this._contextService=i,this._instanceSrv=s,this._renderManagerService=c,this._editorBridgeService=o,this._cellEditorManagerService=l,this._textSelectionManagerService=g,this._commandService=d,this._localService=v,this._editorService=_,this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SLIDE).subscribe(m=>{m&&m.getUnitId()===this._renderContext.unitId?this._d=this._init():(this._disposeCurrent(),this._isUnitEditing&&(this._handleEditorInvisible({visible:!1,eventType:S.DeviceInputEventType.Keyboard,keycode:f.KeyCode.ESC,unitId:this._renderContext.unitId}),this._isUnitEditing=!1))})),this._initEditorVisibilityListener()}dispose(){super.dispose(),this._disposeCurrent()}_disposeCurrent(){var e;(e=this._d)==null||e.dispose(),this._d=null}_init(){const e=new a.DisposableCollection;return this._subscribeToCurrentCell(e),this._initialKeyboardListener(e),this._initialCursorSync(e),this._listenEditorFocus(e),this._commandExecutedListener(e),setTimeout(()=>{this._cursorStateListener(e)},1e3),e}_initEditorVisibilityListener(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible?(this._isUnitEditing=!0,this._handleEditorVisible(e)):this._isUnitEditing&&(this._handleEditorInvisible(e),this._isUnitEditing=!1)}))}_listenEditorFocus(e){const t=this._getEditorObject();t&&e.add(t.document.onPointerDown$.subscribeEvent(()=>{}))}_getEditorSkeleton(e){var t;return(t=this._renderManagerService.getRenderById(e))==null?void 0:t.with(ee.DocSkeletonManagerService).getSkeleton()}_getEditorViewModel(e){var t;return(t=this._renderManagerService.getRenderById(e))==null?void 0:t.with(ee.DocSkeletonManagerService).getViewModel()}_initialCursorSync(e){e.add(this._cellEditorManagerService.focus$.pipe(M.filter(t=>!!t)).subscribe(()=>{var t;(t=S.getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_DOC,this._instanceSrv,this._renderManagerService))==null||t.with(N.DocSelectionRenderService).sync()}))}_subscribeToCurrentCell(e){e.add(this._editorBridgeService.currentEditRectState$.subscribe(t=>{var v;if(t==null||this._contextService.getContextValue(a.FOCUSING_EDITOR_STANDALONE)||this._contextService.getContextValue(a.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE))return;const{position:{startX:n,endX:i},documentLayoutObject:{textRotation:s,wrapStrategy:c,documentModel:o},scaleX:l,editorUnitId:g}=t,{vertexAngle:d}=S.convertTextRotation(s);o.updateDocumentId(g),c===a.WrapStrategy.WRAP&&d===0&&o.updateDocumentDataPageSize((i-n)/l),this._instanceSrv.changeDoc(g,o),this._contextService.setContextValue(a.FOCUSING_EDITOR_BUT_HIDDEN,!0),this._textSelectionManagerService.replaceTextRanges([{startOffset:0,endOffset:0}]),(v=S.getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_DOC,this._instanceSrv,this._renderManagerService))==null||v.with(N.DocSelectionRenderService).activate(Xe,Xe)}))}_fitTextSize(e,t,n,i,s=1,c=1){const{startX:o,startY:l,endX:g,endY:d}=e,v=i.documentModel;if(v==null)return;const{actualWidth:_,actualHeight:m}=this._predictingSize(e,t,n,i,s,c),{verticalAlign:I,paddingData:C,fill:p}=i;let E=g-o,D=d-l;if(E<_&&(E=_),D<m)D=m,v.updateDocumentDataMargin(C);else{let T=0;I===a.VerticalAlign.MIDDLE?T=(D-m)/2/c:I===a.VerticalAlign.TOP?T=C.t||0:T=(D-m)/c-(C.b||0),T=T<(C.t||0)?C.t||0:T,v.updateDocumentDataMargin({t:T})}n.calculate(),this._editAreaProcessing(E,D,e,t,p,s,c)}_predictingSize(e,t,n,i,s=1,c=1){const{startX:o,endX:l}=e,{textRotation:g,wrapStrategy:d}=i,v=i.documentModel,{vertexAngle:_}=S.convertTextRotation(g),m=document.body.clientWidth;if(d===a.WrapStrategy.WRAP&&_===0){const{actualWidth:p,actualHeight:E}=n.getActualSize();return{actualWidth:p*s,actualHeight:E*c}}v==null||v.updateDocumentDataPageSize((m-o-t.left)/s),n.calculate();const I=n.getActualSize();let C=l-o;return C<I.actualWidth*s+Ge*s&&(C=I.actualWidth*s+Ge*s),v==null||v.updateDocumentDataPageSize(C/s),v==null||v.updateDocumentRenderConfig({horizontalAlign:a.HorizontalAlign.UNSPECIFIED,cellValueType:void 0}),{actualWidth:C,actualHeight:I.actualHeight*c}}_editAreaProcessing(e,t,n,i,s,c=1,o=1){var O;const l=this._getEditorObject();if(l==null)return;function g(J){return Number.parseInt(J.replace("px",""))}const v=this._renderContext.engine.getCanvasElement(),_=v.getBoundingClientRect(),m=g(v.style.width),{top:I,left:C,width:p}=_,E=p/m;let{startX:D,startY:T}=n;D+=i.left,T+=i.top;const{document:U,scene:P,engine:A}=l,x=P.getViewport(N.VIEWPORT_KEY.VIEW_MAIN),G=document.body.clientHeight-T-i.top-Rt*2,$=document.body.clientWidth-D-i.left;let F=t,B=x==null?void 0:x.getScrollBar();F>G?(F=G,B==null?x&&new S.ScrollBar(x,{enableHorizontal:!1,barSize:8}):x==null||x.resetCanvasSizeAndUpdateScroll()):(B=null,(O=x==null?void 0:x.getScrollBar())==null||O.dispose()),e+=(B==null?void 0:B.barSize)||0,e=Math.min(e,$),D-=S.FIX_ONE_PIXEL_BLUR_OFFSET,T-=S.FIX_ONE_PIXEL_BLUR_OFFSET,this._addBackground(P,e/c,t/o,s);const{scaleX:Y,scaleY:Z}=P.getPrecisionScale();P.transformByState({width:e*E/c,height:t*E/o,scaleX:c*E,scaleY:o*E}),U.resize(e/c,t/o),setTimeout(()=>{A.resizeBySize(S.fixLineWidthByScale(e,Y),S.fixLineWidthByScale(F,Z))},0);const k=this._layoutService.getContentElement().getBoundingClientRect(),he=v.getBoundingClientRect();D=D*E+(he.left-k.left),T=T*E+(he.top-k.top),this._cellEditorManagerService.setState({startX:D,startY:T,endX:e*E+D,endY:F*E+T,show:!0})}_addBackground(e,t,n,i){const s="_backgroundRectHelperColor_",c=e.getObject(s);c==null&&i==null||(c==null?e.addObjects([new S.Rect(s,{width:t,height:n,fill:i,evented:!1})],N.DOCS_COMPONENT_MAIN_LAYER_INDEX):i==null?c.dispose():(c.setProps({fill:i}),c.transformByState({width:t,height:n})))}_handleEditorVisible(e){var p,E;const{eventType:t}=e;this._cursorChange=[S.DeviceInputEventType.PointerDown,S.DeviceInputEventType.Dblclick].includes(t)?H.CursorChange:H.StartEditor;const n=this._editorBridgeService.getEditRectState();if(n==null)return;const{position:i,documentLayoutObject:s,slideCardOffset:c,scaleX:o,scaleY:l,editorUnitId:g,unitId:d}=n,v=this._getEditorObject();if(v==null)return;const{scene:_}=v;this._contextService.setContextValue(a.EDITOR_ACTIVATED,!0);const{documentModel:m}=s,I=this._getEditorSkeleton(g);if(!I||!m)return;this._fitTextSize(i,c,I,s,o,l);const C=m.getBody().dataStream.length-2||0;(p=_.getViewport(N.VIEWPORT_KEY.VIEW_MAIN))==null||p.scrollToViewportPos({viewportScrollX:Number.POSITIVE_INFINITY}),this._textSelectionManagerService.replaceTextRanges([{startOffset:C,endOffset:C}]),(E=this._renderManagerService.getRenderById(d))==null||E.scene.resetCursor()}_resetBodyStyle(e,t=!1){e.dataStream=a.DEFAULT_EMPTY_DOCUMENT_VALUE,e.textRuns!=null&&(e.textRuns.length===1&&!t?(e.textRuns[0].st=0,e.textRuns[0].ed=1):e.textRuns=void 0),e.paragraphs!=null&&(e.paragraphs.length===1?e.paragraphs[0].startIndex=0:e.paragraphs=[{startIndex:0}]),e.sectionBreaks!=null&&(e.sectionBreaks=void 0),e.tables!=null&&(e.tables=void 0),e.customRanges!=null&&(e.customRanges=void 0),e.customBlocks!=null&&(e.customBlocks=void 0)}_initialKeyboardListener(e){}_showEditorByKeyboard(e){}_commandExecutedListener(e){const t=[se.id],n=[ee.RichTextEditingMutation.id];e.add(this._commandService.onCommandExecuted(i=>{this._editorService.getFocusId()===K&&(t.includes(i.id)&&this._moveCursorCmdHandler(i),n.includes(i.id)&&this._editorBridgeService.isVisible()&&this._editingChangedHandler())}))}_moveCursorCmdHandler(e){const t=e.params,{keycode:n,isShift:i}=t;n!=null&&this._cursorChange===H.CursorChange?this._moveInEditor(n,i):this._editorBridgeService.changeVisible(t)}_editingChangedHandler(){const e=this._editorBridgeService.getEditorRect();if(!e)return;const t=e.richTextObj;t.refreshDocumentByDocData(),t.resizeToContentSize();const{unitId:n}=this._renderContext;this._handleEditorVisible({visible:!0,eventType:3,unitId:n})}_getEditorObject(){return At(this._editorBridgeService.getCurrentEditorId(),this._renderManagerService)}async _handleEditorInvisible(e){const{keycode:t}=e;if(this._cursorChange=H.InitialState,this._exitInput(e),this._editorBridgeService.getEditRectState()==null)return;if(this._editorBridgeService.getEditorDirty()===!1){this._moveCursor(t);return}this._moveCursor(t)}_exitInput(e){this._contextService.setContextValue(a.EDITOR_ACTIVATED,!1),this._cellEditorManagerService.setState({show:e.visible});const t=this._editorBridgeService.getCurrentEditorId();t!=null&&this._undoRedoService.clearUndoRedo(t)}_moveCursor(e){if(e!=null)switch(a.Direction.LEFT,e){case f.KeyCode.ENTER:a.Direction.DOWN;break;case f.KeyCode.TAB:a.Direction.RIGHT;break;case f.KeyCode.ARROW_DOWN:a.Direction.DOWN;break;case f.KeyCode.ARROW_UP:a.Direction.UP;break;case f.KeyCode.ARROW_LEFT:a.Direction.LEFT;break;case f.KeyCode.ARROW_RIGHT:a.Direction.RIGHT;break}}_cursorStateListener(e){const t=this._getEditorObject();if(!t)return;const{document:n}=t;e.add(a.toDisposable(n.onPointerDown$.subscribeEvent(()=>{this._cursorChange===H.StartEditor&&(this._cursorChange=H.CursorChange)})))}_moveInEditor(e,t){let n=a.Direction.LEFT;e===f.KeyCode.ARROW_DOWN?n=a.Direction.DOWN:e===f.KeyCode.ARROW_UP?n=a.Direction.UP:e===f.KeyCode.ARROW_RIGHT&&(n=a.Direction.RIGHT),t?this._commandService.executeCommand(N.MoveSelectionOperation.id,{direction:n}):this._commandService.executeCommand(N.MoveCursorOperation.id,{direction:n})}};Ee=Lt([R(1,f.ILayoutService),R(2,a.IUndoRedoService),R(3,a.IContextService),R(4,a.IUniverInstanceService),R(5,S.IRenderManagerService),R(6,ae),R(7,be),R(8,a.Inject(ee.DocSelectionManagerService)),R(9,a.ICommandService),R(10,a.Inject(a.LocaleService)),R(11,N.IEditorService)],Ee);function At(r,e){if(r==null)return;const t=e.getRenderById(r);if(t==null)return;const{mainComponent:n,scene:i,engine:s,components:c}=t,o=n,l=c.get(N.DOCS_VIEW_KEY.BACKGROUND);return{document:o,docBackground:l,scene:i,engine:s}}var Bt=Object.getOwnPropertyDescriptor,$t=(r,e,t,n)=>{for(var i=n>1?void 0:n?Bt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},Oe=(r,e)=>(t,n)=>e(t,n,r);let ye=class extends a.RxDisposable{constructor(e,t,n,i){super();y(this,"setSlideTextEditor$",new M.Subject);y(this,"_curRichText",null);y(this,"_d");this._renderContext=e,this._instanceSrv=t,this._commandService=n,this._editorBridgeService=i,this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SLIDE).subscribe(s=>{s&&s.getUnitId()===this._renderContext.unitId?this._d=this._init():this._disposeCurrent()}))}_init(){const e=new a.DisposableCollection;return this._initEventListener(e),e}_disposeCurrent(){var e;(e=this._d)==null||e.dispose(),this._d=null}_setEditorRect(e,t){this._curRichText=t;const{scene:n,engine:i}=this._renderContext,s=this._renderContext.unitId,c={scene:n,engine:i,unitId:s,pageId:e,richTextObj:t};this._editorBridgeService.setEditorRect(c)}_initEventListener(e){const t=c=>{const o=c.getTransformer();o&&(e.add(o.clearControl$.subscribe(()=>{this.setEditorVisible(!1),this.pickOtherObjects()})),e.add(o.createControl$.subscribe(()=>{this.setEditorVisible(!1)})),e.add(c.onDblclick$.subscribeEvent(()=>{o.clearControls();const g=o.getSelectedObjectMap().values().next().value;g&&(g.objectType!==S.ObjectType.RICH_TEXT?this.pickOtherObjects():this.startEditing(c.sceneKey,g))})),e.add(this._instanceSrv.focused$.subscribe(l=>{this.endEditing()})))},{mainComponent:n}=this._renderContext;n.subSceneChanged$.subscribeEvent(c=>{t(c)});const s=Array.from(n.getSubScenes().values());for(let c=0;c<s.length;c++){const o=s[c];t(o)}}pickOtherObjects(){this.endEditing()}endEditing(){var s;if(!this._curRichText)return;this.setEditorVisible(!1);const e=this._curRichText;if(!this._instanceSrv.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE))return!1;e.refreshDocumentByDocData(),e.resizeToContentSize(),this._editorBridgeService.endEditing$.next(e);const n={bl:1,fs:e.fs,text:e.text},i=(s=e.documentData.body)==null?void 0:s.textRuns;if(i&&i.length){const o=i[0].ts;n.cl=o==null?void 0:o.cl}this._commandService.executeCommand(L.id,{unitId:this._renderContext.unitId,oKey:e==null?void 0:e.oKey,props:{richText:n}}),this._curRichText=null}startEditing(e,t){this._setEditorRect(e,t),this.setEditorVisible(!0)}setEditorVisible(e){var n,i;e?(n=this._curRichText)==null||n.hide():(i=this._curRichText)==null||i.show();const{unitId:t}=this._renderContext;this._editorBridgeService.changeVisible({visible:e,eventType:S.DeviceInputEventType.PointerDown,unitId:t})}};ye=$t([Oe(1,a.IUniverInstanceService),Oe(2,a.ICommandService),Oe(3,ae)],ye);const Te={id:"slide.operation.activate-slide",type:a.CommandType.OPERATION,handler:(r,e)=>{var g,d;const t=e.unitId,n=r.get(h.CanvasView),s=r.get(a.IUniverInstanceService).getUnit(t),c=(g=s==null?void 0:s.getActivePage())==null?void 0:g.id;if(!c)return!1;const o=n.getRenderUnitByPageId(c,t);if(!o)return!1;const l=(d=o.scene)==null?void 0:d.getTransformer();return l&&l.clearControls(),n.activePage(e.id,t),!0}},De={id:"slide.operation.append-slide",type:a.CommandType.OPERATION,handler:(r,e)=>{const t=e.unitId;return r.get(a.IUniverInstanceService).getUnit(t)?(r.get(h.CanvasView).appendPage(t),!0):!1}},ce={id:"slide.command.insert-float-image",type:a.CommandType.COMMAND,handler:async(r,e)=>{var A;const t=r.get(a.IUniverInstanceService),n=(A=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE))==null?void 0:A.getUnitId();if(!n)return!1;const s=await r.get(f.ILocalFileService).openFile({multiple:!0,accept:ge.DRAWING_IMAGE_ALLOW_IMAGE_LIST.map(x=>`.${x.replace("image/","")}`).join(",")});if(s.length!==1)return!1;const o=await r.get(ge.IImageIoService).saveImage(s[0]);if(!o)return!1;const{imageId:l,imageSourceType:g,source:d,base64Cache:v}=o,{width:_,height:m,image:I}=await ge.getImageSize(v||""),C=t.getUnit(n);if(!C)return!1;const p=C.getActivePage(),E=Object.values(p.pageElements),D=E!=null&&E.length?Math.max(...E.map(x=>x.zIndex)):20,T={id:l,zIndex:D+1,left:0,top:0,width:_,height:m,title:"",description:"",type:a.PageElementType.IMAGE,image:{imageProperties:{contentUrl:v,imageSourceType:g,source:d,base64Cache:v,image:I}}};p.pageElements[l]=T,C.updatePage(p.id,p);const U=r.get(h.CanvasView),P=U.createObjectToPage(T,p.id,n);return P&&U.setObjectActiveByPage(P,p.id,n),!0}},oe={id:"slide.command.add-text",type:a.CommandType.COMMAND,handler:async r=>{var i;const e=r.get(a.ICommandService),n=(i=r.get(a.IUniverInstanceService).getFocusedUnit())==null?void 0:i.getUnitId();return await e.executeCommand(we.id,{unitId:n})}},we={id:"slide.operation.add-text",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=e.unitId,n=a.generateRandomId(6),i=220,s=40,c=230,o=142,l=(e==null?void 0:e.text)||"A New Text",d=r.get(a.IUniverInstanceService).getUnit(t);if(!d)return!1;const v=d.getActivePage(),_=Object.values(v.pageElements),m=_!=null&&_.length?Math.max(..._.map(E=>E.zIndex)):21,I={id:n,zIndex:m+1,left:c,top:o,width:i,height:s,title:"text",description:"",type:a.PageElementType.TEXT,richText:{text:l,fs:30,cl:{rgb:"rgb(51, 51, 51)"},bl:1}};v.pageElements[n]=I,d.updatePage(v.id,v);const C=r.get(h.CanvasView),p=C.createObjectToPage(I,v.id,t);return p&&C.setObjectActiveByPage(p,v.id,t),!0}},xe={id:"slide.operation.set-slide-page-thumb",type:a.CommandType.OPERATION,handler:(r,e)=>(r.get(h.CanvasView).createThumbs(e.unitId),!0)};function Ht(r){var I,C;const e=(C=(I=r.popup)==null?void 0:I.extraProps)==null?void 0:C.menuItems;if(!e)return null;const t=f.useDependency(a.ICommandService),n=f.useDependency(a.LocaleService),[i,s]=b.useState(!1),[c,o]=b.useState(!1),l=()=>{o(!0)},g=()=>{o(!1)},d=p=>{s(p)},v=p=>{t.executeCommand(p.commandId,p.commandParams),s(!1)},_=i||c,m=e.filter(p=>!p.disable);return u.jsx("div",{onMouseEnter:l,onMouseLeave:g,children:u.jsx(w.Dropdown,{align:"start",overlay:u.jsx("ul",{className:w.clsx("univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1 univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg",w.borderClassName),children:m.map(p=>u.jsx("li",{className:"univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded univer-text-sm univer-transition-colors hover:univer-bg-gray-100",onClick:()=>v(p),children:u.jsx("span",{className:"univer-px-2 univer-py-1.5 univer-align-middle",children:n.t(p.label)})},p.index))}),open:i,onOpenChange:d,children:u.jsxs("div",{className:w.clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 dark:hover:!univer-bg-gray-800 hover:univer-bg-gray-100",w.borderClassName,{"univer-bg-gray-100 dark:!univer-bg-gray-800":i,"univer-bg-white dark:!univer-bg-gray-900":!i}),children:[u.jsx(Re,{className:"univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"}),_&&u.jsx(_e,{className:"dark:!univer-text-white"})]})})})}function Ye(){var I,C;const r=f.useDependency(a.IUniverInstanceService),e=f.useDependency(a.ICommandService),t=f.useDependency(S.IRenderManagerService),n=f.useDependency(a.LocaleService),i=b.useRef(null),s=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),c=s==null?void 0:s.getPages(),o=s==null?void 0:s.getPageOrder();if(!c||!o)return null;const l=o.map(p=>c[p]),[g,d]=b.useState((C=(I=s==null?void 0:s.getActivePage())==null?void 0:I.id)!=null?C:null),v=b.useMemo(()=>l.map(()=>b.createRef()),[l]);b.useEffect(()=>{const p=s==null?void 0:s.activePage$.subscribe(E=>{var T;const D=(T=E==null?void 0:E.id)!=null?T:null;D&&d(D)});return()=>{p==null||p.unsubscribe()}},[]),b.useEffect(()=>{v.forEach((p,E)=>{var D;if(p.current){const T=l[E];(D=t.getRenderById(T.id))==null||D.engine.setContainer(p.current)}}),v.length>0&&e.syncExecuteCommand(xe.id,{unitId:s==null?void 0:s.getUnitId()})},[v,l,t,e,s]);const _=b.useCallback(p=>{e.syncExecuteCommand(Te.id,{id:p,unitId:s==null?void 0:s.getUnitId()})},[e,s]),m=b.useCallback(()=>{e.syncExecuteCommand(De.id,{unitId:s==null?void 0:s.getUnitId()})},[e,s]);return u.jsx("aside",{ref:i,className:w.clsx("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden",w.scrollbarClassName),children:u.jsxs("div",{className:"univer-px-4",children:[u.jsx("header",{className:"univer-flex univer-justify-center univer-pt-4",children:u.jsx("a",{className:w.clsx("univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-leading-8 univer-transition-colors",w.borderClassName),onClick:m,children:n.t("slide.append")})}),l.map((p,E)=>u.jsxs("div",{className:w.clsx("univer-my-4 univer-flex univer-gap-2",{"[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600":p.id===g}),onClick:()=>_(p.id),children:[u.jsx("span",{children:E+1}),u.jsx("div",{ref:v[E],className:w.clsx("univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white hover:univer-border-primary-600",w.borderClassName)})]},p.id))]})})}const le=-1e3,Ze={width:0,height:0,top:le,left:le},qe=()=>{const[r,e]=b.useState({...Ze}),t=f.useDependency(be),n=f.useDependency(N.IEditorService),i=f.useDependency(a.IContextService),s=f.useObservable(()=>i.subscribeContextValue$(f.DISABLE_AUTO_FOCUS_KEY),!1,void 0,[i,f.DISABLE_AUTO_FOCUS_KEY]);return a.DocumentFlavor.UNSPECIFIED,b.useEffect(()=>{t.state$.subscribe(c=>{if(c==null)return;const{startX:o=le,startY:l=le,endX:g=0,endY:d=0,show:v=!1}=c;if(!v)e({...Ze});else{e({width:g-o-S.FIX_ONE_PIXEL_BLUR_OFFSET+2,height:d-l-S.FIX_ONE_PIXEL_BLUR_OFFSET+2,left:o+S.FIX_ONE_PIXEL_BLUR_OFFSET,top:l+S.FIX_ONE_PIXEL_BLUR_OFFSET});const _=n.getEditor(K);if(_==null)return;const{left:m,top:I,width:C,height:p}=_.getBoundingClientRect();t.setRect({left:m,top:I,width:C,height:p})}})},[]),b.useEffect(()=>{s||t.setFocus(!0)},[s,r]),u.jsx("div",{className:w.clsx("univer-absolute univer-z-10 univer-box-border univer-flex",w.borderClassName),style:{left:r.left,top:r.top,width:r.width,height:r.height}})},Je="addition-and-subtraction-single",Pe="slide.menu.image";function Ft(r){return{id:Pe,type:f.MenuItemType.SUBITEMS,icon:Je,tooltip:"slide.image.insert.title",hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}function Wt(r){return{id:ce.id,title:"slide.image.insert.float",type:f.MenuItemType.BUTTON,hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}const Qe="graph-single",Ue="slide.menu.shape";function zt(r){return{id:Ue,type:f.MenuItemType.SUBITEMS,icon:Qe,tooltip:"slide.shape.insert.title",hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}function kt(r){return{id:ne.id,title:"slide.shape.insert.rectangle",type:f.MenuItemType.BUTTON,hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}const et="text-single";function Kt(r){return{id:oe.id,type:f.MenuItemType.BUTTON,icon:et,tooltip:"slide.text.insert.title",hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}const tt={[f.RibbonStartGroup.FORMAT]:{[oe.id]:{order:0,menuItemFactory:Kt},[Pe]:{order:0,menuItemFactory:Ft,[ce.id]:{order:0,menuItemFactory:Wt}},[Ue]:{order:0,menuItemFactory:zt,[ne.id]:{order:0,menuItemFactory:kt}}}};function Me(r){return r.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&r.getContextValue(a.EDITOR_ACTIVATED)}function Xt(r){return r.getContextValue(a.FORMULA_EDITOR_ACTIVATED)&&r.getContextValue(a.FOCUSING_UNIVER_EDITOR)}const nt=[f.KeyCode.ARROW_DOWN,f.KeyCode.ARROW_UP,f.KeyCode.ARROW_LEFT,f.KeyCode.ARROW_RIGHT];[f.KeyCode.ENTER,f.KeyCode.TAB,...nt];function Gt(){const r=[];for(const e of nt)r.push({id:se.id,binding:e,preconditions:t=>Me(t),staticParameters:{visible:!1,eventType:S.DeviceInputEventType.Keyboard,keycode:e,isShift:!1}}),r.push({id:se.id,binding:e|f.MetaKeys.SHIFT,preconditions:t=>Me(t),staticParameters:{visible:!1,eventType:S.DeviceInputEventType.Keyboard,keycode:e,isShift:!0}});return r}const Yt={id:N.DeleteLeftCommand.id,preconditions:r=>Me(r)||Xt(r),binding:f.KeyCode.BACKSPACE};var Zt=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Zt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},X=(r,e)=>(t,n)=>e(t,n,r);h.SlidesUIController=class extends a.Disposable{constructor(e,t,n,i,s,c){super(),this._injector=e,this._menuManagerService=t,this._componentManager=n,this._uiPartsService=i,this._commandService=s,this._shortcutService=c,this._initCommands(),this._initCustomComponents(),this._initUIComponents(),this._initMenus(),this._initShortcuts()}_initMenus(){this._menuManagerService.mergeMenu(tt)}_initCustomComponents(){const e=this._componentManager;this.disposeWithMe(e.register(Je,Le)),this.disposeWithMe(e.register(et,We)),this.disposeWithMe(e.register(Qe,Be)),this.disposeWithMe(e.register(ke,Ht)),this.disposeWithMe(e.register(te,Tt))}_initCommands(){[De,Te,xe,ce,we,oe,Se,ne,Ie,pe,L,se].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_initUIComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(f.BuiltInUIPart.LEFT_SIDEBAR,()=>f.connectInjector(Ye,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(f.BuiltInUIPart.CONTENT,()=>f.connectInjector(qe,this._injector)))}_initShortcuts(){[Yt,...Gt()].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}},h.SlidesUIController=qt([X(0,a.Inject(a.Injector)),X(1,f.IMenuManagerService),X(2,a.Inject(f.ComponentManager)),X(3,f.IUIPartsService),X(4,a.ICommandService),X(5,f.IShortcutService)],h.SlidesUIController);var Jt=Object.getOwnPropertyDescriptor,Qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Jt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},Ne=(r,e)=>(t,n)=>e(t,n,r);let de=class extends a.RxDisposable{constructor(r,e,t){super(),this._contextService=r,this._instanceSrv=e,this._renderManagerService=t,Promise.resolve().then(()=>this._init())}_init(){this._initSlideDataListener(),this._initContextListener()}_initSlideDataListener(){this._instanceSrv.getTypeOfUnitAdded$(a.UniverInstanceType.UNIVER_SLIDE).pipe(M.takeUntil(this.dispose$)).subscribe(r=>{this._createRenderer(r==null?void 0:r.getUnitId())}),this._instanceSrv.getAllUnitsForType(a.UniverInstanceType.UNIVER_SLIDE).forEach(r=>{this._createRenderer(r.getUnitId())}),this._instanceSrv.getTypeOfUnitDisposed$(a.UniverInstanceType.UNIVER_SLIDE).pipe(M.takeUntil(this.dispose$)).subscribe(r=>this._disposeRenderer(r))}_createRenderer(r){r==null||this._instanceSrv.getUnit(r,a.UniverInstanceType.UNIVER_SLIDE)==null||this._renderManagerService.createRender(r)}_disposeRenderer(r){const e=r.getUnitId();this._renderManagerService.removeRender(e)}_initContextListener(){}};de=Qt([Ne(0,a.IContextService),Ne(1,a.IUniverInstanceService),Ne(2,S.IRenderManagerService)],de);var en=Object.getOwnPropertyDescriptor,tn=(r,e,t,n)=>{for(var i=n>1?void 0:n?en(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},ue=(r,e)=>(t,n)=>e(t,n,r);const nn="SLIDE_UI";h.UniverSlidesUIPlugin=(ve=class extends a.Plugin{constructor(e=Ve,t,n,i,s){super(),this._config=e,this._injector=t,this._renderManagerService=n,this._univerInstanceService=i,this._configService=s;const{menu:c,...o}=a.merge({},Ve,this._config);c&&this._configService.setConfig("menu",c,{merge:!0}),this._configService.setConfig(ot,o)}onStarting(){a.mergeOverrideWithDependencies([[de],[ae,{useClass:me}],[be,{useClass:Vt}],[h.SlideCanvasPopMangerService]],this._config.override).forEach(e=>this._injector.add(e))}onReady(){[[q]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SLIDE,e))}),a.mergeOverrideWithDependencies([[h.CanvasView],[h.SlidesUIController],[q],[re]],this._config.override).forEach(e=>{this._injector.add(e)}),this._injector.get(h.CanvasView),this._injector.get(de)}onRendered(){[[ye],[Ee]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SLIDE,e))}),this._markSlideAsFocused(),this._injector.get(h.SlidesUIController)}onSteady(){this._injector.get(re)}_markSlideAsFocused(){const e=this._univerInstanceService;try{const t=e.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE);e.focusUnit(t.getUnitId())}catch{}}},y(ve,"pluginName",nn),y(ve,"type",a.UniverInstanceType.UNIVER_SLIDE),ve),h.UniverSlidesUIPlugin=tn([ue(1,a.Inject(a.Injector)),ue(2,S.IRenderManagerService),ue(3,a.IUniverInstanceService),ue(4,a.IConfigService)],h.UniverSlidesUIPlugin),h.ActivateSlidePageOperation=Te,h.AppendSlideOperation=De,h.DeleteSlideElementOperation=pe,h.ISlideEditorBridgeService=ae,h.InsertSlideFloatImageCommand=ce,h.InsertSlideShapeRectangleCommand=ne,h.InsertSlideShapeRectangleOperation=Se,h.SHAPE_MENU_ID=Ue,h.SLIDES_IMAGE_MENU_ID=Pe,h.SLIDE_EDITOR_ID=K,h.SetSlidePageThumbOperation=xe,h.SlideAddTextCommand=oe,h.SlideAddTextOperation=we,h.SlideEditorContainer=qe,h.SlideSideBar=Ye,h.SlidesUIMenuSchema=tt,h.UpdateSlideElementOperation=L,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(h,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/slides"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/slides","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs","@univerjs/docs","@univerjs/docs-ui","@univerjs/drawing"],a):(h=typeof globalThis<"u"?globalThis:h||self,a(h.UniverSlidesUi={},h.UniverCore,h.UniverEngineRender,h.UniverSlides,h.UniverUi,h.React,h.UniverDesign,h.React,h.rxjs,h.UniverDocs,h.UniverDocsUi,h.UniverDrawing))})(this,function(h,a,I,W,f,u,x,E,M,ee,N,ge){"use strict";var rn=Object.defineProperty;var sn=(h,a,I)=>a in h?rn(h,a,{enumerable:!0,configurable:!0,writable:!0,value:I}):h[a]=I;var O=(h,a,I)=>sn(h,typeof a!="symbol"?a+"":a,I);var ve;var Qe=Object.getOwnPropertyDescriptor,et=(r,e,t,n)=>{for(var i=n>1?void 0:n?Qe(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},fe=(r,e)=>(t,n)=>e(t,n,r);let q=class extends a.RxDisposable{constructor(e,t,n,i){super();O(this,"_objectProvider",null);O(this,"_refreshThumb",a.debounce(()=>{this.createThumbs()},300));this._renderContext=e,this._injector=t,this._univerInstanceService=n,this._renderManagerService=i,this._objectProvider=this._injector.createInstance(W.ObjectProvider),this._addNewRender()}_addNewRender(){const{unitId:e,engine:t,scene:n}=this._renderContext,i=this._getCurrUnitModel();if(!i)return;const s=t.onTransformChange$.subscribeEvent(()=>{this._scrollToCenter(),s==null||s.unsubscribe()});t.onTransformChange$.subscribeEvent(()=>{setTimeout(()=>{this.createThumbs()},300)});const c=new I.Viewport(W.SLIDE_KEY.VIEW,n,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1,isWheelPreventDefaultX:!0});n.attachControl(),n.onMouseWheel$.subscribeEvent((l,g)=>{const d=l;if(d.ctrlKey){const v=Math.abs(d.deltaX);let _=v<40?.2:v<80?.4:.2;_*=d.deltaY>0?-1:1,n.scaleX<1&&(_/=2),n.scaleX+_>4?n.scale(4,4):n.scaleX+_<.1?n.scale(.1,.1):(d.deltaY>0,d.preventDefault())}else c.onMouseWheel(d,g)}),n.onFileLoaded$.subscribeEvent(()=>{this._refreshThumb()}),I.ScrollBar.attachTo(c);const o=this._createSlide(n);this._renderContext.mainComponent=o,this._createSlidePages(i,o),this.createThumbs(),t.runRenderLoop(()=>{n.render()})}_scrollToCenter(){var l;const e=(l=this._currentRender())==null?void 0:l.scene,t=e==null?void 0:e.getViewport(W.SLIDE_KEY.VIEW),n=this._getCenterPositionViewPort(e);if(!t||!n)return;const{left:i,top:s}=n,{x:c,y:o}=t.transViewportScroll2ScrollValue(i,s);t.scrollToBarPos({x:c,y:o})}_currentRender(){return I.getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_SLIDE,this._univerInstanceService,this._renderManagerService)}_createSlide(e){const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),{width:n,height:i}=e,s=t.getPageSize(),{width:c=100,height:o=100}=s,l=new I.Slide(W.SLIDE_KEY.COMPONENT,{left:(n-c)/2,top:(i-o)/2,width:c,height:o,zIndex:10});return l.enableSelectedClipElement(),e.addObject(l),l}_addBackgroundRect(e,t){const i=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE).getPageSize(),{width:s=0,height:c=0}=i,o=new I.Rect("canvas",{left:0,top:0,width:s,height:c,strokeWidth:1,stroke:"rgba(198,198,198,1)",fill:a.getColorStyle(t)||"rgba(255,255,255,1)",zIndex:0,evented:!1});e.addObject(o,0)}_getCenterPositionViewPort(e){if(!e)return{left:0,top:0};const{width:t,height:n}=e,i=e.getEngine(),s=(i==null?void 0:i.width)||0,c=(i==null?void 0:i.height)||0;return{left:(t-s)/2,top:(n-c)/2}}_thumbSceneRender(e,t){const n=this._renderManagerService.getRenderById(e);if(n==null)return;const{engine:i}=n;if(i==null)return;const{width:s,height:c}=t,{width:o=s,height:l=c}=i,g=i.getCanvas().getContext();t.renderToThumb(g,e,o/s,l/c)}_createSlidePages(e,t){const n=e.getPages(),i=e.getPageOrder();if(!(!n||!i)&&i.length!==0){for(let s=0,c=i.length;s<c;s++){const o=i[s];this.createPageScene(o,n[o]),this._createThumb(o)}t.activeFirstPage()}}_createThumb(e){this._renderManagerService.createRender(e)}_getCurrUnitModel(){return this._renderContext.unit}activePage(e){let t=e;const n=this._getCurrUnitModel();let i;if(t)i=n.getPage(t);else{const l=n.getPages(),g=n.getPageOrder();if(g==null||l==null)return;i=l[g[0]],t=i.id}const s=this._currentRender();if(i==null||s==null||s.mainComponent==null)return;const{id:c}=i,o=s.mainComponent;if(n.setActivePage(i),o!=null&&o.hasPage(c)){o.changePage(c);return}this.createPageScene(c,i)}createThumbs(){const t=this._getCurrUnitModel().getPageOrder(),n=this._currentRender();if(!(!t||!n)&&t.length!==0)for(let i=0,s=t.length;i<s;i++){const c=t[i];this._thumbSceneRender(c,n.mainComponent)}}createPageScene(e,t){const n=this._renderContext;if(!n||!this._objectProvider)return;const{scene:i,mainComponent:s}=n,c=s,{width:o,height:l}=c,g=new I.Scene(e,c,{width:o,height:l});new I.Viewport(`PageViewer_${e}`,g,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1}).closeClip();const{pageElements:v,pageBackgroundFill:_}=t,m=this._objectProvider.convertToRenderObjects(v,i);if(!m||!c)return;this._addBackgroundRect(g,_),g.addObjects(m),g.initTransformer(),m.forEach(C=>{g.attachTransformerTo(C)});const S=g.getTransformer();return S==null||S.changeEnd$.subscribe(()=>{this._thumbSceneRender(e,c)}),S==null||S.clearControl$.subscribe(()=>{this._thumbSceneRender(e,c)}),c.addPageScene(g),g}getPageRenderUnit(e){const n=this._renderContext.mainComponent.getSubScenes().get(e),{engine:i,unit:s}=this._renderContext;return{scene:n,engine:i,unit:s}}createObjectToPage(e,t){const{scene:n}=this.getPageRenderUnit(t);if(!n||!this._objectProvider)return;const i=this._objectProvider.convertToRenderObject(e,n);if(i)return n.addObject(i),n.attachTransformerTo(i),n.getLayer().makeDirty(),i}setObjectActiveByPage(e,t){const{scene:n}=this.getPageRenderUnit(t);if(!n)return;const i=n.getTransformer();i==null||i.activeAnObject(e)}removeObjectById(e,t){const{scene:n}=this.getPageRenderUnit(t);if(!n)return;n.removeObject(e);const i=n.getTransformer();i==null||i.clearControls()}appendPage(){const e=this._getCurrUnitModel(),t=e.getBlankPage(),n=this._currentRender();if(t==null||n==null||n.mainComponent==null)return;const{id:i}=t,s=n.mainComponent,c=this.createPageScene(i,t);s&&c&&s.addPageScene(c),e.appendPage(t),e.setActivePage(t)}};q=et([fe(1,a.Inject(a.Injector)),fe(2,a.IUniverInstanceService),fe(3,I.IRenderManagerService)],q);var tt=Object.getOwnPropertyDescriptor,nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?tt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},it=(r,e)=>(t,n)=>e(t,n,r);h.CanvasView=class extends a.RxDisposable{constructor(e){super(),this._renderManagerService=e}_getSlideRenderControllerFromRenderUnit(e){return this._renderManagerService.getRenderById(e).with(q)}createThumbs(e){this._getSlideRenderControllerFromRenderUnit(e).createThumbs()}activePage(e,t){this._getSlideRenderControllerFromRenderUnit(t).activePage(e)}getRenderUnitByPageId(e,t){return this._getSlideRenderControllerFromRenderUnit(t).getPageRenderUnit(e)}createObjectToPage(e,t,n){return this._getSlideRenderControllerFromRenderUnit(n).createObjectToPage(e,t)}setObjectActiveByPage(e,t,n){return this._getSlideRenderControllerFromRenderUnit(n).setObjectActiveByPage(e,t)}removeObjectById(e,t,n){this._getSlideRenderControllerFromRenderUnit(n).removeObjectById(e,t)}appendPage(e){this._getSlideRenderControllerFromRenderUnit(e).appendPage()}},h.CanvasView=nt([it(0,I.IRenderManagerService)],h.CanvasView);const rt="slides-ui.config",Re={},pe={id:"slide.operation.delete-element",type:a.CommandType.OPERATION,handler:(r,e)=>{if(!(e!=null&&e.id))return!1;const t=e.unitId,i=r.get(a.IUniverInstanceService).getUnit(t);if(!i)return!1;const s=i.getActivePage();return delete s.pageElements[e.id],i.updatePage(s.id,s),r.get(h.CanvasView).removeObjectById(e.id,s.id,t),!0}};var R=function(){return R=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},R.apply(this,arguments)},st=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},A=E.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,s=r.extend,c=st(r,["icon","id","className","extend"]),o="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=E.useRef("_".concat(ot()));return je(t,"".concat(n),{defIds:t.defIds,idSuffix:l.current},R({ref:e,className:o},c),s)});function je(r,e,t,n,i){return E.createElement(r.tag,R(R({key:e},at(r,t,i)),n),(ct(r,t).children||[]).map(function(s,c){return je(s,"".concat(e,"-").concat(r.tag,"-").concat(c),t,void 0,i)}))}function at(r,e,t){var n=R({},r.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),r.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(s){var c=s[0],o=s[1];c==="mask"&&typeof o=="string"&&(n[c]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var i=e.defIds;return!i||i.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(s){var c=s[0],o=s[1];typeof o=="string"&&(n[c]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function ct(r,e){var t,n=e.defIds;return!n||n.length===0?r:r.tag==="defs"&&(!((t=r.children)===null||t===void 0)&&t.length)?R(R({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?R(R({},i),{attrs:R(R({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function ot(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";var lt={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"}}]},Ve=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"autofill-double-icon",ref:e,icon:lt}))});Ve.displayName="AutofillDoubleIcon";var dt={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"}}]},Le=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"bottom-icon",ref:e,icon:dt}))});Le.displayName="BottomIcon";var ut={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{clipPath:"url(#graph-icon_clip0_1293_28)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6.29541 11.1896C3.83208 10.7489 1.9624 8.59552 1.9624 6.00544C1.9624 3.09673 4.32036 0.73877 7.22907 0.73877C9.93483 0.73877 12.164 2.77918 12.4619 5.40527H13.5621C14.998 5.40527 16.1621 6.56933 16.1621 8.00527V12.6719C16.1621 14.1079 14.998 15.2719 13.5621 15.2719H8.89541C7.45947 15.2719 6.29541 14.1079 6.29541 12.6719V11.1896ZM3.1624 6.00544C3.1624 3.75947 4.98311 1.93877 7.22907 1.93877C9.27112 1.93877 10.9616 3.44388 11.2518 5.40527H8.89541C7.45947 5.40527 6.29541 6.56933 6.29541 8.00527V9.96442C4.49946 9.5425 3.1624 7.93012 3.1624 6.00544ZM7.49541 8.00527C7.49541 7.23207 8.12221 6.60527 8.89541 6.60527H13.5621C14.3353 6.60527 14.9621 7.23207 14.9621 8.00527V12.6719C14.9621 13.4451 14.3353 14.0719 13.5621 14.0719H8.89541C8.12221 14.0719 7.49541 13.4451 7.49541 12.6719V8.00527Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"graph-icon_clip0_1293_28"},children:[{tag:"path",attrs:{fill:"white",d:"M0 0H16V16H0z",transform:"translate(.9)"}}]}]}],defIds:["graph-icon_clip0_1293_28"]},Ae=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"graph-icon",ref:e,icon:ut}))});Ae.displayName="GraphIcon";var vt={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"}}]},_e=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"more-down-icon",ref:e,icon:vt}))});_e.displayName="MoreDownIcon";var ht={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"}}]},Be=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"move-down-icon",ref:e,icon:ht}))});Be.displayName="MoveDownIcon";var gt={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"}}]},$e=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"move-up-icon",ref:e,icon:gt}))});$e.displayName="MoveUpIcon";var ft={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:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},Fe=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"paint-bucket-double-icon",ref:e,icon:ft}))});Fe.displayName="PaintBucketDoubleIcon";var pt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#text-icon_clip0_1293_26)"},children:[{tag:"path",attrs:{d:"M2.22891 2.07227C1.89754 2.07227 1.62891 2.34089 1.62891 2.67227C1.62891 3.00364 1.89754 3.27227 2.22891 3.27227H6.29541V14.0056C6.29541 14.337 6.56404 14.6056 6.89541 14.6056C7.22678 14.6056 7.49541 14.337 7.49541 14.0056V3.27227H11.5622C11.8936 3.27227 12.1622 3.00364 12.1622 2.67227C12.1622 2.34089 11.8936 2.07227 11.5622 2.07227H2.22891Z"}},{tag:"path",attrs:{d:"M10.2289 6.40552C9.89754 6.40552 9.62891 6.67415 9.62891 7.00552C9.62891 7.33689 9.89754 7.60552 10.2289 7.60552H12.2954V14.0055C12.2954 14.3369 12.564 14.6055 12.8954 14.6055C13.2268 14.6055 13.4954 14.3369 13.4954 14.0055V7.60552H15.5622C15.8936 7.60552 16.1622 7.33689 16.1622 7.00552C16.1622 6.67415 15.8936 6.40552 15.5622 6.40552H10.2289Z"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"text-icon_clip0_1293_26"},children:[{tag:"path",attrs:{fill:"white",d:"M0 0H16V16H0z",transform:"translate(.9)"}}]}]}],defIds:["text-icon_clip0_1293_26"]},He=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"text-icon",ref:e,icon:pt}))});He.displayName="TextIcon";var _t={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"}}]},We=E.forwardRef(function(r,e){return E.createElement(A,Object.assign({},r,{id:"topmost-icon",ref:e,icon:_t}))});We.displayName="TopmostIcon";const j={id:"slide.operation.update-element",type:a.CommandType.OPERATION,handler:(r,e)=>{const{oKey:t,props:n}=e,i=r.get(a.IUniverInstanceService),s=e==null?void 0:e.unitId,c=i.getUnit(s);if(!c)return!1;const o=c.getActivePage();return o.pageElements[t]=a.Tools.deepMerge(o.pageElements[t],n),c.updatePage(o.id,o),!0}};function It(r){const{pageId:e,unitId:t}=r,n=f.useDependency(a.LocaleService),i=f.useDependency(h.CanvasView),s=f.useDependency(a.ICommandService),c=i.getRenderUnitByPageId(e,t),o=c==null?void 0:c.scene;if(!o)return null;const l=o.getTransformer();if(!l)return null;const d=l.getSelectedObjectMap().values().next().value;if(!d)return null;const v=_=>{const m=o.getAllObjects(),[S,C]=m.reduce(([b,w],T)=>{const U=T.zIndex,P=U<b?U:b,L=U>w?U:w;return[P,L]},[0,0]);let p=d.zIndex;_===3?p=S-1:_===2?p=C+1:_===0?p=d.zIndex+1:_===1&&(p=d.zIndex-1),d.setProps({zIndex:p}),s.executeCommand(j.id,{unitId:t,oKey:d==null?void 0:d.oKey,props:{zIndex:p}})};return u.jsxs("div",{className:"univer-relative univer-w-full",children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",children:u.jsx("div",{children:n.t("image-panel.arrange.title")})})}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/2",children:u.jsx(x.Button,{onClick:()=>{v(0)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx($e,{}),n.t("image-panel.arrange.forward")]})})}),u.jsx("div",{className:"univer-w-1/2",children:u.jsx(x.Button,{onClick:()=>{v(1)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx(Be,{}),n.t("image-panel.arrange.backward")]})})})]}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/2",children:u.jsx(x.Button,{onClick:()=>{v(2)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx(We,{}),n.t("image-panel.arrange.front")]})})}),u.jsx("div",{className:"univer-w-1/2",children:u.jsx(x.Button,{onClick:()=>{v(3)},children:u.jsxs("span",{className:"univer-flex univer-items-center univer-gap-1",children:[u.jsx(Le,{}),n.t("image-panel.arrange.back")]})})})]})]})}function St(r){var S,C;const{pageId:e,unitId:t}=r,n=f.useDependency(a.LocaleService),i=f.useDependency(h.CanvasView),s=f.useDependency(a.ICommandService),c=i.getRenderUnitByPageId(e,t),o=c==null?void 0:c.scene;if(!o)return null;const l=o.getTransformer();if(!l)return null;const d=l.getSelectedObjectMap().values().next().value;if(!d)return null;const[v,_]=E.useState((C=(S=d.fill)==null?void 0:S.toString())!=null?C:"");function m(p){d==null||d.setProps({fill:p}),s.executeCommand(j.id,{unitId:t,oKey:d==null?void 0:d.oKey,props:{shape:{shapeProperties:{shapeBackgroundFill:{rgb:p}}}}}),_(p)}return u.jsx("div",{className:x.clsx("univer-relative univer-bottom-0 univer-mt-5 univer-w-full",x.borderTopClassName),children:u.jsxs("div",{className:"univer-relative univer-w-full",children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",children:u.jsx("div",{children:n.t("slide.panel.fill.title")})})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-1/2",children:u.jsx(x.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(x.ColorPicker,{value:"#fff",onChange:m})}),children:u.jsxs("a",{className:"univer-flex univer-cursor-pointer univer-items-center univer-gap-1",children:[u.jsx(Fe,{className:"univer-fill-primary-600"}),u.jsx(_e,{})]})})})})]})})}function Ct(r){const{pageId:e,unitId:t}=r,n=f.useDependency(a.LocaleService),i=f.useDependency(h.CanvasView),s=f.useDependency(a.ICommandService),c=i.getRenderUnitByPageId(e,t),o=c==null?void 0:c.scene;if(!o)return null;const l=o.getTransformer();if(!l)return null;const d=l.getSelectedObjectMap().values().next().value;if(!d)return null;const{width:v=0,height:_=0,left:m=0,top:S=0,angle:C=0}=d,[p,b]=E.useState(v),[w,T]=E.useState(_),[U,P]=E.useState(m),[L,D]=E.useState(S),[Z,$]=E.useState(C),H=y=>{const{objects:J}=y,Q=J.values().next().value,{width:Jt=0,height:Qt=0,left:en=0,top:tn=0,angle:nn=0}=Q;b(Jt),T(Qt),P(en),D(tn),$(nn)};E.useEffect(()=>{const y=l.changeStart$.subscribe(Q=>{H(Q)}),J=l.changing$.subscribe(Q=>{H(Q)});return()=>{J.unsubscribe(),y.unsubscribe()}},[]);function B(y){!y||!d||(s.executeCommand(j.id,{pageId:e,oKey:d.oKey,props:{width:y}}),d==null||d.resize(y,d.height),b(y),l==null||l.refreshControls())}function G(y){!y||!d||(s.executeCommand(j.id,{pageId:e,oKey:d.oKey,props:{height:y}}),d==null||d.resize(d.width,y),T(y),l==null||l.refreshControls())}function Y(y){!y||!d||(s.executeCommand(j.id,{pageId:e,oKey:d.oKey,props:{left:y}}),d==null||d.translate(y,d.top),P(y),l==null||l.refreshControls())}function K(y){!y||!d||(s.executeCommand(j.id,{pageId:e,oKey:d.oKey,props:{right:y}}),d==null||d.translate(d.left,y),D(y),l==null||l.refreshControls())}function he(y){!y||!d||(s.executeCommand(j.id,{pageId:e,oKey:d.oKey,props:{angle:y}}),d==null||d.transformByState({angle:y}),$(y),l==null||l.refreshControls())}return u.jsxs("div",{className:x.clsx("univer-relative univer-bottom-0 univer-mt-5 univer-w-full",x.borderTopClassName),children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",children:u.jsx("div",{children:n.t("image-panel.transform.title")})})}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.width")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(x.InputNumber,{className:"univer-w-11/12",min:1,value:p,onChange:y=>{B(y)}})})})]})}),u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.height")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(x.InputNumber,{className:"univer-w-11/12",min:1,value:w,onChange:y=>{G(y)}})})})]})})]}),u.jsxs("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:[u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.x")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(x.InputNumber,{className:"univer-w-11/12",precision:1,min:0,value:U,onChange:y=>{Y(y)}})})})]})}),u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.y")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(x.InputNumber,{className:"univer-w-11/12",precision:1,min:0,value:L,onChange:y=>{K(y)}})})})]})}),u.jsx("div",{className:"univer-w-1/3",children:u.jsxs("label",{children:[u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:n.t("image-panel.transform.rotate")})}),u.jsx("div",{className:"univer-relative univer-mt-2.5 univer-flex univer-h-full",children:u.jsx("div",{className:"univer-w-full",children:u.jsx(x.InputNumber,{className:"univer-w-11/12",precision:1,value:Z,onChange:he})})})]})})]})]})}const te="COMPONENT_SLIDE_SIDEBAR";function mt(){var g,d,v;const r=f.useDependency(a.IUniverInstanceService),e=f.useDependency(h.CanvasView),t=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),n=(g=t==null?void 0:t.getActivePage())==null?void 0:g.id;if(!n)return null;const s=(d=e.getRenderUnitByPageId(n,n).scene)==null?void 0:d.getTransformer();if(!s)return null;const o=s.getSelectedObjectMap().values().next().value;if(!o)return null;const l=((v=r.getFocusedUnit())==null?void 0:v.getUnitId())||"";return u.jsxs("section",{className:"univer-p-2 univer-text-center univer-text-sm",children:[u.jsx(It,{pageId:n,unitId:l}),u.jsx(Ct,{pageId:n,unitId:l}),o.objectType===I.ObjectType.RECT&&u.jsx(St,{pageId:n,unitId:l})]})}const ne={id:"slide.command.insert-float-shape",type:a.CommandType.COMMAND,handler:async r=>{var i;const e=r.get(a.ICommandService),n=(i=r.get(a.IUniverInstanceService).getFocusedUnit())==null?void 0:i.getUnitId();return e.executeCommand(Ie.id,{unitId:n})}},Ie={id:"slide.operation.insert-float-shape",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=a.generateRandomId(6),n=r.get(a.IUniverInstanceService),i=e.unitId,s=n.getUnit(i);if(!s)return!1;const c=s.getActivePage(),o=Object.values(c.pageElements),l=o!=null&&o.length?Math.max(...o.map(_=>_.zIndex)):20,g={id:t,zIndex:l+1,left:378,top:142,width:250,height:250,title:t,description:"",type:a.PageElementType.SHAPE,shape:{shapeType:a.BasicShapes.Rect,text:"",shapeProperties:{shapeBackgroundFill:{rgb:"rgb(0,0,255)"}}}};c.pageElements[t]=g,s.updatePage(c.id,c);const d=r.get(h.CanvasView),v=d.createObjectToPage(g,c.id,i);return v&&d.setObjectActiveByPage(v,c.id,i),!0}},Se={id:"sidebar.operation.slide-shape",type:a.CommandType.COMMAND,handler:async(r,e)=>{const{visible:t,objectType:n}=e,i=r.get(f.ISidebarService),s=r.get(a.LocaleService);let c="",o="";return n===I.ObjectType.RECT?(c="slide.sidebar.shape",o=te):n===I.ObjectType.IMAGE?(c="slide.sidebar.image",o=te):n===I.ObjectType.RICH_TEXT&&(c="slide.sidebar.text",o=te),t?i.open({header:{title:s.t(c)},children:{label:o},onClose:()=>{},width:360}):i.close(),!0}},ke="COMPONENT_SLIDE_IMAGE_POPUP_MENU";var bt=Object.getOwnPropertyDescriptor,Et=(r,e,t,n)=>{for(var i=n>1?void 0:n?bt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},ie=(r,e)=>(t,n)=>e(t,n,r);function yt(r,e){const t=Ke(r.left,r.top,e),n=Ke(r.right,r.bottom,e);return{left:t.x,top:t.y,right:n.x,bottom:n.y}}function Ke(r,e,t){const{scaleX:n,scaleY:i}=t.getAncestorScale(),s=t.getViewport(W.SLIDE_KEY.VIEW);if(!s)return{x:r,y:e};const{viewportScrollX:c,viewportScrollY:o}=s,l=(r-c)*n,g=(e-o)*i;return{x:l,y:g}}h.SlideCanvasPopMangerService=class extends a.Disposable{constructor(e,t,n,i){super(),this._globalPopupManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._commandService=i}_createObjectPositionObserver(e,t){const i=(()=>{var B,G,Y,K;const{scene:o,engine:l}=t,{left:g,top:d,width:v,height:_}=e,m=(o.width-((G=(B=t.mainComponent)==null?void 0:B.width)!=null?G:0))/2,S=(o.height-((K=(Y=t.mainComponent)==null?void 0:Y.height)!=null?K:0))/2,C={left:g,right:g+v,top:d,bottom:d+_},p=l.getCanvasElement(),b=p.getBoundingClientRect(),w=I.pxToNum(p.style.width),{scaleX:T,scaleY:U}=o.getAncestorScale(),P=yt(C,o),{top:L,left:D,width:Z}=b,$=Z/w;return{left:P.left*$*T+D+m,right:P.right*$*T+D+m,top:P.top*$*U+L+S,bottom:P.bottom*$*U+L+S}})(),s=new M.BehaviorSubject(i),c=new a.DisposableCollection;return{position:i,position$:s,disposable:c}}attachPopupToObject(e,t){const i=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE).getUnitId(),s=this._renderManagerService.getRenderById(i);if(!s)return{dispose:()=>{}};const{position:c,position$:o,disposable:l}=this._createObjectPositionObserver(e,s),g=this._globalPopupManagerService.addPopup({...t,unitId:i,subUnitId:"default",anchorRect:c,anchorRect$:o,canvasElement:s.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(g),o.complete(),l.dispose()}}}},h.SlideCanvasPopMangerService=Et([ie(0,a.Inject(f.ICanvasPopupService)),ie(1,I.IRenderManagerService),ie(2,a.IUniverInstanceService),ie(3,a.ICommandService)],h.SlideCanvasPopMangerService);var Ot=Object.getOwnPropertyDescriptor,Tt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ot(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},k=(r,e)=>(t,n)=>e(t,n,r);let re=class extends a.RxDisposable{constructor(e,t,n,i,s,c,o){super();O(this,"_initImagePopupMenu",new Set);this._canvasPopManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._contextService=i,this._canvasView=s,this._sidebarService=c,this._commandService=o,this._init()}_init(){this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SLIDE).forEach(e=>this._create(e))}_create(e){if(!e)return;const t=e.getUnitId();this._renderManagerService.has(t)&&!this._initImagePopupMenu.has(t)&&(this._popupMenuListener(t),this._initImagePopupMenu.add(t))}_hasCropObject(e){}_popupMenuListener(e){var i;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),n=(i=t==null?void 0:t.getPages())!=null?i:{};Object.keys(n).forEach(s=>{var g;const o=(g=this._canvasView.getRenderUnitByPageId(s,e).scene)==null?void 0:g.getTransformer();if(!o)return;let l;this.disposeWithMe(a.toDisposable(o.createControl$.subscribe(()=>{const d=o.getSelectedObjectMap();if(d.size>1){l==null||l.dispose();return}const v=d.values().next().value;if(!v)return;const _=v.oKey;l==null||l.dispose(),l=this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(v,{componentKey:ke,direction:"horizontal",offset:[2,0],extraProps:{menuItems:this._getMenuItemsByObjectType(v.objectType,_,e)}})),this._sidebarService.visible&&this._commandService.executeCommand(Se.id,{visible:!0,objectType:v.objectType})}))),this.disposeWithMe(o.clearControl$.subscribe(()=>{l==null||l.dispose(),this._contextService.setContextValue(a.FOCUSING_COMMON_DRAWINGS,!1)})),this.disposeWithMe(o.changing$.subscribe(()=>{l==null||l.dispose();const d=o.getSelectedObjectMap();if(d.size>1){l==null||l.dispose();return}const v=d.values().next().value;v&&this._commandService.executeCommand(j.id,{unitId:e,oKey:v.oKey,props:{width:v.width,height:v.height,left:v.left,top:v.top}})}))})}_getMenuItemsByObjectType(e,t,n){return[{label:"slide.popup.edit",index:0,commandId:Se.id,commandParams:{visible:!0,objectType:e},disable:!1},{label:"slide.popup.delete",index:5,commandId:pe.id,commandParams:{id:t,unitId:n},disable:!1}]}};re=Tt([k(0,a.Inject(h.SlideCanvasPopMangerService)),k(1,I.IRenderManagerService),k(2,a.IUniverInstanceService),k(3,a.IContextService),k(4,a.Inject(h.CanvasView)),k(5,f.ISidebarService),k(6,a.ICommandService)],re);const se={id:"slide.operation.edit-arrow",type:a.CommandType.OPERATION,handler:()=>!0},z=a.createInternalEditorID("SLIDE_EDITOR");var wt=Object.getOwnPropertyDescriptor,xt=(r,e,t,n)=>{for(var i=n>1?void 0:n?wt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},Ce=(r,e)=>(t,n)=>e(t,n,r);const ae=a.createIdentifier("univer.slide-editor-bridge.service");let me=class extends a.Disposable{constructor(e,t,n){super();O(this,"_editorUnitId",z);O(this,"_isForceKeepVisible",!1);O(this,"_editorIsDirty",!1);O(this,"_currentEditRectState",null);O(this,"_currentEditRectState$",new M.BehaviorSubject(null));O(this,"currentEditRectState$",this._currentEditRectState$.asObservable());O(this,"_visibleParam",{visible:!1,eventType:I.DeviceInputEventType.Dblclick,unitId:""});O(this,"_visible$",new M.BehaviorSubject(this._visibleParam));O(this,"visible$",this._visible$.asObservable());O(this,"_afterVisible$",new M.BehaviorSubject(this._visibleParam));O(this,"afterVisible$",this._afterVisible$.asObservable());O(this,"endEditing$",new M.Subject);O(this,"_currentEditRectInfo");this._editorService=e,this._contextService=t,this._renderManagerService=n}dispose(){super.dispose()}getEditorRect(){return this._currentEditRectInfo}setEditorRect(e){this._currentEditRectInfo=e,this._editorService.getFocusEditor()||(this._editorService.focus(z),this._contextService.setContextValue(a.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(a.FOCUSING_EDITOR_STANDALONE,!1),this._contextService.setContextValue(a.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE,!1));const t=this.getEditRectState();this._currentEditRectState=t,this._currentEditRectState$.next(t)}changeVisible(e){this._visibleParam=e,e.visible&&(this._editorIsDirty=!1),this._visible$.next(this._visibleParam),this._afterVisible$.next(this._visibleParam)}getEditRectState(){const e=z,t=this._currentEditRectInfo,n=t.unitId,i=t.richTextObj.documentData;i.id=e,i.documentStyle={...i.documentStyle,pageSize:{width:t.richTextObj.width,height:1/0}};const c={documentModel:new a.DocumentDataModel(i),fontString:"document",textRotation:{a:0,v:0},wrapStrategy:0,verticalAlign:a.VerticalAlign.TOP,horizontalAlign:a.HorizontalAlign.LEFT,paddingData:{t:0,b:1,l:2,r:2}},o=t.richTextObj.width,l=t.richTextObj.height,g=t.richTextObj.left,d=t.richTextObj.top,v={left:0,top:0},_=this._renderManagerService.getRenderById(n),m=_==null?void 0:_.scene,S=m==null?void 0:m.getViewport(W.SLIDE_KEY.VIEW),C=m==null?void 0:m.getObject(W.SLIDE_KEY.COMPONENT),p={x:(C==null?void 0:C.left)||0,y:(C==null?void 0:C.top)||0},b=(S==null?void 0:S.viewportScrollX)||0,w=(S==null?void 0:S.viewportScrollY)||0;return v.left=p.x-b,v.top=p.y-w,{position:{startX:g,startY:d,endX:g+o,endY:d+l},scaleX:1,scaleY:1,slideCardOffset:v,unitId:n,editorUnitId:e,documentLayoutObject:c}}changeEditorDirty(e){this._editorIsDirty=e}isVisible(){return this._visibleParam.visible}getEditorDirty(){return this._editorIsDirty}getCurrentEditorId(){return this._editorUnitId}genDocData(e){const t=this.getCurrentEditorId(),n=e.text,i=e.fs;return{id:t,body:{dataStream:`${n}\r
|
|
2
|
+
`,textRuns:[{st:0,ed:n.length}],paragraphs:[{paragraphStyle:{},startIndex:n.length+1}],sectionBreaks:[{startIndex:n.length+2}]},documentStyle:{marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,pageSize:{width:1/0,height:1/0},textStyle:{fs:i},renderConfig:{verticalAlign:a.VerticalAlign.MIDDLE,centerAngle:0,vertexAngle:0,wrapStrategy:0}},drawings:{},drawingsOrder:[],settings:{zoomRatio:1}}}};me=xt([Ce(0,N.IEditorService),Ce(1,a.IContextService),Ce(2,I.IRenderManagerService)],me);class Dt{constructor(){O(this,"_state",null);O(this,"_rect",null);O(this,"_state$",new M.BehaviorSubject(null));O(this,"state$",this._state$.asObservable());O(this,"_rect$",new M.BehaviorSubject(null));O(this,"rect$",this._rect$.asObservable());O(this,"_focus",!1);O(this,"_focus$",new M.BehaviorSubject(this._focus));O(this,"focus$",this._focus$.asObservable())}dispose(){this._state$.complete(),this._state=null,this._rect$.complete(),this._rect=null}setState(e){this._state=e,this._refresh(e)}getRect(){return this._rect}setRect(e){this._rect=e,this._rect$.next(e)}getState(){return this._state}setFocus(e=!1){this._focus=e,this._focus$.next(e)}_refresh(e){this._state$.next(e)}}const be=a.createIdentifier("univer.slide-editor-manager.service");var F=(r=>(r[r.InitialState=0]="InitialState",r[r.StartEditor=1]="StartEditor",r[r.CursorChange=2]="CursorChange",r))(F||{}),Pt=Object.getOwnPropertyDescriptor,Ut=(r,e,t,n)=>{for(var i=n>1?void 0:n?Pt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},V=(r,e)=>(t,n)=>e(t,n,r);const ze=-1e3,Xe=5,Mt=2;let Ee=class extends a.Disposable{constructor(e,t,n,i,s,c,o,l,g,d,v,_){super();O(this,"_cursorChange",F.InitialState);O(this,"_isUnitEditing",!1);O(this,"_d");this._renderContext=e,this._layoutService=t,this._undoRedoService=n,this._contextService=i,this._instanceSrv=s,this._renderManagerService=c,this._editorBridgeService=o,this._cellEditorManagerService=l,this._textSelectionManagerService=g,this._commandService=d,this._localService=v,this._editorService=_,this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SLIDE).subscribe(m=>{m&&m.getUnitId()===this._renderContext.unitId?this._d=this._init():(this._disposeCurrent(),this._isUnitEditing&&(this._handleEditorInvisible({visible:!1,eventType:I.DeviceInputEventType.Keyboard,keycode:f.KeyCode.ESC,unitId:this._renderContext.unitId}),this._isUnitEditing=!1))})),this._initEditorVisibilityListener()}dispose(){super.dispose(),this._disposeCurrent()}_disposeCurrent(){var e;(e=this._d)==null||e.dispose(),this._d=null}_init(){const e=new a.DisposableCollection;return this._subscribeToCurrentCell(e),this._initialKeyboardListener(e),this._initialCursorSync(e),this._listenEditorFocus(e),this._commandExecutedListener(e),setTimeout(()=>{this._cursorStateListener(e)},1e3),e}_initEditorVisibilityListener(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible?(this._isUnitEditing=!0,this._handleEditorVisible(e)):this._isUnitEditing&&(this._handleEditorInvisible(e),this._isUnitEditing=!1)}))}_listenEditorFocus(e){const t=this._getEditorObject();t&&e.add(t.document.onPointerDown$.subscribeEvent(()=>{}))}_getEditorSkeleton(e){var t;return(t=this._renderManagerService.getRenderById(e))==null?void 0:t.with(ee.DocSkeletonManagerService).getSkeleton()}_getEditorViewModel(e){var t;return(t=this._renderManagerService.getRenderById(e))==null?void 0:t.with(ee.DocSkeletonManagerService).getViewModel()}_initialCursorSync(e){e.add(this._cellEditorManagerService.focus$.pipe(M.filter(t=>!!t)).subscribe(()=>{var t;(t=I.getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_DOC,this._instanceSrv,this._renderManagerService))==null||t.with(N.DocSelectionRenderService).sync()}))}_subscribeToCurrentCell(e){e.add(this._editorBridgeService.currentEditRectState$.subscribe(t=>{var v;if(t==null||this._contextService.getContextValue(a.FOCUSING_EDITOR_STANDALONE)||this._contextService.getContextValue(a.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE))return;const{position:{startX:n,endX:i},documentLayoutObject:{textRotation:s,wrapStrategy:c,documentModel:o},scaleX:l,editorUnitId:g}=t,{vertexAngle:d}=I.convertTextRotation(s);o.updateDocumentId(g),c===a.WrapStrategy.WRAP&&d===0&&o.updateDocumentDataPageSize((i-n)/l),this._instanceSrv.changeDoc(g,o),this._contextService.setContextValue(a.FOCUSING_EDITOR_BUT_HIDDEN,!0),this._textSelectionManagerService.replaceTextRanges([{startOffset:0,endOffset:0}]),(v=I.getCurrentTypeOfRenderer(a.UniverInstanceType.UNIVER_DOC,this._instanceSrv,this._renderManagerService))==null||v.with(N.DocSelectionRenderService).activate(ze,ze)}))}_fitTextSize(e,t,n,i,s=1,c=1){const{startX:o,startY:l,endX:g,endY:d}=e,v=i.documentModel;if(v==null)return;const{actualWidth:_,actualHeight:m}=this._predictingSize(e,t,n,i,s,c),{verticalAlign:S,paddingData:C,fill:p}=i;let b=g-o,w=d-l;if(b<_&&(b=_),w<m)w=m,v.updateDocumentDataMargin(C);else{let T=0;S===a.VerticalAlign.MIDDLE?T=(w-m)/2/c:S===a.VerticalAlign.TOP?T=C.t||0:T=(w-m)/c-(C.b||0),T=T<(C.t||0)?C.t||0:T,v.updateDocumentDataMargin({t:T})}n.calculate(),this._editAreaProcessing(b,w,e,t,p,s,c)}_predictingSize(e,t,n,i,s=1,c=1){const{startX:o,endX:l}=e,{textRotation:g,wrapStrategy:d}=i,v=i.documentModel,{vertexAngle:_}=I.convertTextRotation(g),m=document.body.clientWidth;if(d===a.WrapStrategy.WRAP&&_===0){const{actualWidth:p,actualHeight:b}=n.getActualSize();return{actualWidth:p*s,actualHeight:b*c}}v==null||v.updateDocumentDataPageSize((m-o-t.left)/s),n.calculate();const S=n.getActualSize();let C=l-o;return C<S.actualWidth*s+Xe*s&&(C=S.actualWidth*s+Xe*s),v==null||v.updateDocumentDataPageSize(C/s),v==null||v.updateDocumentRenderConfig({horizontalAlign:a.HorizontalAlign.UNSPECIFIED,cellValueType:void 0}),{actualWidth:C,actualHeight:S.actualHeight*c}}_editAreaProcessing(e,t,n,i,s,c=1,o=1){var y;const l=this._getEditorObject();if(l==null)return;function g(J){return Number.parseInt(J.replace("px",""))}const v=this._renderContext.engine.getCanvasElement(),_=v.getBoundingClientRect(),m=g(v.style.width),{top:S,left:C,width:p}=_,b=p/m;let{startX:w,startY:T}=n;w+=i.left,T+=i.top;const{document:U,scene:P,engine:L}=l,D=P.getViewport(N.VIEWPORT_KEY.VIEW_MAIN),Z=document.body.clientHeight-T-i.top-Mt*2,$=document.body.clientWidth-w-i.left;let H=t,B=D==null?void 0:D.getScrollBar();H>Z?(H=Z,B==null?D&&new I.ScrollBar(D,{enableHorizontal:!1,barSize:8}):D==null||D.resetCanvasSizeAndUpdateScroll()):(B=null,(y=D==null?void 0:D.getScrollBar())==null||y.dispose()),e+=(B==null?void 0:B.barSize)||0,e=Math.min(e,$),w-=I.FIX_ONE_PIXEL_BLUR_OFFSET,T-=I.FIX_ONE_PIXEL_BLUR_OFFSET,this._addBackground(P,e/c,t/o,s);const{scaleX:G,scaleY:Y}=P.getPrecisionScale();P.transformByState({width:e*b/c,height:t*b/o,scaleX:c*b,scaleY:o*b}),U.resize(e/c,t/o),setTimeout(()=>{L.resizeBySize(I.fixLineWidthByScale(e,G),I.fixLineWidthByScale(H,Y))},0);const K=this._layoutService.getContentElement().getBoundingClientRect(),he=v.getBoundingClientRect();w=w*b+(he.left-K.left),T=T*b+(he.top-K.top),this._cellEditorManagerService.setState({startX:w,startY:T,endX:e*b+w,endY:H*b+T,show:!0})}_addBackground(e,t,n,i){const s="_backgroundRectHelperColor_",c=e.getObject(s);c==null&&i==null||(c==null?e.addObjects([new I.Rect(s,{width:t,height:n,fill:i,evented:!1})],N.DOCS_COMPONENT_MAIN_LAYER_INDEX):i==null?c.dispose():(c.setProps({fill:i}),c.transformByState({width:t,height:n})))}_handleEditorVisible(e){var p,b;const{eventType:t}=e;this._cursorChange=[I.DeviceInputEventType.PointerDown,I.DeviceInputEventType.Dblclick].includes(t)?F.CursorChange:F.StartEditor;const n=this._editorBridgeService.getEditRectState();if(n==null)return;const{position:i,documentLayoutObject:s,slideCardOffset:c,scaleX:o,scaleY:l,editorUnitId:g,unitId:d}=n,v=this._getEditorObject();if(v==null)return;const{scene:_}=v;this._contextService.setContextValue(a.EDITOR_ACTIVATED,!0);const{documentModel:m}=s,S=this._getEditorSkeleton(g);if(!S||!m)return;this._fitTextSize(i,c,S,s,o,l);const C=m.getBody().dataStream.length-2||0;(p=_.getViewport(N.VIEWPORT_KEY.VIEW_MAIN))==null||p.scrollToViewportPos({viewportScrollX:Number.POSITIVE_INFINITY}),this._textSelectionManagerService.replaceTextRanges([{startOffset:C,endOffset:C}]),(b=this._renderManagerService.getRenderById(d))==null||b.scene.resetCursor()}_resetBodyStyle(e,t=!1){e.dataStream=a.DEFAULT_EMPTY_DOCUMENT_VALUE,e.textRuns!=null&&(e.textRuns.length===1&&!t?(e.textRuns[0].st=0,e.textRuns[0].ed=1):e.textRuns=void 0),e.paragraphs!=null&&(e.paragraphs.length===1?e.paragraphs[0].startIndex=0:e.paragraphs=[{startIndex:0}]),e.sectionBreaks!=null&&(e.sectionBreaks=void 0),e.tables!=null&&(e.tables=void 0),e.customRanges!=null&&(e.customRanges=void 0),e.customBlocks!=null&&(e.customBlocks=void 0)}_initialKeyboardListener(e){}_showEditorByKeyboard(e){}_commandExecutedListener(e){const t=[se.id],n=[ee.RichTextEditingMutation.id];e.add(this._commandService.onCommandExecuted(i=>{this._editorService.getFocusId()===z&&(t.includes(i.id)&&this._moveCursorCmdHandler(i),n.includes(i.id)&&this._editorBridgeService.isVisible()&&this._editingChangedHandler())}))}_moveCursorCmdHandler(e){const t=e.params,{keycode:n,isShift:i}=t;n!=null&&this._cursorChange===F.CursorChange?this._moveInEditor(n,i):this._editorBridgeService.changeVisible(t)}_editingChangedHandler(){const e=this._editorBridgeService.getEditorRect();if(!e)return;const t=e.richTextObj;t.refreshDocumentByDocData(),t.resizeToContentSize();const{unitId:n}=this._renderContext;this._handleEditorVisible({visible:!0,eventType:3,unitId:n})}_getEditorObject(){return Nt(this._editorBridgeService.getCurrentEditorId(),this._renderManagerService)}async _handleEditorInvisible(e){const{keycode:t}=e;if(this._cursorChange=F.InitialState,this._exitInput(e),this._editorBridgeService.getEditRectState()==null)return;if(this._editorBridgeService.getEditorDirty()===!1){this._moveCursor(t);return}this._moveCursor(t)}_exitInput(e){this._contextService.setContextValue(a.EDITOR_ACTIVATED,!1),this._cellEditorManagerService.setState({show:e.visible});const t=this._editorBridgeService.getCurrentEditorId();t!=null&&this._undoRedoService.clearUndoRedo(t)}_moveCursor(e){if(e!=null)switch(a.Direction.LEFT,e){case f.KeyCode.ENTER:a.Direction.DOWN;break;case f.KeyCode.TAB:a.Direction.RIGHT;break;case f.KeyCode.ARROW_DOWN:a.Direction.DOWN;break;case f.KeyCode.ARROW_UP:a.Direction.UP;break;case f.KeyCode.ARROW_LEFT:a.Direction.LEFT;break;case f.KeyCode.ARROW_RIGHT:a.Direction.RIGHT;break}}_cursorStateListener(e){const t=this._getEditorObject();if(!t)return;const{document:n}=t;e.add(a.toDisposable(n.onPointerDown$.subscribeEvent(()=>{this._cursorChange===F.StartEditor&&(this._cursorChange=F.CursorChange)})))}_moveInEditor(e,t){let n=a.Direction.LEFT;e===f.KeyCode.ARROW_DOWN?n=a.Direction.DOWN:e===f.KeyCode.ARROW_UP?n=a.Direction.UP:e===f.KeyCode.ARROW_RIGHT&&(n=a.Direction.RIGHT),t?this._commandService.executeCommand(N.MoveSelectionOperation.id,{direction:n}):this._commandService.executeCommand(N.MoveCursorOperation.id,{direction:n})}};Ee=Ut([V(1,f.ILayoutService),V(2,a.IUndoRedoService),V(3,a.IContextService),V(4,a.IUniverInstanceService),V(5,I.IRenderManagerService),V(6,ae),V(7,be),V(8,a.Inject(ee.DocSelectionManagerService)),V(9,a.ICommandService),V(10,a.Inject(a.LocaleService)),V(11,N.IEditorService)],Ee);function Nt(r,e){if(r==null)return;const t=e.getRenderById(r);if(t==null)return;const{mainComponent:n,scene:i,engine:s,components:c}=t,o=n,l=c.get(N.DOCS_VIEW_KEY.BACKGROUND);return{document:o,docBackground:l,scene:i,engine:s}}var Rt=Object.getOwnPropertyDescriptor,jt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Rt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},ye=(r,e)=>(t,n)=>e(t,n,r);let Oe=class extends a.RxDisposable{constructor(e,t,n,i){super();O(this,"setSlideTextEditor$",new M.Subject);O(this,"_curRichText",null);O(this,"_d");this._renderContext=e,this._instanceSrv=t,this._commandService=n,this._editorBridgeService=i,this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SLIDE).subscribe(s=>{s&&s.getUnitId()===this._renderContext.unitId?this._d=this._init():this._disposeCurrent()}))}_init(){const e=new a.DisposableCollection;return this._initEventListener(e),e}_disposeCurrent(){var e;(e=this._d)==null||e.dispose(),this._d=null}_setEditorRect(e,t){this._curRichText=t;const{scene:n,engine:i}=this._renderContext,s=this._renderContext.unitId,c={scene:n,engine:i,unitId:s,pageId:e,richTextObj:t};this._editorBridgeService.setEditorRect(c)}_initEventListener(e){const t=c=>{const o=c.getTransformer();o&&(e.add(o.clearControl$.subscribe(()=>{this.setEditorVisible(!1),this.pickOtherObjects()})),e.add(o.createControl$.subscribe(()=>{this.setEditorVisible(!1)})),e.add(c.onDblclick$.subscribeEvent(()=>{o.clearControls();const g=o.getSelectedObjectMap().values().next().value;g&&(g.objectType!==I.ObjectType.RICH_TEXT?this.pickOtherObjects():this.startEditing(c.sceneKey,g))})),e.add(this._instanceSrv.focused$.subscribe(l=>{this.endEditing()})))},{mainComponent:n}=this._renderContext;n.subSceneChanged$.subscribeEvent(c=>{t(c)});const s=Array.from(n.getSubScenes().values());for(let c=0;c<s.length;c++){const o=s[c];t(o)}}pickOtherObjects(){this.endEditing()}endEditing(){var s;if(!this._curRichText)return;this.setEditorVisible(!1);const e=this._curRichText;if(!this._instanceSrv.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE))return!1;e.refreshDocumentByDocData(),e.resizeToContentSize(),this._editorBridgeService.endEditing$.next(e);const n={bl:1,fs:e.fs,text:e.text},i=(s=e.documentData.body)==null?void 0:s.textRuns;if(i&&i.length){const o=i[0].ts;n.cl=o==null?void 0:o.cl}this._commandService.executeCommand(j.id,{unitId:this._renderContext.unitId,oKey:e==null?void 0:e.oKey,props:{richText:n}}),this._curRichText=null}startEditing(e,t){this._setEditorRect(e,t),this.setEditorVisible(!0)}setEditorVisible(e){var n,i;e?(n=this._curRichText)==null||n.hide():(i=this._curRichText)==null||i.show();const{unitId:t}=this._renderContext;this._editorBridgeService.changeVisible({visible:e,eventType:I.DeviceInputEventType.PointerDown,unitId:t})}};Oe=jt([ye(1,a.IUniverInstanceService),ye(2,a.ICommandService),ye(3,ae)],Oe);const Te={id:"slide.operation.activate-slide",type:a.CommandType.OPERATION,handler:(r,e)=>{var g,d;const t=e.unitId,n=r.get(h.CanvasView),s=r.get(a.IUniverInstanceService).getUnit(t),c=(g=s==null?void 0:s.getActivePage())==null?void 0:g.id;if(!c)return!1;const o=n.getRenderUnitByPageId(c,t);if(!o)return!1;const l=(d=o.scene)==null?void 0:d.getTransformer();return l&&l.clearControls(),n.activePage(e.id,t),!0}},we={id:"slide.operation.append-slide",type:a.CommandType.OPERATION,handler:(r,e)=>{const t=e.unitId;return r.get(a.IUniverInstanceService).getUnit(t)?(r.get(h.CanvasView).appendPage(t),!0):!1}},ce={id:"slide.command.insert-float-image",type:a.CommandType.COMMAND,handler:async(r,e)=>{var L;const t=r.get(a.IUniverInstanceService),n=(L=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE))==null?void 0:L.getUnitId();if(!n)return!1;const s=await r.get(f.ILocalFileService).openFile({multiple:!0,accept:ge.DRAWING_IMAGE_ALLOW_IMAGE_LIST.map(D=>`.${D.replace("image/","")}`).join(",")});if(s.length!==1)return!1;const o=await r.get(ge.IImageIoService).saveImage(s[0]);if(!o)return!1;const{imageId:l,imageSourceType:g,source:d,base64Cache:v}=o,{width:_,height:m,image:S}=await ge.getImageSize(v||""),C=t.getUnit(n);if(!C)return!1;const p=C.getActivePage(),b=Object.values(p.pageElements),w=b!=null&&b.length?Math.max(...b.map(D=>D.zIndex)):20,T={id:l,zIndex:w+1,left:0,top:0,width:_,height:m,title:"",description:"",type:a.PageElementType.IMAGE,image:{imageProperties:{contentUrl:v,imageSourceType:g,source:d,base64Cache:v,image:S}}};p.pageElements[l]=T,C.updatePage(p.id,p);const U=r.get(h.CanvasView),P=U.createObjectToPage(T,p.id,n);return P&&U.setObjectActiveByPage(P,p.id,n),!0}},oe={id:"slide.command.add-text",type:a.CommandType.COMMAND,handler:async r=>{var i;const e=r.get(a.ICommandService),n=(i=r.get(a.IUniverInstanceService).getFocusedUnit())==null?void 0:i.getUnitId();return await e.executeCommand(xe.id,{unitId:n})}},xe={id:"slide.operation.add-text",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=e.unitId,n=a.generateRandomId(6),i=220,s=40,c=230,o=142,l=(e==null?void 0:e.text)||"A New Text",d=r.get(a.IUniverInstanceService).getUnit(t);if(!d)return!1;const v=d.getActivePage(),_=Object.values(v.pageElements),m=_!=null&&_.length?Math.max(..._.map(b=>b.zIndex)):21,S={id:n,zIndex:m+1,left:c,top:o,width:i,height:s,title:"text",description:"",type:a.PageElementType.TEXT,richText:{text:l,fs:30,cl:{rgb:"rgb(51, 51, 51)"},bl:1}};v.pageElements[n]=S,d.updatePage(v.id,v);const C=r.get(h.CanvasView),p=C.createObjectToPage(S,v.id,t);return p&&C.setObjectActiveByPage(p,v.id,t),!0}},De={id:"slide.operation.set-slide-page-thumb",type:a.CommandType.OPERATION,handler:(r,e)=>(r.get(h.CanvasView).createThumbs(e.unitId),!0)};function Vt(r){var S,C;const e=(C=(S=r.popup)==null?void 0:S.extraProps)==null?void 0:C.menuItems;if(!e)return null;const t=f.useDependency(a.ICommandService),n=f.useDependency(a.LocaleService),[i,s]=E.useState(!1),[c,o]=E.useState(!1),l=()=>{o(!0)},g=()=>{o(!1)},d=p=>{s(p)},v=p=>{t.executeCommand(p.commandId,p.commandParams),s(!1)},_=i||c,m=e.filter(p=>!p.disable);return u.jsx("div",{onMouseEnter:l,onMouseLeave:g,children:u.jsx(x.Dropdown,{align:"start",overlay:u.jsx("ul",{className:x.clsx("univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1 univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg",x.borderClassName),children:m.map(p=>u.jsx("li",{className:"univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded univer-text-sm univer-transition-colors hover:univer-bg-gray-100",onClick:()=>v(p),children:u.jsx("span",{className:"univer-px-2 univer-py-1.5 univer-align-middle",children:n.t(p.label)})},p.index))}),open:i,onOpenChange:d,children:u.jsxs("div",{className:x.clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 dark:hover:!univer-bg-gray-800 hover:univer-bg-gray-100",x.borderClassName,{"univer-bg-gray-100 dark:!univer-bg-gray-800":i,"univer-bg-white dark:!univer-bg-gray-900":!i}),children:[u.jsx(Ve,{className:"univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"}),_&&u.jsx(_e,{className:"dark:!univer-text-white"})]})})})}function Ze(){var S,C;const r=f.useDependency(a.IUniverInstanceService),e=f.useDependency(a.ICommandService),t=f.useDependency(I.IRenderManagerService),n=f.useDependency(a.LocaleService),i=E.useRef(null),s=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE),c=s==null?void 0:s.getPages(),o=s==null?void 0:s.getPageOrder();if(!c||!o)return null;const l=o.map(p=>c[p]),[g,d]=E.useState((C=(S=s==null?void 0:s.getActivePage())==null?void 0:S.id)!=null?C:null),v=E.useMemo(()=>l.map(()=>E.createRef()),[l]);E.useEffect(()=>{const p=s==null?void 0:s.activePage$.subscribe(b=>{var T;const w=(T=b==null?void 0:b.id)!=null?T:null;w&&d(w)});return()=>{p==null||p.unsubscribe()}},[]),E.useEffect(()=>{v.forEach((p,b)=>{var w;if(p.current){const T=l[b];(w=t.getRenderById(T.id))==null||w.engine.setContainer(p.current)}}),v.length>0&&e.syncExecuteCommand(De.id,{unitId:s==null?void 0:s.getUnitId()})},[v,l,t,e,s]);const _=E.useCallback(p=>{e.syncExecuteCommand(Te.id,{id:p,unitId:s==null?void 0:s.getUnitId()})},[e,s]),m=E.useCallback(()=>{e.syncExecuteCommand(we.id,{unitId:s==null?void 0:s.getUnitId()})},[e,s]);return u.jsx("aside",{ref:i,className:x.clsx("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden",x.scrollbarClassName),children:u.jsxs("div",{className:"univer-px-4",children:[u.jsx("header",{className:"univer-flex univer-justify-center univer-pt-4",children:u.jsx("a",{className:x.clsx("univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-leading-8 univer-transition-colors",x.borderClassName),onClick:m,children:n.t("slide.append")})}),l.map((p,b)=>u.jsxs("div",{className:x.clsx("univer-my-4 univer-flex univer-gap-2",{"[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600":p.id===g}),onClick:()=>_(p.id),children:[u.jsx("span",{children:b+1}),u.jsx("div",{ref:v[b],className:x.clsx("univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white hover:univer-border-primary-600",x.borderClassName)})]},p.id))]})})}const le=-1e3,Ge={width:0,height:0,top:le,left:le};function Ye(){const[r,e]=E.useState({...Ge}),t=f.useDependency(be),n=f.useDependency(N.IEditorService),i=f.useDependency(a.IContextService),s=f.useObservable(()=>i.subscribeContextValue$(f.DISABLE_AUTO_FOCUS_KEY),!1,void 0,[i,f.DISABLE_AUTO_FOCUS_KEY]);return a.DocumentFlavor.UNSPECIFIED,E.useEffect(()=>{t.state$.subscribe(c=>{if(c==null)return;const{startX:o=le,startY:l=le,endX:g=0,endY:d=0,show:v=!1}=c;if(!v)e({...Ge});else{e({width:g-o-I.FIX_ONE_PIXEL_BLUR_OFFSET+2,height:d-l-I.FIX_ONE_PIXEL_BLUR_OFFSET+2,left:o+I.FIX_ONE_PIXEL_BLUR_OFFSET,top:l+I.FIX_ONE_PIXEL_BLUR_OFFSET});const _=n.getEditor(z);if(_==null)return;const{left:m,top:S,width:C,height:p}=_.getBoundingClientRect();t.setRect({left:m,top:S,width:C,height:p})}})},[]),E.useEffect(()=>{s||t.setFocus(!0)},[s,r]),u.jsx("div",{className:x.clsx("univer-absolute univer-z-10 univer-box-border univer-flex",x.borderClassName),style:{left:r.left,top:r.top,width:r.width,height:r.height}})}const Pe="slide.menu.image";function Lt(r){return{id:Pe,type:f.MenuItemType.SUBITEMS,icon:"AddImageIcon",tooltip:"slide.image.insert.title",hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}function At(r){return{id:ce.id,title:"slide.image.insert.float",type:f.MenuItemType.BUTTON,hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}const Ue="slide.menu.shape";function Bt(r){return{id:Ue,type:f.MenuItemType.SUBITEMS,icon:"GraphIcon",tooltip:"slide.shape.insert.title",hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}function $t(r){return{id:ne.id,title:"slide.shape.insert.rectangle",type:f.MenuItemType.BUTTON,hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}function Ft(r){return{id:oe.id,type:f.MenuItemType.BUTTON,icon:"TextIcon",tooltip:"slide.text.insert.title",hidden$:f.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SLIDE)}}const qe={[f.RibbonStartGroup.FORMAT]:{[oe.id]:{order:0,menuItemFactory:Ft},[Pe]:{order:0,menuItemFactory:Lt,[ce.id]:{order:0,menuItemFactory:At}},[Ue]:{order:0,menuItemFactory:Bt,[ne.id]:{order:0,menuItemFactory:$t}}}};function Me(r){return r.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&r.getContextValue(a.EDITOR_ACTIVATED)}function Ht(r){return r.getContextValue(a.FORMULA_EDITOR_ACTIVATED)&&r.getContextValue(a.FOCUSING_UNIVER_EDITOR)}const Je=[f.KeyCode.ARROW_DOWN,f.KeyCode.ARROW_UP,f.KeyCode.ARROW_LEFT,f.KeyCode.ARROW_RIGHT];[f.KeyCode.ENTER,f.KeyCode.TAB,...Je];function Wt(){const r=[];for(const e of Je)r.push({id:se.id,binding:e,preconditions:t=>Me(t),staticParameters:{visible:!1,eventType:I.DeviceInputEventType.Keyboard,keycode:e,isShift:!1}}),r.push({id:se.id,binding:e|f.MetaKeys.SHIFT,preconditions:t=>Me(t),staticParameters:{visible:!1,eventType:I.DeviceInputEventType.Keyboard,keycode:e,isShift:!0}});return r}const kt={id:N.DeleteLeftCommand.id,preconditions:r=>Me(r)||Ht(r),binding:f.KeyCode.BACKSPACE};var Kt=Object.getOwnPropertyDescriptor,zt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Kt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},X=(r,e)=>(t,n)=>e(t,n,r);h.SlidesUIController=class extends a.Disposable{constructor(e,t,n,i,s,c){super(),this._injector=e,this._menuManagerService=t,this._componentManager=n,this._uiPartsService=i,this._commandService=s,this._shortcutService=c,this._initCommands(),this._initCustomComponents(),this._initUIComponents(),this._initMenus(),this._initShortcuts()}_initMenus(){this._menuManagerService.mergeMenu(qe)}_initCustomComponents(){const e=this._componentManager;this.disposeWithMe(e.register("TextIcon",He)),this.disposeWithMe(e.register("GraphIcon",Ae)),this.disposeWithMe(e.register(ke,Vt)),this.disposeWithMe(e.register(te,mt))}_initCommands(){[we,Te,De,ce,xe,oe,Ie,ne,Se,pe,j,se].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_initUIComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(f.BuiltInUIPart.LEFT_SIDEBAR,()=>f.connectInjector(Ze,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(f.BuiltInUIPart.CONTENT,()=>f.connectInjector(Ye,this._injector)))}_initShortcuts(){[kt,...Wt()].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}},h.SlidesUIController=zt([X(0,a.Inject(a.Injector)),X(1,f.IMenuManagerService),X(2,a.Inject(f.ComponentManager)),X(3,f.IUIPartsService),X(4,a.ICommandService),X(5,f.IShortcutService)],h.SlidesUIController);var Xt=Object.getOwnPropertyDescriptor,Zt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Xt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},Ne=(r,e)=>(t,n)=>e(t,n,r);let de=class extends a.RxDisposable{constructor(r,e,t){super(),this._contextService=r,this._instanceSrv=e,this._renderManagerService=t,Promise.resolve().then(()=>this._init())}_init(){this._initSlideDataListener(),this._initContextListener()}_initSlideDataListener(){this._instanceSrv.getTypeOfUnitAdded$(a.UniverInstanceType.UNIVER_SLIDE).pipe(M.takeUntil(this.dispose$)).subscribe(r=>{this._createRenderer(r==null?void 0:r.getUnitId())}),this._instanceSrv.getAllUnitsForType(a.UniverInstanceType.UNIVER_SLIDE).forEach(r=>{this._createRenderer(r.getUnitId())}),this._instanceSrv.getTypeOfUnitDisposed$(a.UniverInstanceType.UNIVER_SLIDE).pipe(M.takeUntil(this.dispose$)).subscribe(r=>this._disposeRenderer(r))}_createRenderer(r){r==null||this._instanceSrv.getUnit(r,a.UniverInstanceType.UNIVER_SLIDE)==null||this._renderManagerService.createRender(r)}_disposeRenderer(r){const e=r.getUnitId();this._renderManagerService.removeRender(e)}_initContextListener(){}};de=Zt([Ne(0,a.IContextService),Ne(1,a.IUniverInstanceService),Ne(2,I.IRenderManagerService)],de);var Gt=Object.getOwnPropertyDescriptor,Yt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Gt(e,t):e,s=r.length-1,c;s>=0;s--)(c=r[s])&&(i=c(i)||i);return i},ue=(r,e)=>(t,n)=>e(t,n,r);const qt="SLIDE_UI";h.UniverSlidesUIPlugin=(ve=class extends a.Plugin{constructor(e=Re,t,n,i,s){super(),this._config=e,this._injector=t,this._renderManagerService=n,this._univerInstanceService=i,this._configService=s;const{menu:c,...o}=a.merge({},Re,this._config);c&&this._configService.setConfig("menu",c,{merge:!0}),this._configService.setConfig(rt,o)}onStarting(){a.mergeOverrideWithDependencies([[de],[ae,{useClass:me}],[be,{useClass:Dt}],[h.SlideCanvasPopMangerService]],this._config.override).forEach(e=>this._injector.add(e))}onReady(){[[q]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SLIDE,e))}),a.mergeOverrideWithDependencies([[h.CanvasView],[h.SlidesUIController],[q],[re]],this._config.override).forEach(e=>{this._injector.add(e)}),this._injector.get(h.CanvasView),this._injector.get(de)}onRendered(){[[Oe],[Ee]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SLIDE,e))}),this._markSlideAsFocused(),this._injector.get(h.SlidesUIController)}onSteady(){this._injector.get(re)}_markSlideAsFocused(){const e=this._univerInstanceService;try{const t=e.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SLIDE);e.focusUnit(t.getUnitId())}catch{}}},O(ve,"pluginName",qt),O(ve,"type",a.UniverInstanceType.UNIVER_SLIDE),ve),h.UniverSlidesUIPlugin=Yt([ue(1,a.Inject(a.Injector)),ue(2,I.IRenderManagerService),ue(3,a.IUniverInstanceService),ue(4,a.IConfigService)],h.UniverSlidesUIPlugin),h.ActivateSlidePageOperation=Te,h.AppendSlideOperation=we,h.DeleteSlideElementOperation=pe,h.ISlideEditorBridgeService=ae,h.InsertSlideFloatImageCommand=ce,h.InsertSlideShapeRectangleCommand=ne,h.InsertSlideShapeRectangleOperation=Ie,h.SHAPE_MENU_ID=Ue,h.SLIDES_IMAGE_MENU_ID=Pe,h.SLIDE_EDITOR_ID=z,h.SetSlidePageThumbOperation=De,h.SlideAddTextCommand=oe,h.SlideAddTextOperation=xe,h.SlideEditorContainer=Ye,h.SlideSideBar=Ze,h.SlidesUIMenuSchema=qe,h.UpdateSlideElementOperation=j,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/slides-ui",
|
|
3
|
-
"version": "0.8.0-
|
|
3
|
+
"version": "0.8.0-nightly.202505271607",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer normal ui-plugin-slides",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"rxjs": ">=7.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@univerjs/icons": "^0.3
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/docs
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/slides": "0.8.0-
|
|
64
|
-
"@univerjs/
|
|
65
|
-
"@univerjs/
|
|
57
|
+
"@univerjs/icons": "^0.4.3",
|
|
58
|
+
"@univerjs/design": "0.8.0-nightly.202505271607",
|
|
59
|
+
"@univerjs/core": "0.8.0-nightly.202505271607",
|
|
60
|
+
"@univerjs/docs": "0.8.0-nightly.202505271607",
|
|
61
|
+
"@univerjs/docs-ui": "0.8.0-nightly.202505271607",
|
|
62
|
+
"@univerjs/engine-render": "0.8.0-nightly.202505271607",
|
|
63
|
+
"@univerjs/slides": "0.8.0-nightly.202505271607",
|
|
64
|
+
"@univerjs/drawing": "0.8.0-nightly.202505271607",
|
|
65
|
+
"@univerjs/ui": "0.8.0-nightly.202505271607"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"postcss": "^8.5.3",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|