@leafer-ui/draw 1.6.6 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/draw.cjs +32 -29
- package/lib/draw.esm.js +32 -29
- package/lib/draw.esm.min.js +1 -1
- package/lib/draw.esm.min.js.map +1 -1
- package/lib/draw.min.cjs +1 -1
- package/lib/draw.min.cjs.map +1 -1
- package/package.json +6 -6
package/lib/draw.cjs
CHANGED
|
@@ -133,13 +133,9 @@ class UIData extends core.LeafData {
|
|
|
133
133
|
else
|
|
134
134
|
return strokeWidth;
|
|
135
135
|
}
|
|
136
|
-
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
137
|
-
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
138
136
|
get __hasMultiPaint() {
|
|
139
137
|
const t = this;
|
|
140
|
-
|
|
141
|
-
return true;
|
|
142
|
-
return t.fill && this.__hasStroke;
|
|
138
|
+
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
143
139
|
}
|
|
144
140
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
145
141
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
@@ -430,15 +426,18 @@ const { stintSet } = core.DataHelper;
|
|
|
430
426
|
const UIRender = {
|
|
431
427
|
__updateChange() {
|
|
432
428
|
const data = this.__;
|
|
429
|
+
if (data.__useStroke) {
|
|
430
|
+
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
431
|
+
stintSet(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
|
|
432
|
+
stintSet(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
433
|
+
}
|
|
433
434
|
if (data.__useEffect) {
|
|
434
435
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
435
436
|
stintSet(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
|
|
436
437
|
data.__useEffect = !!(shadow || otherEffect);
|
|
437
438
|
}
|
|
438
|
-
stintSet(this.__world, 'half', data.__hasHalf);
|
|
439
|
-
stintSet(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
440
439
|
data.__checkSingle();
|
|
441
|
-
stintSet(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
440
|
+
stintSet(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
|
|
442
441
|
},
|
|
443
442
|
__drawFast(canvas, options) {
|
|
444
443
|
drawFast(this, canvas, options);
|
|
@@ -496,18 +495,15 @@ const UIRender = {
|
|
|
496
495
|
this.__drawFast(canvas, options);
|
|
497
496
|
}
|
|
498
497
|
},
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
this.
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
if (stroke && !ignoreStroke)
|
|
509
|
-
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
510
|
-
}
|
|
498
|
+
__drawShape(canvas, options) {
|
|
499
|
+
this.__drawRenderPath(canvas);
|
|
500
|
+
const data = this.__, { fill, stroke } = data;
|
|
501
|
+
if (fill && !options.ignoreFill)
|
|
502
|
+
data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
503
|
+
if (data.__isCanvas)
|
|
504
|
+
this.__drawAfterFill(canvas, options);
|
|
505
|
+
if (stroke && !options.ignoreStroke)
|
|
506
|
+
data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
511
507
|
},
|
|
512
508
|
__drawAfterFill(canvas, options) {
|
|
513
509
|
if (this.__.__clipAfterFill) {
|
|
@@ -632,12 +628,14 @@ exports.UI = UI_1 = class UI extends core.Leaf {
|
|
|
632
628
|
}
|
|
633
629
|
}
|
|
634
630
|
__updateRenderPath() {
|
|
635
|
-
|
|
636
|
-
|
|
631
|
+
const data = this.__;
|
|
632
|
+
if (data.path) {
|
|
637
633
|
data.__pathForRender = data.cornerRadius ? core.PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
638
634
|
if (data.__useArrow)
|
|
639
635
|
PathArrow.addArrows(this, !data.cornerRadius);
|
|
640
636
|
}
|
|
637
|
+
else
|
|
638
|
+
data.__pathForRender && (data.__pathForRender = undefined);
|
|
641
639
|
}
|
|
642
640
|
__drawRenderPath(canvas) {
|
|
643
641
|
canvas.beginPath();
|
|
@@ -848,13 +846,13 @@ __decorate([
|
|
|
848
846
|
core.surfaceType()
|
|
849
847
|
], exports.UI.prototype, "fill", void 0);
|
|
850
848
|
__decorate([
|
|
851
|
-
core.strokeType()
|
|
849
|
+
core.strokeType(undefined, true)
|
|
852
850
|
], exports.UI.prototype, "stroke", void 0);
|
|
853
851
|
__decorate([
|
|
854
852
|
core.strokeType('inside')
|
|
855
853
|
], exports.UI.prototype, "strokeAlign", void 0);
|
|
856
854
|
__decorate([
|
|
857
|
-
core.strokeType(1)
|
|
855
|
+
core.strokeType(1, true)
|
|
858
856
|
], exports.UI.prototype, "strokeWidth", void 0);
|
|
859
857
|
__decorate([
|
|
860
858
|
core.strokeType(false)
|
|
@@ -1281,7 +1279,7 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1281
1279
|
list.push(item);
|
|
1282
1280
|
this.requestRender();
|
|
1283
1281
|
}
|
|
1284
|
-
zoom(_zoomType,
|
|
1282
|
+
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
1285
1283
|
return core.Plugin.need('view');
|
|
1286
1284
|
}
|
|
1287
1285
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
@@ -1326,7 +1324,7 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1326
1324
|
Leafer_1.list.remove(this);
|
|
1327
1325
|
try {
|
|
1328
1326
|
this.stop();
|
|
1329
|
-
this.
|
|
1327
|
+
this.emitLeafer(core.LeaferEvent.END);
|
|
1330
1328
|
this.__removeListenEvents();
|
|
1331
1329
|
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
1332
1330
|
this.__controllers.length = 0;
|
|
@@ -1454,7 +1452,7 @@ exports.Box = class Box extends exports.Group {
|
|
|
1454
1452
|
}
|
|
1455
1453
|
__drawContent(canvas, options) {
|
|
1456
1454
|
this.__renderGroup(canvas, options);
|
|
1457
|
-
if (this.__.
|
|
1455
|
+
if (this.__.__useStroke) {
|
|
1458
1456
|
canvas.setWorld(this.__nowWorld);
|
|
1459
1457
|
this.__drawRenderPath(canvas);
|
|
1460
1458
|
}
|
|
@@ -1674,8 +1672,8 @@ exports.Polygon = class Polygon extends exports.UI {
|
|
|
1674
1672
|
for (let i = 1; i < sides; i++) {
|
|
1675
1673
|
lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
|
|
1676
1674
|
}
|
|
1675
|
+
closePath$1(path);
|
|
1677
1676
|
}
|
|
1678
|
-
closePath$1(path);
|
|
1679
1677
|
}
|
|
1680
1678
|
__updateRenderPath() { }
|
|
1681
1679
|
__updateBoxBounds() { }
|
|
@@ -1909,10 +1907,15 @@ exports.Text = class Text extends exports.UI {
|
|
|
1909
1907
|
const box = this.__box;
|
|
1910
1908
|
if (box)
|
|
1911
1909
|
box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
|
|
1912
|
-
if (this.textEditing && !
|
|
1910
|
+
if (this.textEditing && !options.exporting)
|
|
1913
1911
|
return;
|
|
1914
1912
|
super.__draw(canvas, options, originCanvas);
|
|
1915
1913
|
}
|
|
1914
|
+
__drawShape(canvas, options) {
|
|
1915
|
+
if (options.shape)
|
|
1916
|
+
this.__box && this.__box.__drawShape(canvas, options);
|
|
1917
|
+
super.__drawShape(canvas, options);
|
|
1918
|
+
}
|
|
1916
1919
|
destroy() {
|
|
1917
1920
|
if (this.boxStyle)
|
|
1918
1921
|
this.boxStyle = null;
|
package/lib/draw.esm.js
CHANGED
|
@@ -132,13 +132,9 @@ class UIData extends LeafData {
|
|
|
132
132
|
else
|
|
133
133
|
return strokeWidth;
|
|
134
134
|
}
|
|
135
|
-
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
136
|
-
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
137
135
|
get __hasMultiPaint() {
|
|
138
136
|
const t = this;
|
|
139
|
-
|
|
140
|
-
return true;
|
|
141
|
-
return t.fill && this.__hasStroke;
|
|
137
|
+
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
142
138
|
}
|
|
143
139
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
144
140
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
@@ -429,15 +425,18 @@ const { stintSet } = DataHelper;
|
|
|
429
425
|
const UIRender = {
|
|
430
426
|
__updateChange() {
|
|
431
427
|
const data = this.__;
|
|
428
|
+
if (data.__useStroke) {
|
|
429
|
+
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
430
|
+
stintSet(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
|
|
431
|
+
stintSet(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
432
|
+
}
|
|
432
433
|
if (data.__useEffect) {
|
|
433
434
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
434
435
|
stintSet(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
|
|
435
436
|
data.__useEffect = !!(shadow || otherEffect);
|
|
436
437
|
}
|
|
437
|
-
stintSet(this.__world, 'half', data.__hasHalf);
|
|
438
|
-
stintSet(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
439
438
|
data.__checkSingle();
|
|
440
|
-
stintSet(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
439
|
+
stintSet(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
|
|
441
440
|
},
|
|
442
441
|
__drawFast(canvas, options) {
|
|
443
442
|
drawFast(this, canvas, options);
|
|
@@ -495,18 +494,15 @@ const UIRender = {
|
|
|
495
494
|
this.__drawFast(canvas, options);
|
|
496
495
|
}
|
|
497
496
|
},
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
this.
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (stroke && !ignoreStroke)
|
|
508
|
-
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
509
|
-
}
|
|
497
|
+
__drawShape(canvas, options) {
|
|
498
|
+
this.__drawRenderPath(canvas);
|
|
499
|
+
const data = this.__, { fill, stroke } = data;
|
|
500
|
+
if (fill && !options.ignoreFill)
|
|
501
|
+
data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
502
|
+
if (data.__isCanvas)
|
|
503
|
+
this.__drawAfterFill(canvas, options);
|
|
504
|
+
if (stroke && !options.ignoreStroke)
|
|
505
|
+
data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
510
506
|
},
|
|
511
507
|
__drawAfterFill(canvas, options) {
|
|
512
508
|
if (this.__.__clipAfterFill) {
|
|
@@ -631,12 +627,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
631
627
|
}
|
|
632
628
|
}
|
|
633
629
|
__updateRenderPath() {
|
|
634
|
-
|
|
635
|
-
|
|
630
|
+
const data = this.__;
|
|
631
|
+
if (data.path) {
|
|
636
632
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
637
633
|
if (data.__useArrow)
|
|
638
634
|
PathArrow.addArrows(this, !data.cornerRadius);
|
|
639
635
|
}
|
|
636
|
+
else
|
|
637
|
+
data.__pathForRender && (data.__pathForRender = undefined);
|
|
640
638
|
}
|
|
641
639
|
__drawRenderPath(canvas) {
|
|
642
640
|
canvas.beginPath();
|
|
@@ -847,13 +845,13 @@ __decorate([
|
|
|
847
845
|
surfaceType()
|
|
848
846
|
], UI.prototype, "fill", void 0);
|
|
849
847
|
__decorate([
|
|
850
|
-
strokeType()
|
|
848
|
+
strokeType(undefined, true)
|
|
851
849
|
], UI.prototype, "stroke", void 0);
|
|
852
850
|
__decorate([
|
|
853
851
|
strokeType('inside')
|
|
854
852
|
], UI.prototype, "strokeAlign", void 0);
|
|
855
853
|
__decorate([
|
|
856
|
-
strokeType(1)
|
|
854
|
+
strokeType(1, true)
|
|
857
855
|
], UI.prototype, "strokeWidth", void 0);
|
|
858
856
|
__decorate([
|
|
859
857
|
strokeType(false)
|
|
@@ -1280,7 +1278,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1280
1278
|
list.push(item);
|
|
1281
1279
|
this.requestRender();
|
|
1282
1280
|
}
|
|
1283
|
-
zoom(_zoomType,
|
|
1281
|
+
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
1284
1282
|
return Plugin.need('view');
|
|
1285
1283
|
}
|
|
1286
1284
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
@@ -1325,7 +1323,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1325
1323
|
Leafer_1.list.remove(this);
|
|
1326
1324
|
try {
|
|
1327
1325
|
this.stop();
|
|
1328
|
-
this.
|
|
1326
|
+
this.emitLeafer(LeaferEvent.END);
|
|
1329
1327
|
this.__removeListenEvents();
|
|
1330
1328
|
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
1331
1329
|
this.__controllers.length = 0;
|
|
@@ -1453,7 +1451,7 @@ let Box = class Box extends Group {
|
|
|
1453
1451
|
}
|
|
1454
1452
|
__drawContent(canvas, options) {
|
|
1455
1453
|
this.__renderGroup(canvas, options);
|
|
1456
|
-
if (this.__.
|
|
1454
|
+
if (this.__.__useStroke) {
|
|
1457
1455
|
canvas.setWorld(this.__nowWorld);
|
|
1458
1456
|
this.__drawRenderPath(canvas);
|
|
1459
1457
|
}
|
|
@@ -1673,8 +1671,8 @@ let Polygon = class Polygon extends UI {
|
|
|
1673
1671
|
for (let i = 1; i < sides; i++) {
|
|
1674
1672
|
lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
|
|
1675
1673
|
}
|
|
1674
|
+
closePath$1(path);
|
|
1676
1675
|
}
|
|
1677
|
-
closePath$1(path);
|
|
1678
1676
|
}
|
|
1679
1677
|
__updateRenderPath() { }
|
|
1680
1678
|
__updateBoxBounds() { }
|
|
@@ -1908,10 +1906,15 @@ let Text = class Text extends UI {
|
|
|
1908
1906
|
const box = this.__box;
|
|
1909
1907
|
if (box)
|
|
1910
1908
|
box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
|
|
1911
|
-
if (this.textEditing && !
|
|
1909
|
+
if (this.textEditing && !options.exporting)
|
|
1912
1910
|
return;
|
|
1913
1911
|
super.__draw(canvas, options, originCanvas);
|
|
1914
1912
|
}
|
|
1913
|
+
__drawShape(canvas, options) {
|
|
1914
|
+
if (options.shape)
|
|
1915
|
+
this.__box && this.__box.__drawShape(canvas, options);
|
|
1916
|
+
super.__drawShape(canvas, options);
|
|
1917
|
+
}
|
|
1915
1918
|
destroy() {
|
|
1916
1919
|
if (this.boxStyle)
|
|
1917
1920
|
this.boxStyle = null;
|
package/lib/draw.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineKey as t,decorateLeafAttr as e,attr as i,Plugin as s,PathConvert as o,DataHelper as r,Debug as a,LeafData as n,canvasSizeAttrs as _,UICreator as h,dataProcessor as d,dataType as p,surfaceType as l,opacityType as u,visibleType as c,sortType as y,maskType as g,eraserType as v,positionType as f,boundsType as w,scaleType as x,rotationType as m,autoLayoutType as S,naturalBoundsType as R,pathInputType as k,pathType as b,hitType as B,strokeType as A,cursorType as C,rewrite as P,Leaf as F,useModule as W,rewriteAble as E,MathHelper as I,pen as T,PathCorner as D,PathDrawer as z,registerUI as L,Branch as M,LeafList as O,Resource as N,getBoundsData as V,Creator as j,CanvasManager as Y,WaitHelper as H,LeaferEvent as U,Bounds as X,ResizeEvent as q,AutoBounds as G,Run as J,LayoutEvent as $,RenderEvent as K,WatchEvent as Q,ImageManager as Z,BoundsHelper as tt,affectRenderBoundsType as et,PathCommandDataHelper as it,Platform as st,PointHelper as ot,PathBounds as rt,affectStrokeBoundsType as at,getPointData as nt,LeaferImage as _t,ImageEvent as ht,Matrix as dt,PathCreator as pt}from"@leafer/core";export*from"@leafer/core";function lt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function ut(t){return e(t,(t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function ct(t){return e(t,(t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function yt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}"function"==typeof SuppressedError&&SuppressedError;const gt={},vt={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},ft={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},wt={},xt={},mt={},St={},Rt={},kt={apply(){s.need("filter")}},bt={},Bt={setStyleName:()=>s.need("state"),set:()=>s.need("state")},At={list:{},register(t,e){At.list[t]=e},get:t=>At.list[t]},{parse:Ct,objectToCanvasData:Pt}=o,{stintSet:Ft}=r,{hasTransparent:Wt}=vt,Et={},It=a.get("UIData");class Tt extends n{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,It.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,It.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("fill",t):(Ft(this,"__isTransparentFill",Wt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(Ft(this,"__isTransparentStroke",Wt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t)}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?Ct(t):Pt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Dt(this,"shadow",t)}setInnerShadow(t){Dt(this,"innerShadow",t)}setFilter(t){Dt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&xt.compute("fill",this.__leaf),e&&xt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),e instanceof Array&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Et)):(this.__isStrokes=!0,this._stroke||(this._stroke=Et))}__removePaint(t,e){e&&this.__removeInput(t),mt.recycleImage(t,this),"fill"===t?(Ft(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ft(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function Dt(t,e,i){t.__setInput(e,i),i instanceof Array?(i.some((t=>!1===t.visible))&&(i=i.filter((t=>!1!==t.visible))),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class zt extends Tt{}class Lt extends zt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class Mt extends zt{__getInputData(t,e){const i=super.__getInputData(t,e);return _.forEach((t=>delete i[t])),i}}class Ot extends Lt{}class Nt extends Tt{}class Vt extends Tt{get __boxStroke(){return!this.__pathInputed}}class jt extends Tt{get __boxStroke(){return!this.__pathInputed}}class Yt extends Tt{}class Ht extends Tt{}class Ut extends Tt{get __pathInputed(){return 2}}class Xt extends zt{}const qt={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Gt extends Tt{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=qt[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=h.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange(),r.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Jt extends Vt{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class $t extends Vt{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const Kt={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),r&&(t+=kt.getSpread(r));let a=t=Math.ceil(t);return i&&i.forEach((t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:Qt}=r,Zt={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Qt(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!(e[0].box&&t.__isTransparentFill)&&i&&!(i instanceof Array&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}Qt(this.__world,"half",t.__hasHalf),Qt(t,"__fillAfterStroke",t.stroke&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill),t.__checkSingle(),Qt(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){te(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:r,__drawAfterFill:a,__fillAfterStroke:n,__isFastShadow:_}=s;if(this.__drawRenderPath(t),s.__useEffect&&!_){const _=xt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:p}=s;h&&Rt.shadow(this,t,_),n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t)),o&&(s.__isFills?xt.fills(o,this,t):xt.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Rt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t)),p&&kt.apply(p,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,vt.string(e.color))}o&&(s.__isFills?xt.fills(o,this,t):xt.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t))}}else s.__pathInputed?te(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,i,s){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:o,stroke:r}=this.__;this.__drawRenderPath(t),o&&!i&&(this.__.__isAlphaPixelFill?xt.fills(o,this,t):xt.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),r&&!s&&(this.__.__isAlphaPixelStroke?xt.strokes(r,this,t):xt.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function te(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&xt.stroke(o,t,e),s&&xt.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&xt.stroke(o,t,e)}const ee={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:_}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),_&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:_}=this.__;if(!_)return;t.setStroke(n,_,this.__);const h=_/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=_,r-=_,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+h,s+h,o,r),t.restore()):t.strokeRect(i+h,s+h,o,r);break;case"outside":t.strokeRect(i-h,s-h,o+_,r+_)}}}};var ie;let se=ie=class extends F{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){I.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return T.set(this.path=t||[]),t||this.__drawPathByBox(T),T}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return s.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return s.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(T.set(i=[]),this.__drawPathByBox(T)),t?o.toCanvasData(i,!0):i}getPathString(t,e,i){return o.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||bt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?D.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&wt.addArrows(this,!t.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?z.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,o,"number"==typeof r?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){xt.fill(this.__.placeholderColor,this,t)}animate(t,e,i,o){return s.need("animate")}killAnimate(t,e){}export(t,e){return s.need("export")}syncExport(t,e){return s.need("export")}clone(t){const e=r.clone(this.toJSON());return t&&Object.assign(e,t),ie.one(e)}static one(t,e,i,s,o){return h.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){L()(this)}static registerData(t){d(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};lt([d(Tt)],se.prototype,"__",void 0),lt([yt()],se.prototype,"zoomLayer",void 0),lt([p("")],se.prototype,"id",void 0),lt([p("")],se.prototype,"name",void 0),lt([p("")],se.prototype,"className",void 0),lt([l("pass-through")],se.prototype,"blendMode",void 0),lt([u(1)],se.prototype,"opacity",void 0),lt([c(!0)],se.prototype,"visible",void 0),lt([l(!1)],se.prototype,"locked",void 0),lt([l(!1)],se.prototype,"dim",void 0),lt([l(!1)],se.prototype,"dimskip",void 0),lt([y(0)],se.prototype,"zIndex",void 0),lt([g(!1)],se.prototype,"mask",void 0),lt([v(!1)],se.prototype,"eraser",void 0),lt([f(0,!0)],se.prototype,"x",void 0),lt([f(0,!0)],se.prototype,"y",void 0),lt([w(100,!0)],se.prototype,"width",void 0),lt([w(100,!0)],se.prototype,"height",void 0),lt([x(1,!0)],se.prototype,"scaleX",void 0),lt([x(1,!0)],se.prototype,"scaleY",void 0),lt([m(0,!0)],se.prototype,"rotation",void 0),lt([m(0,!0)],se.prototype,"skewX",void 0),lt([m(0,!0)],se.prototype,"skewY",void 0),lt([f(0,!0)],se.prototype,"offsetX",void 0),lt([f(0,!0)],se.prototype,"offsetY",void 0),lt([f(0,!0)],se.prototype,"scrollX",void 0),lt([f(0,!0)],se.prototype,"scrollY",void 0),lt([S()],se.prototype,"origin",void 0),lt([S()],se.prototype,"around",void 0),lt([p(!1)],se.prototype,"lazy",void 0),lt([R(1)],se.prototype,"pixelRatio",void 0),lt([k()],se.prototype,"path",void 0),lt([b()],se.prototype,"windingRule",void 0),lt([b(!0)],se.prototype,"closed",void 0),lt([w(0)],se.prototype,"padding",void 0),lt([w(!1)],se.prototype,"lockRatio",void 0),lt([w()],se.prototype,"widthRange",void 0),lt([w()],se.prototype,"heightRange",void 0),lt([p(!1)],se.prototype,"draggable",void 0),lt([p()],se.prototype,"dragBounds",void 0),lt([p(!1)],se.prototype,"editable",void 0),lt([B(!0)],se.prototype,"hittable",void 0),lt([B("path")],se.prototype,"hitFill",void 0),lt([A("path")],se.prototype,"hitStroke",void 0),lt([B(!1)],se.prototype,"hitBox",void 0),lt([B(!0)],se.prototype,"hitChildren",void 0),lt([B(!0)],se.prototype,"hitSelf",void 0),lt([B()],se.prototype,"hitRadius",void 0),lt([C("")],se.prototype,"cursor",void 0),lt([l()],se.prototype,"fill",void 0),lt([A()],se.prototype,"stroke",void 0),lt([A("inside")],se.prototype,"strokeAlign",void 0),lt([A(1)],se.prototype,"strokeWidth",void 0),lt([A(!1)],se.prototype,"strokeWidthFixed",void 0),lt([A("none")],se.prototype,"strokeCap",void 0),lt([A("miter")],se.prototype,"strokeJoin",void 0),lt([A()],se.prototype,"dashPattern",void 0),lt([A(0)],se.prototype,"dashOffset",void 0),lt([A(10)],se.prototype,"miterLimit",void 0),lt([b(0)],se.prototype,"cornerRadius",void 0),lt([b()],se.prototype,"cornerSmoothing",void 0),lt([ut()],se.prototype,"shadow",void 0),lt([ut()],se.prototype,"innerShadow",void 0),lt([ut()],se.prototype,"blur",void 0),lt([ut()],se.prototype,"backgroundBlur",void 0),lt([ut()],se.prototype,"grayscale",void 0),lt([ut()],se.prototype,"filter",void 0),lt([l()],se.prototype,"placeholderColor",void 0),lt([p(100)],se.prototype,"placeholderDelay",void 0),lt([p({})],se.prototype,"data",void 0),lt([P(F.prototype.reset)],se.prototype,"reset",null),se=ie=lt([W(Kt),W(Zt),E()],se);let oe=class extends se{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach((t=>this.add(t))),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return e.children=this.children.map((e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var re;lt([d(zt)],oe.prototype,"__",void 0),lt([w(0)],oe.prototype,"width",void 0),lt([w(0)],oe.prototype,"height",void 0),oe=lt([W(M),L()],oe);const ae=a.get("Leafer");let ne=re=class extends oe{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&N.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||V()}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),re.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,r.assign(s,t));const o=this.canvas=j.canvas(s);this.__controllers.push(this.renderer=j.renderer(this,o,s),this.watcher=j.watcher(this,s),this.layouter=j.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=j.selector(this),this.interaction=j.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=j.hitCanvasManager()),this.canvasManager=new Y,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),H.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(U.RESTART):this.emitLeafer(U.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(U.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=r.copyAttrs({},t,_);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new X(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=r.copyAttrs({},this.canvas,_);e.resize(t),this.updateLazyBounds(),this.__onResize(new q(t,i))}__onResize(t){this.emitEvent(t),r.copyAttrs(this.__,t,_),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new G(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(_.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout((()=>this.parent&&this.parent.__updateSortChildren())))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&_.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=r.copyAttrs({},this.canvas,_);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(U.BEFORE_READY),this.emitLeafer(U.READY),this.emitLeafer(U.AFTER_READY),H.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(U.VIEW_READY),H.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:r}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(o=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:o,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){H.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender((()=>{this.imageReady&&(t&&this.emitLeafer(U.VIEW_COMPLETED),H.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,o){return s.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new U(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once([[U.START,()=>J.end(t)],[$.START,this.updateLazyBounds,this],[K.START,this.__onCreated,this],[K.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Q.DATA,this.__onWatchData,this],[$.END,this.__onLayoutEnd,this],[K.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){re.list.remove(this);try{this.stop(),this.emitEvent(new U(U.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{Z.clearRecycled()}),100)}catch(t){ae.error(t)}}};t?e():setTimeout(e)}};ne.list=new O,lt([d(Mt)],ne.prototype,"__",void 0),lt([w()],ne.prototype,"pixelRatio",void 0),ne=re=lt([L()],ne);let _e=class extends se{get __tag(){return"Rect"}constructor(t){super(t)}};lt([d(Vt)],_e.prototype,"__",void 0),_e=lt([W(ee),E(),L()],_e);const{copy:he,add:de,includes:pe}=tt,le=_e.prototype,ue=oe.prototype,ce={};let ye=class extends oe{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;const{renderBounds:e}=this.__layout;this.children.length?(super.__updateRenderBounds(),he(ce,e),this.__updateRectRenderBounds(),t=!pe(e,ce),t&&"hide"!==this.__.overflow&&de(e,ce)):this.__updateRectRenderBounds(),r.stintSet(this,"isOverflow",t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};lt([d(Lt)],ye.prototype,"__",void 0),lt([w(100)],ye.prototype,"width",void 0),lt([w(100)],ye.prototype,"height",void 0),lt([p(!1)],ye.prototype,"resizeChildren",void 0),lt([et("show")],ye.prototype,"overflow",void 0),lt([P(le.__updateStrokeSpread)],ye.prototype,"__updateStrokeSpread",null),lt([P(le.__updateRenderSpread)],ye.prototype,"__updateRectRenderSpread",null),lt([P(le.__updateBoxBounds)],ye.prototype,"__updateRectBoxBounds",null),lt([P(le.__updateStrokeBounds)],ye.prototype,"__updateStrokeBounds",null),lt([P(le.__updateRenderBounds)],ye.prototype,"__updateRectRenderBounds",null),lt([P(le.__updateChange)],ye.prototype,"__updateRectChange",null),lt([P(le.__render)],ye.prototype,"__renderRect",null),lt([P(ue.__render)],ye.prototype,"__renderGroup",null),ye=lt([E(),L()],ye);let ge=class extends ye{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};lt([d(Ot)],ge.prototype,"__",void 0),lt([l("#FFFFFF")],ge.prototype,"fill",void 0),lt([et("hide")],ge.prototype,"overflow",void 0),ge=lt([L()],ge);const{moveTo:ve,closePath:fe,ellipse:we}=it;let xe=class extends se{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];i?(s||o?(i<1&&we(n,r,a,r*i,a*i,0,s,o,!1),we(n,r,a,r,a,0,o,s,!0),i<1&&fe(n)):(i<1&&(we(n,r,a,r*i,a*i),ve(n,t,a)),we(n,r,a,r,a,0,360,0,!0)),st.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(ve(n,r,a),we(n,r,a,r,a,0,s,o,!1),fe(n)):we(n,r,a,r,a)}};lt([d(jt)],xe.prototype,"__",void 0),lt([b(0)],xe.prototype,"innerRadius",void 0),lt([b(0)],xe.prototype,"startAngle",void 0),lt([b(0)],xe.prototype,"endAngle",void 0),xe=lt([L()],xe);const{moveTo:me,lineTo:Se,drawPoints:Re}=it,{rotate:ke,getAngle:be,getDistance:Be,defaultPoint:Ae}=ot,{toBounds:Ce}=rt;let Pe=class extends se{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=nt();return t&&(i.x=t),e&&ke(i,e),i}set toPoint(t){this.width=Be(Ae,t),this.rotation=be(Ae,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Re(e,t.points,!1,t.closed):(me(e,0,0),Se(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Re(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&wt.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Ce(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};lt([d(Nt)],Pe.prototype,"__",void 0),lt([at("center")],Pe.prototype,"strokeAlign",void 0),lt([w(0)],Pe.prototype,"height",void 0),lt([b()],Pe.prototype,"points",void 0),lt([b(0)],Pe.prototype,"curve",void 0),lt([b(!1)],Pe.prototype,"closed",void 0),Pe=lt([L()],Pe);const{sin:Fe,cos:We,PI:Ee}=Math,{moveTo:Ie,lineTo:Te,closePath:De,drawPoints:ze}=it,Le=Pe.prototype;let Me=class extends se{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)ze(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,r=i/2;Ie(t,o,0);for(let e=1;e<s;e++)Te(t,o+o*Fe(2*e*Ee/s),r-r*We(2*e*Ee/s))}De(t)}__updateRenderPath(){}__updateBoxBounds(){}};lt([d(Yt)],Me.prototype,"__",void 0),lt([b(3)],Me.prototype,"sides",void 0),lt([b()],Me.prototype,"points",void 0),lt([b(0)],Me.prototype,"curve",void 0),lt([P(Le.__updateRenderPath)],Me.prototype,"__updateRenderPath",null),lt([P(Le.__updateBoxBounds)],Me.prototype,"__updateBoxBounds",null),Me=lt([E(),L()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:je,lineTo:Ye,closePath:He}=it;let Ue=class extends se{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];je(a,o,0);for(let t=1;t<2*i;t++)Ye(a,o+(t%2==0?o:o*s)*Oe(t*Ve/i),r-(t%2==0?r:r*s)*Ne(t*Ve/i));He(a)}};lt([d(Ht)],Ue.prototype,"__",void 0),lt([b(5)],Ue.prototype,"corners",void 0),lt([b(.382)],Ue.prototype,"innerRadius",void 0),Ue=lt([L()],Ue);let Xe=class extends _e{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return t instanceof Array&&t[0].image}constructor(t){super(t)}};lt([d(Jt)],Xe.prototype,"__",void 0),lt([w("")],Xe.prototype,"url",void 0),Xe=lt([L()],Xe);const qe=Xe;let Ge=class extends _e{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=j.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new _t({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ht(ht.LOADED,{image:t}))}))}draw(t,e,i,s){const o=new dt(t.worldTransform).invert(),r=new dt;e&&r.translate(e.x,e.y),i&&("number"==typeof i?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};lt([d($t)],Ge.prototype,"__",void 0),lt([ct(100)],Ge.prototype,"width",void 0),lt([ct(100)],Ge.prototype,"height",void 0),lt([ct(1)],Ge.prototype,"pixelRatio",void 0),lt([ct(!0)],Ge.prototype,"smooth",void 0),lt([p(!1)],Ge.prototype,"safeResize",void 0),lt([ct()],Ge.prototype,"contextSettings",void 0),Ge=lt([L()],Ge);const{copyAndSpread:Je,includes:$e,spread:Ke,setList:Qe}=tt;let Ze=class extends se{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h}=t;t.__lineHeight=ft.number(e,o),t.__letterSpacing=ft.number(i,o),t.__padding=h?I.fourNumber(h):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o}px ${s}`,t.__clipText="show"!==_&&!t.__autoSize,t.__textDrawData=gt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:a,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&Ke(_,i/2),a||n){if(h.x=a?_.x:0,h.y=n?_.y:0,h.width=a?_.width:t.width,h.height=n?_.height:t.height,o){const[e,i,s,o]=t.__padding;a&&(h.x-=o,h.width+=i+o),n&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),r.stintSet(this,"isOverflow",!$e(h,_)),this.isOverflow?(Qe(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Je(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!bt.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};lt([d(Gt)],Ze.prototype,"__",void 0),lt([w(0)],Ze.prototype,"width",void 0),lt([w(0)],Ze.prototype,"height",void 0),lt([l()],Ze.prototype,"boxStyle",void 0),lt([p(!1)],Ze.prototype,"resizeFontSize",void 0),lt([l("#000000")],Ze.prototype,"fill",void 0),lt([at("outside")],Ze.prototype,"strokeAlign",void 0),lt([B("all")],Ze.prototype,"hitFill",void 0),lt([w("")],Ze.prototype,"text",void 0),lt([w("")],Ze.prototype,"placeholder",void 0),lt([w("caption")],Ze.prototype,"fontFamily",void 0),lt([w(12)],Ze.prototype,"fontSize",void 0),lt([w("normal")],Ze.prototype,"fontWeight",void 0),lt([w(!1)],Ze.prototype,"italic",void 0),lt([w("none")],Ze.prototype,"textCase",void 0),lt([w("none")],Ze.prototype,"textDecoration",void 0),lt([w(0)],Ze.prototype,"letterSpacing",void 0),lt([w({type:"percent",value:1.5})],Ze.prototype,"lineHeight",void 0),lt([w(0)],Ze.prototype,"paraIndent",void 0),lt([w(0)],Ze.prototype,"paraSpacing",void 0),lt([w("x")],Ze.prototype,"writingMode",void 0),lt([w("left")],Ze.prototype,"textAlign",void 0),lt([w("top")],Ze.prototype,"verticalAlign",void 0),lt([w(!0)],Ze.prototype,"autoSizeAlign",void 0),lt([w("normal")],Ze.prototype,"textWrap",void 0),lt([w("show")],Ze.prototype,"textOverflow",void 0),lt([l(!1)],Ze.prototype,"textEditing",void 0),Ze=lt([L()],Ze);let ti=class extends se{get __tag(){return"Path"}constructor(t){super(t)}};lt([d(Ut)],ti.prototype,"__",void 0),lt([at("center")],ti.prototype,"strokeAlign",void 0),ti=lt([L()],ti);let ei=class extends oe{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new ti(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};lt([d(Xt)],ei.prototype,"__",void 0),lt([(e,i)=>{t(e,i,{get(){return this.__path}})}],ei.prototype,"path",void 0),ei=lt([W(pt,["set","path","paint"]),L()],ei);export{ye as Box,Lt as BoxData,Ge as Canvas,$t as CanvasData,vt as ColorConvert,Rt as Effect,xe as Ellipse,jt as EllipseData,bt as Export,kt as Filter,ge as Frame,Ot as FrameData,oe as Group,zt as GroupData,Xe as Image,Jt as ImageData,ne as Leafer,Mt as LeaferData,Pe as Line,Nt as LineData,qe as MyImage,xt as Paint,St as PaintGradient,mt as PaintImage,ti as Path,wt as PathArrow,Ut as PathData,ei as Pen,Xt as PenData,Me as Polygon,Yt as PolygonData,_e as Rect,Vt as RectData,ee as RectRender,Ue as Star,Ht as StarData,Bt as State,Ze as Text,gt as TextConvert,Gt as TextData,At as Transition,se as UI,Kt as UIBounds,Tt as UIData,Zt as UIRender,ft as UnitConvert,ut as effectType,ct as resizeType,yt as zoomLayerType};
|
|
1
|
+
import{defineKey as t,decorateLeafAttr as e,attr as i,Plugin as s,PathConvert as o,DataHelper as r,Debug as a,LeafData as n,canvasSizeAttrs as _,UICreator as h,dataProcessor as d,dataType as p,surfaceType as l,opacityType as u,visibleType as c,sortType as y,maskType as g,eraserType as v,positionType as f,boundsType as w,scaleType as x,rotationType as m,autoLayoutType as S,naturalBoundsType as R,pathInputType as k,pathType as b,hitType as B,strokeType as A,cursorType as C,rewrite as P,Leaf as F,useModule as E,rewriteAble as I,MathHelper as W,pen as T,PathCorner as D,PathDrawer as z,registerUI as L,Branch as M,LeafList as O,Resource as N,getBoundsData as V,Creator as j,CanvasManager as Y,WaitHelper as U,LeaferEvent as X,Bounds as H,ResizeEvent as q,AutoBounds as G,Run as J,LayoutEvent as $,RenderEvent as K,WatchEvent as Q,ImageManager as Z,BoundsHelper as tt,affectRenderBoundsType as et,PathCommandDataHelper as it,Platform as st,PointHelper as ot,PathBounds as rt,affectStrokeBoundsType as at,getPointData as nt,LeaferImage as _t,ImageEvent as ht,Matrix as dt,PathCreator as pt}from"@leafer/core";export*from"@leafer/core";function lt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function ut(t){return e(t,(t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function ct(t){return e(t,(t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function yt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}"function"==typeof SuppressedError&&SuppressedError;const gt={},vt={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},ft={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},wt={},xt={},mt={},St={},Rt={},kt={apply(){s.need("filter")}},bt={},Bt={setStyleName:()=>s.need("state"),set:()=>s.need("state")},At={list:{},register(t,e){At.list[t]=e},get:t=>At.list[t]},{parse:Ct,objectToCanvasData:Pt}=o,{stintSet:Ft}=r,{hasTransparent:Et}=vt,It={},Wt=a.get("UIData");class Tt extends n{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Wt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Wt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("fill",t):(Ft(this,"__isTransparentFill",Et(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(Ft(this,"__isTransparentStroke",Et(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t)}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?Ct(t):Pt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Dt(this,"shadow",t)}setInnerShadow(t){Dt(this,"innerShadow",t)}setFilter(t){Dt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&xt.compute("fill",this.__leaf),e&&xt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),e instanceof Array&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=It)):(this.__isStrokes=!0,this._stroke||(this._stroke=It))}__removePaint(t,e){e&&this.__removeInput(t),mt.recycleImage(t,this),"fill"===t?(Ft(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ft(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function Dt(t,e,i){t.__setInput(e,i),i instanceof Array?(i.some((t=>!1===t.visible))&&(i=i.filter((t=>!1!==t.visible))),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class zt extends Tt{}class Lt extends zt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class Mt extends zt{__getInputData(t,e){const i=super.__getInputData(t,e);return _.forEach((t=>delete i[t])),i}}class Ot extends Lt{}class Nt extends Tt{}class Vt extends Tt{get __boxStroke(){return!this.__pathInputed}}class jt extends Tt{get __boxStroke(){return!this.__pathInputed}}class Yt extends Tt{}class Ut extends Tt{}class Xt extends Tt{get __pathInputed(){return 2}}class Ht extends zt{}const qt={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Gt extends Tt{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=qt[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=h.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange(),r.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Jt extends Vt{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class $t extends Vt{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const Kt={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),r&&(t+=kt.getSpread(r));let a=t=Math.ceil(t);return i&&i.forEach((t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:Qt}=r,Zt={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Qt(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Qt(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Qt(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!(e[0].box&&t.__isTransparentFill)&&i&&!(i instanceof Array&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Qt(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){te(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:r,__drawAfterFill:a,__fillAfterStroke:n,__isFastShadow:_}=s;if(this.__drawRenderPath(t),s.__useEffect&&!_){const _=xt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:p}=s;h&&Rt.shadow(this,t,_),n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t)),o&&(s.__isFills?xt.fills(o,this,t):xt.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Rt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t)),p&&kt.apply(p,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,vt.string(e.color))}o&&(s.__isFills?xt.fills(o,this,t):xt.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?xt.strokes(r,this,t):xt.stroke(r,this,t))}}else s.__pathInputed?te(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?xt.fills(s,this,t):xt.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?xt.strokes(o,this,t):xt.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function te(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&xt.stroke(o,t,e),s&&xt.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&xt.stroke(o,t,e)}const ee={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:_}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),_&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:_}=this.__;if(!_)return;t.setStroke(n,_,this.__);const h=_/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=_,r-=_,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+h,s+h,o,r),t.restore()):t.strokeRect(i+h,s+h,o,r);break;case"outside":t.strokeRect(i-h,s-h,o+_,r+_)}}}};var ie;let se=ie=class extends F{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return T.set(this.path=t||[]),t||this.__drawPathByBox(T),T}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return s.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return s.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(T.set(i=[]),this.__drawPathByBox(T)),t?o.toCanvasData(i,!0):i}getPathString(t,e,i){return o.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||bt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?D.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&wt.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?z.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,o,"number"==typeof r?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){xt.fill(this.__.placeholderColor,this,t)}animate(t,e,i,o){return s.need("animate")}killAnimate(t,e){}export(t,e){return s.need("export")}syncExport(t,e){return s.need("export")}clone(t){const e=r.clone(this.toJSON());return t&&Object.assign(e,t),ie.one(e)}static one(t,e,i,s,o){return h.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){L()(this)}static registerData(t){d(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};lt([d(Tt)],se.prototype,"__",void 0),lt([yt()],se.prototype,"zoomLayer",void 0),lt([p("")],se.prototype,"id",void 0),lt([p("")],se.prototype,"name",void 0),lt([p("")],se.prototype,"className",void 0),lt([l("pass-through")],se.prototype,"blendMode",void 0),lt([u(1)],se.prototype,"opacity",void 0),lt([c(!0)],se.prototype,"visible",void 0),lt([l(!1)],se.prototype,"locked",void 0),lt([l(!1)],se.prototype,"dim",void 0),lt([l(!1)],se.prototype,"dimskip",void 0),lt([y(0)],se.prototype,"zIndex",void 0),lt([g(!1)],se.prototype,"mask",void 0),lt([v(!1)],se.prototype,"eraser",void 0),lt([f(0,!0)],se.prototype,"x",void 0),lt([f(0,!0)],se.prototype,"y",void 0),lt([w(100,!0)],se.prototype,"width",void 0),lt([w(100,!0)],se.prototype,"height",void 0),lt([x(1,!0)],se.prototype,"scaleX",void 0),lt([x(1,!0)],se.prototype,"scaleY",void 0),lt([m(0,!0)],se.prototype,"rotation",void 0),lt([m(0,!0)],se.prototype,"skewX",void 0),lt([m(0,!0)],se.prototype,"skewY",void 0),lt([f(0,!0)],se.prototype,"offsetX",void 0),lt([f(0,!0)],se.prototype,"offsetY",void 0),lt([f(0,!0)],se.prototype,"scrollX",void 0),lt([f(0,!0)],se.prototype,"scrollY",void 0),lt([S()],se.prototype,"origin",void 0),lt([S()],se.prototype,"around",void 0),lt([p(!1)],se.prototype,"lazy",void 0),lt([R(1)],se.prototype,"pixelRatio",void 0),lt([k()],se.prototype,"path",void 0),lt([b()],se.prototype,"windingRule",void 0),lt([b(!0)],se.prototype,"closed",void 0),lt([w(0)],se.prototype,"padding",void 0),lt([w(!1)],se.prototype,"lockRatio",void 0),lt([w()],se.prototype,"widthRange",void 0),lt([w()],se.prototype,"heightRange",void 0),lt([p(!1)],se.prototype,"draggable",void 0),lt([p()],se.prototype,"dragBounds",void 0),lt([p(!1)],se.prototype,"editable",void 0),lt([B(!0)],se.prototype,"hittable",void 0),lt([B("path")],se.prototype,"hitFill",void 0),lt([A("path")],se.prototype,"hitStroke",void 0),lt([B(!1)],se.prototype,"hitBox",void 0),lt([B(!0)],se.prototype,"hitChildren",void 0),lt([B(!0)],se.prototype,"hitSelf",void 0),lt([B()],se.prototype,"hitRadius",void 0),lt([C("")],se.prototype,"cursor",void 0),lt([l()],se.prototype,"fill",void 0),lt([A(void 0,!0)],se.prototype,"stroke",void 0),lt([A("inside")],se.prototype,"strokeAlign",void 0),lt([A(1,!0)],se.prototype,"strokeWidth",void 0),lt([A(!1)],se.prototype,"strokeWidthFixed",void 0),lt([A("none")],se.prototype,"strokeCap",void 0),lt([A("miter")],se.prototype,"strokeJoin",void 0),lt([A()],se.prototype,"dashPattern",void 0),lt([A(0)],se.prototype,"dashOffset",void 0),lt([A(10)],se.prototype,"miterLimit",void 0),lt([b(0)],se.prototype,"cornerRadius",void 0),lt([b()],se.prototype,"cornerSmoothing",void 0),lt([ut()],se.prototype,"shadow",void 0),lt([ut()],se.prototype,"innerShadow",void 0),lt([ut()],se.prototype,"blur",void 0),lt([ut()],se.prototype,"backgroundBlur",void 0),lt([ut()],se.prototype,"grayscale",void 0),lt([ut()],se.prototype,"filter",void 0),lt([l()],se.prototype,"placeholderColor",void 0),lt([p(100)],se.prototype,"placeholderDelay",void 0),lt([p({})],se.prototype,"data",void 0),lt([P(F.prototype.reset)],se.prototype,"reset",null),se=ie=lt([E(Kt),E(Zt),I()],se);let oe=class extends se{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach((t=>this.add(t))),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return e.children=this.children.map((e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var re;lt([d(zt)],oe.prototype,"__",void 0),lt([w(0)],oe.prototype,"width",void 0),lt([w(0)],oe.prototype,"height",void 0),oe=lt([E(M),L()],oe);const ae=a.get("Leafer");let ne=re=class extends oe{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&N.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||V()}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),re.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,r.assign(s,t));const o=this.canvas=j.canvas(s);this.__controllers.push(this.renderer=j.renderer(this,o,s),this.watcher=j.watcher(this,s),this.layouter=j.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=j.selector(this),this.interaction=j.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=j.hitCanvasManager()),this.canvasManager=new Y,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),U.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(X.RESTART):this.emitLeafer(X.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(X.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=r.copyAttrs({},t,_);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new H(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=r.copyAttrs({},this.canvas,_);e.resize(t),this.updateLazyBounds(),this.__onResize(new q(t,i))}__onResize(t){this.emitEvent(t),r.copyAttrs(this.__,t,_),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new G(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(_.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout((()=>this.parent&&this.parent.__updateSortChildren())))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&_.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=r.copyAttrs({},this.canvas,_);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(X.BEFORE_READY),this.emitLeafer(X.READY),this.emitLeafer(X.AFTER_READY),U.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(X.VIEW_READY),U.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:r}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(o=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:o,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){U.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender((()=>{this.imageReady&&(t&&this.emitLeafer(X.VIEW_COMPLETED),U.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,o){return s.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new X(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once([[X.START,()=>J.end(t)],[$.START,this.updateLazyBounds,this],[K.START,this.__onCreated,this],[K.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Q.DATA,this.__onWatchData,this],[$.END,this.__onLayoutEnd,this],[K.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){re.list.remove(this);try{this.stop(),this.emitLeafer(X.END),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{Z.clearRecycled()}),100)}catch(t){ae.error(t)}}};t?e():setTimeout(e)}};ne.list=new O,lt([d(Mt)],ne.prototype,"__",void 0),lt([w()],ne.prototype,"pixelRatio",void 0),ne=re=lt([L()],ne);let _e=class extends se{get __tag(){return"Rect"}constructor(t){super(t)}};lt([d(Vt)],_e.prototype,"__",void 0),_e=lt([E(ee),I(),L()],_e);const{copy:he,add:de,includes:pe}=tt,le=_e.prototype,ue=oe.prototype,ce={};let ye=class extends oe{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;const{renderBounds:e}=this.__layout;this.children.length?(super.__updateRenderBounds(),he(ce,e),this.__updateRectRenderBounds(),t=!pe(e,ce),t&&"hide"!==this.__.overflow&&de(e,ce)):this.__updateRectRenderBounds(),r.stintSet(this,"isOverflow",t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__useStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};lt([d(Lt)],ye.prototype,"__",void 0),lt([w(100)],ye.prototype,"width",void 0),lt([w(100)],ye.prototype,"height",void 0),lt([p(!1)],ye.prototype,"resizeChildren",void 0),lt([et("show")],ye.prototype,"overflow",void 0),lt([P(le.__updateStrokeSpread)],ye.prototype,"__updateStrokeSpread",null),lt([P(le.__updateRenderSpread)],ye.prototype,"__updateRectRenderSpread",null),lt([P(le.__updateBoxBounds)],ye.prototype,"__updateRectBoxBounds",null),lt([P(le.__updateStrokeBounds)],ye.prototype,"__updateStrokeBounds",null),lt([P(le.__updateRenderBounds)],ye.prototype,"__updateRectRenderBounds",null),lt([P(le.__updateChange)],ye.prototype,"__updateRectChange",null),lt([P(le.__render)],ye.prototype,"__renderRect",null),lt([P(ue.__render)],ye.prototype,"__renderGroup",null),ye=lt([I(),L()],ye);let ge=class extends ye{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};lt([d(Ot)],ge.prototype,"__",void 0),lt([l("#FFFFFF")],ge.prototype,"fill",void 0),lt([et("hide")],ge.prototype,"overflow",void 0),ge=lt([L()],ge);const{moveTo:ve,closePath:fe,ellipse:we}=it;let xe=class extends se{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];i?(s||o?(i<1&&we(n,r,a,r*i,a*i,0,s,o,!1),we(n,r,a,r,a,0,o,s,!0),i<1&&fe(n)):(i<1&&(we(n,r,a,r*i,a*i),ve(n,t,a)),we(n,r,a,r,a,0,360,0,!0)),st.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(ve(n,r,a),we(n,r,a,r,a,0,s,o,!1),fe(n)):we(n,r,a,r,a)}};lt([d(jt)],xe.prototype,"__",void 0),lt([b(0)],xe.prototype,"innerRadius",void 0),lt([b(0)],xe.prototype,"startAngle",void 0),lt([b(0)],xe.prototype,"endAngle",void 0),xe=lt([L()],xe);const{moveTo:me,lineTo:Se,drawPoints:Re}=it,{rotate:ke,getAngle:be,getDistance:Be,defaultPoint:Ae}=ot,{toBounds:Ce}=rt;let Pe=class extends se{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=nt();return t&&(i.x=t),e&&ke(i,e),i}set toPoint(t){this.width=Be(Ae,t),this.rotation=be(Ae,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Re(e,t.points,!1,t.closed):(me(e,0,0),Se(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Re(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&wt.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Ce(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};lt([d(Nt)],Pe.prototype,"__",void 0),lt([at("center")],Pe.prototype,"strokeAlign",void 0),lt([w(0)],Pe.prototype,"height",void 0),lt([b()],Pe.prototype,"points",void 0),lt([b(0)],Pe.prototype,"curve",void 0),lt([b(!1)],Pe.prototype,"closed",void 0),Pe=lt([L()],Pe);const{sin:Fe,cos:Ee,PI:Ie}=Math,{moveTo:We,lineTo:Te,closePath:De,drawPoints:ze}=it,Le=Pe.prototype;let Me=class extends se{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)ze(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,r=i/2;We(t,o,0);for(let e=1;e<s;e++)Te(t,o+o*Fe(2*e*Ie/s),r-r*Ee(2*e*Ie/s));De(t)}}__updateRenderPath(){}__updateBoxBounds(){}};lt([d(Yt)],Me.prototype,"__",void 0),lt([b(3)],Me.prototype,"sides",void 0),lt([b()],Me.prototype,"points",void 0),lt([b(0)],Me.prototype,"curve",void 0),lt([P(Le.__updateRenderPath)],Me.prototype,"__updateRenderPath",null),lt([P(Le.__updateBoxBounds)],Me.prototype,"__updateBoxBounds",null),Me=lt([I(),L()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:je,lineTo:Ye,closePath:Ue}=it;let Xe=class extends se{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];je(a,o,0);for(let t=1;t<2*i;t++)Ye(a,o+(t%2==0?o:o*s)*Oe(t*Ve/i),r-(t%2==0?r:r*s)*Ne(t*Ve/i));Ue(a)}};lt([d(Ut)],Xe.prototype,"__",void 0),lt([b(5)],Xe.prototype,"corners",void 0),lt([b(.382)],Xe.prototype,"innerRadius",void 0),Xe=lt([L()],Xe);let He=class extends _e{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return t instanceof Array&&t[0].image}constructor(t){super(t)}};lt([d(Jt)],He.prototype,"__",void 0),lt([w("")],He.prototype,"url",void 0),He=lt([L()],He);const qe=He;let Ge=class extends _e{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=j.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new _t({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ht(ht.LOADED,{image:t}))}))}draw(t,e,i,s){const o=new dt(t.worldTransform).invert(),r=new dt;e&&r.translate(e.x,e.y),i&&("number"==typeof i?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};lt([d($t)],Ge.prototype,"__",void 0),lt([ct(100)],Ge.prototype,"width",void 0),lt([ct(100)],Ge.prototype,"height",void 0),lt([ct(1)],Ge.prototype,"pixelRatio",void 0),lt([ct(!0)],Ge.prototype,"smooth",void 0),lt([p(!1)],Ge.prototype,"safeResize",void 0),lt([ct()],Ge.prototype,"contextSettings",void 0),Ge=lt([L()],Ge);const{copyAndSpread:Je,includes:$e,spread:Ke,setList:Qe}=tt;let Ze=class extends se{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h}=t;t.__lineHeight=ft.number(e,o),t.__letterSpacing=ft.number(i,o),t.__padding=h?W.fourNumber(h):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o}px ${s}`,t.__clipText="show"!==_&&!t.__autoSize,t.__textDrawData=gt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:a,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&Ke(_,i/2),a||n){if(h.x=a?_.x:0,h.y=n?_.y:0,h.width=a?_.width:t.width,h.height=n?_.height:t.height,o){const[e,i,s,o]=t.__padding;a&&(h.x-=o,h.width+=i+o),n&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),r.stintSet(this,"isOverflow",!$e(h,_)),this.isOverflow?(Qe(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Je(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};lt([d(Gt)],Ze.prototype,"__",void 0),lt([w(0)],Ze.prototype,"width",void 0),lt([w(0)],Ze.prototype,"height",void 0),lt([l()],Ze.prototype,"boxStyle",void 0),lt([p(!1)],Ze.prototype,"resizeFontSize",void 0),lt([l("#000000")],Ze.prototype,"fill",void 0),lt([at("outside")],Ze.prototype,"strokeAlign",void 0),lt([B("all")],Ze.prototype,"hitFill",void 0),lt([w("")],Ze.prototype,"text",void 0),lt([w("")],Ze.prototype,"placeholder",void 0),lt([w("caption")],Ze.prototype,"fontFamily",void 0),lt([w(12)],Ze.prototype,"fontSize",void 0),lt([w("normal")],Ze.prototype,"fontWeight",void 0),lt([w(!1)],Ze.prototype,"italic",void 0),lt([w("none")],Ze.prototype,"textCase",void 0),lt([w("none")],Ze.prototype,"textDecoration",void 0),lt([w(0)],Ze.prototype,"letterSpacing",void 0),lt([w({type:"percent",value:1.5})],Ze.prototype,"lineHeight",void 0),lt([w(0)],Ze.prototype,"paraIndent",void 0),lt([w(0)],Ze.prototype,"paraSpacing",void 0),lt([w("x")],Ze.prototype,"writingMode",void 0),lt([w("left")],Ze.prototype,"textAlign",void 0),lt([w("top")],Ze.prototype,"verticalAlign",void 0),lt([w(!0)],Ze.prototype,"autoSizeAlign",void 0),lt([w("normal")],Ze.prototype,"textWrap",void 0),lt([w("show")],Ze.prototype,"textOverflow",void 0),lt([l(!1)],Ze.prototype,"textEditing",void 0),Ze=lt([L()],Ze);let ti=class extends se{get __tag(){return"Path"}constructor(t){super(t)}};lt([d(Xt)],ti.prototype,"__",void 0),lt([at("center")],ti.prototype,"strokeAlign",void 0),ti=lt([L()],ti);let ei=class extends oe{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new ti(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};lt([d(Ht)],ei.prototype,"__",void 0),lt([(e,i)=>{t(e,i,{get(){return this.__path}})}],ei.prototype,"path",void 0),ei=lt([E(pt,["set","path","paint"]),L()],ei);export{ye as Box,Lt as BoxData,Ge as Canvas,$t as CanvasData,vt as ColorConvert,Rt as Effect,xe as Ellipse,jt as EllipseData,bt as Export,kt as Filter,ge as Frame,Ot as FrameData,oe as Group,zt as GroupData,He as Image,Jt as ImageData,ne as Leafer,Mt as LeaferData,Pe as Line,Nt as LineData,qe as MyImage,xt as Paint,St as PaintGradient,mt as PaintImage,ti as Path,wt as PathArrow,Xt as PathData,ei as Pen,Ht as PenData,Me as Polygon,Yt as PolygonData,_e as Rect,Vt as RectData,ee as RectRender,Xe as Star,Ut as StarData,Bt as State,Ze as Text,gt as TextConvert,Gt as TextData,At as Transition,se as UI,Kt as UIBounds,Tt as UIData,Zt as UIRender,ft as UnitConvert,ut as effectType,ct as resizeType,yt as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=draw.esm.min.js.map
|