@leafer-ui/miniapp 1.7.0 → 1.8.0
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 +77 -47
- package/dist/miniapp.esm.js +78 -48
- 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 +240 -144
- 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?("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,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(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:a}=t.FileHelper;function o(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 o=e.toDataURL(s(a(i)),n);return o=o.substring(o.indexOf("64,")+3),t.Platform.origin.download(o,i)},download:(e,n)=>new Promise(((s,a)=>{let o;n.includes("/")||(n=`${i.env.USER_DATA_PATH}/`+n,o=!0);const r=i.getFileSystemManager();r.writeFile({filePath:n,data:e,encoding:"base64",success(){o?t.Platform.miniapp.saveToAlbum(n).then((()=>{r.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.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=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:h,updateBounds:l,updateChange:c}=t.LeafHelper,{pushAllChildBranch:d,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;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(){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:g,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:n,__updatedList:s}=this,{BEFORE:a,LAYOUT:o,AFTER:r}=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?(h(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||l(n[t])}l(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(o,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:a}=t.LayoutEvent,o=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,o,this.times)),w.fullLayout(i),o.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(s,o,this.times)),i.emitEvent(new t.LayoutEvent(a,o,this.times)),this.addBlocks(o),t.Run.end(e)}static fullLayout(e){g(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 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(){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,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,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:n}=this,s=e.getIntersect(n.bounds),a=new t.Bounds(s);n.save(),s.spread(v.clipSpread).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0),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||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(){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,o=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(o);const{list:r}=this.findList,h=this.getBestMatchLeaf(r,n.bottomList,a),l=a?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:a}=this.point,o={x:s,y:a,radiusX:0,radiusY:0};for(let s=0,a=e.length;s<a;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),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,a,o;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&&(o=s.list[t],!a||!a.has(o));t++)i.add(o)}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)&&(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()}}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,n){const{target:s,picker:a}=this;return t.Platform.backgrounder&&s&&s.updateLayout(),a.getByPoint(e,i,n)}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 r(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 n=L.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,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=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),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 R(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 S(t,e){t.__.__font?R(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,e,i){switch(e.__.strokeAlign){case"center":P(t,1,e,i);break;case"inside":T(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?P(t,2,e,i):T(t,"outside",e,i)}}function P(t,e,i,n){const s=i.__;n.setStroke(!s.__isStrokes&&t,s.strokeWidth*e,s),s.__isStrokes?M(t,!0,i,n):A(i,n)}function T(t,e,i,n){const s=n.getSameCanvas(!0,!0);s.font=i.__.__font,P(t,2,i,s),s.blendMode="outside"===e?"destination-out":"destination-in",R(i,s),s.blendMode="normal",C(n,s,i),s.recycle(i.__nowWorld)}function C(e,i,n){n.__worldFlipped||t.Platform.fullImageShadow?e.copyWorldByReset(i,n.__nowWorld):e.copyWorldToInner(i,n.__nowWorld,n.__layout.renderBounds)}function A(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 M(t,e,n,s){let a;for(let o=0,r=t.length;o<r;o++)a=t[o],a.image&&i.PaintImage.checkImage(n,s,a,!1)||a.style&&(s.strokeStyle=a.style,a.blendMode?(s.saveBlendMode(a.blendMode),e?A(n,s):s.stroke(),s.restoreBlendMode()):e?A(n,s):s.stroke())}function O(t,e,i){const n=e.__;if(n.__strokeWidth)if(n.__font)k(t,e,i);else switch(n.strokeAlign){case"center":W(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),W(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const n=e.__;if(n.__fillAfterStroke)W(t,2,e,i);else{const{renderBounds:s}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),W(t,2,e,a),a.clipUI(n),a.clearWorld(s),C(i,a,e),a.recycle(e.__nowWorld)}}(t,e,i)}}function W(t,e,n,s){const a=n.__;s.setStroke(!a.__isStrokes&&t,a.__strokeWidth*e,a),a.__isStrokes?M(t,!1,n,s):s.stroke(),a.__useArrow&&i.Paint.strokeArrow(t,n,s)}const{getSpread:I,getOuterOf:D,getByMove:H,getIntersectData:z}=t.BoundsHelper;let F;const{stintSet:j}=t.DataHelper,{hasTransparent:U}=i.ColorConvert;function G(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:a}=n.__layout;switch(e.type){case"image":s=i.PaintImage.image(n,t,e,a,!F||!F[e.url]);break;case"linear":s=i.PaintGradient.linearGradient(e,a);break;case"radial":s=i.PaintGradient.radialGradient(e,a);break;case"angular":s=i.PaintGradient.conicGradient(e,a);break;case"solid":const{type:o,color:r,opacity:h}=e;s={type:o,style:i.ColorConvert.string(r,h)};break;default:void 0!==e.r&&(s={type:"solid",style:i.ColorConvert.string(e)})}return s&&("string"==typeof s.style&&U(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const Y={compute:function(t,e){const n=e.__,s=[];let a,o,r=n.__input[t];r instanceof Array||(r=[r]),F=i.PaintImage.recycleImage(t,n);for(let i,n=0,a=r.length;n<a;n++)(i=G(t,r[n],e))&&s.push(i);n["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(a=!0),o=!0),"fill"===t?(j(n,"__isAlphaPixelFill",a),j(n,"__isTransparentFill",o)):(j(n,"__isAlphaPixelStroke",a),j(n,"__isTransparentStroke",o))},fill:function(t,e,i){i.fillStyle=t,S(e,i)},fills:function(t,e,n){let s;for(let a=0,o=t.length;a<o;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}}n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),S(e,n),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),S(e,n),n.restoreBlendMode()):S(e,n)}},fillPathOrText:S,fillText:R,stroke:O,strokes:function(t,e,i){O(t,e,i)},strokeText:k,drawTextStroke:A,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let a,o,r,h,{scaleX:l,scaleY:c}=s;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(s))h=n,a=r=s;else{const{renderShapeSpread:n}=t.__layout,d=z(n?I(e.bounds,l===c?n*l:[n*c,n*l]):e.bounds,s);o=e.bounds.getFitMatrix(d);let{a:u,d:f}=o;if(o.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,c*=f),r=D(s,o),a=H(r,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,f)})}return t.__renderShape(n,i),{canvas:n,matrix:o,bounds:a,worldCanvas:h,shapeBounds:r,scaleX:l,scaleY:c}}};let q={};const{get:N,rotateOfOuter:X,translate:V,scaleOfOuter:Q,scale:K,rotate:Z,skew:$}=t.MatrixHelper;function J(t,e,i,n,s,a,o){const r=N();V(r,e.x+i,e.y+n),K(r,s,a),o&&X(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function tt(t,e,i,n,s,a,o,r){const h=N();o&&Z(h,o),r&&$(h,r.x,r.y),s&&K(h,s,a),V(h,e.x+i,e.y+n),t.transform=h}function et(t,e,i,n,s,a,o,r,h,l){const c=N();if(h)if("center"===l)X(c,{x:i/2,y:n/2},h);else switch(Z(c,h),h){case 90:V(c,n,0);break;case 180:V(c,i,n);break;case 270:V(c,0,i)}q.x=e.x+s,q.y=e.y+a,V(c,q.x,q.y),o&&Q(c,q,o,r),t.transform=c}const{get:it,translate:nt}=t.MatrixHelper,st=new t.Bounds,at={},ot={};function rt(t,e,i,n){const{changeful:s,sync:a,editing:o}=i;s&&(t.changeful=s),a&&(t.sync=a),o&&(t.editing=o),t.data=ht(i,n,e)}function ht(e,i,n){e.padding&&(i=st.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:s,height:a}=n;const{opacity:o,mode:r,align:h,offset:l,scale:c,size:d,rotation:u,skew:f,repeat:p,filters:g}=e,_=i.width===s&&i.height===a,m={mode:r},w="center"!==h&&(u||0)%180==90;let y,v;switch(t.BoundsHelper.set(ot,0,0,w?a:s,w?s:a),r&&"cover"!==r&&"fit"!==r?((c||d)&&(t.MathHelper.getScaleData(c,d,n,at),y=at.scaleX,v=at.scaleY),h&&(y&&t.BoundsHelper.scale(ot,y,v,!0),t.AlignHelper.toPoint(h,ot,i,ot,!0,!0))):_&&!u||(y=v=t.BoundsHelper.getFitScale(i,ot,"fit"!==r),t.BoundsHelper.put(i,n,h,y,!1,ot),t.BoundsHelper.scale(ot,y,v,!0)),l&&t.PointHelper.move(ot,l),r){case"stretch":_||(s=i.width,a=i.height);break;case"normal":case"clip":(ot.x||ot.y||y||u||f)&&tt(m,i,ot.x,ot.y,y,v,u,f);break;case"repeat":(!_||y||u)&&et(m,i,s,a,ot.x,ot.y,y,v,u,h),p||(m.repeat="repeat");break;default:y&&J(m,i,ot.x,ot.y,y,v,u)}return m.transform||(i.x||i.y)&&(m.transform=it(),nt(m.transform,i.x,i.y)),y&&"stretch"!==r&&(m.scaleX=y,m.scaleY=v),m.width=s,m.height=a,o&&(m.opacity=o),g&&(m.filters=g),p&&(m.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),m}let lt,ct=new t.Bounds;const{isSame:dt}=t.BoundsHelper;function ut(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||rt(s,n,i,a),!0}function ft(e,i){_t(e,t.ImageEvent.LOAD,i)}function pt(e,i){_t(e,t.ImageEvent.LOADED,i)}function gt(e,i,n){i.error=n,e.forceUpdate("surface"),_t(e,t.ImageEvent.ERROR,i)}function _t(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function mt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:yt,copy:vt}=t.MatrixHelper,{ceil:xt,abs:bt}=Math;function Et(e,i,n){let{scaleX:s,scaleY:a}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const o=s+"-"+a+"-"+n;if(i.patternId===o||e.destroyed)return!1;{s=bt(s),a=bt(a);const{image:e,data:r}=i;let h,l,{width:c,height:d,scaleX:u,scaleY:f,transform:p,repeat:g}=r;u&&(u=bt(u),f=bt(f),l=wt(),vt(l,p),yt(l,1/u,1/f),s*=u,a*=f),s*=n,a*=n,c*=s,d*=a;const _=c*d;if(!g&&_>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)}_>m&&(h=Math.sqrt(_/m)),h&&(s/=h,a/=h,c/=h,d/=h),u&&(s/=u,a/=f),(p||1!==s||1!==a)&&(l||(l=wt(),p&&vt(l,p)),yt(l,1/s,1/a));const w=e.getCanvas(xt(c)||1,xt(d)||1,r.opacity,r.filters),y=e.getPattern(w,g||t.Platform.origin.noRepeat||"no-repeat",l,i);return i.style=y,i.patternId=o,!0}}function Lt(t,e,i,n){return new(i||(i=Promise))((function(s,a){function o(t){try{h(n.next(t))}catch(t){a(t)}}function r(t){try{h(n.throw(t))}catch(t){a(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(o,r)}h((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Bt}=Math;const Rt={image:function(e,i,n,s,a){let o,r;const h=t.ImageManager.get(n);return lt&&n===lt.paint&&dt(s,lt.boxBounds)?o=lt.leafPaint:(o={type:n.type,image:h},h.hasAlphaPixel&&(o.isTransparent=!0),lt=h.use>1?{leafPaint:o,paint:n,boxBounds:ct.set(s)}:null),(a||h.loading)&&(r={image:h,attrName:i,attrValue:n}),h.ready?(ut(e,i,n,h,o,s),a&&(ft(e,r),pt(e,r))):h.error?a&>(e,r,h.error):(a&&(mt(e,!0),ft(e,r)),o.loadId=h.load((()=>{mt(e,!1),e.destroyed||(ut(e,i,n,h,o,s)&&(h.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),pt(e,r)),o.loadId=void 0}),(t=>{mt(e,!1),gt(e,r,t),o.loadId=void 0})),e.placeholderColor&&(e.placeholderDelay?setTimeout((()=>{h.ready||(h.isPlacehold=!0,e.forceUpdate("surface"))}),e.placeholderDelay):h.isPlacehold=!0)),o},checkImage:function(e,n,s,a){const{scaleX:o,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:h}=n,{data:l}=s;if(!l||s.patternId===o+"-"+r+"-"+h&&!i.Export.running)return!1;if(a)if(l.repeat)a=!1;else if(!(s.changeful||t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=l;e*=Bt(o)*h,i*=Bt(r)*h,l.scaleX&&(e*=l.scaleX,i*=l.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(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,l),!0):(!s.style||s.sync||i.Export.running?Et(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>Lt(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&Et(e,s,h),e.forceUpdate("surface")}))),300)),!1)},createPattern:Et,recycleImage:function(e,i){const n=i["_"+e];if(n instanceof Array){let s,a,o,r,h;for(let l=0,c=n.length;l<c;l++)s=n[l],a=s.image,h=a&&a.url,h&&(o||(o={}),o[h]=!0,t.ImageManager.recycle(a),a.loading&&(r||(r=i.__input&&i.__input[e]||[],r instanceof Array||(r=[r])),a.unload(n[l].loadId,!r.some((t=>t.url===h)))));return o}return null},createData:rt,getPatternData:ht,fillOrFitMode:J,clipMode:tt,repeatMode:et},{toPoint:St}=t.AroundHelper,{hasTransparent:kt}=i.ColorConvert,Pt={},Tt={};function Ct(t,e,n,s){if(n){let a,o,r,h;for(let t=0,l=n.length;t<l;t++)a=n[t],"string"==typeof a?(r=t/(l-1),o=i.ColorConvert.string(a,s)):(r=a.offset,o=i.ColorConvert.string(a.color,s)),e.addColorStop(r,o),!h&&kt(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:At,getDistance:Mt}=t.PointHelper,{get:Ot,rotateOfOuter:Wt,scaleOfOuter:It}=t.MatrixHelper,{toPoint:Dt}=t.AroundHelper,Ht={},zt={};function Ft(t,e,i,n,s){let a;const{width:o,height:r}=t;if(o!==r||n){const t=At(e,i);a=Ot(),s?(It(a,e,o/r*(n||1),1),Wt(a,e,t+90)):(It(a,e,1,o/r*(n||1)),Wt(a,e,t))}return a}const{getDistance:jt}=t.PointHelper,{toPoint:Ut}=t.AroundHelper,Gt={},Yt={};const qt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:o}=e;St(n||"top",i,Pt),St(s||"bottom",i,Tt);const r=t.Platform.canvas.createLinearGradient(Pt.x,Pt.y,Tt.x,Tt.y),h={type:a,style:r};return Ct(h,r,e.stops,o),h},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:o,stretch:r}=e;Dt(n||"center",i,Ht),Dt(s||"bottom",i,zt);const h=t.Platform.canvas.createRadialGradient(Ht.x,Ht.y,0,Ht.x,Ht.y,Mt(Ht,zt)),l={type:a,style:h};Ct(l,h,e.stops,o);const c=Ft(i,Ht,zt,r,!0);return c&&(l.transform=c),l},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:o,stretch:r}=e;Ut(n||"center",i,Gt),Ut(s||"bottom",i,Yt);const h=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Gt.x,Gt.y):t.Platform.canvas.createRadialGradient(Gt.x,Gt.y,0,Gt.x,Gt.y,jt(Gt,Yt)),l={type:a,style:h};Ct(l,h,e.stops,o);const c=Ft(i,Gt,Yt,r||1,t.Platform.conicGradientRotate90);return c&&(l.transform=c),l},getTransform:Ft},{copy:Nt,toOffsetOutBounds:Xt}=t.BoundsHelper,Vt={},Qt={};function Kt(e,i,n,s){const{bounds:a,shapeBounds:o}=s;if(t.Platform.fullImageShadow){if(Nt(Vt,e.bounds),Vt.x+=i.x-o.x,Vt.y+=i.y-o.y,n){const{matrix:t}=s;Vt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Vt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Vt.width*=n,Vt.height*=n}e.copyWorld(s.canvas,e.bounds,Vt)}else n&&(Nt(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,o,n?Vt:i)}const{toOffsetOutBounds:Zt}=t.BoundsHelper,$t={};const Jt={shadow:function(t,e,n){let s,a;const{__nowWorld:o,__layout:r}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:f}=n,p=e.getSameCanvas(),g=h.length-1;Xt(c,Qt),h.forEach(((h,_)=>{p.setWorldShadow(Qt.offsetX+h.x*u,Qt.offsetY+h.y*f,h.blur*u,i.ColorConvert.string(h.color)),a=h.spread?1+2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Kt(p,Qt,a,n),s=c,h.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,c,o,"copy"),s=o),l?p.copyWorld(l,o,o,"destination-out"):p.copyWorld(n.canvas,d,c,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,o,h.blendMode):e.copyWorldToInner(p,s,r.renderBounds,h.blendMode),g&&_<g&&p.clearWorld(s,!0)})),p.recycle(s)},innerShadow:function(t,e,n){let s,a;const{__nowWorld:o,__layout:r}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:f}=n,p=e.getSameCanvas(),g=h.length-1;Zt(c,$t),h.forEach(((h,_)=>{p.save(),p.setWorldShadow($t.offsetX+h.x*u,$t.offsetY+h.y*f,h.blur*u),a=h.spread?1-2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Kt(p,$t,a,n),p.restore(),l?(p.copyWorld(p,c,o,"copy"),p.copyWorld(l,o,o,"source-out"),s=o):(p.copyWorld(n.canvas,d,c,"source-out"),s=c),p.fillWorld(s,i.ColorConvert.string(h.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,o,h.blendMode):e.copyWorldToInner(p,s,r.renderBounds,h.blendMode),g&&_<g&&p.clearWorld(s,!0)})),p.recycle(s)},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:te}=t.LeafBoundsHelper;function ee(t,e,i,n,s,a){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),ne(t,e,i,1)}(t,i,n,s);break;case"opacity-path":ne(t,i,n,a);break;case"path":i.restore()}}function ie(t){return t.getSameCanvas(!1,!0)}function ne(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,a,o,r;const{children:h}=this;for(let l=0,c=h.length;l<c;l++)i=h[l],r=i.__.mask,r&&(o&&(ee(this,o,t,s,n,a),n=s=null),"path"===r||"clipping-path"===r?(i.opacity<1?(o="opacity-path",a=i.opacity,s||(s=ie(t))):(o="path",t.save()),i.__clip(s||t,e)):(o="grayscale"===r?"grayscale":"alpha",n||(n=ie(t)),s||(s=ie(t)),i.__render(n,e)),"clipping"!==r&&"clipping-path"!==r)||te(i,e)||i.__render(s||t,e);ee(this,o,t,s,n,a)};const se=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ae=se+"_#~&*+\\=|≮≯≈≠=…",oe=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 re(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const he=re("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),le=re("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ce=re(se),de=re(ae),ue=re("- —/~|┆·");var fe;!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"}(fe||(fe={}));const{Letter:pe,Single:ge,Before:_e,After:me,Symbol:we,Break:ye}=fe;function ve(t){return he[t]?pe:ue[t]?ye:le[t]?_e:ce[t]?me:de[t]?we:oe.test(t)?ge:pe}const xe={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 be(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:Ee}=xe,{Letter:Le,Single:Be,Before:Re,After:Se,Symbol:ke,Break:Pe}=fe;let Te,Ce,Ae,Me,Oe,We,Ie,De,He,ze,Fe,je,Ue,Ge,Ye,qe,Ne,Xe=[];function Ve(t,e){He&&!De&&(De=He),Te.data.push({char:t,width:e}),Ae+=e}function Qe(){Me+=Ae,Te.width=Ae,Ce.words.push(Te),Te={data:[]},Ae=0}function Ke(){Ge&&(Ye.paraNumber++,Ce.paraStart=!0,Ge=!1),He&&(Ce.startCharSize=De,Ce.endCharSize=He,De=0),Ce.width=Me,qe.width?Ee(Ce):Ne&&Ze(),Xe.push(Ce),Ce={words:[]},Me=0}function Ze(){Me>(Ye.maxWidth||0)&&(Ye.maxWidth=Me)}const{top:$e,right:Je,bottom:ti,left:ei}=t.Direction4;function ii(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 ni={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let s=0,a=0,o=n.__getInput("width")||0,r=n.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:c}=n;c&&(o?(s=c[ei],o-=c[Je]+c[ei]):n.autoSizeAlign||(s=c[ei]),r?(a=c[$e],r-=c[$e]+c[ti]):n.autoSizeAlign||(a=c[$e]));const d={bounds:{x:s,y:a,width:o,height:r},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,i,n){Ye=e,Xe=e.rows,qe=e.bounds,Ne=!qe.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:o}=n,{canvas:r}=t.Platform,{width:h,height:l}=qe;if(h||l||s||"none"!==o){const t="none"!==n.textWrap,e="break"===n.textWrap;Ge=!0,Fe=null,De=Ie=He=Ae=Me=0,Te={data:[]},Ce={words:[]},s&&(i=[...i]);for(let n=0,l=i.length;n<l;n++)We=i[n],"\n"===We?(Ae&&Qe(),Ce.paraEnd=!0,Ke(),Ge=!0):(ze=ve(We),ze===Le&&"none"!==o&&(We=be(We,o,!Ae)),Ie=r.measureText(We).width,s&&(s<0&&(He=Ie),Ie+=s),je=ze===Be&&(Fe===Be||Fe===Le)||Fe===Be&&ze!==Se,Ue=!(ze!==Re&&ze!==Be||Fe!==ke&&Fe!==Se),Oe=Ge&&a?h-a:h,t&&h&&Me+Ae+Ie>Oe&&(e?(Ae&&Qe(),Me&&Ke()):(Ue||(Ue=ze===Le&&Fe==Se),je||Ue||ze===Pe||ze===Re||ze===Be||Ae+Ie>Oe?(Ae&&Qe(),Me&&Ke()):Me&&Ke()))," "===We&&!0!==Ge&&Me+Ae===0||(ze===Pe?(" "===We&&Ae&&Qe(),Ve(We,Ie),Qe()):je||Ue?(Ae&&Qe(),Ve(We,Ie)):Ve(We,Ie)),Fe=ze);Ae&&Qe(),Me&&Ke(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ye.paraNumber++,Me=r.measureText(t).width,Xe.push({x:a||0,text:t,width:Me,paraStart:!0}),Ne&&Ze()}))}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ii(e,"x",t[ei]);break;case"right":ii(e,"x",-t[Je])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ii(e,"y",t[$e]);break;case"bottom":ii(e,"y",-t[ti])}}(c,d,n,o,r),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:h,textAlign:l,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=a*s+(d?d*(t.paraNumber-1):0),w=o;if(h&&m>_)m=Math.max(_,a),s>1&&(t.overflow=s);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}w+=p;let y,v,x,b=g||u?g:t.maxWidth;for(let o=0,c=s;o<c;o++){if(y=i[o],y.x=f,y.width<g||y.width>g&&!h)switch(l){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&d&&o>0&&(w+=d),y.y=w,w+=a,t.overflow>o&&w>m&&(y.isOverflow=!0,t.overflow=o+1),v=y.x,x=y.width,r<0&&(y.width<0?(x=-y.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<n.x&&(n.x=v),x>n.width&&(n.width=x),h&&g&&g<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=p,n.height=m}(d,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:a,letterSpacing:o}=e;let r,h,l,c,d,u;n.forEach((t=>{t.words&&(l=a&&t.paraStart?a:0,u=t.words.length,h=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-l)/(u-1):0,c=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,r=t.x,t.data=[],t.words.forEach(((e,i)=>{1===c?(d={char:"",x:r},r=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):r=function(t,e,i,n){return t.forEach((t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,r,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==s||i===u-1||(r+=h,t.width+=h)}))),t.words=null)}))}(d,n,o),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:a,overflow:o}=e;let{textOverflow:r}=i;if(a.splice(o),r&&"show"!==r){let e,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const l=r?t.Platform.canvas.measureText(r).width:0,c=n+s-l;("none"===i.textWrap?a:[a[o-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<c));n--){if(h<c&&" "!==e.char||!n){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,n,s,o),"none"!==h&&function(t,e){let n;const{fontSize:s,textDecoration:a}=e;switch(t.decorationHeight=s/11,"object"==typeof a?(n=a.type,a.color&&(t.decorationColor=i.ColorConvert.string(a.color))):n=a,n){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,n),d}};const si={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 a=t.r+","+t.g+","+t.b;return 1===s?"rgb("+a+")":"rgba("+a+","+s+")"}};Object.assign(i.TextConvert,ni),Object.assign(i.ColorConvert,si),Object.assign(i.Paint,Y),Object.assign(i.PaintImage,Rt),Object.assign(i.PaintGradient,qt),Object.assign(i.Effect,Jt),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&&o(0,wx)}catch(t){}Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=B,exports.Layouter=w,exports.LeaferCanvas=n,exports.Picker=b,exports.Renderer=v,exports.Selector=E,exports.Watcher=r,exports.useCanvas=o,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?("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: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(t,e,i,s,n){this.context.roundRect(t,e,i,s,"number"==typeof n?[n]:n)}),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,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),void 0!==this.width&&this.resizeListener(new t.ResizeEvent(e,i))}}const{mineType:n,fileType:a}=t.FileHelper;function o(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 o=e.toDataURL(n(a(i)),s);return o=o.substring(o.indexOf("64,")+3),t.Platform.origin.download(o,i)},download:(e,s)=>new Promise(((n,a)=>{let o;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,o=!0);const r=i.getFileSystemManager();r.writeFile({filePath:s,data:e,encoding:"base64",success(){o?t.Platform.miniapp.saveToAlbum(s).then((()=>{r.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.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=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 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(){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:g,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:s,__updatedList:n}=this,{BEFORE:a,LAYOUT:o,AFTER:r}=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(o,f,this.times)),s.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:s,LAYOUT:n,AFTER:a}=t.LayoutEvent,o=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(s,o,this.times)),y.fullLayout(i),o.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(n,o,this.times)),i.emitEvent(new t.LayoutEvent(a,o,this.times)),this.addBlocks(o),t.Run.end(e)}static fullLayout(e){g(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 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(){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,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},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,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:s}=this,n=e.getIntersect(s.bounds),a=new t.Bounds(n);s.save(),n.spread(v.clipSpread).ceil(),s.clearWorld(n,!0),s.clipWorld(n,!0),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();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: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||w.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.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,s){i||(i=0),s||(s={});const n=s.through||!1,a=s.ignoreHittable||!1,o=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(o);const{list:r}=this.findList,l=this.getBestMatchLeaf(r,s.bottomList,a),h=a?this.getPath(l):this.getHitablePath(l);return this.clear(),n?{path:h,target:l,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:l}}getBestMatchLeaf(e,i,s){if(e.length){let i;this.findList=new t.LeafList;const{x:n,y:a}=this.point,o={x:n,y:a,radiusX:0,radiusY:0};for(let n=0,a=e.length;n<a;n++)if(i=e[n],(s||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),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 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);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,o;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&&(o=n.list[t],!a||!a.has(o));t++)i.add(o)}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)&&(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&&!s.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()}}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,s){const{target:n,picker:a}=this;return t.Platform.backgrounder&&n&&n.updateLayout(),a.getByPoint(e,i,s)}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 r(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 s=E.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,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=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),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(t,e,i,s){const n=i.__;"object"==typeof t?A(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),T(i,s))}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 o;const r=n.__,{__hasMultiStrokeStyle:l}=r;l||a.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,c=t.length;h<c;h++)if(o=t[h],(!o.image||!i.PaintImage.checkImage(n,a,o,!1))&&o.style){if(l){const{strokeStyle:t}=o;t?a.setStroke(o.style,r.__getRealStrokeWidth(t)*e,r,t):a.setStroke(o.style,r.__strokeWidth*e,r)}else a.strokeStyle=o.style;o.blendMode?(a.saveBlendMode(o.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,o=s.getSameCanvas(!0,!0);i.__drawRenderPath(o),O(e,2,i,o),o.clipUI(n),o.clearWorld(a),t.LeafHelper.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}}(e,i,s)}}function O(t,e,s,n){const a=s.__;"object"==typeof t?A(t,e,!1,s,n):(n.setStroke(t,a.__strokeWidth*e,a),n.stroke()),a.__useArrow&&i.Paint.strokeArrow(t,s,n)}const{getSpread:W,getOuterOf:D,getByMove:I,getIntersectData:H}=t.BoundsHelper;let z;const{stintSet:F}=t.DataHelper,{hasTransparent:j}=i.ColorConvert;function U(t,e,s){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:a}=s.__layout;switch(e.type){case"image":n=i.PaintImage.image(s,t,e,a,!z||!z[e.url]);break;case"linear":n=i.PaintGradient.linearGradient(e,a);break;case"radial":n=i.PaintGradient.radialGradient(e,a);break;case"angular":n=i.PaintGradient.conicGradient(e,a);break;case"solid":const{type:o,color:r,opacity:l}=e;n={type:o,style:i.ColorConvert.string(r,l)};break;default:void 0!==e.r&&(n={type:"solid",style:i.ColorConvert.string(e)})}if(n){if("string"==typeof n.style&&j(n.style)&&(n.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}e.blendMode&&(n.blendMode=e.blendMode)}return n}const G={compute:function(t,e){const s=e.__,n=[];let a,o,r,l=s.__input[t];l instanceof Array||(l=[l]),z=i.PaintImage.recycleImage(t,s);for(let i,s=0,a=l.length;s<a;s++)(i=U(t,l[s],e))&&(n.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));s["_"+t]=n.length?n:void 0,n.length&&n.every((t=>t.isTransparent))&&(n.some((t=>t.image))&&(a=!0),o=!0),"fill"===t?(F(s,"__isAlphaPixelFill",a),F(s,"__isTransparentFill",o)):(F(s,"__isAlphaPixelStroke",a),F(s,"__isTransparentStroke",o),F(s,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,k(e,i)},fills:function(t,e,s){let n;for(let a=0,o=t.length;a<o;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);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(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let a,o,r,l,{scaleX:h,scaleY:c}=n;if(h<0&&(h=-h),c<0&&(c=-c),e.bounds.includes(n))l=s,a=r=n;else{const{renderShapeSpread:s}=t.__layout,d=H(s?W(e.bounds,h===c?s*h:[s*c,s*h]):e.bounds,n);o=e.bounds.getFitMatrix(d);let{a:u,d:f}=o;if(o.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,i),h*=u,c*=f),r=D(n,o),a=I(r,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,f)})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:a,worldCanvas:l,shapeBounds:r,scaleX:h,scaleY:c}}};let Y={},q=t.getMatrixData();const{get:N,rotateOfOuter:X,translate:V,scaleOfOuter:Q,multiplyParent:K,scale:Z,rotate:$,skew:J}=t.MatrixHelper;function tt(t,e,i,s,n,a,o){const r=N();V(r,e.x+i,e.y+s),Z(r,n,a),o&&X(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function et(t,e,i,s,n,a,o,r,l){const h=N();o&&$(h,o),r&&J(h,r.x,r.y),n&&Z(h,n,a),V(h,e.x+i,e.y+s),l&&(q.a=e.width/l.width,q.d=e.height/l.height,K(h,q)),t.transform=h}function it(t,e,i,s,n,a,o,r,l,h){const c=N();if(l)if("center"===h)X(c,{x:i/2,y:s/2},l);else switch($(c,l),l){case 90:V(c,s,0);break;case 180:V(c,i,s);break;case 270:V(c,0,i)}Y.x=e.x+n,Y.y=e.y+a,V(c,Y.x,Y.y),o&&Q(c,Y,o,r),t.transform=c}const{get:st,translate:nt}=t.MatrixHelper,at=new t.Bounds,ot={},rt={};function lt(t,e,i,s){const{changeful:n,sync:a,editing:o,scaleFixed:r}=i;n&&(t.changeful=n),a&&(t.sync=a),o&&(t.editing=o),r&&(t.scaleFixed=r),t.data=ht(i,s,e)}function ht(e,i,s){e.padding&&(i=at.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:n,height:a}=s;const{opacity:o,mode:r,align:l,offset:h,scale:c,size:d,rotation:u,skew:f,clipSize:p,repeat:g,filters:_}=e,m=i.width===n&&i.height===a,y={mode:r},w="center"!==l&&(u||0)%180==90;let v,x;switch(t.BoundsHelper.set(rt,0,0,w?a:n,w?n:a),r&&"cover"!==r&&"fit"!==r?((c||d)&&(t.MathHelper.getScaleData(c,d,s,ot),v=ot.scaleX,x=ot.scaleY),l&&(v&&t.BoundsHelper.scale(rt,v,x,!0),t.AlignHelper.toPoint(l,rt,i,rt,!0,!0))):m&&!u||(v=x=t.BoundsHelper.getFitScale(i,rt,"fit"!==r),t.BoundsHelper.put(i,s,l,v,!1,rt),t.BoundsHelper.scale(rt,v,x,!0)),h&&t.PointHelper.move(rt,h),r){case"stretch":m||(n=i.width,a=i.height);break;case"normal":case"clip":(rt.x||rt.y||v||p||u||f)&&et(y,i,rt.x,rt.y,v,x,u,f,e.clipSize);break;case"repeat":(!m||v||u)&&it(y,i,n,a,rt.x,rt.y,v,x,u,l),g||(y.repeat="repeat");break;default:v&&tt(y,i,rt.x,rt.y,v,x,u)}return y.transform||(i.x||i.y)&&(y.transform=st(),nt(y.transform,i.x,i.y)),v&&"stretch"!==r&&(y.scaleX=v,y.scaleY=x),y.width=n,y.height=a,o&&(y.opacity=o),_&&(y.filters=_),g&&(y.repeat="string"==typeof g?"x"===g?"repeat-x":"repeat-y":"repeat"),y}let ct,dt=new t.Bounds;const{isSame:ut}=t.BoundsHelper;function ft(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||lt(n,s,i,a),!0}function pt(e,i){mt(e,t.ImageEvent.LOAD,i)}function gt(e,i){mt(e,t.ImageEvent.LOADED,i)}function _t(e,i,s){i.error=s,e.forceUpdate("surface"),mt(e,t.ImageEvent.ERROR,i)}function mt(e,i,s){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,s))}function yt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:vt,copy:xt}=t.MatrixHelper,{ceil:bt,abs:Lt}=Math;function Et(e,i,s){let{scaleX:n,scaleY:a}=e.getRenderScaleData(!0,i.scaleFixed);const o=n+"-"+a+"-"+s;if(i.patternId===o||e.destroyed)return!1;{const{image:e,data:r}=i;let l,h,{width:c,height:d,scaleX:u,scaleY:f,transform:p,repeat:g}=r;u&&(u=Lt(u),f=Lt(f),h=wt(),xt(h,p),vt(h,1/u,1/f),n*=u,a*=f),n*=s,a*=s,c*=n,d*=a;const _=c*d;if(!g&&_>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)}_>m&&(l=Math.sqrt(_/m)),l&&(n/=l,a/=l,c/=l,d/=l),u&&(n/=u,a/=f),(p||1!==n||1!==a)&&(h||(h=wt(),p&&xt(h,p)),vt(h,1/n,1/a));const y=e.getCanvas(bt(c)||1,bt(d)||1,r.opacity,r.filters),w=e.getPattern(y,g||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=w,i.patternId=o,!0}}function Bt(t,e,i,s){return new(i||(i=Promise))((function(n,a){function o(t){try{l(s.next(t))}catch(t){a(t)}}function r(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(o,r)}l((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const St={image:function(e,i,s,n,a){let o,r;const l=t.ImageManager.get(s);return ct&&s===ct.paint&&ut(n,ct.boxBounds)?o=ct.leafPaint:(o={type:s.type,image:l},l.hasAlphaPixel&&(o.isTransparent=!0),ct=l.use>1?{leafPaint:o,paint:s,boxBounds:dt.set(n)}:null),(a||l.loading)&&(r={image:l,attrName:i,attrValue:s}),l.ready?(ft(e,i,s,l,o,n),a&&(pt(e,r),gt(e,r))):l.error?a&&_t(e,r,l.error):(a&&(yt(e,!0),pt(e,r)),o.loadId=l.load((()=>{yt(e,!1),e.destroyed||(ft(e,i,s,l,o,n)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),gt(e,r)),o.loadId=void 0}),(t=>{yt(e,!1),_t(e,r,t),o.loadId=void 0})),e.placeholderColor&&(e.placeholderDelay?setTimeout((()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))}),e.placeholderDelay):l.isPlacehold=!0)),o},checkImage:function(e,s,n,a){const{scaleX:o,scaleY:r}=e.getRenderScaleData(!0,n.scaleFixed),{pixelRatio:l}=s,{data:h}=n;if(!h||n.patternId===o+"-"+r+"-"+l&&!i.Export.running)return!1;if(a)if(h.repeat)a=!1;else if(!(n.changeful||t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=h;e*=o*l,i*=r*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?Et(e,n,l):n.patternTask||(n.patternTask=t.ImageManager.patternTasker.add((()=>Bt(this,void 0,void 0,(function*(){n.patternTask=null,s.bounds.hit(e.__nowWorld)&&Et(e,n,l),e.forceUpdate("surface")}))),300)),!1)},createPattern:Et,recycleImage:function(e,i){const s=i["_"+e];if(s instanceof Array){let n,a,o,r,l;for(let h=0,c=s.length;h<c;h++)n=s[h],a=n.image,l=a&&a.url,l&&(o||(o={}),o[l]=!0,t.ImageManager.recycle(a),a.loading&&(r||(r=i.__input&&i.__input[e]||[],r instanceof Array||(r=[r])),a.unload(s[h].loadId,!r.some((t=>t.url===l)))));return o}return null},createData:lt,getPatternData:ht,fillOrFitMode:tt,clipMode:et,repeatMode:it},{toPoint:kt}=t.AroundHelper,{hasTransparent:Rt}=i.ColorConvert,Pt={},Ct={};function Tt(t,e,s,n){if(s){let a,o,r,l;for(let t=0,h=s.length;t<h;t++)a=s[t],"string"==typeof a?(r=t/(h-1),o=i.ColorConvert.string(a,n)):(r=a.offset,o=i.ColorConvert.string(a.color,n)),e.addColorStop(r,o),!l&&Rt(o)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:At,getDistance:Mt}=t.PointHelper,{get:Ot,rotateOfOuter:Wt,scaleOfOuter:Dt}=t.MatrixHelper,{toPoint:It}=t.AroundHelper,Ht={},zt={};function Ft(t,e,i,s,n){let a;const{width:o,height:r}=t;if(o!==r||s){const t=At(e,i);a=Ot(),n?(Dt(a,e,o/r*(s||1),1),Wt(a,e,t+90)):(Dt(a,e,1,o/r*(s||1)),Wt(a,e,t))}return a}const{getDistance:jt}=t.PointHelper,{toPoint:Ut}=t.AroundHelper,Gt={},Yt={};const qt={linearGradient:function(e,i){let{from:s,to:n,type:a,opacity:o}=e;kt(s||"top",i,Pt),kt(n||"bottom",i,Ct);const r=t.Platform.canvas.createLinearGradient(Pt.x,Pt.y,Ct.x,Ct.y),l={type:a,style:r};return Tt(l,r,e.stops,o),l},radialGradient:function(e,i){let{from:s,to:n,type:a,opacity:o,stretch:r}=e;It(s||"center",i,Ht),It(n||"bottom",i,zt);const l=t.Platform.canvas.createRadialGradient(Ht.x,Ht.y,0,Ht.x,Ht.y,Mt(Ht,zt)),h={type:a,style:l};Tt(h,l,e.stops,o);const c=Ft(i,Ht,zt,r,!0);return c&&(h.transform=c),h},conicGradient:function(e,i){let{from:s,to:n,type:a,opacity:o,stretch:r}=e;Ut(s||"center",i,Gt),Ut(n||"bottom",i,Yt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Gt.x,Gt.y):t.Platform.canvas.createRadialGradient(Gt.x,Gt.y,0,Gt.x,Gt.y,jt(Gt,Yt)),h={type:a,style:l};Tt(h,l,e.stops,o);const c=Ft(i,Gt,Yt,r||1,t.Platform.conicGradientRotate90);return c&&(h.transform=c),h},getTransform:Ft},{copy:Nt,toOffsetOutBounds:Xt}=t.BoundsHelper,Vt={},Qt={};function Kt(e,i,s,n){const{bounds:a,shapeBounds:o}=n;if(t.Platform.fullImageShadow){if(Nt(Vt,e.bounds),Vt.x+=i.x-o.x,Vt.y+=i.y-o.y,s){const{matrix:t}=n;Vt.x-=(a.x+(t?t.e:0)+a.width/2)*(s-1),Vt.y-=(a.y+(t?t.f:0)+a.height/2)*(s-1),Vt.width*=s,Vt.height*=s}e.copyWorld(n.canvas,e.bounds,Vt)}else s&&(Nt(Vt,i),Vt.x-=i.width/2*(s-1),Vt.y-=i.height/2*(s-1),Vt.width*=s,Vt.height*=s),e.copyWorld(n.canvas,o,s?Vt:i)}const{toOffsetOutBounds:Zt}=t.BoundsHelper,$t={};const Jt={shadow:function(e,s,n){let a,o;const{__nowWorld:r,__layout:l}=e,{shadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:p}=n,g=s.getSameCanvas(),_=h.length-1;Xt(d,Qt),h.forEach(((h,m)=>{g.setWorldShadow(Qt.offsetX+h.x*f,Qt.offsetY+h.y*p,h.blur*f,i.ColorConvert.string(h.color)),o=h.spread?1+2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0)):0,Kt(g,Qt,o,n),a=d,h.box&&(g.restore(),g.save(),c&&(g.copyWorld(g,d,r,"copy"),a=r),c?g.copyWorld(c,r,r,"destination-out"):g.copyWorld(n.canvas,u,d,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,s,g,a,h.blendMode),_&&m<_&&g.clearWorld(a,!0)})),g.recycle(a)},innerShadow:function(e,s,n){let a,o;const{__nowWorld:r,__layout:l}=e,{innerShadow:h}=e.__,{worldCanvas:c,bounds:d,shapeBounds:u,scaleX:f,scaleY:p}=n,g=s.getSameCanvas(),_=h.length-1;Zt(d,$t),h.forEach(((h,m)=>{g.save(),g.setWorldShadow($t.offsetX+h.x*f,$t.offsetY+h.y*p,h.blur*f),o=h.spread?1-2*h.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0)):0,Kt(g,$t,o,n),g.restore(),c?(g.copyWorld(g,d,r,"copy"),g.copyWorld(c,r,r,"source-out"),a=r):(g.copyWorld(n.canvas,u,d,"source-out"),a=d),g.fillWorld(a,i.ColorConvert.string(h.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,s,g,a,h.blendMode),_&&m<_&&g.clearWorld(a,!0)})),g.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){}},{excludeRenderBounds:te}=t.LeafBoundsHelper;function ee(t,e,i,s,n,a){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),se(t,e,i,1)}(t,i,s,n);break;case"opacity-path":se(t,i,s,a);break;case"path":i.restore()}}function ie(t){return t.getSameCanvas(!1,!0)}function se(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}i.Group.prototype.__renderMask=function(t,e){let i,s,n,a,o,r;const{children:l}=this;for(let h=0,c=l.length;h<c;h++)i=l[h],r=i.__.mask,r?(o&&(ee(this,o,t,n,s,a),s=n=null),"path"===r||"clipping-path"===r?(i.opacity<1?(o="opacity-path",a=i.opacity,n||(n=ie(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===r?"grayscale":"alpha",s||(s=ie(t)),n||(n=ie(t)),i.__render(s,e)),"clipping"!==r&&"clipping-path"!==r||te(i,e)||i.__render(t,e)):te(i,e)||i.__render(n||t,e);ee(this,o,t,n,s,a)};const ne=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ae=ne+"_#~&*+\\=|≮≯≈≠=…",oe=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 re(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const le=re("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),he=re("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ce=re(ne),de=re(ae),ue=re("- —/~|┆·");var fe;!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"}(fe||(fe={}));const{Letter:pe,Single:ge,Before:_e,After:me,Symbol:ye,Break:we}=fe;function ve(t){return le[t]?pe:ue[t]?we:he[t]?_e:ce[t]?me:de[t]?ye:oe.test(t)?ge:pe}const xe={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 be(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:Le}=xe,{Letter:Ee,Single:Be,Before:Se,After:ke,Symbol:Re,Break:Pe}=fe;let Ce,Te,Ae,Me,Oe,We,De,Ie,He,ze,Fe,je,Ue,Ge,Ye,qe,Ne,Xe=[];function Ve(t,e){He&&!Ie&&(Ie=He),Ce.data.push({char:t,width:e}),Ae+=e}function Qe(){Me+=Ae,Ce.width=Ae,Te.words.push(Ce),Ce={data:[]},Ae=0}function Ke(){Ge&&(Ye.paraNumber++,Te.paraStart=!0,Ge=!1),He&&(Te.startCharSize=Ie,Te.endCharSize=He,Ie=0),Te.width=Me,qe.width?Le(Te):Ne&&Ze(),Xe.push(Te),Te={words:[]},Me=0}function Ze(){Me>(Ye.maxWidth||0)&&(Ye.maxWidth=Me)}const{top:$e,right:Je,bottom:ti,left:ei}=t.Direction4;function ii(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 si={getDrawData:function(e,s){"string"!=typeof e&&(e=String(e));let n=0,a=0,o=s.__getInput("width")||0,r=s.__getInput("height")||0;const{textDecoration:l,__font:h,__padding:c}=s;c&&(o?(n=c[ei],o-=c[Je]+c[ei]):s.autoSizeAlign||(n=c[ei]),r?(a=c[$e],r-=c[$e]+c[ti]):s.autoSizeAlign||(a=c[$e]));const d={bounds:{x:n,y:a,width:o,height:r},rows:[],paraNumber:0,font:t.Platform.canvas.font=h};return function(e,i,s){Ye=e,Xe=e.rows,qe=e.bounds,Ne=!qe.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:o}=s,{canvas:r}=t.Platform,{width:l,height:h}=qe;if(l||h||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;Ge=!0,Fe=null,Ie=De=He=Ae=Me=0,Ce={data:[]},Te={words:[]},n&&(i=[...i]);for(let s=0,h=i.length;s<h;s++)We=i[s],"\n"===We?(Ae&&Qe(),Te.paraEnd=!0,Ke(),Ge=!0):(ze=ve(We),ze===Ee&&"none"!==o&&(We=be(We,o,!Ae)),De=r.measureText(We).width,n&&(n<0&&(He=De),De+=n),je=ze===Be&&(Fe===Be||Fe===Ee)||Fe===Be&&ze!==ke,Ue=!(ze!==Se&&ze!==Be||Fe!==Re&&Fe!==ke),Oe=Ge&&a?l-a:l,t&&l&&Me+Ae+De>Oe&&(e?(Ae&&Qe(),Me&&Ke()):(Ue||(Ue=ze===Ee&&Fe==ke),je||Ue||ze===Pe||ze===Se||ze===Be||Ae+De>Oe?(Ae&&Qe(),Me&&Ke()):Me&&Ke()))," "===We&&!0!==Ge&&Me+Ae===0||(ze===Pe?(" "===We&&Ae&&Qe(),Ve(We,De),Qe()):je||Ue?(Ae&&Qe(),Ve(We,De)):Ve(We,De)),Fe=ze);Ae&&Qe(),Me&&Ke(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ye.paraNumber++,Me=r.measureText(t).width,Xe.push({x:a||0,text:t,width:Me,paraStart:!0}),Ne&&Ze()}))}(d,e,s),c&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":ii(e,"x",t[ei]);break;case"right":ii(e,"x",-t[Je])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ii(e,"y",t[$e]);break;case"bottom":ii(e,"y",-t[ti])}}(c,d,s,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:l,textAlign:h,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=s,m=a*n+(d?d*(t.paraNumber-1):0),y=o;if(l&&m>_)m=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let o=0,c=n;o<c;o++){if(w=i[o],w.x=f,w.width<g||w.width>g&&!l)switch(h){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&d&&o>0&&(y+=d),w.y=y,y+=a,t.overflow>o&&y>m&&(w.isOverflow=!0,t.overflow=o+1),v=w.x,x=w.width,r<0&&(w.width<0?(x=-w.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=m}(d,s),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:o}=e;let r,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=o||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!o&&(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,r=t.x,t.data=[],t.words.forEach(((e,i)=>{1===c?(d={char:"",x:r},r=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):r=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,r,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==n||i===u-1||(r+=l,t.width+=l)}))),t.words=null)}))}(d,s,o),d.overflow&&function(e,i,s,n){if(!n)return;const{rows:a,overflow:o}=e;let{textOverflow:r}=i;if(a.splice(o),r&&"show"!==r){let e,l;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?t.Platform.canvas.measureText(r).width:0,c=s+n-h;("none"===i.textWrap?a:[a[o-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:r,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(d,s,n,o),"none"!==l&&function(t,e){let s;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,"object"==typeof a?(s=a.type,a.color&&(t.decorationColor=i.ColorConvert.string(a.color))):s=a,s){case"under":t.decorationY=[.15*n];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n,.35*-n]}}(d,s),d}};const ni={string:function(t,e){const s="number"==typeof e&&1!==e;if("string"==typeof t){if(!s||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let n=void 0===t.a?1:t.a;s&&(n*=e);const a=t.r+","+t.g+","+t.b;return 1===n?"rgb("+a+")":"rgba("+a+","+n+")"}};Object.assign(i.TextConvert,si),Object.assign(i.ColorConvert,ni),Object.assign(i.Paint,G),Object.assign(i.PaintImage,St),Object.assign(i.PaintGradient,qt),Object.assign(i.Effect,Jt),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&&o(0,wx)}catch(t){}Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=B,exports.Layouter=y,exports.LeaferCanvas=s,exports.Picker=b,exports.Renderer=v,exports.Selector=L,exports.Watcher=r,exports.useCanvas=o,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
|