1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4913],{36562:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultMusic=void 0,e.defaultMusic={title:"",materialId:"",type:"maka",duration:0,url:"",preview:""}},94715:function(t,e,i){var o=this&&this.__decorate||function(t,e,i,o){var a,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(a=t[r])&&(n=(s<3?a(n):s>3?a(e,i,n):a(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=this&&this.__rest||function(t,e){var i={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(i[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(t);a<o.length;a++)0>e.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(i[o[a]]=t[o[a]]);return i};Object.defineProperty(e,"__esModule",{value:!0}),e.WorksDataManager=void 0;let n=i(98253),r=i(68949),l=i(39892),d=i(8859),h=i(57054),c=i(35562),p=i(36660);let WorksDataManager=class WorksDataManager{constructor(){this.setLayerName=(t,e)=>{this.worksData.positionLink[t].name=e},this.setData=t=>{this.worksData=t},this.getDefaultPageData=()=>{let t=this.worksData.canvasData.content.pages[0],{width:e,height:i}=t;return{id:(0,n.random)(),layers:[],opacity:1,background:{opacity:1},width:e,height:i}},this.getPage=t=>this.worksData.canvasData.content.pages[t]||this.getDefaultPageData(),this.getPageLayers=(t,e=!0)=>[...this.getPage(t).layers||[],...e&&this.worksData.canvasData.content.fixedLayer||[]],this.getConstraintsLayers=(t,e)=>{let i=this.getPageLayers(t).filter(t=>{let i=this.worksData.positionLink[t.elemId];return i&&i.constraints===e});return i},this.setPageLayers=(t,e)=>{this.worksData.canvasData.content.pages[t].layers=e},this.updateLinkDictPorps=(t,e)=>{if(t instanceof Array)t.forEach(t=>this.updateLinkDictPorps(t,e));else{let i=this.worksData.positionLink[t];if(!i){console.warn("key no find");return}this.worksData.positionLink[t]=Object.assign(Object.assign({},i),e)}},this.setMusic=t=>{this.worksData.canvasData.music=t},this.getAllLayers=(t=!1)=>{let{pages:e,fixedLayer:i}=this.worksData.canvasData.content,o=[];for(let t of e){let{layers:e}=t;(0,c.deepLayers)(e,t=>{o.push(t)})}return t&&(0,c.deepLayers)(i,t=>{o.push(t)}),o},this.setAnimationAction=(t,e)=>{if(this.worksData.positionLink[t]){let i=e.find(t=>"enter"===t.bizType),o=e.find(t=>"action"===t.bizType),a=e.find(t=>"out"===t.bizType),s=[i,o,a].filter(Boolean);this.worksData.positionLink[t].animation=s}else console.error("setAnimationAction é误")},this.setAnimation=(t,e)=>{t instanceof Array?t.forEach(t=>this.setAnimationAction(t,e)):this.setAnimationAction(t,e)},this.takeSnapshotOfData=(t,e=!1)=>{p.undoManager.record({actionName:t,dataSnapshot:(0,r.toJS)(this.worksData)}),e&&p.undoManager.clearUndo()},this.setDataWithoutUndo=t=>{this.worksData=t},this.checkItemIsMount=t=>{var e;return!!(null===(e=this.worksData.positionLink[t])||void 0===e?void 0:e.mount)},this.setPageCanvaWidth=(t,e)=>{let i=this.getPage(t);i&&e&&(i.width=e)},this.changePageSetting=t=>{let{pageSetting:e}=this.worksData;e||(this.worksData.pageSetting={}),this.worksData.pageSetting=(0,n.mergeDeep)(this.worksData.pageSetting,t)},this.cleanWorks=()=>{let t=[];(0,h.findItemFromWorks)(this.worksData.canvasData,e=>{t.push(e.elemId)}),this.keepLinks(t)},this.keepLinks=t=>{let e={};t.forEach(t=>{e[t]=this.worksData.positionLink[t]}),this.worksData.positionLink=e},this.getSaveData=(t=!1)=>(t&&this.cleanWorks(),(0,r.toJS)(this.worksData)),this.setWorkMeta=(t,e)=>{let{activity:i={},elementRef:o,label:a}=t,{meta:s}=this.worksData;this.worksData.meta=Object.assign({},s,e,{activity:Object.assign(Object.assign({},i),{type:o,name:a})})},this.delWorkMeta=()=>{this.worksData.meta=void 0},this.setWorkMetaPure=t=>{let{meta:e={}}=this.worksData;this.worksData.meta=(0,n.mergeDeep)(e,t)},this.getWorkMeta=()=>{let{meta:t}=this.worksData;return t},this.getLayerOrigin=(t,e=!1)=>{let i=this.getAllLayers(e);for(let e=0;e<i.length;e++){let o=i[e];if(o.elemId===t)return o}},this.getLayer=(t,e=!1)=>(0,r.toJS)(this.getLayerOrigin(t,e)),this.setLayer=(t,e)=>{let i=this.getLayerOrigin(t);if(i){let{elemId:t}=e,o=s(e,["elemId"]);
1Object.assign(i,o),this.fouceUpdate()}},this.getItemAttrs=t=>{var e;return null===(e=this.getLayer(t))||void 0===e?void 0:e.attrs},this.fouceUpdate=()=>{let t=(0,r.toJS)(this.worksData);this.setDataWithoutUndo(t)},this.changeCompAttr=(t,e={},i=!0)=>{let o=this.getAllLayers();(0,c.deepLayers)(o,i=>{i.elemId===t&&(i.attrs=(0,n.mergeDeep)(i.attrs,e))}),this.fouceUpdate(),i&&this.takeSnapshotOfData("changeCompAttr")},this.changeCompAttrMulti=t=>{let e=this.getAllLayers();t.forEach(t=>{(0,c.deepLayers)(e,e=>{e.elemId===t.elemId&&(e.attrs=(0,n.mergeDeep)(e.attrs,t.nextAttrs))})}),this.fouceUpdate(),this.takeSnapshotOfData("changeCompAttr")},this.delLink=t=>{t instanceof Array?t.forEach(t=>Reflect.deleteProperty(this.worksData.positionLink,t)):Reflect.deleteProperty(this.worksData.positionLink,t)},this.changeContainerInfoForWidgetEitity=(t,e)=>{if(!t)return console.error(`changeContainerInfoForWidgetEitity 失败ï¼è¯·ä¼ å
¥ compEntityId`);Object.assign(this.worksData.positionLink[t],e)},this.getAvoidCoverLink=t=>{let{positionLink:e}=this.worksData,i=["width","height","x","y","rotate"],o=Object.assign({},t);for(let a of Object.values(e)){let e=!0,s=Object.assign({},a);for(let t of i)s[t]!==o[t]&&(e=!1);if(e)return this.getAvoidCoverLink(Object.assign(Object.assign({},t),{x:t.x+20,y:t.y+20}))}return t},this.setRotate=(t,e)=>{this.worksData.positionLink[t].rotate=e},this.setLinkSize=(t,e)=>{let i=Object.assign({},this.worksData.positionLink[t]);i.width!==(0,n.notEmpty)(e.width,this.worksData.positionLink[t].width)&&(this.worksData.positionLink[t].width=(0,n.notEmpty)(e.width,this.worksData.positionLink[t].width)),i.height!==(0,n.notEmpty)(e.height,this.worksData.positionLink[t].height)&&(this.worksData.positionLink[t].height=(0,n.notEmpty)(e.height,this.worksData.positionLink[t].height))},this.setZindexDict=t=>{for(let e of Object.keys(t)){let i=t[e];this.worksData.positionLink[e]=Object.assign(Object.assign({},this.worksData.positionLink[e]),i)}},this.setLinkBatch=t=>{t.forEach(t=>{let{elemId:e,nextContainerInfo:i}=t;this.worksData.positionLink[e]&&Object.assign(this.worksData.positionLink[e],i)})},this.setPageOptions=(t,e)=>{let i=this.getPage(t);i&&(i.options=Object.assign({},i.options,e))},this.setPage=(t,e)=>{let i=this.getPage(t);this.worksData.canvasData.content.pages[t]=Object.assign(i,e),this.resetCanvasHeight()},this.resetCanvasHeight=()=>{if((0,l.getIsFlatPages)()){let t=this.getPages(),e=t.reduce((t,e)=>t+e.height,0);this.worksData.canvasData.visualHeight=e,this.worksData.canvasData.height=e}},this.getPages=()=>{let{pages:t}=this.worksData.canvasData.content;return t},this.getConnectionSpec=()=>{let t=this.getPages(),e=t.map((t,e)=>({specConnection:t.specConnection,pageIndex:e}));return e.filter(t=>t.specConnection)},this.worksData=(0,h.getDefaultWorksData)()}get pageLength(){let{pages:t}=this.worksData.canvasData.content;return t.length}};o([r.observable,a("design:type",d.IWorksData)],WorksDataManager.prototype,"worksData",void 0),o([r.computed,a("design:type",Object),a("design:paramtypes",[])],WorksDataManager.prototype,"pageLength",null),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setLayerName",void 0),o([p.undoableAction,a("design:type",Object)],WorksDataManager.prototype,"setData",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"updateLinkDictPorps",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setMusic",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setAnimationAction",void 0),o([p.undoableAction,a("design:type",Object)],WorksDataManager.prototype,"setAnimation",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setDataWithoutUndo",void 0),o([p.undoableAction,a("design:type",Object)],WorksDataManager.prototype,"setPageCanvaWidth",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"changePageSetting",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setWorkMeta",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"delWorkMeta",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setWorkMetaPure",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"fouceUpd
1ate",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"changeCompAttr",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"changeCompAttrMulti",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setRotate",void 0),o([r.action,a("design:type",Object)],WorksDataManager.prototype,"setLinkSize",void 0),o([p.undoableAction,a("design:type",Object)],WorksDataManager.prototype,"setZindexDict",void 0),o([p.undoableAction,a("design:type",Object)],WorksDataManager.prototype,"resetCanvasHeight",void 0),e.WorksDataManager=WorksDataManager},58672:function(t,e,i){var o=this&&this.__createBinding||(Object.create?function(t,e,i,o){void 0===o&&(o=i);var a=Object.getOwnPropertyDescriptor(e,i);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,o,a)}:function(t,e,i,o){void 0===o&&(o=i),t[o]=e[i]}),a=this&&this.__decorate||function(t,e,i,o){var a,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(a=t[r])&&(n=(s<3?a(n):s>3?a(e,i,n):a(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n},s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||o(e,t,i)},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=this&&this.__awaiter||function(t,e,i,o){return new(i||(i=Promise))(function(a,s){function fulfilled(t){try{step(o.next(t))}catch(t){s(t)}}function rejected(t){try{step(o.throw(t))}catch(t){s(t)}}function step(t){var e;t.done?a(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(fulfilled,rejected)}step((o=o.apply(t,e||[])).next())})},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WorksStore=e.operationStore=void 0;let d=i(68949),h=i(98253),c=i(39892),p=l(i(24969)),g=i(35562),u=i(8859),y=i(36660),k=i(95848),m=i(94715),f=i(57299),b=i(57054),v=i(35988),D=i(79732);s(i(95848),e),s(i(36660),e),e.operationStore=new k.OperationStore({count:500});let actions=(t,e)=>{for(let i of[...y.storeActionNames,...f.commonActionNames]){let o=t[i];t[i]=(...a)=>{let s;let n=o.bind(t);return e&&e[i]?(s=e[i].call(t,{action:n,worksData:t},...a))||console.warn(`æ¹æ³ ${i} 已被 actionInterceptor ææï¼å¹¶ä¸æ²¡æè¿åå¼ï¼è¯·ç¡®è®¤æ¯å¦ä¸éè¦è¿å`):s=n(...a),t.isAppReady&&y.storeActionNames.includes(i)&&y.undoManager.record({actionName:i,dataSnapshot:(0,d.toJS)(t.worksData)}),s},(0,d.action)(t,i)}};let WorksStore=class WorksStore extends m.WorksDataManager{constructor(t){let{actionInterceptor:i}=t;super(),this.config={scaleConfig:{max:2,min:.1}},this.operationStore=e.operationStore,this.activeResizePageIndex=void 0,this.widgetState={},this.scale=1,this.editorCompLoad=!1,this.pageIndex=0,this.isShowGridline=!1,this.musicEditState=!1,this.activeItem={},this.activeLayerId="",this.scaleStatus=!0,this.areaComps=[],this.areaParentId="",this.areaParentLinkDict={x:0,y:0,width:0,height:0,groupType:u.GroupType.临æ¶,lock:!1,animation:[]},this.highlightComps=[],this.controlComp="",this.isAppReady=!1,this.widgetMetadataColl=null,this.widgetLoadState={},this.widgetRely={},this.connectState="connected",this.operationState={},this.activeAnimationType="enter",this.lockLayerPositionMode=!1,this.initData=(t,e,i)=>{let{defaultActiveLayerId:o,editorMode:a}=i||{};this.setDataWithoutUndo(t),this.setWidgetMetaColl(e),o&&(this.activeLayerId=o);let s=(0,c.getIsFlatPages)(),n=s?0:this.worksData.canvasData.visualHeight;this.worksData.canvasData.content.pages.forEach(t=>{t.id||(t.id=(0,h.random)()),this.worksData.canvasData.content.pages.filter(e=>e.id===t.id).length>1&&(t.id=(0,h.random)()),t.width||(t.width=this.worksData.canvasData.width),t.height||(t.height=this.worksData.canvasData.visualHeight),s&&(n+=t.height)}),n!==this.worksData.canvasData.visualHeight&&(this.worksData.canvasData.visualHeight=n,this.worksData.canvasData.height=n),a&&(this.worksData.editorMode=a),this.isAppReady=!0,this.widgetRelyMonitor(),this.takeSnapshotOfData("initData")},this.redo=()=>{let t=y.undoManager.redo();t&&this.setData(t.dataSnapshot)},this.undo=()=>{let t=y.undoManager.undo();t&&this.setDataWithoutUndo(t.dataSnapshot)},this.flatGroup=()=>{let{pages:t}=this.worksData.canvasData.content,e=[],deepScanElement=(t,i)=>{if(t)for(let o=0;o<t.length;o++){let a=t[o],s=a.body||[];i&&(null==a?void 0:a.elementRef)==="MkCombination"&&this.getLink(a.elemId).parentId&&e.push(a.elemId),s.length>0&&deepScanElement(s,a)}};
1Object.keys(t).forEach(e=>{let i=t[+e];deepScanElement(i.layers)}),e.forEach(t=>{this.unCombinationLayers(t)})},this.setWidgetLoadState=t=>{t&&(this.widgetLoadState=Object.assign(Object.assign({},this.widgetLoadState),t))},this.setWidgetMetaColl=t=>{this.widgetMetadataColl=Object.assign(Object.assign({},this.widgetMetadataColl),t)},this.setLockLayerPositionMode=t=>{this.lockLayerPositionMode=t},this.widgetRelyMonitor=()=>{let t=(0,b.treeNodeCounter)(this.worksData),e=t.allWidgetRely;JSON.stringify(e)!==JSON.stringify(this.widgetRely)&&(this.widgetRely=Object.assign(Object.assign({},this.widgetRely),e),this.loadWidgetResourceSelf())},this.loadWidgetResourceSelf=()=>{if("undefined"==typeof window)return;let t=!1;if(this.widgetMetadataColl){if(Object.keys(this.widgetRely).forEach(e=>{this.widgetLoadState[e]||(t=!0)}),!t)return;this.config.appMode||console.error("æªè®¾ç½® this.config.appMode æ¶ï¼ä¼é»è®¤ä¸º editor-web 模å¼"),(0,b.loadWidgetResource)({widgetMetadataColl:this.widgetMetadataColl,widgetRely:this.widgetRely,loadedWidgetCache:this.widgetLoadState,mode:this.config.appMode||"editor-web"}).then(t=>{this.setWidgetLoadState(t)}).catch(t=>{console.error(t)})}},this.getWidgetMetaOrigin=t=>{var e;return(0,d.toJS)(null===(e=this.widgetMetadataColl)||void 0===e?void 0:e[t])},this.checkWidgetIsLoaded=t=>!!this.widgetLoadState[t],this.makeLibDataFixCanvas=t=>{var e;let i;!t.positionLink&&t.linkDict&&(t.positionLink=t.linkDict);let{layers:o,positionLink:a,linkDict:s,body:n,rawLayers:r}=t,l=s||a,d=l[(null===(e=null==r?void 0:r[0])||void 0===e?void 0:e.elemId)||o.elemId];if(!d)return console.log("æ¾ä¸å° link"),t;let h=d.width,c=d.height;if(!h||!c)return console.log("å
ç´ å®½é«ä¸º0"),t;let p=this.worksData.canvasData.width,g=this.worksData.canvasData.visualHeight,u=this.getDefaultPageData();i=h>p&&c<g?p/h:h<p&&c>g?g/c:Math.min(p/h,g/c);let y=(0,D.transformEntityByScale)([Object.assign(Object.assign({},u),{layers:r||[o]})],i,l,{originCanvasH:g,originCanvasW:p});return(console.log("scale",i),console.log("convertedWorksData",y),r)?{layers:y.pages[0].layers[0],body:n,positionLink:y.newLink,rawLayers:r}:{layers:y.pages[0].layers[0],body:n,positionLink:y.newLink}},this.addComponentFromLib=t=>{let{layers:e,positionLink:i,body:o,rawLayers:a}=this.makeLibDataFixCanvas(t);if(a){this.addComponentBatch(a,i),this.widgetRelyMonitor();return}let s={},n="",r={},l=[],{height:d,width:c}=this.getPage(this.pageIndex);if(e){let t=i[e.elemId];(0,v.deepLayers)([e],(t,e)=>{let o=t.elemId,a=(0,h.random)();r[t.elemId]=a,t.elemId=a;let d=r[(null==t?void 0:t.parentId)||""]||"";d&&(t.parentId=d),e||(n=a),s[o]=a,l.push({id:t.elemId,compName:t.elementRef,lindDict:Object.assign(Object.assign({},i[o]),{parentId:t.parentId}),oldId:o})});let o=Object.assign({},t,{x:(c-(t.width||0))/2,y:(d-(t.height||0))/2}),a=(0,b.getMaxZ)(this.worksData.positionLink)+1,p={oldId:n,id:e.elemId,compName:e.elementRef,lindDict:Object.assign(Object.assign({},t),{zIndex:a})};l.push(p),l.forEach(t=>{let{id:e,lindDict:i,oldId:o}=t;this.setLink(e,i)}),this.addComponent(e,o),this.setLink(p.id,Object.assign(Object.assign({},this.worksData.positionLink[p.id]),{zIndex:a})),this.flatGroup()}if(o&&Array.isArray(o)){let t={};o.forEach(e=>{let o=(0,h.random)(),a=e.elemId;e.elemId=o,t[o]=Object.assign({},i[a]),this.addComponentAction(e,t[o]),l.push({id:e.elemId,compName:e.elementRef,oldId:a,lindDict:t[o]})}),setTimeout(()=>{console.log(Object.keys(t)),this.temporaryToKeepGroup(Object.keys(t))},50)}return e},this.setAreaParent=(t,e,i=!0)=>{this.areaParentId=t,this.areaParentLinkDict=Object.assign(Object.assign({},this.areaParentLinkDict),e),this.areaParentLinkDict.groupType=u.GroupType.临æ¶,this.areaParentLinkDict.visibility=!0,this.setActivLayer(t)},this.getThemeSchema=()=>{var t;return null===(t=this.worksData.style)||void 0===t?void 0:t.themeSchema},this.setThemeSchema=t=>{var e;return this.worksData.style||(this.worksData.style={}),this.worksData.style.themeSchema=(0,h.mergeDeep)((null===(e=this.worksData.style)||void 0===e?void 0:e.themeSchema)||{},t)},this.onComponentDidMount=(t,e,i)=>{let{boxInfo:o,data:a}=e;if((null==a?void 0:a.__newCommit__)&&this.changeCompAttr(t,a),null==this.worksData.positionLink[t]||this.worksData.positionLink[t].mount)return;let s=this.worksData.positionLink[t];if(this.worksData.positionLink[t].width=o.width||s.width,this.worksData.positionLink[t].height=o.height||s.height,this.worksData.positionLink[t].x=o.x||s.x,this.worksData.positionLink[t].y=o.y||s.y,-9999999===this.worksData.positionLink[t].x){if(this.config.elementDidMount){let e=this.config.elementDidMount(t,o,a,this);e&&(null==a?void 0:a.__newCommit__)&&(a.width=e.width||a.width,a.height=e.height||a.height,this.changeCompAttr(t,a))}else if(-9999999===this.worksData.positionLink[t].x){let{height:e,width:a}=this.getPage(void 0!==i?i:this.pageIndex);this.worksData.positionLink[t].x=(a-o.width)/2,this.worksData.positionLink[t].y=(e-o.height)/2}}this.worksData.positionLink[t].mount=!0,a&&this.changeCompAttr(t,a)},this.duplicateComp=(t,e=!0)=>{let i=this.getCopyEntityData(t);return this.elementPaste(i,{},e)},this.getEditorSDK=t=>({setWorksStyle:this.setWorksStyle,setLayerDisableStateBatch:t=>{this.setLinkBatch(t.map(t=>({elemId:t.compEntityId,nextContainerInfo:{disabled:t.option.disabled}})))}
1,setPageBackground:(t,e)=>{this.setPageBackground(e,!1,t)},getWorksData:()=>(0,d.toJS)(this.worksData),selectLayer:this.setControlComp,getActivePageIdx:()=>this.pageIndex,didMount:this.onComponentDidMount,changeWidgetState:e=>this.changeWidgetState(t,e),changeCompAttrMulti:this.changeCompAttrMulti,copyPage:this.copyPage,getPageData:t=>(0,d.toJS)(this.getPage(t)),getLink:t=>(0,d.toJS)(this.getLink(t)),setLinkBatch:this.setLinkBatch,addPage:this.addPage,delPage:this.delPage,orderPage:this.orderPage,setPageOptions:this.setPageOptions,changeCompAttr:this.changeCompAttr,addComponent:this.addComponent,addLayersToNewCanvas:this.addLayersToNewCanvas,deleteCompEntity:this.deleteCompEntity,getLayer:this.getLayer,changePageScale:(t,e)=>{let i=this.getPage(t),o=e.width?e.width-i.width:0,a=e.height?e.height-i.height:0;this.setPage(t,e),((t,e,i=0,o=!1)=>{let a=[];a=this.getPageLayers(t,o);let{scale:s}=this,{positionLink:n}=this.worksData,r=[];for(let t of a){let o=e,a=i,{x:l,y:d,constraints:h="LT"}=n[t.elemId];if("LT"===h)continue;"LB"===h&&(o=0),"RT"===h&&(a=0);let c=(l*s+o*s)/s,p=(d*s+a*s)/s,g={x:c,y:p};r.push({elemId:t.elemId,nextContainerInfo:g})}this.setLinkBatch(r)})(t,o,a)},duplicateComp:this.duplicateComp,onFormValueChange:e=>{this.changeCompAttr(t,e)},changeContainer:e=>{this.changeContainerInfoForWidgetEitity(t,e),this.recalculationCombinationInfo(t)},changePageAndContainer:(t,e)=>{this.changeContainerInfoForWidgetEitity(e.id,e.scale),Object.assign(this.worksData.canvasData.content.pages[t.pageIndex],t.scale)},getOperatorHandle:()=>this.getOperatorHandle(t),changeOperatorHandle:e=>{this.changeOperatorHandle(t,e)},getStaticResource:t=>Promise.resolve(t.url),getCanvasPosition:()=>{let{positionLink:e}=this.worksData,i=(0,g.deepItemToCanvas)(t,e);return this.moduleToCanvas(t,i)},getCombinationPosition:e=>{let{positionLink:i}=this.worksData,o=(0,g.canvasToDeepCombinationPosition)(t,e,i);return o},disableDeleteModule:(t,e)=>{this.setPageOptions(t,{enableDelete:e})},hasWatermark:()=>(0,c.hasWatermark)(),watermarkVersion:()=>(0,c.watermarkVersion)()}),this.moveElementLayerZindex=(t,e=!0,i=!1)=>{if(!t)return;let o=(0,h.toArray)(t),{pageIndex:a}=this,s=this.getPageLayers(a,!1);s.sort((t,e)=>
1{let i=this.getLink(t.elemId).zIndex||0,o=this.getLink(e.elemId).zIndex||0;return i-o});let n=s.map((t,e)=>({dict:this.getLink(t.elemId),index:e+1,id:t.elemId}));for(let t of o){let o=`${Number(e)}${Number(i)}`,a={11:"置顶","01":"ç½®åº",10:"ä¸ç§»ä¸å±","00":"ä¸ç§»ä¸å±"},s=n.length-1,r=a[o],l=n.find(e=>e.id===t);"ä¸ç§»ä¸å±"===r&&l?l.index+=2:"ä¸ç§»ä¸å±"===r&&l?l.index-=2:"置顶"===r&&l?l.index=s+2:"ç½®åº"===r&&l&&(l.index=-1)}let r=n.sort((t,e)=>t.index-e.index);r.forEach((t,e)=>{this.worksData.positionLink[t.id]=Object.assign(Object.assign({},t.dict),{zIndex:e+1})})},this.replaceWorksData=(t,e)=>{this.worksData.positionLink=e,this.worksData.canvasData.content.pages=t},this.isFlexMode=()=>"flex"===this.worksData.editorMode,this.exchangeGridlineState=()=>{this.isShowGridline=!this.isShowGridline},this.setWorksStyle=t=>{this.worksData.style||(this.worksData.style={layer:{},works:{}}),this.worksData.style=(0,h.mergeDeep)({},this.worksData.style,t)},this.setCanvaSize=(t,e,i)=>{let o=this.getPage(t);o&&(o.height=i,o.width=e),this.resetCanvasHeight()},this.setPageCanvaHeight=(t,e)=>{let i=this.getPage(t);i&&null!=e&&(i.height=e),this.resetCanvasHeight()},this.addCanvas=(t=1280,e)=>{this.addPage(+this.pageIndex,{layers:[],opacity:1,background:{},id:(0,h.random)(),width:this.worksData.canvasData.width,height:t,options:e}),this.resetCanvasHeight()},this.addLayersToNewCanvas=(t,e,i)=>{this.addCanvas(e,i),t.forEach(t=>{let e=(0,h.random)(),i=t.elemId||e;this.addComponentAction(Object.assign(Object.assign({},t),{elemId:i}),Object.assign(Object.assign({},t.__link__||{}),{x:0,y:0,rotate:0}))})},this.moduleToCanvas=(t,e)=>{let i=Object.assign(Object.assign({},e),{y:e.y+(0,g.getModuleTopHeight)(this,this.pageIndex)});return i},this.canvasToModule=(t,e)=>{let i=Object.assign(Object.assign({},e),{y:e.y-(0,g.getModuleTopHeight)(this,this.pageIndex)});return i},this.moveItemToPage=(t,e)=>{let i=this.getLink(t);if(this.pageIndex===e)return;let o=this.moduleToCanvas(t,i);this.worksData.positionLink[t].y=o.y-(0,g.getModuleTopHeight)(this,e);let{pageIndex:a}=this,s=this.getPageLayers(a,!1),n=this.getPageLayers(e,!1),r=s.findIndex(e=>e.elemId===t);if(r>-1){let t=s.splice(r,1)[0];t&&n.push(t)}this.setPageLayers(a,s),this.setPageLayers(e,n),this.setPageIndex(e)},this.getCompShouleBelongToPage=t=>{let e=this.moduleToCanvas(t,this.worksData.positionLink[t]),{y:i,height:o=0}=e,a=this.getPages();if(i<0)return 0;let s=0;for(let t in a){if(+t<this.pageIndex){if(i>=s&&i+o<=s+a[t].height)return+t}else if(i+o>=s&&i<=s+a[t].height)return+t;s+=a[t].height}return a.length-1},this.changeItemPageByLinkAction=(t,e)=>{if(!(0,c.getIsFlatPages)())return;let i=(0,g.getMostParentByCompId)(t,this.worksData.positionLink),o=this.getCompShouleBelongToPage(i);return o!==this.pageIndex&&this.moveItemToPage(i,o),o},this.elementPaste=(t,e,i=!0)=>{let o=[];if(null!=t){if("string"==typeof t)try{let e=JSON.parse(t);if(o instanceof Array)o=e;else{console.log(`è§£æç²è´´çæ°æ®æ æ³è½¬æ¢æç¼è¾å¨å
ç´ ç»æ°æ®`);return}}catch(t){console.log(`è§£æç²è´´çæ°æ®æ æ³è½¬æ¢æç¼è¾å¨å
ç´ æ°æ®`);return}else o=t;if(o instanceof Array){o=o.filter(Boolean);let t=[];for(let a of o)if(!this.isDisableCopy(a.compId)){let o=this.elementPaste(a,e,i);o&&t.push(o)}return t}{let{compId:t,inputLinkDict:a,entity:s,originLink:n,currentLink:r}=o,l=(0,g.changeCopyData)(t,s,Object.assign(Object.assign({},this.worksData.positionLink),r),a),{comp:d,linkDatas:h}=l,{height:c,width:p}=this.getPage(this.pageIndex),u=Object.assign(Object.assign({},n),{zIndex:(0,b.getMaxZ)(this.worksData.positionLink)}),{positionLink:y,moveInfo:k}=e;Object.entries(h).forEach(t=>{let[e,i]=t;if(e!==d.elemId){let t=Object.assign({},i);this.worksData.positionLink[e]=t}});let m={x:p/2,y:c/2};k?(u.x+=k.dx||0,u.y+=k.dy||0):y?(u.x=m.x-(n.width||0)/2,u.y=m.y-(n.height||0)/2):u=this.getAvoidCoverLink(u);let f=this.addComponentAction(d,u);return i&&(this.setControlComp(f),this.changeItemPageByLinkAction(f,u)),f}}},this.setLocation=(t,e)=>{let i=Object.assign({},this.worksData.positionLink[t]);e.x!==i.x&&null!=e.x&&(this.worksData.positionLink[t].x=(0,h.notEmpty)(e.x,this.worksData.positionLink[t].x)),e.y!==i.y&&null!=e.y&&(this.worksData.positionLink[t].y=(0,h.notEmpty)(e.y,this.worksData.positionLink[t].y)),(0,b.throttle)(this.changeItemPageByLinkAction,200)},this.recalculationCombinationInfo=t=>{var e,i;if(!t)return;let{positionLink:o}=this.worksData,a=o[t];if(a&&a.parentId){let{parentId:t}=a,s=o[t],{rotate:n=0}=s,r=Object.keys(o).filter(e=>o[e].parentId===t),l=(0,h.polarCoordinatesTransfrom)(t,r,o),d=(0,g.getCombinationInfoByLinkDict)(r,l,n),{x:c,y:p,width:u,height:y,extraLink:k}=d;for(let o of(this.worksData.positionLink[t]=Object.assign(Object.assign({},this.worksData.positionLink[t]),{x:c,y:p,width:u,height:y}),Object.keys(k))){let t=k[o],a={x:(null===(e=t.inCombinationPoint)||void 0===e?void 0:e.x)||0,y:(null===(i=t.inCombinationPoint)||void 0===i?void 0:i.y)||0};this.setLocation(o,a);let s=l[o].rotate||0;
1this.setRotate(o,s-n)}this.recalculationCombinationInfo(t)}},this.isCommonOperatorDisabled=t=>{var e,i;let o=this.getLayer(t,!0),a=this.getLink(t);if(o){let t=o.elementRef,s=(0,c.getWidgetMeta)(t);if(s){let t=s.editorApply.disabledCommonOperator;return!!(null==a?void 0:a.disabledCommonOperator)||!!t||!!s.editorApply.blockInPageOptions&&(null===(i=null===(e=s.editorApply.blockInPageOptions)||void 0===e?void 0:e.forWorksType)||void 0===i?void 0:i.includes((0,c.getWorksDetailStatic)().type))}}return!1},this.isDisablePosition=(t,e="other")=>{let i=this.getLink(t);if(!i)return!1;let{lock:o=!1}=i;return!!o||!!(i.parentId&&"shortcuts"===e||this.isCommonOperatorDisabled(t)&&!this.isHighlightCanvasOperator(t))},this.isDisableSize=t=>{let e=this.getLink(t),i=this.getLayerOrigin(t);if(!e)return!1;let{lock:o=!1}=e;return!!o||t===this.areaParentId||!!(e.parentId||this.isCommonOperatorDisabled(t))||null!=i&&!!i.elementRef&&["MkCombination"].indexOf(i.elementRef)>=0},this.isDisableCopy=t=>{if(t){let e=this.getLayer(t);if(e){let t=e.elementRef,i=(0,c.getWidgetMeta)(t);if((null==i?void 0:i.editorApply.disabledCopy)||"MkBulletScreen"===t)return!0}return this.isCommonOperatorDisabled(t)||this.isHighlightCanvasOperator(t)}return!1},this.isDisableDelete=t=>{var e;return!!this.isCommonOperatorDisabled(t)||null!==(e=this.getLink(t))&&void 0!==e&&!!e.lock},this.isDisableRegion=t=>!!this.isCommonOperatorDisabled(t),this.isHighlightCanvasOperator=t=>{let e=this.getLayer(t);if(e){let t=e.elementRef,i=(0,c.getWidgetMeta)(t);if(i){let{highlightOperator:t=!1}=i.editorApply;return t}}return!1},this.setMusicEditState=t=>{this.musicEditState=t},this.cleanActivePage=()=>{this.activeResizePageIndex=void 0},this.setActivePage=t=>{this.activeResizePageIndex=t},this.getLink=t=>this.worksData.positionLink[t]||({[this.areaParentId]:this.areaParentLinkDict})[t],this.setEditorCompLoad=t=>{this.editorCompLoad=t},this.setPageIndex=t=>{null!=t&&(this.pageIndex=t)},this.clearOperation=()=>{let{controlComp:t}=this;return this.areaComps=[],this.highlightComps=[],this.controlComp="",this.activeLayerId="",t},this.setScaleStatus=t=>{this.scaleStatus=t},this.cleanArea=()=>{this.areaParentId="",this.areaParentLinkDict={x:0,y:0,width:0,height:0,groupType:u.GroupType.临æ¶,rotate:0}},this.deHighlightComId=t=>{this.highlightComps=this.highlightComps.filter(e=>t!==e)},this.getOperatorHandle=t=>this.operationState[t],this.changeOperatorHandle=(t,e)=>{this.operationState[t]=e},this.getLinks=()=>{console.warn("æ¤æ¥å£ææ§è½é®é¢ï¼è°¨æ
è°ç¨ã");let t=Object.assign(Object.assign({},this.worksData.positionLink),{[this.areaParentId]:this.areaParentLinkDict});return t},this.setScale=t=>{let{min:e=1,max:i=2}=this.config.scaleConfig||{};this.scale=Math.max(e,Math.min(t,i))},this.getLayers=(t=!1)=>{let{pageIndex:e}=this;return this.getPageLayers(e,t)},this.unCombinationLayers=(t,e)=>{var i;let{pageIndex:o,worksData:a}=this;if("-1"==`${o}`)return;let{positionLink:s}=a,{parentId:n}=s[t],{pages:r}=this.worksData.canvasData.content,l=r[o],{layers:d}=l,p=d;(0,g.isInCanvas)((0,c.getPageId)(),n)||(p=(null===(i=(0,g.findTreeLayer)(n,d))||void 0===i?void 0:i.body)||[]);let y=p.find(e=>e.elemId===t);this.clearOperation();let k=[];if(y&&y.body){let{body:i}=y,o=(0,h.polarCoordinatesTransfrom)(t,i.map(t=>t.elemId),this.worksData.positionLink);i.forEach(e=>{e.parentId=y.parentId,this.worksData.positionLink[e.elemId].parentId=this.worksData.positionLink[t].parentId,this.worksData.positionLink[e.elemId].x=o[e.elemId].x,this.worksData.positionLink[e.elemId].y=o[e.elemId].y,this.worksData.positionLink[e.elemId].rotate=(this.worksData.positionLink[e.elemId].rotate||0)+(this.worksData.positionLink[y.elemId].rotate||0)}),p.push(...i),y.body=void 0;let a=p.findIndex(t=>t.elemId===y.elemId);p.splice(a,1),delete this.worksData.positionLink[y.elemId];let s=Object.keys(o);k.push(...s),e!==u.GroupType.临æ¶&&this.setAreaComps(s)}return this.setControlComp(""),k},this.setCombinationLayers=(t,e={})=>{if(t.length<2)return;let i=[],unGroupRec=t=>{t.forEach(t=>{let e=this.worksData.positionLink[t];if(e.groupType){let e=this.unCombinationLayers(t)||[];e.length>0&&(i.push(...e),unGroupRec(e))}else i.push(t)})};unGroupRec(t),this.clearOperation(),t=i;let o=Object.keys(this.worksData.positionLink).filter(e=>t.includes(e)),a=Object.assign(Object.assign({},(0,g.getCombinationInfoByLinkDict)(o,this.worksData.positionLink)),e),{pageIndex:s}=this,{pages:n}=this.worksData.canvasData.content,r=n[s],{layers:l}=r,d=[],c=[],p=(0,h.random)(),u={};
1l.forEach(e=>{if(t.includes(e.elemId)){u[e.elemId]=this.worksData.positionLink[e.elemId],u[e.elemId].parentId=p,u[e.elemId].x-=a.x||0,u[e.elemId].y-=a.y||0;let t=u[e.elemId].rotate||0;u[e.elemId].rotate=t,e.parentId=p,d.push(e)}else c.push(e)});let y=Math.max(0,(0,b.getMaxZ)(u)-1);if(0===d.length)return;let k={elemId:p,type:"element",parentId:void 0,body:d,elementRef:"MkCombination",attrs:Object.assign({},a)};return this.worksData.positionLink=Object.assign(Object.assign({},this.worksData.positionLink),u),this.worksData.positionLink[p]=(0,b.getDefaultLink)(a,this.worksData.positionLink),this.worksData.positionLink[p].zIndex=y,c.push(k),r.layers=c,this.setControlComp(p),{comId:p,combinationIds:t}},this.temporaryToKeepGroup=(t,e)=>{let i=this.setCombinationLayers(t,void 0);return i&&(this.worksData.positionLink[i.comId].groupType=u.GroupType.ä¿æ,e&&Object.assign(this.worksData.positionLink[i.comId],e)),null==i?void 0:i.comId},this.initOperationHandle=t=>{if(t&&!this.operationState[t.elemId]&&t.elementRef){let{elemId:e,elementRef:i}=t,o=(0,c.getWidgetMeta)(i),a=(null==o?void 0:o.editorApply.disableScaleDirection)||[],s=(null==o?void 0:o.editorApply.disableScale)||!1,n=a.includes("vertical"),r=a.includes("horizontal"),l=a.includes("diagonal"),d={disableScale:s||n&&r&&l,diagonalOnly:s||n&&r&&!l,horizontalOnly:s||n&&!r&&l,verticalOnly:s||!n&&r&&!l,disableDiagonal:s||!n&&!r&&l,disableVertical:s||n&&!r&&!l,full:s||!n&&!r&&!l},h=Object.keys(d).find(t=>d[t]?t:null);this.operationState[e]=h}},this.setControlComp=(t,e)=>{this.controlComp=t,this.areaComps=this.areaComps.filter(e=>e!==t),this.highlightComps=this.highlightComps.filter(e=>e!==t),this.setActivItemByID(t,e)},this.setActivItemByID=(t,e)=>{let i=this.worksData.positionLink[t],o=this.getLayer(t,!0),a={name:"",contentProps:{},comId:"",idx:0};o&&i&&(a.comId=t,a.contentProps=o,a.name=o.elementRef,a.idx=i.zIndex?null==i?void 0:i.zIndex:0),this.setActivLayer(t)},this.setActivLayer=t=>{this.activeLayerId=t,this.initOperationHandle(this.getLayer(t))},this.getActiveLayer=()=>this.getLayer(this.activeLayerId),this.getActiveLink=()=>this.getLink(this.activeLayerId),this.getActiveItemAttrs=()=>this.getItemAttrs(this.activeLayerId),this.deleteActiveCompEntity=(t=!0)=>{let e=this.activeLayerId;e&&(t?this.deleteCompEntity(e):this.deleteCompEntityFun(e))},this.deleteCompEntityFun=(t,e=this.pageIndex)=>{let i=(0,h.toArray)(t),o=[],a=this.getPageLayers(e,!1),s=[],pickRemainingLayers=t=>{let e=[];for(let a of t){let{elemId:t}=a;(i.includes(t)||a.parentId&&i.includes(a.parentId))&&o.push(t),i.includes(t)?s.push(a):e.push(a),a.body&&(a.body=pickRemainingLayers(a.body))}return e},n=pickRemainingLayers((0,h.mergeDeep)(a));this.areaComps=this.areaComps.filter(t=>!i.includes(t)&&!this.isDisableDelete(t)),this.setPageLayers(e,n),this.delLink(o)},this.deleteCompEntity=(t,e=this.pageIndex)=>{this.deleteCompEntityFun(t,e),this.cleanArea(),this.clearOperation(),this.setActivItemByID("")},this.setAreaComps=t=>{if(t instanceof Array)this.areaComps=t.filter(t=>{let{visibility:e=!0}=this.worksData.positionLink[t];return e});else if(this.controlComp!==t){let e=this.worksData.positionLink[t];!this.areaComps.includes(t)&&e.visibility&&this.areaComps.push(t)}},this.addComponentAction=(t,e)=>{let{elemId:i=(0,h.random)(),type:o="element",elementRef:a}=t,s=Object.assign({},t),{pageIndex:n}=this;s.elemId=i,s.type=o,this.worksData.canvasData.content.pages[n]||(this.worksData.canvasData.content.pages[n]=this.getDefaultPageData());let r=this.getPageLayers(n,!1);r.push(s),this.setPageLayers(n,r),this.setLink(i,e),this.areaComps=[];let l=a&&(0,c.getWidgetMeta)(a);return l&&l.activity&&this.setWorkMeta(l),this.widgetRelyMonitor(),i},this.addComponent=(t,e,i=!0)=>{let o=this.addComponentAction(t,e);return i&&setTimeout(()=>{this.setActivItemByID(o),this.setControlComp(o)},10),o},this.addComponentBatchByPSD=(t,e)=>{let{pageIndex:i}=this,o=this.getPageLayers(i,!1);t.forEach(t=>{let{elemId:e,type:a="element"}=t,s=Object.assign({},t),n=e||(0,h.random)();s.from="psd",s.elemId=n,s.type=a,this.worksData.canvasData.content.pages[i]||(this.worksData.canvasData.content.pages[i]=this.getDefaultPageData()),o.push(s)}),this.setPageLayers(i,o),e&&Object.assign(this.worksData.positionLink,e)},this.addComponentBatch=(t,e)=>{let{pageIndex:i}=this,o=this.getPageLayers(i,!1);t.forEach(t=>{let{elemId:e,type:a="element"}=t,s=Object.assign({},t),n=e||(0,h.random)();s.elemId=n,s.type=a,this.worksData.canvasData.content.pages[i]||(this.worksData.canvasData.content.pages[i]=this.getDefaultPageData()),o.push(s)}),this.setPageLayers(i,o),e&&Object.assign(this.worksData.positionLink,e)},this.addMkTextByCopy=t=>{this.addComponent({attrs:{fontUrl:"https://font.maka.im/20190724/Alibaba-PuHuiTi-Regular.ttf",fontFamily:"Alibaba-PuHuiTi-Regular",text:`<p>${t}</p>`,fontSize:28},elementRef:"MkText"})},this.copyEntityAction=(t,e,i)=>{let o=(0,g.checkCopyItem)(t,t=>{this.addMkTextByCopy(t)}),a=o.entity;if(!a)return;let{elemId:s}=a,n=(0,d.toJS)(this.worksData.positionLink[s]);delete n.parentId;let r=(0,d.toJS)(this.worksData.positionLink);return{entity:a,inputLinkDict:e,compId:s,originLink:n,currentLink:r,page_id:(0,c.getWorksId)()}},this.shearEntity=t=>{(0,d.runInAction)(()=>r(this,void 0,void 0,function*(){let e=this.getCopyEntityData(t);yield navigator.clipboard.writeText(JSON.stringify(e)),this.deleteCompEntity(t),this.setControlComp("")}))},this.getCopyEntityData=(t,e="copy")=>{if(t instanceof Array)return t.map(t=>this.getCopyEntityData(t));{if(!this.activeLayerId)return null;let i=t||this.activeLayerId,o=this.getLayer(i);if(null==o||delete o.parentId,o){let t=this.copyEntityAction({entity:o},void 0,e);if(t)return t}return null}},this.setCompsLock=(t,e)=>{t.forEach(t=>{t===this.areaParentId?this.areaParentLinkDict.lock=e:this.updateLinkDictPorps(t,{lock:e})})},this.setLink=(t,e)=>{if(null==e)this.worksData.positionLink[t]=(0,b.getDefaultLink)({x:-9999999,y:0,rotate:0},this.worksData.positionLink);else{let i=this.getLink(t);
1i?this.worksData.positionLink[t]=Object.assign(Object.assign({},i),e):this.worksData.positionLink[t]=(0,b.getDefaultLink)(e,this.worksData.positionLink)}},this.addPage=(t,e,i,o=!0,a)=>{let s=t,n=(0,c.getMaxPage)();if(this.worksData.canvasData.content.pages.length>=n){console.error("å·²è¶
è¿æå¤§é¡µæ°éå¶"),null==a||a("å·²è¶
è¿æå¤§é¡µæ°éå¶");return}null==s&&(s=Math.max(...Object.keys(this.worksData.canvasData.content.pages).map(Number))||0),s+=1;let r=this.getPages(),l=r[s-1],{width:d,height:h}=l,p=e||this.getDefaultPageData();p.width=(null==e?void 0:e.width)||d,p.height=(null==e?void 0:e.height)||h;let u=(0,g.insertPages)(r,s,p);this.worksData.canvasData.content.pages=u,i&&Object.assign(this.worksData.positionLink,i),this.setPageIndex(s),this.clearOperation(),this.setActivItemByID(""),this.widgetRelyMonitor()},this.copyPage=(t,e=!0)=>{let i=+t,o=this.getPage(t);if(o){let t=(0,d.toJS)(o);t.id=(0,h.random)();let a={oldPageId:o.id,newPageId:t.id,layerIdMap:{}},{layers:s}=t,n={};return(0,v.deepLayers)(s,t=>{var e;let i=(0,h.random)(),{elemId:o}=t;if(null!=o){let s=t.parentId,r=null===(e=n[t.parentId||""])||void 0===e?void 0:e.newId;n[o]={newId:i,oldParentId:s,newParentId:r},t.elemId=i,t.parentId=r,a.layerIdMap[o]={elemId:i,elemRef:t.elementRef}}}),Object.entries(n).forEach(t=>{let[e,i]=t,{newId:o,newParentId:a}=i;this.worksData.positionLink[o]=(0,d.toJS)(this.worksData.positionLink[e]),this.worksData.positionLink[o].parentId=a}),this.addPage(i,t,void 0,e),a}},this.orderPage=(t,e,i=!0)=>{let o=this.getPages(),a=(0,g.orderPages)(o,t,e);this.worksData.canvasData.content.pages=a,i&&(this.setPageIndex(e),this.clearOperation(),this.cleanArea())},this.delPage=t=>{let e=this.getPages();if(e.length<=1)return;let{layers:i,options:o}=e[t];if((null==o?void 0:o.enableDelete)===!1)return;let a=[];(0,v.deepLayers)(i,t=>{let{elemId:e}=t;a.push(e)}),delete this.worksData.canvasData.content.pages[t],this.worksData.canvasData.content.pages=this.worksData.canvasData.content.pages.filter(Boolean);let s=Math.max(e.length-1,0),n=(0,h.valueInterval)(0,s,t-1);this.setPageIndex(n),a.forEach(t=>{delete this.worksData.positionLink[t]})},this.replacePage=(t,e,i)=>{let o=this.getPages(),a=o[t],{layers:s}=a,n=[];(0,v.deepLayers)(s,t=>{let{elemId:e}=t;n.push(e)}),n.forEach(t=>{delete this.worksData.positionLink[t]}),o.splice(t,1,Object.assign(a,e)),this.worksData.canvasData.content.pages=o,i&&Object.assign(this.worksData.positionLink,i),this.clearOperation(),this.setActivItemByID(""),this.widgetRelyMonitor()},this.getPageBackground=t=>{let{pageIndex:e}=this,i=this.getPage(null==t?e:t),o=i.background||{};return Array.isArray(o)&&(o={}),o},this.setPageBackground=(t,e=!1,i,o=!0)=>{this.takeSnapshotOfData("setPageBackground"),e&&this.deleteActiveCompEntity(!1);let a=null==i?this.pageIndex:i,s=this.getPageBackground(a),n=(0,h.mergeDeep)(s,t);!s||s.bgpic||s.bgcolor||(n.opacity=1),this.worksData.canvasData.content.pages[a].background=n,this.setData(this.worksData)},this.setWorkPassword=t=>{this.changePageSetting({password:t})},this.changeContraints=(t,e)=>{let i=this.getLink(t);this.getPage(this.pageIndex),i&&(i.constraints=e)},this.getWidgetState=t=>(0,d.toJS)(this.widgetState[t]||{}),this.changeWidgetState=(t,e)=>{this.widgetState[t]||(this.widgetState[t]={}),this.widgetState[t]=(0,h.mergeDeep)(this.widgetState[t],e)},i&&(actions(this,t.actionInterceptor),(0,d.makeObservable)(this)),this.recalculationCombinationControl=new p.default(this),Object.assign(this.config,t)}};a([d.observable,n("design:type",Object)],WorksStore.prototype,"activeResizePageIndex",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"widgetState",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"scale",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"editorCompLoad",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"pageIndex",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"isShowGridline",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"musicEditState",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"activeItem",void 0),a([d.observable,n("design:type",String)],WorksStore.prototype,"activeLayerId",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"scaleStatus",void 0),a([d.observable,n("design:type",Array)],WorksStore.prototype,"areaComps",void 0),a([d.observable,n("design:type",String)],WorksStore.prototype,"areaParentId",void 0),a([d.observable,n("design:type",u.IPositionLink)],WorksStore.prototype,"areaParentLinkDict",void 0),a([d.observable,n("design:type",Array)],WorksStore.prototype,"highlightComps",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"controlComp",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"isAppReady",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"widgetMetadataColl",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"widgetLoadState",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"widgetRely",void 0),a([d.observable,n("design:type",String)],WorksStore.prototype,"connectState",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"operationState",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"activeAnimationType",void 0),a([d.observable,n("design:type",Object)],WorksStore.prototype,"lockLayerPositionMode",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"initData",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setWidgetLoadState",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setWidgetMetaColl",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setLockLayerPositionMode",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"widgetRelyMonitor",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"addComponentFromLib",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"setAreaParent",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setThemeSchema",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"onComponentDidMount",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"moveElementLayerZindex",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"replaceWorksData",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"exchangeGridlineState",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setWorksStyle",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"setCanvaSize",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"setPageCanvaHeight",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"addCanvas",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"addLayersToNewCanvas",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"moduleToCanvas",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"canvasToModule",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"elementPaste",void 0),a([f.commonAction,n("design:type",Object)],WorksStore.prototype,"setLocation",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"recalculationCombinationInfo",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setMusicEditState",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"cleanActivePage",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setActivePage",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setEditorCompLoad",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setPageIndex",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"clearOperation",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setScaleStatus",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"cleanArea",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"deHighlightComId",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setScale",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"unCombinationLayers",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setCombinationLayers",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"temporaryToKeepGroup",void 0),a([f.commonAction,n("design:type",Object)],WorksStore.prototype,"setControlComp",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setActivItemByID",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setActivLayer",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"deleteActiveCompEntity",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"deleteCompEntity",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setAreaComps",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"addComponentAction",void 0),a([f.commonAction,n("design:type",Object)],WorksStore.prototype,"addComponent",void 0),a([f.commonAction,n("design:type",Object)],WorksStore.prototype,"addComponentBatchByPSD",void 0),a([f.commonAction,n("design:type",Object)],WorksStore.prototype,"addComponentBatch",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"shearEntity",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"setCompsLock",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setLink",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"addPage",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"copyPage",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"orderPage",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"delPage",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"replacePage",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setPageBackgroun
1d",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"setWorkPassword",void 0),a([y.undoableAction,n("design:type",Object)],WorksStore.prototype,"changeContraints",void 0),a([d.action,n("design:type",Object)],WorksStore.prototype,"changeWidgetState",void 0),e.WorksStore=WorksStore},57299:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.commonAction=e.commonActionNames=void 0,e.commonActionNames=[],e.commonAction=(t,i)=>{e.commonActionNames.push(i)}},94913:function(t,e,i){var o=this&&this.__createBinding||(Object.create?function(t,e,i,o){void 0===o&&(o=i);var a=Object.getOwnPropertyDescriptor(e,i);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,o,a)}:function(t,e,i,o){void 0===o&&(o=i),t[o]=e[i]}),a=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||o(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),a(i(58672),e),a(i(94715),e)},95848:function(t,e,i){var o=this&&this.__decorate||function(t,e,i,o){var a,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(a=t[r])&&(n=(s<3?a(n):s>3?a(e,i,n):a(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=this&&this.__awaiter||function(t,e,i,o){return new(i||(i=Promise))(function(a,s){function fulfilled(t){try{step(o.next(t))}catch(t){s(t)}}function rejected(t){try{step(o.throw(t))}catch(t){s(t)}}function step(t){var e;t.done?a(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(fulfilled,rejected)}step((o=o.apply(t,e||[])).next())})},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.OperationStore=void 0;let r=i(68949),l=n(i(69483)),d=i(98253),h=i(57054);let OperationStore=class OperationStore{constructor(t){this.operationList=[],this.loading=!0,this.dbMaxCount=500,this.workId="",this.uid="",this.actionList=[],this.getIterate=()=>new Promise(t=>{let e=this.operationLocal,i=[];e.iterate((t,e)=>{e.includes(this.workId)&&e.includes(this.uid)&&i.push({val:t,key:e})}).then(()=>{t(i)}).catch(()=>{t([])})}),this.cleanOldData=(t,e)=>s(this,void 0,void 0,function*(){let i=Date.now(),o=[];for(let a of e){let{val:{time:e}}=a;i-e>12096e5&&o.push(t.removeItem(`${e}`))}return yield Promise.all(o)}),this.init=(t,e)=>s(this,void 0,void 0,function*(){this.workId=t,this.uid=e,this.operationLocal=l.default.createInstance({name:"operation-history"});let i=yield this.getIterate(),o=i.filter(t=>t.key.includes(this.workId));yield this.cleanOldData(this.operationLocal,i),0===o.length?this.operationList=[]:this.operationList=o.map(t=>t.key),yield(0,d.sleep)(2e3),this.loading=!1}),this.saveItem=(t,e)=>s(this,void 0,void 0,function*(){let i=this.operationLocal,o=yield this.getIterate();if(o.length>this.dbMaxCount){let t=o.reduce((t,e)=>t.val.time<e.val.time?t:e);if(t){let{key:e}=t;i.removeItem(e).catch(()=>console.log("å é¤å¤±è´¥"))}}i.setItem(`${t}`,e)}),this.getLayersCount=t=>{let e=0,{pages:i}=t.canvasData.content;return Object.values(i).forEach(t=>{let{layers:i}=t;e+=i.length}),e},this.addOperationOne=t=>s(this,void 0,void 0,function*(){if(this.loading||0===this.getLayersCount(t))return;let e=this.operationLocal,i=Date.now(),o=`${this.workId}-${this.uid}-${i}`;if(this.operationList.push(`${o}`),this.operationList.length>this.dbMaxCount){let t=this.operationList.pop();t&&e.removeItem(`${t}`).catch(()=>console.log("å é¤å¤±è´¥"))}this.saveItem(o,{data:t,time:i})}),this.getOperationHistory=()=>s(this,void 0,void 0,function*(){let t=yield this.getIterate();return t.filter(t=>t.key.includes(this.workId))}),this.addOperation=(0,h.throttle)(this.addOperationOne,9e5),(0,r.makeObservable)(this);let{count:e}=t;this.dbMaxCount=e}};o([r.action,a("design:type",Object)],OperationStore.prototype,"init",void 0),o([r.action,a("design:type",Object)],OperationStore.prototype,"addOperationOne",void 0),o([r.action,a("design:type",Object)],OperationStore.prototype,"addOperation",void 0),e.OperationStore=OperationStore}
1,24969:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});let o=i(68949);e.default=class{constructor(t){this.setPreControlComp=t=>{if(this.preControlComp=t,this.disposeCompLinkChange(),!this.workStore.worksData.positionLink[t])return;this.compLinkDict=(0,o.toJS)(this.workStore.worksData.positionLink[t]);let{compLinkDict:e}=this;this.disposeCompLinkChange=(0,o.autorun)(()=>{if(!this.workStore.worksData.positionLink[t])return;let i=(0,o.toJS)(this.workStore.worksData.positionLink[t]);setTimeout(()=>{this.workStore.recalculationCombinationInfo(t)},0),this.compLinkDict=Object.assign(Object.assign({},e),i)})},this.setPreActiveItem=t=>{this.preActiveItem=t,this.disposeActiveLinkChange(),this.activeLinkDict=(0,o.toJS)(this.workStore.worksData.positionLink[t]);let{activeLinkDict:e}=this,i=!1;this.disposeActiveLinkChange=(0,o.autorun)(()=>{if(this.workStore.worksData.positionLink[t]&&!i){i=!0;let a=(0,o.toJS)(this.workStore.worksData.positionLink[t]);setTimeout(()=>{this.workStore.recalculationCombinationInfo(t)},0),this.activeLinkDict=Object.assign(Object.assign({},e),a),setTimeout(()=>{i=!1},100)}})},this.init=()=>{(0,o.autorun)(()=>{let{controlComp:t}=this.workStore;this.preControlComp!==t&&(this.workStore.recalculationCombinationInfo(this.preControlComp),this.setPreControlComp(t))}),(0,o.autorun)(()=>{let t=this.workStore.activeLayerId;this.preActiveItem!==t&&(this.workStore.recalculationCombinationInfo(this.preActiveItem),this.setPreActiveItem(t))})},this.workStore=t,this.preControlComp="",this.preActiveItem="",this.disposeCompLinkChange=()=>{},this.disposeActiveLinkChange=()=>{},this.init()}}},35562:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.pageCoordinateSystemToCanvas=e.canvasCoordinateSystemToPage=e.getWorksHeight=e.getModuleTopHeight=e.getIdsByAssociated=e.istTrailerPage=e.getIncompleteLinkDict=e.getInvolveIds=e.getOutLayerId=e.isInCanvas=e.canvasToDeepCombinationPosition=e.getCombinationInfoByLinkDict=e.changeCopyData=e.deepCopyItem=e.checkCopyItem=e.orderPages=e.insertPages=e.getCombinationInfo=e.deepItemToCanvas=e.getMostParentByCompId=e.getPathByCompId=e.findTreeLayer=e.getRect=e.deepLayers=void 0;let o=i(98253),a=i(68949),s=i(39892),n=i(35988);Object.defineProperty(e,"deepLayers",{enumerable:!0,get:function(){return n.deepLayers}}),e.getRect=t=>{let e="string"==typeof t?document.querySelector(t):t,i=e.getBoundingClientRect(),o=i.left+i.width/2,a=i.top+i.height/2;return{x:i.x,y:i.y,top:i.top,left:i.left,width:i.width,right:i.right,height:i.height,bottom:i.bottom,center:{x:o,y:a,left:o,right:o,top:a,bottom:a}}},e.findTreeLayer=(t,i)=>{for(let o of i){if(o.elemId===t)return o;if(null!=o.body){let i=(0,e.findTreeLayer)(t,o.body);if(null!=i)return i}}return null},e.getPathByCompId=(t,e)=>{let i=[],o=e[t];for(;null==o?void 0:o.parentId;)i.push(o.parentId),o=e[o.parentId];return i},e.getMostParentByCompId=(t,e)=>{let i=t,o=e[t];for(;null==o?void 0:o.parentId;)i=o.parentId,o=e[o.parentId];return i},e.deepItemToCanvas=(t,i,a,s)=>{let n=0,r={x:a||0,y:s||0,lastCombinationRotate:n},l=(0,e.getPathByCompId)(t,i).reverse(),d=i,h=i;if(0===l.length)return r;for(let e=0;e<l.length;e++){let a=l[e],s=l[e+1];if(s){h=(0,o.polarCoordinatesTransfrom)(a,[s],Object.assign(Object.assign({},i),d)),h=Object.assign(Object.assign({},i),h);let t=d[a].rotate||0,e=d[s].rotate||0;h[s].rotate=e+t,h[s].width=i[s].width,h[s].height=i[s].height,d=h}else{h=(0,o.polarCoordinatesTransfrom)(a,[t],d);let e=d[a].rotate||0;n=e}}return Object.assign(Object.assign({},h[t]),{lastCombinationRotate:n})},e.getCombinationInfo=(t,i)=>{let o=0,a=0,s=0,n=0;for(let i=0;i<t.length;i++){let r=t[i],l=(0,e.getRect)(r);0===i?(o=l.left,a=l.top,s=l.right,n=l.bottom):(o=Math.min(o,l.left,l.right),a=Math.min(a,l.top,l.bottom),s=Math.max(s,l.left,l.right),n=Math.max(n,l.top,l.bottom))}let r=document.querySelector("#id-canvas-scroll .canvas_content_box"),l=(0,e.getRect)(r),d=o-l.x,h=a-l.y,c={x:d/i,width:(s-o)/i,y:h/i,height:(n-a)/i};return c},e.insertPages=(t,e,i)=>{let o=[...t.slice(0,e),Object.assign(Object.assign({},i),{pageIndex:e}),...t.slice(e)];return o},e.orderPages=(t,e,i)=>{let o=t.splice(e,1)[0];return t.splice(i,0,o),t},e.checkCopyItem=(t,e)=>{let i;if("string"==typeof t)try{i=JSON.parse(t)}catch(o){console.log(`è§£æç²è´´çæ°æ®æ æ³è½¬æ¢æç¼è¾å¨å
ç´ æ°æ®,å°è¯è½¬æ¢æå¯ææ¬ç»ä»¶`),e(t),i=null;return}else i=t;return i},e.deepCopyItem=(t,e)=>{let i={},s=(0,a.toJS)(e);return(0,n.deepLayers)([t],(t,e)=>{let{elemId:a}=t;t.elemId=(0,o.random)(),null==t.parentId?i[t.elemId]=Object.assign(Object.assign({},s[a]),{lock:!1,mount:!1}):(t.elemId=(0,o.random)(),t.parentId=e,i[t.elemId]=Object.assign(Object.assign({},s[a]),{parentId:e,lock:!1,mount:!1}))}),{comp:t,linkDatas:i}},e.changeCopyData=(t,i,o,a)=>{let{comp:s,linkDatas:n}=(0,e.deepCopyItem)(i,o);return n[s.elemId].x=(null==a?void 0:a.x)||+(o[t].x||0),n[s.elemId].y=(null==a?void 0:a.y)||+(o[t].y||0),{comp:s,linkDatas:n}},e.getCombinationInfoByLinkDict=(t,e,i=0)=>{let a=(0,o.getCompTransformCoordinateSystem)(t,e,i),s=Object.assign({rotate:i,extraLink:a.rectTransformCompCoordinateSystemInfoDict},a.combinationPosition);return s},e.canvasToDeepCombinationPosition=(t,i,a)=>{let s=a[t],n=Object.assign({},i);if(s&&s.parentId){let s=(0,e.getPathByCompId)(t,a).reverse(),r=i;for(let t of s){let e=a[t];
1if(e){let{rotate:t=0}=e,i=(0,o.getCenterObj)(e),a=(0,o.getCenterObj)(r),s=(0,o.getRotatedPoint)(a,i,-t),l=s.x-a.x,d=s.y-a.y;n.x=r.x+l-e.x,n.y=r.y+d-e.y,n.rotate=(r.rotate||0)-(e.rotate||0),r=Object.assign({},n)}}return n}return i},e.isInCanvas=(t,e)=>""===e||e===t||null==e,e.getOutLayerId=(t,i,o)=>{let a=i[t];if(!a)return null;let{parentId:s}=a;if((0,e.isInCanvas)(o,s))return t;{let a=t,s=i[a];for(;!(0,e.isInCanvas)(o,s.parentId);)s=i[a=s.parentId];return a}},e.getInvolveIds=(t,e)=>{let i=[],o=e[t];if(!o)return i;for(;o&&o.parentId;){for(let t of Object.keys(e)){let a=e[t];a.parentId===o.parentId&&i.push(t)}i.push(o.parentId),o=e[o.parentId]}return i.push(t),i},e.getIncompleteLinkDict=(t,e)=>{let i={};for(let o of t)e[o]&&(i[o]=e[o]);return i},e.istTrailerPage=t=>"-1"==`${t}`,e.getIdsByAssociated=(t,e)=>{let i=[e];return(0,n.deepLayers)(t,t=>{let{elemId:e}=t;i.push(e)}),i},e.getModuleTopHeight=(t,e)=>{if(!(0,s.getIsFlatPages)()||void 0===e)return 0;let i=0,o=t.getPages();for(let t of Object.keys(o)){if(e===+t)break;i+=o[t].height||0}return i},e.getWorksHeight=t=>{let e=0,i=t.getPages();for(let t of i)e+=t.height||0;return e},e.canvasCoordinateSystemToPage=(t,i,o)=>{if(null==i)return o;let{x:a,y:s}=o,n=s-(0,e.getModuleTopHeight)(t,i);return{x:a,y:n}},e.pageCoordinateSystemToCanvas=(t,i,o)=>{if(null==i)return o;let{x:a=0,y:s=0}=o,n=s+(0,e.getModuleTopHeight)(t,i);return{x:a||0,y:n}}},36660:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.undoManager=e.UndoManager=e.undoableAction=e.storeActionNames=void 0,e.storeActionNames=[],e.undoableAction=(t,i)=>{e.storeActionNames.push(i)};let UndoManager=class UndoManager{constructor(t=100){this.maxUndoLevel=100,this.storeTimelineStack=[],this.undoStoreStack=[],this.timer=Math.random(),this.isUndoable=()=>this.storeTimelineStack.length>0,this.isRndoable=()=>this.undoStoreStack.length>0,this.record=t=>{"undefined"!=typeof window&&(clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.storeTimelineStack.push(t),this.storeTimelineStack.length>this.maxUndoLevel&&this.storeTimelineStack.shift()},150))},this.clearUndo=()=>{this.undoStoreStack=[]},this.redo=()=>this.undoStoreStack.pop(),this.undo=()=>{let t=this.storeTimelineStack.pop();t&&this.undoStoreStack.push(t);let e=[...this.storeTimelineStack].pop();return e},this.log=()=>{console.log("storeTimelineStack",this.storeTimelineStack)},this.maxUndoLevel=t}};e.UndoManager=UndoManager,e.undoManager=new UndoManager},8859:function(t,e,i){var o=this&&this.__createBinding||(Object.create?function(t,e,i,o){void 0===o&&(o=i);var a=Object.getOwnPropertyDescriptor(e,i);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,o,a)}:function(t,e,i,o){void 0===o&&(o=i),t[o]=e[i]}),a=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||o(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),a(i(40022),e),a(i(70282),e)},40022:function(t,e){var i;Object.defineProperty(e,"__esModule",{value:!0}),e.DataFromContentLib=e.IWorksStoreConfig=e.PasteDict=e.PasteDataItem=e.CopyData=e.IWorksMeta=e.IModule=e.PageSetting=e.FixedPage=e.WorksPage=e.WorksBackground=e.LayerElemItem=e.IPositionLink=e.IMusic=e.GroupType=e.IWorksData=void 0,e.IWorksData=class{},(i=e.GroupType||(e.GroupType={}))["ä¿æ"]="keep",i["临æ¶"]="temporary",e.IMusic=class{},e.IPositionLink=class{},e.LayerElemItem=class{},e.WorksBackground=class{},e.WorksPage=class{},e.FixedPage=class{},e.PageSetting=class{},e.IModule=class{},e.IWorksMeta=class{},e.CopyData=class{},e.PasteDataItem=class{},e.PasteDict=class{},e.IWorksStoreConfig=class{},e.DataFromContentLib=class{}},70282:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorksThemeConfig=void 0,e.WorksThemeConfig=class{constructor(){this.worksBg={top:{ossPath:"",materialId:""},body:{ossPath:"",materialId:""},footer:{ossPath:"",materialId:""}},this.worksFg={atmosphere:{url:"",materialId:"",name:""}},this.title={attrs:{color:"#000",fontSize:24}},this.subTitle={attrs:{fontSize:18,color:"#000",bg:{left:"",min:"",right:""}}},this.text={attrs:{fontSize:16,lineHeight:1.8,color:"#000"}},this.picture={attrs:{}},this.layer={padding:""},this.worksStyle={padding:""}}}}
1,14478:function(t,e,i){let o,a;Object.defineProperty(e,"__esModule",{value:!0}),e.analyzWorksData=e.getCurrPageData=e.didWidgetMount=e.initAnalyzWorksData=void 0;let s=i(47601),n={},r=!1,l=0;e.initAnalyzWorksData=(t,i,s)=>(r||(a=s,o||(o=(0,e.analyzWorksData)(t,i))),o),e.didWidgetMount=t=>{!n[t]&&(n[t]=!0,(l+=1)>=o.widgetRelyInfo.widgetCount-1&&(r=!0,null==a||a(o)))},e.getCurrPageData=(t,e)=>{if(!t)return{};let{pages:i}=t.canvasData.content;return i[e]||i[0]},e.analyzWorksData=(t,i)=>{let o=(0,s.treeNodeCounter)(t,i),a=(()=>{let{pages:e}=t.canvasData.content,o=e[i]||{layers:[],opacity:1,background:{}},a=(o.layers||[]).map((t,e)=>({idx:e,type:t.elementRef,attrs:t.attrs,id:t.elemId,body:t.body}));return a})();return{getBgData:()=>{let o=(0,e.getCurrPageData)(t,i);return o.background},widgetRelyInfo:o,compArr:a,getContainerInfo:e=>t.positionLink[e]}}},57054:function(t,e,i){var o=this&&this.__createBinding||(Object.create?function(t,e,i,o){void 0===o&&(o=i);var a=Object.getOwnPropertyDescriptor(e,i);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,o,a)}:function(t,e,i,o){void 0===o&&(o=i),t[o]=e[i]}),a=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||o(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),a(i(26719),e),a(i(45808),e),a(i(14478),e),a(i(47601),e),a(i(35988),e)},26719:function(t,e,i){var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.loadWidgetResource=e.getWidgetResUrl=e.wrapCDNUrl=void 0;let a=o(i(67294)),s=i(39892),n=i(98253),r={};e.wrapCDNUrl=t=>(0,s.cdnApi)(t);let getLocalWidgetResource=(t="")=>{let e=(0,n.getUrlSearchParams)({target:"dev_dll"})||"http://localhost:22111";return`${e}/${t}.js`},resGateway=(t,i)=>{let o=getIsUseLocalWidget();return o?getLocalWidgetResource(t):(0,e.wrapCDNUrl)(i)};e.getWidgetResUrl=(t,e,i)=>{let{cdnPath:o,ref:a,componentMeta:s}=t,n="editor-web"===i,r="viewer"===i,l="",d="";switch(e){case"comp":return resGateway(a,l=`${o}comp.js`);case"form":if(r)return null;return l=`${o}${n?"form.js":"form-wap.js"}`,(d=n?s.editorApply.webFormRef:s.editorApply.wapFormRef)?resGateway(d,l):null;case"template":if(r)return null;let{templatesRef:h}=s.editorApply;if(!h)return null;return(l=`${o}templates.js`)?resGateway(h,l):null}};let getIsUseLocalWidget=()=>(0,n.hasUrlParam)("dev_dll");e.loadWidgetResource=t=>{let{loadedWidgetCache:i,widgetMetadataColl:o,widgetRely:s={},mode:l}=t;return new Promise((t,d)=>{if(!o)return;let h="viewer"!==l,c={};Object.keys(s).forEach(t=>{t&&!i[t]&&(c[t]=!0)});let p=Object.keys(c).map(t=>{if(!t)return Promise.all([]);let i=o[t];if(!i)return console.error(`æ¾ä¸å° metaItem ${t}`),Promise.all([]);let a=(0,e.getWidgetResUrl)(i,"comp",l),s=(0,e.getWidgetResUrl)(i,"form",l),r=[(0,n.LoadScript)({src:`${a}`,id:`${t}Comp`}),h&&s?(0,n.LoadScript)({src:`${s}`,id:`${t}Form`}):null].filter(Boolean);return Promise.all(r)}),registerWidget=t=>{Object.keys(t).forEach(t=>{var e;let i=null===(e=window[t])||void 0===e?void 0:e.default;"function"==typeof i&&(window[t]=a.default.memo(i))})};p.length>0?Promise.all(p).then(()=>{Object.assign(r,s,c,i),registerWidget(r),t(Object.assign({},r))}).catch(t=>{console.error("loadWidgetResource error",t),d(t)}):d(Error("没æéè¦å è½½çç»ä»¶"))})}},47601:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.countPageElem=e.countPageElements=e.treeNodeCounter=void 0;let widgetRelyFilter=t=>{delete t.MkCombination};e.treeNodeCounter=(t,i)=>{let{pages:o,fixedLayer:a}=t.canvasData.content,s={MkBg:!0,MkText:!0,MkPicture:!0},n=void 0!==i,r={},l={};if(o&&o.forEach((t,i)=>{let{widgetCountInLayers:o,widgetRely:a,groupCountInLayers:n}=(0,e.countPageElements)(t.layers||[]);r[i]=o,l[i]=n,Object.assign(s,a)}),Array.isArray(a)){let{widgetCountInLayers:t,widgetRely:i,groupCountInLayers:o}=(0,e.countPageElements)(a);r.fixedLayer=t,l.fixedLayer=o,Object.assign(s,i)}let countAllPage=t=>{let e=0;return Object.keys(t).forEach(i=>
1{e+=t[i]}),e};return widgetRelyFilter(s),{widgetCount:n?r[i]:countAllPage(r),groupCounter:n?l[i]:countAllPage(l),pageCounter:r,allWidgetRely:s}};let isArray=t=>Array.isArray(t)&&t.length>0;e.countPageElements=t=>{if(!t)return{widgetCountInLayers:0,groupCountInLayers:0,widgetRely:{}};let e=0,i=0,o={},recursive=t=>{isArray(t)&&t.forEach(t=>{null!=t.elementRef&&(o[t.elementRef]=!0,e+=1,t.body&&isArray(t.body)&&(i+=1,recursive(t.body)))})};return recursive(t),{widgetCountInLayers:e,groupCountInLayers:i,widgetRely:o}};let hasChild=t=>Array.isArray(t)&&t.length>0;e.countPageElem=t=>{let e=0,i={},recursive=t=>{hasChild(t)&&(e+=t.length,t.forEach(t=>{t.elementRef&&(i[t.elementRef]=!0,t.body&&hasChild(t.body)&&recursive(t.body))}))};return recursive(t),{widgetCountInLayers:e,widgetRely:i}}},45808:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.findItemFromWorks=e.deepScanElement=e.getDefaultWorksData=e.getDefaultLink=e.getMaxZ=e.getDefaultPageData=e.pagesToArray=e.throttle=void 0;let o=i(98253),a=i(36562);e.throttle=(t,e)=>{let i=0;return(...o)=>{let a=Date.now();a-i>e&&(t(...o),i=a)}},e.pagesToArray=t=>{let e=[];for(let i of Object.keys(t)){let o=t[i];o&&e.push(Object.assign({},o))}return e},e.getDefaultPageData=t=>({layers:[],opacity:1,background:{},id:(0,o.random)(),width:t.width,height:t.height}),e.getMaxZ=t=>{let e=Object.values(t),i=Math.max(...e.map(t=>t.zIndex||0));return i+1},e.getDefaultLink=(t,i={})=>{let o=(0,e.getMaxZ)(i),a=Object.assign({lock:!1,visibility:!0,rotate:0,borderRadius:0,opacity:1,zIndex:o,mount:!1},t);return a},e.getDefaultWorksData=t=>{let e={height:1280,width:720},i={_version:0,pageSetting:{paginAnimateSetting:{autoPlay:!1,indicator:"slim",pageNumber:"none",pageTurningEffect:"layer",autoPlayTime:3,disableManualPageTurning:!1}},canvasData:{width:e.width,height:e.height,visualHeight:e.height,content:{pages:[{id:(0,o.random)(),layers:[],opacity:1,background:{opacity:1},width:e.width,height:e.height}],fixedPages:{layers:[]},fixedLayer:[]},actions:{},music:a.defaultMusic},positionLink:{}};return(0,o.mergeDeep)(i,t)},e.deepScanElement=(t,i,o)=>{for(let a=0;a<t.length;a++){let s=t[a];null==i||i(s,o);let n=s.body||[];n.length>0&&(0,e.deepScanElement)(n,i,o)}},e.findItemFromWorks=(t,i,o)=>{let{pages:a}=t.content;if(void 0===o)for(let t=0;t<a.length;t++){let o=a[t];(0,e.deepScanElement)(o.layers,i,t)}else{let t=a[o];(0,e.deepScanElement)(t.layers,i,o)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.