@leafer-ui/miniapp 1.9.4 → 1.9.6
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 +41 -20
- package/dist/miniapp.esm.js +42 -21
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +234 -226
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/miniapp.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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?(t.isString(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,a={width:i||e.width,height:n||e.height,pixelRatio:s};this.resize(a),this.context&&(this.viewSelect&&(t.Platform.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(e,i,n,s,a){this.context.roundRect(e,i,n,s,t.isNumber(a)?[a]:a)}),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),t.isUndefined(this.width)||this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:s,fileType:a}=t.FileHelper;function r(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 r=e.toDataURL(s(a(i)),n);return r=r.substring(r.indexOf("64,")+3),t.Platform.origin.download(r,i)},download:(e,n)=>new Promise((s,a)=>{let r;n.includes("/")||(n=`${i.env.USER_DATA_PATH}/`+n,r=!0);const o=i.getFileSystemManager();o.writeFile({filePath:n,data:e,encoding:"base64",success(){r?t.Platform.miniapp.saveToAlbum(n).then(()=>{o.unlink({filePath:n}),s()}):s()},fail(t){a(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.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class o{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=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:h,updateChange:c}=t.LeafHelper,{pushAllChildBranch:d,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,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:p,updateAllChange:_}=t.LeafHelper,m=t.Debug.get("Layouter");class y{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.layouting||!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:a,LAYOUT:r,AFTER:o}=t.LayoutEvent,f=this.getBlocks(s);f.forEach(t=>t.setBefore()),n.emitEvent(new t.LayoutEvent(a,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?(l(t,!0),e.add(t),t.isBranch&&d(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||h(n[t])}h(i)}})}(this.__levelList),function(t){t.list.forEach(c)}(s),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new t.LayoutEvent(r,f,this.times)),n.emitEvent(new t.LayoutEvent(o,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:a}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),y.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new t.LayoutEvent(s,r,this.times)),i.emitEvent(new t.LayoutEvent(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(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(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[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 w=t.Debug.get("Renderer");class v{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()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.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;e&&(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),a=new t.Bounds(s);n.save(),s.spread(v.clipSpread).ceil(),n.clearWorld(s),n.clipWorld(s),this.__render(s,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),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,s=e.includes(this.target.__world),a=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}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=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.Platform.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()})}__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.update()}}__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||w.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(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[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)}}v.clipSpread=10;const{hitRadiusPoint:x}=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,a=n.ignoreHittable||!1,r=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(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,a),h=a?this.getPath(l):this.getHitablePath(l);return this.clear(),s?{path:h,target:l,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(e,i,n){const s=this.findList=new t.LeafList;if(e.length){let i;const{x:a,y:r}=this.point,o={x:a,y:r,radiusX:0,radiusY:0};for(let a=0,r=e.length;a<r;a++)if(i=e[a],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),s.length)){if(i.isBranchLeaf&&e.some(e=>e!==i&&t.LeafHelper.hasParent(e,i))){s.reset();break}return s.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),s.length)return s.list[0];return n?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}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,a,r;for(let t=0,e=n.length;t<e;t++){s=n[t],a=n[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!a||!a.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||x(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),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){let i,s=[];const{children:a}=n;for(let n=0,r=a.length;n<r;n++)if(i=a[n],i.__.mask&&s.push(i),i===t){if(s&&!s.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class L{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:s,picker:a}=this;return t.Platform.backgrounder&&s&&s.updateLayout(),a.getByPoint(e,i,n)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(e,i,n,s){return this.finder?this.finder.getBy(e,i,n,s):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,i)=>new v(t,e,i),selector:(t,e)=>new L(t,e)}),t.Platform.layout=y.fullLayout;const E={convertTouch(t,i){const n=E.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 B 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,i){return e.isUndefined(t.x)?super.getLocal(t,i):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=E.getTouch(t);this.pointerDown(E.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=E.getTouch(t);this.pointerMove(E.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=E.getTouch(t);this.pointerUp(E.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 S(t,e){const i=t.__,{rows:n,decorationY:s}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)a=n[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(s){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>s.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function k(t,e){t.__.__font?S(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function R(t,e,i){switch(e.__.strokeAlign){case"center":P(t,1,e,i);break;case"inside":C(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?P(t,2,e,i):C(t,"outside",e,i)}}function P(e,i,n,s){const a=n.__;t.isObject(e)?A(e,i,!0,n,s):(s.setStroke(e,a.__strokeWidth*i,a),T(n,s))}function C(e,i,n,s){const a=s.getSameCanvas(!0,!0);a.font=n.__.__font,P(e,2,n,a),a.blendMode="outside"===i?"destination-out":"destination-in",S(n,a),a.blendMode="normal",t.LeafHelper.copyCanvasByWorld(n,s,a),a.recycle(n.__nowWorld)}function T(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:a}=n;for(let t=0,n=s.length;t<n;t++)i=s[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)});if(a){const{decorationHeight:t}=n;s.forEach(i=>a.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}}function A(t,e,n,s,a){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||a.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,c=t.length;h<c;h++)if(r=t[h],(!r.image||!i.PaintImage.checkImage(s,a,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?a.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):a.setStroke(r.style,o.__strokeWidth*e,o)}else a.strokeStyle=r.style;r.blendMode?(a.saveBlendMode(r.blendMode),n?T(s,a):a.stroke(),a.restoreBlendMode()):n?T(s,a):a.stroke()}}function M(e,i,n){const s=i.__;if(s.__strokeWidth)if(s.__font)R(e,i,n);else switch(s.strokeAlign){case"center":O(e,1,i,n);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),O(t,2,e,i),i.restore()}(e,i,n);break;case"outside":!function(e,i,n){const s=i.__;if(s.__fillAfterStroke)O(e,2,i,n);else{const{renderBounds:a}=i.__layout,r=n.getSameCanvas(!0,!0);i.__drawRenderPath(r),O(e,2,i,r),r.clipUI(s),r.clearWorld(a),t.LeafHelper.copyCanvasByWorld(i,n,r),r.recycle(i.__nowWorld)}}(e,i,n)}}function O(e,n,s,a){const r=s.__;t.isObject(e)?A(e,n,!1,s,a):(a.setStroke(e,r.__strokeWidth*n,r),a.stroke()),r.__useArrow&&i.Paint.strokeArrow(e,s,a)}const{getSpread:W,getOuterOf:I,getByMove:D,getIntersectData:H}=t.BoundsHelper;let z;const{stintSet:F}=t.DataHelper,{hasTransparent:j}=i.ColorConvert;function U(e,n,s){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let a;const{boxBounds:r}=s.__layout;switch(n.type){case"image":a=i.PaintImage.image(s,e,n,r,!z||!z[n.url]);break;case"linear":a=i.PaintGradient.linearGradient(n,r);break;case"radial":a=i.PaintGradient.radialGradient(n,r);break;case"angular":a=i.PaintGradient.conicGradient(n,r);break;case"solid":const{type:o,color:l,opacity:h}=n;a={type:o,style:i.ColorConvert.string(l,h)};break;default:t.isUndefined(n.r)||(a={type:"solid",style:i.ColorConvert.string(n)})}if(a){if(t.isString(a.style)&&j(a.style)&&(a.isTransparent=!0),n.style){if(0===n.style.strokeWidth)return;a.strokeStyle=n.style}n.editing&&(a.editing=n.editing),n.blendMode&&(a.blendMode=n.blendMode)}return a}const G={compute:function(e,n){const s=n.__,a=[];let r,o,l,h=s.__input[e];t.isArray(h)||(h=[h]),z=i.PaintImage.recycleImage(e,s);for(let t,i=0,s=h.length;i<s;i++)(t=U(e,h[i],n))&&(a.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));s["_"+e]=a.length?a:void 0,a.length&&a.every(t=>t.isTransparent)&&(a.some(t=>t.image)&&(r=!0),o=!0),"fill"===e?(F(s,"__isAlphaPixelFill",r),F(s,"__isTransparentFill",o)):(F(s,"__isAlphaPixelStroke",r),F(s,"__isTransparentStroke",o),F(s,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,k(e,i)},fills:function(t,e,n){let s;for(let a=0,r=t.length;a<r;a++){if(s=t[a],s.image){if(i.PaintImage.checkImage(e,n,s,!e.__.__font))continue;if(!s.style){!a&&s.image.isPlacehold&&e.drawImagePlaceholder(n,s.image);continue}}if(n.fillStyle=s.style,s.transform||s.scaleFixed){if(n.save(),s.transform&&n.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&i>1)&&n.scale(1/t,1/i)}s.blendMode&&(n.blendMode=s.blendMode),k(e,n),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),k(e,n),n.restoreBlendMode()):k(e,n)}},fillPathOrText:k,fillText:S,stroke:M,strokes:function(t,e,i){M(t,e,i)},strokeText:R,drawTextStroke:T,shape:function(e,i,n){const s=i.getSameCanvas(),a=e.__nowWorld,r=i.bounds;let o,l,h,c,d,{scaleX:u,scaleY:f}=e.getRenderScaleData(!0);if(r.includes(a))d=s,o=c=a;else{const{renderShapeSpread:s}=e.__layout;let g;if(t.Platform.fullImageShadow)g=a;else{const t=s?W(r,u===f?s*u:[s*f,s*u]):r;g=H(t,a)}h=r.getFitMatrix(g);let{a:p,d:_}=h;h.a<1&&(d=i.getSameCanvas(),e.__renderShape(d,n),u*=p,f*=_),c=I(a,h),o=D(c,-h.e,-h.f);const m=n.matrix;m?(l=new t.Matrix(h),l.multiply(m),p*=m.scaleX,_*=m.scaleY):l=h,l.withScale(p,_),n=Object.assign(Object.assign({},n),{matrix:l})}return e.__renderShape(s,n),{canvas:s,matrix:l,fitMatrix:h,bounds:o,worldCanvas:d,shapeBounds:c,scaleX:u,scaleY:f}}};let Y={},N=t.getMatrixData();const{get:X,rotateOfOuter:q,translate:V,scaleOfOuter:Q,multiplyParent:K,scale:Z,rotate:$,skew:J}=t.MatrixHelper;function tt(t,e,i,n,s,a,r){const o=X();V(o,e.x+i,e.y+n),Z(o,s,a),r&&q(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function et(t,e,i,n,s,a,r,o,l){const h=X();nt(h,e,i,n,s,a,r,o),l&&(N.a=e.width/l.width,N.d=e.height/l.height,K(h,N)),t.transform=h}function it(t,e,i,n,s,a,r,o,l,h,c,d){const u=X();if(d)nt(u,e,s,a,r,o,l,h);else{if(l)if("center"===c)q(u,{x:i/2,y:n/2},l);else switch($(u,l),l){case 90:V(u,n,0);break;case 180:V(u,i,n);break;case 270:V(u,0,i)}Y.x=e.x+s,Y.y=e.y+a,V(u,Y.x,Y.y),r&&Q(u,Y,r,o)}t.transform=u}function nt(t,e,i,n,s,a,r,o){r&&$(t,r),o&&J(t,o.x,o.y),s&&Z(t,s,a),V(t,e.x+i,e.y+n)}const{get:st,translate:at}=t.MatrixHelper,rt=new t.Bounds,ot={},lt={};function ht(t,e,i,n){const{changeful:s,sync:a,scaleFixed:r}=i;s&&(t.changeful=s),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=ct(i,n,e)}function ct(e,i,n){e.padding&&(i=rt.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:s,height:a}=n;const{opacity:r,mode:o,align:l,offset:h,scale:c,size:d,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:m}=e,y=i.width===s&&i.height===a,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(lt,0,0,v?a:s,v?s:a),o&&"cover"!==o&&"fit"!==o?((c||d)&&(t.MathHelper.getScaleData(c,d,n,ot),x=ot.scaleX,b=ot.scaleY),(l||_||p)&&(x&&t.BoundsHelper.scale(lt,x,b,!0),l&&t.AlignHelper.toPoint(l,lt,i,lt,!0,!0))):y&&!u||(x=b=t.BoundsHelper.getFitScale(i,lt,"fit"!==o),t.BoundsHelper.put(i,n,l,x,!1,lt),t.BoundsHelper.scale(lt,x,b,!0)),h&&t.PointHelper.move(lt,h),o){case"stretch":y||(s=i.width,a=i.height);break;case"normal":case"clip":(lt.x||lt.y||x||g||u||f)&&et(w,i,lt.x,lt.y,x,b,u,f,e.clipSize);break;case"repeat":(!y||x||u||f)&&it(w,i,s,a,lt.x,lt.y,x,b,u,f,l,e.freeTransform),p||(w.repeat="repeat");const n=t.isObject(p);(_||n)&&(w.gap=function(e,i,n,s,a){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:dt(r,n,a.width,i&&i.x),y:dt(o,s,a.height,i&&i.y)}}(_,n&&p,lt.width,lt.height,i));break;default:x&&tt(w,i,lt.x,lt.y,x,b,u)}return w.transform||(i.x||i.y)&&(w.transform=st(),at(w.transform,i.x,i.y)),x&&"stretch"!==o&&(w.scaleX=x,w.scaleY=b),w.width=s,w.height=a,r&&(w.opacity=r),m&&(w.filters=m),p&&(w.repeat=t.isString(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),w}function dt(e,i,n,s){const a=t.isString(e)||s?(s?n-s*i:n%i)/((s||Math.floor(n/i))-1):e;return"auto"===e&&a<0?0:a}let ut,ft=new t.Bounds;const{isSame:gt}=t.BoundsHelper;function pt(t,e,i,n,s,a){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||ht(s,n,i,a),!0}function _t(e,i){wt(e,t.ImageEvent.LOAD,i)}function mt(e,i){wt(e,t.ImageEvent.LOADED,i)}function yt(e,i,n){i.error=n,e.forceUpdate("surface"),wt(e,t.ImageEvent.ERROR,i)}function wt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function vt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:xt,scale:bt,copy:Lt}=t.MatrixHelper,{floor:Et,max:Bt,abs:St}=Math;function kt(e,i,n){let{scaleX:s,scaleY:a}=e.getRenderScaleData(!0,i.scaleFixed);const r=s+"-"+a+"-"+n;if(i.patternId===r||e.destroyed)return!1;{const{image:e,data:o}=i;let l,h,{width:c,height:d,scaleX:u,scaleY:f,transform:g,repeat:p,gap:_}=o;s*=n,a*=n;const m=_&&_.x*s,y=_&&_.y*a;u&&(u=St(u),f=St(f),h=xt(),Lt(h,g),bt(h,1/u,1/f),s*=u,a*=f),c*=s,d*=a;const w=c*d;if(!p&&w>t.Platform.image.maxCacheSize)return!1;let v=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;v>t&&(v=t)}if(w>v&&(l=Math.sqrt(w/v)),l&&(s/=l,a/=l,c/=l,d/=l),u&&(s/=u,a/=f),(g||1!==s||1!==a)&&(h||(h=xt(),g&&Lt(h,g)),bt(h,1/s,1/a)),h){const t=c+(m||0),e=d+(y||0);bt(h,t/Bt(Et(t),1),e/Bt(Et(e),1))}const x=e.getCanvas(c,d,o.opacity,o.filters,m,y),b=e.getPattern(x,p||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=b,i.patternId=r,!0}}function Rt(t,e,i,n){return new(i||(i=Promise))(function(s,a){function r(t){try{l(n.next(t))}catch(t){a(t)}}function o(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Pt={image:function(e,i,n,s,a){let r,o;const l=t.ImageManager.get(n);return ut&&n===ut.paint&>(s,ut.boxBounds)?r=ut.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),ut=l.use>1?{leafPaint:r,paint:n,boxBounds:ft.set(s)}:null),(a||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(pt(e,i,n,l,r,s),a&&(_t(e,o),mt(e,o))):l.error?a&&yt(e,o,l.error):(a&&(vt(e,!0),_t(e,o)),r.loadId=l.load(()=>{vt(e,!1),e.destroyed||(pt(e,i,n,l,r,s)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),mt(e,o)),r.loadId=void 0},t=>{vt(e,!1),yt(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,n,s,a){const{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:l}=n,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+l&&!i.Export.running)return!1;if(a)if(h.repeat)a=!1;else if(!(s.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=h;e*=r*l,i*=o*l,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(e.__.__isFastShadow&&(n.fillStyle=s.style||"#000",n.fill()),function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,s,h),!0):(!s.style||s.sync||i.Export.running?kt(e,s,l):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add(()=>Rt(this,void 0,void 0,function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&kt(e,s,l),e.forceUpdate("surface")}),300)),!1)},createPattern:kt,recycleImage:function(e,i){const n=i["_"+e];if(t.isArray(n)){let s,a,r,o,l;for(let h=0,c=n.length;h<c;h++)s=n[h],a=s.image,l=a&&a.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),a.unload(n[h].loadId,!o.some(t=>t.url===l))));return r}return null},createData:ht,getPatternData:ct,fillOrFitMode:tt,clipMode:et,repeatMode:it},{toPoint:Ct}=t.AroundHelper,{hasTransparent:Tt}=i.ColorConvert,At={},Mt={};function Ot(e,n,s,a){if(s){let r,o,l,h;for(let e=0,c=s.length;e<c;e++)r=s[e],t.isString(r)?(l=e/(c-1),o=i.ColorConvert.string(r,a)):(l=r.offset,o=i.ColorConvert.string(r.color,a)),n.addColorStop(l,o),!h&&Tt(o)&&(h=!0);h&&(e.isTransparent=!0)}}const{getAngle:Wt,getDistance:It}=t.PointHelper,{get:Dt,rotateOfOuter:Ht,scaleOfOuter:zt}=t.MatrixHelper,{toPoint:Ft}=t.AroundHelper,jt={},Ut={};function Gt(t,e,i,n,s){let a;const{width:r,height:o}=t;if(r!==o||n){const t=Wt(e,i);a=Dt(),s?(zt(a,e,r/o*(n||1),1),Ht(a,e,t+90)):(zt(a,e,1,r/o*(n||1)),Ht(a,e,t))}return a}const{getDistance:Yt}=t.PointHelper,{toPoint:Nt}=t.AroundHelper,Xt={},qt={};const Vt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:r}=e;Ct(n||"top",i,At),Ct(s||"bottom",i,Mt);const o=t.Platform.canvas.createLinearGradient(At.x,At.y,Mt.x,Mt.y),l={type:a,style:o};return Ot(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;Ft(n||"center",i,jt),Ft(s||"bottom",i,Ut);const l=t.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,It(jt,Ut)),h={type:a,style:l};Ot(h,l,e.stops,r);const c=Gt(i,jt,Ut,o,!0);return c&&(h.transform=c),h},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;Nt(n||"center",i,Xt),Nt(s||"bottom",i,qt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Xt.x,Xt.y):t.Platform.canvas.createRadialGradient(Xt.x,Xt.y,0,Xt.x,Xt.y,Yt(Xt,qt)),h={type:a,style:l};Ot(h,l,e.stops,r);const c=Gt(i,Xt,qt,o||1,t.Platform.conicGradientRotate90);return c&&(h.transform=c),h},getTransform:Gt},{copy:Qt,toOffsetOutBounds:Kt}=t.BoundsHelper,Zt={},$t={};function Jt(e,i,n,s){const{bounds:a,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Qt(Zt,e.bounds),Zt.x+=i.x-r.x,Zt.y+=i.y-r.y,n){const{fitMatrix:t}=s;Zt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Zt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Zt.width*=n,Zt.height*=n}e.copyWorld(s.canvas,e.bounds,Zt)}else n&&(Qt(Zt,i),Zt.x-=i.width/2*(n-1),Zt.y-=i.height/2*(n-1),Zt.width*=n,Zt.height*=n),e.copyWorld(s.canvas,r,n?Zt:i)}const{toOffsetOutBounds:te}=t.BoundsHelper,ee={};const ie={shadow:function(e,n,s){let a,r;const{__nowWorld:o,__layout:l}=e,{shadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:g}=s,p=n.getSameCanvas(),_=h.length-1;Kt(d,$t),h.forEach((h,m)=>{let y=1;if(h.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.setWorldShadow($t.offsetX+h.x*f*y,$t.offsetY+h.y*g*y,h.blur*f*y,i.ColorConvert.string(h.color)),r=h.spread?1+2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*y:0,Jt(p,$t,r,s),a=d,h.box&&(p.restore(),p.save(),c&&(p.copyWorld(p,d,o,"copy"),a=o),c?p.copyWorld(c,o,o,"destination-out"):p.copyWorld(s.canvas,u,d,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,p,a,h.blendMode),_&&m<_&&p.clearWorld(a)}),p.recycle(a)},innerShadow:function(e,n,s){let a,r;const{__nowWorld:o,__layout:l}=e,{innerShadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:g}=s,p=n.getSameCanvas(),_=h.length-1;te(d,ee),h.forEach((h,m)=>{let y=1;if(h.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.save(),p.setWorldShadow(ee.offsetX+h.x*f*y,ee.offsetY+h.y*g*y,h.blur*f*y),r=h.spread?1-2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*y:0,Jt(p,ee,r,s),p.restore(),c?(p.copyWorld(p,d,o,"copy"),p.copyWorld(c,o,o,"source-out"),a=o):(p.copyWorld(s.canvas,u,d,"source-out"),a=d),p.fillWorld(a,i.ColorConvert.string(h.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,p,a,h.blendMode),_&&m<_&&p.clearWorld(a)}),p.recycle(a)},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:ne}=t.LeafBoundsHelper;let se;function ae(t,e,i,n,s,a,r,o){switch(e){case"grayscale":se||(se=!0,s.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,s,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),a&&n.recycle(r);oe(t,e,i,1,s,a)}(t,i,n,s,r,o);break;case"opacity-path":oe(t,i,n,a,r,o);break;case"path":o&&i.restore()}}function re(t){return t.getSameCanvas(!1,!0)}function oe(t,e,i,n,s,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,s),a?i.recycle(r):i.clearWorld(r)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,a,r,o;const{children:l}=this;for(let h=0,c=l.length;h<c;h++){if(i=l[h],o=i.__.mask,o){r&&(ae(this,r,t,s,n,a,void 0,!0),n=s=null),a=i.__.opacity,se=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",s||(s=re(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===o?"grayscale":"alpha",n||(n=re(t)),s||(s=re(t)),i.__render(n,e)),"clipping"!==o&&"clipping-path"!==o||ne(i,e)||i.__render(t,e);continue}const c=1===a&&i.__.__blendMode;c&&ae(this,r,t,s,n,a,void 0,!1),ne(i,e)||i.__render(s||t,e),c&&ae(this,r,t,s,n,a,c,!1)}ae(this,r,t,s,n,a,void 0,!0)};const le=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",he=le+"_#~&*+\\=|≮≯≈≠=…",ce=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 de(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ue=de("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fe=de("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ge=de(le),pe=de(he),_e=de("- —/~|┆·");var me;!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"}(me||(me={}));const{Letter:ye,Single:we,Before:ve,After:xe,Symbol:be,Break:Le}=me;function Ee(t){return ue[t]?ye:_e[t]?Le:fe[t]?ve:ge[t]?xe:pe[t]?be:ce.test(t)?we:ye}const Be={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let a=s-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Se(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:ke}=Be,{Letter:Re,Single:Pe,Before:Ce,After:Te,Symbol:Ae,Break:Me}=me;let Oe,We,Ie,De,He,ze,Fe,je,Ue,Ge,Ye,Ne,Xe,qe,Ve,Qe,Ke,Ze=[];function $e(t,e){Ue&&!je&&(je=Ue),Oe.data.push({char:t,width:e}),Ie+=e}function Je(){De+=Ie,Oe.width=Ie,We.words.push(Oe),Oe={data:[]},Ie=0}function ti(){qe&&(Ve.paraNumber++,We.paraStart=!0,qe=!1),Ue&&(We.startCharSize=je,We.endCharSize=Ue,je=0),We.width=De,Qe.width?ke(We):Ke&&ei(),Ze.push(We),We={words:[]},De=0}function ei(){De>(Ve.maxWidth||0)&&(Ve.maxWidth=De)}const{top:ii,right:ni,bottom:si,left:ai}=t.Direction4;function ri(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 oi={getDrawData:function(e,n){t.isString(e)||(e=String(e));let s=0,a=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:l,__font:h,__padding:c}=n;c&&(r?(s=c[ai],r-=c[ni]+c[ai]):n.autoSizeAlign||(s=c[ai]),o?(a=c[ii],o-=c[ii]+c[si]):n.autoSizeAlign||(a=c[ii]));const d={bounds:{x:s,y:a,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=h};return function(e,i,n){Ve=e,Ze=e.rows,Qe=e.bounds,Ke=!Qe.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:r}=n,{canvas:o}=t.Platform,{width:l,height:h}=Qe;if(l||h||s||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;qe=!0,Ye=null,je=Fe=Ue=Ie=De=0,Oe={data:[]},We={words:[]},s&&(i=[...i]);for(let n=0,h=i.length;n<h;n++)ze=i[n],"\n"===ze?(Ie&&Je(),We.paraEnd=!0,ti(),qe=!0):(Ge=Ee(ze),Ge===Re&&"none"!==r&&(ze=Se(ze,r,!Ie)),Fe=o.measureText(ze).width,s&&(s<0&&(Ue=Fe),Fe+=s),Ne=Ge===Pe&&(Ye===Pe||Ye===Re)||Ye===Pe&&Ge!==Te,Xe=!(Ge!==Ce&&Ge!==Pe||Ye!==Ae&&Ye!==Te),He=qe&&a?l-a:l,t&&l&&De+Ie+Fe>He&&(e?(Ie&&Je(),De&&ti()):(Xe||(Xe=Ge===Re&&Ye==Te),Ne||Xe||Ge===Me||Ge===Ce||Ge===Pe||Ie+Fe>He?(Ie&&Je(),De&&ti()):De&&ti()))," "===ze&&!0!==qe&&De+Ie===0||(Ge===Me?(" "===ze&&Ie&&Je(),$e(ze,Fe),Je()):Ne||Xe?(Ie&&Je(),$e(ze,Fe)):$e(ze,Fe)),Ye=Ge);Ie&&Je(),De&&ti(),Ze.length>0&&(Ze[Ze.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ve.paraNumber++,De=o.measureText(t).width,Ze.push({x:a||0,text:t,width:De,paraStart:!0}),Ke&&ei()})}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ri(e,"x",t[ai]);break;case"right":ri(e,"x",-t[ni])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ri(e,"y",t[ii]);break;case"bottom":ri(e,"y",-t[si])}}(c,d,n,r,o),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:h,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,m=a*s+(d?d*(t.paraNumber-1):0),y=r;if(l&&m>_)m=Math.max(_,a),s>1&&(t.overflow=s);else if(_||u)switch(c){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}y+=g;let w,v,x,b=p||u?p:t.maxWidth;for(let r=0,c=s;r<c;r++){if(w=i[r],w.x=f,w.width<p||w.width>p&&!l)switch(h){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&d&&r>0&&(y+=d),w.y=y,y+=a,t.overflow>r&&y>m&&(w.isOverflow=!0,t.overflow=r+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&p&&p<x&&(w.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=g,n.height=m}(d,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:a,letterSpacing:r}=e;let o,l,h,c,d,u;n.forEach(t=>{t.words&&(h=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-h)/(u-1):0,c=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=h,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=h,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===c?(d={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):o=function(t,e,i,n){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==s||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(d,n,r),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:a,overflow:r}=e;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?t.Platform.canvas.measureText(o).width:0,c=n+s-h;("none"===i.textWrap?a:[a[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<c));n--){if(l<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=h,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(d,n,s,r),"none"!==l&&function(e,n){let s;const{fontSize:a,textDecoration:r}=n;switch(e.decorationHeight=a/11,t.isObject(r)?(s=r.type,r.color&&(e.decorationColor=i.ColorConvert.string(r.color))):s=r,s){case"under":e.decorationY=[.15*a];break;case"delete":e.decorationY=[.35*-a];break;case"under-delete":e.decorationY=[.15*a,.35*-a]}}(d,n),d}};const li={string:function(e,n){const s=t.isNumber(n)&&n<1;if(t.isString(e)){if(!s||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let a=t.isUndefined(e.a)?1:e.a;s&&(a*=n);const r=e.r+","+e.g+","+e.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(i.TextConvert,oi),Object.assign(i.ColorConvert,li),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Pt),Object.assign(i.PaintGradient,Vt),Object.assign(i.Effect,ie),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new B(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&&r(0,wx)}catch(t){}Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=B,exports.Layouter=y,exports.LeaferCanvas=n,exports.Picker=b,exports.Renderer=v,exports.Selector=L,exports.Watcher=o,exports.useCanvas=r,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 s extends t.LeaferCanvasBase{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?(t.isString(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:s,pixelRatio:n}=this.config,a={width:i||e.width,height:s||e.height,pixelRatio:n};this.resize(a),this.context&&(this.viewSelect&&(t.Platform.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(e,i,s,n,a){this.context.roundRect(e,i,s,n,t.isNumber(a)?[a]:a)}),t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;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||(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,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},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),t.isUndefined(this.width)||this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:n,fileType:a}=t.FileHelper;function r(e,i){t.Platform.origin={createCanvas:(t,e,s)=>{const n={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(n):i.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(n(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let r=e.toDataURL(n(a(i)),s);return r=r.substring(r.indexOf("64,")+3),t.Platform.origin.download(r,i)},download:(e,s)=>new Promise((n,a)=>{let r;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,r=!0);const o=i.getFileSystemManager();o.writeFile({filePath:s,data:e,encoding:"base64",success(){r?t.Platform.miniapp.saveToAlbum(s).then(()=>{o.unlink({filePath:s}),n()}):n()},fail(t){a(t)}})}),loadImage:e=>new Promise((i,s)=>{const n=t.Platform.canvas.view.createImage();n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.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:s=>{s.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 s(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.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class o{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=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:h,updateChange:c}=t.LeafHelper,{pushAllChildBranch:d,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,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:p,updateAllChange:_}=t.LeafHelper,m=t.Debug.get("Layouter");class w{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.layouting||!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:s,__updatedList:n}=this,{BEFORE:a,LAYOUT:r,AFTER:o}=t.LayoutEvent,f=this.getBlocks(n);f.forEach(t=>t.setBefore()),s.emitEvent(new t.LayoutEvent(a,f,this.times)),this.extraBlock=null,n.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&d(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(n,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||h(s[t])}h(i)}})}(this.__levelList),function(t){t.list.forEach(c)}(n),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),s.emitEvent(new t.LayoutEvent(r,f,this.times)),s.emitEvent(new t.LayoutEvent(o,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:s,LAYOUT:n,AFTER:a}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(s,r,this.times)),w.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new t.LayoutEvent(n,r,this.times)),i.emitEvent(new t.LayoutEvent(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(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(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[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 v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=e,this.canvas=i,s&&(this.config=t.DataHelper.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,y.log(i.innerName,"---\x3e");try{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;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:s}=this,n=e.getIntersect(s.bounds),a=new t.Bounds(n);s.save(),n.spread(v.clipSpread).ceil(),s.clearWorld(n),s.clipWorld(n),this.__render(n,a),s.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:s}=this,n=e.includes(this.target.__world),a=n?{includes:n}:{bounds:e,includes:n};this.needFill&&s.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(s,e),this.target.__render(s,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}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=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const e=1e3/(Date.now()-i),{maxFPS:n}=this.config;if(n&&e>n-.5)return t.Platform.requestRender(s);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.Platform.requestRender(s)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:s}=e.old;if(!new t.Bounds(0,0,i,s).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.update()}}__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,s){this.target.emitEvent(new t.RenderEvent(e,this.times,i,s))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,s){i||(i=0),s||(s={});const n=s.through||!1,a=s.ignoreHittable||!1,r=s.target||this.target;this.exclude=s.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(s.findList),s.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,s.bottomList,a),h=a?this.getPath(l):this.getHitablePath(l);return this.clear(),n?{path:h,target:l,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(e,i,s){const n=this.findList=new t.LeafList;if(e.length){let i;const{x:a,y:r}=this.point,o={x:a,y:r,radiusX:0,radiusY:0};for(let a=0,r=e.length;a<r;a++)if(i=e[a],(s||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),n.length)){if(i.isBranchLeaf&&e.some(e=>e!==i&&t.LeafHelper.hasParent(e,i))){n.reset();break}return n.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),n.length)return n.list[0];return s?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}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 s,n=new t.LeafList;for(let t=i.list.length-1;t>-1&&(s=i.list[t],s.__.hittable)&&(n.addAt(s,0),s.__.hitChildren&&(!s.isLeafer||"draw"!==s.mode));t--);return n}getThroughPath(e){const i=new t.LeafList,s=[];for(let t=e.length-1;t>-1;t--)s.push(this.getPath(e[t]));let n,a,r;for(let t=0,e=s.length;t<e;t++){n=s[t],a=s[t+1];for(let t=0,e=n.length;t<e&&(r=n.list[t],!a||!a.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||x(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,r=a.length;s<r;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class E{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,s){const{target:n,picker:a}=this;return t.Platform.backgrounder&&n&&n.updateLayout(),a.getByPoint(e,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(e,i,s,n){return this.finder?this.finder.getBy(e,i,s,n):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,i)=>new v(t,e,i),selector:(t,e)=>new E(t,e)}),t.Platform.layout=w.fullLayout;const L={convertTouch(t,i){const s=L.getTouch(t),n=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},n),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:s.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class B 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,i){return e.isUndefined(t.x)?super.getLocal(t,i):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=L.getTouch(t);this.pointerDown(L.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=L.getTouch(t);this.pointerMove(L.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=L.getTouch(t);this.pointerUp(L.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),s=this.getKeepTouchList(this.touches,i);s.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),s),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function S(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function k(t,e){t.__.__font?S(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function R(t,e,i){switch(e.__.strokeAlign){case"center":P(t,1,e,i);break;case"inside":C(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?P(t,2,e,i):C(t,"outside",e,i)}}function P(e,i,s,n){const a=s.__;t.isObject(e)?A(e,i,!0,s,n):(n.setStroke(e,a.__strokeWidth*i,a),T(s,n))}function C(e,i,s,n){const a=n.getSameCanvas(!0,!0);a.font=s.__.__font,P(e,2,s,a),a.blendMode="outside"===i?"destination-out":"destination-in",S(s,a),a.blendMode="normal",t.LeafHelper.copyCanvasByWorld(s,n,a),a.recycle(s.__nowWorld)}function T(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;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)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function A(t,e,s,n,a){let r;const o=n.__,{__hasMultiStrokeStyle:l}=o;l||a.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,c=t.length;h<c;h++)if(r=t[h],(!r.image||!i.PaintImage.checkImage(n,a,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?a.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):a.setStroke(r.style,o.__strokeWidth*e,o)}else a.strokeStyle=r.style;r.blendMode?(a.saveBlendMode(r.blendMode),s?T(n,a):a.stroke(),a.restoreBlendMode()):s?T(n,a):a.stroke()}}function M(e,i,s){const n=i.__;if(n.__strokeWidth)if(n.__font)R(e,i,s);else switch(n.strokeAlign){case"center":O(e,1,i,s);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),O(t,2,e,i),i.restore()}(e,i,s);break;case"outside":!function(e,i,s){const n=i.__;if(n.__fillAfterStroke)O(e,2,i,s);else{const{renderBounds:a}=i.__layout,r=s.getSameCanvas(!0,!0);i.__drawRenderPath(r),O(e,2,i,r),r.clipUI(n),r.clearWorld(a),t.LeafHelper.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}}(e,i,s)}}function O(e,s,n,a){const r=n.__;t.isObject(e)?A(e,s,!1,n,a):(a.setStroke(e,r.__strokeWidth*s,r),a.stroke()),r.__useArrow&&i.Paint.strokeArrow(e,n,a)}const{getSpread:W,getOuterOf:I,getByMove:D,getIntersectData:H}=t.BoundsHelper;let z;const{stintSet:F}=t.DataHelper,{hasTransparent:j}=i.ColorConvert;function U(e,s,n){if(!t.isObject(s)||!1===s.visible||0===s.opacity)return;let a;const{boxBounds:r}=n.__layout;switch(s.type){case"image":a=i.PaintImage.image(n,e,s,r,!z||!z[s.url]);break;case"linear":a=i.PaintGradient.linearGradient(s,r);break;case"radial":a=i.PaintGradient.radialGradient(s,r);break;case"angular":a=i.PaintGradient.conicGradient(s,r);break;case"solid":const{type:o,color:l,opacity:h}=s;a={type:o,style:i.ColorConvert.string(l,h)};break;default:t.isUndefined(s.r)||(a={type:"solid",style:i.ColorConvert.string(s)})}if(a){if(t.isString(a.style)&&j(a.style)&&(a.isTransparent=!0),s.style){if(0===s.style.strokeWidth)return;a.strokeStyle=s.style}s.editing&&(a.editing=s.editing),s.blendMode&&(a.blendMode=s.blendMode)}return a}const G={compute:function(e,s){const n=s.__,a=[];let r,o,l,h=n.__input[e];t.isArray(h)||(h=[h]),z=i.PaintImage.recycleImage(e,n);for(let t,i=0,n=h.length;i<n;i++)(t=U(e,h[i],s))&&(a.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));n["_"+e]=a.length?a:void 0,a.length&&a.every(t=>t.isTransparent)&&(a.some(t=>t.image)&&(r=!0),o=!0),"fill"===e?(F(n,"__isAlphaPixelFill",r),F(n,"__isTransparentFill",o)):(F(n,"__isAlphaPixelStroke",r),F(n,"__isTransparentStroke",o),F(n,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,k(e,i)},fills:function(t,e,s){let n;for(let a=0,r=t.length;a<r;a++){if(n=t[a],n.image){if(i.PaintImage.checkImage(e,s,n,!e.__.__font))continue;if(!n.style){!a&&n.image.isPlacehold&&e.drawImagePlaceholder(s,n.image);continue}}if(s.fillStyle=n.style,n.transform||n.scaleFixed){if(s.save(),n.transform&&s.transform(n.transform),n.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&i>1)&&s.scale(1/t,1/i)}n.blendMode&&(s.blendMode=n.blendMode),k(e,s),s.restore()}else n.blendMode?(s.saveBlendMode(n.blendMode),k(e,s),s.restoreBlendMode()):k(e,s)}},fillPathOrText:k,fillText:S,stroke:M,strokes:function(t,e,i){M(t,e,i)},strokeText:R,drawTextStroke:T,shape:function(e,i,s){const n=i.getSameCanvas(),a=e.__nowWorld,r=i.bounds;let o,l,h,c,d,{scaleX:u,scaleY:f}=e.getRenderScaleData(!0);if(r.includes(a))d=n,o=c=a;else{const{renderShapeSpread:n}=e.__layout;let g;if(t.Platform.fullImageShadow)g=a;else{const t=n?W(r,u===f?n*u:[n*f,n*u]):r;g=H(t,a)}h=r.getFitMatrix(g);let{a:p,d:_}=h;h.a<1&&(d=i.getSameCanvas(),e.__renderShape(d,s),u*=p,f*=_),c=I(a,h),o=D(c,-h.e,-h.f);const m=s.matrix;m?(l=new t.Matrix(h),l.multiply(m),p*=m.scaleX,_*=m.scaleY):l=h,l.withScale(p,_),s=Object.assign(Object.assign({},s),{matrix:l})}return e.__renderShape(n,s),{canvas:n,matrix:l,fitMatrix:h,bounds:o,worldCanvas:d,shapeBounds:c,scaleX:u,scaleY:f}}};let Y={},N=t.getMatrixData();const{get:q,rotateOfOuter:X,translate:V,scaleOfOuter:Q,multiplyParent:K,scale:Z,rotate:$,skew:J}=t.MatrixHelper;function tt(t,e,i,s,n,a,r){const o=q();V(o,e.x+i,e.y+s),Z(o,n,a),r&&X(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function et(t,e,i,s,n,a,r,o,l){const h=q();st(h,e,i,s,n,a,r,o),l&&(N.a=e.width/l.width,N.d=e.height/l.height,K(h,N)),t.transform=h}function it(t,e,i,s,n,a,r,o,l,h,c,d){const u=q();if(d)st(u,e,n,a,r,o,l,h);else{if(l)if("center"===c)X(u,{x:i/2,y:s/2},l);else switch($(u,l),l){case 90:V(u,s,0);break;case 180:V(u,i,s);break;case 270:V(u,0,i)}Y.x=e.x+n,Y.y=e.y+a,V(u,Y.x,Y.y),r&&Q(u,Y,r,o)}t.transform=u}function st(t,e,i,s,n,a,r,o){r&&$(t,r),o&&J(t,o.x,o.y),n&&Z(t,n,a),V(t,e.x+i,e.y+s)}const{get:nt,translate:at}=t.MatrixHelper,rt=new t.Bounds,ot={},lt={};function ht(t,e,i,s){const{changeful:n,sync:a,scaleFixed:r}=i;n&&(t.changeful=n),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=ct(i,s,e)}function ct(e,i,s){e.padding&&(i=rt.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:n,height:a}=s;const{opacity:r,mode:o,align:l,offset:h,scale:c,size:d,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:m}=e,w=i.width===n&&i.height===a,y={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(lt,0,0,v?a:n,v?n:a),o&&"cover"!==o&&"fit"!==o?((c||d)&&(t.MathHelper.getScaleData(c,d,s,ot),x=ot.scaleX,b=ot.scaleY),(l||_||p)&&(x&&t.BoundsHelper.scale(lt,x,b,!0),l&&t.AlignHelper.toPoint(l,lt,i,lt,!0,!0))):w&&!u||(x=b=t.BoundsHelper.getFitScale(i,lt,"fit"!==o),t.BoundsHelper.put(i,s,l,x,!1,lt),t.BoundsHelper.scale(lt,x,b,!0)),h&&t.PointHelper.move(lt,h),o){case"stretch":w||(n=i.width,a=i.height);break;case"normal":case"clip":(lt.x||lt.y||x||g||u||f)&&et(y,i,lt.x,lt.y,x,b,u,f,e.clipSize);break;case"repeat":(!w||x||u||f)&&it(y,i,n,a,lt.x,lt.y,x,b,u,f,l,e.freeTransform),p||(y.repeat="repeat");const s=t.isObject(p);(_||s)&&(y.gap=function(e,i,s,n,a){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:dt(r,s,a.width,i&&i.x),y:dt(o,n,a.height,i&&i.y)}}(_,s&&p,lt.width,lt.height,i));break;default:x&&tt(y,i,lt.x,lt.y,x,b,u)}return y.transform||(i.x||i.y)&&(y.transform=nt(),at(y.transform,i.x,i.y)),x&&"stretch"!==o&&(y.scaleX=x,y.scaleY=b),y.width=n,y.height=a,r&&(y.opacity=r),m&&(y.filters=m),p&&(y.repeat=t.isString(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),y}function dt(e,i,s,n){const a=t.isString(e)||n?(n?s-n*i:s%i)/((n||Math.floor(s/i))-1):e;return"auto"===e&&a<0?0:a}let ut,ft=new t.Bounds;const{isSame:gt}=t.BoundsHelper;function pt(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||ht(n,s,i,a),!0}function _t(e,i){yt(e,t.ImageEvent.LOAD,i)}function mt(e,i){yt(e,t.ImageEvent.LOADED,i)}function wt(e,i,s){i.error=s,e.forceUpdate("surface"),yt(e,t.ImageEvent.ERROR,i)}function yt(e,i,s){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,s))}function vt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:xt,scale:bt,copy:Et}=t.MatrixHelper,{floor:Lt,ceil:Bt,max:St,abs:kt}=Math;function Rt(e,i,s){let{scaleX:n,scaleY:a}=e.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+a+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:o,data:l}=i;let h,c,{width:d,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:m}=l;n*=s,a*=s,f&&(f=kt(f),g=kt(g),c=xt(),Et(c,p),bt(c,1/f,1/g),n*=f,a*=g),d*=n,u*=a;const w=d*u;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(o.isSVG){const t=d/o.width;t>1&&(h=t/Bt(t))}else{const t=o.width*o.height;y>t&&(y=t)}w>y&&(h=Math.sqrt(w/y)),h&&(n/=h,a/=h,d/=h,u/=h),f&&(n/=f,a/=g);const v=m&&m.x*n,x=m&&m.y*a;if(p||1!==n||1!==a){const t=d+(v||0),e=u+(x||0);n/=t/St(Lt(t),1),a/=e/St(Lt(e),1),c||(c=xt(),p&&Et(c,p)),bt(c,1/n,1/a)}const b=o.getCanvas(d,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),E=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",c,i);return i.style=E,i.patternId=r,!0}}function Pt(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Ct={image:function(e,i,s,n,a){let r,o;const l=t.ImageManager.get(s);return ut&&s===ut.paint&>(n,ut.boxBounds)?r=ut.leafPaint:(r={type:s.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),ut=l.use>1?{leafPaint:r,paint:s,boxBounds:ft.set(n)}:null),(a||l.loading)&&(o={image:l,attrName:i,attrValue:s}),l.ready?(pt(e,i,s,l,r,n),a&&(_t(e,o),mt(e,o))):l.error?a&&wt(e,o,l.error):(a&&(vt(e,!0),_t(e,o)),r.loadId=l.load(()=>{vt(e,!1),e.destroyed||(pt(e,i,s,l,r,n)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),mt(e,o)),r.loadId=void 0},t=>{vt(e,!1),wt(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,s,n,a){const{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,n.scaleFixed),{pixelRatio:l}=s,{data:h}=n;if(!h||n.patternId===r+"-"+o+"-"+l&&!i.Export.running)return!1;if(a)if(h.repeat)a=!1;else if(!(n.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=h;e*=r*l,i*=o*l,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(e.__.__isFastShadow&&(s.fillStyle=n.style||"#000",s.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,s,n,h),!0):(!n.style||n.sync||i.Export.running?Rt(e,n,l):n.patternTask||(n.patternTask=t.ImageManager.patternTasker.add(()=>Pt(this,void 0,void 0,function*(){n.patternTask=null,s.bounds.hit(e.__nowWorld)&&Rt(e,n,l),e.forceUpdate("surface")}),300)),!1)},createPattern:Rt,recycleImage:function(e,i){const s=i["_"+e];if(t.isArray(s)){let n,a,r,o,l;for(let h=0,c=s.length;h<c;h++)n=s[h],a=n.image,l=a&&a.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),a.unload(s[h].loadId,!o.some(t=>t.url===l))));return r}return null},createData:ht,getPatternData:ct,fillOrFitMode:tt,clipMode:et,repeatMode:it},{toPoint:Tt}=t.AroundHelper,{hasTransparent:At}=i.ColorConvert,Mt={},Ot={};function Wt(e,s,n,a){if(n){let r,o,l,h;for(let e=0,c=n.length;e<c;e++)r=n[e],t.isString(r)?(l=e/(c-1),o=i.ColorConvert.string(r,a)):(l=r.offset,o=i.ColorConvert.string(r.color,a)),s.addColorStop(l,o),!h&&At(o)&&(h=!0);h&&(e.isTransparent=!0)}}const{getAngle:It,getDistance:Dt}=t.PointHelper,{get:Ht,rotateOfOuter:zt,scaleOfOuter:Ft}=t.MatrixHelper,{toPoint:jt}=t.AroundHelper,Ut={},Gt={};function Yt(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=It(e,i);a=Ht(),n?(Ft(a,e,r/o*(s||1),1),zt(a,e,t+90)):(Ft(a,e,1,r/o*(s||1)),zt(a,e,t))}return a}const{getDistance:Nt}=t.PointHelper,{toPoint:qt}=t.AroundHelper,Xt={},Vt={};const Qt={linearGradient:function(e,i){let{from:s,to:n,type:a,opacity:r}=e;Tt(s||"top",i,Mt),Tt(n||"bottom",i,Ot);const o=t.Platform.canvas.createLinearGradient(Mt.x,Mt.y,Ot.x,Ot.y),l={type:a,style:o};return Wt(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=e;jt(s||"center",i,Ut),jt(n||"bottom",i,Gt);const l=t.Platform.canvas.createRadialGradient(Ut.x,Ut.y,0,Ut.x,Ut.y,Dt(Ut,Gt)),h={type:a,style:l};Wt(h,l,e.stops,r);const c=Yt(i,Ut,Gt,o,!0);return c&&(h.transform=c),h},conicGradient:function(e,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=e;qt(s||"center",i,Xt),qt(n||"bottom",i,Vt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Xt.x,Xt.y):t.Platform.canvas.createRadialGradient(Xt.x,Xt.y,0,Xt.x,Xt.y,Nt(Xt,Vt)),h={type:a,style:l};Wt(h,l,e.stops,r);const c=Yt(i,Xt,Vt,o||1,t.Platform.conicGradientRotate90);return c&&(h.transform=c),h},getTransform:Yt},{copy:Kt,toOffsetOutBounds:Zt}=t.BoundsHelper,$t={},Jt={};function te(e,i,s,n){const{bounds:a,shapeBounds:r}=n;if(t.Platform.fullImageShadow){if(Kt($t,e.bounds),$t.x+=i.x-r.x,$t.y+=i.y-r.y,s){const{fitMatrix:t}=n;$t.x-=(a.x+(t?t.e:0)+a.width/2)*(s-1),$t.y-=(a.y+(t?t.f:0)+a.height/2)*(s-1),$t.width*=s,$t.height*=s}e.copyWorld(n.canvas,e.bounds,$t)}else s&&(Kt($t,i),$t.x-=i.width/2*(s-1),$t.y-=i.height/2*(s-1),$t.width*=s,$t.height*=s),e.copyWorld(n.canvas,r,s?$t:i)}const{toOffsetOutBounds:ee}=t.BoundsHelper,ie={};const se={shadow:function(e,s,n){let a,r;const{__nowWorld:o,__layout:l}=e,{shadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:g}=n,p=s.getSameCanvas(),_=h.length-1;Zt(d,Jt),h.forEach((h,m)=>{let w=1;if(h.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}p.setWorldShadow(Jt.offsetX+h.x*f*w,Jt.offsetY+h.y*g*w,h.blur*f*w,i.ColorConvert.string(h.color)),r=h.spread?1+2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*w:0,te(p,Jt,r,n),a=d,h.box&&(p.restore(),p.save(),c&&(p.copyWorld(p,d,o,"copy"),a=o),c?p.copyWorld(c,o,o,"destination-out"):p.copyWorld(n.canvas,u,d,"destination-out")),i.Effect.isTransformShadow(h)?i.Effect.renderTransformShadow(e,s,p,a,h):t.LeafHelper.copyCanvasByWorld(e,s,p,a,h.blendMode),_&&m<_&&p.clearWorld(a)}),p.recycle(a)},innerShadow:function(e,s,n){let a,r;const{__nowWorld:o,__layout:l}=e,{innerShadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:g}=n,p=s.getSameCanvas(),_=h.length-1;ee(d,ie),h.forEach((h,m)=>{let w=1;if(h.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}p.save(),p.setWorldShadow(ie.offsetX+h.x*f*w,ie.offsetY+h.y*g*w,h.blur*f*w),r=h.spread?1-2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*w:0,te(p,ie,r,n),p.restore(),c?(p.copyWorld(p,d,o,"copy"),p.copyWorld(c,o,o,"source-out"),a=o):(p.copyWorld(n.canvas,u,d,"source-out"),a=d),p.fillWorld(a,i.ColorConvert.string(h.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,s,p,a,h.blendMode),_&&m<_&&p.clearWorld(a)}),p.recycle(a)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowSpread:function(t,e){let i=0;return e.forEach(t=>i=Math.max(i,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),i},isTransformShadow(t){}},{excludeRenderBounds:ne}=t.LeafBoundsHelper;let ae;function re(t,e,i,s,n,a,r,o){switch(e){case"grayscale":ae||(ae=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),a&&s.recycle(r);le(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":le(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function oe(t){return t.getSameCanvas(!1,!0)}function le(t,e,i,s,n,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),a?i.recycle(r):i.clearWorld(r)}i.Group.prototype.__renderMask=function(t,e){let i,s,n,a,r,o;const{children:l}=this;for(let h=0,c=l.length;h<c;h++){if(i=l[h],o=i.__.mask,o){r&&(re(this,r,t,n,s,a,void 0,!0),s=n=null),a=i.__.opacity,ae=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=oe(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=oe(t)),n||(n=oe(t)),i.__render(s,e)),"clipping"!==o&&"clipping-path"!==o||ne(i,e)||i.__render(t,e);continue}const c=1===a&&i.__.__blendMode;c&&re(this,r,t,n,s,a,void 0,!1),ne(i,e)||i.__render(n||t,e),c&&re(this,r,t,n,s,a,c,!1)}re(this,r,t,n,s,a,void 0,!0)};const he=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ce=he+"_#~&*+\\=|≮≯≈≠=…",de=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 ue(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const fe=ue("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ge=ue("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),pe=ue(he),_e=ue(ce),me=ue("- —/~|┆·");var we;!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"}(we||(we={}));const{Letter:ye,Single:ve,Before:xe,After:be,Symbol:Ee,Break:Le}=we;function Be(t){return fe[t]?ye:me[t]?Le:ge[t]?xe:pe[t]?be:_e[t]?Ee:de.test(t)?ve:ye}const Se={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function ke(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:Re}=Se,{Letter:Pe,Single:Ce,Before:Te,After:Ae,Symbol:Me,Break:Oe}=we;let We,Ie,De,He,ze,Fe,je,Ue,Ge,Ye,Ne,qe,Xe,Ve,Qe,Ke,Ze,$e=[];function Je(t,e){Ge&&!Ue&&(Ue=Ge),We.data.push({char:t,width:e}),De+=e}function ti(){He+=De,We.width=De,Ie.words.push(We),We={data:[]},De=0}function ei(){Ve&&(Qe.paraNumber++,Ie.paraStart=!0,Ve=!1),Ge&&(Ie.startCharSize=Ue,Ie.endCharSize=Ge,Ue=0),Ie.width=He,Ke.width?Re(Ie):Ze&&ii(),$e.push(Ie),Ie={words:[]},He=0}function ii(){He>(Qe.maxWidth||0)&&(Qe.maxWidth=He)}const{top:si,right:ni,bottom:ai,left:ri}=t.Direction4;function oi(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const li={getDrawData:function(e,s){t.isString(e)||(e=String(e));let n=0,a=0,r=s.__getInput("width")||0,o=s.__getInput("height")||0;const{textDecoration:l,__font:h,__padding:c}=s;c&&(r?(n=c[ri],r-=c[ni]+c[ri]):s.autoSizeAlign||(n=c[ri]),o?(a=c[si],o-=c[si]+c[ai]):s.autoSizeAlign||(a=c[si]));const d={bounds:{x:n,y:a,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=h};return function(e,i,s){Qe=e,$e=e.rows,Ke=e.bounds,Ze=!Ke.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=t.Platform,{width:l,height:h}=Ke;if(l||h||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Ve=!0,Ne=null,Ue=je=Ge=De=He=0,We={data:[]},Ie={words:[]},n&&(i=[...i]);for(let s=0,h=i.length;s<h;s++)Fe=i[s],"\n"===Fe?(De&&ti(),Ie.paraEnd=!0,ei(),Ve=!0):(Ye=Be(Fe),Ye===Pe&&"none"!==r&&(Fe=ke(Fe,r,!De)),je=o.measureText(Fe).width,n&&(n<0&&(Ge=je),je+=n),qe=Ye===Ce&&(Ne===Ce||Ne===Pe)||Ne===Ce&&Ye!==Ae,Xe=!(Ye!==Te&&Ye!==Ce||Ne!==Me&&Ne!==Ae),ze=Ve&&a?l-a:l,t&&l&&He+De+je>ze&&(e?(De&&ti(),He&&ei()):(Xe||(Xe=Ye===Pe&&Ne==Ae),qe||Xe||Ye===Oe||Ye===Te||Ye===Ce||De+je>ze?(De&&ti(),He&&ei()):He&&ei()))," "===Fe&&!0!==Ve&&He+De===0||(Ye===Oe?(" "===Fe&&De&&ti(),Je(Fe,je),ti()):qe||Xe?(De&&ti(),Je(Fe,je)):Je(Fe,je)),Ne=Ye);De&&ti(),He&&ei(),$e.length>0&&($e[$e.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Qe.paraNumber++,He=o.measureText(t).width,$e.push({x:a||0,text:t,width:He,paraStart:!0}),Ze&&ii()})}(d,e,s),c&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":oi(e,"x",t[ri]);break;case"right":oi(e,"x",-t[ni])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":oi(e,"y",t[si]);break;case"bottom":oi(e,"y",-t[ai])}}(c,d,s,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:h,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,m=a*n+(d?d*(t.paraNumber-1):0),w=r;if(l&&m>_)m=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(c){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}w+=g;let y,v,x,b=p||u?p:t.maxWidth;for(let r=0,c=n;r<c;r++){if(y=i[r],y.x=f,y.width<p||y.width>p&&!l)switch(h){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&d&&r>0&&(w+=d),y.y=w,w+=a,t.overflow>r&&w>m&&(y.isOverflow=!0,t.overflow=r+1),v=y.x,x=y.width,o<0&&(y.width<0?(x=-y.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<s.x&&(s.x=v),x>s.width&&(s.width=x),l&&p&&p<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(d,s),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:r}=e;let o,l,h,c,d,u;s.forEach(t=>{t.words&&(h=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-h)/(u-1):0,c=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=h,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=h,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===c?(d={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):o=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==n||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(d,s,r),d.overflow&&function(e,i,s,n){if(!n)return;const{rows:a,overflow:r}=e;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?t.Platform.canvas.measureText(o).width:0,c=s+n-h;("none"===i.textWrap?a:[a[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],l=e.x+e.width,!(s===i&&l<c));s--){if(l<c&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=h,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(d,s,n,r),"none"!==l&&function(e,s){let n,a=0;const{fontSize:r,textDecoration:o}=s;switch(e.decorationHeight=r/11,t.isObject(o)?(n=o.type,o.color&&(e.decorationColor=i.ColorConvert.string(o.color)),o.offset&&(a=Math.min(.3*r,Math.max(o.offset,.15*-r)))):n=o,n){case"under":e.decorationY=[.15*r+a];break;case"delete":e.decorationY=[.35*-r];break;case"under-delete":e.decorationY=[.15*r+a,.35*-r]}}(d,s),d}};const hi={string:function(e,s){const n=t.isNumber(s)&&s<1;if(t.isString(e)){if(!n||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let a=t.isUndefined(e.a)?1:e.a;n&&(a*=s);const r=e.r+","+e.g+","+e.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(i.TextConvert,li),Object.assign(i.ColorConvert,hi),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Ct),Object.assign(i.PaintGradient,Qt),Object.assign(i.Effect,se),Object.assign(t.Creator,{interaction:(t,e,i,s)=>new B(t,e,i,s),hitCanvas:(t,e)=>new s(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),i.Leafer.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&r(0,wx)}catch(t){}Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=B,exports.Layouter=w,exports.LeaferCanvas=s,exports.Picker=b,exports.Renderer=v,exports.Selector=E,exports.Watcher=o,exports.useCanvas=r,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]}})});
|
|
2
2
|
//# sourceMappingURL=miniapp.min.cjs.map
|