leafer-ui 2.0.5 → 2.0.7
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 -1
- package/dist/web.cjs +6 -5
- package/dist/web.esm.js +7 -6
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +37 -9
- 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 +37 -9
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -156,6 +156,9 @@ LeaferJS 不仅致力打造前沿的 2D 和未来的 3D 引擎技术,更希望
|
|
|
156
156
|
<p><h3 align="center">银牌赞助</h3></p>
|
|
157
157
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 5px;">
|
|
158
158
|
<a target="_blank" href="">
|
|
159
|
+
<img width="40" title="black" src="https://api.pxgrow.com/uploads/avatar/249/AzA/4v/u.jpg" loading="lazy" />
|
|
160
|
+
</a>
|
|
161
|
+
<a target="_blank" href="">
|
|
159
162
|
<img width="40" title="ARAM" src="https://api.pxgrow.com/uploads/avatar/3Pv/P26/zw/u.jpg" loading="lazy" />
|
|
160
163
|
</a>
|
|
161
164
|
<a target="_blank" href="">
|
|
@@ -327,7 +330,7 @@ LeaferJS 不仅致力打造前沿的 2D 和未来的 3D 引擎技术,更希望
|
|
|
327
330
|
|
|
328
331
|
<p><h3 align="center">铜牌赞助</h3></p>
|
|
329
332
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 15px;">
|
|
330
|
-
|
|
333
|
+
用户zw8T394C 用户zw8T398C 龙眼吃多了上火 用户zw8T392T 用户z89CSw69 用户CzP9SCAz Kim 用户249AzA8v l0f5c7bf 夏先生 yinuo 用户3wTwAz78 用户zw8T39zT 用户249AzA82 用户CzP9SCvz 用户39A334xT 用户3wTwAz3x 用户zw8T39zC 稀饭、微凉 用户CzP9SCT4 便宜VPS服务器 菲鸽 szhua Cheng Suezp beyond 用户3PvP2S63 o Arvin finallycc 用户39A3346C 大雷 用户CzP9SC4z 随风 用户z89CSwT9 用户3wTwAzCx UPMuling 军杨 桔子雨工作室 用户zw8T37xC 前端炒饭仔 用户z89CSw46 崮生 互动矩阵 ZhanYoHo 何佳Q coderhyh 早上好啊 快图设计 do 毛哥哥 迅排设计 用���z89CSw86 糖果 南城以北 黑色摩天仑 Charm Lauginwing 在路上 Jerry 张余🌈 李狗嗨。💢 用户zw8T376T 用户249AzA2v ʚ LMT ɞ 格子 等等 goosen F4nniu 梁福斌 江万江 杨超 ToB Dev 前端之虎陈随易 A☀️云☀️A zhk 爱发电用户_c9c82 轻简历 爱发电用户_0fac0 wangyesheji.cn 风间 爱发电用户_Tqsm 爱发电用户_6KpE 星小志 zwm 爱发电用户_3725c Noth1ng 纳西妲の√ 爱发电用户_Ahb9 爱发电用户_7617d 冷漠 爱发电用户_9RXB 今日值得读 爱发电用户_49sT 爱发电用户_NFCS 爱发电用户_43ad8 爱发电用户_30455 砖吐筷筷 xiaozhang 爱发电用户_b47b3 longbow1998 爱发电用户_5d755 爱发电用户_b76b8 爱发电用户_e70c2 xiaou@截图工具 ousiri 爱发电用户_039dc 花祁 爱发电用户_99f39 坤坤 爱发电用户_X6hp ycteng 曹吉美爸爸 啸沧海 Ronny 爱发电用户_UXEV Biu 王志强 SaltedFish 爱发电用户_76f9d PD.新城คิดถึง 糖颂缘冥倾 ALBERT. 爱发电用户_Pbm7 Leafer 赞助我们 </p>
|
|
331
334
|
|
|
332
335
|
## License
|
|
333
336
|
|
package/dist/web.cjs
CHANGED
|
@@ -342,7 +342,6 @@ core.defineKey(core.Platform, "devicePixelRatio", {
|
|
|
342
342
|
const {userAgent: userAgent} = navigator;
|
|
343
343
|
|
|
344
344
|
if (userAgent.indexOf("Firefox") > -1) {
|
|
345
|
-
core.Platform.conicGradientRotate90 = true;
|
|
346
345
|
core.Platform.intWheelDeltaY = true;
|
|
347
346
|
core.Platform.syncDomFont = true;
|
|
348
347
|
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent) || /Macintosh/.test(navigator.userAgent) && /Version\/[\d.]+.*Safari/.test(navigator.userAgent)) {
|
|
@@ -1875,17 +1874,19 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1875
1874
|
}
|
|
1876
1875
|
|
|
1877
1876
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
1877
|
+
let needUpdate = true;
|
|
1878
1878
|
const data = ui.__;
|
|
1879
1879
|
if (attrName === "fill" && !data.__naturalWidth) {
|
|
1880
1880
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
1881
1881
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
1882
1882
|
if (data.__autoSide) {
|
|
1883
1883
|
ui.forceUpdate("width");
|
|
1884
|
+
core.LeafHelper.updateBounds(ui);
|
|
1884
1885
|
if (ui.__proxyData) {
|
|
1885
1886
|
ui.setProxyAttr("width", data.width);
|
|
1886
1887
|
ui.setProxyAttr("height", data.height);
|
|
1887
1888
|
}
|
|
1888
|
-
|
|
1889
|
+
needUpdate = false;
|
|
1889
1890
|
}
|
|
1890
1891
|
}
|
|
1891
1892
|
if (!leafPaint.data) {
|
|
@@ -1895,7 +1896,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
1895
1896
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
1896
1897
|
}
|
|
1897
1898
|
if (paint.filter) draw.PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
1898
|
-
return
|
|
1899
|
+
return needUpdate;
|
|
1899
1900
|
}
|
|
1900
1901
|
|
|
1901
1902
|
function onLoad(ui, event) {
|
|
@@ -2345,10 +2346,10 @@ const realFrom = {};
|
|
|
2345
2346
|
const realTo = {};
|
|
2346
2347
|
|
|
2347
2348
|
function conicGradient(paint, box) {
|
|
2348
|
-
let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
|
|
2349
|
+
let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
|
|
2349
2350
|
toPoint(from || "center", box, realFrom);
|
|
2350
2351
|
toPoint(to || "bottom", box, realTo);
|
|
2351
|
-
const style = core.Platform.conicGradientSupport ? core.Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : core.Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
2352
|
+
const style = core.Platform.conicGradientSupport ? core.Platform.canvas.createConicGradient(rotation ? rotation * core.OneRadian : 0, realFrom.x, realFrom.y) : core.Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
2352
2353
|
const data = {
|
|
2353
2354
|
type: type,
|
|
2354
2355
|
style: style
|
package/dist/web.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Debug, LeaferCanvasBase, Platform, isString, DataHelper, canvasSizeAttrs, isUndefined, ResizeEvent, canvasPatch, Creator, LeaferImage, defineKey, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, isArray, LeafLevelList, LayoutEvent, Run, ImageManager, PointHelper, BoundsHelper, Plugin, MathHelper, isObject, FourNumberHelper, Matrix, ImageEvent, MatrixHelper, AlignHelper, isNumber, getMatrixData, AroundHelper, Direction4 } from "@leafer/core";
|
|
1
|
+
import { Debug, LeaferCanvasBase, Platform, isString, DataHelper, canvasSizeAttrs, isUndefined, ResizeEvent, canvasPatch, Creator, LeaferImage, defineKey, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, isArray, LeafLevelList, LayoutEvent, Run, ImageManager, PointHelper, BoundsHelper, Plugin, MathHelper, isObject, FourNumberHelper, Matrix, ImageEvent, MatrixHelper, AlignHelper, isNumber, getMatrixData, AroundHelper, OneRadian, Direction4 } from "@leafer/core";
|
|
2
2
|
|
|
3
3
|
export * from "@leafer/core";
|
|
4
4
|
|
|
@@ -346,7 +346,6 @@ defineKey(Platform, "devicePixelRatio", {
|
|
|
346
346
|
const {userAgent: userAgent} = navigator;
|
|
347
347
|
|
|
348
348
|
if (userAgent.indexOf("Firefox") > -1) {
|
|
349
|
-
Platform.conicGradientRotate90 = true;
|
|
350
349
|
Platform.intWheelDeltaY = true;
|
|
351
350
|
Platform.syncDomFont = true;
|
|
352
351
|
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent) || /Macintosh/.test(navigator.userAgent) && /Version\/[\d.]+.*Safari/.test(navigator.userAgent)) {
|
|
@@ -1879,17 +1878,19 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1879
1878
|
}
|
|
1880
1879
|
|
|
1881
1880
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
1881
|
+
let needUpdate = true;
|
|
1882
1882
|
const data = ui.__;
|
|
1883
1883
|
if (attrName === "fill" && !data.__naturalWidth) {
|
|
1884
1884
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
1885
1885
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
1886
1886
|
if (data.__autoSide) {
|
|
1887
1887
|
ui.forceUpdate("width");
|
|
1888
|
+
LeafHelper.updateBounds(ui);
|
|
1888
1889
|
if (ui.__proxyData) {
|
|
1889
1890
|
ui.setProxyAttr("width", data.width);
|
|
1890
1891
|
ui.setProxyAttr("height", data.height);
|
|
1891
1892
|
}
|
|
1892
|
-
|
|
1893
|
+
needUpdate = false;
|
|
1893
1894
|
}
|
|
1894
1895
|
}
|
|
1895
1896
|
if (!leafPaint.data) {
|
|
@@ -1899,7 +1900,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
1899
1900
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
1900
1901
|
}
|
|
1901
1902
|
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
1902
|
-
return
|
|
1903
|
+
return needUpdate;
|
|
1903
1904
|
}
|
|
1904
1905
|
|
|
1905
1906
|
function onLoad(ui, event) {
|
|
@@ -2349,10 +2350,10 @@ const realFrom = {};
|
|
|
2349
2350
|
const realTo = {};
|
|
2350
2351
|
|
|
2351
2352
|
function conicGradient(paint, box) {
|
|
2352
|
-
let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
|
|
2353
|
+
let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
|
|
2353
2354
|
toPoint(from || "center", box, realFrom);
|
|
2354
2355
|
toPoint(to || "bottom", box, realTo);
|
|
2355
|
-
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
2356
|
+
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(rotation ? rotation * OneRadian : 0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
2356
2357
|
const data = {
|
|
2357
2358
|
type: type,
|
|
2358
2359
|
style: style
|
package/dist/web.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Debug as t,LeaferCanvasBase as e,Platform as i,isString as s,DataHelper as n,canvasSizeAttrs as o,isUndefined as r,ResizeEvent as a,canvasPatch as h,Creator as l,LeaferImage as c,defineKey as d,FileHelper as u,LeafList as f,RenderEvent as p,ChildEvent as g,WatchEvent as w,PropertyEvent as _,LeafHelper as m,BranchHelper as v,LeafBoundsHelper as y,Bounds as x,isArray as b,LeafLevelList as S,LayoutEvent as L,Run as k,ImageManager as T,PointHelper as B,BoundsHelper as E,Plugin as P,MathHelper as R,isObject as M,FourNumberHelper as C,Matrix as A,ImageEvent as D,MatrixHelper as O,AlignHelper as W,isNumber as I,getMatrixData as F,AroundHelper as z,Direction4 as j}from"@leafer/core";export*from"@leafer/core";export{LeaferFilm,LeaferImage,LeaferVideo}from"@leafer/core";import{InteractionHelper as U,InteractionBase as G,Cursor as Y,HitCanvasManager as X}from"@leafer-ui/core";export*from"@leafer-ui/core";import{Paint as V,PaintImage as N,ColorConvert as H,PaintGradient as q,Effect as K,Group as Q,TextConvert as $}from"@leafer-ui/draw";var Z;function J(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,a)}h((s=s.apply(t,e||[])).next())})}!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(Z||(Z={})),"function"==typeof SuppressedError&&SuppressedError;const tt=t.get("LeaferCanvas");class et extends e{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 s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;if(s.display||(s.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")}i.syncDomFont&&!this.parentView&&(s.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 e=s(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===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 i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else tt.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:s}=this.view;s.width=t+"px",s.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),tt.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()),i.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=i.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 e=this.view,{x:s,y:n,width:o,height:r}=this.autoBounds.getBoundsFrom(t),a={width:o,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:i.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=e;t.marginLeft=s+"px",t.marginTop=n+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};n.copyAttrs(e,this,o),this.resize(t),this.resizeListener&&!r(this.width)&&this.resizeListener(new a(t,e))}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())}}function it(t,e){i.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=u.mimeType(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,u.mimeType(e),i)),canvasSaveAs:(t,e,s)=>{const n=t.toDataURL(u.mimeType(u.fileType(e)),s);return i.origin.download(n,e)},download(t,e){return J(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,s)=>new Promise((s,n)=>{const o=new i.origin.Image;e&&(o.setAttribute("crossOrigin",e),o.crossOrigin=e),o.onload=()=>{s(o)},o.onerror=t=>{n(t)},o.src=i.image.getRealURL(t)}),loadContent(t){return J(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},i.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},i.canvas=l.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}h(CanvasRenderingContext2D.prototype),h(Path2D.prototype),Object.assign(l,{canvas:(t,e)=>new et(t,e),image:t=>new c(t)}),i.name="web",i.isMobile="ontouchstart"in window,i.requestRender=function(t){window.requestAnimationFrame(t)},d(i,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:st}=navigator;st.indexOf("Firefox")>-1?(i.conicGradientRotate90=!0,i.intWheelDeltaY=!0,i.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(i.fullImageShadow=!0),st.indexOf("Windows")>-1?(i.os="Windows",i.intWheelDeltaY=!0):st.indexOf("Mac")>-1?i.os="Mac":st.indexOf("Linux")>-1&&(i.os="Linux");class nt{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new f;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new f,this.target=t,e&&(this.config=n.default(e,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(p.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===g.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 w(w.DATA,{updatedList:this.updatedList})),this.__updatedList=new f,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[_.CHANGE,this.__onAttrChange,this],[[g.ADD,g.REMOVE],this.__onChildEvent,this],[w.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:ot,updateBounds:rt,updateChange:at}=m,{pushAllChildBranch:ht,pushAllParent:lt}=v;const{worldBounds:ct}=y;class dt{constructor(t){this.updatedBounds=new x,this.beforeBounds=new x,this.afterBounds=new x,b(t)&&(t=new f(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,ct)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,ct),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:ut,updateAllChange:ft}=m,pt=t.get("Layouter");class gt{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new S,this.target=t,e&&(this.config=n.default(e,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(L.START),this.layoutOnce(),t.emitEvent(new L(L.END,this.layoutedBlocks,this.times))}catch(t){pt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?pt.warn("layouting"):this.times>3?pt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(w.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 e=k.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=L,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new L(n,a,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?(ot(t,!0),e.add(t),t.isBranch&&ht(t,e),lt(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),lt(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||rt(s[t])}rt(i)}})}(this.__levelList),function(t){t.list.forEach(at)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new L(o,a,this.times)),i.emitEvent(new L(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,k.end(e)}fullLayout(){const t=k.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=L,o=this.getBlocks(new f(e));e.emitEvent(new L(i,o,this.times)),gt.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new L(s,o,this.times)),e.emitEvent(new L(n,o,this.times)),this.addBlocks(o),k.end(t)}static fullLayout(t){ut(t,!0),t.isBranch?v.updateBounds(t):m.updateBounds(t),ft(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new dt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new dt(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_([[L.REQUEST,this.layout,this],[L.AGAIN,this.layoutAgain,this],[w.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const wt=t.get("Renderer");class _t{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=n.default(i,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(L.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(p.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(p.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(p.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new x,wt.log(e.innerName,"---\x3e");try{this.emitRender(p.START),this.renderOnce(t),this.emitRender(p.END,this.totalBounds),T.clearRecycled()}catch(t){this.rendering=!1,wt.error(t)}wt.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return wt.warn("rendering");if(this.times>3)return wt.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new x,this.renderOptions={},t)this.emitRender(p.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(p.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(p.RENDER,this.renderBounds,this.renderOptions),this.emitRender(p.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 e=k.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new x(s);i.save(),s.spread(_t.clipSpread).ceil();const{ceilPartPixel:o}=this.config;i.clipWorld(s,o),i.clearWorld(s,o),this.__render(s,n),i.restore(),k.end(e)}fullRender(){const t=k.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),k.end(t)}__render(e,s){const{canvas:n,target:o}=this,r=e.includes(o.__world),a=r?{includes:r}:{bounds:e,includes:r};this.needFill&&n.fillWorld(e,this.config.fill),t.showRepaint&&t.drawRepaint(n,e),this.config.useCellRender&&(a.cellList=this.getCellList()),i.render(o,n,a),this.renderBounds=s=s||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=s:this.totalBounds.add(s),n.updateRender(s)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new x;e.setList(t),t.length=0,t.push(e)}}__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 e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return i.requestRender(e);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};i.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new x(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new x(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||wt.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new p(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[p.REQUEST,this.update,this],[L.END,this.__onLayoutEnd,this],[p.AGAIN,this.renderAgain,this],[a.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}_t.clipSpread=10;const mt={},{copyRadiusPoint:vt}=B,{hitRadiusPoint:yt}=E;class xt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new f(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new f;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||m.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&m.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>m.worldHittable(t))}getPath(t){const e=new f,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new f;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new f,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:o}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=yt(i.__world,n.hitRadius?vt(mt,o,n.hitRadius):o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__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 s&&this.hitChild(i,o)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class bt{constructor(t,e){this.config={},e&&(this.config=n.default(e,this.config)),this.picker=new xt(this.target=t,this),this.finder=l.finder&&l.finder(t,this.config)}getByPoint(t,e,s){const{target:n,picker:o}=this;return i.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,e,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):P.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(l,{watcher:(t,e)=>new nt(t,e),layouter:(t,e)=>new gt(t,e),renderer:(t,e,i)=>new _t(t,e,i),selector:(t,e)=>new bt(t,e)}),i.layout=gt.fullLayout,i.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new f,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const St={convert(t,e){const i=U.getBase(t),{x:s,y:n}=e,o=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===o.pointerType&&(o.tangentialPressure=t.tangentialPressure,o.tiltX=t.tiltX,o.tiltY=t.tiltY,o.twist=t.twist),o},convertMouse(t,e){const i=U.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=St.getTouch(t),s=U.getBase(t),{x:n,y:o}=e;return Object.assign(Object.assign({},s),{x:n,y:o,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Lt={convert(t){const e=U.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:kt}=U;class Tt extends G{get windowTarget(){const{view:t}=this;return t&&t.ownerDocument||window}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),this.windowTarget.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)this.windowTarget.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;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&&(!this.config.shadowDOM||!t.composedPath||!t.composedPath().includes(this.view))}onKeyDown(t){this.keyDown(Lt.convert(t))}onKeyUp(t){this.keyUp(Lt.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(St.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(St.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=St.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(St.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(St.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(St.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(St.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=St.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&kt(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(St.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=St.getTouch(t);this.pointerMove(St.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=St.getTouch(t);this.pointerUp(St.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),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(U.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},U.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 e=U.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(R.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),M(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>M(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,b(t))t.forEach(t=>this.eachCursor(t,e,i));else{const n=s(t)&&Y.get(t);n&&i<2?this.eachCursor(n,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function Bt(t,e,i){t.__.__font?V.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Et(t,e,i,s,n){const o=i.__;M(t)?V.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&V.strokeArrow(t,i,s,n)}function Pt(t,e,i,s,n){const o=i.__;M(t)?V.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),V.drawTextStroke(i,s,n))}function Rt(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Pt(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",V.fillText(i,o,n),o.blendMode="normal",m.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}const{getSpread:Mt,copyAndSpread:Ct,toOuterOf:At,getOuterOf:Dt,getByMove:Ot,move:Wt,getIntersectData:It}=E,Ft={};let zt;const{stintSet:jt}=n,{hasTransparent:Ut}=H;function Gt(t,e,i){if(!M(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:o}=i.__layout,{type:a}=e;switch(a){case"image":case"film":case"video":if(!e.url)return;n=N.image(i,t,e,o,!zt||!zt[e.url]),"image"!==a&&N[a](n);break;case"linear":n=q.linearGradient(e,o);break;case"radial":n=q.radialGradient(e,o);break;case"angular":n=q.conicGradient(e,o);break;case"solid":const{color:s,opacity:h}=e;n={type:a,style:H.string(s,h)};break;default:r(e.r)||(n={type:"solid",style:H.string(e)})}if(n&&(n.originPaint=e,s(n.style)&&Ut(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const Yt={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];b(a)||(a=[a]),zt=N.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=Gt(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(jt(i,"__isAlphaPixelFill",n),jt(i,"__isTransparentFill",o)):(jt(i,"__isAlphaPixelStroke",n),jt(i,"__isTransparentStroke",o),jt(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Bt(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,N.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,o.scaleFixed,!1);1!==t&&i.scale(t,s)}o.blendMode&&(i.blendMode=o.blendMode),Bt(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Bt(e,i,s),i.restoreBlendMode()):Bt(e,i,s)}},fillPathOrText:Bt,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[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}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)V.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Et(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Et(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Et(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Et(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),m.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){V.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Pt(t,1,e,i,s);break;case"inside":Rt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Pt(t,2,e,i,s):Rt(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,c=t.length;l<c;l++)if(r=t[l],(!r.image||!N.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?V.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?V.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,s){const n=e.getSameCanvas(),o=e.bounds,r=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,c,d,u,f,p;At(a.strokeSpread?(Ct(Ft,a.boxBounds,a.strokeSpread),Ft):a.boxBounds,r,h);let{scaleX:g,scaleY:w}=t.getRenderScaleData(!0);if(o.includes(h))p=n,l=f=h,c=r;else{let n;if(i.fullImageShadow)n=h;else{const t=a.renderShapeSpread?Mt(o,C.swapAndScale(a.renderShapeSpread,g,w)):o;n=It(t,h)}u=o.getFitMatrix(n);let{a:_,d:m}=u;u.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,s),g*=_,w*=m),f=Dt(h,u),l=Ot(f,-u.e,-u.f),c=Dt(r,u),Wt(c,-u.e,-u.f);const v=s.matrix;v?(d=new A(u),d.multiply(v),_*=v.scaleX,m*=v.scaleY):d=u,d.withScale(_,m),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(n,s),{canvas:n,matrix:d,fitMatrix:u,bounds:l,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:w}}};let Xt,Vt=new x;const{isSame:Nt}=E;function Ht(t,e,i,s,n,o){const r=t.__;if("fill"===e&&!r.__naturalWidth&&(r.__naturalWidth=s.width/r.pixelRatio,r.__naturalHeight=s.height/r.pixelRatio,r.__autoSide))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",r.width),t.setProxyAttr("height",r.height)),!1;if(!n.data){N.createData(n,s,i,o);const{transform:t}=n.data,{opacity:e,blendMode:a}=i,h=t&&!t.onlyScale||r.path||r.cornerRadius;(h||e&&e<1||a)&&(n.complex=!h||2)}return i.filter&&N.applyFilter(n,s,i.filter,t),!0}function qt(t,e){$t(t,D.LOAD,e)}function Kt(t,e){$t(t,D.LOADED,e)}function Qt(t,e,i){e.error=i,t.forceUpdate("surface"),$t(t,D.ERROR,e)}function $t(t,e,i){t.hasEvent(e)&&t.emitEvent(new D(e,i))}function Zt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Jt,translate:te}=O,ee=new x,ie={},se={};function ne(t,e,i,n){const o=s(t)||n?(n?i-n*e:i%e)/((n||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let oe={},re=F();const{get:ae,set:he,rotateOfOuter:le,translate:ce,scaleOfOuter:de,multiplyParent:ue,scale:fe,rotate:pe,skew:ge}=O;function we(t,e,i,s,n,o,r,a){r&&pe(t,r),a&&ge(t,a.x,a.y),n&&fe(t,n,o),ce(t,e.x+i,e.y+s)}const{get:_e,scale:me,copy:ve}=O,{getFloorScale:ye}=R,{abs:xe}=Math;const be={image:function(t,e,i,s,n){let o,r;const a=T.get(i,i.type);return Xt&&i===Xt.paint&&Nt(s,Xt.boxBounds)?o=Xt.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Xt=a.use>1?{leafPaint:o,paint:i,boxBounds:Vt.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Ht(t,e,i,a,o,s),n&&(qt(t,r),Kt(t,r))):a.error?n&&Qt(t,r,a.error):(n&&(Zt(t,!0),qt(t,r)),o.loadId=a.load(()=>{Zt(t,!1),t.destroyed||(Ht(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Kt(t,r)),o.loadId=void 0},e=>{Zt(t,!1),Qt(t,r,e),o.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,s,n,o){const{scaleX:r,scaleY:a}=N.getImageRenderScaleData(t,s,n,o),h=t.film?t.nowIndex:r+"-"+a,{image:l,data:c,originPaint:d}=t,{exporting:u,snapshot:f}=o;return!(!c||t.patternId===h&&!u||f)&&(e&&(c.repeat?e=!1:d.changeful||t.film||"miniapp"===i.name||u||(e=i.image.isLarge(l,r,a)||l.width*r>8096||l.height*a>8096)),e?(s.__.__isFastShadow&&(n.fillStyle=t.style||"#000",n.fill()),N.drawImage(t,r,a,s,n,o),!0):(!t.style||d.sync||u?N.createPattern(t,s,n,o):N.createPatternTask(t,s,n,o),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a,complex:h}=t;let{width:l,height:c}=a;if(h){const{blendMode:o,opacity:d}=t.originPaint,{transform:u}=r;n.save(),2===h&&n.clipUI(s),o&&(n.blendMode=o),d&&(n.opacity*=d),u&&n.transform(u),a.render(n,0,0,l,c,s,t,e,i),n.restore()}else r.scaleX&&(l*=r.scaleX,c*=r.scaleY),a.render(n,0,0,l,c,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(b(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,T.recyclePaint(s),e.__willDestroy&&n.parent&&N.recycleFilter(n,e.__leaf),n.loading&&(r||(r=e.__input&&e.__input[t]||[],b(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=T.patternTasker.add(()=>J(this,void 0,void 0,function*(){N.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,s,n){let{scaleX:o,scaleY:r}=N.getImageRenderScaleData(t,e,s,n),a=t.film?t.nowIndex:o+"-"+r;if(t.patternId!==a&&!e.destroyed&&(!i.image.isLarge(t.image,o,r)||t.data.repeat)){const{image:s,data:n}=t,{opacity:h}=t.originPaint,{transform:l,gap:c}=n,d=N.getPatternFixScale(t,o,r);let u,f,p,{width:g,height:w}=s;d&&(o*=d,r*=d),g*=o,w*=r,c&&(f=c.x*o/xe(n.scaleX||1),p=c.y*r/xe(n.scaleY||1)),(l||1!==o||1!==r)&&(o*=ye(g+(f||0)),r*=ye(w+(p||0)),u=_e(),l&&ve(u,l),me(u,1/o,1/r));const _=s.getCanvas(g,w,h,void 0,f,p,e.leafer&&e.leafer.config.smooth,n.interlace),m=s.getPattern(_,n.repeat||i.origin.noRepeat||"no-repeat",u,t);t.style=m,t.patternId=a}},getPatternFixScale:function(t,e,s){const{image:n}=t;let o,r=i.image.maxPatternSize,a=n.width*n.height;return n.isSVG?e>1&&(o=Math.ceil(e)/e):r>a&&(r=a),(a*=e*s)>r&&(o=Math.sqrt(r/a)),o},createData:function(t,e,i,s){t.data=N.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=ee.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:n,height:o}=i,{mode:r,align:a,offset:h,scale:l,size:c,rotation:d,skew:u,clipSize:f,repeat:p,gap:g,interlace:w}=t,_=e.width===n&&e.height===o,m={mode:r},v="center"!==a&&(d||0)%180==90;let y,x;switch(E.set(se,0,0,v?o:n,v?n:o),r&&"cover"!==r&&"fit"!==r?((l||c)&&(R.getScaleData(l,c,i,ie),y=ie.scaleX,x=ie.scaleY),(a||g||p)&&(y&&E.scale(se,y,x,!0),a&&W.toPoint(a,se,e,se,!0,!0))):_&&!d||(y=x=E.getFitScale(e,se,"fit"!==r),E.put(e,i,a,y,!1,se),E.scale(se,y,x,!0)),h&&B.move(se,h),r){case"stretch":_?y&&(y=x=void 0):(y=e.width/n,x=e.height/o,N.stretchMode(m,e,y,x));break;case"normal":case"clip":if(se.x||se.y||y||f||d||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),N.clipMode(m,e,se.x,se.y,y,x,d,u,t,i),t&&(y=y?y*t:t,x=x?x*i:i)}break;case"repeat":(!_||y||d||u)&&N.repeatMode(m,e,n,o,se.x,se.y,y,x,d,u,a,t.freeTransform),p||(m.repeat="repeat");const i=M(p);(g||i)&&(m.gap=function(t,e,i,s,n){let o,r;M(t)?(o=t.x,r=t.y):o=r=t;return{x:ne(o,i,n.width,e&&e.x),y:ne(r,s,n.height,e&&e.y)}}(g,i&&p,se.width,se.height,e));break;default:y&&N.fillOrFitMode(m,e,se.x,se.y,y,x,d)}return m.transform||(e.x||e.y)&&te(m.transform=Jt(),e.x,e.y),y&&(m.scaleX=y,m.scaleY=x),p&&(m.repeat=s(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),w&&(m.interlace=I(w)||"percent"===w.type?{type:"x",offset:w}:w),m},stretchMode:function(t,e,i,s){const n=ae(),{x:o,y:r}=e;o||r?ce(n,o,r):i>0&&s>0&&(n.onlyScale=!0),fe(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=ae();ce(a,e.x+i,e.y+s),fe(a,n,o),r&&le(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const c=ae();we(c,e,i,s,n,o,r,a),h&&(r||a?(he(re),de(re,e,h,l),ue(c,re)):de(c,e,h,l)),t.transform=c},repeatMode:function(t,e,i,s,n,o,r,a,h,l,c,d){const u=ae();if(d)we(u,e,n,o,r,a,h,l);else{if(h)if("center"===c)le(u,{x:i/2,y:s/2},h);else switch(pe(u,h),h){case 90:ce(u,s,0);break;case 180:ce(u,i,s);break;case 270:ce(u,0,i)}oe.x=e.x+n,oe.y=e.y+o,ce(u,oe.x,oe.y),r&&de(u,oe,r,a)}t.transform=u}},{toPoint:Se}=z,{hasTransparent:Le}=H,ke={},Te={};function Be(t,e,i,n){if(i){let o,r,a,h;for(let t=0,l=i.length;t<l;t++)o=i[t],s(o)?(a=t/(l-1),r=H.string(o,n)):(a=o.offset,r=H.string(o.color,n)),e.addColorStop(a,r),!h&&Le(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ee,getDistance:Pe}=B,{get:Re,rotateOfOuter:Me,scaleOfOuter:Ce}=O,{toPoint:Ae}=z,De={},Oe={};function We(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Ee(e,i);o=Re(),n?(Ce(o,e,r/a*(s||1),1),Me(o,e,t+90)):(Ce(o,e,1,r/a*(s||1)),Me(o,e,t))}return o}const{getDistance:Ie}=B,{toPoint:Fe}=z,ze={},je={};const Ue={linearGradient:function(t,e){let{from:s,to:n,type:o,opacity:r}=t;Se(s||"top",e,ke),Se(n||"bottom",e,Te);const a=i.canvas.createLinearGradient(ke.x,ke.y,Te.x,Te.y),h={type:o,style:a};return Be(h,a,t.stops,r),h},radialGradient:function(t,e){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Ae(s||"center",e,De),Ae(n||"bottom",e,Oe);const h=i.canvas.createRadialGradient(De.x,De.y,0,De.x,De.y,Pe(De,Oe)),l={type:o,style:h};Be(l,h,t.stops,r);const c=We(e,De,Oe,a,!0);return c&&(l.transform=c),l},conicGradient:function(t,e){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Fe(s||"center",e,ze),Fe(n||"bottom",e,je);const h=i.conicGradientSupport?i.canvas.createConicGradient(0,ze.x,ze.y):i.canvas.createRadialGradient(ze.x,ze.y,0,ze.x,ze.y,Ie(ze,je)),l={type:o,style:h};Be(l,h,t.stops,r);const c=We(e,ze,je,a||1,i.conicGradientRotate90);return c&&(l.transform=c),l},getTransform:We},{copy:Ge,move:Ye,toOffsetOutBounds:Xe}=E,{max:Ve,abs:Ne}=Math,He={},qe=new A,Ke={};function Qe(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=Ne(t.spread||0),r=Ve(r,n+o-s),a=Ve(a,n+o+i),h=Ve(h,n+o+s),l=Ve(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function $e(t,e,s){const{shapeBounds:n}=s;let o,r;i.fullImageShadow?(Ge(He,t.bounds),Ye(He,e.x-n.x,e.y-n.y),o=t.bounds,r=He):(o=n,r=e),t.copyWorld(s.canvas,o,r)}const{toOffsetOutBounds:Ze}=E,Je={};const ti=Qe;const ei={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:c,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Xe(h,Ke,l),r.forEach((r,g)=>{let w=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}f.setWorldShadow(Ke.offsetX+(r.x||0)*d*w,Ke.offsetY+(r.y||0)*u*w,(r.blur||0)*d*w,H.string(r.color)),n=K.getShadowTransform(t,f,i,r,Ke,w),n&&f.setTransform(n),$e(f,Ke,i),n&&f.resetTransform(),s=l,r.box&&(f.restore(),f.save(),a&&(f.copyWorld(f,l,o,"copy"),s=o),a?f.copyWorld(a,o,o,"destination-out"):f.copyWorld(i.canvas,c,h,"destination-out")),m.copyCanvasByWorld(t,e,f,s,r.blendMode),p&&g<p&&f.clearWorld(s)}),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:c,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Ze(h,Je,l),r.forEach((r,g)=>{let w=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}f.save(),f.setWorldShadow(Je.offsetX+(r.x||0)*d*w,Je.offsetY+(r.y||0)*u*w,(r.blur||0)*d*w),n=K.getShadowTransform(t,f,i,r,Je,w,!0),n&&f.setTransform(n),$e(f,Je,i),f.restore(),a?(f.copyWorld(f,l,o,"copy"),f.copyWorld(a,o,o,"source-out"),s=o):(f.copyWorld(i.canvas,c,h,"source-out"),s=l),f.fillWorld(s,H.string(r.color),"source-in"),m.copyCanvasByWorld(t,e,f,s,r.blendMode),p&&g<p&&f.clearWorld(s)}),f.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Qe,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return qe.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),qe}},isTransformShadow(t){},getInnerShadowSpread:ti},{excludeRenderBounds:ii}=y;let si;function ni(t,e,i,s,n,o,r,a){switch(e){case"grayscale":si||(si=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);ri(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":ri(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function oi(t){return t.getSameCanvas(!1,!0)}function ri(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}Q.prototype.__renderMask=function(t,e){let i,s,n,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&&(ni(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||ii(i,e)||i.__render(t,e),o=i.__.opacity,si=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=oi(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=oi(t)),n||(n=oi(t)),i.__render(s,e));continue}const c=1===o&&i.__.__blendMode;c&&ni(this,r,t,n,s,o,void 0,!1),ii(i,e)||i.__render(n||t,e),c&&ni(this,r,t,n,s,o,c,!1)}ni(this,r,t,n,s,o,void 0,!0)};const ai=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",hi=ai+"_#~&*+\\=|≮≯≈≠=…",li=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 ci(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const di=ci("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ui=ci("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),fi=ci(ai),pi=ci(hi),gi=ci("- —/~|┆·");var wi;!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"}(wi||(wi={}));const{Letter:_i,Single:mi,Before:vi,After:yi,Symbol:xi,Break:bi}=wi;function Si(t){return di[t]?_i:gi[t]?bi:ui[t]?vi:fi[t]?yi:pi[t]?xi:li.test(t)?mi:_i}const Li={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function ki(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:Ti}=Li,{Letter:Bi,Single:Ei,Before:Pi,After:Ri,Symbol:Mi,Break:Ci}=wi;let Ai,Di,Oi,Wi,Ii,Fi,zi,ji,Ui,Gi,Yi,Xi,Vi,Ni,Hi,qi,Ki,Qi=[];function $i(t,e){Ui&&!ji&&(ji=Ui),Ai.data.push({char:t,width:e}),Oi+=e}function Zi(){Wi+=Oi,Ai.width=Oi,Di.words.push(Ai),Ai={data:[]},Oi=0}function Ji(){Ni&&(Hi.paraNumber++,Di.paraStart=!0,Ni=!1),Ui&&(Di.startCharSize=ji,Di.endCharSize=Ui,ji=0),Di.width=Wi,qi.width?Ti(Di):Ki&&ts(),Qi.push(Di),Di={words:[]},Wi=0}function ts(){Wi>(Hi.maxWidth||0)&&(Hi.maxWidth=Wi)}const{top:es,right:is,bottom:ss,left:ns}=j;function os(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const rs={getDrawData:function(t,e){s(t)||(t=String(t));let n=0,o=0,r=e.__getInput("width")||0,a=e.__getInput("height")||0;const{__padding:h}=e;h&&(r?(n=h[ns],r-=h[is]+h[ns],!r&&(r=.01)):e.autoSizeAlign||(n=h[ns]),a?(o=h[es],a-=h[es]+h[ss],!a&&(a=.01)):e.autoSizeAlign||(o=h[es]));const l={bounds:{x:n,y:o,width:r,height:a},rows:[],paraNumber:0,font:i.canvas.font=e.__font};return function(t,e,s){Hi=t,Qi=t.rows,qi=t.bounds,Ki=!qi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=i,{width:h}=qi;if(s.__isCharMode){const t="none"!==s.textWrap,i="break"===s.textWrap;Ni=!0,Yi=null,ji=zi=Ui=Oi=Wi=0,Ai={data:[]},Di={words:[]};for(let s=0,l=(e=[...e]).length;s<l;s++)Fi=e[s],"\n"===Fi?(Oi&&Zi(),Di.paraEnd=!0,Ji(),Ni=!0):(Gi=Si(Fi),Gi===Bi&&"none"!==r&&(Fi=ki(Fi,r,!Oi)),zi=a.measureText(Fi).width,n&&(n<0&&(Ui=zi),zi+=n),Xi=Gi===Ei&&(Yi===Ei||Yi===Bi)||Yi===Ei&&Gi!==Ri,Vi=!(Gi!==Pi&&Gi!==Ei||Yi!==Mi&&Yi!==Ri),Ii=Ni&&o?h-o:h,t&&h&&Wi+Oi+zi>Ii&&(i?(Oi&&Zi(),Wi&&Ji()):(Vi||(Vi=Gi===Bi&&Yi==Ri),Xi||Vi||Gi===Ci||Gi===Pi||Gi===Ei||Oi+zi>Ii?(Oi&&Zi(),Wi&&Ji()):Wi&&Ji()))," "===Fi&&!0!==Ni&&Wi+Oi===0||(Gi===Ci?(" "===Fi&&Oi&&Zi(),$i(Fi,zi),Zi()):Xi||Vi?(Oi&&Zi(),$i(Fi,zi)):$i(Fi,zi)),Yi=Gi);Oi&&Zi(),Wi&&Ji(),Qi.length>0&&(Qi[Qi.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Hi.paraNumber++,Wi=a.measureText(t).width,Qi.push({x:o||0,text:t,width:Wi,paraStart:!0}),Ki&&ts()})}(l,t,e),h&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":os(e,"x",t[ns]);break;case"right":os(e,"x",-t[is])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":os(e,"y",t[es]);break;case"bottom":os(e,"y",-t[ss])}}(h,l,e,r,a),function(t,e){const{rows:i,bounds:s}=t,n=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:w}=s,_=o*n+(d?d*(t.paraNumber-1):0),m=r;if(h&&_>w)_=Math.max(e.__autoHeight?_:w,o),n>1&&(t.overflow=n);else if(w||u)switch(c){case"middle":p+=(w-_)/2;break;case"bottom":p+=w-_}m+=p;let v,y,x,b=g||u?g:t.maxWidth;for(let r=0,c=n;r<c;r++){if(v=i[r],v.x=f,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&d&&r>0&&(m+=d),v.y=m,m+=o,t.overflow>r&&m>_&&(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<s.x&&(s.x=y),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=_}(l,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,__letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let c,d,u,f,p,g,w,_,m,v;s.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?(w={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,w),(t.isOverflow||" "!==w.char)&&t.data.push(w)):c=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,c,t.data,t.isOverflow,v&&f),v&&(m=i===_-1,u?m||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(m?1:0))))})),t.words=null)})}(l,e,r),l.overflow&&function(t,e,s,n){const{rows:o,overflow:r}=t;let{textOverflow:a}=e;if(r&&o.splice(r),n&&a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?i.canvas.measureText(a).width:0,c=s+n-l;("none"===e.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<c));s--){if(h<c&&" "!==t.char||!s){e.data.splice(s+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,e,n,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,M(o)?(i=o.type,o.color&&(t.decorationColor=H.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(l,e),l}};const as={string:function(t,e){if(!t)return"#000";const i=I(e)&&e<1;if(s(t)){if(!i||!H.object)return t;t=H.object(t)}let n=r(t.a)?1:t.a;i&&(n*=e);const o=t.r+","+t.g+","+t.b;return 1===n?"rgb("+o+")":"rgba("+o+","+n+")"}};Object.assign($,rs),Object.assign(H,as),Object.assign(V,Yt),Object.assign(N,be),Object.assign(q,Ue),Object.assign(K,ei),Object.assign(l,{interaction:(t,e,i,s)=>new Tt(t,e,i,s),hitCanvas:(t,e)=>new et(t,e),hitCanvasManager:()=>new X}),it();export{Tt as Interaction,gt as Layouter,et as LeaferCanvas,Z as PathNodeHandleType,xt as Picker,_t as Renderer,bt as Selector,nt as Watcher,it as useCanvas};
|
|
1
|
+
import{Debug as t,LeaferCanvasBase as e,Platform as i,isString as s,DataHelper as n,canvasSizeAttrs as o,isUndefined as r,ResizeEvent as a,canvasPatch as h,Creator as l,LeaferImage as c,defineKey as d,FileHelper as u,LeafList as f,RenderEvent as p,ChildEvent as g,WatchEvent as w,PropertyEvent as _,LeafHelper as m,BranchHelper as v,LeafBoundsHelper as y,Bounds as x,isArray as b,LeafLevelList as S,LayoutEvent as L,Run as k,ImageManager as T,PointHelper as B,BoundsHelper as E,Plugin as P,MathHelper as R,isObject as M,FourNumberHelper as C,Matrix as A,ImageEvent as D,MatrixHelper as O,AlignHelper as W,isNumber as I,getMatrixData as F,AroundHelper as z,OneRadian as j,Direction4 as U}from"@leafer/core";export*from"@leafer/core";export{LeaferFilm,LeaferImage,LeaferVideo}from"@leafer/core";import{InteractionHelper as Y,InteractionBase as G,Cursor as X,HitCanvasManager as V}from"@leafer-ui/core";export*from"@leafer-ui/core";import{Paint as N,PaintImage as H,ColorConvert as q,PaintGradient as K,Effect as Q,Group as $,TextConvert as Z}from"@leafer-ui/draw";var J;function tt(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,a)}h((s=s.apply(t,e||[])).next())})}!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(J||(J={})),"function"==typeof SuppressedError&&SuppressedError;const et=t.get("LeaferCanvas");class it extends e{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 s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:s}=this.view;if(s.display||(s.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")}i.syncDomFont&&!this.parentView&&(s.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 e=s(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===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 i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else et.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:s}=this.view;s.width=t+"px",s.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),et.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()),i.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=i.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 e=this.view,{x:s,y:n,width:o,height:r}=this.autoBounds.getBoundsFrom(t),a={width:o,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:i.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=e;t.marginLeft=s+"px",t.marginTop=n+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};n.copyAttrs(e,this,o),this.resize(t),this.resizeListener&&!r(this.width)&&this.resizeListener(new a(t,e))}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())}}function st(t,e){i.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=u.mimeType(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,u.mimeType(e),i)),canvasSaveAs:(t,e,s)=>{const n=t.toDataURL(u.mimeType(u.fileType(e)),s);return i.origin.download(n,e)},download(t,e){return tt(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,s)=>new Promise((s,n)=>{const o=new i.origin.Image;e&&(o.setAttribute("crossOrigin",e),o.crossOrigin=e),o.onload=()=>{s(o)},o.onerror=t=>{n(t)},o.src=i.image.getRealURL(t)}),loadContent(t){return tt(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},i.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},i.canvas=l.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}h(CanvasRenderingContext2D.prototype),h(Path2D.prototype),Object.assign(l,{canvas:(t,e)=>new it(t,e),image:t=>new c(t)}),i.name="web",i.isMobile="ontouchstart"in window,i.requestRender=function(t){window.requestAnimationFrame(t)},d(i,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:nt}=navigator;nt.indexOf("Firefox")>-1?(i.intWheelDeltaY=!0,i.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(i.fullImageShadow=!0),nt.indexOf("Windows")>-1?(i.os="Windows",i.intWheelDeltaY=!0):nt.indexOf("Mac")>-1?i.os="Mac":nt.indexOf("Linux")>-1&&(i.os="Linux");class ot{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new f;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new f,this.target=t,e&&(this.config=n.default(e,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(p.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===g.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 w(w.DATA,{updatedList:this.updatedList})),this.__updatedList=new f,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[_.CHANGE,this.__onAttrChange,this],[[g.ADD,g.REMOVE],this.__onChildEvent,this],[w.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:rt,updateBounds:at,updateChange:ht}=m,{pushAllChildBranch:lt,pushAllParent:ct}=v;const{worldBounds:dt}=y;class ut{constructor(t){this.updatedBounds=new x,this.beforeBounds=new x,this.afterBounds=new x,b(t)&&(t=new f(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,dt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,dt),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:ft,updateAllChange:pt}=m,gt=t.get("Layouter");class wt{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new S,this.target=t,e&&(this.config=n.default(e,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(L.START),this.layoutOnce(),t.emitEvent(new L(L.END,this.layoutedBlocks,this.times))}catch(t){gt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?gt.warn("layouting"):this.times>3?gt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(w.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 e=k.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=L,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new L(n,a,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?(rt(t,!0),e.add(t),t.isBranch&<(t,e),ct(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ct(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||at(s[t])}at(i)}})}(this.__levelList),function(t){t.list.forEach(ht)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new L(o,a,this.times)),i.emitEvent(new L(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,k.end(e)}fullLayout(){const t=k.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=L,o=this.getBlocks(new f(e));e.emitEvent(new L(i,o,this.times)),wt.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new L(s,o,this.times)),e.emitEvent(new L(n,o,this.times)),this.addBlocks(o),k.end(t)}static fullLayout(t){ft(t,!0),t.isBranch?v.updateBounds(t):m.updateBounds(t),pt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ut([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ut(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_([[L.REQUEST,this.layout,this],[L.AGAIN,this.layoutAgain,this],[w.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const _t=t.get("Renderer");class mt{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=n.default(i,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(L.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(p.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(p.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(p.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new x,_t.log(e.innerName,"---\x3e");try{this.emitRender(p.START),this.renderOnce(t),this.emitRender(p.END,this.totalBounds),T.clearRecycled()}catch(t){this.rendering=!1,_t.error(t)}_t.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return _t.warn("rendering");if(this.times>3)return _t.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new x,this.renderOptions={},t)this.emitRender(p.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(p.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(p.RENDER,this.renderBounds,this.renderOptions),this.emitRender(p.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 e=k.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new x(s);i.save(),s.spread(mt.clipSpread).ceil();const{ceilPartPixel:o}=this.config;i.clipWorld(s,o),i.clearWorld(s,o),this.__render(s,n),i.restore(),k.end(e)}fullRender(){const t=k.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),k.end(t)}__render(e,s){const{canvas:n,target:o}=this,r=e.includes(o.__world),a=r?{includes:r}:{bounds:e,includes:r};this.needFill&&n.fillWorld(e,this.config.fill),t.showRepaint&&t.drawRepaint(n,e),this.config.useCellRender&&(a.cellList=this.getCellList()),i.render(o,n,a),this.renderBounds=s=s||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=s:this.totalBounds.add(s),n.updateRender(s)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new x;e.setList(t),t.length=0,t.push(e)}}__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 e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return i.requestRender(e);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};i.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new x(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new x(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||_t.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new p(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[p.REQUEST,this.update,this],[L.END,this.__onLayoutEnd,this],[p.AGAIN,this.renderAgain,this],[a.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}mt.clipSpread=10;const vt={},{copyRadiusPoint:yt}=B,{hitRadiusPoint:xt}=E;class bt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new f(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new f;if(t.length){let e;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||m.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&m.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>m.worldHittable(t))}getPath(t){const e=new f,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new f;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new f,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:o}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=xt(i.__world,n.hitRadius?yt(vt,o,n.hitRadius):o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__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 s&&this.hitChild(i,o)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class St{constructor(t,e){this.config={},e&&(this.config=n.default(e,this.config)),this.picker=new bt(this.target=t,this),this.finder=l.finder&&l.finder(t,this.config)}getByPoint(t,e,s){const{target:n,picker:o}=this;return i.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,e,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):P.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(l,{watcher:(t,e)=>new ot(t,e),layouter:(t,e)=>new wt(t,e),renderer:(t,e,i)=>new mt(t,e,i),selector:(t,e)=>new St(t,e)}),i.layout=wt.fullLayout,i.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new f,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Lt={convert(t,e){const i=Y.getBase(t),{x:s,y:n}=e,o=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===o.pointerType&&(o.tangentialPressure=t.tangentialPressure,o.tiltX=t.tiltX,o.tiltY=t.tiltY,o.twist=t.twist),o},convertMouse(t,e){const i=Y.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=Lt.getTouch(t),s=Y.getBase(t),{x:n,y:o}=e;return Object.assign(Object.assign({},s),{x:n,y:o,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},kt={convert(t){const e=Y.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:Tt}=Y;class Bt extends G{get windowTarget(){const{view:t}=this;return t&&t.ownerDocument||window}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),this.windowTarget.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)this.windowTarget.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;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&&(!this.config.shadowDOM||!t.composedPath||!t.composedPath().includes(this.view))}onKeyDown(t){this.keyDown(kt.convert(t))}onKeyUp(t){this.keyUp(kt.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(Lt.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(Lt.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=Lt.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(Lt.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(Lt.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(Lt.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(Lt.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=Lt.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&Tt(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(Lt.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=Lt.getTouch(t);this.pointerMove(Lt.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=Lt.getTouch(t);this.pointerUp(Lt.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),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Y.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Y.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 e=Y.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(R.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),M(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>M(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,b(t))t.forEach(t=>this.eachCursor(t,e,i));else{const n=s(t)&&X.get(t);n&&i<2?this.eachCursor(n,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function Et(t,e,i){t.__.__font?N.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Pt(t,e,i,s,n){const o=i.__;M(t)?N.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&N.strokeArrow(t,i,s,n)}function Rt(t,e,i,s,n){const o=i.__;M(t)?N.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,o.__strokeWidth*e,o),N.drawTextStroke(i,s,n))}function Mt(t,e,i,s,n){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Rt(t,2,i,o,n),o.blendMode="outside"===e?"destination-out":"destination-in",N.fillText(i,o,n),o.blendMode="normal",m.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}const{getSpread:Ct,copyAndSpread:At,toOuterOf:Dt,getOuterOf:Ot,getByMove:Wt,move:It,getIntersectData:Ft}=E,zt={};let jt;const{stintSet:Ut}=n,{hasTransparent:Yt}=q;function Gt(t,e,i){if(!M(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:o}=i.__layout,{type:a}=e;switch(a){case"image":case"film":case"video":if(!e.url)return;n=H.image(i,t,e,o,!jt||!jt[e.url]),"image"!==a&&H[a](n);break;case"linear":n=K.linearGradient(e,o);break;case"radial":n=K.radialGradient(e,o);break;case"angular":n=K.conicGradient(e,o);break;case"solid":const{color:s,opacity:h}=e;n={type:a,style:q.string(s,h)};break;default:r(e.r)||(n={type:"solid",style:q.string(e)})}if(n&&(n.originPaint=e,s(n.style)&&Yt(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const Xt={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];b(a)||(a=[a]),jt=H.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=Gt(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(Ut(i,"__isAlphaPixelFill",n),Ut(i,"__isTransparentFill",o)):(Ut(i,"__isAlphaPixelStroke",n),Ut(i,"__isTransparentStroke",o),Ut(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Et(e,i,s)},fills:function(t,e,i,s){let n,o,r;for(let a=0,h=t.length;a<h;a++){if(n=t[a],o=n.originPaint,n.image){if(r?r++:r=1,H.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||o.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,o.scaleFixed,!1);1!==t&&i.scale(t,s)}o.blendMode&&(i.blendMode=o.blendMode),Et(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),Et(e,i,s),i.restoreBlendMode()):Et(e,i,s)}},fillPathOrText:Et,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:o}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[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}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>o.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)N.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":Pt(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Pt(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Pt(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Pt(t,2,e,r,s),r.clipUI(n),r.clearWorld(o),m.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){N.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Rt(t,1,e,i,s);break;case"inside":Mt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Rt(t,2,e,i,s):Mt(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:o,decorationY:r}=n;for(let t=0,i=o.length;t<i;t++)s=o[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;o.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,o){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,c=t.length;l<c;l++)if(r=t[l],(!r.image||!H.checkImage(r,!1,s,n,o))&&r.style){if(h){const{strokeStyle:t}=r;t?n.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(r.style,a.__strokeWidth*e,a)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?N.drawTextStroke(s,n,o):n.stroke(),n.restoreBlendMode()):i?N.drawTextStroke(s,n,o):n.stroke()}},shape:function(t,e,s){const n=e.getSameCanvas(),o=e.bounds,r=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,c,d,u,f,p;Dt(a.strokeSpread?(At(zt,a.boxBounds,a.strokeSpread),zt):a.boxBounds,r,h);let{scaleX:g,scaleY:w}=t.getRenderScaleData(!0);if(o.includes(h))p=n,l=f=h,c=r;else{let n;if(i.fullImageShadow)n=h;else{const t=a.renderShapeSpread?Ct(o,C.swapAndScale(a.renderShapeSpread,g,w)):o;n=Ft(t,h)}u=o.getFitMatrix(n);let{a:_,d:m}=u;u.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,s),g*=_,w*=m),f=Ot(h,u),l=Wt(f,-u.e,-u.f),c=Ot(r,u),It(c,-u.e,-u.f);const v=s.matrix;v?(d=new A(u),d.multiply(v),_*=v.scaleX,m*=v.scaleY):d=u,d.withScale(_,m),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(n,s),{canvas:n,matrix:d,fitMatrix:u,bounds:l,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:w}}};let Vt,Nt=new x;const{isSame:Ht}=E;function qt(t,e,i,s,n,o){let r=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=s.width/a.pixelRatio,a.__naturalHeight=s.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate("width"),m.updateBounds(t),t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),r=!1)),!n.data){H.createData(n,s,i,o);const{transform:t}=n.data,{opacity:e,blendMode:r}=i,h=t&&!t.onlyScale||a.path||a.cornerRadius;(h||e&&e<1||r)&&(n.complex=!h||2)}return i.filter&&H.applyFilter(n,s,i.filter,t),r}function Kt(t,e){Zt(t,D.LOAD,e)}function Qt(t,e){Zt(t,D.LOADED,e)}function $t(t,e,i){e.error=i,t.forceUpdate("surface"),Zt(t,D.ERROR,e)}function Zt(t,e,i){t.hasEvent(e)&&t.emitEvent(new D(e,i))}function Jt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:te,translate:ee}=O,ie=new x,se={},ne={};function oe(t,e,i,n){const o=s(t)||n?(n?i-n*e:i%e)/((n||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let re={},ae=F();const{get:he,set:le,rotateOfOuter:ce,translate:de,scaleOfOuter:ue,multiplyParent:fe,scale:pe,rotate:ge,skew:we}=O;function _e(t,e,i,s,n,o,r,a){r&&ge(t,r),a&&we(t,a.x,a.y),n&&pe(t,n,o),de(t,e.x+i,e.y+s)}const{get:me,scale:ve,copy:ye}=O,{getFloorScale:xe}=R,{abs:be}=Math;const Se={image:function(t,e,i,s,n){let o,r;const a=T.get(i,i.type);return Vt&&i===Vt.paint&&Ht(s,Vt.boxBounds)?o=Vt.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Vt=a.use>1?{leafPaint:o,paint:i,boxBounds:Nt.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(qt(t,e,i,a,o,s),n&&(Kt(t,r),Qt(t,r))):a.error?n&&$t(t,r,a.error):(n&&(Jt(t,!0),Kt(t,r)),o.loadId=a.load(()=>{Jt(t,!1),t.destroyed||(qt(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Qt(t,r)),o.loadId=void 0},e=>{Jt(t,!1),$t(t,r,e),o.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,s,n,o){const{scaleX:r,scaleY:a}=H.getImageRenderScaleData(t,s,n,o),h=t.film?t.nowIndex:r+"-"+a,{image:l,data:c,originPaint:d}=t,{exporting:u,snapshot:f}=o;return!(!c||t.patternId===h&&!u||f)&&(e&&(c.repeat?e=!1:d.changeful||t.film||"miniapp"===i.name||u||(e=i.image.isLarge(l,r,a)||l.width*r>8096||l.height*a>8096)),e?(s.__.__isFastShadow&&(n.fillStyle=t.style||"#000",n.fill()),H.drawImage(t,r,a,s,n,o),!0):(!t.style||d.sync||u?H.createPattern(t,s,n,o):H.createPatternTask(t,s,n,o),!1))},drawImage:function(t,e,i,s,n,o){const{data:r,image:a,complex:h}=t;let{width:l,height:c}=a;if(h){const{blendMode:o,opacity:d}=t.originPaint,{transform:u}=r;n.save(),2===h&&n.clipUI(s),o&&(n.blendMode=o),d&&(n.opacity*=d),u&&n.transform(u),a.render(n,0,0,l,c,s,t,e,i),n.restore()}else r.scaleX&&(l*=r.scaleX,c*=r.scaleY),a.render(n,0,0,l,c,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return o&&o.scaleX&&(n.scaleX*=Math.abs(o.scaleX),n.scaleY*=Math.abs(o.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(b(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,T.recyclePaint(s),e.__willDestroy&&n.parent&&H.recycleFilter(n,e.__leaf),n.loading&&(r||(r=e.__input&&e.__input[t]||[],b(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=T.patternTasker.add(()=>tt(this,void 0,void 0,function*(){H.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,s,n){let{scaleX:o,scaleY:r}=H.getImageRenderScaleData(t,e,s,n),a=t.film?t.nowIndex:o+"-"+r;if(t.patternId!==a&&!e.destroyed&&(!i.image.isLarge(t.image,o,r)||t.data.repeat)){const{image:s,data:n}=t,{opacity:h}=t.originPaint,{transform:l,gap:c}=n,d=H.getPatternFixScale(t,o,r);let u,f,p,{width:g,height:w}=s;d&&(o*=d,r*=d),g*=o,w*=r,c&&(f=c.x*o/be(n.scaleX||1),p=c.y*r/be(n.scaleY||1)),(l||1!==o||1!==r)&&(o*=xe(g+(f||0)),r*=xe(w+(p||0)),u=me(),l&&ye(u,l),ve(u,1/o,1/r));const _=s.getCanvas(g,w,h,void 0,f,p,e.leafer&&e.leafer.config.smooth,n.interlace),m=s.getPattern(_,n.repeat||i.origin.noRepeat||"no-repeat",u,t);t.style=m,t.patternId=a}},getPatternFixScale:function(t,e,s){const{image:n}=t;let o,r=i.image.maxPatternSize,a=n.width*n.height;return n.isSVG?e>1&&(o=Math.ceil(e)/e):r>a&&(r=a),(a*=e*s)>r&&(o=Math.sqrt(r/a)),o},createData:function(t,e,i,s){t.data=H.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=ie.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:n,height:o}=i,{mode:r,align:a,offset:h,scale:l,size:c,rotation:d,skew:u,clipSize:f,repeat:p,gap:g,interlace:w}=t,_=e.width===n&&e.height===o,m={mode:r},v="center"!==a&&(d||0)%180==90;let y,x;switch(E.set(ne,0,0,v?o:n,v?n:o),r&&"cover"!==r&&"fit"!==r?((l||c)&&(R.getScaleData(l,c,i,se),y=se.scaleX,x=se.scaleY),(a||g||p)&&(y&&E.scale(ne,y,x,!0),a&&W.toPoint(a,ne,e,ne,!0,!0))):_&&!d||(y=x=E.getFitScale(e,ne,"fit"!==r),E.put(e,i,a,y,!1,ne),E.scale(ne,y,x,!0)),h&&B.move(ne,h),r){case"stretch":_?y&&(y=x=void 0):(y=e.width/n,x=e.height/o,H.stretchMode(m,e,y,x));break;case"normal":case"clip":if(ne.x||ne.y||y||f||d||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),H.clipMode(m,e,ne.x,ne.y,y,x,d,u,t,i),t&&(y=y?y*t:t,x=x?x*i:i)}break;case"repeat":(!_||y||d||u)&&H.repeatMode(m,e,n,o,ne.x,ne.y,y,x,d,u,a,t.freeTransform),p||(m.repeat="repeat");const i=M(p);(g||i)&&(m.gap=function(t,e,i,s,n){let o,r;M(t)?(o=t.x,r=t.y):o=r=t;return{x:oe(o,i,n.width,e&&e.x),y:oe(r,s,n.height,e&&e.y)}}(g,i&&p,ne.width,ne.height,e));break;default:y&&H.fillOrFitMode(m,e,ne.x,ne.y,y,x,d)}return m.transform||(e.x||e.y)&&ee(m.transform=te(),e.x,e.y),y&&(m.scaleX=y,m.scaleY=x),p&&(m.repeat=s(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),w&&(m.interlace=I(w)||"percent"===w.type?{type:"x",offset:w}:w),m},stretchMode:function(t,e,i,s){const n=he(),{x:o,y:r}=e;o||r?de(n,o,r):i>0&&s>0&&(n.onlyScale=!0),pe(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,o,r){const a=he();de(a,e.x+i,e.y+s),pe(a,n,o),r&&ce(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,n,o,r,a,h,l){const c=he();_e(c,e,i,s,n,o,r,a),h&&(r||a?(le(ae),ue(ae,e,h,l),fe(c,ae)):ue(c,e,h,l)),t.transform=c},repeatMode:function(t,e,i,s,n,o,r,a,h,l,c,d){const u=he();if(d)_e(u,e,n,o,r,a,h,l);else{if(h)if("center"===c)ce(u,{x:i/2,y:s/2},h);else switch(ge(u,h),h){case 90:de(u,s,0);break;case 180:de(u,i,s);break;case 270:de(u,0,i)}re.x=e.x+n,re.y=e.y+o,de(u,re.x,re.y),r&&ue(u,re,r,a)}t.transform=u}},{toPoint:Le}=z,{hasTransparent:ke}=q,Te={},Be={};function Ee(t,e,i,n){if(i){let o,r,a,h;for(let t=0,l=i.length;t<l;t++)o=i[t],s(o)?(a=t/(l-1),r=q.string(o,n)):(a=o.offset,r=q.string(o.color,n)),e.addColorStop(a,r),!h&&ke(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Pe,getDistance:Re}=B,{get:Me,rotateOfOuter:Ce,scaleOfOuter:Ae}=O,{toPoint:De}=z,Oe={},We={};function Ie(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Pe(e,i);o=Me(),n?(Ae(o,e,r/a*(s||1),1),Ce(o,e,t+90)):(Ae(o,e,1,r/a*(s||1)),Ce(o,e,t))}return o}const{getDistance:Fe}=B,{toPoint:ze}=z,je={},Ue={};const Ye={linearGradient:function(t,e){let{from:s,to:n,type:o,opacity:r}=t;Le(s||"top",e,Te),Le(n||"bottom",e,Be);const a=i.canvas.createLinearGradient(Te.x,Te.y,Be.x,Be.y),h={type:o,style:a};return Ee(h,a,t.stops,r),h},radialGradient:function(t,e){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;De(s||"center",e,Oe),De(n||"bottom",e,We);const h=i.canvas.createRadialGradient(Oe.x,Oe.y,0,Oe.x,Oe.y,Re(Oe,We)),l={type:o,style:h};Ee(l,h,t.stops,r);const c=Ie(e,Oe,We,a,!0);return c&&(l.transform=c),l},conicGradient:function(t,e){let{from:s,to:n,type:o,opacity:r,rotation:a,stretch:h}=t;ze(s||"center",e,je),ze(n||"bottom",e,Ue);const l=i.conicGradientSupport?i.canvas.createConicGradient(a?a*j:0,je.x,je.y):i.canvas.createRadialGradient(je.x,je.y,0,je.x,je.y,Fe(je,Ue)),c={type:o,style:l};Ee(c,l,t.stops,r);const d=Ie(e,je,Ue,h||1,i.conicGradientRotate90);return d&&(c.transform=d),c},getTransform:Ie},{copy:Ge,move:Xe,toOffsetOutBounds:Ve}=E,{max:Ne,abs:He}=Math,qe={},Ke=new A,Qe={};function $e(t,e){let i,s,n,o,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),n=He(t.spread||0),r=Ne(r,n+o-s),a=Ne(a,n+o+i),h=Ne(h,n+o+s),l=Ne(l,n+o-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function Ze(t,e,s){const{shapeBounds:n}=s;let o,r;i.fullImageShadow?(Ge(qe,t.bounds),Xe(qe,e.x-n.x,e.y-n.y),o=t.bounds,r=qe):(o=n,r=e),t.copyWorld(s.canvas,o,r)}const{toOffsetOutBounds:Je}=E,ti={};const ei=$e;const ii={shadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:c,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Ve(h,Qe,l),r.forEach((r,g)=>{let w=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}f.setWorldShadow(Qe.offsetX+(r.x||0)*d*w,Qe.offsetY+(r.y||0)*u*w,(r.blur||0)*d*w,q.string(r.color)),n=Q.getShadowTransform(t,f,i,r,Qe,w),n&&f.setTransform(n),Ze(f,Qe,i),n&&f.resetTransform(),s=l,r.box&&(f.restore(),f.save(),a&&(f.copyWorld(f,l,o,"copy"),s=o),a?f.copyWorld(a,o,o,"destination-out"):f.copyWorld(i.canvas,c,h,"destination-out")),m.copyCanvasByWorld(t,e,f,s,r.blendMode),p&&g<p&&f.clearWorld(s)}),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:c,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Je(h,ti,l),r.forEach((r,g)=>{let w=1;if(r.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}f.save(),f.setWorldShadow(ti.offsetX+(r.x||0)*d*w,ti.offsetY+(r.y||0)*u*w,(r.blur||0)*d*w),n=Q.getShadowTransform(t,f,i,r,ti,w,!0),n&&f.setTransform(n),Ze(f,ti,i),f.restore(),a?(f.copyWorld(f,l,o,"copy"),f.copyWorld(a,o,o,"source-out"),s=o):(f.copyWorld(i.canvas,c,h,"source-out"),s=l),f.fillWorld(s,q.string(r.color),"source-in"),m.copyCanvasByWorld(t,e,f,s,r.blendMode),p&&g<p&&f.clearWorld(s)}),f.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:$e,getShadowTransform:function(t,e,i,s,n,o,r){if(s.spread){const i=2*s.spread*o*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Ke.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Ke}},isTransformShadow(t){},getInnerShadowSpread:ei},{excludeRenderBounds:si}=y;let ni;function oi(t,e,i,s,n,o,r,a){switch(e){case"grayscale":ni||(ni=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);ai(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":ai(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function ri(t){return t.getSameCanvas(!1,!0)}function ai(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}$.prototype.__renderMask=function(t,e){let i,s,n,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&&(oi(this,r,t,n,s,o,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||si(i,e)||i.__render(t,e),o=i.__.opacity,ni=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=ri(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=ri(t)),n||(n=ri(t)),i.__render(s,e));continue}const c=1===o&&i.__.__blendMode;c&&oi(this,r,t,n,s,o,void 0,!1),si(i,e)||i.__render(n||t,e),c&&oi(this,r,t,n,s,o,c,!1)}oi(this,r,t,n,s,o,void 0,!0)};const hi=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",li=hi+"_#~&*+\\=|≮≯≈≠=…",ci=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 di(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ui=di("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fi=di("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),pi=di(hi),gi=di(li),wi=di("- —/~|┆·");var _i;!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"}(_i||(_i={}));const{Letter:mi,Single:vi,Before:yi,After:xi,Symbol:bi,Break:Si}=_i;function Li(t){return ui[t]?mi:wi[t]?Si:fi[t]?yi:pi[t]?xi:gi[t]?bi:ci.test(t)?vi:mi}const ki={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Ti(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:Bi}=ki,{Letter:Ei,Single:Pi,Before:Ri,After:Mi,Symbol:Ci,Break:Ai}=_i;let Di,Oi,Wi,Ii,Fi,zi,ji,Ui,Yi,Gi,Xi,Vi,Ni,Hi,qi,Ki,Qi,$i=[];function Zi(t,e){Yi&&!Ui&&(Ui=Yi),Di.data.push({char:t,width:e}),Wi+=e}function Ji(){Ii+=Wi,Di.width=Wi,Oi.words.push(Di),Di={data:[]},Wi=0}function ts(){Hi&&(qi.paraNumber++,Oi.paraStart=!0,Hi=!1),Yi&&(Oi.startCharSize=Ui,Oi.endCharSize=Yi,Ui=0),Oi.width=Ii,Ki.width?Bi(Oi):Qi&&es(),$i.push(Oi),Oi={words:[]},Ii=0}function es(){Ii>(qi.maxWidth||0)&&(qi.maxWidth=Ii)}const{top:is,right:ss,bottom:ns,left:os}=U;function rs(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const as={getDrawData:function(t,e){s(t)||(t=String(t));let n=0,o=0,r=e.__getInput("width")||0,a=e.__getInput("height")||0;const{__padding:h}=e;h&&(r?(n=h[os],r-=h[ss]+h[os],!r&&(r=.01)):e.autoSizeAlign||(n=h[os]),a?(o=h[is],a-=h[is]+h[ns],!a&&(a=.01)):e.autoSizeAlign||(o=h[is]));const l={bounds:{x:n,y:o,width:r,height:a},rows:[],paraNumber:0,font:i.canvas.font=e.__font};return function(t,e,s){qi=t,$i=t.rows,Ki=t.bounds,Qi=!Ki.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=i,{width:h}=Ki;if(s.__isCharMode){const t="none"!==s.textWrap,i="break"===s.textWrap;Hi=!0,Xi=null,Ui=ji=Yi=Wi=Ii=0,Di={data:[]},Oi={words:[]};for(let s=0,l=(e=[...e]).length;s<l;s++)zi=e[s],"\n"===zi?(Wi&&Ji(),Oi.paraEnd=!0,ts(),Hi=!0):(Gi=Li(zi),Gi===Ei&&"none"!==r&&(zi=Ti(zi,r,!Wi)),ji=a.measureText(zi).width,n&&(n<0&&(Yi=ji),ji+=n),Vi=Gi===Pi&&(Xi===Pi||Xi===Ei)||Xi===Pi&&Gi!==Mi,Ni=!(Gi!==Ri&&Gi!==Pi||Xi!==Ci&&Xi!==Mi),Fi=Hi&&o?h-o:h,t&&h&&Ii+Wi+ji>Fi&&(i?(Wi&&Ji(),Ii&&ts()):(Ni||(Ni=Gi===Ei&&Xi==Mi),Vi||Ni||Gi===Ai||Gi===Ri||Gi===Pi||Wi+ji>Fi?(Wi&&Ji(),Ii&&ts()):Ii&&ts()))," "===zi&&!0!==Hi&&Ii+Wi===0||(Gi===Ai?(" "===zi&&Wi&&Ji(),Zi(zi,ji),Ji()):Vi||Ni?(Wi&&Ji(),Zi(zi,ji)):Zi(zi,ji)),Xi=Gi);Wi&&Ji(),Ii&&ts(),$i.length>0&&($i[$i.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{qi.paraNumber++,Ii=a.measureText(t).width,$i.push({x:o||0,text:t,width:Ii,paraStart:!0}),Qi&&es()})}(l,t,e),h&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":rs(e,"x",t[os]);break;case"right":rs(e,"x",-t[ss])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":rs(e,"y",t[is]);break;case"bottom":rs(e,"y",-t[ns])}}(h,l,e,r,a),function(t,e){const{rows:i,bounds:s}=t,n=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:w}=s,_=o*n+(d?d*(t.paraNumber-1):0),m=r;if(h&&_>w)_=Math.max(e.__autoHeight?_:w,o),n>1&&(t.overflow=n);else if(w||u)switch(c){case"middle":p+=(w-_)/2;break;case"bottom":p+=w-_}m+=p;let v,y,x,b=g||u?g:t.maxWidth;for(let r=0,c=n;r<c;r++){if(v=i[r],v.x=f,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&d&&r>0&&(m+=d),v.y=m,m+=o,t.overflow>r&&m>_&&(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<s.x&&(s.x=y),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=_}(l,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,__letterSpacing:r}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let c,d,u,f,p,g,w,_,m,v;s.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?(w={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,w),(t.isOverflow||" "!==w.char)&&t.data.push(w)):c=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,c,t.data,t.isOverflow,v&&f),v&&(m=i===_-1,u?m||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(m?1:0))))})),t.words=null)})}(l,e,r),l.overflow&&function(t,e,s,n){const{rows:o,overflow:r}=t;let{textOverflow:a}=e;if(r&&o.splice(r),n&&a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?i.canvas.measureText(a).width:0,c=s+n-l;("none"===e.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<c));s--){if(h<c&&" "!==t.char||!s){e.data.splice(s+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,e,n,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,M(o)?(i=o.type,o.color&&(t.decorationColor=q.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(l,e),l}};const hs={string:function(t,e){if(!t)return"#000";const i=I(e)&&e<1;if(s(t)){if(!i||!q.object)return t;t=q.object(t)}let n=r(t.a)?1:t.a;i&&(n*=e);const o=t.r+","+t.g+","+t.b;return 1===n?"rgb("+o+")":"rgba("+o+","+n+")"}};Object.assign(Z,as),Object.assign(q,hs),Object.assign(N,Xt),Object.assign(H,Se),Object.assign(K,Ye),Object.assign(Q,ii),Object.assign(l,{interaction:(t,e,i,s)=>new Bt(t,e,i,s),hitCanvas:(t,e)=>new it(t,e),hitCanvasManager:()=>new V}),st();export{Bt as Interaction,wt as Layouter,it as LeaferCanvas,J as PathNodeHandleType,bt as Picker,mt as Renderer,St as Selector,ot as Watcher,st as useCanvas};
|
|
2
2
|
//# sourceMappingURL=web.esm.min.js.map
|