@leafer-draw/node 1.0.0-rc.22 → 1.0.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node.cjs +22 -13
- package/dist/node.esm.js +23 -14
- package/dist/node.esm.min.js +1 -1
- package/dist/node.min.cjs +1 -1
- package/package.json +7 -7
package/dist/node.cjs
CHANGED
|
@@ -627,8 +627,11 @@ class Renderer {
|
|
|
627
627
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
628
628
|
this.addBlock(this.canvas.bounds);
|
|
629
629
|
this.target.forceUpdate('surface');
|
|
630
|
+
return;
|
|
630
631
|
}
|
|
631
632
|
}
|
|
633
|
+
this.addBlock(new core.Bounds(0, 0, 1, 1));
|
|
634
|
+
this.changed = true;
|
|
632
635
|
}
|
|
633
636
|
__onLayoutEnd(event) {
|
|
634
637
|
if (event.data)
|
|
@@ -899,7 +902,7 @@ function shape(ui, current, options) {
|
|
|
899
902
|
}
|
|
900
903
|
else {
|
|
901
904
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
902
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
905
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
903
906
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
904
907
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
905
908
|
if (fitMatrix.a < 1) {
|
|
@@ -999,10 +1002,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
999
1002
|
rotate(transform, rotation);
|
|
1000
1003
|
data.transform = transform;
|
|
1001
1004
|
}
|
|
1002
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
1005
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
1003
1006
|
const transform = get$4();
|
|
1004
1007
|
if (rotation) {
|
|
1005
|
-
if (
|
|
1008
|
+
if (align === 'center') {
|
|
1006
1009
|
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
1007
1010
|
}
|
|
1008
1011
|
else {
|
|
@@ -1035,12 +1038,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1035
1038
|
let { width, height } = image;
|
|
1036
1039
|
if (paint.padding)
|
|
1037
1040
|
box = tempBox.set(box).shrink(paint.padding);
|
|
1038
|
-
const { opacity, mode,
|
|
1041
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
1039
1042
|
const sameBox = box.width === width && box.height === height;
|
|
1040
1043
|
if (blendMode)
|
|
1041
1044
|
leafPaint.blendMode = blendMode;
|
|
1042
1045
|
const data = leafPaint.data = { mode };
|
|
1043
|
-
const swapSize =
|
|
1046
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
1044
1047
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
1045
1048
|
let x = 0, y = 0, scaleX, scaleY;
|
|
1046
1049
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
@@ -1058,11 +1061,11 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1058
1061
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
1059
1062
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
1060
1063
|
}
|
|
1061
|
-
if (
|
|
1064
|
+
if (align) {
|
|
1062
1065
|
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
1063
1066
|
if (scaleX)
|
|
1064
1067
|
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
1065
|
-
core.
|
|
1068
|
+
core.AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
1066
1069
|
x += tempPoint.x, y += tempPoint.y;
|
|
1067
1070
|
}
|
|
1068
1071
|
if (offset)
|
|
@@ -1079,7 +1082,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1079
1082
|
break;
|
|
1080
1083
|
case 'repeat':
|
|
1081
1084
|
if (!sameBox || scaleX || rotation)
|
|
1082
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
1085
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
1083
1086
|
if (!repeat)
|
|
1084
1087
|
data.repeat = 'repeat';
|
|
1085
1088
|
break;
|
|
@@ -1996,11 +1999,13 @@ function clipText(drawData, style) {
|
|
|
1996
1999
|
const { rows, overflow } = drawData;
|
|
1997
2000
|
let { textOverflow } = style;
|
|
1998
2001
|
rows.splice(overflow);
|
|
1999
|
-
if (textOverflow !== '
|
|
2000
|
-
if (textOverflow === '
|
|
2002
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
2003
|
+
if (textOverflow === 'hide')
|
|
2004
|
+
textOverflow = '';
|
|
2005
|
+
else if (textOverflow === 'ellipsis')
|
|
2001
2006
|
textOverflow = '...';
|
|
2002
2007
|
let char, charRight;
|
|
2003
|
-
const ellipsisWidth = core.Platform.canvas.measureText(textOverflow).width;
|
|
2008
|
+
const ellipsisWidth = textOverflow ? core.Platform.canvas.measureText(textOverflow).width : 0;
|
|
2004
2009
|
const right = style.x + style.width - ellipsisWidth;
|
|
2005
2010
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
2006
2011
|
list.forEach(row => {
|
|
@@ -2168,8 +2173,12 @@ const ExportModule = {
|
|
|
2168
2173
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
2169
2174
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
2170
2175
|
const { slice, trim, onCanvas } = options;
|
|
2171
|
-
|
|
2172
|
-
|
|
2176
|
+
let scale = options.scale || 1;
|
|
2177
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
2178
|
+
if (leaf.isApp) {
|
|
2179
|
+
scale *= pixelRatio;
|
|
2180
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
2181
|
+
}
|
|
2173
2182
|
const screenshot = options.screenshot || leaf.isApp;
|
|
2174
2183
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
2175
2184
|
const needFill = core.FileHelper.isOpaqueImage(filename) || fill, matrix = new core.Matrix();
|
package/dist/node.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LeaferCanvasBase, Platform, canvasPatch, Creator, LeaferImage, FileHelper, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, AnimateEvent, ResizeEvent, BoundsHelper, MatrixHelper,
|
|
1
|
+
import { LeaferCanvasBase, Platform, canvasPatch, Creator, LeaferImage, FileHelper, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, AnimateEvent, ResizeEvent, BoundsHelper, MatrixHelper, AlignHelper, ImageEvent, PointHelper, Direction4, TwoPointBoundsHelper, TaskProcessor, Matrix } from '@leafer/core';
|
|
2
2
|
export * from '@leafer/core';
|
|
3
3
|
export { LeaferImage } from '@leafer/core';
|
|
4
4
|
import { writeFileSync } from 'fs';
|
|
@@ -628,8 +628,11 @@ class Renderer {
|
|
|
628
628
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
629
629
|
this.addBlock(this.canvas.bounds);
|
|
630
630
|
this.target.forceUpdate('surface');
|
|
631
|
+
return;
|
|
631
632
|
}
|
|
632
633
|
}
|
|
634
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
635
|
+
this.changed = true;
|
|
633
636
|
}
|
|
634
637
|
__onLayoutEnd(event) {
|
|
635
638
|
if (event.data)
|
|
@@ -900,7 +903,7 @@ function shape(ui, current, options) {
|
|
|
900
903
|
}
|
|
901
904
|
else {
|
|
902
905
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
903
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
906
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
904
907
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
905
908
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
906
909
|
if (fitMatrix.a < 1) {
|
|
@@ -1000,10 +1003,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1000
1003
|
rotate(transform, rotation);
|
|
1001
1004
|
data.transform = transform;
|
|
1002
1005
|
}
|
|
1003
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
1006
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
1004
1007
|
const transform = get$4();
|
|
1005
1008
|
if (rotation) {
|
|
1006
|
-
if (
|
|
1009
|
+
if (align === 'center') {
|
|
1007
1010
|
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
1008
1011
|
}
|
|
1009
1012
|
else {
|
|
@@ -1036,12 +1039,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1036
1039
|
let { width, height } = image;
|
|
1037
1040
|
if (paint.padding)
|
|
1038
1041
|
box = tempBox.set(box).shrink(paint.padding);
|
|
1039
|
-
const { opacity, mode,
|
|
1042
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
1040
1043
|
const sameBox = box.width === width && box.height === height;
|
|
1041
1044
|
if (blendMode)
|
|
1042
1045
|
leafPaint.blendMode = blendMode;
|
|
1043
1046
|
const data = leafPaint.data = { mode };
|
|
1044
|
-
const swapSize =
|
|
1047
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
1045
1048
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
1046
1049
|
let x = 0, y = 0, scaleX, scaleY;
|
|
1047
1050
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
@@ -1059,11 +1062,11 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1059
1062
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
1060
1063
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
1061
1064
|
}
|
|
1062
|
-
if (
|
|
1065
|
+
if (align) {
|
|
1063
1066
|
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
1064
1067
|
if (scaleX)
|
|
1065
1068
|
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
1066
|
-
|
|
1069
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
1067
1070
|
x += tempPoint.x, y += tempPoint.y;
|
|
1068
1071
|
}
|
|
1069
1072
|
if (offset)
|
|
@@ -1080,7 +1083,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1080
1083
|
break;
|
|
1081
1084
|
case 'repeat':
|
|
1082
1085
|
if (!sameBox || scaleX || rotation)
|
|
1083
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
1086
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
1084
1087
|
if (!repeat)
|
|
1085
1088
|
data.repeat = 'repeat';
|
|
1086
1089
|
break;
|
|
@@ -1997,11 +2000,13 @@ function clipText(drawData, style) {
|
|
|
1997
2000
|
const { rows, overflow } = drawData;
|
|
1998
2001
|
let { textOverflow } = style;
|
|
1999
2002
|
rows.splice(overflow);
|
|
2000
|
-
if (textOverflow !== '
|
|
2001
|
-
if (textOverflow === '
|
|
2003
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
2004
|
+
if (textOverflow === 'hide')
|
|
2005
|
+
textOverflow = '';
|
|
2006
|
+
else if (textOverflow === 'ellipsis')
|
|
2002
2007
|
textOverflow = '...';
|
|
2003
2008
|
let char, charRight;
|
|
2004
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
2009
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
2005
2010
|
const right = style.x + style.width - ellipsisWidth;
|
|
2006
2011
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
2007
2012
|
list.forEach(row => {
|
|
@@ -2169,8 +2174,12 @@ const ExportModule = {
|
|
|
2169
2174
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
2170
2175
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
2171
2176
|
const { slice, trim, onCanvas } = options;
|
|
2172
|
-
|
|
2173
|
-
|
|
2177
|
+
let scale = options.scale || 1;
|
|
2178
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
2179
|
+
if (leaf.isApp) {
|
|
2180
|
+
scale *= pixelRatio;
|
|
2181
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
2182
|
+
}
|
|
2174
2183
|
const screenshot = options.screenshot || leaf.isApp;
|
|
2175
2184
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
2176
2185
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
package/dist/node.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,Platform as e,canvasPatch as n,Creator as i,LeaferImage as s,FileHelper as o,LeafList as a,DataHelper as r,RenderEvent as d,ChildEvent as l,WatchEvent as c,PropertyEvent as h,LeafHelper as u,BranchHelper as f,Bounds as _,LeafBoundsHelper as p,Debug as g,LeafLevelList as w,LayoutEvent as y,Run as m,ImageManager as v,AnimateEvent as x,ResizeEvent as b,BoundsHelper as B,MatrixHelper as R,AroundHelper as k,ImageEvent as E,PointHelper as S,Direction4 as L,TwoPointBoundsHelper as A,TaskProcessor as W,Matrix as O}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{writeFileSync as T}from"fs";import{PaintImage as M,ColorConvert as C,PaintGradient as I,Export as D,Group as F,TextConvert as P,Paint as U,Effect as N}from"@leafer-ui/draw";export*from"@leafer-ui/draw";function Y(t,e,n,i){return new(n||(n=Promise))((function(s,o){function a(t){try{d(i.next(t))}catch(t){o(t)}}function r(t){try{d(i.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}d((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class G extends t{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),e.roundRectPatch&&(this.context.__proto__.roundRect=null,n(this.context.__proto__))}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}const{mineType:X,fileType:j}=o;function q(t,n){if(e.canvasType=t,!e.origin){if("skia"===t){const{Canvas:t,loadImage:i}=n;e.origin={createCanvas:(e,n,i)=>new t(e,n,i),canvasToDataURL:(t,e,n)=>t.toDataURLSync(e,{quality:n}),canvasToBolb:(t,e,n)=>t.toBuffer(e,{quality:n}),canvasSaveAs:(t,e,n)=>t.saveAs(e,{quality:n}),download(t,e){},loadImage:i},e.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:i}=n;e.origin={createCanvas:(e,n,i)=>new t(e,n,i),canvasToDataURL:(t,e,n)=>t.toDataURL(X(e),n),canvasToBolb:(t,e,n)=>Y(this,void 0,void 0,(function*(){return t.toBuffer(X(e),n)})),canvasSaveAs:(t,e,n)=>Y(this,void 0,void 0,(function*(){return T(e,t.toBuffer(X(j(e)),n))})),download(t,e){},loadImage:i}}e.ellipseToCurve=!0,e.event={stopDefault(t){},stopNow(t){},stop(t){}},e.canvas=i.canvas()}}Object.assign(i,{canvas:(t,e)=>new G(t,e),image:t=>new s(t)}),e.name="node",e.requestRender=function(t){setTimeout(t)},e.devicePixelRatio=1,e.conicGradientSupport=!0;class V{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new a;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 a,this.target=t,e&&(this.config=r.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(d.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===l.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,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new c(c.DATA,{updatedList:this.updatedList})),this.__updatedList=new a,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(h.CHANGE,this.__onAttrChange,this),t.on_([l.ADD,l.REMOVE],this.__onChildEvent,this),t.on_(c.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:z,updateBounds:H,updateAllWorldOpacity:Q}=u,{pushAllChildBranch:J,pushAllParent:Z}=f;const{worldBounds:$}=p,K={x:0,y:0,width:1e5,height:1e5};class tt{constructor(t){this.updatedBounds=new _,this.beforeBounds=new _,this.afterBounds=new _,t instanceof Array&&(t=new a(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,$)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(K):this.afterBounds.setListWithFn(t,$),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:et,updateAllChange:nt}=u,it=g.get("Layouter");class st{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new w,this.target=t,e&&(this.config=r.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.running)return;const{target:t}=this;this.times=0;try{t.emit(y.START),this.layoutOnce(),t.emitEvent(new y(y.END,this.layoutedBlocks,this.times))}catch(t){it.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?it.warn("layouting"):this.times>3?it.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.REQUEST),this.totalTimes>1?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=m.start("PartLayout"),{target:n,__updatedList:i}=this,{BEFORE:s,LAYOUT:o,AFTER:a}=y,r=this.getBlocks(i);r.forEach((t=>t.setBefore())),n.emitEvent(new y(s,r,this.times)),this.extraBlock=null,i.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(z(t,!0),e.add(t),t.isBranch&&J(t,e),Z(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Z(t,e)))}))}(i,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||H(i[t])}H(n)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&Q(t),t.__updateChange()}))}(i),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),n.emitEvent(new y(o,r,this.times)),n.emitEvent(new y(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,m.end(e)}fullLayout(){const t=m.start("FullLayout"),{target:e}=this,{BEFORE:n,LAYOUT:i,AFTER:s}=y,o=this.getBlocks(new a(e));e.emitEvent(new y(n,o,this.times)),st.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new y(i,o,this.times)),e.emitEvent(new y(s,o,this.times)),this.addBlocks(o),m.end(t)}static fullLayout(t){et(t,!0),t.isBranch?f.updateBounds(t):u.updateBounds(t),nt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new tt([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new tt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(y.REQUEST,this.layout,this),t.on_(y.AGAIN,this.layoutAgain,this),t.on_(c.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ot=g.get("Renderer");class at{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,n&&(this.config=r.default(n,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(y.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new _,ot.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),v.clearRecycled()}catch(t){this.rendering=!1,ot.error(t)}ot.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ot.warn("rendering");if(this.times>3)return ot.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new _,this.renderOptions={},t)this.emitRender(d.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(d.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(d.RENDER,this.renderBounds,this.renderOptions),this.emitRender(d.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return ot.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=m.start("PartRender"),{canvas:n}=this,i=t.getIntersect(n.bounds),s=t.includes(this.target.__world),o=new _(i);n.save(),s&&!g.showRepaint?n.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),n.clearWorld(i,!0),n.clipWorld(i,!0)),this.__render(i,s,o),n.restore(),m.end(e)}fullRender(){const t=m.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),m.end(t)}__render(t,e,n){const i=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),g.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,i),this.renderBounds=n||t,this.renderOptions=i,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),g.showHitView&&this.renderHitView(i),g.showBoundsView&&this.renderBoundsView(i),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new _;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&(this.target.emit(x.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:n}=t.old;new _(0,0,e,n).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("surface"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||ot.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,n){this.target.emitEvent(new d(t,this.times,e,n))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(d.REQUEST,this.update,this),t.on_(y.END,this.__onLayoutEnd,this),t.on_(d.AGAIN,this.renderAgain,this),t.on_(b.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function rt(t,e){let n;const{rows:i,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=i.length;t<a;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),s&&e.fillRect(n.x,n.y+s,n.width,o)}function dt(t,e,n){const{strokeAlign:i}=e.__,s="string"!=typeof t;switch(i){case"center":n.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?ht(t,!0,e,n):ct(e,n);break;case"inside":lt("inside",t,s,e,n);break;case"outside":lt("outside",t,s,e,n)}}function lt(t,e,n,i,s){const{__strokeWidth:o,__font:a}=i.__,r=s.getSameCanvas(!0,!0);r.setStroke(n?void 0:e,2*o,i.__),r.font=a,n?ht(e,!0,i,r):ct(i,r),r.blendMode="outside"===t?"destination-out":"destination-in",rt(i,r),r.blendMode="normal",i.__worldFlipped?s.copyWorldByReset(r,i.__nowWorld):s.copyWorldToInner(r,i.__nowWorld,i.__layout.renderBounds),r.recycle(i.__nowWorld)}function ct(t,e){let n;const{rows:i,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=i.length;t<a;t++)n=i[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),s&&e.strokeRect(n.x,n.y+s,n.width,o)}function ht(t,e,n,i){let s;for(let o=0,a=t.length;o<a;o++)s=t[o],s.image&&M.checkImage(n,i,s,!1)||s.style&&(i.strokeStyle=s.style,s.blendMode?(i.saveBlendMode(s.blendMode),e?ct(n,i):i.stroke(),i.restoreBlendMode()):e?ct(n,i):i.stroke())}Object.assign(i,{watcher:(t,e)=>new V(t,e),layouter:(t,e)=>new st(t,e),renderer:(t,e,n)=>new at(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,i)=>{}}),e.layout=st.fullLayout;const{getSpread:ut,getOuterOf:ft,getByMove:_t,getIntersectData:pt}=B;let gt;function wt(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:i}=n.__layout;switch(e.type){case"solid":let{type:s,blendMode:o,color:a,opacity:r}=e;return{type:s,blendMode:o,style:C.string(a,r)};case"image":return M.image(n,t,e,i,!gt||!gt[e.url]);case"linear":return I.linearGradient(e,i);case"radial":return I.radialGradient(e,i);case"angular":return I.conicGradient(e,i);default:return e.r?{type:"solid",style:C.string(e)}:void 0}}const yt={compute:function(t,e){const n=e.__,i=[];let s,o=n.__input[t];o instanceof Array||(o=[o]),gt=M.recycleImage(t,n);for(let n,s=0,a=o.length;s<a;s++)n=wt(t,o[s],e),n&&i.push(n);n["_"+t]=i.length?i:void 0,i.length&&i[0].image&&(s=i[0].image.hasOpacityPixel),"fill"===t?n.__pixelFill=s:n.__pixelStroke=s},fill:function(t,e,n){n.fillStyle=t,e.__.__font?rt(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,e,n){let i;const{windingRule:s,__font:o}=e.__;for(let a=0,r=t.length;a<r;a++)i=t[a],i.image&&M.checkImage(e,n,i,!o)||i.style&&(n.fillStyle=i.style,i.transform?(n.save(),n.transform(i.transform),i.blendMode&&(n.blendMode=i.blendMode),o?rt(e,n):s?n.fill(s):n.fill(),n.restore()):i.blendMode?(n.saveBlendMode(i.blendMode),o?rt(e,n):s?n.fill(s):n.fill(),n.restoreBlendMode()):o?rt(e,n):s?n.fill(s):n.fill())},fillText:rt,stroke:function(t,e,n){const i=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=i;if(s)if(a)dt(t,e,n);else switch(o){case"center":n.setStroke(t,s,i),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*s,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const o=n.getSameCanvas(!0,!0);o.setStroke(t,2*s,i),e.__drawRenderPath(o),o.stroke(),i.windingRule?o.clip(i.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(o,e.__nowWorld):n.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=i;if(s)if(a)dt(t,e,n);else switch(o){case"center":n.setStroke(void 0,s,i),ht(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*s,i),i.windingRule?n.clip(i.windingRule):n.clip(),ht(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:o}=e.__layout,a=n.getSameCanvas(!0,!0);e.__drawRenderPath(a),a.setStroke(void 0,2*s,i),ht(t,!1,e,a),i.windingRule?a.clip(i.windingRule):a.clip(),a.clearWorld(o),e.__worldFlipped?n.copyWorldByReset(a,e.__nowWorld):n.copyWorldToInner(a,e.__nowWorld,o),a.recycle(e.__nowWorld)}},strokeText:dt,drawTextStroke:ct,shape:function(t,e,n){const i=e.getSameCanvas(),s=t.__nowWorld;let o,a,r,d,{scaleX:l,scaleY:c}=s;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(s))d=i,o=r=s;else{const{renderShapeSpread:i}=t.__layout,h=pt(i?ut(e.bounds,i*l,i*c):e.bounds,s);a=e.bounds.getFitMatrix(h);let{a:u,d:f}=a;if(a.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,n),l*=u,c*=f),r=ft(s,a),o=_t(r,-a.e,-a.f),n.matrix){const{matrix:t}=n;a.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:a.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:a,bounds:o,worldCanvas:d,shapeBounds:r,scaleX:l,scaleY:c}}};let mt={};const{get:vt,rotateOfOuter:xt,translate:bt,scaleOfOuter:Bt,scale:Rt,rotate:kt}=R;function Et(t,e,n,i,s,o,a){const r=vt();bt(r,e.x+n,e.y+i),Rt(r,s,o),a&&xt(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function St(t,e,n,i,s,o,a){const r=vt();bt(r,e.x+n,e.y+i),s&&Rt(r,s,o),a&&kt(r,a),t.transform=r}function Lt(t,e,n,i,s,o,a,r,d,l){const c=vt();if(d)if("center"===l)xt(c,{x:n/2,y:i/2},d);else switch(kt(c,d),d){case 90:bt(c,i,0);break;case 180:bt(c,n,i);break;case 270:bt(c,0,n)}mt.x=e.x+s,mt.y=e.y+o,bt(c,mt.x,mt.y),a&&Bt(c,mt,a,r),t.transform=c}const{get:At,translate:Wt}=R,Ot=new _,Tt={};function Mt(t,e,n,i){let{width:s,height:o}=e;n.padding&&(i=Ot.set(i).shrink(n.padding));const{opacity:a,mode:r,around:d,offset:l,scale:c,size:h,rotation:u,blendMode:f,repeat:_}=n,p=i.width===s&&i.height===o;f&&(t.blendMode=f);const g=t.data={mode:r},w="center"!==d&&(u||0)%180==90,y=w?o:s,m=w?s:o;let v,x,b=0,B=0;if(r&&"cover"!==r&&"fit"!==r)h?(v=("number"==typeof h?h:h.width)/s,x=("number"==typeof h?h:h.height)/o):c&&(v="number"==typeof c?c:c.x,x="number"==typeof c?c:c.y);else if(!p||u){const t=i.width/y,e=i.height/m;v=x="fit"===r?Math.min(t,e):Math.max(t,e),b+=(i.width-s*v)/2,B+=(i.height-o*x)/2}if(d){const t={x:b,y:B,width:y,height:m};v&&(t.width*=v,t.height*=x),k.toPoint(d,i,Tt,!0,t),b+=Tt.x,B+=Tt.y}switch(l&&(b+=l.x,B+=l.y),r){case"strench":p||(s=i.width,o=i.height);break;case"normal":case"clip":(b||B||v||u)&&St(g,i,b,B,v,x,u);break;case"repeat":(!p||v||u)&&Lt(g,i,s,o,b,B,v,x,u,d),_||(g.repeat="repeat");break;default:v&&Et(g,i,b,B,v,x,u)}g.transform||(i.x||i.y)&&(g.transform=At(),Wt(g.transform,i.x,i.y)),v&&"strench"!==r&&(g.scaleX=v,g.scaleY=x),g.width=s,g.height=o,a&&(g.opacity=a),_&&(g.repeat="string"==typeof _?"x"===_?"repeat-x":"repeat-y":"repeat")}let Ct,It=new _;const{isSame:Dt}=B;function Ft(t,e,n,i,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||Mt(s,i,n,o),!0}function Pt(t,e){Yt(t,E.LOAD,e)}function Ut(t,e){Yt(t,E.LOADED,e)}function Nt(t,e,n){e.error=n,t.forceUpdate("surface"),Yt(t,E.ERROR,e)}function Yt(t,e,n){t.hasEvent(e)&&t.emitEvent(new E(e,n))}function Gt(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:Xt,scale:jt,copy:qt}=R,{ceil:Vt,abs:zt}=Math;function Ht(t,n,i){let{scaleX:s,scaleY:o}=v.patternLocked?t.__world:t.__nowWorld;const a=s+"-"+o;if(n.patternId===a||t.destroyed)return!1;{s=zt(s),o=zt(o);const{image:t,data:r}=n;let d,l,{width:c,height:h,scaleX:u,scaleY:f,opacity:_,transform:p,repeat:g}=r;u&&(l=Xt(),qt(l,p),jt(l,1/u,1/f),s*=u,o*=f),s*=i,o*=i,c*=s,h*=o;const w=c*h;if(!g&&w>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}w>y&&(d=Math.sqrt(w/y)),d&&(s/=d,o/=d,c/=d,h/=d),u&&(s/=u,o/=f),(p||1!==s||1!==o)&&(l||(l=Xt(),p&&qt(l,p)),jt(l,1/s,1/o));const m=t.getCanvas(Vt(c)||1,Vt(h)||1,_),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,n);return n.style=v,n.patternId=a,!0}}const{abs:Qt}=Math;const Jt={image:function(t,e,n,i,s){let o,a;const r=v.get(n);return Ct&&n===Ct.paint&&Dt(i,Ct.boxBounds)?o=Ct.leafPaint:(o={type:n.type,image:r},Ct=r.use>1?{leafPaint:o,paint:n,boxBounds:It.set(i)}:null),(s||r.loading)&&(a={image:r,attrName:e,attrValue:n}),r.ready?(Ft(t,e,n,r,o,i),s&&(Pt(t,a),Ut(t,a))):r.error?s&&Nt(t,a,r.error):(Gt(t,!0),s&&Pt(t,a),o.loadId=r.load((()=>{Gt(t,!1),t.destroyed||(Ft(t,e,n,r,o,i)&&(r.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ut(t,a)),o.loadId=null}),(e=>{Gt(t,!1),Nt(t,a,e),o.loadId=null}))),o},createData:Mt,fillOrFitMode:Et,clipMode:St,repeatMode:Lt,createPattern:Ht,checkImage:function(t,n,i,s){const{scaleX:o,scaleY:a}=v.patternLocked?t.__world:t.__nowWorld;if(i.data&&i.patternId!==o+"-"+a){const{data:r}=i;if(s)if(r.repeat)s=!1;else{let{width:t,height:i}=r;t*=Qt(o)*n.pixelRatio,i*=Qt(a)*n.pixelRatio,r.scaleX&&(t*=r.scaleX,i*=r.scaleY),s=t*i>e.image.maxCacheSize}return s?(n.save(),n.clip(),i.blendMode&&(n.blendMode=i.blendMode),r.opacity&&(n.opacity*=r.opacity),r.transform&&n.transform(r.transform),n.drawImage(i.image.view,0,0,r.width,r.height),n.restore(),!0):(!i.style||D.running?Ht(t,i,n.pixelRatio):i.patternTask||(i.patternTask=v.patternTasker.add((()=>Y(this,void 0,void 0,(function*(){i.patternTask=null,n.bounds.hit(t.__nowWorld)&&Ht(t,i,n.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(t,e){const n=e["_"+t];if(n instanceof Array){let i,s,o,a;for(let r=0,d=n.length;r<d;r++)i=n[r].image,a=i&&i.url,a&&(s||(s={}),s[a]=!0,v.recycle(i),i.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),i.unload(n[r].loadId,!o.some((t=>t.url===a)))));return s}return null}},Zt={x:.5,y:0},$t={x:.5,y:1};function Kt(t,e,n){let i;for(let s=0,o=e.length;s<o;s++)i=e[s],t.addColorStop(i.offset,C.string(i.color,n))}const{set:te,getAngle:ee,getDistance:ne}=S,{get:ie,rotateOfOuter:se,scaleOfOuter:oe}=R,ae={x:.5,y:.5},re={x:.5,y:1},de={},le={};const{set:ce,getAngle:he,getDistance:ue}=S,{get:fe,rotateOfOuter:_e,scaleOfOuter:pe}=R,ge={x:.5,y:.5},we={x:.5,y:1},ye={},me={};const ve={linearGradient:function(t,n){let{from:i,to:s,type:o,blendMode:a,opacity:r}=t;i||(i=Zt),s||(s=$t);const d=e.canvas.createLinearGradient(n.x+i.x*n.width,n.y+i.y*n.height,n.x+s.x*n.width,n.y+s.y*n.height);Kt(d,t.stops,r);const l={type:o,style:d};return a&&(l.blendMode=a),l},radialGradient:function(t,n){let{from:i,to:s,type:o,opacity:a,blendMode:r,stretch:d}=t;i||(i=ae),s||(s=re);const{x:l,y:c,width:h,height:u}=n;let f;te(de,l+i.x*h,c+i.y*u),te(le,l+s.x*h,c+s.y*u),(h!==u||d)&&(f=ie(),oe(f,de,h/u*(d||1),1),se(f,de,ee(de,le)+90));const _=e.canvas.createRadialGradient(de.x,de.y,0,de.x,de.y,ne(de,le));Kt(_,t.stops,a);const p={type:o,style:_,transform:f};return r&&(p.blendMode=r),p},conicGradient:function(t,n){let{from:i,to:s,type:o,opacity:a,blendMode:r,stretch:d}=t;i||(i=ge),s||(s=we);const{x:l,y:c,width:h,height:u}=n;ce(ye,l+i.x*h,c+i.y*u),ce(me,l+s.x*h,c+s.y*u);const f=fe(),_=he(ye,me);e.conicGradientRotate90?(pe(f,ye,h/u*(d||1),1),_e(f,ye,_+90)):(pe(f,ye,1,h/u*(d||1)),_e(f,ye,_));const p=e.conicGradientSupport?e.canvas.createConicGradient(0,ye.x,ye.y):e.canvas.createRadialGradient(ye.x,ye.y,0,ye.x,ye.y,ue(ye,me));Kt(p,t.stops,a);const g={type:o,style:p,transform:f};return r&&(g.blendMode=r),g}},{copy:xe,toOffsetOutBounds:be}=B,Be={},Re={};function ke(t,n,i,s){const{bounds:o,shapeBounds:a}=s;if(e.fullImageShadow){if(xe(Be,t.bounds),Be.x+=n.x-a.x,Be.y+=n.y-a.y,i){const{matrix:t}=s;Be.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),Be.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),Be.width*=i,Be.height*=i}t.copyWorld(s.canvas,t.bounds,Be)}else i&&(xe(Be,n),Be.x-=n.width/2*(i-1),Be.y-=n.height/2*(i-1),Be.width*=i,Be.height*=i),t.copyWorld(s.canvas,a,i?Be:n)}const{toOffsetOutBounds:Ee}=B,Se={};const Le={shadow:function(t,e,n){let i,s;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),_=r.length-1;be(l,Re),r.forEach(((r,p)=>{f.setWorldShadow(Re.offsetX+r.x*h,Re.offsetY+r.y*u,r.blur*h,r.color),s=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ke(f,Re,s,n),i=l,r.box&&(f.restore(),f.save(),d&&(f.copyWorld(f,l,o,"copy"),i=o),d?f.copyWorld(d,o,o,"destination-out"):f.copyWorld(n.canvas,c,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,i,o,r.blendMode):e.copyWorldToInner(f,i,a.renderBounds,r.blendMode),_&&p<_&&f.clearWorld(i,!0)})),f.recycle(i)},innerShadow:function(t,e,n){let i,s;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),_=r.length-1;Ee(l,Se),r.forEach(((r,p)=>{f.save(),f.setWorldShadow(Se.offsetX+r.x*h,Se.offsetY+r.y*u,r.blur*h),s=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ke(f,Se,s,n),f.restore(),d?(f.copyWorld(f,l,o,"copy"),f.copyWorld(d,o,o,"source-out"),i=o):(f.copyWorld(n.canvas,c,l,"source-out"),i=l),f.fillWorld(i,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,i,o,r.blendMode):e.copyWorldToInner(f,i,a.renderBounds,r.blendMode),_&&p<_&&f.clearWorld(i,!0)})),f.recycle(i)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Ae}=p;function We(t,e,n,i,s,o){switch(e){case"alpha":!function(t,e,n,i){const s=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,s),i.recycle(s),Te(t,e,n,1)}(t,n,i,s);break;case"opacity-path":Te(t,n,i,o);break;case"path":n.restore()}}function Oe(t){return t.getSameCanvas(!1,!0)}function Te(t,e,n,i){const s=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,s),n.recycle(s)}F.prototype.__renderMask=function(t,e){let n,i,s,o,a;const{children:r}=this;for(let d=0,l=r.length;d<l;d++)n=r[d],n.__.mask&&(a&&(We(this,a,t,s,i,o),i=s=null),"path"===n.__.maskType?(n.opacity<1?(a="opacity-path",o=n.opacity,s||(s=Oe(t))):(a="path",t.save()),n.__clip(s||t,e)):(a="alpha",i||(i=Oe(t)),s||(s=Oe(t)),n.__render(i,e)),"clipping"!==n.__.maskType)||Ae(n,e)||n.__render(s||t,e);We(this,a,t,s,i,o)};const Me=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ce=Me+"_#~&*+\\=|≮≯≈≠=…",Ie=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function De(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Fe=De("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Pe=De("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ue=De(Me),Ne=De(Ce),Ye=De("- —/~|┆·");var Ge;!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"}(Ge||(Ge={}));const{Letter:Xe,Single:je,Before:qe,After:Ve,Symbol:ze,Break:He}=Ge;function Qe(t){return Fe[t]?Xe:Ye[t]?He:Pe[t]?qe:Ue[t]?Ve:Ne[t]?ze:Ie.test(t)?je:Xe}const Je={trimRight(t){const{words:e}=t;let n,i=0,s=e.length;for(let o=s-1;o>-1&&(n=e[o].data[0]," "===n.char);o--)i++,t.width-=n.width;i&&e.splice(s-i,i)}};function Ze(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:$e}=Je,{Letter:Ke,Single:tn,Before:en,After:nn,Symbol:sn,Break:on}=Ge;let an,rn,dn,ln,cn,hn,un,fn,_n,pn,gn,wn,yn,mn,vn,xn,bn=[];function Bn(t,e){_n&&!fn&&(fn=_n),an.data.push({char:t,width:e}),dn+=e}function Rn(){ln+=dn,an.width=dn,rn.words.push(an),an={data:[]},dn=0}function kn(){mn&&(vn.paraNumber++,rn.paraStart=!0,mn=!1),_n&&(rn.startCharSize=fn,rn.endCharSize=_n,fn=0),rn.width=ln,xn.width&&$e(rn),bn.push(rn),rn={words:[]},ln=0}const En=0,Sn=1,Ln=2;const{top:An,right:Wn,bottom:On,left:Tn}=L;function Mn(t,e,n){const{bounds:i,rows:s}=t;i[e]+=n;for(let t=0;t<s.length;t++)s[t][e]+=n}const Cn={getDrawData:function(t,n){"string"!=typeof t&&(t=String(t));let i=0,s=0,o=n.__getInput("width")||0,a=n.__getInput("height")||0;const{textDecoration:r,__font:d,__padding:l}=n;l&&(o&&(i=l[Tn],o-=l[Wn]+l[Tn]),a&&(s=l[An],a-=l[An]+l[On]));const c={bounds:{x:i,y:s,width:o,height:a},rows:[],paraNumber:0,font:e.canvas.font=d};return function(t,n,i){vn=t,bn=t.rows,xn=t.bounds;const{__letterSpacing:s,paraIndent:o,textCase:a}=i,{canvas:r}=e,{width:d,height:l}=xn;if(d||l||s||"none"!==a){const t="none"!==i.textWrap,e="break"===i.textWrap;mn=!0,gn=null,fn=un=_n=dn=ln=0,an={data:[]},rn={words:[]};for(let i=0,l=n.length;i<l;i++)hn=n[i],"\n"===hn?(dn&&Rn(),rn.paraEnd=!0,kn(),mn=!0):(pn=Qe(hn),pn===Ke&&"none"!==a&&(hn=Ze(hn,a,!dn)),un=r.measureText(hn).width,s&&(s<0&&(_n=un),un+=s),wn=pn===tn&&(gn===tn||gn===Ke)||gn===tn&&pn!==nn,yn=!(pn!==en&&pn!==tn||gn!==sn&&gn!==nn),cn=mn&&o?d-o:d,t&&d&&ln+dn+un>cn&&(e?(dn&&Rn(),kn()):(yn||(yn=pn===Ke&&gn==nn),wn||yn||pn===on||pn===en||pn===tn||dn+un>cn?(dn&&Rn(),kn()):kn()))," "===hn&&!0!==mn&&ln+dn===0||(pn===on?(" "===hn&&dn&&Rn(),Bn(hn,un),Rn()):wn||yn?(dn&&Rn(),Bn(hn,un)):Bn(hn,un)),gn=pn);dn&&Rn(),ln&&kn(),bn.length>0&&(bn[bn.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{vn.paraNumber++,bn.push({x:o||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(c,t,n),l&&function(t,e,n,i,s){if(!i)switch(n.textAlign){case"left":Mn(e,"x",t[Tn]);break;case"right":Mn(e,"x",-t[Wn])}if(!s)switch(n.verticalAlign){case"top":Mn(e,"y",t[An]);break;case"bottom":Mn(e,"y",-t[On])}}(l,c,n,o,a),function(t,e){const{rows:n,bounds:i}=t,{__lineHeight:s,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:d,verticalAlign:l,paraSpacing:c}=e;let h,u,f,{x:_,y:p,width:g,height:w}=i,y=s*n.length+(c?c*(t.paraNumber-1):0),m=o;if(r&&y>w)y=Math.max(w,s),t.overflow=n.length;else switch(l){case"middle":p+=(w-y)/2;break;case"bottom":p+=w-y}m+=p;for(let o=0,l=n.length;o<l;o++){switch(h=n[o],h.x=_,d){case"center":h.x+=(g-h.width)/2;break;case"right":h.x+=g-h.width}h.paraStart&&c&&o>0&&(m+=c),h.y=m,m+=s,t.overflow>o&&m>y&&(h.isOverflow=!0,t.overflow=o+1),u=h.x,f=h.width,a<0&&(h.width<0?(f=-h.width+e.fontSize+a,u-=f,f+=e.fontSize):f-=a),u<i.x&&(i.x=u),f>i.width&&(i.width=f),r&&g&&g<f&&(h.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=y}(c,n),function(t,e,n,i){const{rows:s}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let d,l,c,h,u;s.forEach((t=>{t.words&&(c=a&&t.paraStart?a:0,l=n&&"justify"===o&&t.words.length>1?(n-t.width-c)/(t.words.length-1):0,h=r||t.isOverflow?En:l>.01?Sn:Ln,t.isOverflow&&!r&&(t.textMode=!0),h===Ln?(t.x+=c,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=c,d=t.x,t.data=[],t.words.forEach((e=>{h===Sn?(u={char:"",x:d},d=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,n){return t.forEach((t=>{" "!==t.char&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(c,n,o),c.overflow&&function(t,n){const{rows:i,overflow:s}=t;let{textOverflow:o}=n;if(i.splice(s),"hide"!==o){let t,a;"ellipsis"===o&&(o="...");const r=e.canvas.measureText(o).width,d=n.x+n.width-r;("none"===n.textWrap?i:[i[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let n=e.data.length-1;for(let i=n;i>-1&&(t=e.data[i],a=t.x+t.width,!(i===n&&a<d));i--){if(a<d&&" "!==t.char){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=r,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(c,n),"none"!==r&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(c,n),c}};const In={string:function(t,e){if("string"==typeof t)return t;let n=void 0===t.a?1:t.a;e&&(n*=e);const i=t.r+","+t.g+","+t.b;return 1===n?"rgb("+i+")":"rgba("+i+","+n+")"}},{setPoint:Dn,addPoint:Fn,toBounds:Pn}=A;const Un={export(t,n,s){return this.running=!0,function(t){Nn||(Nn=new W);return new Promise((e=>{Nn.add((()=>Y(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((a=>new Promise((r=>{const d=t=>{a(t),r(),this.running=!1};if("json"===n)return d({data:t.toJSON()});if("json"===o.fileType(n))return e.origin.download("data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(t.toJSON())),n),d({data:!0});const{leafer:l}=t;l?l.waitViewCompleted((()=>Y(this,void 0,void 0,(function*(){s=o.getExportOptions(s);let e,a,r=1,c=1;const{worldTransform:h,isLeafer:u,isFrame:f}=t,{slice:p,trim:g,onCanvas:w}=s,y=s.scale||1,m=s.pixelRatio||1,v=s.screenshot||t.isApp,x=u&&v&&void 0===s.fill?t.fill:s.fill,b=o.isOpaqueImage(n)||x,B=new O;if(v)e=!0===v?u?l.canvas.bounds:t.worldRenderBounds:v;else{let n=s.relative||(u?"inner":"local");switch(r=h.scaleX,c=h.scaleY,n){case"inner":B.set(h);break;case"local":B.set(h).divide(t.localTransform),r/=t.scaleX,c/=t.scaleY;break;case"world":r=1,c=1;break;case"page":n=t.leafer;default:B.set(h).divide(t.getTransform(n));const e=n.worldTransform;r/=r/e.scaleX,c/=c/e.scaleY}e=t.getBounds("render",n)}const{x:R,y:k,width:E,height:S}=new _(e).scale(y);let L=i.canvas({width:Math.round(E),height:Math.round(S),pixelRatio:m});const A={matrix:B.scale(1/y).invert().translate(-R,-k).withScale(1/r*y,1/c*y)};if(p&&(t=l,A.bounds=L.bounds),L.save(),f&&void 0!==x){const e=t.get("fill");t.fill="",t.__render(L,A),t.fill=e}else t.__render(L,A);if(L.restore(),g){a=function(t){const{width:e,height:n}=t.view,{data:i}=t.context.getImageData(0,0,e,n);let s,o,a,r=0;for(let t=0;t<i.length;t+=4)0!==i[t+3]&&(s=r%e,o=(r-s)/e,a?Fn(a,s,o):Dn(a={},s,o)),r++;const d=new _;return Pn(a,d),d.scale(1/t.pixelRatio).ceil()}(L);const t=L,{width:e,height:n}=a,s={x:0,y:0,width:e,height:n,pixelRatio:m};L=i.canvas(s),L.copyWorld(t,a,s)}b&&L.fillWorld(L.bounds,x||"#FFFFFF","destination-over"),w&&w(L);const W="canvas"===n?L:yield L.export(n,s);d({data:W,width:L.pixelWidth,height:L.pixelHeight,renderBounds:e,trimBounds:a})})))):d({data:!1})}))))}};let Nn;const Yn=t.prototype,Gn=g.get("@leafer-ui/export");Yn.export=function(t,e){const{quality:n,blob:i}=o.getExportOptions(e);return t.includes(".")?this.saveAs(t,n):i?this.toBlob(t,n):this.toDataURL(t,n)},Yn.toBlob=function(t,n){return new Promise((i=>{e.origin.canvasToBolb(this.view,t,n).then((t=>{i(t)})).catch((t=>{Gn.error(t),i(null)}))}))},Yn.toDataURL=function(t,n){return e.origin.canvasToDataURL(this.view,t,n)},Yn.saveAs=function(t,n){return new Promise((i=>{e.origin.canvasSaveAs(this.view,t,n).then((()=>{i(!0)})).catch((t=>{Gn.error(t),i(!1)}))}))},Object.assign(P,Cn),Object.assign(C,In),Object.assign(U,yt),Object.assign(M,Jt),Object.assign(I,ve),Object.assign(N,Le),Object.assign(D,Un);export{st as Layouter,G as LeaferCanvas,at as Renderer,V as Watcher,q as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,Creator as n,LeaferImage as s,FileHelper as o,LeafList as a,DataHelper as r,RenderEvent as d,ChildEvent as l,WatchEvent as c,PropertyEvent as h,LeafHelper as u,BranchHelper as f,Bounds as p,LeafBoundsHelper as _,Debug as g,LeafLevelList as w,LayoutEvent as y,Run as m,ImageManager as v,AnimateEvent as x,ResizeEvent as b,BoundsHelper as B,MatrixHelper as R,AlignHelper as k,ImageEvent as E,PointHelper as S,Direction4 as L,TwoPointBoundsHelper as A,TaskProcessor as W,Matrix as O}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{writeFileSync as T}from"fs";import{PaintImage as M,ColorConvert as C,PaintGradient as I,Export as D,Group as F,TextConvert as P,Paint as U,Effect as N}from"@leafer-ui/draw";export*from"@leafer-ui/draw";function Y(t,e,i,n){return new(i||(i=Promise))((function(s,o){function a(t){try{d(n.next(t))}catch(t){o(t)}}function r(t){try{d(n.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}d((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class G extends t{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),e.roundRectPatch&&(this.context.__proto__.roundRect=null,i(this.context.__proto__))}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}const{mineType:X,fileType:j}=o;function q(t,i){if(e.canvasType=t,!e.origin){if("skia"===t){const{Canvas:t,loadImage:n}=i;e.origin={createCanvas:(e,i,n)=>new t(e,i,n),canvasToDataURL:(t,e,i)=>t.toDataURLSync(e,{quality:i}),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>t.saveAs(e,{quality:i}),download(t,e){},loadImage:n},e.roundRectPatch=!0}else if("napi"===t){const{Canvas:t,loadImage:n}=i;e.origin={createCanvas:(e,i,n)=>new t(e,i,n),canvasToDataURL:(t,e,i)=>t.toDataURL(X(e),i),canvasToBolb:(t,e,i)=>Y(this,void 0,void 0,(function*(){return t.toBuffer(X(e),i)})),canvasSaveAs:(t,e,i)=>Y(this,void 0,void 0,(function*(){return T(e,t.toBuffer(X(j(e)),i))})),download(t,e){},loadImage:n}}e.ellipseToCurve=!0,e.event={stopDefault(t){},stopNow(t){},stop(t){}},e.canvas=n.canvas()}}Object.assign(n,{canvas:(t,e)=>new G(t,e),image:t=>new s(t)}),e.name="node",e.requestRender=function(t){setTimeout(t)},e.devicePixelRatio=1,e.conicGradientSupport=!0;class V{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new a;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 a,this.target=t,e&&(this.config=r.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(d.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===l.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 c(c.DATA,{updatedList:this.updatedList})),this.__updatedList=new a,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(h.CHANGE,this.__onAttrChange,this),t.on_([l.ADD,l.REMOVE],this.__onChildEvent,this),t.on_(c.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:z,updateBounds:H,updateAllWorldOpacity:Q}=u,{pushAllChildBranch:J,pushAllParent:Z}=f;const{worldBounds:$}=_,K={x:0,y:0,width:1e5,height:1e5};class tt{constructor(t){this.updatedBounds=new p,this.beforeBounds=new p,this.afterBounds=new p,t instanceof Array&&(t=new a(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,$)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(K):this.afterBounds.setListWithFn(t,$),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:et,updateAllChange:it}=u,nt=g.get("Layouter");class st{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new w,this.target=t,e&&(this.config=r.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.running)return;const{target:t}=this;this.times=0;try{t.emit(y.START),this.layoutOnce(),t.emitEvent(new y(y.END,this.layoutedBlocks,this.times))}catch(t){nt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?nt.warn("layouting"):this.times>3?nt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.REQUEST),this.totalTimes>1?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=m.start("PartLayout"),{target:i,__updatedList:n}=this,{BEFORE:s,LAYOUT:o,AFTER:a}=y,r=this.getBlocks(n);r.forEach((t=>t.setBefore())),i.emitEvent(new y(s,r,this.times)),this.extraBlock=null,n.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(z(t,!0),e.add(t),t.isBranch&&J(t,e),Z(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Z(t,e)))}))}(n,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||H(n[t])}H(i)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&Q(t),t.__updateChange()}))}(n),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new y(o,r,this.times)),i.emitEvent(new y(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,m.end(e)}fullLayout(){const t=m.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:n,AFTER:s}=y,o=this.getBlocks(new a(e));e.emitEvent(new y(i,o,this.times)),st.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new y(n,o,this.times)),e.emitEvent(new y(s,o,this.times)),this.addBlocks(o),m.end(t)}static fullLayout(t){et(t,!0),t.isBranch?f.updateBounds(t):u.updateBounds(t),it(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new tt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new tt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(y.REQUEST,this.layout,this),t.on_(y.AGAIN,this.layoutAgain,this),t.on_(c.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ot=g.get("Renderer");class at{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,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=r.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(y.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new p,ot.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),v.clearRecycled()}catch(t){this.rendering=!1,ot.error(t)}ot.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ot.warn("rendering");if(this.times>3)return ot.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new p,this.renderOptions={},t)this.emitRender(d.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(d.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(d.RENDER,this.renderBounds,this.renderOptions),this.emitRender(d.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return ot.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=m.start("PartRender"),{canvas:i}=this,n=t.getIntersect(i.bounds),s=t.includes(this.target.__world),o=new p(n);i.save(),s&&!g.showRepaint?i.clear():(n.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(n,!0),i.clipWorld(n,!0)),this.__render(n,s,o),i.restore(),m.end(e)}fullRender(){const t=m.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),m.end(t)}__render(t,e,i){const n=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),g.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,n),this.renderBounds=i||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),g.showHitView&&this.renderHitView(n),g.showBoundsView&&this.renderBoundsView(n),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new p;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&(this.target.emit(x.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new p(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 p(0,0,1,1)),this.changed=!0}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||ot.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,i){this.target.emitEvent(new d(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(d.REQUEST,this.update,this),t.on_(y.END,this.__onLayoutEnd,this),t.on_(d.AGAIN,this.renderAgain,this),t.on_(b.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function rt(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),s&&e.fillRect(i.x,i.y+s,i.width,o)}function dt(t,e,i){const{strokeAlign:n}=e.__,s="string"!=typeof t;switch(n){case"center":i.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?ht(t,!0,e,i):ct(e,i);break;case"inside":lt("inside",t,s,e,i);break;case"outside":lt("outside",t,s,e,i)}}function lt(t,e,i,n,s){const{__strokeWidth:o,__font:a}=n.__,r=s.getSameCanvas(!0,!0);r.setStroke(i?void 0:e,2*o,n.__),r.font=a,i?ht(e,!0,n,r):ct(n,r),r.blendMode="outside"===t?"destination-out":"destination-in",rt(n,r),r.blendMode="normal",n.__worldFlipped?s.copyWorldByReset(r,n.__nowWorld):s.copyWorldToInner(r,n.__nowWorld,n.__layout.renderBounds),r.recycle(n.__nowWorld)}function ct(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),s&&e.strokeRect(i.x,i.y+s,i.width,o)}function ht(t,e,i,n){let s;for(let o=0,a=t.length;o<a;o++)s=t[o],s.image&&M.checkImage(i,n,s,!1)||s.style&&(n.strokeStyle=s.style,s.blendMode?(n.saveBlendMode(s.blendMode),e?ct(i,n):n.stroke(),n.restoreBlendMode()):e?ct(i,n):n.stroke())}Object.assign(n,{watcher:(t,e)=>new V(t,e),layouter:(t,e)=>new st(t,e),renderer:(t,e,i)=>new at(t,e,i),selector:(t,e)=>{},interaction:(t,e,i,n)=>{}}),e.layout=st.fullLayout;const{getSpread:ut,getOuterOf:ft,getByMove:pt,getIntersectData:_t}=B;let gt;function wt(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:n}=i.__layout;switch(e.type){case"solid":let{type:s,blendMode:o,color:a,opacity:r}=e;return{type:s,blendMode:o,style:C.string(a,r)};case"image":return M.image(i,t,e,n,!gt||!gt[e.url]);case"linear":return I.linearGradient(e,n);case"radial":return I.radialGradient(e,n);case"angular":return I.conicGradient(e,n);default:return e.r?{type:"solid",style:C.string(e)}:void 0}}const yt={compute:function(t,e){const i=e.__,n=[];let s,o=i.__input[t];o instanceof Array||(o=[o]),gt=M.recycleImage(t,i);for(let i,s=0,a=o.length;s<a;s++)i=wt(t,o[s],e),i&&n.push(i);i["_"+t]=n.length?n:void 0,n.length&&n[0].image&&(s=n[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=s:i.__pixelStroke=s},fill:function(t,e,i){i.fillStyle=t,e.__.__font?rt(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,i){let n;const{windingRule:s,__font:o}=e.__;for(let a=0,r=t.length;a<r;a++)n=t[a],n.image&&M.checkImage(e,i,n,!o)||n.style&&(i.fillStyle=n.style,n.transform?(i.save(),i.transform(n.transform),n.blendMode&&(i.blendMode=n.blendMode),o?rt(e,i):s?i.fill(s):i.fill(),i.restore()):n.blendMode?(i.saveBlendMode(n.blendMode),o?rt(e,i):s?i.fill(s):i.fill(),i.restoreBlendMode()):o?rt(e,i):s?i.fill(s):i.fill())},fillText:rt,stroke:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)dt(t,e,i);else switch(o){case"center":i.setStroke(t,s,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*s,n),e.__drawRenderPath(o),o.stroke(),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)dt(t,e,i);else switch(o){case"center":i.setStroke(void 0,s,n),ht(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),ht(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),a.setStroke(void 0,2*s,n),ht(t,!1,e,a),n.windingRule?a.clip(n.windingRule):a.clip(),a.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(a,e.__nowWorld):i.copyWorldToInner(a,e.__nowWorld,o),a.recycle(e.__nowWorld)}},strokeText:dt,drawTextStroke:ct,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let o,a,r,d,{scaleX:l,scaleY:c}=s;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(s))d=n,o=r=s;else{const{renderShapeSpread:n}=t.__layout,h=_t(n?ut(e.bounds,l===c?n*l:[n*c,n*l]):e.bounds,s);a=e.bounds.getFitMatrix(h);let{a:u,d:f}=a;if(a.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,i),l*=u,c*=f),r=ft(s,a),o=pt(r,-a.e,-a.f),i.matrix){const{matrix:t}=i;a.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:a.withScale(u,f)})}return t.__renderShape(n,i),{canvas:n,matrix:a,bounds:o,worldCanvas:d,shapeBounds:r,scaleX:l,scaleY:c}}};let mt={};const{get:vt,rotateOfOuter:xt,translate:bt,scaleOfOuter:Bt,scale:Rt,rotate:kt}=R;function Et(t,e,i,n,s,o,a){const r=vt();bt(r,e.x+i,e.y+n),Rt(r,s,o),a&&xt(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function St(t,e,i,n,s,o,a){const r=vt();bt(r,e.x+i,e.y+n),s&&Rt(r,s,o),a&&kt(r,a),t.transform=r}function Lt(t,e,i,n,s,o,a,r,d,l){const c=vt();if(d)if("center"===l)xt(c,{x:i/2,y:n/2},d);else switch(kt(c,d),d){case 90:bt(c,n,0);break;case 180:bt(c,i,n);break;case 270:bt(c,0,i)}mt.x=e.x+s,mt.y=e.y+o,bt(c,mt.x,mt.y),a&&Bt(c,mt,a,r),t.transform=c}const{get:At,translate:Wt}=R,Ot=new p,Tt={};function Mt(t,e,i,n){let{width:s,height:o}=e;i.padding&&(n=Ot.set(n).shrink(i.padding));const{opacity:a,mode:r,align:d,offset:l,scale:c,size:h,rotation:u,blendMode:f,repeat:p}=i,_=n.width===s&&n.height===o;f&&(t.blendMode=f);const g=t.data={mode:r},w="center"!==d&&(u||0)%180==90,y=w?o:s,m=w?s:o;let v,x,b=0,B=0;if(r&&"cover"!==r&&"fit"!==r)h?(v=("number"==typeof h?h:h.width)/s,x=("number"==typeof h?h:h.height)/o):c&&(v="number"==typeof c?c:c.x,x="number"==typeof c?c:c.y);else if(!_||u){const t=n.width/y,e=n.height/m;v=x="fit"===r?Math.min(t,e):Math.max(t,e),b+=(n.width-s*v)/2,B+=(n.height-o*x)/2}if(d){const t={x:b,y:B,width:y,height:m};v&&(t.width*=v,t.height*=x),k.toPoint(d,t,n,Tt,!0),b+=Tt.x,B+=Tt.y}switch(l&&(b+=l.x,B+=l.y),r){case"strench":_||(s=n.width,o=n.height);break;case"normal":case"clip":(b||B||v||u)&&St(g,n,b,B,v,x,u);break;case"repeat":(!_||v||u)&&Lt(g,n,s,o,b,B,v,x,u,d),p||(g.repeat="repeat");break;default:v&&Et(g,n,b,B,v,x,u)}g.transform||(n.x||n.y)&&(g.transform=At(),Wt(g.transform,n.x,n.y)),v&&"strench"!==r&&(g.scaleX=v,g.scaleY=x),g.width=s,g.height=o,a&&(g.opacity=a),p&&(g.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat")}let Ct,It=new p;const{isSame:Dt}=B;function Ft(t,e,i,n,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||Mt(s,n,i,o),!0}function Pt(t,e){Yt(t,E.LOAD,e)}function Ut(t,e){Yt(t,E.LOADED,e)}function Nt(t,e,i){e.error=i,t.forceUpdate("surface"),Yt(t,E.ERROR,e)}function Yt(t,e,i){t.hasEvent(e)&&t.emitEvent(new E(e,i))}function Gt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Xt,scale:jt,copy:qt}=R,{ceil:Vt,abs:zt}=Math;function Ht(t,i,n){let{scaleX:s,scaleY:o}=v.patternLocked?t.__world:t.__nowWorld;const a=s+"-"+o;if(i.patternId===a||t.destroyed)return!1;{s=zt(s),o=zt(o);const{image:t,data:r}=i;let d,l,{width:c,height:h,scaleX:u,scaleY:f,opacity:p,transform:_,repeat:g}=r;u&&(l=Xt(),qt(l,_),jt(l,1/u,1/f),s*=u,o*=f),s*=n,o*=n,c*=s,h*=o;const w=c*h;if(!g&&w>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}w>y&&(d=Math.sqrt(w/y)),d&&(s/=d,o/=d,c/=d,h/=d),u&&(s/=u,o/=f),(_||1!==s||1!==o)&&(l||(l=Xt(),_&&qt(l,_)),jt(l,1/s,1/o));const m=t.getCanvas(Vt(c)||1,Vt(h)||1,p),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=a,!0}}const{abs:Qt}=Math;const Jt={image:function(t,e,i,n,s){let o,a;const r=v.get(i);return Ct&&i===Ct.paint&&Dt(n,Ct.boxBounds)?o=Ct.leafPaint:(o={type:i.type,image:r},Ct=r.use>1?{leafPaint:o,paint:i,boxBounds:It.set(n)}:null),(s||r.loading)&&(a={image:r,attrName:e,attrValue:i}),r.ready?(Ft(t,e,i,r,o,n),s&&(Pt(t,a),Ut(t,a))):r.error?s&&Nt(t,a,r.error):(Gt(t,!0),s&&Pt(t,a),o.loadId=r.load((()=>{Gt(t,!1),t.destroyed||(Ft(t,e,i,r,o,n)&&(r.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ut(t,a)),o.loadId=null}),(e=>{Gt(t,!1),Nt(t,a,e),o.loadId=null}))),o},createData:Mt,fillOrFitMode:Et,clipMode:St,repeatMode:Lt,createPattern:Ht,checkImage:function(t,i,n,s){const{scaleX:o,scaleY:a}=v.patternLocked?t.__world:t.__nowWorld;if(n.data&&n.patternId!==o+"-"+a){const{data:r}=n;if(s)if(r.repeat)s=!1;else{let{width:t,height:n}=r;t*=Qt(o)*i.pixelRatio,n*=Qt(a)*i.pixelRatio,r.scaleX&&(t*=r.scaleX,n*=r.scaleY),s=t*n>e.image.maxCacheSize}return s?(i.save(),i.clip(),n.blendMode&&(i.blendMode=n.blendMode),r.opacity&&(i.opacity*=r.opacity),r.transform&&i.transform(r.transform),i.drawImage(n.image.view,0,0,r.width,r.height),i.restore(),!0):(!n.style||D.running?Ht(t,n,i.pixelRatio):n.patternTask||(n.patternTask=v.patternTasker.add((()=>Y(this,void 0,void 0,(function*(){n.patternTask=null,i.bounds.hit(t.__nowWorld)&&Ht(t,n,i.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let n,s,o,a;for(let r=0,d=i.length;r<d;r++)n=i[r].image,a=n&&n.url,a&&(s||(s={}),s[a]=!0,v.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),n.unload(i[r].loadId,!o.some((t=>t.url===a)))));return s}return null}},Zt={x:.5,y:0},$t={x:.5,y:1};function Kt(t,e,i){let n;for(let s=0,o=e.length;s<o;s++)n=e[s],t.addColorStop(n.offset,C.string(n.color,i))}const{set:te,getAngle:ee,getDistance:ie}=S,{get:ne,rotateOfOuter:se,scaleOfOuter:oe}=R,ae={x:.5,y:.5},re={x:.5,y:1},de={},le={};const{set:ce,getAngle:he,getDistance:ue}=S,{get:fe,rotateOfOuter:pe,scaleOfOuter:_e}=R,ge={x:.5,y:.5},we={x:.5,y:1},ye={},me={};const ve={linearGradient:function(t,i){let{from:n,to:s,type:o,blendMode:a,opacity:r}=t;n||(n=Zt),s||(s=$t);const d=e.canvas.createLinearGradient(i.x+n.x*i.width,i.y+n.y*i.height,i.x+s.x*i.width,i.y+s.y*i.height);Kt(d,t.stops,r);const l={type:o,style:d};return a&&(l.blendMode=a),l},radialGradient:function(t,i){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:d}=t;n||(n=ae),s||(s=re);const{x:l,y:c,width:h,height:u}=i;let f;te(de,l+n.x*h,c+n.y*u),te(le,l+s.x*h,c+s.y*u),(h!==u||d)&&(f=ne(),oe(f,de,h/u*(d||1),1),se(f,de,ee(de,le)+90));const p=e.canvas.createRadialGradient(de.x,de.y,0,de.x,de.y,ie(de,le));Kt(p,t.stops,a);const _={type:o,style:p,transform:f};return r&&(_.blendMode=r),_},conicGradient:function(t,i){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:d}=t;n||(n=ge),s||(s=we);const{x:l,y:c,width:h,height:u}=i;ce(ye,l+n.x*h,c+n.y*u),ce(me,l+s.x*h,c+s.y*u);const f=fe(),p=he(ye,me);e.conicGradientRotate90?(_e(f,ye,h/u*(d||1),1),pe(f,ye,p+90)):(_e(f,ye,1,h/u*(d||1)),pe(f,ye,p));const _=e.conicGradientSupport?e.canvas.createConicGradient(0,ye.x,ye.y):e.canvas.createRadialGradient(ye.x,ye.y,0,ye.x,ye.y,ue(ye,me));Kt(_,t.stops,a);const g={type:o,style:_,transform:f};return r&&(g.blendMode=r),g}},{copy:xe,toOffsetOutBounds:be}=B,Be={},Re={};function ke(t,i,n,s){const{bounds:o,shapeBounds:a}=s;if(e.fullImageShadow){if(xe(Be,t.bounds),Be.x+=i.x-a.x,Be.y+=i.y-a.y,n){const{matrix:t}=s;Be.x-=(o.x+(t?t.e:0)+o.width/2)*(n-1),Be.y-=(o.y+(t?t.f:0)+o.height/2)*(n-1),Be.width*=n,Be.height*=n}t.copyWorld(s.canvas,t.bounds,Be)}else n&&(xe(Be,i),Be.x-=i.width/2*(n-1),Be.y-=i.height/2*(n-1),Be.width*=n,Be.height*=n),t.copyWorld(s.canvas,a,n?Be:i)}const{toOffsetOutBounds:Ee}=B,Se={};const Le={shadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;be(l,Re),r.forEach(((r,_)=>{f.setWorldShadow(Re.offsetX+r.x*h,Re.offsetY+r.y*u,r.blur*h,r.color),s=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ke(f,Re,s,i),n=l,r.box&&(f.restore(),f.save(),d&&(f.copyWorld(f,l,o,"copy"),n=o),d?f.copyWorld(d,o,o,"destination-out"):f.copyWorld(i.canvas,c,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),p&&_<p&&f.clearWorld(n,!0)})),f.recycle(n)},innerShadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Ee(l,Se),r.forEach(((r,_)=>{f.save(),f.setWorldShadow(Se.offsetX+r.x*h,Se.offsetY+r.y*u,r.blur*h),s=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ke(f,Se,s,i),f.restore(),d?(f.copyWorld(f,l,o,"copy"),f.copyWorld(d,o,o,"source-out"),n=o):(f.copyWorld(i.canvas,c,l,"source-out"),n=l),f.fillWorld(n,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),p&&_<p&&f.clearWorld(n,!0)})),f.recycle(n)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Ae}=_;function We(t,e,i,n,s,o){switch(e){case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),Te(t,e,i,1)}(t,i,n,s);break;case"opacity-path":Te(t,i,n,o);break;case"path":i.restore()}}function Oe(t){return t.getSameCanvas(!1,!0)}function Te(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}F.prototype.__renderMask=function(t,e){let i,n,s,o,a;const{children:r}=this;for(let d=0,l=r.length;d<l;d++)i=r[d],i.__.mask&&(a&&(We(this,a,t,s,n,o),n=s=null),"path"===i.__.maskType?(i.opacity<1?(a="opacity-path",o=i.opacity,s||(s=Oe(t))):(a="path",t.save()),i.__clip(s||t,e)):(a="alpha",n||(n=Oe(t)),s||(s=Oe(t)),i.__render(n,e)),"clipping"!==i.__.maskType)||Ae(i,e)||i.__render(s||t,e);We(this,a,t,s,n,o)};const Me=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ce=Me+"_#~&*+\\=|≮≯≈≠=…",Ie=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function De(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Fe=De("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Pe=De("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ue=De(Me),Ne=De(Ce),Ye=De("- —/~|┆·");var Ge;!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"}(Ge||(Ge={}));const{Letter:Xe,Single:je,Before:qe,After:Ve,Symbol:ze,Break:He}=Ge;function Qe(t){return Fe[t]?Xe:Ye[t]?He:Pe[t]?qe:Ue[t]?Ve:Ne[t]?ze:Ie.test(t)?je:Xe}const Je={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Ze(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:$e}=Je,{Letter:Ke,Single:ti,Before:ei,After:ii,Symbol:ni,Break:si}=Ge;let oi,ai,ri,di,li,ci,hi,ui,fi,pi,_i,gi,wi,yi,mi,vi,xi=[];function bi(t,e){fi&&!ui&&(ui=fi),oi.data.push({char:t,width:e}),ri+=e}function Bi(){di+=ri,oi.width=ri,ai.words.push(oi),oi={data:[]},ri=0}function Ri(){yi&&(mi.paraNumber++,ai.paraStart=!0,yi=!1),fi&&(ai.startCharSize=ui,ai.endCharSize=fi,ui=0),ai.width=di,vi.width&&$e(ai),xi.push(ai),ai={words:[]},di=0}const ki=0,Ei=1,Si=2;const{top:Li,right:Ai,bottom:Wi,left:Oi}=L;function Ti(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const Mi={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let n=0,s=0,o=i.__getInput("width")||0,a=i.__getInput("height")||0;const{textDecoration:r,__font:d,__padding:l}=i;l&&(o&&(n=l[Oi],o-=l[Ai]+l[Oi]),a&&(s=l[Li],a-=l[Li]+l[Wi]));const c={bounds:{x:n,y:s,width:o,height:a},rows:[],paraNumber:0,font:e.canvas.font=d};return function(t,i,n){mi=t,xi=t.rows,vi=t.bounds;const{__letterSpacing:s,paraIndent:o,textCase:a}=n,{canvas:r}=e,{width:d,height:l}=vi;if(d||l||s||"none"!==a){const t="none"!==n.textWrap,e="break"===n.textWrap;yi=!0,_i=null,ui=hi=fi=ri=di=0,oi={data:[]},ai={words:[]};for(let n=0,l=i.length;n<l;n++)ci=i[n],"\n"===ci?(ri&&Bi(),ai.paraEnd=!0,Ri(),yi=!0):(pi=Qe(ci),pi===Ke&&"none"!==a&&(ci=Ze(ci,a,!ri)),hi=r.measureText(ci).width,s&&(s<0&&(fi=hi),hi+=s),gi=pi===ti&&(_i===ti||_i===Ke)||_i===ti&&pi!==ii,wi=!(pi!==ei&&pi!==ti||_i!==ni&&_i!==ii),li=yi&&o?d-o:d,t&&d&&di+ri+hi>li&&(e?(ri&&Bi(),Ri()):(wi||(wi=pi===Ke&&_i==ii),gi||wi||pi===si||pi===ei||pi===ti||ri+hi>li?(ri&&Bi(),Ri()):Ri()))," "===ci&&!0!==yi&&di+ri===0||(pi===si?(" "===ci&&ri&&Bi(),bi(ci,hi),Bi()):gi||wi?(ri&&Bi(),bi(ci,hi)):bi(ci,hi)),_i=pi);ri&&Bi(),di&&Ri(),xi.length>0&&(xi[xi.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{mi.paraNumber++,xi.push({x:o||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(c,t,i),l&&function(t,e,i,n,s){if(!n)switch(i.textAlign){case"left":Ti(e,"x",t[Oi]);break;case"right":Ti(e,"x",-t[Ai])}if(!s)switch(i.verticalAlign){case"top":Ti(e,"y",t[Li]);break;case"bottom":Ti(e,"y",-t[Wi])}}(l,c,i,o,a),function(t,e){const{rows:i,bounds:n}=t,{__lineHeight:s,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:d,verticalAlign:l,paraSpacing:c}=e;let h,u,f,{x:p,y:_,width:g,height:w}=n,y=s*i.length+(c?c*(t.paraNumber-1):0),m=o;if(r&&y>w)y=Math.max(w,s),t.overflow=i.length;else switch(l){case"middle":_+=(w-y)/2;break;case"bottom":_+=w-y}m+=_;for(let o=0,l=i.length;o<l;o++){switch(h=i[o],h.x=p,d){case"center":h.x+=(g-h.width)/2;break;case"right":h.x+=g-h.width}h.paraStart&&c&&o>0&&(m+=c),h.y=m,m+=s,t.overflow>o&&m>y&&(h.isOverflow=!0,t.overflow=o+1),u=h.x,f=h.width,a<0&&(h.width<0?(f=-h.width+e.fontSize+a,u-=f,f+=e.fontSize):f-=a),u<n.x&&(n.x=u),f>n.width&&(n.width=f),r&&g&&g<f&&(h.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=_,n.height=y}(c,i),function(t,e,i,n){const{rows:s}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let d,l,c,h,u;s.forEach((t=>{t.words&&(c=a&&t.paraStart?a:0,l=i&&"justify"===o&&t.words.length>1?(i-t.width-c)/(t.words.length-1):0,h=r||t.isOverflow?ki:l>.01?Ei:Si,t.isOverflow&&!r&&(t.textMode=!0),h===Si?(t.x+=c,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=c,d=t.x,t.data=[],t.words.forEach((e=>{h===Ei?(u={char:"",x:d},d=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(c,i,o),c.overflow&&function(t,i){const{rows:n,overflow:s}=t;let{textOverflow:o}=i;if(n.splice(s),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const r=o?e.canvas.measureText(o).width:0,d=i.x+i.width-r;("none"===i.textWrap?n:[n[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let n=i;n>-1&&(t=e.data[n],a=t.x+t.width,!(n===i&&a<d));n--){if(a<d&&" "!==t.char){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=r,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(c,i),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(c,i),c}};const Ci={string:function(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const n=t.r+","+t.g+","+t.b;return 1===i?"rgb("+n+")":"rgba("+n+","+i+")"}},{setPoint:Ii,addPoint:Di,toBounds:Fi}=A;const Pi={export(t,i,s){return this.running=!0,function(t){Ui||(Ui=new W);return new Promise((e=>{Ui.add((()=>Y(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((a=>new Promise((r=>{const d=t=>{a(t),r(),this.running=!1};if("json"===i)return d({data:t.toJSON()});if("json"===o.fileType(i))return e.origin.download("data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(t.toJSON())),i),d({data:!0});const{leafer:l}=t;l?l.waitViewCompleted((()=>Y(this,void 0,void 0,(function*(){s=o.getExportOptions(s);let e,a,r=1,c=1;const{worldTransform:h,isLeafer:u,isFrame:f}=t,{slice:_,trim:g,onCanvas:w}=s;let y=s.scale||1,m=s.pixelRatio||1;t.isApp&&(y*=m,m=t.app.pixelRatio);const v=s.screenshot||t.isApp,x=u&&v&&void 0===s.fill?t.fill:s.fill,b=o.isOpaqueImage(i)||x,B=new O;if(v)e=!0===v?u?l.canvas.bounds:t.worldRenderBounds:v;else{let i=s.relative||(u?"inner":"local");switch(r=h.scaleX,c=h.scaleY,i){case"inner":B.set(h);break;case"local":B.set(h).divide(t.localTransform),r/=t.scaleX,c/=t.scaleY;break;case"world":r=1,c=1;break;case"page":i=t.leafer;default:B.set(h).divide(t.getTransform(i));const e=i.worldTransform;r/=r/e.scaleX,c/=c/e.scaleY}e=t.getBounds("render",i)}const{x:R,y:k,width:E,height:S}=new p(e).scale(y);let L=n.canvas({width:Math.round(E),height:Math.round(S),pixelRatio:m});const A={matrix:B.scale(1/y).invert().translate(-R,-k).withScale(1/r*y,1/c*y)};if(_&&(t=l,A.bounds=L.bounds),L.save(),f&&void 0!==x){const e=t.get("fill");t.fill="",t.__render(L,A),t.fill=e}else t.__render(L,A);if(L.restore(),g){a=function(t){const{width:e,height:i}=t.view,{data:n}=t.context.getImageData(0,0,e,i);let s,o,a,r=0;for(let t=0;t<n.length;t+=4)0!==n[t+3]&&(s=r%e,o=(r-s)/e,a?Di(a,s,o):Ii(a={},s,o)),r++;const d=new p;return Fi(a,d),d.scale(1/t.pixelRatio).ceil()}(L);const t=L,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:m};L=n.canvas(s),L.copyWorld(t,a,s)}b&&L.fillWorld(L.bounds,x||"#FFFFFF","destination-over"),w&&w(L);const W="canvas"===i?L:yield L.export(i,s);d({data:W,width:L.pixelWidth,height:L.pixelHeight,renderBounds:e,trimBounds:a})})))):d({data:!1})}))))}};let Ui;const Ni=t.prototype,Yi=g.get("@leafer-ui/export");Ni.export=function(t,e){const{quality:i,blob:n}=o.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):n?this.toBlob(t,i):this.toDataURL(t,i)},Ni.toBlob=function(t,i){return new Promise((n=>{e.origin.canvasToBolb(this.view,t,i).then((t=>{n(t)})).catch((t=>{Yi.error(t),n(null)}))}))},Ni.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},Ni.saveAs=function(t,i){return new Promise((n=>{e.origin.canvasSaveAs(this.view,t,i).then((()=>{n(!0)})).catch((t=>{Yi.error(t),n(!1)}))}))},Object.assign(P,Mi),Object.assign(C,Ci),Object.assign(U,yt),Object.assign(M,Jt),Object.assign(I,ve),Object.assign(N,Le),Object.assign(D,Pi);export{st as Layouter,G as LeaferCanvas,at as Renderer,V as Watcher,q as useCanvas};
|
package/dist/node.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("fs"),n=require("@leafer-ui/draw");function i(t,e,n,i){return new(n||(n=Promise))((function(a,s){function o(t){try{d(i.next(t))}catch(t){s(t)}}function r(t){try{d(i.throw(t))}catch(t){s(t)}}function d(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,r)}d((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class a extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),t.Platform.roundRectPatch&&(this.context.__proto__.roundRect=null,t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}const{mineType:s,fileType:o}=t.FileHelper;Object.assign(t.Creator,{canvas:(t,e)=>new a(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="node",t.Platform.requestRender=function(t){setTimeout(t)},t.Platform.devicePixelRatio=1,t.Platform.conicGradientSupport=!0;class r{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:l,updateAllWorldOpacity:c}=t.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper,p={x:0,y:0,width:1e5,height:1e5};class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(p):this.afterBounds.setListWithFn(t,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:w}=t.LeafHelper,y=t.Debug.get("Layouter");class m{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:s,LAYOUT:o,AFTER:r}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(d(t,!0),e.add(t),t.isBranch&&h(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||l(i[t])}l(n)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&c(t),t.__updateChange()}))}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(o,f,this.times)),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:s}=t.LayoutEvent,o=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,o,this.times)),m.fullLayout(n),o.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,o,this.times)),n.emitEvent(new t.LayoutEvent(s,o,this.times)),this.addBlocks(o),t.Run.end(e)}static fullLayout(e){_(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),w(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new g([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new g(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,v.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return v.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),s=e.includes(this.target.__world),o=new t.Bounds(a);i.save(),s&&!t.Debug.showRepaint?i.clear():(a.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0)),this.__render(a,s,o),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,i){const a=e.includes(this.target.__world)?{includes:n}:{bounds:e,includes:n};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,a),this.renderBounds=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),t.Debug.showHitView&&this.renderHitView(a),t.Debug.showBoundsView&&this.renderBoundsView(a),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&(this.target.emit(t.AnimateEvent.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal&&(e.bigger||!e.samePixelRatio)){const{width:n,height:i}=e.old;new t.Bounds(0,0,n,i).includes(this.target.__world)&&!this.needFill&&e.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("surface"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function b(t,e){let n;const{rows:i,decorationY:a,decorationHeight:s}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),a&&e.fillRect(n.x,n.y+a,n.width,s)}function B(t,e,n){const{strokeAlign:i}=e.__,a="string"!=typeof t;switch(i){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?L(t,!0,e,n):R(e,n);break;case"inside":E("inside",t,a,e,n);break;case"outside":E("outside",t,a,e,n)}}function E(t,e,n,i,a){const{__strokeWidth:s,__font:o}=i.__,r=a.getSameCanvas(!0,!0);r.setStroke(n?void 0:e,2*s,i.__),r.font=o,n?L(e,!0,i,r):R(i,r),r.blendMode="outside"===t?"destination-out":"destination-in",b(i,r),r.blendMode="normal",i.__worldFlipped?a.copyWorldByReset(r,i.__nowWorld):a.copyWorldToInner(r,i.__nowWorld,i.__layout.renderBounds),r.recycle(i.__nowWorld)}function R(t,e){let n;const{rows:i,decorationY:a,decorationHeight:s}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)n=i[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),a&&e.strokeRect(n.x,n.y+a,n.width,s)}function L(t,e,i,a){let s;for(let o=0,r=t.length;o<r;o++)s=t[o],s.image&&n.PaintImage.checkImage(i,a,s,!1)||s.style&&(a.strokeStyle=s.style,s.blendMode?(a.saveBlendMode(s.blendMode),e?R(i,a):a.stroke(),a.restoreBlendMode()):e?R(i,a):a.stroke())}Object.assign(t.Creator,{watcher:(t,e)=>new r(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,n)=>new x(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,i)=>{}}),t.Platform.layout=m.fullLayout;const{getSpread:k,getOuterOf:S,getByMove:P,getIntersectData:O}=t.BoundsHelper;let A;function C(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:a}=i.__layout;switch(e.type){case"solid":let{type:s,blendMode:o,color:r,opacity:d}=e;return{type:s,blendMode:o,style:n.ColorConvert.string(r,d)};case"image":return n.PaintImage.image(i,t,e,a,!A||!A[e.url]);case"linear":return n.PaintGradient.linearGradient(e,a);case"radial":return n.PaintGradient.radialGradient(e,a);case"angular":return n.PaintGradient.conicGradient(e,a);default:return e.r?{type:"solid",style:n.ColorConvert.string(e)}:void 0}}const W={compute:function(t,e){const i=e.__,a=[];let s,o=i.__input[t];o instanceof Array||(o=[o]),A=n.PaintImage.recycleImage(t,i);for(let n,i=0,s=o.length;i<s;i++)n=C(t,o[i],e),n&&a.push(n);i["_"+t]=a.length?a:void 0,a.length&&a[0].image&&(s=a[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=s:i.__pixelStroke=s},fill:function(t,e,n){n.fillStyle=t,e.__.__font?b(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,e,i){let a;const{windingRule:s,__font:o}=e.__;for(let r=0,d=t.length;r<d;r++)a=t[r],a.image&&n.PaintImage.checkImage(e,i,a,!o)||a.style&&(i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),o?b(e,i):s?i.fill(s):i.fill(),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),o?b(e,i):s?i.fill(s):i.fill(),i.restoreBlendMode()):o?b(e,i):s?i.fill(s):i.fill())},fillText:b,stroke:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:s,__font:o}=i;if(a)if(o)B(t,e,n);else switch(s){case"center":n.setStroke(t,a,i),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const s=n.getSameCanvas(!0,!0);s.setStroke(t,2*a,i),e.__drawRenderPath(s),s.stroke(),i.windingRule?s.clip(i.windingRule):s.clip(),s.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(s,e.__nowWorld):n.copyWorldToInner(s,e.__nowWorld,e.__layout.renderBounds),s.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:s,__font:o}=i;if(a)if(o)B(t,e,n);else switch(s){case"center":n.setStroke(void 0,a,i),L(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),L(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:s}=e.__layout,o=n.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*a,i),L(t,!1,e,o),i.windingRule?o.clip(i.windingRule):o.clip(),o.clearWorld(s),e.__worldFlipped?n.copyWorldByReset(o,e.__nowWorld):n.copyWorldToInner(o,e.__nowWorld,s),o.recycle(e.__nowWorld)}},strokeText:B,drawTextStroke:R,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let s,o,r,d,{scaleX:l,scaleY:c}=a;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(a))d=i,s=r=a;else{const{renderShapeSpread:i}=t.__layout,h=O(i?k(e.bounds,i*l,i*c):e.bounds,a);o=e.bounds.getFitMatrix(h);let{a:u,d:f}=o;if(o.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,n),l*=u,c*=f),r=S(a,o),s=P(r,-o.e,-o.f),n.matrix){const{matrix:t}=n;o.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:o.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:o,bounds:s,worldCanvas:d,shapeBounds:r,scaleX:l,scaleY:c}}};let T={};const{get:M,rotateOfOuter:I,translate:D,scaleOfOuter:F,scale:H,rotate:j}=t.MatrixHelper;function U(t,e,n,i,a,s,o){const r=M();D(r,e.x+n,e.y+i),H(r,a,s),o&&I(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function G(t,e,n,i,a,s,o){const r=M();D(r,e.x+n,e.y+i),a&&H(r,a,s),o&&j(r,o),t.transform=r}function N(t,e,n,i,a,s,o,r,d,l){const c=M();if(d)if("center"===l)I(c,{x:n/2,y:i/2},d);else switch(j(c,d),d){case 90:D(c,i,0);break;case 180:D(c,n,i);break;case 270:D(c,0,n)}T.x=e.x+a,T.y=e.y+s,D(c,T.x,T.y),o&&F(c,T,o,r),t.transform=c}const{get:Y,translate:q}=t.MatrixHelper,X=new t.Bounds,V={};function z(e,n,i,a){let{width:s,height:o}=n;i.padding&&(a=X.set(a).shrink(i.padding));const{opacity:r,mode:d,around:l,offset:c,scale:h,size:u,rotation:f,blendMode:p,repeat:g}=i,_=a.width===s&&a.height===o;p&&(e.blendMode=p);const w=e.data={mode:d},y="center"!==l&&(f||0)%180==90,m=y?o:s,v=y?s:o;let x,b,B=0,E=0;if(d&&"cover"!==d&&"fit"!==d)u?(x=("number"==typeof u?u:u.width)/s,b=("number"==typeof u?u:u.height)/o):h&&(x="number"==typeof h?h:h.x,b="number"==typeof h?h:h.y);else if(!_||f){const t=a.width/m,e=a.height/v;x=b="fit"===d?Math.min(t,e):Math.max(t,e),B+=(a.width-s*x)/2,E+=(a.height-o*b)/2}if(l){const e={x:B,y:E,width:m,height:v};x&&(e.width*=x,e.height*=b),t.AroundHelper.toPoint(l,a,V,!0,e),B+=V.x,E+=V.y}switch(c&&(B+=c.x,E+=c.y),d){case"strench":_||(s=a.width,o=a.height);break;case"normal":case"clip":(B||E||x||f)&&G(w,a,B,E,x,b,f);break;case"repeat":(!_||x||f)&&N(w,a,s,o,B,E,x,b,f,l),g||(w.repeat="repeat");break;default:x&&U(w,a,B,E,x,b,f)}w.transform||(a.x||a.y)&&(w.transform=Y(),q(w.transform,a.x,a.y)),x&&"strench"!==d&&(w.scaleX=x,w.scaleY=b),w.width=s,w.height=o,r&&(w.opacity=r),g&&(w.repeat="string"==typeof g?"x"===g?"repeat-x":"repeat-y":"repeat")}let Q,J=new t.Bounds;const{isSame:Z}=t.BoundsHelper;function $(t,e,n,i,a,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||z(a,i,n,s),!0}function K(e,n){nt(e,t.ImageEvent.LOAD,n)}function tt(e,n){nt(e,t.ImageEvent.LOADED,n)}function et(e,n,i){n.error=i,e.forceUpdate("surface"),nt(e,t.ImageEvent.ERROR,n)}function nt(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function it(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:at,scale:st,copy:ot}=t.MatrixHelper,{ceil:rt,abs:dt}=Math;function lt(e,n,i){let{scaleX:a,scaleY:s}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const o=a+"-"+s;if(n.patternId===o||e.destroyed)return!1;{a=dt(a),s=dt(s);const{image:e,data:r}=n;let d,l,{width:c,height:h,scaleX:u,scaleY:f,opacity:p,transform:g,repeat:_}=r;u&&(l=at(),ot(l,g),st(l,1/u,1/f),a*=u,s*=f),a*=i,s*=i,c*=a,h*=s;const w=c*h;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}w>y&&(d=Math.sqrt(w/y)),d&&(a/=d,s/=d,c/=d,h/=d),u&&(a/=u,s/=f),(g||1!==a||1!==s)&&(l||(l=at(),g&&ot(l,g)),st(l,1/a,1/s));const m=e.getCanvas(rt(c)||1,rt(h)||1,p),v=e.getPattern(m,_||t.Platform.origin.noRepeat||"no-repeat",l,n);return n.style=v,n.patternId=o,!0}}const{abs:ct}=Math;const ht={image:function(e,n,i,a,s){let o,r;const d=t.ImageManager.get(i);return Q&&i===Q.paint&&Z(a,Q.boxBounds)?o=Q.leafPaint:(o={type:i.type,image:d},Q=d.use>1?{leafPaint:o,paint:i,boxBounds:J.set(a)}:null),(s||d.loading)&&(r={image:d,attrName:n,attrValue:i}),d.ready?($(e,n,i,d,o,a),s&&(K(e,r),tt(e,r))):d.error?s&&et(e,r,d.error):(it(e,!0),s&&K(e,r),o.loadId=d.load((()=>{it(e,!1),e.destroyed||($(e,n,i,d,o,a)&&(d.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),tt(e,r)),o.loadId=null}),(t=>{it(e,!1),et(e,r,t),o.loadId=null}))),o},createData:z,fillOrFitMode:U,clipMode:G,repeatMode:N,createPattern:lt,checkImage:function(e,a,s,o){const{scaleX:r,scaleY:d}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;if(s.data&&s.patternId!==r+"-"+d){const{data:l}=s;if(o)if(l.repeat)o=!1;else{let{width:e,height:n}=l;e*=ct(r)*a.pixelRatio,n*=ct(d)*a.pixelRatio,l.scaleX&&(e*=l.scaleX,n*=l.scaleY),o=e*n>t.Platform.image.maxCacheSize}return o?(a.save(),a.clip(),s.blendMode&&(a.blendMode=s.blendMode),l.opacity&&(a.opacity*=l.opacity),l.transform&&a.transform(l.transform),a.drawImage(s.image.view,0,0,l.width,l.height),a.restore(),!0):(!s.style||n.Export.running?lt(e,s,a.pixelRatio):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>i(this,void 0,void 0,(function*(){s.patternTask=null,a.bounds.hit(e.__nowWorld)&<(e,s,a.pixelRatio),e.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,s,o,r;for(let d=0,l=i.length;d<l;d++)a=i[d].image,r=a&&a.url,r&&(s||(s={}),s[r]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=n.__input&&n.__input[e]||[],o instanceof Array||(o=[o])),a.unload(i[d].loadId,!o.some((t=>t.url===r)))));return s}return null}},ut={x:.5,y:0},ft={x:.5,y:1};function pt(t,e,i){let a;for(let s=0,o=e.length;s<o;s++)a=e[s],t.addColorStop(a.offset,n.ColorConvert.string(a.color,i))}const{set:gt,getAngle:_t,getDistance:wt}=t.PointHelper,{get:yt,rotateOfOuter:mt,scaleOfOuter:vt}=t.MatrixHelper,xt={x:.5,y:.5},bt={x:.5,y:1},Bt={},Et={};const{set:Rt,getAngle:Lt,getDistance:kt}=t.PointHelper,{get:St,rotateOfOuter:Pt,scaleOfOuter:Ot}=t.MatrixHelper,At={x:.5,y:.5},Ct={x:.5,y:1},Wt={},Tt={};const Mt={linearGradient:function(e,n){let{from:i,to:a,type:s,blendMode:o,opacity:r}=e;i||(i=ut),a||(a=ft);const d=t.Platform.canvas.createLinearGradient(n.x+i.x*n.width,n.y+i.y*n.height,n.x+a.x*n.width,n.y+a.y*n.height);pt(d,e.stops,r);const l={type:s,style:d};return o&&(l.blendMode=o),l},radialGradient:function(e,n){let{from:i,to:a,type:s,opacity:o,blendMode:r,stretch:d}=e;i||(i=xt),a||(a=bt);const{x:l,y:c,width:h,height:u}=n;let f;gt(Bt,l+i.x*h,c+i.y*u),gt(Et,l+a.x*h,c+a.y*u),(h!==u||d)&&(f=yt(),vt(f,Bt,h/u*(d||1),1),mt(f,Bt,_t(Bt,Et)+90));const p=t.Platform.canvas.createRadialGradient(Bt.x,Bt.y,0,Bt.x,Bt.y,wt(Bt,Et));pt(p,e.stops,o);const g={type:s,style:p,transform:f};return r&&(g.blendMode=r),g},conicGradient:function(e,n){let{from:i,to:a,type:s,opacity:o,blendMode:r,stretch:d}=e;i||(i=At),a||(a=Ct);const{x:l,y:c,width:h,height:u}=n;Rt(Wt,l+i.x*h,c+i.y*u),Rt(Tt,l+a.x*h,c+a.y*u);const f=St(),p=Lt(Wt,Tt);t.Platform.conicGradientRotate90?(Ot(f,Wt,h/u*(d||1),1),Pt(f,Wt,p+90)):(Ot(f,Wt,1,h/u*(d||1)),Pt(f,Wt,p));const g=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Wt.x,Wt.y):t.Platform.canvas.createRadialGradient(Wt.x,Wt.y,0,Wt.x,Wt.y,kt(Wt,Tt));pt(g,e.stops,o);const _={type:s,style:g,transform:f};return r&&(_.blendMode=r),_}},{copy:It,toOffsetOutBounds:Dt}=t.BoundsHelper,Ft={},Ht={};function jt(e,n,i,a){const{bounds:s,shapeBounds:o}=a;if(t.Platform.fullImageShadow){if(It(Ft,e.bounds),Ft.x+=n.x-o.x,Ft.y+=n.y-o.y,i){const{matrix:t}=a;Ft.x-=(s.x+(t?t.e:0)+s.width/2)*(i-1),Ft.y-=(s.y+(t?t.f:0)+s.height/2)*(i-1),Ft.width*=i,Ft.height*=i}e.copyWorld(a.canvas,e.bounds,Ft)}else i&&(It(Ft,n),Ft.x-=n.width/2*(i-1),Ft.y-=n.height/2*(i-1),Ft.width*=i,Ft.height*=i),e.copyWorld(a.canvas,o,i?Ft:n)}const{toOffsetOutBounds:Ut}=t.BoundsHelper,Gt={};const Nt={shadow:function(t,e,n){let i,a;const{__nowWorld:s,__layout:o}=t,{shadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Dt(l,Ht),r.forEach(((r,g)=>{f.setWorldShadow(Ht.offsetX+r.x*h,Ht.offsetY+r.y*u,r.blur*h,r.color),a=r.spread?1+2*r.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,jt(f,Ht,a,n),i=l,r.box&&(f.restore(),f.save(),d&&(f.copyWorld(f,l,s,"copy"),i=s),d?f.copyWorld(d,s,s,"destination-out"):f.copyWorld(n.canvas,c,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,i,s,r.blendMode):e.copyWorldToInner(f,i,o.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},innerShadow:function(t,e,n){let i,a;const{__nowWorld:s,__layout:o}=t,{innerShadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Ut(l,Gt),r.forEach(((r,g)=>{f.save(),f.setWorldShadow(Gt.offsetX+r.x*h,Gt.offsetY+r.y*u,r.blur*h),a=r.spread?1-2*r.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,jt(f,Gt,a,n),f.restore(),d?(f.copyWorld(f,l,s,"copy"),f.copyWorld(d,s,s,"source-out"),i=s):(f.copyWorld(n.canvas,c,l,"source-out"),i=l),f.fillWorld(i,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,i,s,r.blendMode):e.copyWorldToInner(f,i,o.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Yt}=t.LeafBoundsHelper;function qt(t,e,n,i,a,s){switch(e){case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),Vt(t,e,n,1)}(t,n,i,a);break;case"opacity-path":Vt(t,n,i,s);break;case"path":n.restore()}}function Xt(t){return t.getSameCanvas(!1,!0)}function Vt(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,s,o;const{children:r}=this;for(let d=0,l=r.length;d<l;d++)n=r[d],n.__.mask&&(o&&(qt(this,o,t,a,i,s),i=a=null),"path"===n.__.maskType?(n.opacity<1?(o="opacity-path",s=n.opacity,a||(a=Xt(t))):(o="path",t.save()),n.__clip(a||t,e)):(o="alpha",i||(i=Xt(t)),a||(a=Xt(t)),n.__render(i,e)),"clipping"!==n.__.maskType)||Yt(n,e)||n.__render(a||t,e);qt(this,o,t,a,i,s)};const zt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Qt=zt+"_#~&*+\\=|≮≯≈≠=…",Jt=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 Zt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const $t=Zt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Kt=Zt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),te=Zt(zt),ee=Zt(Qt),ne=Zt("- —/~|┆·");var ie;!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"}(ie||(ie={}));const{Letter:ae,Single:se,Before:oe,After:re,Symbol:de,Break:le}=ie;function ce(t){return $t[t]?ae:ne[t]?le:Kt[t]?oe:te[t]?re:ee[t]?de:Jt.test(t)?se:ae}const he={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let s=a-1;s>-1&&(n=e[s].data[0]," "===n.char);s--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function ue(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:fe}=he,{Letter:pe,Single:ge,Before:_e,After:we,Symbol:ye,Break:me}=ie;let ve,xe,be,Be,Ee,Re,Le,ke,Se,Pe,Oe,Ae,Ce,We,Te,Me,Ie=[];function De(t,e){Se&&!ke&&(ke=Se),ve.data.push({char:t,width:e}),be+=e}function Fe(){Be+=be,ve.width=be,xe.words.push(ve),ve={data:[]},be=0}function He(){We&&(Te.paraNumber++,xe.paraStart=!0,We=!1),Se&&(xe.startCharSize=ke,xe.endCharSize=Se,ke=0),xe.width=Be,Me.width&&fe(xe),Ie.push(xe),xe={words:[]},Be=0}const je=0,Ue=1,Ge=2;const{top:Ne,right:Ye,bottom:qe,left:Xe}=t.Direction4;function Ve(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const ze={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let i=0,a=0,s=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:r,__font:d,__padding:l}=n;l&&(s&&(i=l[Xe],s-=l[Ye]+l[Xe]),o&&(a=l[Ne],o-=l[Ne]+l[qe]));const c={bounds:{x:i,y:a,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){Te=e,Ie=e.rows,Me=e.bounds;const{__letterSpacing:a,paraIndent:s,textCase:o}=i,{canvas:r}=t.Platform,{width:d,height:l}=Me;if(d||l||a||"none"!==o){const t="none"!==i.textWrap,e="break"===i.textWrap;We=!0,Oe=null,ke=Le=Se=be=Be=0,ve={data:[]},xe={words:[]};for(let i=0,l=n.length;i<l;i++)Re=n[i],"\n"===Re?(be&&Fe(),xe.paraEnd=!0,He(),We=!0):(Pe=ce(Re),Pe===pe&&"none"!==o&&(Re=ue(Re,o,!be)),Le=r.measureText(Re).width,a&&(a<0&&(Se=Le),Le+=a),Ae=Pe===ge&&(Oe===ge||Oe===pe)||Oe===ge&&Pe!==we,Ce=!(Pe!==_e&&Pe!==ge||Oe!==ye&&Oe!==we),Ee=We&&s?d-s:d,t&&d&&Be+be+Le>Ee&&(e?(be&&Fe(),He()):(Ce||(Ce=Pe===pe&&Oe==we),Ae||Ce||Pe===me||Pe===_e||Pe===ge||be+Le>Ee?(be&&Fe(),He()):He()))," "===Re&&!0!==We&&Be+be===0||(Pe===me?(" "===Re&&be&&Fe(),De(Re,Le),Fe()):Ae||Ce?(be&&Fe(),De(Re,Le)):De(Re,Le)),Oe=Pe);be&&Fe(),Be&&He(),Ie.length>0&&(Ie[Ie.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Te.paraNumber++,Ie.push({x:s||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(c,e,n),l&&function(t,e,n,i,a){if(!i)switch(n.textAlign){case"left":Ve(e,"x",t[Xe]);break;case"right":Ve(e,"x",-t[Ye])}if(!a)switch(n.verticalAlign){case"top":Ve(e,"y",t[Ne]);break;case"bottom":Ve(e,"y",-t[qe])}}(l,c,n,s,o),function(t,e){const{rows:n,bounds:i}=t,{__lineHeight:a,__baseLine:s,__letterSpacing:o,__clipText:r,textAlign:d,verticalAlign:l,paraSpacing:c}=e;let h,u,f,{x:p,y:g,width:_,height:w}=i,y=a*n.length+(c?c*(t.paraNumber-1):0),m=s;if(r&&y>w)y=Math.max(w,a),t.overflow=n.length;else switch(l){case"middle":g+=(w-y)/2;break;case"bottom":g+=w-y}m+=g;for(let s=0,l=n.length;s<l;s++){switch(h=n[s],h.x=p,d){case"center":h.x+=(_-h.width)/2;break;case"right":h.x+=_-h.width}h.paraStart&&c&&s>0&&(m+=c),h.y=m,m+=a,t.overflow>s&&m>y&&(h.isOverflow=!0,t.overflow=s+1),u=h.x,f=h.width,o<0&&(h.width<0?(f=-h.width+e.fontSize+o,u-=f,f+=e.fontSize):f-=o),u<i.x&&(i.x=u),f>i.width&&(i.width=f),r&&_&&_<f&&(h.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=g,i.height=y}(c,n),function(t,e,n,i){const{rows:a}=t,{textAlign:s,paraIndent:o,letterSpacing:r}=e;let d,l,c,h,u;a.forEach((t=>{t.words&&(c=o&&t.paraStart?o:0,l=n&&"justify"===s&&t.words.length>1?(n-t.width-c)/(t.words.length-1):0,h=r||t.isOverflow?je:l>.01?Ue:Ge,t.isOverflow&&!r&&(t.textMode=!0),h===Ge?(t.x+=c,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=c,d=t.x,t.data=[],t.words.forEach((e=>{h===Ue?(u={char:"",x:d},d=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,n){return t.forEach((t=>{" "!==t.char&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(c,n,s),c.overflow&&function(e,n){const{rows:i,overflow:a}=e;let{textOverflow:s}=n;if(i.splice(a),"hide"!==s){let e,o;"ellipsis"===s&&(s="...");const r=t.Platform.canvas.measureText(s).width,d=n.x+n.width-r;("none"===n.textWrap?i:[i[a-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],o=e.x+e.width,!(i===n&&o<d));i--){if(o<d&&" "!==e.char){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=r,t.data.push({char:s,x:o}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,n),"none"!==r&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(c,n),c}};const Qe={string:function(t,e){if("string"==typeof t)return t;let n=void 0===t.a?1:t.a;e&&(n*=e);const i=t.r+","+t.g+","+t.b;return 1===n?"rgb("+i+")":"rgba("+i+","+n+")"}},{setPoint:Je,addPoint:Ze,toBounds:$e}=t.TwoPointBoundsHelper;const Ke={export(e,n,a){return this.running=!0,function(e){tn||(tn=new t.TaskProcessor);return new Promise((t=>{tn.add((()=>i(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((s=>new Promise((o=>{const r=t=>{s(t),o(),this.running=!1};if("json"===n)return r({data:e.toJSON()});if("json"===t.FileHelper.fileType(n))return t.Platform.origin.download("data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(e.toJSON())),n),r({data:!0});const{leafer:d}=e;d?d.waitViewCompleted((()=>i(this,void 0,void 0,(function*(){a=t.FileHelper.getExportOptions(a);let i,s,o=1,l=1;const{worldTransform:c,isLeafer:h,isFrame:u}=e,{slice:f,trim:p,onCanvas:g}=a,_=a.scale||1,w=a.pixelRatio||1,y=a.screenshot||e.isApp,m=h&&y&&void 0===a.fill?e.fill:a.fill,v=t.FileHelper.isOpaqueImage(n)||m,x=new t.Matrix;if(y)i=!0===y?h?d.canvas.bounds:e.worldRenderBounds:y;else{let t=a.relative||(h?"inner":"local");switch(o=c.scaleX,l=c.scaleY,t){case"inner":x.set(c);break;case"local":x.set(c).divide(e.localTransform),o/=e.scaleX,l/=e.scaleY;break;case"world":o=1,l=1;break;case"page":t=e.leafer;default:x.set(c).divide(e.getTransform(t));const n=t.worldTransform;o/=o/n.scaleX,l/=l/n.scaleY}i=e.getBounds("render",t)}const{x:b,y:B,width:E,height:R}=new t.Bounds(i).scale(_);let L=t.Creator.canvas({width:Math.round(E),height:Math.round(R),pixelRatio:w});const k={matrix:x.scale(1/_).invert().translate(-b,-B).withScale(1/o*_,1/l*_)};if(f&&(e=d,k.bounds=L.bounds),L.save(),u&&void 0!==m){const t=e.get("fill");e.fill="",e.__render(L,k),e.fill=t}else e.__render(L,k);if(L.restore(),p){s=function(e){const{width:n,height:i}=e.view,{data:a}=e.context.getImageData(0,0,n,i);let s,o,r,d=0;for(let t=0;t<a.length;t+=4)0!==a[t+3]&&(s=d%n,o=(d-s)/n,r?Ze(r,s,o):Je(r={},s,o)),d++;const l=new t.Bounds;return $e(r,l),l.scale(1/e.pixelRatio).ceil()}(L);const e=L,{width:n,height:i}=s,a={x:0,y:0,width:n,height:i,pixelRatio:w};L=t.Creator.canvas(a),L.copyWorld(e,s,a)}v&&L.fillWorld(L.bounds,m||"#FFFFFF","destination-over"),g&&g(L);const S="canvas"===n?L:yield L.export(n,a);r({data:S,width:L.pixelWidth,height:L.pixelHeight,renderBounds:i,trimBounds:s})})))):r({data:!1})}))))}};let tn;const en=t.LeaferCanvasBase.prototype,nn=t.Debug.get("@leafer-ui/export");en.export=function(e,n){const{quality:i,blob:a}=t.FileHelper.getExportOptions(n);return e.includes(".")?this.saveAs(e,i):a?this.toBlob(e,i):this.toDataURL(e,i)},en.toBlob=function(e,n){return new Promise((i=>{t.Platform.origin.canvasToBolb(this.view,e,n).then((t=>{i(t)})).catch((t=>{nn.error(t),i(null)}))}))},en.toDataURL=function(e,n){return t.Platform.origin.canvasToDataURL(this.view,e,n)},en.saveAs=function(e,n){return new Promise((i=>{t.Platform.origin.canvasSaveAs(this.view,e,n).then((()=>{i(!0)})).catch((t=>{nn.error(t),i(!1)}))}))},Object.assign(n.TextConvert,ze),Object.assign(n.ColorConvert,Qe),Object.assign(n.Paint,W),Object.assign(n.PaintImage,ht),Object.assign(n.PaintGradient,Mt),Object.assign(n.Effect,Nt),Object.assign(n.Export,Ke),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=a,exports.Renderer=x,exports.Watcher=r,exports.useCanvas=function(n,a){if(t.Platform.canvasType=n,!t.Platform.origin){if("skia"===n){const{Canvas:e,loadImage:n}=a;t.Platform.origin={createCanvas:(t,n,i)=>new e(t,n,i),canvasToDataURL:(t,e,n)=>t.toDataURLSync(e,{quality:n}),canvasToBolb:(t,e,n)=>t.toBuffer(e,{quality:n}),canvasSaveAs:(t,e,n)=>t.saveAs(e,{quality:n}),download(t,e){},loadImage:n},t.Platform.roundRectPatch=!0}else if("napi"===n){const{Canvas:n,loadImage:r}=a;t.Platform.origin={createCanvas:(t,e,i)=>new n(t,e,i),canvasToDataURL:(t,e,n)=>t.toDataURL(s(e),n),canvasToBolb:(t,e,n)=>i(this,void 0,void 0,(function*(){return t.toBuffer(s(e),n)})),canvasSaveAs:(t,n,a)=>i(this,void 0,void 0,(function*(){return e.writeFileSync(n,t.toBuffer(s(o(n)),a))})),download(t,e){},loadImage:r}}t.Platform.ellipseToCurve=!0,t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas()}},Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(n).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return n[t]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("fs"),n=require("@leafer-ui/draw");function i(t,e,n,i){return new(n||(n=Promise))((function(a,s){function o(t){try{d(i.next(t))}catch(t){s(t)}}function r(t){try{d(i.throw(t))}catch(t){s(t)}}function d(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,r)}d((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class a extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config),t.Platform.roundRectPatch&&(this.context.__proto__.roundRect=null,t.canvasPatch(this.context.__proto__))}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}const{mineType:s,fileType:o}=t.FileHelper;Object.assign(t.Creator,{canvas:(t,e)=>new a(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="node",t.Platform.requestRender=function(t){setTimeout(t)},t.Platform.devicePixelRatio=1,t.Platform.conicGradientSupport=!0;class r{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:l,updateAllWorldOpacity:c}=t.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper,p={x:0,y:0,width:1e5,height:1e5};class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(p):this.afterBounds.setListWithFn(t,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:w}=t.LeafHelper,y=t.Debug.get("Layouter");class m{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:s,LAYOUT:o,AFTER:r}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(d(t,!0),e.add(t),t.isBranch&&h(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||l(i[t])}l(n)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&c(t),t.__updateChange()}))}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(o,f,this.times)),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:s}=t.LayoutEvent,o=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,o,this.times)),m.fullLayout(n),o.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,o,this.times)),n.emitEvent(new t.LayoutEvent(s,o,this.times)),this.addBlocks(o),t.Run.end(e)}static fullLayout(e){_(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),w(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new g([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new g(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}render(e){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,v.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return v.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),s=e.includes(this.target.__world),o=new t.Bounds(a);i.save(),s&&!t.Debug.showRepaint?i.clear():(a.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0)),this.__render(a,s,o),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,i){const a=e.includes(this.target.__world)?{includes:n}:{bounds:e,includes:n};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.Debug.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,a),this.renderBounds=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),t.Debug.showHitView&&this.renderHitView(a),t.Debug.showBoundsView&&this.renderBoundsView(a),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.running&&(this.target.emit(t.AnimateEvent.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)),this.target&&this.__requestRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.changed=!0}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function b(t,e){let n;const{rows:i,decorationY:a,decorationHeight:s}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)})),a&&e.fillRect(n.x,n.y+a,n.width,s)}function B(t,e,n){const{strokeAlign:i}=e.__,a="string"!=typeof t;switch(i){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?L(t,!0,e,n):R(e,n);break;case"inside":E("inside",t,a,e,n);break;case"outside":E("outside",t,a,e,n)}}function E(t,e,n,i,a){const{__strokeWidth:s,__font:o}=i.__,r=a.getSameCanvas(!0,!0);r.setStroke(n?void 0:e,2*s,i.__),r.font=o,n?L(e,!0,i,r):R(i,r),r.blendMode="outside"===t?"destination-out":"destination-in",b(i,r),r.blendMode="normal",i.__worldFlipped?a.copyWorldByReset(r,i.__nowWorld):a.copyWorldToInner(r,i.__nowWorld,i.__layout.renderBounds),r.recycle(i.__nowWorld)}function R(t,e){let n;const{rows:i,decorationY:a,decorationHeight:s}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)n=i[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)})),a&&e.strokeRect(n.x,n.y+a,n.width,s)}function L(t,e,i,a){let s;for(let o=0,r=t.length;o<r;o++)s=t[o],s.image&&n.PaintImage.checkImage(i,a,s,!1)||s.style&&(a.strokeStyle=s.style,s.blendMode?(a.saveBlendMode(s.blendMode),e?R(i,a):a.stroke(),a.restoreBlendMode()):e?R(i,a):a.stroke())}Object.assign(t.Creator,{watcher:(t,e)=>new r(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,n)=>new x(t,e,n),selector:(t,e)=>{},interaction:(t,e,n,i)=>{}}),t.Platform.layout=m.fullLayout;const{getSpread:k,getOuterOf:S,getByMove:P,getIntersectData:O}=t.BoundsHelper;let A;function C(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:a}=i.__layout;switch(e.type){case"solid":let{type:s,blendMode:o,color:r,opacity:d}=e;return{type:s,blendMode:o,style:n.ColorConvert.string(r,d)};case"image":return n.PaintImage.image(i,t,e,a,!A||!A[e.url]);case"linear":return n.PaintGradient.linearGradient(e,a);case"radial":return n.PaintGradient.radialGradient(e,a);case"angular":return n.PaintGradient.conicGradient(e,a);default:return e.r?{type:"solid",style:n.ColorConvert.string(e)}:void 0}}const W={compute:function(t,e){const i=e.__,a=[];let s,o=i.__input[t];o instanceof Array||(o=[o]),A=n.PaintImage.recycleImage(t,i);for(let n,i=0,s=o.length;i<s;i++)n=C(t,o[i],e),n&&a.push(n);i["_"+t]=a.length?a:void 0,a.length&&a[0].image&&(s=a[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=s:i.__pixelStroke=s},fill:function(t,e,n){n.fillStyle=t,e.__.__font?b(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,e,i){let a;const{windingRule:s,__font:o}=e.__;for(let r=0,d=t.length;r<d;r++)a=t[r],a.image&&n.PaintImage.checkImage(e,i,a,!o)||a.style&&(i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),o?b(e,i):s?i.fill(s):i.fill(),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),o?b(e,i):s?i.fill(s):i.fill(),i.restoreBlendMode()):o?b(e,i):s?i.fill(s):i.fill())},fillText:b,stroke:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:s,__font:o}=i;if(a)if(o)B(t,e,n);else switch(s){case"center":n.setStroke(t,a,i),n.stroke();break;case"inside":n.save(),n.setStroke(t,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const s=n.getSameCanvas(!0,!0);s.setStroke(t,2*a,i),e.__drawRenderPath(s),s.stroke(),i.windingRule?s.clip(i.windingRule):s.clip(),s.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(s,e.__nowWorld):n.copyWorldToInner(s,e.__nowWorld,e.__layout.renderBounds),s.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:s,__font:o}=i;if(a)if(o)B(t,e,n);else switch(s){case"center":n.setStroke(void 0,a,i),L(t,!1,e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),L(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:s}=e.__layout,o=n.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*a,i),L(t,!1,e,o),i.windingRule?o.clip(i.windingRule):o.clip(),o.clearWorld(s),e.__worldFlipped?n.copyWorldByReset(o,e.__nowWorld):n.copyWorldToInner(o,e.__nowWorld,s),o.recycle(e.__nowWorld)}},strokeText:B,drawTextStroke:R,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let s,o,r,d,{scaleX:l,scaleY:c}=a;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(a))d=i,s=r=a;else{const{renderShapeSpread:i}=t.__layout,h=O(i?k(e.bounds,l===c?i*l:[i*c,i*l]):e.bounds,a);o=e.bounds.getFitMatrix(h);let{a:u,d:f}=o;if(o.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,n),l*=u,c*=f),r=S(a,o),s=P(r,-o.e,-o.f),n.matrix){const{matrix:t}=n;o.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:o.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:o,bounds:s,worldCanvas:d,shapeBounds:r,scaleX:l,scaleY:c}}};let T={};const{get:M,rotateOfOuter:I,translate:D,scaleOfOuter:F,scale:H,rotate:j}=t.MatrixHelper;function U(t,e,n,i,a,s,o){const r=M();D(r,e.x+n,e.y+i),H(r,a,s),o&&I(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function G(t,e,n,i,a,s,o){const r=M();D(r,e.x+n,e.y+i),a&&H(r,a,s),o&&j(r,o),t.transform=r}function N(t,e,n,i,a,s,o,r,d,l){const c=M();if(d)if("center"===l)I(c,{x:n/2,y:i/2},d);else switch(j(c,d),d){case 90:D(c,i,0);break;case 180:D(c,n,i);break;case 270:D(c,0,n)}T.x=e.x+a,T.y=e.y+s,D(c,T.x,T.y),o&&F(c,T,o,r),t.transform=c}const{get:Y,translate:q}=t.MatrixHelper,X=new t.Bounds,V={};function z(e,n,i,a){let{width:s,height:o}=n;i.padding&&(a=X.set(a).shrink(i.padding));const{opacity:r,mode:d,align:l,offset:c,scale:h,size:u,rotation:f,blendMode:p,repeat:g}=i,_=a.width===s&&a.height===o;p&&(e.blendMode=p);const w=e.data={mode:d},y="center"!==l&&(f||0)%180==90,m=y?o:s,v=y?s:o;let x,b,B=0,E=0;if(d&&"cover"!==d&&"fit"!==d)u?(x=("number"==typeof u?u:u.width)/s,b=("number"==typeof u?u:u.height)/o):h&&(x="number"==typeof h?h:h.x,b="number"==typeof h?h:h.y);else if(!_||f){const t=a.width/m,e=a.height/v;x=b="fit"===d?Math.min(t,e):Math.max(t,e),B+=(a.width-s*x)/2,E+=(a.height-o*b)/2}if(l){const e={x:B,y:E,width:m,height:v};x&&(e.width*=x,e.height*=b),t.AlignHelper.toPoint(l,e,a,V,!0),B+=V.x,E+=V.y}switch(c&&(B+=c.x,E+=c.y),d){case"strench":_||(s=a.width,o=a.height);break;case"normal":case"clip":(B||E||x||f)&&G(w,a,B,E,x,b,f);break;case"repeat":(!_||x||f)&&N(w,a,s,o,B,E,x,b,f,l),g||(w.repeat="repeat");break;default:x&&U(w,a,B,E,x,b,f)}w.transform||(a.x||a.y)&&(w.transform=Y(),q(w.transform,a.x,a.y)),x&&"strench"!==d&&(w.scaleX=x,w.scaleY=b),w.width=s,w.height=o,r&&(w.opacity=r),g&&(w.repeat="string"==typeof g?"x"===g?"repeat-x":"repeat-y":"repeat")}let Q,J=new t.Bounds;const{isSame:Z}=t.BoundsHelper;function $(t,e,n,i,a,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||z(a,i,n,s),!0}function K(e,n){nt(e,t.ImageEvent.LOAD,n)}function tt(e,n){nt(e,t.ImageEvent.LOADED,n)}function et(e,n,i){n.error=i,e.forceUpdate("surface"),nt(e,t.ImageEvent.ERROR,n)}function nt(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function it(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:at,scale:st,copy:ot}=t.MatrixHelper,{ceil:rt,abs:dt}=Math;function lt(e,n,i){let{scaleX:a,scaleY:s}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const o=a+"-"+s;if(n.patternId===o||e.destroyed)return!1;{a=dt(a),s=dt(s);const{image:e,data:r}=n;let d,l,{width:c,height:h,scaleX:u,scaleY:f,opacity:p,transform:g,repeat:_}=r;u&&(l=at(),ot(l,g),st(l,1/u,1/f),a*=u,s*=f),a*=i,s*=i,c*=a,h*=s;const w=c*h;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}w>y&&(d=Math.sqrt(w/y)),d&&(a/=d,s/=d,c/=d,h/=d),u&&(a/=u,s/=f),(g||1!==a||1!==s)&&(l||(l=at(),g&&ot(l,g)),st(l,1/a,1/s));const m=e.getCanvas(rt(c)||1,rt(h)||1,p),v=e.getPattern(m,_||t.Platform.origin.noRepeat||"no-repeat",l,n);return n.style=v,n.patternId=o,!0}}const{abs:ct}=Math;const ht={image:function(e,n,i,a,s){let o,r;const d=t.ImageManager.get(i);return Q&&i===Q.paint&&Z(a,Q.boxBounds)?o=Q.leafPaint:(o={type:i.type,image:d},Q=d.use>1?{leafPaint:o,paint:i,boxBounds:J.set(a)}:null),(s||d.loading)&&(r={image:d,attrName:n,attrValue:i}),d.ready?($(e,n,i,d,o,a),s&&(K(e,r),tt(e,r))):d.error?s&&et(e,r,d.error):(it(e,!0),s&&K(e,r),o.loadId=d.load((()=>{it(e,!1),e.destroyed||($(e,n,i,d,o,a)&&(d.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),tt(e,r)),o.loadId=null}),(t=>{it(e,!1),et(e,r,t),o.loadId=null}))),o},createData:z,fillOrFitMode:U,clipMode:G,repeatMode:N,createPattern:lt,checkImage:function(e,a,s,o){const{scaleX:r,scaleY:d}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;if(s.data&&s.patternId!==r+"-"+d){const{data:l}=s;if(o)if(l.repeat)o=!1;else{let{width:e,height:n}=l;e*=ct(r)*a.pixelRatio,n*=ct(d)*a.pixelRatio,l.scaleX&&(e*=l.scaleX,n*=l.scaleY),o=e*n>t.Platform.image.maxCacheSize}return o?(a.save(),a.clip(),s.blendMode&&(a.blendMode=s.blendMode),l.opacity&&(a.opacity*=l.opacity),l.transform&&a.transform(l.transform),a.drawImage(s.image.view,0,0,l.width,l.height),a.restore(),!0):(!s.style||n.Export.running?lt(e,s,a.pixelRatio):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>i(this,void 0,void 0,(function*(){s.patternTask=null,a.bounds.hit(e.__nowWorld)&<(e,s,a.pixelRatio),e.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,s,o,r;for(let d=0,l=i.length;d<l;d++)a=i[d].image,r=a&&a.url,r&&(s||(s={}),s[r]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=n.__input&&n.__input[e]||[],o instanceof Array||(o=[o])),a.unload(i[d].loadId,!o.some((t=>t.url===r)))));return s}return null}},ut={x:.5,y:0},ft={x:.5,y:1};function pt(t,e,i){let a;for(let s=0,o=e.length;s<o;s++)a=e[s],t.addColorStop(a.offset,n.ColorConvert.string(a.color,i))}const{set:gt,getAngle:_t,getDistance:wt}=t.PointHelper,{get:yt,rotateOfOuter:mt,scaleOfOuter:vt}=t.MatrixHelper,xt={x:.5,y:.5},bt={x:.5,y:1},Bt={},Et={};const{set:Rt,getAngle:Lt,getDistance:kt}=t.PointHelper,{get:St,rotateOfOuter:Pt,scaleOfOuter:Ot}=t.MatrixHelper,At={x:.5,y:.5},Ct={x:.5,y:1},Wt={},Tt={};const Mt={linearGradient:function(e,n){let{from:i,to:a,type:s,blendMode:o,opacity:r}=e;i||(i=ut),a||(a=ft);const d=t.Platform.canvas.createLinearGradient(n.x+i.x*n.width,n.y+i.y*n.height,n.x+a.x*n.width,n.y+a.y*n.height);pt(d,e.stops,r);const l={type:s,style:d};return o&&(l.blendMode=o),l},radialGradient:function(e,n){let{from:i,to:a,type:s,opacity:o,blendMode:r,stretch:d}=e;i||(i=xt),a||(a=bt);const{x:l,y:c,width:h,height:u}=n;let f;gt(Bt,l+i.x*h,c+i.y*u),gt(Et,l+a.x*h,c+a.y*u),(h!==u||d)&&(f=yt(),vt(f,Bt,h/u*(d||1),1),mt(f,Bt,_t(Bt,Et)+90));const p=t.Platform.canvas.createRadialGradient(Bt.x,Bt.y,0,Bt.x,Bt.y,wt(Bt,Et));pt(p,e.stops,o);const g={type:s,style:p,transform:f};return r&&(g.blendMode=r),g},conicGradient:function(e,n){let{from:i,to:a,type:s,opacity:o,blendMode:r,stretch:d}=e;i||(i=At),a||(a=Ct);const{x:l,y:c,width:h,height:u}=n;Rt(Wt,l+i.x*h,c+i.y*u),Rt(Tt,l+a.x*h,c+a.y*u);const f=St(),p=Lt(Wt,Tt);t.Platform.conicGradientRotate90?(Ot(f,Wt,h/u*(d||1),1),Pt(f,Wt,p+90)):(Ot(f,Wt,1,h/u*(d||1)),Pt(f,Wt,p));const g=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Wt.x,Wt.y):t.Platform.canvas.createRadialGradient(Wt.x,Wt.y,0,Wt.x,Wt.y,kt(Wt,Tt));pt(g,e.stops,o);const _={type:s,style:g,transform:f};return r&&(_.blendMode=r),_}},{copy:It,toOffsetOutBounds:Dt}=t.BoundsHelper,Ft={},Ht={};function jt(e,n,i,a){const{bounds:s,shapeBounds:o}=a;if(t.Platform.fullImageShadow){if(It(Ft,e.bounds),Ft.x+=n.x-o.x,Ft.y+=n.y-o.y,i){const{matrix:t}=a;Ft.x-=(s.x+(t?t.e:0)+s.width/2)*(i-1),Ft.y-=(s.y+(t?t.f:0)+s.height/2)*(i-1),Ft.width*=i,Ft.height*=i}e.copyWorld(a.canvas,e.bounds,Ft)}else i&&(It(Ft,n),Ft.x-=n.width/2*(i-1),Ft.y-=n.height/2*(i-1),Ft.width*=i,Ft.height*=i),e.copyWorld(a.canvas,o,i?Ft:n)}const{toOffsetOutBounds:Ut}=t.BoundsHelper,Gt={};const Nt={shadow:function(t,e,n){let i,a;const{__nowWorld:s,__layout:o}=t,{shadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Dt(l,Ht),r.forEach(((r,g)=>{f.setWorldShadow(Ht.offsetX+r.x*h,Ht.offsetY+r.y*u,r.blur*h,r.color),a=r.spread?1+2*r.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,jt(f,Ht,a,n),i=l,r.box&&(f.restore(),f.save(),d&&(f.copyWorld(f,l,s,"copy"),i=s),d?f.copyWorld(d,s,s,"destination-out"):f.copyWorld(n.canvas,c,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,i,s,r.blendMode):e.copyWorldToInner(f,i,o.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},innerShadow:function(t,e,n){let i,a;const{__nowWorld:s,__layout:o}=t,{innerShadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:h,scaleY:u}=n,f=e.getSameCanvas(),p=r.length-1;Ut(l,Gt),r.forEach(((r,g)=>{f.save(),f.setWorldShadow(Gt.offsetX+r.x*h,Gt.offsetY+r.y*u,r.blur*h),a=r.spread?1-2*r.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,jt(f,Gt,a,n),f.restore(),d?(f.copyWorld(f,l,s,"copy"),f.copyWorld(d,s,s,"source-out"),i=s):(f.copyWorld(n.canvas,c,l,"source-out"),i=l),f.fillWorld(i,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,i,s,r.blendMode):e.copyWorldToInner(f,i,o.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(i,!0)})),f.recycle(i)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Yt}=t.LeafBoundsHelper;function qt(t,e,n,i,a,s){switch(e){case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),Vt(t,e,n,1)}(t,n,i,a);break;case"opacity-path":Vt(t,n,i,s);break;case"path":n.restore()}}function Xt(t){return t.getSameCanvas(!1,!0)}function Vt(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,s,o;const{children:r}=this;for(let d=0,l=r.length;d<l;d++)n=r[d],n.__.mask&&(o&&(qt(this,o,t,a,i,s),i=a=null),"path"===n.__.maskType?(n.opacity<1?(o="opacity-path",s=n.opacity,a||(a=Xt(t))):(o="path",t.save()),n.__clip(a||t,e)):(o="alpha",i||(i=Xt(t)),a||(a=Xt(t)),n.__render(i,e)),"clipping"!==n.__.maskType)||Yt(n,e)||n.__render(a||t,e);qt(this,o,t,a,i,s)};const zt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Qt=zt+"_#~&*+\\=|≮≯≈≠=…",Jt=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 Zt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const $t=Zt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Kt=Zt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),te=Zt(zt),ee=Zt(Qt),ne=Zt("- —/~|┆·");var ie;!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"}(ie||(ie={}));const{Letter:ae,Single:se,Before:oe,After:re,Symbol:de,Break:le}=ie;function ce(t){return $t[t]?ae:ne[t]?le:Kt[t]?oe:te[t]?re:ee[t]?de:Jt.test(t)?se:ae}const he={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let s=a-1;s>-1&&(n=e[s].data[0]," "===n.char);s--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function ue(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:fe}=he,{Letter:pe,Single:ge,Before:_e,After:we,Symbol:ye,Break:me}=ie;let ve,xe,be,Be,Ee,Re,Le,ke,Se,Pe,Oe,Ae,Ce,We,Te,Me,Ie=[];function De(t,e){Se&&!ke&&(ke=Se),ve.data.push({char:t,width:e}),be+=e}function Fe(){Be+=be,ve.width=be,xe.words.push(ve),ve={data:[]},be=0}function He(){We&&(Te.paraNumber++,xe.paraStart=!0,We=!1),Se&&(xe.startCharSize=ke,xe.endCharSize=Se,ke=0),xe.width=Be,Me.width&&fe(xe),Ie.push(xe),xe={words:[]},Be=0}const je=0,Ue=1,Ge=2;const{top:Ne,right:Ye,bottom:qe,left:Xe}=t.Direction4;function Ve(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const ze={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let i=0,a=0,s=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:r,__font:d,__padding:l}=n;l&&(s&&(i=l[Xe],s-=l[Ye]+l[Xe]),o&&(a=l[Ne],o-=l[Ne]+l[qe]));const c={bounds:{x:i,y:a,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){Te=e,Ie=e.rows,Me=e.bounds;const{__letterSpacing:a,paraIndent:s,textCase:o}=i,{canvas:r}=t.Platform,{width:d,height:l}=Me;if(d||l||a||"none"!==o){const t="none"!==i.textWrap,e="break"===i.textWrap;We=!0,Oe=null,ke=Le=Se=be=Be=0,ve={data:[]},xe={words:[]};for(let i=0,l=n.length;i<l;i++)Re=n[i],"\n"===Re?(be&&Fe(),xe.paraEnd=!0,He(),We=!0):(Pe=ce(Re),Pe===pe&&"none"!==o&&(Re=ue(Re,o,!be)),Le=r.measureText(Re).width,a&&(a<0&&(Se=Le),Le+=a),Ae=Pe===ge&&(Oe===ge||Oe===pe)||Oe===ge&&Pe!==we,Ce=!(Pe!==_e&&Pe!==ge||Oe!==ye&&Oe!==we),Ee=We&&s?d-s:d,t&&d&&Be+be+Le>Ee&&(e?(be&&Fe(),He()):(Ce||(Ce=Pe===pe&&Oe==we),Ae||Ce||Pe===me||Pe===_e||Pe===ge||be+Le>Ee?(be&&Fe(),He()):He()))," "===Re&&!0!==We&&Be+be===0||(Pe===me?(" "===Re&&be&&Fe(),De(Re,Le),Fe()):Ae||Ce?(be&&Fe(),De(Re,Le)):De(Re,Le)),Oe=Pe);be&&Fe(),Be&&He(),Ie.length>0&&(Ie[Ie.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Te.paraNumber++,Ie.push({x:s||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(c,e,n),l&&function(t,e,n,i,a){if(!i)switch(n.textAlign){case"left":Ve(e,"x",t[Xe]);break;case"right":Ve(e,"x",-t[Ye])}if(!a)switch(n.verticalAlign){case"top":Ve(e,"y",t[Ne]);break;case"bottom":Ve(e,"y",-t[qe])}}(l,c,n,s,o),function(t,e){const{rows:n,bounds:i}=t,{__lineHeight:a,__baseLine:s,__letterSpacing:o,__clipText:r,textAlign:d,verticalAlign:l,paraSpacing:c}=e;let h,u,f,{x:p,y:g,width:_,height:w}=i,y=a*n.length+(c?c*(t.paraNumber-1):0),m=s;if(r&&y>w)y=Math.max(w,a),t.overflow=n.length;else switch(l){case"middle":g+=(w-y)/2;break;case"bottom":g+=w-y}m+=g;for(let s=0,l=n.length;s<l;s++){switch(h=n[s],h.x=p,d){case"center":h.x+=(_-h.width)/2;break;case"right":h.x+=_-h.width}h.paraStart&&c&&s>0&&(m+=c),h.y=m,m+=a,t.overflow>s&&m>y&&(h.isOverflow=!0,t.overflow=s+1),u=h.x,f=h.width,o<0&&(h.width<0?(f=-h.width+e.fontSize+o,u-=f,f+=e.fontSize):f-=o),u<i.x&&(i.x=u),f>i.width&&(i.width=f),r&&_&&_<f&&(h.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=g,i.height=y}(c,n),function(t,e,n,i){const{rows:a}=t,{textAlign:s,paraIndent:o,letterSpacing:r}=e;let d,l,c,h,u;a.forEach((t=>{t.words&&(c=o&&t.paraStart?o:0,l=n&&"justify"===s&&t.words.length>1?(n-t.width-c)/(t.words.length-1):0,h=r||t.isOverflow?je:l>.01?Ue:Ge,t.isOverflow&&!r&&(t.textMode=!0),h===Ge?(t.x+=c,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=c,d=t.x,t.data=[],t.words.forEach((e=>{h===Ue?(u={char:"",x:d},d=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,n){return t.forEach((t=>{" "!==t.char&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(c,n,s),c.overflow&&function(e,n){const{rows:i,overflow:a}=e;let{textOverflow:s}=n;if(i.splice(a),s&&"show"!==s){let e,o;"hide"===s?s="":"ellipsis"===s&&(s="...");const r=s?t.Platform.canvas.measureText(s).width:0,d=n.x+n.width-r;("none"===n.textWrap?i:[i[a-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],o=e.x+e.width,!(i===n&&o<d));i--){if(o<d&&" "!==e.char){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=r,t.data.push({char:s,x:o}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,n),"none"!==r&&function(t,e){const{fontSize:n}=e;switch(t.decorationHeight=n/11,e.textDecoration){case"under":t.decorationY=.15*n;break;case"delete":t.decorationY=.35*-n}}(c,n),c}};const Qe={string:function(t,e){if("string"==typeof t)return t;let n=void 0===t.a?1:t.a;e&&(n*=e);const i=t.r+","+t.g+","+t.b;return 1===n?"rgb("+i+")":"rgba("+i+","+n+")"}},{setPoint:Je,addPoint:Ze,toBounds:$e}=t.TwoPointBoundsHelper;const Ke={export(e,n,a){return this.running=!0,function(e){tn||(tn=new t.TaskProcessor);return new Promise((t=>{tn.add((()=>i(this,void 0,void 0,(function*(){return yield e(t)}))),{parallel:!1})}))}((s=>new Promise((o=>{const r=t=>{s(t),o(),this.running=!1};if("json"===n)return r({data:e.toJSON()});if("json"===t.FileHelper.fileType(n))return t.Platform.origin.download("data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(e.toJSON())),n),r({data:!0});const{leafer:d}=e;d?d.waitViewCompleted((()=>i(this,void 0,void 0,(function*(){a=t.FileHelper.getExportOptions(a);let i,s,o=1,l=1;const{worldTransform:c,isLeafer:h,isFrame:u}=e,{slice:f,trim:p,onCanvas:g}=a;let _=a.scale||1,w=a.pixelRatio||1;e.isApp&&(_*=w,w=e.app.pixelRatio);const y=a.screenshot||e.isApp,m=h&&y&&void 0===a.fill?e.fill:a.fill,v=t.FileHelper.isOpaqueImage(n)||m,x=new t.Matrix;if(y)i=!0===y?h?d.canvas.bounds:e.worldRenderBounds:y;else{let t=a.relative||(h?"inner":"local");switch(o=c.scaleX,l=c.scaleY,t){case"inner":x.set(c);break;case"local":x.set(c).divide(e.localTransform),o/=e.scaleX,l/=e.scaleY;break;case"world":o=1,l=1;break;case"page":t=e.leafer;default:x.set(c).divide(e.getTransform(t));const n=t.worldTransform;o/=o/n.scaleX,l/=l/n.scaleY}i=e.getBounds("render",t)}const{x:b,y:B,width:E,height:R}=new t.Bounds(i).scale(_);let L=t.Creator.canvas({width:Math.round(E),height:Math.round(R),pixelRatio:w});const k={matrix:x.scale(1/_).invert().translate(-b,-B).withScale(1/o*_,1/l*_)};if(f&&(e=d,k.bounds=L.bounds),L.save(),u&&void 0!==m){const t=e.get("fill");e.fill="",e.__render(L,k),e.fill=t}else e.__render(L,k);if(L.restore(),p){s=function(e){const{width:n,height:i}=e.view,{data:a}=e.context.getImageData(0,0,n,i);let s,o,r,d=0;for(let t=0;t<a.length;t+=4)0!==a[t+3]&&(s=d%n,o=(d-s)/n,r?Ze(r,s,o):Je(r={},s,o)),d++;const l=new t.Bounds;return $e(r,l),l.scale(1/e.pixelRatio).ceil()}(L);const e=L,{width:n,height:i}=s,a={x:0,y:0,width:n,height:i,pixelRatio:w};L=t.Creator.canvas(a),L.copyWorld(e,s,a)}v&&L.fillWorld(L.bounds,m||"#FFFFFF","destination-over"),g&&g(L);const S="canvas"===n?L:yield L.export(n,a);r({data:S,width:L.pixelWidth,height:L.pixelHeight,renderBounds:i,trimBounds:s})})))):r({data:!1})}))))}};let tn;const en=t.LeaferCanvasBase.prototype,nn=t.Debug.get("@leafer-ui/export");en.export=function(e,n){const{quality:i,blob:a}=t.FileHelper.getExportOptions(n);return e.includes(".")?this.saveAs(e,i):a?this.toBlob(e,i):this.toDataURL(e,i)},en.toBlob=function(e,n){return new Promise((i=>{t.Platform.origin.canvasToBolb(this.view,e,n).then((t=>{i(t)})).catch((t=>{nn.error(t),i(null)}))}))},en.toDataURL=function(e,n){return t.Platform.origin.canvasToDataURL(this.view,e,n)},en.saveAs=function(e,n){return new Promise((i=>{t.Platform.origin.canvasSaveAs(this.view,e,n).then((()=>{i(!0)})).catch((t=>{nn.error(t),i(!1)}))}))},Object.assign(n.TextConvert,ze),Object.assign(n.ColorConvert,Qe),Object.assign(n.Paint,W),Object.assign(n.PaintImage,ht),Object.assign(n.PaintGradient,Mt),Object.assign(n.Effect,Nt),Object.assign(n.Export,Ke),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=a,exports.Renderer=x,exports.Watcher=r,exports.useCanvas=function(n,a){if(t.Platform.canvasType=n,!t.Platform.origin){if("skia"===n){const{Canvas:e,loadImage:n}=a;t.Platform.origin={createCanvas:(t,n,i)=>new e(t,n,i),canvasToDataURL:(t,e,n)=>t.toDataURLSync(e,{quality:n}),canvasToBolb:(t,e,n)=>t.toBuffer(e,{quality:n}),canvasSaveAs:(t,e,n)=>t.saveAs(e,{quality:n}),download(t,e){},loadImage:n},t.Platform.roundRectPatch=!0}else if("napi"===n){const{Canvas:n,loadImage:r}=a;t.Platform.origin={createCanvas:(t,e,i)=>new n(t,e,i),canvasToDataURL:(t,e,n)=>t.toDataURL(s(e),n),canvasToBolb:(t,e,n)=>i(this,void 0,void 0,(function*(){return t.toBuffer(s(e),n)})),canvasSaveAs:(t,n,a)=>i(this,void 0,void 0,(function*(){return e.writeFileSync(n,t.toBuffer(s(o(n)),a))})),download(t,e){},loadImage:r}}t.Platform.ellipseToCurve=!0,t.Platform.event={stopDefault(t){},stopNow(t){},stop(t){}},t.Platform.canvas=t.Creator.canvas()}},Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(n).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return n[t]}})}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-draw/node",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.23",
|
|
4
4
|
"description": "@leafer-draw/node",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "dist/
|
|
8
|
+
"main": "dist/node.esm.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
"import": "./dist/node.esm.js",
|
|
11
11
|
"require": "./dist/node.cjs",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"leaferjs"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@leafer/node": "1.0.0-rc.
|
|
35
|
-
"@leafer-draw/partner": "1.0.0-rc.
|
|
36
|
-
"@leafer-ui/draw": "1.0.0-rc.
|
|
37
|
-
"@leafer-ui/partner": "1.0.0-rc.
|
|
38
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
34
|
+
"@leafer/node": "1.0.0-rc.23",
|
|
35
|
+
"@leafer-draw/partner": "1.0.0-rc.23",
|
|
36
|
+
"@leafer-ui/draw": "1.0.0-rc.23",
|
|
37
|
+
"@leafer-ui/partner": "1.0.0-rc.23",
|
|
38
|
+
"@leafer-ui/interface": "1.0.0-rc.23"
|
|
39
39
|
}
|
|
40
40
|
}
|