@leafer-ui/miniapp 1.0.9 → 1.0.10
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/dist/miniapp.cjs +15 -15
- package/dist/miniapp.esm.js +15 -15
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +71 -51
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.Platform.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.Platform.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:n,pixelRatio:s}=this.config,o={width:i||e.width,height:n||e.height,pixelRatio:s};this.resize(o),this.context&&(this.viewSelect&&(t.Platform.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,s){this.context.roundRect(t,e,i,n,"number"==typeof s?[s]:s)}),t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.Platform.miniapp.getBounds(this.viewSelect).then((t=>{this.clientBounds=t,e&&e()}))}startAutoLayout(e,i){this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.Platform.miniapp.onWindowResize(this.checkSize))}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,n={width:t,height:e,pixelRatio:i};this.isSameSize(n)||this.emitResize(n)}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.Platform.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),void 0!==this.width&&this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:s,fileType:o}=t.FileHelper;function a(e,i){t.Platform.origin={createCanvas:(t,e,n)=>{const s={type:"2d",width:t,height:e};i.createOffscreenCanvas?i.createOffscreenCanvas(s):i.createOffScreenCanvas(s)},canvasToDataURL:(t,e,i)=>t.toDataURL(s(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,n)=>{let a=e.toDataURL(s(o(i)),n);return a=a.substring(a.indexOf("64,")+3),t.Platform.origin.download(a,i)},download:(e,n)=>new Promise(((s,o)=>{let a;n.includes("/")||(n=`${i.env.USER_DATA_PATH}/`+n,a=!0);const r=i.getFileSystemManager();r.writeFile({filePath:n,data:e,encoding:"base64",success(){a?t.Platform.miniapp.saveToAlbum(n).then((()=>{r.unlink({filePath:n}),s()})):s()},fail(t){o(t)}})})),loadImage:e=>new Promise(((i,n)=>{const s=t.Platform.canvas.view.createImage();s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=t.Platform.image.getRealURL(e)})),noRepeat:"repeat-x"},t.Platform.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((e=>{i.getSetting({success:n=>{n.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="miniapp",t.Platform.requestRender=function(e){const{view:i}=t.Platform.renderCanvas||t.Platform.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class r{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:h,updateBounds:l,updateAllWorldOpacity:d}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper,g={x:0,y:0,width:1e5,height:1e5};class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(g):this.afterBounds.setListWithFn(t,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:w}=t.LeafHelper,m=t.Debug.get("Layouter");class v{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:o,LAYOUT:a,AFTER:r}=t.LayoutEvent,f=this.getBlocks(s);f.forEach((t=>t.setBefore())),n.emitEvent(new t.LayoutEvent(o,f,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(h(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(s,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||l(n[t])}l(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&d(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(s),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),n.emitEvent(new t.LayoutEvent(a,f,this.times)),n.emitEvent(new t.LayoutEvent(r,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:o}=t.LayoutEvent,a=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,a,this.times)),v.fullLayout(i),a.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(s,a,this.times)),i.emitEvent(new t.LayoutEvent(o,a,this.times)),this.addBlocks(a),t.Run.end(e)}static fullLayout(e){_(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),w(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new p([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const y=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(i.innerName,"---\x3e");try{i.app.emit(t.RenderEvent.CHILD_START,i),this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,y.error(t)}y.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return y.warn("rendering");if(this.times>3)return y.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return y.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),o=e.includes(this.target.__world),a=new t.Bounds(s);n.save(),o&&!t.Debug.showRepaint?n.clear():(s.spread(10+1/this.canvas.pixelRatio).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0)),this.__render(s,o,a),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds,!0),i.restore(),t.Run.end(e)}__render(e,i,n){const s=e.includes(this.target.__world)?{includes:i}:{bounds:e,includes:i};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,s),this.renderBounds=n=n||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),t.Debug.showHitView&&this.renderHitView(s),t.Debug.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender(n)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.changed=!0}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||y.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}const{hitRadiusPoint:b}=t.BoundsHelper;class B{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const s=n.through||!1,o=n.ignoreHittable||!1,a=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(a);const{list:r}=this.findList,h=this.getBestMatchLeaf(r,n.bottomList,o),l=o?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:r.length?this.getThroughPath(r):l}:{path:l,target:h}}getBestMatchLeaf(e,i,n){if(e.length){let i;this.findList=new t.LeafList;const{x:s,y:o}=this.point,a={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=e.length;s<o;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,a),this.findList.length))return this.findList.list[0]}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,s=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren);t--);return s}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let s,o,a;for(let t=0,e=n.length;t<e;t++){s=n[t],o=n[t+1];for(let t=0,e=s.length;t<e&&(a=s.list[t],!o||!o.has(a));t++)i.add(a)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||b(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)):n&&this.hitChild(i,s))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask&&!n.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:L,NoAndSkip:E,YesAndSkip:R}=t.Answer,S={},P={},k={};class T{constructor(e,i){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new B(e,this),e&&this.__listenEvents()}getBy(e,i,n,s){switch(typeof e){case"number":const o=this.getByInnerId(e,i);return n?o:o?[o]:[];case"string":switch(e[0]){case"#":S.id=e.substring(1),e=S;break;case".":P.className=e.substring(1),e=P;break;default:k.tag=e,e=k}case"object":if(void 0!==e.id){const t=this.getById(e.id,i);return n?t:t?[t]:[]}if(e.tag){const{tag:s}=e,o=s instanceof Array;return this.getByMethod(o?this.methods.tags:this.methods.tag,i,n,o?t.DataHelper.toMap(s):s)}return this.getByMethod(this.methods.className,i,n,e.className);case"function":return this.getByMethod(e,i,n,s)}}getByPoint(e,i,n){return"node"===t.Platform.name&&this.target&&this.target.emit(t.LayoutEvent.CHECK_UPDATE),this.picker.getByPoint(e,i,n)}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(e,i){const n=this.idMap[e];return n&&t.LeafHelper.hasParent(n,i||this.target)?n:(this.eachFind(this.toChildren(i),this.methods.id,null,e),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,n){const s=i?null:[];return this.eachFind(this.toChildren(e),t,s,n),s||this.findLeaf}eachFind(t,e,i,n){let s,o;for(let a=0,r=t.length;a<r;a++){if(s=t[a],o=e(s,n),o===L||o===R){if(!i)return void(this.findLeaf=s);i.push(s)}s.isBranch&&o<E&&this.eachFind(s.children,e,i,n)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(t.ChildEvent.REMOVE,this.__onRemoveChild,this),this.target.on_(t.PropertyEvent.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.picker.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(t.Creator,{watcher:(t,e)=>new r(t,e),layouter:(t,e)=>new v(t,e),renderer:(t,e,i)=>new x(t,e,i),selector:(t,e)=>new T(t,e)}),t.Platform.layout=v.fullLayout;const C={convertTouch(t,i){const n=C.getTouch(t),s=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},s),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class M extends e.InteractionBase{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=C.getTouch(t);this.pointerDown(C.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=C.getTouch(t);this.pointerMove(C.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=C.getTouch(t);this.pointerUp(C.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const i=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,i);n.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),n),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const n=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&n.push({from:this.getLocal(t),to:this.getLocal(i)})})),n}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function A(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),s&&e.fillRect(i.x,i.y+s,i.width,o)}function I(t,e,i){const{strokeAlign:n}=e.__,s="string"!=typeof t;switch(n){case"center":i.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?H(t,!0,e,i):O(e,i);break;case"inside":W("inside",t,s,e,i);break;case"outside":W("outside",t,s,e,i)}}function W(t,e,i,n,s){const{__strokeWidth:o,__font:a}=n.__,r=s.getSameCanvas(!0,!0);r.setStroke(i?void 0:e,2*o,n.__),r.font=a,i?H(e,!0,n,r):O(n,r),r.blendMode="outside"===t?"destination-out":"destination-in",A(n,r),r.blendMode="normal",n.__worldFlipped?s.copyWorldByReset(r,n.__nowWorld):s.copyWorldToInner(r,n.__nowWorld,n.__layout.renderBounds),r.recycle(n.__nowWorld)}function O(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),s&&e.strokeRect(i.x,i.y+s,i.width,o)}function H(t,e,n,s){let o;for(let a=0,r=t.length;a<r;a++)o=t[a],o.image&&i.PaintImage.checkImage(n,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?O(n,s):s.stroke(),s.restoreBlendMode()):e?O(n,s):s.stroke())}const{getSpread:D,getOuterOf:F,getByMove:z,getIntersectData:N}=t.BoundsHelper;let Y;function j(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=n.__layout;switch(e.type){case"solid":let{type:o,blendMode:a,color:r,opacity:h}=e;return{type:o,blendMode:a,style:i.ColorConvert.string(r,h)};case"image":return i.PaintImage.image(n,t,e,s,!Y||!Y[e.url]);case"linear":return i.PaintGradient.linearGradient(e,s);case"radial":return i.PaintGradient.radialGradient(e,s);case"angular":return i.PaintGradient.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:i.ColorConvert.string(e)}:void 0}}const G={compute:function(t,e){const n=e.__,s=[];let o,a=n.__input[t];a instanceof Array||(a=[a]),Y=i.PaintImage.recycleImage(t,n);for(let i,n=0,o=a.length;n<o;n++)i=j(t,a[n],e),i&&s.push(i);n["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(o=s[0].image.hasOpacityPixel),"fill"===t?n.__pixelFill=o:n.__pixelStroke=o},fill:function(t,e,i){i.fillStyle=t,e.__.__font?A(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,n){let s;const{windingRule:o,__font:a}=e.__;for(let r=0,h=t.length;r<h;r++)s=t[r],s.image&&i.PaintImage.checkImage(e,n,s,!a)||s.style&&(n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),a?A(e,n):o?n.fill(o):n.fill(),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),a?A(e,n):o?n.fill(o):n.fill(),n.restoreBlendMode()):a?A(e,n):o?n.fill(o):n.fill())},fillText:A,stroke:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)I(t,e,i);else switch(o){case"center":i.setStroke(t,s,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*s,n),e.__drawRenderPath(o),o.stroke(),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)I(t,e,i);else switch(o){case"center":i.setStroke(void 0,s,n),H(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),H(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),a.setStroke(void 0,2*s,n),H(t,!1,e,a),n.windingRule?a.clip(n.windingRule):a.clip(),a.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(a,e.__nowWorld):i.copyWorldToInner(a,e.__nowWorld,o),a.recycle(e.__nowWorld)}},strokeText:I,drawTextStroke:O,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let o,a,r,h,{scaleX:l,scaleY:d}=s;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(s))h=n,o=r=s;else{const{renderShapeSpread:n}=t.__layout,c=N(n?D(e.bounds,l===d?n*l:[n*d,n*l]):e.bounds,s);a=e.bounds.getFitMatrix(c);let{a:u,d:f}=a;if(a.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=f),r=F(s,a),o=z(r,-a.e,-a.f),i.matrix){const{matrix:t}=i;a.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:a.withScale(u,f)})}return t.__renderShape(n,i),{canvas:n,matrix:a,bounds:o,worldCanvas:h,shapeBounds:r,scaleX:l,scaleY:d}}};let U={};const{get:V,rotateOfOuter:X,translate:q,scaleOfOuter:Q,scale:K,rotate:J}=t.MatrixHelper;function Z(t,e,i,n,s,o,a){const r=V();q(r,e.x+i,e.y+n),K(r,s,o),a&&X(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function $(t,e,i,n,s,o,a){const r=V();q(r,e.x+i,e.y+n),s&&K(r,s,o),a&&J(r,a),t.transform=r}function tt(t,e,i,n,s,o,a,r,h,l){const d=V();if(h)if("center"===l)X(d,{x:i/2,y:n/2},h);else switch(J(d,h),h){case 90:q(d,n,0);break;case 180:q(d,i,n);break;case 270:q(d,0,i)}U.x=e.x+s,U.y=e.y+o,q(d,U.x,U.y),a&&Q(d,U,a,r),t.transform=d}const{get:et,translate:it}=t.MatrixHelper,nt=new t.Bounds,st={},ot={};function at(t,e,i,n){const{blendMode:s,sync:o}=i;s&&(t.blendMode=s),o&&(t.sync=o),t.data=rt(i,n,e)}function rt(e,i,n){let{width:s,height:o}=n;e.padding&&(i=nt.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:a,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,repeat:f}=e,g=i.width===s&&i.height===o,p={mode:r},_="center"!==h&&(u||0)%180==90,w=_?o:s,m=_?s:o;let v,y,x=0,b=0;if(r&&"cover"!==r&&"fit"!==r)(d||c)&&(t.MathHelper.getScaleData(d,c,n,ot),v=ot.scaleX,y=ot.scaleY);else if(!g||u){const t=i.width/w,e=i.height/m;v=y="fit"===r?Math.min(t,e):Math.max(t,e),x+=(i.width-s*v)/2,b+=(i.height-o*y)/2}if(h){const e={x:x,y:b,width:w,height:m};v&&(e.width*=v,e.height*=y),t.AlignHelper.toPoint(h,e,i,st,!0),x+=st.x,b+=st.y}switch(l&&(x+=l.x,b+=l.y),r){case"stretch":g||(s=i.width,o=i.height);break;case"normal":case"clip":(x||b||v||u)&&$(p,i,x,b,v,y,u);break;case"repeat":(!g||v||u)&&tt(p,i,s,o,x,b,v,y,u,h),f||(p.repeat="repeat");break;default:v&&Z(p,i,x,b,v,y,u)}return p.transform||(i.x||i.y)&&(p.transform=et(),it(p.transform,i.x,i.y)),v&&"stretch"!==r&&(p.scaleX=v,p.scaleY=y),p.width=s,p.height=o,a&&(p.opacity=a),f&&(p.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),p}let ht,lt=new t.Bounds;const{isSame:dt}=t.BoundsHelper;function ct(t,e,i,n,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||at(s,n,i,o),!0}function ut(e,i){pt(e,t.ImageEvent.LOAD,i)}function ft(e,i){pt(e,t.ImageEvent.LOADED,i)}function gt(e,i,n){i.error=n,e.forceUpdate("surface"),pt(e,t.ImageEvent.ERROR,i)}function pt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function _t(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:mt,copy:vt}=t.MatrixHelper,{ceil:yt,abs:xt}=Math;function bt(e,i,n){let{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const a=s+"-"+o+"-"+n;if(i.patternId===a||e.destroyed)return!1;{s=xt(s),o=xt(o);const{image:e,data:r}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:f,opacity:g,transform:p,repeat:_}=r;u&&(l=wt(),vt(l,p),mt(l,1/u,1/f),s*=u,o*=f),s*=n,o*=n,d*=s,c*=o;const w=d*c;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let m=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;m>t&&(m=t)}w>m&&(h=Math.sqrt(w/m)),h&&(s/=h,o/=h,d/=h,c/=h),u&&(s/=u,o/=f),(p||1!==s||1!==o)&&(l||(l=wt(),p&&vt(l,p)),mt(l,1/s,1/o));const v=e.getCanvas(yt(d)||1,yt(c)||1,g),y=e.getPattern(v,_||t.Platform.origin.noRepeat||"no-repeat",l,i);return i.style=y,i.patternId=a,!0}}function Bt(t,e,i,n){return new(i||(i=Promise))((function(s,o){function a(t){try{h(n.next(t))}catch(t){o(t)}}function r(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Lt}=Math;const Et={image:function(e,i,n,s,o){let a,r;const h=t.ImageManager.get(n);return ht&&n===ht.paint&&dt(s,ht.boxBounds)?a=ht.leafPaint:(a={type:n.type,image:h},ht=h.use>1?{leafPaint:a,paint:n,boxBounds:lt.set(s)}:null),(o||h.loading)&&(r={image:h,attrName:i,attrValue:n}),h.ready?(ct(e,i,n,h,a,s),o&&(ut(e,r),ft(e,r))):h.error?o&>(e,r,h.error):(o&&(_t(e,!0),ut(e,r)),a.loadId=h.load((()=>{_t(e,!1),e.destroyed||(ct(e,i,n,h,a,s)&&(h.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ft(e,r)),a.loadId=null}),(t=>{_t(e,!1),gt(e,r,t),a.loadId=null}))),a},checkImage:function(e,n,s,o){const{scaleX:a,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:h}=n;if(!s.data||s.patternId===a+"-"+r+"-"+h&&!i.Export.running)return!1;{const{data:l}=s;if(o)if(l.repeat)o=!1;else{let{width:e,height:n}=l;e*=Lt(a)*h,n*=Lt(r)*h,l.scaleX&&(e*=l.scaleX,n*=l.scaleY),o=e*n>t.Platform.image.maxCacheSize||i.Export.running}return o?(n.save(),e.windingRule?n.clip(e.windingRule):n.clip(),s.blendMode&&(n.blendMode=s.blendMode),l.opacity&&(n.opacity*=l.opacity),l.transform&&n.transform(l.transform),n.drawImage(s.image.view,0,0,l.width,l.height),n.restore(),!0):(!s.style||s.sync||i.Export.running?bt(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>Bt(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&bt(e,s,h),e.forceUpdate("surface")}))),300)),!1)}},createPattern:bt,recycleImage:function(e,i){const n=i["_"+e];if(n instanceof Array){let s,o,a,r;for(let h=0,l=n.length;h<l;h++)s=n[h].image,r=s&&s.url,r&&(o||(o={}),o[r]=!0,t.ImageManager.recycle(s),s.loading&&(a||(a=i.__input&&i.__input[e]||[],a instanceof Array||(a=[a])),s.unload(n[h].loadId,!a.some((t=>t.url===r)))));return o}return null},createData:at,getPatternData:rt,fillOrFitMode:Z,clipMode:$,repeatMode:tt},{toPoint:Rt}=t.AroundHelper,St={},Pt={};function kt(t,e,n){if(e){let s;for(let o=0,a=e.length;o<a;o++)s=e[o],"string"==typeof s?t.addColorStop(o/(a-1),i.ColorConvert.string(s,n)):t.addColorStop(s.offset,i.ColorConvert.string(s.color,n))}}const{getAngle:Tt,getDistance:Ct}=t.PointHelper,{get:Mt,rotateOfOuter:At,scaleOfOuter:It}=t.MatrixHelper,{toPoint:Wt}=t.AroundHelper,Ot={},Ht={};function Dt(t,e,i,n,s){let o;const{width:a,height:r}=t;if(a!==r||n){const t=Tt(e,i);o=Mt(),s?(It(o,e,a/r*(n||1),1),At(o,e,t+90)):(It(o,e,1,a/r*(n||1)),At(o,e,t))}return o}const{getDistance:Ft}=t.PointHelper,{toPoint:zt}=t.AroundHelper,Nt={},Yt={};const jt={linearGradient:function(e,i){let{from:n,to:s,type:o,blendMode:a,opacity:r}=e;Rt(n||"top",i,St),Rt(s||"bottom",i,Pt);const h=t.Platform.canvas.createLinearGradient(St.x,St.y,Pt.x,Pt.y);kt(h,e.stops,r);const l={type:o,style:h};return a&&(l.blendMode=a),l},radialGradient:function(e,i){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:h}=e;Wt(n||"center",i,Ot),Wt(s||"bottom",i,Ht);const l=t.Platform.canvas.createRadialGradient(Ot.x,Ot.y,0,Ot.x,Ot.y,Ct(Ot,Ht));kt(l,e.stops,a);const d={type:o,style:l},c=Dt(i,Ot,Ht,h,!0);return c&&(d.transform=c),r&&(d.blendMode=r),d},conicGradient:function(e,i){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:h}=e;zt(n||"center",i,Nt),zt(s||"bottom",i,Yt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Nt.x,Nt.y):t.Platform.canvas.createRadialGradient(Nt.x,Nt.y,0,Nt.x,Nt.y,Ft(Nt,Yt));kt(l,e.stops,a);const d={type:o,style:l},c=Dt(i,Nt,Yt,h||1,t.Platform.conicGradientRotate90);return c&&(d.transform=c),r&&(d.blendMode=r),d},getTransform:Dt},{copy:Gt,toOffsetOutBounds:Ut}=t.BoundsHelper,Vt={},Xt={};function qt(e,i,n,s){const{bounds:o,shapeBounds:a}=s;if(t.Platform.fullImageShadow){if(Gt(Vt,e.bounds),Vt.x+=i.x-a.x,Vt.y+=i.y-a.y,n){const{matrix:t}=s;Vt.x-=(o.x+(t?t.e:0)+o.width/2)*(n-1),Vt.y-=(o.y+(t?t.f:0)+o.height/2)*(n-1),Vt.width*=n,Vt.height*=n}e.copyWorld(s.canvas,e.bounds,Vt)}else n&&(Gt(Vt,i),Vt.x-=i.width/2*(n-1),Vt.y-=i.height/2*(n-1),Vt.width*=n,Vt.height*=n),e.copyWorld(s.canvas,a,n?Vt:i)}const{toOffsetOutBounds:Qt}=t.BoundsHelper,Kt={};const Jt={shadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Ut(l,Xt),r.forEach(((r,p)=>{f.setWorldShadow(Xt.offsetX+r.x*c,Xt.offsetY+r.y*u,r.blur*c,r.color),s=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,qt(f,Xt,s,i),n=l,r.box&&(f.restore(),f.save(),h&&(f.copyWorld(f,l,o,"copy"),n=o),h?f.copyWorld(h,o,o,"destination-out"):f.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(n,!0)})),f.recycle(n)},innerShadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Qt(l,Kt),r.forEach(((r,p)=>{f.save(),f.setWorldShadow(Kt.offsetX+r.x*c,Kt.offsetY+r.y*u,r.blur*c),s=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,qt(f,Kt,s,i),f.restore(),h?(f.copyWorld(f,l,o,"copy"),f.copyWorld(h,o,o,"source-out"),n=o):(f.copyWorld(i.canvas,d,l,"source-out"),n=l),f.fillWorld(n,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(n,!0)})),f.recycle(n)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Zt}=t.LeafBoundsHelper;function $t(t,e,i,n,s,o){switch(e){case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),ee(t,e,i,1)}(t,i,n,s);break;case"opacity-path":ee(t,i,n,o);break;case"path":i.restore()}}function te(t){return t.getSameCanvas(!1,!0)}function ee(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,o,a;const{children:r}=this;for(let h=0,l=r.length;h<l;h++)i=r[h],i.__.mask&&(a&&($t(this,a,t,s,n,o),n=s=null),"path"===i.__.mask?(i.opacity<1?(a="opacity-path",o=i.opacity,s||(s=te(t))):(a="path",t.save()),i.__clip(s||t,e)):(a="alpha",n||(n=te(t)),s||(s=te(t)),i.__render(n,e)),"clipping"!==i.__.mask)||Zt(i,e)||i.__render(s||t,e);$t(this,a,t,s,n,o)};const ie=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ne=ie+"_#~&*+\\=|≮≯≈≠=…",se=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function oe(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const ae=oe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),re=oe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),he=oe(ie),le=oe(ne),de=oe("- —/~|┆·");var ce;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ce||(ce={}));const{Letter:ue,Single:fe,Before:ge,After:pe,Symbol:_e,Break:we}=ce;function me(t){return ae[t]?ue:de[t]?we:re[t]?ge:he[t]?pe:le[t]?_e:se.test(t)?fe:ue}const ve={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function ye(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xe}=ve,{Letter:be,Single:Be,Before:Le,After:Ee,Symbol:Re,Break:Se}=ce;let Pe,ke,Te,Ce,Me,Ae,Ie,We,Oe,He,De,Fe,ze,Ne,Ye,je,Ge,Ue=[];function Ve(t,e){Oe&&!We&&(We=Oe),Pe.data.push({char:t,width:e}),Te+=e}function Xe(){Ce+=Te,Pe.width=Te,ke.words.push(Pe),Pe={data:[]},Te=0}function qe(){Ne&&(Ye.paraNumber++,ke.paraStart=!0,Ne=!1),Oe&&(ke.startCharSize=We,ke.endCharSize=Oe,We=0),ke.width=Ce,je.width?xe(ke):Ge&&Qe(),Ue.push(ke),ke={words:[]},Ce=0}function Qe(){Ce>(Ye.maxWidth||0)&&(Ye.maxWidth=Ce)}const Ke=0,Je=1,Ze=2;const{top:$e,right:ti,bottom:ei,left:ii}=t.Direction4;function ni(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const si={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let n=0,s=0,o=i.__getInput("width")||0,a=i.__getInput("height")||0;const{textDecoration:r,__font:h,__padding:l}=i;l&&(o?(n=l[ii],o-=l[ti]+l[ii]):i.autoSizeAlign||(n=l[ii]),a?(s=l[$e],a-=l[$e]+l[ei]):i.autoSizeAlign||(s=l[$e]));const d={bounds:{x:n,y:s,width:o,height:a},rows:[],paraNumber:0,font:t.Platform.canvas.font=h};return function(e,i,n){Ye=e,Ue=e.rows,je=e.bounds,Ge=!je.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:a}=n,{canvas:r}=t.Platform,{width:h,height:l}=je;if(h||l||s||"none"!==a){const t="none"!==n.textWrap,e="break"===n.textWrap;Ne=!0,De=null,We=Ie=Oe=Te=Ce=0,Pe={data:[]},ke={words:[]};for(let n=0,l=i.length;n<l;n++)Ae=i[n],"\n"===Ae?(Te&&Xe(),ke.paraEnd=!0,qe(),Ne=!0):(He=me(Ae),He===be&&"none"!==a&&(Ae=ye(Ae,a,!Te)),Ie=r.measureText(Ae).width,s&&(s<0&&(Oe=Ie),Ie+=s),Fe=He===Be&&(De===Be||De===be)||De===Be&&He!==Ee,ze=!(He!==Le&&He!==Be||De!==Re&&De!==Ee),Me=Ne&&o?h-o:h,t&&h&&Ce+Te+Ie>Me&&(e?(Te&&Xe(),Ce&&qe()):(ze||(ze=He===be&&De==Ee),Fe||ze||He===Se||He===Le||He===Be||Te+Ie>Me?(Te&&Xe(),Ce&&qe()):Ce&&qe()))," "===Ae&&!0!==Ne&&Ce+Te===0||(He===Se?(" "===Ae&&Te&&Xe(),Ve(Ae,Ie),Xe()):Fe||ze?(Te&&Xe(),Ve(Ae,Ie)):Ve(Ae,Ie)),De=He);Te&&Xe(),Ce&&qe(),Ue.length>0&&(Ue[Ue.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ye.paraNumber++,Ce=r.measureText(t).width,Ue.push({x:o||0,text:t,width:Ce,paraStart:!0}),Ge&&Qe()}))}(d,e,i),l&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ni(e,"x",t[ii]);break;case"right":ni(e,"x",-t[ti])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ni(e,"y",t[$e]);break;case"bottom":ni(e,"y",-t[ei])}}(l,d,i,o,a),function(t,e){const{rows:i,bounds:n}=t,{__lineHeight:s,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:h,verticalAlign:l,paraSpacing:d,autoSizeAlign:c}=e;let{x:u,y:f,width:g,height:p}=n,_=s*i.length+(d?d*(t.paraNumber-1):0),w=o;if(r&&_>p)_=Math.max(p,s),t.overflow=i.length;else if(p||c)switch(l){case"middle":f+=(p-_)/2;break;case"bottom":f+=p-_}w+=f;let m,v,y,x=g||c?g:t.maxWidth;for(let o=0,l=i.length;o<l;o++){if(m=i[o],m.x=u,m.width<g||m.width>g&&!r)switch(h){case"center":m.x+=(x-m.width)/2;break;case"right":m.x+=x-m.width}m.paraStart&&d&&o>0&&(w+=d),m.y=w,w+=s,t.overflow>o&&w>_&&(m.isOverflow=!0,t.overflow=o+1),v=m.x,y=m.width,a<0&&(m.width<0?(y=-m.width+e.fontSize+a,v-=y,y+=e.fontSize):y-=a),v<n.x&&(n.x=v),y>n.width&&(n.width=y),r&&g&&g<y&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=f,n.height=_}(d,i),function(t,e,i,n){const{rows:s}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let h,l,d,c,u;s.forEach((t=>{t.words&&(d=a&&t.paraStart?a:0,l=i&&"justify"===o&&t.words.length>1?(i-t.width-d)/(t.words.length-1):0,c=r||t.isOverflow?Ke:l>.01?Je:Ze,t.isOverflow&&!r&&(t.textMode=!0),c===Ze?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===Je?(u={char:"",x:h},h=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,h,u),(t.isOverflow||" "!==u.char)&&t.data.push(u)):h=function(t,e,i,n){return t.forEach((t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,h,t.data,t.isOverflow),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(d,i,o),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:o,overflow:a}=e;let{textOverflow:r}=i;if(o.splice(a),r&&"show"!==r){let e,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const l=r?t.Platform.canvas.measureText(r).width:0,d=n+s-l;("none"===i.textWrap?o:[o[a-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],h=e.x+e.width,!(n===i&&h<d));n--){if(h<d&&" "!==e.char){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:r,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(d,i,n,o),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(d,i),d}};const oi={string:function(t,e){const n="number"==typeof e&&1!==e;if("string"==typeof t){if(!n||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let s=void 0===t.a?1:t.a;n&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}},{setPoint:ai,addPoint:ri,toBounds:hi}=t.TwoPointBoundsHelper;const li={export(e,i,n){this.running=!0;const s=t.FileHelper.fileType(i),o=i.includes(".");return n=t.FileHelper.getExportOptions(n),function(e){di||(di=new t.TaskProcessor);return new Promise((t=>{di.add((()=>Bt(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((a=>new Promise((r=>{const h=t=>{a(t),r(),this.running=!1},{toURL:l}=t.Platform,{download:d}=t.Platform.origin;if("json"===s)return o&&d(l(JSON.stringify(e.toJSON(n.json)),"text"),i),h({data:!!o||e.toJSON(n.json)});if("svg"===s)return o&&d(l(e.toSVG(),"svg"),i),h({data:!!o||e.toSVG()});const{leafer:c}=e;c?(ci(e),c.waitViewCompleted((()=>Bt(this,void 0,void 0,(function*(){let s,o,a=1,r=1;const{worldTransform:l,isLeafer:d,isFrame:u}=e,{slice:f,trim:g,onCanvas:p}=n,_=void 0===n.smooth?c.config.smooth:n.smooth,w=n.contextSettings||c.config.contextSettings,m=n.screenshot||e.isApp,v=d&&m&&void 0===n.fill?e.fill:n.fill,y=t.FileHelper.isOpaqueImage(i)||v,x=new t.Matrix;if(m)s=!0===m?d?c.canvas.bounds:e.worldRenderBounds:m;else{let t=n.relative||(d?"inner":"local");switch(a=l.scaleX,r=l.scaleY,t){case"inner":x.set(l);break;case"local":x.set(l).divide(e.localTransform),a/=e.scaleX,r/=e.scaleY;break;case"world":a=1,r=1;break;case"page":t=e.leafer;default:x.set(l).divide(e.getTransform(t));const i=t.worldTransform;a/=a/i.scaleX,r/=r/i.scaleY}s=e.getBounds("render",t)}const b={scaleX:1,scaleY:1};t.MathHelper.getScaleData(n.scale,n.size,s,b);let B=n.pixelRatio||1;e.isApp&&(b.scaleX*=B,b.scaleY*=B,B=e.app.pixelRatio);const{x:L,y:E,width:R,height:S}=new t.Bounds(s).scale(b.scaleX,b.scaleY),P={matrix:x.scale(1/b.scaleX,1/b.scaleY).invert().translate(-L,-E).withScale(1/a*b.scaleX,1/r*b.scaleY)};let k,T=t.Creator.canvas({width:Math.round(R),height:Math.round(S),pixelRatio:B,smooth:_,contextSettings:w});if(f&&(k=e,k.__worldOpacity=0,e=c,P.bounds=T.bounds),T.save(),u&&void 0!==v){const t=e.get("fill");e.fill="",e.__render(T,P),e.fill=t}else e.__render(T,P);if(T.restore(),k&&k.__updateWorldOpacity(),g){o=function(e){const{width:i,height:n}=e.view,{data:s}=e.context.getImageData(0,0,i,n);let o,a,r,h=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=h%i,a=(h-o)/i,r?ri(r,o,a):ai(r={},o,a)),h++;const l=new t.Bounds;return hi(r,l),l.scale(1/e.pixelRatio).ceil()}(T);const e=T,{width:i,height:n}=o,s={x:0,y:0,width:i,height:n,pixelRatio:B};T=t.Creator.canvas(s),T.copyWorld(e,o,s)}y&&T.fillWorld(T.bounds,v||"#FFFFFF","destination-over"),p&&p(T);const C="canvas"===i?T:yield T.export(i,n);h({data:C,width:T.pixelWidth,height:T.pixelHeight,renderBounds:s,trimBounds:o})}))))):h({data:!1})}))))}};let di;function ci(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>ci(t)))}const ui=t.LeaferCanvasBase.prototype,fi=t.Debug.get("@leafer-ui/export");ui.export=function(e,i){const{quality:n,blob:s}=t.FileHelper.getExportOptions(i);return e.includes(".")?this.saveAs(e,n):s?this.toBlob(e,n):this.toDataURL(e,n)},ui.toBlob=function(e,i){return new Promise((n=>{t.Platform.origin.canvasToBolb(this.view,e,i).then((t=>{n(t)})).catch((t=>{fi.error(t),n(null)}))}))},ui.toDataURL=function(e,i){return t.Platform.origin.canvasToDataURL(this.view,e,i)},ui.saveAs=function(e,i){return new Promise((n=>{t.Platform.origin.canvasSaveAs(this.view,e,i).then((()=>{n(!0)})).catch((t=>{fi.error(t),n(!1)}))}))},Object.assign(i.TextConvert,si),Object.assign(i.ColorConvert,oi),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Et),Object.assign(i.PaintGradient,jt),Object.assign(i.Effect,Jt),Object.assign(i.Export,li),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new M(t,e,i,n),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),i.Leafer.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&a(0,wx)}catch(t){}"ios"===wx.getSystemInfoSync().platform&&(t.LeaferImage.prototype.getPattern=function(e,i,n,s){const o=t.Platform.canvas.createPattern(this.view,i),{width:a,height:r}=e;this.width===a&&this.height===r||(n||(n=t.MatrixHelper.get()),t.MatrixHelper.scale(n,a/this.width,r/this.height));try{n&&o.setTransform&&(o.setTransform(n),n=null)}catch(t){}return s&&(s.transform=n),o}),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=M,exports.Layouter=v,exports.LeaferCanvas=n,exports.Renderer=x,exports.Selector=T,exports.Watcher=r,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.Platform.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.Platform.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:n,pixelRatio:s}=this.config,o={width:i||e.width,height:n||e.height,pixelRatio:s};this.resize(o),this.context&&(this.viewSelect&&(t.Platform.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,s){this.context.roundRect(t,e,i,n,"number"==typeof s?[s]:s)}),t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.Platform.miniapp.getBounds(this.viewSelect).then((t=>{this.clientBounds=t,e&&e()}))}startAutoLayout(e,i){this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.Platform.miniapp.onWindowResize(this.checkSize))}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,n={width:t,height:e,pixelRatio:i};this.isSameSize(n)||this.emitResize(n)}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.Platform.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),void 0!==this.width&&this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:s,fileType:o}=t.FileHelper;function a(e,i){t.Platform.origin={createCanvas:(t,e,n)=>{const s={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(s):i.createOffScreenCanvas(s)},canvasToDataURL:(t,e,i)=>t.toDataURL(s(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,n)=>{let a=e.toDataURL(s(o(i)),n);return a=a.substring(a.indexOf("64,")+3),t.Platform.origin.download(a,i)},download:(e,n)=>new Promise(((s,o)=>{let a;n.includes("/")||(n=`${i.env.USER_DATA_PATH}/`+n,a=!0);const r=i.getFileSystemManager();r.writeFile({filePath:n,data:e,encoding:"base64",success(){a?t.Platform.miniapp.saveToAlbum(n).then((()=>{r.unlink({filePath:n}),s()})):s()},fail(t){o(t)}})})),loadImage:e=>new Promise(((i,n)=>{const s=t.Platform.canvas.view.createImage();s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=t.Platform.image.getRealURL(e)})),noRepeat:"repeat-x"},t.Platform.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((e=>{i.getSetting({success:n=>{n.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="miniapp",t.Platform.requestRender=function(e){const{view:i}=t.Platform.renderCanvas||t.Platform.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class r{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:h,updateBounds:l,updateAllWorldOpacity:d}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper,g={x:0,y:0,width:1e5,height:1e5};class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(g):this.afterBounds.setListWithFn(t,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:w}=t.LeafHelper,m=t.Debug.get("Layouter");class v{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:o,LAYOUT:a,AFTER:r}=t.LayoutEvent,f=this.getBlocks(s);f.forEach((t=>t.setBefore())),n.emitEvent(new t.LayoutEvent(o,f,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(h(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(s,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||l(n[t])}l(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&d(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(s),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),n.emitEvent(new t.LayoutEvent(a,f,this.times)),n.emitEvent(new t.LayoutEvent(r,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:o}=t.LayoutEvent,a=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,a,this.times)),v.fullLayout(i),a.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(s,a,this.times)),i.emitEvent(new t.LayoutEvent(o,a,this.times)),this.addBlocks(a),t.Run.end(e)}static fullLayout(e){_(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),w(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new p([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const y=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(i.innerName,"---\x3e");try{i.isApp||i.app.emit(t.RenderEvent.CHILD_START,i),this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,y.error(t)}y.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return y.warn("rendering");if(this.times>3)return y.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return y.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),o=e.includes(this.target.__world),a=new t.Bounds(s);n.save(),o&&!t.Debug.showRepaint?n.clear():(s.spread(10+1/this.canvas.pixelRatio).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0)),this.__render(s,o,a),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds,!0),i.restore(),t.Run.end(e)}__render(e,i,n){const s=e.includes(this.target.__world)?{includes:i}:{bounds:e,includes:i};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,s),this.renderBounds=n=n||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),t.Debug.showHitView&&this.renderHitView(s),t.Debug.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender(n)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.changed=!0}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||y.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}const{hitRadiusPoint:b}=t.BoundsHelper;class B{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const s=n.through||!1,o=n.ignoreHittable||!1,a=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(a);const{list:r}=this.findList,h=this.getBestMatchLeaf(r,n.bottomList,o),l=o?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:r.length?this.getThroughPath(r):l}:{path:l,target:h}}getBestMatchLeaf(e,i,n){if(e.length){let i;this.findList=new t.LeafList;const{x:s,y:o}=this.point,a={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=e.length;s<o;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,a),this.findList.length))return this.findList.list[0]}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,s=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren);t--);return s}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let s,o,a;for(let t=0,e=n.length;t<e;t++){s=n[t],o=n[t+1];for(let t=0,e=s.length;t<e&&(a=s.list[t],!o||!o.has(a));t++)i.add(a)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||b(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)):n&&this.hitChild(i,s))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask&&!n.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:L,NoAndSkip:E,YesAndSkip:R}=t.Answer,S={},P={},k={};class T{constructor(e,i){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new B(e,this),e&&this.__listenEvents()}getBy(e,i,n,s){switch(typeof e){case"number":const o=this.getByInnerId(e,i);return n?o:o?[o]:[];case"string":switch(e[0]){case"#":S.id=e.substring(1),e=S;break;case".":P.className=e.substring(1),e=P;break;default:k.tag=e,e=k}case"object":if(void 0!==e.id){const t=this.getById(e.id,i);return n?t:t?[t]:[]}if(e.tag){const{tag:s}=e,o=s instanceof Array;return this.getByMethod(o?this.methods.tags:this.methods.tag,i,n,o?t.DataHelper.toMap(s):s)}return this.getByMethod(this.methods.className,i,n,e.className);case"function":return this.getByMethod(e,i,n,s)}}getByPoint(e,i,n){return"node"===t.Platform.name&&this.target&&this.target.emit(t.LayoutEvent.CHECK_UPDATE),this.picker.getByPoint(e,i,n)}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(e,i){const n=this.idMap[e];return n&&t.LeafHelper.hasParent(n,i||this.target)?n:(this.eachFind(this.toChildren(i),this.methods.id,null,e),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,n){const s=i?null:[];return this.eachFind(this.toChildren(e),t,s,n),s||this.findLeaf}eachFind(t,e,i,n){let s,o;for(let a=0,r=t.length;a<r;a++){if(s=t[a],o=e(s,n),o===L||o===R){if(!i)return void(this.findLeaf=s);i.push(s)}s.isBranch&&o<E&&this.eachFind(s.children,e,i,n)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(t.ChildEvent.REMOVE,this.__onRemoveChild,this),this.target.on_(t.PropertyEvent.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.picker.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(t.Creator,{watcher:(t,e)=>new r(t,e),layouter:(t,e)=>new v(t,e),renderer:(t,e,i)=>new x(t,e,i),selector:(t,e)=>new T(t,e)}),t.Platform.layout=v.fullLayout;const C={convertTouch(t,i){const n=C.getTouch(t),s=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},s),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class M extends e.InteractionBase{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=C.getTouch(t);this.pointerDown(C.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=C.getTouch(t);this.pointerMove(C.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=C.getTouch(t);this.pointerUp(C.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const i=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,i);n.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),n),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const n=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&n.push({from:this.getLocal(t),to:this.getLocal(i)})})),n}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function A(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),s&&e.fillRect(i.x,i.y+s,i.width,o)}function I(t,e,i){const{strokeAlign:n}=e.__,s="string"!=typeof t;switch(n){case"center":i.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?H(t,!0,e,i):O(e,i);break;case"inside":W("inside",t,s,e,i);break;case"outside":W("outside",t,s,e,i)}}function W(t,e,i,n,s){const{__strokeWidth:o,__font:a}=n.__,r=s.getSameCanvas(!0,!0);r.setStroke(i?void 0:e,2*o,n.__),r.font=a,i?H(e,!0,n,r):O(n,r),r.blendMode="outside"===t?"destination-out":"destination-in",A(n,r),r.blendMode="normal",n.__worldFlipped?s.copyWorldByReset(r,n.__nowWorld):s.copyWorldToInner(r,n.__nowWorld,n.__layout.renderBounds),r.recycle(n.__nowWorld)}function O(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),s&&e.strokeRect(i.x,i.y+s,i.width,o)}function H(t,e,n,s){let o;for(let a=0,r=t.length;a<r;a++)o=t[a],o.image&&i.PaintImage.checkImage(n,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?O(n,s):s.stroke(),s.restoreBlendMode()):e?O(n,s):s.stroke())}const{getSpread:D,getOuterOf:F,getByMove:z,getIntersectData:N}=t.BoundsHelper;let Y;function j(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=n.__layout;switch(e.type){case"solid":let{type:o,blendMode:a,color:r,opacity:h}=e;return{type:o,blendMode:a,style:i.ColorConvert.string(r,h)};case"image":return i.PaintImage.image(n,t,e,s,!Y||!Y[e.url]);case"linear":return i.PaintGradient.linearGradient(e,s);case"radial":return i.PaintGradient.radialGradient(e,s);case"angular":return i.PaintGradient.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:i.ColorConvert.string(e)}:void 0}}const G={compute:function(t,e){const n=e.__,s=[];let o,a=n.__input[t];a instanceof Array||(a=[a]),Y=i.PaintImage.recycleImage(t,n);for(let i,n=0,o=a.length;n<o;n++)i=j(t,a[n],e),i&&s.push(i);n["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(o=s[0].image.hasOpacityPixel),"fill"===t?n.__pixelFill=o:n.__pixelStroke=o},fill:function(t,e,i){i.fillStyle=t,e.__.__font?A(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,n){let s;const{windingRule:o,__font:a}=e.__;for(let r=0,h=t.length;r<h;r++)s=t[r],s.image&&i.PaintImage.checkImage(e,n,s,!a)||s.style&&(n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),a?A(e,n):o?n.fill(o):n.fill(),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),a?A(e,n):o?n.fill(o):n.fill(),n.restoreBlendMode()):a?A(e,n):o?n.fill(o):n.fill())},fillText:A,stroke:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)I(t,e,i);else switch(o){case"center":i.setStroke(t,s,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*s,n),e.__drawRenderPath(o),o.stroke(),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)I(t,e,i);else switch(o){case"center":i.setStroke(void 0,s,n),H(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),H(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),a.setStroke(void 0,2*s,n),H(t,!1,e,a),n.windingRule?a.clip(n.windingRule):a.clip(),a.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(a,e.__nowWorld):i.copyWorldToInner(a,e.__nowWorld,o),a.recycle(e.__nowWorld)}},strokeText:I,drawTextStroke:O,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let o,a,r,h,{scaleX:l,scaleY:d}=s;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(s))h=n,o=r=s;else{const{renderShapeSpread:n}=t.__layout,c=N(n?D(e.bounds,l===d?n*l:[n*d,n*l]):e.bounds,s);a=e.bounds.getFitMatrix(c);let{a:u,d:f}=a;if(a.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=f),r=F(s,a),o=z(r,-a.e,-a.f),i.matrix){const{matrix:t}=i;a.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:a.withScale(u,f)})}return t.__renderShape(n,i),{canvas:n,matrix:a,bounds:o,worldCanvas:h,shapeBounds:r,scaleX:l,scaleY:d}}};let U={};const{get:V,rotateOfOuter:X,translate:q,scaleOfOuter:Q,scale:K,rotate:J}=t.MatrixHelper;function Z(t,e,i,n,s,o,a){const r=V();q(r,e.x+i,e.y+n),K(r,s,o),a&&X(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function $(t,e,i,n,s,o,a){const r=V();q(r,e.x+i,e.y+n),s&&K(r,s,o),a&&J(r,a),t.transform=r}function tt(t,e,i,n,s,o,a,r,h,l){const d=V();if(h)if("center"===l)X(d,{x:i/2,y:n/2},h);else switch(J(d,h),h){case 90:q(d,n,0);break;case 180:q(d,i,n);break;case 270:q(d,0,i)}U.x=e.x+s,U.y=e.y+o,q(d,U.x,U.y),a&&Q(d,U,a,r),t.transform=d}const{get:et,translate:it}=t.MatrixHelper,nt=new t.Bounds,st={},ot={};function at(t,e,i,n){const{blendMode:s,sync:o}=i;s&&(t.blendMode=s),o&&(t.sync=o),t.data=rt(i,n,e)}function rt(e,i,n){let{width:s,height:o}=n;e.padding&&(i=nt.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:a,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,repeat:f}=e,g=i.width===s&&i.height===o,p={mode:r},_="center"!==h&&(u||0)%180==90,w=_?o:s,m=_?s:o;let v,y,x=0,b=0;if(r&&"cover"!==r&&"fit"!==r)(d||c)&&(t.MathHelper.getScaleData(d,c,n,ot),v=ot.scaleX,y=ot.scaleY);else if(!g||u){const t=i.width/w,e=i.height/m;v=y="fit"===r?Math.min(t,e):Math.max(t,e),x+=(i.width-s*v)/2,b+=(i.height-o*y)/2}if(h){const e={x:x,y:b,width:w,height:m};v&&(e.width*=v,e.height*=y),t.AlignHelper.toPoint(h,e,i,st,!0),x+=st.x,b+=st.y}switch(l&&(x+=l.x,b+=l.y),r){case"stretch":g||(s=i.width,o=i.height);break;case"normal":case"clip":(x||b||v||u)&&$(p,i,x,b,v,y,u);break;case"repeat":(!g||v||u)&&tt(p,i,s,o,x,b,v,y,u,h),f||(p.repeat="repeat");break;default:v&&Z(p,i,x,b,v,y,u)}return p.transform||(i.x||i.y)&&(p.transform=et(),it(p.transform,i.x,i.y)),v&&"stretch"!==r&&(p.scaleX=v,p.scaleY=y),p.width=s,p.height=o,a&&(p.opacity=a),f&&(p.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),p}let ht,lt=new t.Bounds;const{isSame:dt}=t.BoundsHelper;function ct(t,e,i,n,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||at(s,n,i,o),!0}function ut(e,i){pt(e,t.ImageEvent.LOAD,i)}function ft(e,i){pt(e,t.ImageEvent.LOADED,i)}function gt(e,i,n){i.error=n,e.forceUpdate("surface"),pt(e,t.ImageEvent.ERROR,i)}function pt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function _t(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:mt,copy:vt}=t.MatrixHelper,{ceil:yt,abs:xt}=Math;function bt(e,i,n){let{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const a=s+"-"+o+"-"+n;if(i.patternId===a||e.destroyed)return!1;{s=xt(s),o=xt(o);const{image:e,data:r}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:f,opacity:g,transform:p,repeat:_}=r;u&&(l=wt(),vt(l,p),mt(l,1/u,1/f),s*=u,o*=f),s*=n,o*=n,d*=s,c*=o;const w=d*c;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let m=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;m>t&&(m=t)}w>m&&(h=Math.sqrt(w/m)),h&&(s/=h,o/=h,d/=h,c/=h),u&&(s/=u,o/=f),(p||1!==s||1!==o)&&(l||(l=wt(),p&&vt(l,p)),mt(l,1/s,1/o));const v=e.getCanvas(yt(d)||1,yt(c)||1,g),y=e.getPattern(v,_||t.Platform.origin.noRepeat||"no-repeat",l,i);return i.style=y,i.patternId=a,!0}}function Bt(t,e,i,n){return new(i||(i=Promise))((function(s,o){function a(t){try{h(n.next(t))}catch(t){o(t)}}function r(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Lt}=Math;const Et={image:function(e,i,n,s,o){let a,r;const h=t.ImageManager.get(n);return ht&&n===ht.paint&&dt(s,ht.boxBounds)?a=ht.leafPaint:(a={type:n.type,image:h},ht=h.use>1?{leafPaint:a,paint:n,boxBounds:lt.set(s)}:null),(o||h.loading)&&(r={image:h,attrName:i,attrValue:n}),h.ready?(ct(e,i,n,h,a,s),o&&(ut(e,r),ft(e,r))):h.error?o&>(e,r,h.error):(o&&(_t(e,!0),ut(e,r)),a.loadId=h.load((()=>{_t(e,!1),e.destroyed||(ct(e,i,n,h,a,s)&&(h.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ft(e,r)),a.loadId=null}),(t=>{_t(e,!1),gt(e,r,t),a.loadId=null}))),a},checkImage:function(e,n,s,o){const{scaleX:a,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:h}=n;if(!s.data||s.patternId===a+"-"+r+"-"+h&&!i.Export.running)return!1;{const{data:l}=s;if(o)if(l.repeat)o=!1;else{let{width:e,height:n}=l;e*=Lt(a)*h,n*=Lt(r)*h,l.scaleX&&(e*=l.scaleX,n*=l.scaleY),o=e*n>t.Platform.image.maxCacheSize||i.Export.running}return o?(n.save(),e.windingRule?n.clip(e.windingRule):n.clip(),s.blendMode&&(n.blendMode=s.blendMode),l.opacity&&(n.opacity*=l.opacity),l.transform&&n.transform(l.transform),n.drawImage(s.image.view,0,0,l.width,l.height),n.restore(),!0):(!s.style||s.sync||i.Export.running?bt(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>Bt(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&bt(e,s,h),e.forceUpdate("surface")}))),300)),!1)}},createPattern:bt,recycleImage:function(e,i){const n=i["_"+e];if(n instanceof Array){let s,o,a,r;for(let h=0,l=n.length;h<l;h++)s=n[h].image,r=s&&s.url,r&&(o||(o={}),o[r]=!0,t.ImageManager.recycle(s),s.loading&&(a||(a=i.__input&&i.__input[e]||[],a instanceof Array||(a=[a])),s.unload(n[h].loadId,!a.some((t=>t.url===r)))));return o}return null},createData:at,getPatternData:rt,fillOrFitMode:Z,clipMode:$,repeatMode:tt},{toPoint:Rt}=t.AroundHelper,St={},Pt={};function kt(t,e,n){if(e){let s;for(let o=0,a=e.length;o<a;o++)s=e[o],"string"==typeof s?t.addColorStop(o/(a-1),i.ColorConvert.string(s,n)):t.addColorStop(s.offset,i.ColorConvert.string(s.color,n))}}const{getAngle:Tt,getDistance:Ct}=t.PointHelper,{get:Mt,rotateOfOuter:At,scaleOfOuter:It}=t.MatrixHelper,{toPoint:Wt}=t.AroundHelper,Ot={},Ht={};function Dt(t,e,i,n,s){let o;const{width:a,height:r}=t;if(a!==r||n){const t=Tt(e,i);o=Mt(),s?(It(o,e,a/r*(n||1),1),At(o,e,t+90)):(It(o,e,1,a/r*(n||1)),At(o,e,t))}return o}const{getDistance:Ft}=t.PointHelper,{toPoint:zt}=t.AroundHelper,Nt={},Yt={};const jt={linearGradient:function(e,i){let{from:n,to:s,type:o,blendMode:a,opacity:r}=e;Rt(n||"top",i,St),Rt(s||"bottom",i,Pt);const h=t.Platform.canvas.createLinearGradient(St.x,St.y,Pt.x,Pt.y);kt(h,e.stops,r);const l={type:o,style:h};return a&&(l.blendMode=a),l},radialGradient:function(e,i){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:h}=e;Wt(n||"center",i,Ot),Wt(s||"bottom",i,Ht);const l=t.Platform.canvas.createRadialGradient(Ot.x,Ot.y,0,Ot.x,Ot.y,Ct(Ot,Ht));kt(l,e.stops,a);const d={type:o,style:l},c=Dt(i,Ot,Ht,h,!0);return c&&(d.transform=c),r&&(d.blendMode=r),d},conicGradient:function(e,i){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:h}=e;zt(n||"center",i,Nt),zt(s||"bottom",i,Yt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Nt.x,Nt.y):t.Platform.canvas.createRadialGradient(Nt.x,Nt.y,0,Nt.x,Nt.y,Ft(Nt,Yt));kt(l,e.stops,a);const d={type:o,style:l},c=Dt(i,Nt,Yt,h||1,t.Platform.conicGradientRotate90);return c&&(d.transform=c),r&&(d.blendMode=r),d},getTransform:Dt},{copy:Gt,toOffsetOutBounds:Ut}=t.BoundsHelper,Vt={},Xt={};function qt(e,i,n,s){const{bounds:o,shapeBounds:a}=s;if(t.Platform.fullImageShadow){if(Gt(Vt,e.bounds),Vt.x+=i.x-a.x,Vt.y+=i.y-a.y,n){const{matrix:t}=s;Vt.x-=(o.x+(t?t.e:0)+o.width/2)*(n-1),Vt.y-=(o.y+(t?t.f:0)+o.height/2)*(n-1),Vt.width*=n,Vt.height*=n}e.copyWorld(s.canvas,e.bounds,Vt)}else n&&(Gt(Vt,i),Vt.x-=i.width/2*(n-1),Vt.y-=i.height/2*(n-1),Vt.width*=n,Vt.height*=n),e.copyWorld(s.canvas,a,n?Vt:i)}const{toOffsetOutBounds:Qt}=t.BoundsHelper,Kt={};const Jt={shadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Ut(l,Xt),r.forEach(((r,p)=>{f.setWorldShadow(Xt.offsetX+r.x*c,Xt.offsetY+r.y*u,r.blur*c,r.color),s=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,qt(f,Xt,s,i),n=l,r.box&&(f.restore(),f.save(),h&&(f.copyWorld(f,l,o,"copy"),n=o),h?f.copyWorld(h,o,o,"destination-out"):f.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(n,!0)})),f.recycle(n)},innerShadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Qt(l,Kt),r.forEach(((r,p)=>{f.save(),f.setWorldShadow(Kt.offsetX+r.x*c,Kt.offsetY+r.y*u,r.blur*c),s=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,qt(f,Kt,s,i),f.restore(),h?(f.copyWorld(f,l,o,"copy"),f.copyWorld(h,o,o,"source-out"),n=o):(f.copyWorld(i.canvas,d,l,"source-out"),n=l),f.fillWorld(n,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(n,!0)})),f.recycle(n)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Zt}=t.LeafBoundsHelper;function $t(t,e,i,n,s,o){switch(e){case"grayscale":s.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),ee(t,e,i,1)}(t,i,n,s);break;case"opacity-path":ee(t,i,n,o);break;case"path":i.restore()}}function te(t){return t.getSameCanvas(!1,!0)}function ee(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,o,a,r;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],r=i.__.mask,r&&(a&&($t(this,a,t,s,n,o),n=s=null),"path"===r||"clipping-path"===r?(i.opacity<1?(a="opacity-path",o=i.opacity,s||(s=te(t))):(a="path",t.save()),i.__clip(s||t,e)):(a="grayscale"===r?"grayscale":"alpha",n||(n=te(t)),s||(s=te(t)),i.__render(n,e)),"clipping"!==r&&"clipping-path"!==r)||Zt(i,e)||i.__render(s||t,e);$t(this,a,t,s,n,o)};const ie=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ne=ie+"_#~&*+\\=|≮≯≈≠=…",se=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function oe(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const ae=oe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),re=oe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),he=oe(ie),le=oe(ne),de=oe("- —/~|┆·");var ce;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ce||(ce={}));const{Letter:ue,Single:fe,Before:ge,After:pe,Symbol:_e,Break:we}=ce;function me(t){return ae[t]?ue:de[t]?we:re[t]?ge:he[t]?pe:le[t]?_e:se.test(t)?fe:ue}const ve={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function ye(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xe}=ve,{Letter:be,Single:Be,Before:Le,After:Ee,Symbol:Re,Break:Se}=ce;let Pe,ke,Te,Ce,Me,Ae,Ie,We,Oe,He,De,Fe,ze,Ne,Ye,je,Ge,Ue=[];function Ve(t,e){Oe&&!We&&(We=Oe),Pe.data.push({char:t,width:e}),Te+=e}function Xe(){Ce+=Te,Pe.width=Te,ke.words.push(Pe),Pe={data:[]},Te=0}function qe(){Ne&&(Ye.paraNumber++,ke.paraStart=!0,Ne=!1),Oe&&(ke.startCharSize=We,ke.endCharSize=Oe,We=0),ke.width=Ce,je.width?xe(ke):Ge&&Qe(),Ue.push(ke),ke={words:[]},Ce=0}function Qe(){Ce>(Ye.maxWidth||0)&&(Ye.maxWidth=Ce)}const Ke=0,Je=1,Ze=2;const{top:$e,right:ti,bottom:ei,left:ii}=t.Direction4;function ni(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const si={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let n=0,s=0,o=i.__getInput("width")||0,a=i.__getInput("height")||0;const{textDecoration:r,__font:h,__padding:l}=i;l&&(o?(n=l[ii],o-=l[ti]+l[ii]):i.autoSizeAlign||(n=l[ii]),a?(s=l[$e],a-=l[$e]+l[ei]):i.autoSizeAlign||(s=l[$e]));const d={bounds:{x:n,y:s,width:o,height:a},rows:[],paraNumber:0,font:t.Platform.canvas.font=h};return function(e,i,n){Ye=e,Ue=e.rows,je=e.bounds,Ge=!je.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:a}=n,{canvas:r}=t.Platform,{width:h,height:l}=je;if(h||l||s||"none"!==a){const t="none"!==n.textWrap,e="break"===n.textWrap;Ne=!0,De=null,We=Ie=Oe=Te=Ce=0,Pe={data:[]},ke={words:[]};for(let n=0,l=i.length;n<l;n++)Ae=i[n],"\n"===Ae?(Te&&Xe(),ke.paraEnd=!0,qe(),Ne=!0):(He=me(Ae),He===be&&"none"!==a&&(Ae=ye(Ae,a,!Te)),Ie=r.measureText(Ae).width,s&&(s<0&&(Oe=Ie),Ie+=s),Fe=He===Be&&(De===Be||De===be)||De===Be&&He!==Ee,ze=!(He!==Le&&He!==Be||De!==Re&&De!==Ee),Me=Ne&&o?h-o:h,t&&h&&Ce+Te+Ie>Me&&(e?(Te&&Xe(),Ce&&qe()):(ze||(ze=He===be&&De==Ee),Fe||ze||He===Se||He===Le||He===Be||Te+Ie>Me?(Te&&Xe(),Ce&&qe()):Ce&&qe()))," "===Ae&&!0!==Ne&&Ce+Te===0||(He===Se?(" "===Ae&&Te&&Xe(),Ve(Ae,Ie),Xe()):Fe||ze?(Te&&Xe(),Ve(Ae,Ie)):Ve(Ae,Ie)),De=He);Te&&Xe(),Ce&&qe(),Ue.length>0&&(Ue[Ue.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ye.paraNumber++,Ce=r.measureText(t).width,Ue.push({x:o||0,text:t,width:Ce,paraStart:!0}),Ge&&Qe()}))}(d,e,i),l&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ni(e,"x",t[ii]);break;case"right":ni(e,"x",-t[ti])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ni(e,"y",t[$e]);break;case"bottom":ni(e,"y",-t[ei])}}(l,d,i,o,a),function(t,e){const{rows:i,bounds:n}=t,{__lineHeight:s,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:h,verticalAlign:l,paraSpacing:d,autoSizeAlign:c}=e;let{x:u,y:f,width:g,height:p}=n,_=s*i.length+(d?d*(t.paraNumber-1):0),w=o;if(r&&_>p)_=Math.max(p,s),t.overflow=i.length;else if(p||c)switch(l){case"middle":f+=(p-_)/2;break;case"bottom":f+=p-_}w+=f;let m,v,y,x=g||c?g:t.maxWidth;for(let o=0,l=i.length;o<l;o++){if(m=i[o],m.x=u,m.width<g||m.width>g&&!r)switch(h){case"center":m.x+=(x-m.width)/2;break;case"right":m.x+=x-m.width}m.paraStart&&d&&o>0&&(w+=d),m.y=w,w+=s,t.overflow>o&&w>_&&(m.isOverflow=!0,t.overflow=o+1),v=m.x,y=m.width,a<0&&(m.width<0?(y=-m.width+e.fontSize+a,v-=y,y+=e.fontSize):y-=a),v<n.x&&(n.x=v),y>n.width&&(n.width=y),r&&g&&g<y&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=f,n.height=_}(d,i),function(t,e,i,n){const{rows:s}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let h,l,d,c,u;s.forEach((t=>{t.words&&(d=a&&t.paraStart?a:0,l=i&&"justify"===o&&t.words.length>1?(i-t.width-d)/(t.words.length-1):0,c=r||t.isOverflow?Ke:l>.01?Je:Ze,t.isOverflow&&!r&&(t.textMode=!0),c===Ze?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===Je?(u={char:"",x:h},h=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,h,u),(t.isOverflow||" "!==u.char)&&t.data.push(u)):h=function(t,e,i,n){return t.forEach((t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,h,t.data,t.isOverflow),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(d,i,o),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:o,overflow:a}=e;let{textOverflow:r}=i;if(o.splice(a),r&&"show"!==r){let e,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const l=r?t.Platform.canvas.measureText(r).width:0,d=n+s-l;("none"===i.textWrap?o:[o[a-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],h=e.x+e.width,!(n===i&&h<d));n--){if(h<d&&" "!==e.char){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:r,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(d,i,n,o),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(d,i),d}};const oi={string:function(t,e){const n="number"==typeof e&&1!==e;if("string"==typeof t){if(!n||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let s=void 0===t.a?1:t.a;n&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}},{setPoint:ai,addPoint:ri,toBounds:hi}=t.TwoPointBoundsHelper;const li={export(e,i,n){this.running=!0;const s=t.FileHelper.fileType(i),o=i.includes(".");return n=t.FileHelper.getExportOptions(n),function(e){di||(di=new t.TaskProcessor);return new Promise((t=>{di.add((()=>Bt(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((a=>new Promise((r=>{const h=t=>{a(t),r(),this.running=!1},{toURL:l}=t.Platform,{download:d}=t.Platform.origin;if("json"===s)return o&&d(l(JSON.stringify(e.toJSON(n.json)),"text"),i),h({data:!!o||e.toJSON(n.json)});if("svg"===s)return o&&d(l(e.toSVG(),"svg"),i),h({data:!!o||e.toSVG()});const{leafer:c}=e;c?(ci(e),c.waitViewCompleted((()=>Bt(this,void 0,void 0,(function*(){let s,o,a=1,r=1;const{worldTransform:l,isLeafer:d,isFrame:u}=e,{slice:f,trim:g,onCanvas:p}=n,_=void 0===n.smooth?c.config.smooth:n.smooth,w=n.contextSettings||c.config.contextSettings,m=n.screenshot||e.isApp,v=d&&m&&void 0===n.fill?e.fill:n.fill,y=t.FileHelper.isOpaqueImage(i)||v,x=new t.Matrix;if(m)s=!0===m?d?c.canvas.bounds:e.worldRenderBounds:m;else{let t=n.relative||(d?"inner":"local");switch(a=l.scaleX,r=l.scaleY,t){case"inner":x.set(l);break;case"local":x.set(l).divide(e.localTransform),a/=e.scaleX,r/=e.scaleY;break;case"world":a=1,r=1;break;case"page":t=e.leafer;default:x.set(l).divide(e.getTransform(t));const i=t.worldTransform;a/=a/i.scaleX,r/=r/i.scaleY}s=e.getBounds("render",t)}const b={scaleX:1,scaleY:1};t.MathHelper.getScaleData(n.scale,n.size,s,b);let B=n.pixelRatio||1;e.isApp&&(b.scaleX*=B,b.scaleY*=B,B=e.app.pixelRatio);const{x:L,y:E,width:R,height:S}=new t.Bounds(s).scale(b.scaleX,b.scaleY),P={matrix:x.scale(1/b.scaleX,1/b.scaleY).invert().translate(-L,-E).withScale(1/a*b.scaleX,1/r*b.scaleY)};let k,T=t.Creator.canvas({width:Math.round(R),height:Math.round(S),pixelRatio:B,smooth:_,contextSettings:w});if(f&&(k=e,k.__worldOpacity=0,e=c,P.bounds=T.bounds),T.save(),u&&void 0!==v){const t=e.get("fill");e.fill="",e.__render(T,P),e.fill=t}else e.__render(T,P);if(T.restore(),k&&k.__updateWorldOpacity(),g){o=function(e){const{width:i,height:n}=e.view,{data:s}=e.context.getImageData(0,0,i,n);let o,a,r,h=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=h%i,a=(h-o)/i,r?ri(r,o,a):ai(r={},o,a)),h++;const l=new t.Bounds;return hi(r,l),l.scale(1/e.pixelRatio).ceil()}(T);const e=T,{width:i,height:n}=o,s={x:0,y:0,width:i,height:n,pixelRatio:B};T=t.Creator.canvas(s),T.copyWorld(e,o,s)}y&&T.fillWorld(T.bounds,v||"#FFFFFF","destination-over"),p&&p(T);const C="canvas"===i?T:yield T.export(i,n);h({data:C,width:T.pixelWidth,height:T.pixelHeight,renderBounds:s,trimBounds:o})}))))):h({data:!1})}))))}};let di;function ci(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>ci(t)))}const ui=t.LeaferCanvasBase.prototype,fi=t.Debug.get("@leafer-ui/export");ui.export=function(e,i){const{quality:n,blob:s}=t.FileHelper.getExportOptions(i);return e.includes(".")?this.saveAs(e,n):s?this.toBlob(e,n):this.toDataURL(e,n)},ui.toBlob=function(e,i){return new Promise((n=>{t.Platform.origin.canvasToBolb(this.view,e,i).then((t=>{n(t)})).catch((t=>{fi.error(t),n(null)}))}))},ui.toDataURL=function(e,i){return t.Platform.origin.canvasToDataURL(this.view,e,i)},ui.saveAs=function(e,i){return new Promise((n=>{t.Platform.origin.canvasSaveAs(this.view,e,i).then((()=>{n(!0)})).catch((t=>{fi.error(t),n(!1)}))}))},Object.assign(i.TextConvert,si),Object.assign(i.ColorConvert,oi),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Et),Object.assign(i.PaintGradient,jt),Object.assign(i.Effect,Jt),Object.assign(i.Export,li),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new M(t,e,i,n),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),i.Leafer.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&a(0,wx)}catch(t){}"ios"===wx.getSystemInfoSync().platform&&(t.LeaferImage.prototype.getPattern=function(e,i,n,s){const o=t.Platform.canvas.createPattern(this.view,i),{width:a,height:r}=e;this.width===a&&this.height===r||(n||(n=t.MatrixHelper.get()),t.MatrixHelper.scale(n,a/this.width,r/this.height));try{n&&o.setTransform&&(o.setTransform(n),n=null)}catch(t){}return s&&(s.transform=n),o}),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=M,exports.Layouter=v,exports.LeaferCanvas=n,exports.Renderer=x,exports.Selector=T,exports.Watcher=r,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
package/dist/miniapp.module.js
CHANGED
|
@@ -1411,14 +1411,13 @@ const UICreator = {
|
|
|
1411
1411
|
list: {},
|
|
1412
1412
|
register(UI) {
|
|
1413
1413
|
const { __tag: tag } = UI.prototype;
|
|
1414
|
-
if (list$2[tag])
|
|
1414
|
+
if (list$2[tag])
|
|
1415
1415
|
debug$e.repeat(tag);
|
|
1416
|
-
|
|
1417
|
-
else {
|
|
1418
|
-
list$2[tag] = UI;
|
|
1419
|
-
}
|
|
1416
|
+
list$2[tag] = UI;
|
|
1420
1417
|
},
|
|
1421
1418
|
get(tag, data, x, y, width, height) {
|
|
1419
|
+
if (!list$2[tag])
|
|
1420
|
+
debug$e.error('not register ' + tag);
|
|
1422
1421
|
const ui = new list$2[tag](data);
|
|
1423
1422
|
if (x !== undefined) {
|
|
1424
1423
|
ui.x = x;
|
|
@@ -1442,7 +1441,7 @@ const EventCreator = {
|
|
|
1442
1441
|
Object.keys(Event).forEach(key => {
|
|
1443
1442
|
name = Event[key];
|
|
1444
1443
|
if (typeof name === 'string')
|
|
1445
|
-
nameList[name]
|
|
1444
|
+
nameList[name] && debug$d.repeat(name), nameList[name] = Event;
|
|
1446
1445
|
});
|
|
1447
1446
|
},
|
|
1448
1447
|
changeName(oldName, newName) {
|
|
@@ -1644,7 +1643,7 @@ class LeafData {
|
|
|
1644
1643
|
const t = this;
|
|
1645
1644
|
if (t.blendMode === 'pass-through') {
|
|
1646
1645
|
const leaf = this.__leaf;
|
|
1647
|
-
if ((t.opacity < 1 && leaf.isBranch) || leaf.__hasEraser || t.eraser) {
|
|
1646
|
+
if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
|
|
1648
1647
|
t.__single = true;
|
|
1649
1648
|
}
|
|
1650
1649
|
else if (t.__single) {
|
|
@@ -2042,8 +2041,9 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2042
2041
|
takeCanvas = this.getSameCanvas();
|
|
2043
2042
|
takeCanvas.copyWorld(this);
|
|
2044
2043
|
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2044
|
+
const s = this.size;
|
|
2045
|
+
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2046
|
+
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2047
2047
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2048
2048
|
if (this.context && !this.unreal) {
|
|
2049
2049
|
this.updateViewSize();
|
|
@@ -2157,6 +2157,17 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2157
2157
|
if (!onlyResetTransform)
|
|
2158
2158
|
this.useWorldTransform();
|
|
2159
2159
|
}
|
|
2160
|
+
useGrayscaleAlpha(bounds) {
|
|
2161
|
+
this.setTempBounds(bounds, true, true);
|
|
2162
|
+
let alpha, pixel;
|
|
2163
|
+
const { context } = this, imageData = context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height), { data } = imageData;
|
|
2164
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
2165
|
+
pixel = data[i] * 0.299 + data[i + 1] * 0.587 + data[i + 2] * 0.114;
|
|
2166
|
+
if (alpha = data[i + 3])
|
|
2167
|
+
data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
|
|
2168
|
+
}
|
|
2169
|
+
context.putImageData(imageData, tempBounds$1.x, tempBounds$1.y);
|
|
2170
|
+
}
|
|
2160
2171
|
useMask(maskCanvas, fromBounds, toBounds) {
|
|
2161
2172
|
this.copyWorld(maskCanvas, fromBounds, toBounds, 'destination-in');
|
|
2162
2173
|
}
|
|
@@ -2167,7 +2178,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2167
2178
|
if (blendMode)
|
|
2168
2179
|
this.blendMode = blendMode;
|
|
2169
2180
|
this.fillStyle = color;
|
|
2170
|
-
|
|
2181
|
+
this.setTempBounds(bounds);
|
|
2171
2182
|
this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2172
2183
|
if (blendMode)
|
|
2173
2184
|
this.blendMode = 'source-over';
|
|
@@ -2176,22 +2187,18 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2176
2187
|
if (blendMode)
|
|
2177
2188
|
this.blendMode = blendMode;
|
|
2178
2189
|
this.strokeStyle = color;
|
|
2179
|
-
|
|
2190
|
+
this.setTempBounds(bounds);
|
|
2180
2191
|
this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2181
2192
|
if (blendMode)
|
|
2182
2193
|
this.blendMode = 'source-over';
|
|
2183
2194
|
}
|
|
2184
2195
|
clearWorld(bounds, ceilPixel) {
|
|
2185
|
-
|
|
2186
|
-
if (ceilPixel)
|
|
2187
|
-
tempBounds$1.ceil();
|
|
2196
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2188
2197
|
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2189
2198
|
}
|
|
2190
2199
|
clipWorld(bounds, ceilPixel) {
|
|
2191
2200
|
this.beginPath();
|
|
2192
|
-
|
|
2193
|
-
if (ceilPixel)
|
|
2194
|
-
tempBounds$1.ceil();
|
|
2201
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2195
2202
|
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2196
2203
|
this.clip();
|
|
2197
2204
|
}
|
|
@@ -2199,6 +2206,14 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2199
2206
|
const { pixelRatio } = this;
|
|
2200
2207
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2201
2208
|
}
|
|
2209
|
+
setTempBounds(bounds, ceil, intersect) {
|
|
2210
|
+
tempBounds$1.set(bounds);
|
|
2211
|
+
if (intersect)
|
|
2212
|
+
tempBounds$1.intersect(this.bounds);
|
|
2213
|
+
tempBounds$1.scale(this.pixelRatio);
|
|
2214
|
+
if (ceil)
|
|
2215
|
+
tempBounds$1.ceil();
|
|
2216
|
+
}
|
|
2202
2217
|
isSameSize(size) {
|
|
2203
2218
|
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
2204
2219
|
}
|
|
@@ -5212,13 +5227,14 @@ const BranchRender = {
|
|
|
5212
5227
|
this.__.__checkSingle();
|
|
5213
5228
|
},
|
|
5214
5229
|
__render(canvas, options) {
|
|
5230
|
+
this.__nowWorld = this.__getNowWorld(options);
|
|
5215
5231
|
if (this.__worldOpacity) {
|
|
5216
5232
|
if (this.__.__single) {
|
|
5217
5233
|
if (this.__.eraser === 'path')
|
|
5218
5234
|
return this.__renderEraser(canvas, options);
|
|
5219
5235
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5220
5236
|
this.__renderBranch(tempCanvas, options);
|
|
5221
|
-
const nowWorld = this.
|
|
5237
|
+
const nowWorld = this.__nowWorld;
|
|
5222
5238
|
canvas.opacity = this.__.opacity;
|
|
5223
5239
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, this.__.__blendMode, true);
|
|
5224
5240
|
tempCanvas.recycle(nowWorld);
|
|
@@ -5959,7 +5975,7 @@ class LeafLevelList {
|
|
|
5959
5975
|
}
|
|
5960
5976
|
}
|
|
5961
5977
|
|
|
5962
|
-
const version = "1.0.
|
|
5978
|
+
const version = "1.0.10";
|
|
5963
5979
|
|
|
5964
5980
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5965
5981
|
get allowBackgroundColor() { return false; }
|
|
@@ -6072,7 +6088,7 @@ function useCanvas(_canvasType, app) {
|
|
|
6072
6088
|
Platform.origin = {
|
|
6073
6089
|
createCanvas: (width, height, _format) => {
|
|
6074
6090
|
const data = { type: '2d', width, height };
|
|
6075
|
-
app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data);
|
|
6091
|
+
return app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data);
|
|
6076
6092
|
},
|
|
6077
6093
|
canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
|
|
6078
6094
|
canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, { quality }),
|
|
@@ -6183,7 +6199,7 @@ function useCanvas(_canvasType, app) {
|
|
|
6183
6199
|
}
|
|
6184
6200
|
Platform.name = 'miniapp';
|
|
6185
6201
|
Platform.requestRender = function (render) {
|
|
6186
|
-
const { view } =
|
|
6202
|
+
const { view } = Platform.renderCanvas || Platform.canvas;
|
|
6187
6203
|
view.requestAnimationFrame ? view.requestAnimationFrame(render) : setTimeout(render, 16);
|
|
6188
6204
|
};
|
|
6189
6205
|
defineKey(Platform, 'devicePixelRatio', { get() { return Math.max(1, wx.getSystemInfoSync().pixelRatio); } });
|
|
@@ -6568,7 +6584,8 @@ class Renderer {
|
|
|
6568
6584
|
this.totalBounds = new Bounds();
|
|
6569
6585
|
debug$5.log(target.innerName, '--->');
|
|
6570
6586
|
try {
|
|
6571
|
-
target.
|
|
6587
|
+
if (!target.isApp)
|
|
6588
|
+
target.app.emit(RenderEvent.CHILD_START, target);
|
|
6572
6589
|
this.emitRender(RenderEvent.START);
|
|
6573
6590
|
this.renderOnce(callback);
|
|
6574
6591
|
this.emitRender(RenderEvent.END, this.totalBounds);
|
|
@@ -7122,6 +7139,12 @@ class UIData extends LeafData {
|
|
|
7122
7139
|
return strokeWidth;
|
|
7123
7140
|
}
|
|
7124
7141
|
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7142
|
+
get __hasMultiPaint() {
|
|
7143
|
+
const t = this;
|
|
7144
|
+
if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
|
|
7145
|
+
return true;
|
|
7146
|
+
return t.fill && this.__hasStroke;
|
|
7147
|
+
}
|
|
7125
7148
|
get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
|
|
7126
7149
|
get __autoWidth() { return !this._width; }
|
|
7127
7150
|
get __autoHeight() { return !this._height; }
|
|
@@ -7491,9 +7514,8 @@ const RectRender = {
|
|
|
7491
7514
|
canvas.strokeRect(half, half, width, height);
|
|
7492
7515
|
canvas.restore();
|
|
7493
7516
|
}
|
|
7494
|
-
else
|
|
7517
|
+
else
|
|
7495
7518
|
canvas.strokeRect(half, half, width, height);
|
|
7496
|
-
}
|
|
7497
7519
|
break;
|
|
7498
7520
|
case 'outside':
|
|
7499
7521
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -7718,6 +7740,15 @@ __decorate([
|
|
|
7718
7740
|
__decorate([
|
|
7719
7741
|
boundsType(0)
|
|
7720
7742
|
], UI.prototype, "padding", void 0);
|
|
7743
|
+
__decorate([
|
|
7744
|
+
boundsType(false)
|
|
7745
|
+
], UI.prototype, "lockRatio", void 0);
|
|
7746
|
+
__decorate([
|
|
7747
|
+
boundsType()
|
|
7748
|
+
], UI.prototype, "widthRange", void 0);
|
|
7749
|
+
__decorate([
|
|
7750
|
+
boundsType()
|
|
7751
|
+
], UI.prototype, "heightRange", void 0);
|
|
7721
7752
|
__decorate([
|
|
7722
7753
|
dataType(false)
|
|
7723
7754
|
], UI.prototype, "draggable", void 0);
|
|
@@ -8009,8 +8040,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8009
8040
|
__onResize(event) {
|
|
8010
8041
|
this.emitEvent(event);
|
|
8011
8042
|
DataHelper.copyAttrs(this.__, event, canvasSizeAttrs);
|
|
8012
|
-
if (!event.width || !event.height)
|
|
8013
|
-
debug$3.warn('w = 0 or h = 0');
|
|
8014
8043
|
setTimeout(() => { if (this.canvasManager)
|
|
8015
8044
|
this.canvasManager.clearRecycled(); }, 0);
|
|
8016
8045
|
}
|
|
@@ -8335,9 +8364,6 @@ __decorate([
|
|
|
8335
8364
|
__decorate([
|
|
8336
8365
|
dataType(false)
|
|
8337
8366
|
], Box.prototype, "resizeChildren", void 0);
|
|
8338
|
-
__decorate([
|
|
8339
|
-
dataType(false)
|
|
8340
|
-
], Box.prototype, "textBox", void 0);
|
|
8341
8367
|
__decorate([
|
|
8342
8368
|
affectRenderBoundsType('show')
|
|
8343
8369
|
], Box.prototype, "overflow", void 0);
|
|
@@ -9092,19 +9118,13 @@ class UIEvent extends Event {
|
|
|
9092
9118
|
Object.assign(this, params);
|
|
9093
9119
|
}
|
|
9094
9120
|
getBoxPoint(relative) {
|
|
9095
|
-
|
|
9096
|
-
relative = this.current;
|
|
9097
|
-
return relative.getBoxPoint(this);
|
|
9121
|
+
return (relative || this.current).getBoxPoint(this);
|
|
9098
9122
|
}
|
|
9099
9123
|
getInnerPoint(relative) {
|
|
9100
|
-
|
|
9101
|
-
relative = this.current;
|
|
9102
|
-
return relative.getInnerPoint(this);
|
|
9124
|
+
return (relative || this.current).getInnerPoint(this);
|
|
9103
9125
|
}
|
|
9104
9126
|
getLocalPoint(relative) {
|
|
9105
|
-
|
|
9106
|
-
relative = this.current;
|
|
9107
|
-
return relative.getLocalPoint(this);
|
|
9127
|
+
return (relative || this.current).getLocalPoint(this);
|
|
9108
9128
|
}
|
|
9109
9129
|
getPagePoint() {
|
|
9110
9130
|
return this.current.getPagePoint(this);
|
|
@@ -9338,7 +9358,8 @@ const debug$2 = Debug.get('LeaferTypeCreator');
|
|
|
9338
9358
|
const LeaferTypeCreator = {
|
|
9339
9359
|
list: {},
|
|
9340
9360
|
register(name, fn) {
|
|
9341
|
-
list[name]
|
|
9361
|
+
list[name] && debug$2.repeat(name);
|
|
9362
|
+
list[name] = fn;
|
|
9342
9363
|
},
|
|
9343
9364
|
run(name, leafer) {
|
|
9344
9365
|
const fn = list[name];
|
|
@@ -11459,16 +11480,16 @@ const EffectModule = {
|
|
|
11459
11480
|
|
|
11460
11481
|
const { excludeRenderBounds } = LeafBoundsHelper;
|
|
11461
11482
|
Group.prototype.__renderMask = function (canvas, options) {
|
|
11462
|
-
let child, maskCanvas, contentCanvas, maskOpacity, currentMask;
|
|
11483
|
+
let child, maskCanvas, contentCanvas, maskOpacity, currentMask, mask;
|
|
11463
11484
|
const { children } = this;
|
|
11464
11485
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
11465
|
-
child = children[i];
|
|
11466
|
-
if (
|
|
11486
|
+
child = children[i], mask = child.__.mask;
|
|
11487
|
+
if (mask) {
|
|
11467
11488
|
if (currentMask) {
|
|
11468
11489
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11469
11490
|
maskCanvas = contentCanvas = null;
|
|
11470
11491
|
}
|
|
11471
|
-
if (
|
|
11492
|
+
if (mask === 'path' || mask === 'clipping-path') {
|
|
11472
11493
|
if (child.opacity < 1) {
|
|
11473
11494
|
currentMask = 'opacity-path';
|
|
11474
11495
|
maskOpacity = child.opacity;
|
|
@@ -11482,14 +11503,14 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
11482
11503
|
child.__clip(contentCanvas || canvas, options);
|
|
11483
11504
|
}
|
|
11484
11505
|
else {
|
|
11485
|
-
currentMask = 'alpha';
|
|
11506
|
+
currentMask = mask === 'grayscale' ? 'grayscale' : 'alpha';
|
|
11486
11507
|
if (!maskCanvas)
|
|
11487
11508
|
maskCanvas = getCanvas(canvas);
|
|
11488
11509
|
if (!contentCanvas)
|
|
11489
11510
|
contentCanvas = getCanvas(canvas);
|
|
11490
11511
|
child.__render(maskCanvas, options);
|
|
11491
11512
|
}
|
|
11492
|
-
if (
|
|
11513
|
+
if (!(mask === 'clipping' || mask === 'clipping-path'))
|
|
11493
11514
|
continue;
|
|
11494
11515
|
}
|
|
11495
11516
|
if (excludeRenderBounds(child, options))
|
|
@@ -11500,6 +11521,8 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
11500
11521
|
};
|
|
11501
11522
|
function maskEnd(leaf, maskMode, canvas, contentCanvas, maskCanvas, maskOpacity) {
|
|
11502
11523
|
switch (maskMode) {
|
|
11524
|
+
case 'grayscale':
|
|
11525
|
+
maskCanvas.useGrayscaleAlpha(leaf.__nowWorld);
|
|
11503
11526
|
case 'alpha':
|
|
11504
11527
|
usePixelMask(leaf, canvas, contentCanvas, maskCanvas);
|
|
11505
11528
|
break;
|
|
@@ -12204,15 +12227,12 @@ const canvas = LeaferCanvasBase.prototype;
|
|
|
12204
12227
|
const debug = Debug.get('@leafer-ui/export');
|
|
12205
12228
|
canvas.export = function (filename, options) {
|
|
12206
12229
|
const { quality, blob } = FileHelper.getExportOptions(options);
|
|
12207
|
-
if (filename.includes('.'))
|
|
12230
|
+
if (filename.includes('.'))
|
|
12208
12231
|
return this.saveAs(filename, quality);
|
|
12209
|
-
|
|
12210
|
-
else if (blob) {
|
|
12232
|
+
else if (blob)
|
|
12211
12233
|
return this.toBlob(filename, quality);
|
|
12212
|
-
|
|
12213
|
-
else {
|
|
12234
|
+
else
|
|
12214
12235
|
return this.toDataURL(filename, quality);
|
|
12215
|
-
}
|
|
12216
12236
|
};
|
|
12217
12237
|
canvas.toBlob = function (type, quality) {
|
|
12218
12238
|
return new Promise((resolve) => {
|