leafer-ui 1.12.0 → 1.12.2
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/README.md +4 -13
- package/dist/web.cjs +25 -28
- package/dist/web.esm.js +26 -29
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +172 -111
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +176 -111
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t,e=require("@leafer/core"),i=require("@leafer-ui/core"),n=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";const s=e.Debug.get("LeaferCanvas");class o extends e.LeaferCanvasBase{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const n=i.children[t];n?(this.setAbsolute(n),i.insertBefore(e,n)):i.appendChild(n)}}init(){const{config:t}=this,i=t.view||t.canvas;i?this.__createViewFrom(i):this.__createView();const{style:n}=this.view;if(n.display||(n.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.Platform.syncDomFont&&!this.parentView&&(n.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let i=e.isString(t)?document.getElementById(t):t;if(i)if(i instanceof HTMLCanvasElement)this.view=i;else{let t=i;if(i===window||i===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const e=this.view;t.hasChildNodes()&&(this.setAbsolute(e),t.style.position||(t.style.position="relative")),t.appendChild(e)}else s.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:i,pixelRatio:n}=this,{style:s}=this.view;if(this.unreal){const{config:t,autoWidthStr:i,autoHeightStr:n}=this;t.width?(e.isUndefined(i)&&(this.autoWidthStr=s.width||""),s.width=t.width+"px"):e.isUndefined(i)||(s.width=i),t.height?(e.isUndefined(n)&&(this.autoHeightStr=s.height||""),s.height=t.height+"px"):e.isUndefined(n)||(s.height=n)}else s.width=t+"px",s.height=i+"px",this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(i*n)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),s.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.Platform.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=e.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const i=this.view,{x:n,y:s,width:o,height:r}=this.autoBounds.getBoundsFrom(t),a={width:o,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.Platform.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=i;t.marginLeft=n+"px",t.marginTop=s+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const i={};e.DataHelper.copyAttrs(i,this,e.canvasSizeAttrs),this.resize(t),this.resizeListener&&!e.isUndefined(this.width)&&this.resizeListener(new e.ResizeEvent(t,i))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}e.canvasPatch(CanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r,fileType:a}=e.FileHelper;function h(t,i){e.Platform.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const n=r(e),s=t.toDataURL(n,i);return"image/bmp"===n?s.replace("image/png;","image/bmp;"):s},canvasToBolb:(t,e,i)=>new Promise(n=>t.toBlob(n,r(e),i)),canvasSaveAs:(t,i,n)=>{const s=t.toDataURL(r(a(i)),n);return e.Platform.origin.download(s,i)},download:(t,e)=>new Promise(i=>{let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),i()}),loadImage:t=>new Promise((i,n)=>{const s=new e.Platform.origin.Image,{crossOrigin:o}=e.Platform.image;o&&(s.setAttribute("crossOrigin",o),s.crossOrigin=o),s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=e.Platform.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.Platform.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new o(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isMobile="ontouchstart"in window,e.Platform.requestRender=function(t){window.requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:l}=navigator;l.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0,e.Platform.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),l.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):l.indexOf("Mac")>-1?e.Platform.os="Mac":l.indexOf("Linux")>-1&&(e.Platform.os="Linux");class c{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,i){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,i&&(this.config=e.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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.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 e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.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:d,updateBounds:u,updateChange:f}=e.LeafHelper,{pushAllChildBranch:p,pushAllParent:g}=e.BranchHelper;const{worldBounds:m}=e.LeafBoundsHelper;class _{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,m)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,m),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:w,updateAllChange:v}=e.LeafHelper,y=e.Debug.get("Layouter");class x{constructor(t,i){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,i&&(this.config=e.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:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const i=e.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:o,LAYOUT:r,AFTER:a}=e.LayoutEvent,h=this.getBlocks(s);h.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(o,h,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?(d(t,!0),e.add(t),t.isBranch&&p(t,e),g(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),g(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||u(n[t])}u(i)}})}(this.__levelList),function(t){t.list.forEach(f)}(s),this.extraBlock&&h.push(this.extraBlock),h.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(r,h,this.times)),n.emitEvent(new e.LayoutEvent(a,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updatedList=null,e.Run.end(i)}fullLayout(){const t=e.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:o}=e.LayoutEvent,r=this.getBlocks(new e.LeafList(i));i.emitEvent(new e.LayoutEvent(n,r,this.times)),x.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new e.LayoutEvent(s,r,this.times)),i.emitEvent(new e.LayoutEvent(o,r,this.times)),this.addBlocks(r),e.Run.end(t)}static fullLayout(t){w(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),v(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new _([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new _(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_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const P=e.Debug.get("Renderer");class b{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=i,n&&(this.config=e.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new e.Bounds,P.log(i.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,P.error(t)}P.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return P.warn("rendering");if(this.times>3)return P.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.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(t){const i=e.Run.start("PartRender"),{canvas:n}=this,s=t.getIntersect(n.bounds),o=new e.Bounds(s);n.save(),s.spread(b.clipSpread).ceil(),n.clearWorld(s),n.clipWorld(s),this.__render(s,o),n.restore(),e.Run.end(i)}fullRender(){const t=e.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),e.Run.end(t)}__render(t,i){const{canvas:n,target:s}=this,o=t.includes(s.__world),r=o?{includes:o}:{bounds:t,includes:o};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(r.cellList=this.getCellList()),e.Platform.render(s,n,r),this.renderBounds=i=i||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const i=new e.Bounds;i.setList(t),t.length=0,t.push(i)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(i);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:i,height:n}=t.old;if(!new e.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.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||P.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,i,n){this.target.emitEvent(new e.RenderEvent(t,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.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)}}b.clipSpread=10;const{hitRadiusPoint:L}=e.BoundsHelper;class E{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,i,n){i||(i=0),n||(n={});const s=n.through||!1,o=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:i,radiusY:i},this.findList=new e.LeafList(n.findList),n.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:a}=this.findList,h=this.getBestMatchLeaf(a,n.bottomList,o,!!n.findList),l=o?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:a.length?this.getThroughPath(a):l}:{path:l,target:h}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,i,n,s){const o=this.findList=new e.LeafList;if(t.length){let i;const{x:s,y:r}=this.point,a={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(i=t[s],(n||e.LeafHelper.worldHittable(i))&&(this.hitChild(i,a),o.length)){if(i.isBranchLeaf&&t.some(t=>t!==i&&e.LeafHelper.hasParent(t,i))){o.reset();break}return o.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),o.length)return o.list[0];return s?null:n?t[0]:t.find(t=>e.LeafHelper.worldHittable(t))}getPath(t){const i=new e.LeafList,n=[],{target:s}=this;for(;t&&(t.syncEventer&&n.push(t.syncEventer),i.add(t),(t=t.parent)!==s););return n.length&&n.forEach(t=>{for(;t&&(t.__.hittable&&i.add(t),(t=t.parent)!==s););}),s&&i.add(s),i}getHitablePath(t){const i=this.getPath(t&&t.hittable?t:null);let n,s=new e.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren&&(!n.isLeafer||"draw"!==n.mode));t--);return s}getThroughPath(t){const i=new e.LeafList,n=[];for(let e=t.length-1;e>-1;e--)n.push(this.getPath(t[e]));let s,o,r;for(let t=0,e=n.length;t<e;t++){s=n[t],o=n[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!o||!o.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 o=t.length-1;o>-1;o--)if(i=t[o],i.__.visible&&(!e||i.__.mask))if(n=!!i.__.hitRadius||L(i.__world,s),i.isBranch){if(n||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(s))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)}}else 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:o}=n;for(let n=0,r=o.length;n<r;n++)if(i=o[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 B{constructor(t,i){this.config={},i&&(this.config=e.DataHelper.default(i,this.config)),this.picker=new E(this.target=t,this),this.finder=e.Creator.finder&&e.Creator.finder()}getByPoint(t,i,n){const{target:s,picker:o}=this;return e.Platform.backgrounder&&s&&s.updateLayout(),o.getByPoint(t,i,n)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,i,n,s){return this.finder?this.finder.getBy(t,i,n,s):e.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(e.Creator,{watcher:(t,e)=>new c(t,e),layouter:(t,e)=>new x(t,e),renderer:(t,e,i)=>new b(t,e,i),selector:(t,e)=>new B(t,e)}),e.Platform.layout=x.fullLayout,e.Platform.render=function(t,i,n){const s=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(i,n),n.topList.length&&n.topList.forEach(t=>t.__render(i,s))};const S={convert(t,e){const n=i.InteractionHelper.getBase(t),{x:s,y:o}=e,r=Object.assign(Object.assign({},n),{x:s,y:o,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const n=i.InteractionHelper.getBase(t),{x:s,y:o}=e;return Object.assign(Object.assign({},n),{x:s,y:o,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const n=S.getTouch(t),s=i.InteractionHelper.getBase(t),{x:o,y:r}=e;return Object.assign(Object.assign({},s),{x:o,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},k={convert(t){const e=i.InteractionHelper.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:R}=i.InteractionHelper;class T extends i.InteractionBase{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,n=t.length;i<n;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(k.convert(t))}onKeyUp(t){this.keyUp(k.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(S.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(S.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=S.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(S.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(S.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(S.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(S.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=S.getTouch(t),i=this.getLocal(e,!0),{preventDefault:n}=this.config.touch;(!0===n||"auto"===n&&R(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(S.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=S.getTouch(t);this.pointerMove(S.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=S.getTouch(t);this.pointerUp(S.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||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 e=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,e);n.length>1&&(this.multiTouch(i.InteractionHelper.getBase(t),n),this.touches=e)}}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))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},i.InteractionHelper.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const n=i.InteractionHelper.getBase(t);Object.assign(n,this.getLocal(t));const s=t.scale/this.lastGestureScale,o=(t.rotation-this.lastGestureRotation)/Math.PI*180*(e.MathHelper.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},n),{scale:s*s})),this.rotate(Object.assign(Object.assign({},n),{rotation:o})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const i=[];this.eachCursor(t,i),e.isObject(i[i.length-1])&&i.push("default"),this.canvas.view.style.cursor=i.map(t=>e.isObject(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,n,s=0){if(s++,e.isArray(t))t.forEach(t=>this.eachCursor(t,n,s));else{const o=e.isString(t)&&i.Cursor.get(t);o&&s<2?this.eachCursor(o,n,s):n.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function C(t,e,i){t.__.__font?n.Paint.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function M(t,i,s,o,r){const a=s.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,i,!1,s,o,r):(o.setStroke(t,a.__strokeWidth*i,a),o.stroke()),a.__useArrow&&n.Paint.strokeArrow(t,s,o,r)}function O(t,i,s,o,r){const a=s.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,i,!0,s,o,r):(o.setStroke(t,a.__strokeWidth*i,a),n.Paint.drawTextStroke(s,o,r))}function A(t,i,s,o,r){const a=o.getSameCanvas(!0,!0);a.font=s.__.__font,O(t,2,s,a,r),a.blendMode="outside"===i?"destination-out":"destination-in",n.Paint.fillText(s,a,r),a.blendMode="normal",e.LeafHelper.copyCanvasByWorld(s,o,a),a.recycle(s.__nowWorld)}const{getSpread:D,copyAndSpread:I,toOuterOf:W,getOuterOf:H,getByMove:F,move:j,getIntersectData:z}=e.BoundsHelper,U={};let G;const{stintSet:Y}=e.DataHelper,{hasTransparent:X}=n.ColorConvert;function N(t,i,s){if(!e.isObject(i)||!1===i.visible||0===i.opacity)return;let o;const{boxBounds:r}=s.__layout;switch(i.type){case"image":if(!i.url)return;o=n.PaintImage.image(s,t,i,r,!G||!G[i.url]);break;case"linear":o=n.PaintGradient.linearGradient(i,r);break;case"radial":o=n.PaintGradient.radialGradient(i,r);break;case"angular":o=n.PaintGradient.conicGradient(i,r);break;case"solid":const{type:a,color:h,opacity:l}=i;o={type:a,style:n.ColorConvert.string(h,l)};break;default:e.isUndefined(i.r)||(o={type:"solid",style:n.ColorConvert.string(i)})}if(o&&(o.originPaint=i,e.isString(o.style)&&X(o.style)&&(o.isTransparent=!0),i.style)){if(0===i.style.strokeWidth)return;o.strokeStyle=i.style}return o}const V={compute:function(t,i){const s=i.__,o=[];let r,a,h,l=s.__input[t];e.isArray(l)||(l=[l]),G=n.PaintImage.recycleImage(t,s);for(let e,n=0,s=l.length;n<s;n++)(e=N(t,l[n],i))&&(o.push(e),e.strokeStyle&&(h||(h=1),e.strokeStyle.strokeWidth&&(h=Math.max(h,e.strokeStyle.strokeWidth))));s["_"+t]=o.length?o:void 0,o.length?(o.every(t=>t.isTransparent)&&(o.some(t=>t.image)&&(r=!0),a=!0),"fill"===t?(Y(s,"__isAlphaPixelFill",r),Y(s,"__isTransparentFill",a)):(Y(s,"__isAlphaPixelStroke",r),Y(s,"__isTransparentStroke",a),Y(s,"__hasMultiStrokeStyle",h))):s.__removePaint(t,!1)},fill:function(t,e,i,n){i.fillStyle=t,C(e,i,n)},fills:function(t,e,i,s){let o,r,a;for(let h=0,l=t.length;h<l;h++){if(o=t[h],r=o.originPaint,o.image){if(a?a++:a=1,n.PaintImage.checkImage(o,!e.__.__font,e,i,s))continue;if(!o.style){1===a&&o.image.isPlacehold&&e.drawImagePlaceholder(o,i,s);continue}}if(i.fillStyle=o.style,o.transform||r.scaleFixed){if(i.save(),o.transform&&i.transform(o.transform),r.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}r.blendMode&&(i.blendMode=r.blendMode),C(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),C(e,i,s),i.restoreBlendMode()):C(e,i,s)}},fillPathOrText:C,fillText:function(t,e,i){const n=t.__,{rows:s,decorationY:o}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,i=s.length;t<i;t++)r=s[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=n.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>o.forEach(n=>e.fillRect(t.x,t.y+n,t.width,i)))}},stroke:function(t,i,s,o){const r=i.__;if(r.__strokeWidth)if(r.__font)n.Paint.strokeText(t,i,s,o);else switch(r.strokeAlign){case"center":M(t,1,i,s,o);break;case"inside":!function(t,e,i,n){i.save(),i.clipUI(e),M(t,2,e,i,n),i.restore()}(t,i,s,o);break;case"outside":!function(t,i,n,s){const o=i.__;if(o.__fillAfterStroke)M(t,2,i,n,s);else{const{renderBounds:r}=i.__layout,a=n.getSameCanvas(!0,!0);i.__drawRenderPath(a),M(t,2,i,a,s),a.clipUI(o),a.clearWorld(r),e.LeafHelper.copyCanvasByWorld(i,n,a),a.recycle(i.__nowWorld)}}(t,i,s,o)}},strokes:function(t,e,i,s){n.Paint.stroke(t,e,i,s)},strokeText:function(t,e,i,n){switch(e.__.strokeAlign){case"center":O(t,1,e,i,n);break;case"inside":A(t,"inside",e,i,n);break;case"outside":e.__.__fillAfterStroke?O(t,2,e,i,n):A(t,"outside",e,i,n)}},drawTextStroke:function(t,e,i){let n,s=t.__.__textDrawData;const{rows:o,decorationY:r}=s;for(let t=0,i=o.length;t<i;t++)n=o[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(r){const{decorationHeight:t}=s;o.forEach(i=>r.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,o,r){let a;const h=s.__,{__hasMultiStrokeStyle:l}=h;l||o.setStroke(void 0,h.__strokeWidth*e,h);for(let c=0,d=t.length;c<d;c++)if(a=t[c],(!a.image||!n.PaintImage.checkImage(a,!1,s,o,r))&&a.style){if(l){const{strokeStyle:t}=a;t?o.setStroke(a.style,h.__getRealStrokeWidth(t)*e,h,t):o.setStroke(a.style,h.__strokeWidth*e,h)}else o.strokeStyle=a.style;a.originPaint.blendMode?(o.saveBlendMode(a.originPaint.blendMode),i?n.Paint.drawTextStroke(s,o,r):o.stroke(),o.restoreBlendMode()):i?n.Paint.drawTextStroke(s,o,r):o.stroke()}},shape:function(t,i,n){const s=i.getSameCanvas(),o=i.bounds,r=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,c,d,u,f,p;W(a.strokeSpread?(I(U,a.boxBounds,a.strokeSpread),U):a.boxBounds,r,h);let{scaleX:g,scaleY:m}=t.getRenderScaleData(!0);if(o.includes(h))p=s,l=f=h,c=r;else{let s;if(e.Platform.fullImageShadow)s=h;else{const t=a.renderShapeSpread?D(o,e.FourNumberHelper.swapAndScale(a.renderShapeSpread,g,m)):o;s=z(t,h)}u=o.getFitMatrix(s);let{a:_,d:w}=u;u.a<1&&(p=i.getSameCanvas(),t.__renderShape(p,n),g*=_,m*=w),f=H(h,u),l=F(f,-u.e,-u.f),c=H(r,u),j(c,-u.e,-u.f);const v=n.matrix;v?(d=new e.Matrix(u),d.multiply(v),_*=v.scaleX,w*=v.scaleY):d=u,d.withScale(_,w),n=Object.assign(Object.assign({},n),{matrix:d})}return t.__renderShape(s,n),{canvas:s,matrix:d,fitMatrix:u,bounds:l,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:m}}};let q,K=new e.Bounds;const{isSame:Q}=e.BoundsHelper;function $(t,e,i,s,o,r){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 o.data||n.PaintImage.createData(o,s,i,r),!0}function Z(t,i){et(t,e.ImageEvent.LOAD,i)}function J(t,i){et(t,e.ImageEvent.LOADED,i)}function tt(t,i,n){i.error=n,t.forceUpdate("surface"),et(t,e.ImageEvent.ERROR,i)}function et(t,i,n){t.hasEvent(i)&&t.emitEvent(new e.ImageEvent(i,n))}function it(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:nt,translate:st}=e.MatrixHelper,ot=new e.Bounds,rt={},at={};function ht(t,i,n,s){const o=e.isString(t)||s?(s?n-s*i:n%i)/((s||Math.floor(n/i))-1):t;return"auto"===t&&o<0?0:o}let lt={},ct=e.getMatrixData();const{get:dt,set:ut,rotateOfOuter:ft,translate:pt,scaleOfOuter:gt,multiplyParent:mt,scale:_t,rotate:wt,skew:vt}=e.MatrixHelper;function yt(t,e,i,n,s,o,r,a){r&&wt(t,r),a&&vt(t,a.x,a.y),s&&_t(t,s,o),pt(t,e.x+i,e.y+n)}function xt(t,e,i,n){return new(i||(i=Promise))(function(s,o){function r(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,a)}h((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:Pt,scale:bt,copy:Lt}=e.MatrixHelper,{getFloorScale:Et}=e.MathHelper,{abs:Bt}=Math;const St={image:function(t,i,n,s,o){let r,a;const h=e.ImageManager.get(n);return q&&n===q.paint&&Q(s,q.boxBounds)?r=q.leafPaint:(r={type:n.type,image:h},h.hasAlphaPixel&&(r.isTransparent=!0),q=h.use>1?{leafPaint:r,paint:n,boxBounds:K.set(s)}:null),(o||h.loading)&&(a={image:h,attrName:i,attrValue:n}),h.ready?($(t,i,n,h,r,s),o&&(Z(t,a),J(t,a))):h.error?o&&tt(t,a,h.error):(o&&(it(t,!0),Z(t,a)),r.loadId=h.load(()=>{it(t,!1),t.destroyed||($(t,i,n,h,r,s)&&(h.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),J(t,a)),r.loadId=void 0},e=>{it(t,!1),tt(t,a,e),r.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{h.ready||(h.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):h.isPlacehold=!0)),r},checkImage:function(t,i,s,o,r){const{scaleX:a,scaleY:h}=n.PaintImage.getImageRenderScaleData(t,s,o,r),{image:l,data:c,originPaint:d}=t,{exporting:u}=r;return!(!c||t.patternId===a+"-"+h&&!u)&&(i&&(c.repeat?i=!1:d.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(s)||u||(i=e.Platform.image.isLarge(l,a,h)||l.width*a>8096||l.height*h>8096)),i?(s.__.__isFastShadow&&(o.fillStyle=t.style||"#000",o.fill()),n.PaintImage.drawImage(t,a,h,s,o,r),!0):(!t.style||d.sync||u?n.PaintImage.createPattern(t,s,o,r):n.PaintImage.createPatternTask(t,s,o,r),!1))},drawImage:function(t,e,i,n,s,o){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:c}=r,d=a.getFull(r.filters),u=n.__;let f,{width:p,height:g}=a;(f=c&&!c.onlyScale||u.path||u.cornerRadius)||l||h?(s.save(),f&&s.clipUI(n),h&&(s.blendMode=h),l&&(s.opacity*=l),c&&s.transform(c),s.drawImage(d,0,0,p,g),s.restore()):(r.scaleX&&(p*=r.scaleX,g*=r.scaleY),s.drawImage(d,0,0,p,g))},getImageRenderScaleData:function(t,e,i,n){const s=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;s.scaleX*=t,s.scaleY*=t}return o&&o.scaleX&&(s.scaleX*=Math.abs(o.scaleX),s.scaleY*=Math.abs(o.scaleY)),s},recycleImage:function(t,i){const n=i["_"+t];if(e.isArray(n)){let s,o,r,a,h;for(let l=0,c=n.length;l<c;l++)s=n[l],o=s.image,h=o&&o.url,h&&(r||(r={}),r[h]=!0,e.ImageManager.recyclePaint(s),o.loading&&(a||(a=i.__input&&i.__input[t]||[],e.isArray(a)||(a=[a])),o.unload(n[l].loadId,!a.some(t=>t.url===h))));return r}return null},createPatternTask:function(t,i,s,o){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>xt(this,void 0,void 0,function*(){t.patternTask=null,s.bounds.hit(i.__nowWorld)&&n.PaintImage.createPattern(t,i,s,o),i.forceUpdate("surface")}),300))},createPattern:function(t,i,s,o){let{scaleX:r,scaleY:a}=n.PaintImage.getImageRenderScaleData(t,i,s,o),h=r+"-"+a;if(t.patternId!==h&&!i.destroyed&&(!e.Platform.image.isLarge(t.image,r,a)||t.data.repeat)){const{image:s,data:o}=t,{transform:l,gap:c}=o,d=n.PaintImage.getPatternFixScale(t,r,a);let u,f,p,{width:g,height:m}=s;d&&(r*=d,a*=d),g*=r,m*=a,c&&(f=c.x*r/Bt(o.scaleX||1),p=c.y*a/Bt(o.scaleY||1)),(l||1!==r||1!==a)&&(r*=Et(g+(f||0)),a*=Et(m+(p||0)),u=Pt(),l&&Lt(u,l),bt(u,1/r,1/a));const _=s.getCanvas(g,m,o.opacity,o.filters,f,p,i.leafer&&i.leafer.config.smooth),w=s.getPattern(_,o.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=w,t.patternId=h}},getPatternFixScale:function(t,i,n){const{image:s}=t;let o,r=e.Platform.image.maxPatternSize,a=s.width*s.height;return s.isSVG?i>1&&(o=Math.ceil(i)/i):r>a&&(r=a),(a*=i*n)>r&&(o=Math.sqrt(r/a)),o},createData:function(t,e,i,s){t.data=n.PaintImage.getPatternData(i,s,e)},getPatternData:function(t,i,s){t.padding&&(i=ot.set(i).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:o,height:r}=s,{opacity:a,mode:h,align:l,offset:c,scale:d,size:u,rotation:f,skew:p,clipSize:g,repeat:m,gap:_,filters:w}=t,v=i.width===o&&i.height===r,y={mode:h},x="center"!==l&&(f||0)%180==90;let P,b;switch(e.BoundsHelper.set(at,0,0,x?r:o,x?o:r),h&&"cover"!==h&&"fit"!==h?((d||u)&&(e.MathHelper.getScaleData(d,u,s,rt),P=rt.scaleX,b=rt.scaleY),(l||_||m)&&(P&&e.BoundsHelper.scale(at,P,b,!0),l&&e.AlignHelper.toPoint(l,at,i,at,!0,!0))):v&&!f||(P=b=e.BoundsHelper.getFitScale(i,at,"fit"!==h),e.BoundsHelper.put(i,s,l,P,!1,at),e.BoundsHelper.scale(at,P,b,!0)),c&&e.PointHelper.move(at,c),h){case"stretch":v?P&&(P=b=void 0):(P=i.width/o,b=i.height/r,n.PaintImage.stretchMode(y,i,P,b));break;case"normal":case"clip":if(at.x||at.y||P||g||f||p){let t,e;g&&(t=i.width/g.width,e=i.height/g.height),n.PaintImage.clipMode(y,i,at.x,at.y,P,b,f,p,t,e),t&&(P=P?P*t:t,b=b?b*e:e)}break;case"repeat":(!v||P||f||p)&&n.PaintImage.repeatMode(y,i,o,r,at.x,at.y,P,b,f,p,l,t.freeTransform),m||(y.repeat="repeat");const s=e.isObject(m);(_||s)&&(y.gap=function(t,i,n,s,o){let r,a;e.isObject(t)?(r=t.x,a=t.y):r=a=t;return{x:ht(r,n,o.width,i&&i.x),y:ht(a,s,o.height,i&&i.y)}}(_,s&&m,at.width,at.height,i));break;default:P&&n.PaintImage.fillOrFitMode(y,i,at.x,at.y,P,b,f)}return y.transform||(i.x||i.y)&&st(y.transform=nt(),i.x,i.y),P&&(y.scaleX=P,y.scaleY=b),a&&a<1&&(y.opacity=a),w&&(y.filters=w),m&&(y.repeat=e.isString(m)?"x"===m?"repeat-x":"repeat-y":"repeat"),y},stretchMode:function(t,e,i,n){const s=dt(),{x:o,y:r}=e;o||r?pt(s,o,r):s.onlyScale=!0,_t(s,i,n),t.transform=s},fillOrFitMode:function(t,e,i,n,s,o,r){const a=dt();pt(a,e.x+i,e.y+n),_t(a,s,o),r&&ft(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,n,s,o,r,a,h,l){const c=dt();yt(c,e,i,n,s,o,r,a),h&&(r||a?(ut(ct),gt(ct,e,h,l),mt(c,ct)):gt(c,e,h,l)),t.transform=c},repeatMode:function(t,e,i,n,s,o,r,a,h,l,c,d){const u=dt();if(d)yt(u,e,s,o,r,a,h,l);else{if(h)if("center"===c)ft(u,{x:i/2,y:n/2},h);else switch(wt(u,h),h){case 90:pt(u,n,0);break;case 180:pt(u,i,n);break;case 270:pt(u,0,i)}lt.x=e.x+s,lt.y=e.y+o,pt(u,lt.x,lt.y),r&>(u,lt,r,a)}t.transform=u}},{toPoint:kt}=e.AroundHelper,{hasTransparent:Rt}=n.ColorConvert,Tt={},Ct={};function Mt(t,i,s,o){if(s){let r,a,h,l;for(let t=0,c=s.length;t<c;t++)r=s[t],e.isString(r)?(h=t/(c-1),a=n.ColorConvert.string(r,o)):(h=r.offset,a=n.ColorConvert.string(r.color,o)),i.addColorStop(h,a),!l&&Rt(a)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:Ot,getDistance:At}=e.PointHelper,{get:Dt,rotateOfOuter:It,scaleOfOuter:Wt}=e.MatrixHelper,{toPoint:Ht}=e.AroundHelper,Ft={},jt={};function zt(t,e,i,n,s){let o;const{width:r,height:a}=t;if(r!==a||n){const t=Ot(e,i);o=Dt(),s?(Wt(o,e,r/a*(n||1),1),It(o,e,t+90)):(Wt(o,e,1,r/a*(n||1)),It(o,e,t))}return o}const{getDistance:Ut}=e.PointHelper,{toPoint:Gt}=e.AroundHelper,Yt={},Xt={};const Nt={linearGradient:function(t,i){let{from:n,to:s,type:o,opacity:r}=t;kt(n||"top",i,Tt),kt(s||"bottom",i,Ct);const a=e.Platform.canvas.createLinearGradient(Tt.x,Tt.y,Ct.x,Ct.y),h={type:o,style:a};return Mt(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:n,to:s,type:o,opacity:r,stretch:a}=t;Ht(n||"center",i,Ft),Ht(s||"bottom",i,jt);const h=e.Platform.canvas.createRadialGradient(Ft.x,Ft.y,0,Ft.x,Ft.y,At(Ft,jt)),l={type:o,style:h};Mt(l,h,t.stops,r);const c=zt(i,Ft,jt,a,!0);return c&&(l.transform=c),l},conicGradient:function(t,i){let{from:n,to:s,type:o,opacity:r,stretch:a}=t;Gt(n||"center",i,Yt),Gt(s||"bottom",i,Xt);const h=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,Yt.x,Yt.y):e.Platform.canvas.createRadialGradient(Yt.x,Yt.y,0,Yt.x,Yt.y,Ut(Yt,Xt)),l={type:o,style:h};Mt(l,h,t.stops,r);const c=zt(i,Yt,Xt,a||1,e.Platform.conicGradientRotate90);return c&&(l.transform=c),l},getTransform:zt},{copy:Vt,move:qt,toOffsetOutBounds:Kt}=e.BoundsHelper,{max:Qt,abs:$t}=Math,Zt={},Jt=new e.Matrix,te={};function ee(t,e){let i,n,s,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,n=t.y||0,o=1.5*(t.blur||0),s=$t(t.spread||0),r=Qt(r,s+o-n),a=Qt(a,s+o+i),h=Qt(h,s+o+n),l=Qt(l,s+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function ie(t,i,n){const{shapeBounds:s}=n;let o,r;e.Platform.fullImageShadow?(Vt(Zt,t.bounds),qt(Zt,i.x-s.x,i.y-s.y),o=t.bounds,r=Zt):(o=s,r=i),t.copyWorld(n.canvas,o,r)}const{toOffsetOutBounds:ne}=e.BoundsHelper,se={};const oe=ee;const re={shadow:function(t,i,s){let o,r;const{__nowWorld:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:c,renderBounds:d,shapeBounds:u,scaleX:f,scaleY:p}=s,g=i.getSameCanvas(),m=h.length-1;Kt(c,te,d),h.forEach((h,_)=>{let w=1;if(h.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(te.offsetX+(h.x||0)*f*w,te.offsetY+(h.y||0)*p*w,(h.blur||0)*f*w,n.ColorConvert.string(h.color)),r=n.Effect.getShadowTransform(t,g,s,h,te,w),r&&g.setTransform(r),ie(g,te,s),r&&g.resetTransform(),o=d,h.box&&(g.restore(),g.save(),l&&(g.copyWorld(g,d,a,"copy"),o=a),l?g.copyWorld(l,a,a,"destination-out"):g.copyWorld(s.canvas,u,c,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,i,g,o,h.blendMode),m&&_<m&&g.clearWorld(o)}),g.recycle(o)},innerShadow:function(t,i,s){let o,r;const{__nowWorld:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:c,renderBounds:d,shapeBounds:u,scaleX:f,scaleY:p}=s,g=i.getSameCanvas(),m=h.length-1;ne(c,se,d),h.forEach((h,_)=>{let w=1;if(h.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(se.offsetX+(h.x||0)*f*w,se.offsetY+(h.y||0)*p*w,(h.blur||0)*f*w),r=n.Effect.getShadowTransform(t,g,s,h,se,w,!0),r&&g.setTransform(r),ie(g,se,s),g.restore(),l?(g.copyWorld(g,d,a,"copy"),g.copyWorld(l,a,a,"source-out"),o=a):(g.copyWorld(s.canvas,u,c,"source-out"),o=d),g.fillWorld(o,n.ColorConvert.string(h.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,i,g,o,h.blendMode),m&&_<m&&g.clearWorld(o)}),g.recycle(o)},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){},getShadowRenderSpread:ee,getShadowTransform:function(t,e,i,n,s,o,r){if(n.spread){const i=2*n.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Jt.set().scaleOfOuter({x:(s.x+s.width/2)*e.pixelRatio,y:(s.y+s.height/2)*e.pixelRatio},1+i/a,1+i/h),Jt}},isTransformShadow(t){},getInnerShadowSpread:oe},{excludeRenderBounds:ae}=e.LeafBoundsHelper;let he;function le(t,e,i,n,s,o,r,a){switch(e){case"grayscale":he||(he=!0,s.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,s,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),o&&n.recycle(r);de(t,e,i,1,s,o)}(t,i,n,s,r,a);break;case"opacity-path":de(t,i,n,o,r,a);break;case"path":a&&i.restore()}}function ce(t){return t.getSameCanvas(!1,!0)}function de(t,e,i,n,s,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,s),o?i.recycle(r):i.clearWorld(r)}n.Group.prototype.__renderMask=function(t,e){let i,n,s,o,r,a;const{children:h}=this;for(let l=0,c=h.length;l<c;l++){if(i=h[l],a=i.__.mask,a){r&&(le(this,r,t,s,n,o,void 0,!0),n=s=null),"clipping"!==a&&"clipping-path"!==a||ae(i,e)||i.__render(t,e),o=i.__.opacity,he=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",s||(s=ce(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===a?"grayscale":"alpha",n||(n=ce(t)),s||(s=ce(t)),i.__render(n,e));continue}const c=1===o&&i.__.__blendMode;c&&le(this,r,t,s,n,o,void 0,!1),ae(i,e)||i.__render(s||t,e),c&&le(this,r,t,s,n,o,c,!1)}le(this,r,t,s,n,o,void 0,!0)};const ue=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",fe=ue+"_#~&*+\\=|≮≯≈≠=…",pe=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 ge(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const me=ge("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),_e=ge("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),we=ge(ue),ve=ge(fe),ye=ge("- —/~|┆·");var xe;!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"}(xe||(xe={}));const{Letter:Pe,Single:be,Before:Le,After:Ee,Symbol:Be,Break:Se}=xe;function ke(t){return me[t]?Pe:ye[t]?Se:_e[t]?Le:we[t]?Ee:ve[t]?Be:pe.test(t)?be:Pe}const Re={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Te(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:Ce}=Re,{Letter:Me,Single:Oe,Before:Ae,After:De,Symbol:Ie,Break:We}=xe;let He,Fe,je,ze,Ue,Ge,Ye,Xe,Ne,Ve,qe,Ke,Qe,$e,Ze,Je,ti,ei=[];function ii(t,e){Ne&&!Xe&&(Xe=Ne),He.data.push({char:t,width:e}),je+=e}function ni(){ze+=je,He.width=je,Fe.words.push(He),He={data:[]},je=0}function si(){$e&&(Ze.paraNumber++,Fe.paraStart=!0,$e=!1),Ne&&(Fe.startCharSize=Xe,Fe.endCharSize=Ne,Xe=0),Fe.width=ze,Je.width?Ce(Fe):ti&&oi(),ei.push(Fe),Fe={words:[]},ze=0}function oi(){ze>(Ze.maxWidth||0)&&(Ze.maxWidth=ze)}const{top:ri,right:ai,bottom:hi,left:li}=e.Direction4;function ci(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 di={getDrawData:function(t,i){e.isString(t)||(t=String(t));let s=0,o=0,r=i.__getInput("width")||0,a=i.__getInput("height")||0;const{__padding:h}=i;h&&(r?(s=h[li],r-=h[ai]+h[li],!r&&(r=.01)):i.autoSizeAlign||(s=h[li]),a?(o=h[ri],a-=h[ri]+h[hi],!a&&(a=.01)):i.autoSizeAlign||(o=h[ri]));const l={bounds:{x:s,y:o,width:r,height:a},rows:[],paraNumber:0,font:e.Platform.canvas.font=i.__font};return function(t,i,n){Ze=t,ei=t.rows,Je=t.bounds,ti=!Je.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:r}=n,{canvas:a}=e.Platform,{width:h}=Je;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;$e=!0,qe=null,Xe=Ye=Ne=je=ze=0,He={data:[]},Fe={words:[]},s&&(i=[...i]);for(let n=0,l=i.length;n<l;n++)Ge=i[n],"\n"===Ge?(je&&ni(),Fe.paraEnd=!0,si(),$e=!0):(Ve=ke(Ge),Ve===Me&&"none"!==r&&(Ge=Te(Ge,r,!je)),Ye=a.measureText(Ge).width,s&&(s<0&&(Ne=Ye),Ye+=s),Ke=Ve===Oe&&(qe===Oe||qe===Me)||qe===Oe&&Ve!==De,Qe=!(Ve!==Ae&&Ve!==Oe||qe!==Ie&&qe!==De),Ue=$e&&o?h-o:h,t&&h&&ze+je+Ye>Ue&&(e?(je&&ni(),ze&&si()):(Qe||(Qe=Ve===Me&&qe==De),Ke||Qe||Ve===We||Ve===Ae||Ve===Oe||je+Ye>Ue?(je&&ni(),ze&&si()):ze&&si()))," "===Ge&&!0!==$e&&ze+je===0||(Ve===We?(" "===Ge&&je&&ni(),ii(Ge,Ye),ni()):Ke||Qe?(je&&ni(),ii(Ge,Ye)):ii(Ge,Ye)),qe=Ve);je&&ni(),ze&&si(),ei.length>0&&(ei[ei.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ze.paraNumber++,ze=a.measureText(t).width,ei.push({x:o||0,text:t,width:ze,paraStart:!0}),ti&&oi()})}(l,t,i),h&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ci(e,"x",t[li]);break;case"right":ci(e,"x",-t[ai])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ci(e,"y",t[ri]);break;case"bottom":ci(e,"y",-t[hi])}}(h,l,i,r,a),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:m}=n,_=o*s+(d?d*(t.paraNumber-1):0),w=r;if(h&&_>m)_=Math.max(m,o),s>1&&(t.overflow=s);else if(m||u)switch(c){case"middle":p+=(m-_)/2;break;case"bottom":p+=m-_}w+=p;let v,y,x,P=g||u?g:t.maxWidth;for(let r=0,c=s;r<c;r++){if(v=i[r],v.x=f,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(P-v.width)/2;break;case"right":v.x+=P-v.width}v.paraStart&&d&&r>0&&(w+=d),v.y=w,w+=o,t.overflow>r&&w>_&&(v.isOverflow=!0,t.overflow=r+1),y=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,y-=x,x+=e.fontSize):x-=a),y<n.x&&(n.x=y),x>n.width&&(n.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=p,n.height=_}(l,i),i.__isCharMode&&function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:o,letterSpacing:r}=e,a=i&&s.includes("both"),h=a||i&&s.includes("justify"),l=h&&s.includes("letter");let c,d,u,f,p,g,m,_,w,v;n.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,_=t.words.length,h&&(v=!t.paraEnd||a,d=i-t.width-p,l?f=d/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=_>1?d/(_-1):0),g=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,c=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(m={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,m),(t.isOverflow||" "!==m.char)&&t.data.push(m)):c=function(t,e,i,n,s){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,s&&(e+=s)}),e}(e.data,c,t.data,t.isOverflow,v&&f),v&&(w=i===_-1,u?w||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(w?1:0))))})),t.words=null)})}(l,i,r),l.overflow&&function(t,i,n,s){if(!s)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.Platform.canvas.measureText(a).width:0,c=n+s-l;("none"===i.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let n=i;n>-1&&(t=e.data[n],h=t.x+t.width,!(n===i&&h<c));n--){if(h<c&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(l,i,s,r),"none"!==i.textDecoration&&function(t,i){let s,o=0;const{fontSize:r,textDecoration:a}=i;switch(t.decorationHeight=r/11,e.isObject(a)?(s=a.type,a.color&&(t.decorationColor=n.ColorConvert.string(a.color)),a.offset&&(o=Math.min(.3*r,Math.max(a.offset,.15*-r)))):s=a,s){case"under":t.decorationY=[.15*r+o];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+o,.35*-r]}}(l,i),l}};const ui={string:function(t,i){if(!t)return"#000";const s=e.isNumber(i)&&i<1;if(e.isString(t)){if(!s||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let o=e.isUndefined(t.a)?1:t.a;s&&(o*=i);const r=t.r+","+t.g+","+t.b;return 1===o?"rgb("+r+")":"rgba("+r+","+o+")"}};Object.assign(n.TextConvert,di),Object.assign(n.ColorConvert,ui),Object.assign(n.Paint,V),Object.assign(n.PaintImage,St),Object.assign(n.PaintGradient,Nt),Object.assign(n.Effect,re),Object.assign(e.Creator,{interaction:(t,e,i,n)=>new T(t,e,i,n),hitCanvas:(t,e)=>new o(t,e),hitCanvasManager:()=>new i.HitCanvasManager}),h(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Interaction=T,exports.Layouter=x,exports.LeaferCanvas=o,exports.Picker=E,exports.Renderer=b,exports.Selector=B,exports.Watcher=c,exports.useCanvas=h,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]}})}),Object.keys(i).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return i[t]}})});
|
|
1
|
+
"use strict";var t,e=require("@leafer/core"),i=require("@leafer-ui/core"),n=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";const s=e.Debug.get("LeaferCanvas");class o extends e.LeaferCanvasBase{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const n=i.children[t];n?(this.setAbsolute(n),i.insertBefore(e,n)):i.appendChild(n)}}init(){const{config:t}=this,i=t.view||t.canvas;i?this.__createViewFrom(i):this.__createView();const{style:n}=this.view;if(n.display||(n.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}e.Platform.syncDomFont&&!this.parentView&&(n.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let i=e.isString(t)?document.getElementById(t):t;if(i)if(i instanceof HTMLCanvasElement)this.view=i;else{let t=i;if(i===window||i===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const e=this.view;t.hasChildNodes()&&(this.setAbsolute(e),t.style.position||(t.style.position="relative")),t.appendChild(e)}else s.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:n}=this.view;n.width=t+"px",n.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),s.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.Platform.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=e.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const i=this.view,{x:n,y:s,width:o,height:r}=this.autoBounds.getBoundsFrom(t),a={width:o,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.Platform.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=i;t.marginLeft=n+"px",t.marginTop=s+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const i={};e.DataHelper.copyAttrs(i,this,e.canvasSizeAttrs),this.resize(t),this.resizeListener&&!e.isUndefined(this.width)&&this.resizeListener(new e.ResizeEvent(t,i))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}e.canvasPatch(CanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r,fileType:a}=e.FileHelper;function h(t,i){e.Platform.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const n=r(e),s=t.toDataURL(n,i);return"image/bmp"===n?s.replace("image/png;","image/bmp;"):s},canvasToBolb:(t,e,i)=>new Promise(n=>t.toBlob(n,r(e),i)),canvasSaveAs:(t,i,n)=>{const s=t.toDataURL(r(a(i)),n);return e.Platform.origin.download(s,i)},download:(t,e)=>new Promise(i=>{let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),i()}),loadImage:t=>new Promise((i,n)=>{const s=new e.Platform.origin.Image,{crossOrigin:o}=e.Platform.image;o&&(s.setAttribute("crossOrigin",o),s.crossOrigin=o),s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=e.Platform.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.Platform.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new o(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isMobile="ontouchstart"in window,e.Platform.requestRender=function(t){window.requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:l}=navigator;l.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0,e.Platform.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),l.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):l.indexOf("Mac")>-1?e.Platform.os="Mac":l.indexOf("Linux")>-1&&(e.Platform.os="Linux");class c{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,i){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,i&&(this.config=e.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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.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 e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.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:d,updateBounds:u,updateChange:f}=e.LeafHelper,{pushAllChildBranch:p,pushAllParent:g}=e.BranchHelper;const{worldBounds:m}=e.LeafBoundsHelper;class v{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,m)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,m),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:w,updateAllChange:_}=e.LeafHelper,y=e.Debug.get("Layouter");class x{constructor(t,i){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,i&&(this.config=e.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:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const i=e.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:o,LAYOUT:r,AFTER:a}=e.LayoutEvent,h=this.getBlocks(s);h.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(o,h,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?(d(t,!0),e.add(t),t.isBranch&&p(t,e),g(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),g(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||u(n[t])}u(i)}})}(this.__levelList),function(t){t.list.forEach(f)}(s),this.extraBlock&&h.push(this.extraBlock),h.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(r,h,this.times)),n.emitEvent(new e.LayoutEvent(a,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updatedList=null,e.Run.end(i)}fullLayout(){const t=e.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:o}=e.LayoutEvent,r=this.getBlocks(new e.LeafList(i));i.emitEvent(new e.LayoutEvent(n,r,this.times)),x.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new e.LayoutEvent(s,r,this.times)),i.emitEvent(new e.LayoutEvent(o,r,this.times)),this.addBlocks(r),e.Run.end(t)}static fullLayout(t){w(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),_(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new v([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new v(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_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const P=e.Debug.get("Renderer");class b{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=i,n&&(this.config=e.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new e.Bounds,P.log(i.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,P.error(t)}P.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return P.warn("rendering");if(this.times>3)return P.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.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(t){const i=e.Run.start("PartRender"),{canvas:n}=this,s=t.getIntersect(n.bounds),o=new e.Bounds(s);n.save(),s.spread(b.clipSpread).ceil(),n.clearWorld(s),n.clipWorld(s),this.__render(s,o),n.restore(),e.Run.end(i)}fullRender(){const t=e.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),e.Run.end(t)}__render(t,i){const{canvas:n,target:s}=this,o=t.includes(s.__world),r=o?{includes:o}:{bounds:t,includes:o};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(r.cellList=this.getCellList()),e.Platform.render(s,n,r),this.renderBounds=i=i||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const i=new e.Bounds;i.setList(t),t.length=0,t.push(i)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(i);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:i,height:n}=t.old;if(!new e.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.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||P.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,i,n){this.target.emitEvent(new e.RenderEvent(t,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.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)}}b.clipSpread=10;const L={},{copyRadiusPoint:E}=e.PointHelper,{hitRadiusPoint:B}=e.BoundsHelper;class S{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,i,n){i||(i=0),n||(n={});const s=n.through||!1,o=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:i,radiusY:i},this.findList=new e.LeafList(n.findList),n.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:a}=this.findList,h=this.getBestMatchLeaf(a,n.bottomList,o,!!n.findList),l=o?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:a.length?this.getThroughPath(a):l}:{path:l,target:h}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,i,n,s){const o=this.findList=new e.LeafList;if(t.length){let i;const{x:s,y:r}=this.point,a={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(i=t[s],(n||e.LeafHelper.worldHittable(i))&&(this.hitChild(i,a),o.length)){if(i.isBranchLeaf&&t.some(t=>t!==i&&e.LeafHelper.hasParent(t,i))){o.reset();break}return o.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),o.length)return o.list[0];return s?null:n?t[0]:t.find(t=>e.LeafHelper.worldHittable(t))}getPath(t){const i=new e.LeafList,n=[],{target:s}=this;for(;t&&(t.syncEventer&&n.push(t.syncEventer),i.add(t),(t=t.parent)!==s););return n.length&&n.forEach(t=>{for(;t&&(t.__.hittable&&i.add(t),(t=t.parent)!==s););}),s&&i.add(s),i}getHitablePath(t){const i=this.getPath(t&&t.hittable?t:null);let n,s=new e.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren&&(!n.isLeafer||"draw"!==n.mode));t--);return s}getThroughPath(t){const i=new e.LeafList,n=[];for(let e=t.length-1;e>-1;e--)n.push(this.getPath(t[e]));let s,o,r;for(let t=0,e=n.length;t<e;t++){s=n[t],o=n[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!o||!o.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n,s;const{point:o}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],s=i.__,s.visible&&(!e||s.mask))if(n=B(i.__world,s.hitRadius?E(L,o,s.hitRadius):o),i.isBranch){if(n||i.__ignoreHitWorld){if(i.isBranchLeaf&&s.__clipAfterFill&&!i.__hitWorld(o,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else n&&this.hitChild(i,o)}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:o}=n;for(let n=0,r=o.length;n<r;n++)if(i=o[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 R{constructor(t,i){this.config={},i&&(this.config=e.DataHelper.default(i,this.config)),this.picker=new S(this.target=t,this),this.finder=e.Creator.finder&&e.Creator.finder()}getByPoint(t,i,n){const{target:s,picker:o}=this;return e.Platform.backgrounder&&s&&s.updateLayout(),o.getByPoint(t,i,n)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,i,n,s){return this.finder?this.finder.getBy(t,i,n,s):e.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(e.Creator,{watcher:(t,e)=>new c(t,e),layouter:(t,e)=>new x(t,e),renderer:(t,e,i)=>new b(t,e,i),selector:(t,e)=>new R(t,e)}),e.Platform.layout=x.fullLayout,e.Platform.render=function(t,i,n){const s=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(i,n),n.topList.length&&n.topList.forEach(t=>t.__render(i,s))};const k={convert(t,e){const n=i.InteractionHelper.getBase(t),{x:s,y:o}=e,r=Object.assign(Object.assign({},n),{x:s,y:o,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const n=i.InteractionHelper.getBase(t),{x:s,y:o}=e;return Object.assign(Object.assign({},n),{x:s,y:o,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const n=k.getTouch(t),s=i.InteractionHelper.getBase(t),{x:o,y:r}=e;return Object.assign(Object.assign({},s),{x:o,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},T={convert(t){const e=i.InteractionHelper.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:C}=i.InteractionHelper;class M extends i.InteractionBase{get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,n=t.length;i<n;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(T.convert(t))}onKeyUp(t){this.keyUp(T.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(k.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(k.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=k.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(k.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(k.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(k.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(k.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=k.getTouch(t),i=this.getLocal(e,!0),{preventDefault:n}=this.config.touch;(!0===n||"auto"===n&&C(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(k.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=k.getTouch(t);this.pointerMove(k.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=k.getTouch(t);this.pointerUp(k.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||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 e=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,e);n.length>1&&(this.multiTouch(i.InteractionHelper.getBase(t),n),this.touches=e)}}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))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},i.InteractionHelper.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const n=i.InteractionHelper.getBase(t);Object.assign(n,this.getLocal(t));const s=t.scale/this.lastGestureScale,o=(t.rotation-this.lastGestureRotation)/Math.PI*180*(e.MathHelper.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},n),{scale:s*s})),this.rotate(Object.assign(Object.assign({},n),{rotation:o})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const i=[];this.eachCursor(t,i),e.isObject(i[i.length-1])&&i.push("default"),this.canvas.view.style.cursor=i.map(t=>e.isObject(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,n,s=0){if(s++,e.isArray(t))t.forEach(t=>this.eachCursor(t,n,s));else{const o=e.isString(t)&&i.Cursor.get(t);o&&s<2?this.eachCursor(o,n,s):n.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function O(t,e,i){t.__.__font?n.Paint.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function A(t,i,s,o,r){const a=s.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,i,!1,s,o,r):(o.setStroke(t,a.__strokeWidth*i,a),o.stroke()),a.__useArrow&&n.Paint.strokeArrow(t,s,o,r)}function D(t,i,s,o,r){const a=s.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,i,!0,s,o,r):(o.setStroke(t,a.__strokeWidth*i,a),n.Paint.drawTextStroke(s,o,r))}function I(t,i,s,o,r){const a=o.getSameCanvas(!0,!0);a.font=s.__.__font,D(t,2,s,a,r),a.blendMode="outside"===i?"destination-out":"destination-in",n.Paint.fillText(s,a,r),a.blendMode="normal",e.LeafHelper.copyCanvasByWorld(s,o,a),a.recycle(s.__nowWorld)}const{getSpread:W,copyAndSpread:H,toOuterOf:F,getOuterOf:j,getByMove:z,move:G,getIntersectData:U}=e.BoundsHelper,Y={};let X;const{stintSet:N}=e.DataHelper,{hasTransparent:V}=n.ColorConvert;function q(t,i,s){if(!e.isObject(i)||!1===i.visible||0===i.opacity)return;let o;const{boxBounds:r}=s.__layout;switch(i.type){case"image":if(!i.url)return;o=n.PaintImage.image(s,t,i,r,!X||!X[i.url]);break;case"linear":o=n.PaintGradient.linearGradient(i,r);break;case"radial":o=n.PaintGradient.radialGradient(i,r);break;case"angular":o=n.PaintGradient.conicGradient(i,r);break;case"solid":const{type:a,color:h,opacity:l}=i;o={type:a,style:n.ColorConvert.string(h,l)};break;default:e.isUndefined(i.r)||(o={type:"solid",style:n.ColorConvert.string(i)})}if(o&&(o.originPaint=i,e.isString(o.style)&&V(o.style)&&(o.isTransparent=!0),i.style)){if(0===i.style.strokeWidth)return;o.strokeStyle=i.style}return o}const K={compute:function(t,i){const s=i.__,o=[];let r,a,h,l=s.__input[t];e.isArray(l)||(l=[l]),X=n.PaintImage.recycleImage(t,s);for(let e,n=0,s=l.length;n<s;n++)(e=q(t,l[n],i))&&(o.push(e),e.strokeStyle&&(h||(h=1),e.strokeStyle.strokeWidth&&(h=Math.max(h,e.strokeStyle.strokeWidth))));s["_"+t]=o.length?o:void 0,o.length?(o.every(t=>t.isTransparent)&&(o.some(t=>t.image)&&(r=!0),a=!0),"fill"===t?(N(s,"__isAlphaPixelFill",r),N(s,"__isTransparentFill",a)):(N(s,"__isAlphaPixelStroke",r),N(s,"__isTransparentStroke",a),N(s,"__hasMultiStrokeStyle",h))):s.__removePaint(t,!1)},fill:function(t,e,i,n){i.fillStyle=t,O(e,i,n)},fills:function(t,e,i,s){let o,r,a;for(let h=0,l=t.length;h<l;h++){if(o=t[h],r=o.originPaint,o.image){if(a?a++:a=1,n.PaintImage.checkImage(o,!e.__.__font,e,i,s))continue;if(!o.style){1===a&&o.image.isPlacehold&&e.drawImagePlaceholder(o,i,s);continue}}if(i.fillStyle=o.style,o.transform||r.scaleFixed){if(i.save(),o.transform&&i.transform(o.transform),r.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}r.blendMode&&(i.blendMode=r.blendMode),O(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),O(e,i,s),i.restoreBlendMode()):O(e,i,s)}},fillPathOrText:O,fillText:function(t,e,i){const n=t.__,{rows:s,decorationY:o}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,i=s.length;t<i;t++)r=s[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(o){const{decorationColor:t,decorationHeight:i}=n.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>o.forEach(n=>e.fillRect(t.x,t.y+n,t.width,i)))}},stroke:function(t,i,s,o){const r=i.__;if(r.__strokeWidth)if(r.__font)n.Paint.strokeText(t,i,s,o);else switch(r.strokeAlign){case"center":A(t,1,i,s,o);break;case"inside":!function(t,e,i,n){i.save(),i.clipUI(e),A(t,2,e,i,n),i.restore()}(t,i,s,o);break;case"outside":!function(t,i,n,s){const o=i.__;if(o.__fillAfterStroke)A(t,2,i,n,s);else{const{renderBounds:r}=i.__layout,a=n.getSameCanvas(!0,!0);i.__drawRenderPath(a),A(t,2,i,a,s),a.clipUI(o),a.clearWorld(r),e.LeafHelper.copyCanvasByWorld(i,n,a),a.recycle(i.__nowWorld)}}(t,i,s,o)}},strokes:function(t,e,i,s){n.Paint.stroke(t,e,i,s)},strokeText:function(t,e,i,n){switch(e.__.strokeAlign){case"center":D(t,1,e,i,n);break;case"inside":I(t,"inside",e,i,n);break;case"outside":e.__.__fillAfterStroke?D(t,2,e,i,n):I(t,"outside",e,i,n)}},drawTextStroke:function(t,e,i){let n,s=t.__.__textDrawData;const{rows:o,decorationY:r}=s;for(let t=0,i=o.length;t<i;t++)n=o[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(r){const{decorationHeight:t}=s;o.forEach(i=>r.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,o,r){let a;const h=s.__,{__hasMultiStrokeStyle:l}=h;l||o.setStroke(void 0,h.__strokeWidth*e,h);for(let c=0,d=t.length;c<d;c++)if(a=t[c],(!a.image||!n.PaintImage.checkImage(a,!1,s,o,r))&&a.style){if(l){const{strokeStyle:t}=a;t?o.setStroke(a.style,h.__getRealStrokeWidth(t)*e,h,t):o.setStroke(a.style,h.__strokeWidth*e,h)}else o.strokeStyle=a.style;a.originPaint.blendMode?(o.saveBlendMode(a.originPaint.blendMode),i?n.Paint.drawTextStroke(s,o,r):o.stroke(),o.restoreBlendMode()):i?n.Paint.drawTextStroke(s,o,r):o.stroke()}},shape:function(t,i,n){const s=i.getSameCanvas(),o=i.bounds,r=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,c,d,u,f,p;F(a.strokeSpread?(H(Y,a.boxBounds,a.strokeSpread),Y):a.boxBounds,r,h);let{scaleX:g,scaleY:m}=t.getRenderScaleData(!0);if(o.includes(h))p=s,l=f=h,c=r;else{let s;if(e.Platform.fullImageShadow)s=h;else{const t=a.renderShapeSpread?W(o,e.FourNumberHelper.swapAndScale(a.renderShapeSpread,g,m)):o;s=U(t,h)}u=o.getFitMatrix(s);let{a:v,d:w}=u;u.a<1&&(p=i.getSameCanvas(),t.__renderShape(p,n),g*=v,m*=w),f=j(h,u),l=z(f,-u.e,-u.f),c=j(r,u),G(c,-u.e,-u.f);const _=n.matrix;_?(d=new e.Matrix(u),d.multiply(_),v*=_.scaleX,w*=_.scaleY):d=u,d.withScale(v,w),n=Object.assign(Object.assign({},n),{matrix:d})}return t.__renderShape(s,n),{canvas:s,matrix:d,fitMatrix:u,bounds:l,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:m}}};let Q,$=new e.Bounds;const{isSame:Z}=e.BoundsHelper;function J(t,e,i,s,o,r){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 o.data||n.PaintImage.createData(o,s,i,r),!0}function tt(t,i){nt(t,e.ImageEvent.LOAD,i)}function et(t,i){nt(t,e.ImageEvent.LOADED,i)}function it(t,i,n){i.error=n,t.forceUpdate("surface"),nt(t,e.ImageEvent.ERROR,i)}function nt(t,i,n){t.hasEvent(i)&&t.emitEvent(new e.ImageEvent(i,n))}function st(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:ot,translate:rt}=e.MatrixHelper,at=new e.Bounds,ht={},lt={};function ct(t,i,n,s){const o=e.isString(t)||s?(s?n-s*i:n%i)/((s||Math.floor(n/i))-1):t;return"auto"===t&&o<0?0:o}let dt={},ut=e.getMatrixData();const{get:ft,set:pt,rotateOfOuter:gt,translate:mt,scaleOfOuter:vt,multiplyParent:wt,scale:_t,rotate:yt,skew:xt}=e.MatrixHelper;function Pt(t,e,i,n,s,o,r,a){r&&yt(t,r),a&&xt(t,a.x,a.y),s&&_t(t,s,o),mt(t,e.x+i,e.y+n)}function bt(t,e,i,n){return new(i||(i=Promise))(function(s,o){function r(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,a)}h((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:Lt,scale:Et,copy:Bt}=e.MatrixHelper,{getFloorScale:St}=e.MathHelper,{abs:Rt}=Math;const kt={image:function(t,i,n,s,o){let r,a;const h=e.ImageManager.get(n);return Q&&n===Q.paint&&Z(s,Q.boxBounds)?r=Q.leafPaint:(r={type:n.type,image:h},h.hasAlphaPixel&&(r.isTransparent=!0),Q=h.use>1?{leafPaint:r,paint:n,boxBounds:$.set(s)}:null),(o||h.loading)&&(a={image:h,attrName:i,attrValue:n}),h.ready?(J(t,i,n,h,r,s),o&&(tt(t,a),et(t,a))):h.error?o&&it(t,a,h.error):(o&&(st(t,!0),tt(t,a)),r.loadId=h.load(()=>{st(t,!1),t.destroyed||(J(t,i,n,h,r,s)&&(h.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),et(t,a)),r.loadId=void 0},e=>{st(t,!1),it(t,a,e),r.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{h.ready||(h.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):h.isPlacehold=!0)),r},checkImage:function(t,i,s,o,r){const{scaleX:a,scaleY:h}=n.PaintImage.getImageRenderScaleData(t,s,o,r),{image:l,data:c,originPaint:d}=t,{exporting:u}=r;return!(!c||t.patternId===a+"-"+h&&!u)&&(i&&(c.repeat?i=!1:d.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(s)||u||(i=e.Platform.image.isLarge(l,a,h)||l.width*a>8096||l.height*h>8096)),i?(s.__.__isFastShadow&&(o.fillStyle=t.style||"#000",o.fill()),n.PaintImage.drawImage(t,a,h,s,o,r),!0):(!t.style||d.sync||u?n.PaintImage.createPattern(t,s,o,r):n.PaintImage.createPatternTask(t,s,o,r),!1))},drawImage:function(t,e,i,n,s,o){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:c}=r,d=a.getFull(r.filters),u=n.__;let f,{width:p,height:g}=a;(f=c&&!c.onlyScale||u.path||u.cornerRadius)||l||h?(s.save(),f&&s.clipUI(n),h&&(s.blendMode=h),l&&(s.opacity*=l),c&&s.transform(c),s.drawImage(d,0,0,p,g),s.restore()):(r.scaleX&&(p*=r.scaleX,g*=r.scaleY),s.drawImage(d,0,0,p,g))},getImageRenderScaleData:function(t,e,i,n){const s=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;s.scaleX*=t,s.scaleY*=t}return o&&o.scaleX&&(s.scaleX*=Math.abs(o.scaleX),s.scaleY*=Math.abs(o.scaleY)),s},recycleImage:function(t,i){const n=i["_"+t];if(e.isArray(n)){let s,o,r,a,h;for(let l=0,c=n.length;l<c;l++)s=n[l],o=s.image,h=o&&o.url,h&&(r||(r={}),r[h]=!0,e.ImageManager.recyclePaint(s),o.loading&&(a||(a=i.__input&&i.__input[t]||[],e.isArray(a)||(a=[a])),o.unload(n[l].loadId,!a.some(t=>t.url===h))));return r}return null},createPatternTask:function(t,i,s,o){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>bt(this,void 0,void 0,function*(){n.PaintImage.createPattern(t,i,s,o),i.forceUpdate("surface")}),0,()=>(t.patternTask=null,s.bounds.hit(i.__nowWorld))))},createPattern:function(t,i,s,o){let{scaleX:r,scaleY:a}=n.PaintImage.getImageRenderScaleData(t,i,s,o),h=r+"-"+a;if(t.patternId!==h&&!i.destroyed&&(!e.Platform.image.isLarge(t.image,r,a)||t.data.repeat)){const{image:s,data:o}=t,{transform:l,gap:c}=o,d=n.PaintImage.getPatternFixScale(t,r,a);let u,f,p,{width:g,height:m}=s;d&&(r*=d,a*=d),g*=r,m*=a,c&&(f=c.x*r/Rt(o.scaleX||1),p=c.y*a/Rt(o.scaleY||1)),(l||1!==r||1!==a)&&(r*=St(g+(f||0)),a*=St(m+(p||0)),u=Lt(),l&&Bt(u,l),Et(u,1/r,1/a));const v=s.getCanvas(g,m,o.opacity,o.filters,f,p,i.leafer&&i.leafer.config.smooth),w=s.getPattern(v,o.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=w,t.patternId=h}},getPatternFixScale:function(t,i,n){const{image:s}=t;let o,r=e.Platform.image.maxPatternSize,a=s.width*s.height;return s.isSVG?i>1&&(o=Math.ceil(i)/i):r>a&&(r=a),(a*=i*n)>r&&(o=Math.sqrt(r/a)),o},createData:function(t,e,i,s){t.data=n.PaintImage.getPatternData(i,s,e)},getPatternData:function(t,i,s){t.padding&&(i=at.set(i).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:o,height:r}=s,{opacity:a,mode:h,align:l,offset:c,scale:d,size:u,rotation:f,skew:p,clipSize:g,repeat:m,gap:v,filters:w}=t,_=i.width===o&&i.height===r,y={mode:h},x="center"!==l&&(f||0)%180==90;let P,b;switch(e.BoundsHelper.set(lt,0,0,x?r:o,x?o:r),h&&"cover"!==h&&"fit"!==h?((d||u)&&(e.MathHelper.getScaleData(d,u,s,ht),P=ht.scaleX,b=ht.scaleY),(l||v||m)&&(P&&e.BoundsHelper.scale(lt,P,b,!0),l&&e.AlignHelper.toPoint(l,lt,i,lt,!0,!0))):_&&!f||(P=b=e.BoundsHelper.getFitScale(i,lt,"fit"!==h),e.BoundsHelper.put(i,s,l,P,!1,lt),e.BoundsHelper.scale(lt,P,b,!0)),c&&e.PointHelper.move(lt,c),h){case"stretch":_?P&&(P=b=void 0):(P=i.width/o,b=i.height/r,n.PaintImage.stretchMode(y,i,P,b));break;case"normal":case"clip":if(lt.x||lt.y||P||g||f||p){let t,e;g&&(t=i.width/g.width,e=i.height/g.height),n.PaintImage.clipMode(y,i,lt.x,lt.y,P,b,f,p,t,e),t&&(P=P?P*t:t,b=b?b*e:e)}break;case"repeat":(!_||P||f||p)&&n.PaintImage.repeatMode(y,i,o,r,lt.x,lt.y,P,b,f,p,l,t.freeTransform),m||(y.repeat="repeat");const s=e.isObject(m);(v||s)&&(y.gap=function(t,i,n,s,o){let r,a;e.isObject(t)?(r=t.x,a=t.y):r=a=t;return{x:ct(r,n,o.width,i&&i.x),y:ct(a,s,o.height,i&&i.y)}}(v,s&&m,lt.width,lt.height,i));break;default:P&&n.PaintImage.fillOrFitMode(y,i,lt.x,lt.y,P,b,f)}return y.transform||(i.x||i.y)&&rt(y.transform=ot(),i.x,i.y),P&&(y.scaleX=P,y.scaleY=b),a&&a<1&&(y.opacity=a),w&&(y.filters=w),m&&(y.repeat=e.isString(m)?"x"===m?"repeat-x":"repeat-y":"repeat"),y},stretchMode:function(t,e,i,n){const s=ft(),{x:o,y:r}=e;o||r?mt(s,o,r):s.onlyScale=!0,_t(s,i,n),t.transform=s},fillOrFitMode:function(t,e,i,n,s,o,r){const a=ft();mt(a,e.x+i,e.y+n),_t(a,s,o),r&>(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,n,s,o,r,a,h,l){const c=ft();Pt(c,e,i,n,s,o,r,a),h&&(r||a?(pt(ut),vt(ut,e,h,l),wt(c,ut)):vt(c,e,h,l)),t.transform=c},repeatMode:function(t,e,i,n,s,o,r,a,h,l,c,d){const u=ft();if(d)Pt(u,e,s,o,r,a,h,l);else{if(h)if("center"===c)gt(u,{x:i/2,y:n/2},h);else switch(yt(u,h),h){case 90:mt(u,n,0);break;case 180:mt(u,i,n);break;case 270:mt(u,0,i)}dt.x=e.x+s,dt.y=e.y+o,mt(u,dt.x,dt.y),r&&vt(u,dt,r,a)}t.transform=u}},{toPoint:Tt}=e.AroundHelper,{hasTransparent:Ct}=n.ColorConvert,Mt={},Ot={};function At(t,i,s,o){if(s){let r,a,h,l;for(let t=0,c=s.length;t<c;t++)r=s[t],e.isString(r)?(h=t/(c-1),a=n.ColorConvert.string(r,o)):(h=r.offset,a=n.ColorConvert.string(r.color,o)),i.addColorStop(h,a),!l&&Ct(a)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:Dt,getDistance:It}=e.PointHelper,{get:Wt,rotateOfOuter:Ht,scaleOfOuter:Ft}=e.MatrixHelper,{toPoint:jt}=e.AroundHelper,zt={},Gt={};function Ut(t,e,i,n,s){let o;const{width:r,height:a}=t;if(r!==a||n){const t=Dt(e,i);o=Wt(),s?(Ft(o,e,r/a*(n||1),1),Ht(o,e,t+90)):(Ft(o,e,1,r/a*(n||1)),Ht(o,e,t))}return o}const{getDistance:Yt}=e.PointHelper,{toPoint:Xt}=e.AroundHelper,Nt={},Vt={};const qt={linearGradient:function(t,i){let{from:n,to:s,type:o,opacity:r}=t;Tt(n||"top",i,Mt),Tt(s||"bottom",i,Ot);const a=e.Platform.canvas.createLinearGradient(Mt.x,Mt.y,Ot.x,Ot.y),h={type:o,style:a};return At(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:n,to:s,type:o,opacity:r,stretch:a}=t;jt(n||"center",i,zt),jt(s||"bottom",i,Gt);const h=e.Platform.canvas.createRadialGradient(zt.x,zt.y,0,zt.x,zt.y,It(zt,Gt)),l={type:o,style:h};At(l,h,t.stops,r);const c=Ut(i,zt,Gt,a,!0);return c&&(l.transform=c),l},conicGradient:function(t,i){let{from:n,to:s,type:o,opacity:r,stretch:a}=t;Xt(n||"center",i,Nt),Xt(s||"bottom",i,Vt);const h=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,Nt.x,Nt.y):e.Platform.canvas.createRadialGradient(Nt.x,Nt.y,0,Nt.x,Nt.y,Yt(Nt,Vt)),l={type:o,style:h};At(l,h,t.stops,r);const c=Ut(i,Nt,Vt,a||1,e.Platform.conicGradientRotate90);return c&&(l.transform=c),l},getTransform:Ut},{copy:Kt,move:Qt,toOffsetOutBounds:$t}=e.BoundsHelper,{max:Zt,abs:Jt}=Math,te={},ee=new e.Matrix,ie={};function ne(t,e){let i,n,s,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,n=t.y||0,o=1.5*(t.blur||0),s=Jt(t.spread||0),r=Zt(r,s+o-n),a=Zt(a,s+o+i),h=Zt(h,s+o+n),l=Zt(l,s+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function se(t,i,n){const{shapeBounds:s}=n;let o,r;e.Platform.fullImageShadow?(Kt(te,t.bounds),Qt(te,i.x-s.x,i.y-s.y),o=t.bounds,r=te):(o=s,r=i),t.copyWorld(n.canvas,o,r)}const{toOffsetOutBounds:oe}=e.BoundsHelper,re={};const ae=ne;const he={shadow:function(t,i,s){let o,r;const{__nowWorld:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:c,renderBounds:d,shapeBounds:u,scaleX:f,scaleY:p}=s,g=i.getSameCanvas(),m=h.length-1;$t(c,ie,d),h.forEach((h,v)=>{let w=1;if(h.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(ie.offsetX+(h.x||0)*f*w,ie.offsetY+(h.y||0)*p*w,(h.blur||0)*f*w,n.ColorConvert.string(h.color)),r=n.Effect.getShadowTransform(t,g,s,h,ie,w),r&&g.setTransform(r),se(g,ie,s),r&&g.resetTransform(),o=d,h.box&&(g.restore(),g.save(),l&&(g.copyWorld(g,d,a,"copy"),o=a),l?g.copyWorld(l,a,a,"destination-out"):g.copyWorld(s.canvas,u,c,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,i,g,o,h.blendMode),m&&v<m&&g.clearWorld(o)}),g.recycle(o)},innerShadow:function(t,i,s){let o,r;const{__nowWorld:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:c,renderBounds:d,shapeBounds:u,scaleX:f,scaleY:p}=s,g=i.getSameCanvas(),m=h.length-1;oe(c,re,d),h.forEach((h,v)=>{let w=1;if(h.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(re.offsetX+(h.x||0)*f*w,re.offsetY+(h.y||0)*p*w,(h.blur||0)*f*w),r=n.Effect.getShadowTransform(t,g,s,h,re,w,!0),r&&g.setTransform(r),se(g,re,s),g.restore(),l?(g.copyWorld(g,d,a,"copy"),g.copyWorld(l,a,a,"source-out"),o=a):(g.copyWorld(s.canvas,u,c,"source-out"),o=d),g.fillWorld(o,n.ColorConvert.string(h.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,i,g,o,h.blendMode),m&&v<m&&g.clearWorld(o)}),g.recycle(o)},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){},getShadowRenderSpread:ne,getShadowTransform:function(t,e,i,n,s,o,r){if(n.spread){const i=2*n.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return ee.set().scaleOfOuter({x:(s.x+s.width/2)*e.pixelRatio,y:(s.y+s.height/2)*e.pixelRatio},1+i/a,1+i/h),ee}},isTransformShadow(t){},getInnerShadowSpread:ae},{excludeRenderBounds:le}=e.LeafBoundsHelper;let ce;function de(t,e,i,n,s,o,r,a){switch(e){case"grayscale":ce||(ce=!0,s.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,s,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),o&&n.recycle(r);fe(t,e,i,1,s,o)}(t,i,n,s,r,a);break;case"opacity-path":fe(t,i,n,o,r,a);break;case"path":a&&i.restore()}}function ue(t){return t.getSameCanvas(!1,!0)}function fe(t,e,i,n,s,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,s),o?i.recycle(r):i.clearWorld(r)}n.Group.prototype.__renderMask=function(t,e){let i,n,s,o,r,a;const{children:h}=this;for(let l=0,c=h.length;l<c;l++){if(i=h[l],a=i.__.mask,a){r&&(de(this,r,t,s,n,o,void 0,!0),n=s=null),"clipping"!==a&&"clipping-path"!==a||le(i,e)||i.__render(t,e),o=i.__.opacity,ce=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",s||(s=ue(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===a?"grayscale":"alpha",n||(n=ue(t)),s||(s=ue(t)),i.__render(n,e));continue}const c=1===o&&i.__.__blendMode;c&&de(this,r,t,s,n,o,void 0,!1),le(i,e)||i.__render(s||t,e),c&&de(this,r,t,s,n,o,c,!1)}de(this,r,t,s,n,o,void 0,!0)};const pe=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ge=pe+"_#~&*+\\=|≮≯≈≠=…",me=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 ve(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const we=ve("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),_e=ve("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ye=ve(pe),xe=ve(ge),Pe=ve("- —/~|┆·");var be;!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"}(be||(be={}));const{Letter:Le,Single:Ee,Before:Be,After:Se,Symbol:Re,Break:ke}=be;function Te(t){return we[t]?Le:Pe[t]?ke:_e[t]?Be:ye[t]?Se:xe[t]?Re:me.test(t)?Ee:Le}const Ce={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Me(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:Oe}=Ce,{Letter:Ae,Single:De,Before:Ie,After:We,Symbol:He,Break:Fe}=be;let je,ze,Ge,Ue,Ye,Xe,Ne,Ve,qe,Ke,Qe,$e,Ze,Je,ti,ei,ii,ni=[];function si(t,e){qe&&!Ve&&(Ve=qe),je.data.push({char:t,width:e}),Ge+=e}function oi(){Ue+=Ge,je.width=Ge,ze.words.push(je),je={data:[]},Ge=0}function ri(){Je&&(ti.paraNumber++,ze.paraStart=!0,Je=!1),qe&&(ze.startCharSize=Ve,ze.endCharSize=qe,Ve=0),ze.width=Ue,ei.width?Oe(ze):ii&&ai(),ni.push(ze),ze={words:[]},Ue=0}function ai(){Ue>(ti.maxWidth||0)&&(ti.maxWidth=Ue)}const{top:hi,right:li,bottom:ci,left:di}=e.Direction4;function ui(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 fi={getDrawData:function(t,i){e.isString(t)||(t=String(t));let s=0,o=0,r=i.__getInput("width")||0,a=i.__getInput("height")||0;const{__padding:h}=i;h&&(r?(s=h[di],r-=h[li]+h[di],!r&&(r=.01)):i.autoSizeAlign||(s=h[di]),a?(o=h[hi],a-=h[hi]+h[ci],!a&&(a=.01)):i.autoSizeAlign||(o=h[hi]));const l={bounds:{x:s,y:o,width:r,height:a},rows:[],paraNumber:0,font:e.Platform.canvas.font=i.__font};return function(t,i,n){ti=t,ni=t.rows,ei=t.bounds,ii=!ei.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:r}=n,{canvas:a}=e.Platform,{width:h}=ei;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;Je=!0,Qe=null,Ve=Ne=qe=Ge=Ue=0,je={data:[]},ze={words:[]},s&&(i=[...i]);for(let n=0,l=i.length;n<l;n++)Xe=i[n],"\n"===Xe?(Ge&&oi(),ze.paraEnd=!0,ri(),Je=!0):(Ke=Te(Xe),Ke===Ae&&"none"!==r&&(Xe=Me(Xe,r,!Ge)),Ne=a.measureText(Xe).width,s&&(s<0&&(qe=Ne),Ne+=s),$e=Ke===De&&(Qe===De||Qe===Ae)||Qe===De&&Ke!==We,Ze=!(Ke!==Ie&&Ke!==De||Qe!==He&&Qe!==We),Ye=Je&&o?h-o:h,t&&h&&Ue+Ge+Ne>Ye&&(e?(Ge&&oi(),Ue&&ri()):(Ze||(Ze=Ke===Ae&&Qe==We),$e||Ze||Ke===Fe||Ke===Ie||Ke===De||Ge+Ne>Ye?(Ge&&oi(),Ue&&ri()):Ue&&ri()))," "===Xe&&!0!==Je&&Ue+Ge===0||(Ke===Fe?(" "===Xe&&Ge&&oi(),si(Xe,Ne),oi()):$e||Ze?(Ge&&oi(),si(Xe,Ne)):si(Xe,Ne)),Qe=Ke);Ge&&oi(),Ue&&ri(),ni.length>0&&(ni[ni.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{ti.paraNumber++,Ue=a.measureText(t).width,ni.push({x:o||0,text:t,width:Ue,paraStart:!0}),ii&&ai()})}(l,t,i),h&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ui(e,"x",t[di]);break;case"right":ui(e,"x",-t[li])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ui(e,"y",t[hi]);break;case"bottom":ui(e,"y",-t[ci])}}(h,l,i,r,a),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:m}=n,v=o*s+(d?d*(t.paraNumber-1):0),w=r;if(h&&v>m)v=Math.max(m,o),s>1&&(t.overflow=s);else if(m||u)switch(c){case"middle":p+=(m-v)/2;break;case"bottom":p+=m-v}w+=p;let _,y,x,P=g||u?g:t.maxWidth;for(let r=0,c=s;r<c;r++){if(_=i[r],_.x=f,_.width<g||_.width>g&&!h)switch(l){case"center":_.x+=(P-_.width)/2;break;case"right":_.x+=P-_.width}_.paraStart&&d&&r>0&&(w+=d),_.y=w,w+=o,t.overflow>r&&w>v&&(_.isOverflow=!0,t.overflow=r+1),y=_.x,x=_.width,a<0&&(_.width<0?(x=-_.width+e.fontSize+a,y-=x,x+=e.fontSize):x-=a),y<n.x&&(n.x=y),x>n.width&&(n.width=x),h&&g&&g<x&&(_.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=p,n.height=v}(l,i),i.__isCharMode&&function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:o,letterSpacing:r}=e,a=i&&s.includes("both"),h=a||i&&s.includes("justify"),l=h&&s.includes("letter");let c,d,u,f,p,g,m,v,w,_;n.forEach(t=>{t.words&&(p=o&&t.paraStart?o:0,v=t.words.length,h&&(_=!t.paraEnd||a,d=i-t.width-p,l?f=d/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=v>1?d/(v-1):0),g=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,c=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(m={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,m),(t.isOverflow||" "!==m.char)&&t.data.push(m)):c=function(t,e,i,n,s){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,s&&(e+=s)}),e}(e.data,c,t.data,t.isOverflow,_&&f),_&&(w=i===v-1,u?w||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(w?1:0))))})),t.words=null)})}(l,i,r),l.overflow&&function(t,i,n,s){if(!s)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.Platform.canvas.measureText(a).width:0,c=n+s-l;("none"===i.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let n=i;n>-1&&(t=e.data[n],h=t.x+t.width,!(n===i&&h<c));n--){if(h<c&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(l,i,s,r),"none"!==i.textDecoration&&function(t,i){let s,o=0;const{fontSize:r,textDecoration:a}=i;switch(t.decorationHeight=r/11,e.isObject(a)?(s=a.type,a.color&&(t.decorationColor=n.ColorConvert.string(a.color)),a.offset&&(o=Math.min(.3*r,Math.max(a.offset,.15*-r)))):s=a,s){case"under":t.decorationY=[.15*r+o];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+o,.35*-r]}}(l,i),l}};const pi={string:function(t,i){if(!t)return"#000";const s=e.isNumber(i)&&i<1;if(e.isString(t)){if(!s||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let o=e.isUndefined(t.a)?1:t.a;s&&(o*=i);const r=t.r+","+t.g+","+t.b;return 1===o?"rgb("+r+")":"rgba("+r+","+o+")"}};Object.assign(n.TextConvert,fi),Object.assign(n.ColorConvert,pi),Object.assign(n.Paint,K),Object.assign(n.PaintImage,kt),Object.assign(n.PaintGradient,qt),Object.assign(n.Effect,he),Object.assign(e.Creator,{interaction:(t,e,i,n)=>new M(t,e,i,n),hitCanvas:(t,e)=>new o(t,e),hitCanvasManager:()=>new i.HitCanvasManager}),h(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Interaction=M,exports.Layouter=x,exports.LeaferCanvas=o,exports.Picker=S,exports.Renderer=b,exports.Selector=R,exports.Watcher=c,exports.useCanvas=h,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]}})}),Object.keys(i).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return i[t]}})});
|
|
2
2
|
//# sourceMappingURL=web.min.cjs.map
|