@leafer-ui/draw 2.0.1 → 2.0.3

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 CHANGED
@@ -18,7 +18,9 @@ function effectType(defaultValue) {
18
18
  set(value) {
19
19
  this.__setAttr(key, value);
20
20
  if (value) this.__.__useEffect = true;
21
- this.__layout.renderChanged || this.__layout.renderChange();
21
+ const layout = this.__layout;
22
+ layout.renderChanged || layout.renderChange();
23
+ layout.surfaceChange();
22
24
  }
23
25
  }));
24
26
  }
@@ -232,15 +234,16 @@ class UIData extends core.LeafData {
232
234
  this.__needComputePaint = undefined;
233
235
  }
234
236
  __getRealStrokeWidth(childStyle) {
235
- let {strokeWidth: strokeWidth, strokeWidthFixed: strokeWidthFixed} = this;
237
+ let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
236
238
  if (childStyle) {
237
239
  if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
238
- if (!core.isUndefined(childStyle.strokeWidthFixed)) strokeWidthFixed = childStyle.strokeWidthFixed;
240
+ if (!core.isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
239
241
  }
240
- if (strokeWidthFixed) {
241
- const scale = this.__leaf.getClampRenderScale();
242
- return scale > 1 ? strokeWidth / scale : strokeWidth;
243
- } else return strokeWidth;
242
+ if (strokeScaleFixed) {
243
+ const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
244
+ if (scaleX !== 1) return strokeWidth * scaleX;
245
+ }
246
+ return strokeWidth;
244
247
  }
245
248
  __setPaint(attrName, value) {
246
249
  this.__setInput(attrName, value);
@@ -378,13 +381,16 @@ class TextData extends UIData {
378
381
  }
379
382
 
380
383
  class ImageData extends RectData {
384
+ get __urlType() {
385
+ return "image";
386
+ }
381
387
  setUrl(value) {
382
388
  this.__setImageFill(value);
383
389
  this._url = value;
384
390
  }
385
391
  __setImageFill(value) {
386
392
  this.fill = value ? {
387
- type: "image",
393
+ type: this.__urlType,
388
394
  mode: "stretch",
389
395
  url: value
390
396
  } : undefined;
@@ -423,7 +429,7 @@ const UIBounds = {
423
429
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
424
430
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
425
431
  boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
426
- if (!data.__boxStroke) {
432
+ if (!data.__boxStroke || data.__useArrow) {
427
433
  const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
428
434
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
429
435
  spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
@@ -580,6 +586,12 @@ exports.UI = UI_1 = class UI extends core.Leaf {
580
586
  get isFrame() {
581
587
  return false;
582
588
  }
589
+ set strokeWidthFixed(value) {
590
+ this.strokeScaleFixed = value;
591
+ }
592
+ get strokeWidthFixed() {
593
+ return this.strokeScaleFixed;
594
+ }
583
595
  set scale(value) {
584
596
  core.MathHelper.assignScale(this, value);
585
597
  }
@@ -635,6 +647,9 @@ exports.UI = UI_1 = class UI extends core.Leaf {
635
647
  getPathString(curve, pathForRender, floatLength) {
636
648
  return core.PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
637
649
  }
650
+ asPath(curve, pathForRender) {
651
+ this.path = this.getPath(curve, pathForRender);
652
+ }
638
653
  load() {
639
654
  this.__.__computePaint();
640
655
  }
@@ -644,16 +659,18 @@ exports.UI = UI_1 = class UI extends core.Leaf {
644
659
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
645
660
  }
646
661
  }
647
- __updateRenderPath() {
662
+ __updateRenderPath(updateCache) {
648
663
  const data = this.__;
649
664
  if (data.path) {
650
665
  data.__pathForRender = data.cornerRadius ? core.PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
651
- if (data.__useArrow) PathArrow.addArrows(this);
666
+ if (data.__useArrow) PathArrow.addArrows(this, updateCache);
652
667
  } else data.__pathForRender && (data.__pathForRender = undefined);
653
668
  }
654
669
  __drawRenderPath(canvas) {
670
+ const data = this.__;
655
671
  canvas.beginPath();
656
- this.__drawPathByData(canvas, this.__.__pathForRender);
672
+ if (data.__useArrow) PathArrow.updateArrow(this);
673
+ this.__drawPathByData(canvas, data.__pathForRender);
657
674
  }
658
675
  __drawPath(canvas) {
659
676
  canvas.beginPath();
@@ -702,6 +719,7 @@ exports.UI = UI_1 = class UI extends core.Leaf {
702
719
  static setEditOuter(_toolName) {}
703
720
  static setEditInner(_editorName) {}
704
721
  destroy() {
722
+ this.__.__willDestroy = true;
705
723
  this.fill = this.stroke = null;
706
724
  if (this.__animate) this.killAnimate();
707
725
  super.destroy();
@@ -818,7 +836,7 @@ __decorate([ core.strokeType("inside") ], exports.UI.prototype, "strokeAlign", v
818
836
 
819
837
  __decorate([ core.strokeType(1, true) ], exports.UI.prototype, "strokeWidth", void 0);
820
838
 
821
- __decorate([ core.strokeType(false) ], exports.UI.prototype, "strokeWidthFixed", void 0);
839
+ __decorate([ core.strokeType(false) ], exports.UI.prototype, "strokeScaleFixed", void 0);
822
840
 
823
841
  __decorate([ core.strokeType("none") ], exports.UI.prototype, "strokeCap", void 0);
824
842
 
@@ -884,7 +902,10 @@ exports.Group = class Group extends exports.UI {
884
902
  }
885
903
  toJSON(options) {
886
904
  const data = super.toJSON(options);
887
- if (!this.childlessJSON) data.children = this.children.map(child => child.toJSON(options));
905
+ if (!this.childlessJSON) {
906
+ const children = data.children = [];
907
+ this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
908
+ }
888
909
  return data;
889
910
  }
890
911
  pick(_hitPoint, _options) {
@@ -1033,12 +1054,12 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
1033
1054
  this.emitLeafer(core.LeaferEvent.STOP);
1034
1055
  }
1035
1056
  }
1036
- unlockLayout() {
1057
+ unlockLayout(updateLayout = true) {
1037
1058
  this.layouter.start();
1038
- this.updateLayout();
1059
+ if (updateLayout) this.updateLayout();
1039
1060
  }
1040
- lockLayout() {
1041
- this.updateLayout();
1061
+ lockLayout(updateLayout = true) {
1062
+ if (updateLayout) this.updateLayout();
1042
1063
  this.layouter.stop();
1043
1064
  }
1044
1065
  resize(size) {
@@ -1447,9 +1468,9 @@ exports.Ellipse = class Ellipse extends exports.UI {
1447
1468
  return "Ellipse";
1448
1469
  }
1449
1470
  __updatePath() {
1450
- const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
1471
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
1451
1472
  const rx = width / 2, ry = height / 2;
1452
- const path = this.__.path = [];
1473
+ const path = data.path = [];
1453
1474
  let open;
1454
1475
  if (innerRadius) {
1455
1476
  if (startAngle || endAngle) {
@@ -1471,7 +1492,7 @@ exports.Ellipse = class Ellipse extends exports.UI {
1471
1492
  }
1472
1493
  }
1473
1494
  if (!open) closePath$2(path);
1474
- if (core.Platform.ellipseToCurve) this.__.path = this.getPath(true);
1495
+ if (core.Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
1475
1496
  }
1476
1497
  };
1477
1498
 
package/lib/draw.esm.js CHANGED
@@ -18,7 +18,9 @@ function effectType(defaultValue) {
18
18
  set(value) {
19
19
  this.__setAttr(key, value);
20
20
  if (value) this.__.__useEffect = true;
21
- this.__layout.renderChanged || this.__layout.renderChange();
21
+ const layout = this.__layout;
22
+ layout.renderChanged || layout.renderChange();
23
+ layout.surfaceChange();
22
24
  }
23
25
  }));
24
26
  }
@@ -232,15 +234,16 @@ class UIData extends LeafData {
232
234
  this.__needComputePaint = undefined;
233
235
  }
234
236
  __getRealStrokeWidth(childStyle) {
235
- let {strokeWidth: strokeWidth, strokeWidthFixed: strokeWidthFixed} = this;
237
+ let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
236
238
  if (childStyle) {
237
239
  if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
238
- if (!isUndefined(childStyle.strokeWidthFixed)) strokeWidthFixed = childStyle.strokeWidthFixed;
240
+ if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
239
241
  }
240
- if (strokeWidthFixed) {
241
- const scale = this.__leaf.getClampRenderScale();
242
- return scale > 1 ? strokeWidth / scale : strokeWidth;
243
- } else return strokeWidth;
242
+ if (strokeScaleFixed) {
243
+ const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
244
+ if (scaleX !== 1) return strokeWidth * scaleX;
245
+ }
246
+ return strokeWidth;
244
247
  }
245
248
  __setPaint(attrName, value) {
246
249
  this.__setInput(attrName, value);
@@ -378,13 +381,16 @@ class TextData extends UIData {
378
381
  }
379
382
 
380
383
  class ImageData extends RectData {
384
+ get __urlType() {
385
+ return "image";
386
+ }
381
387
  setUrl(value) {
382
388
  this.__setImageFill(value);
383
389
  this._url = value;
384
390
  }
385
391
  __setImageFill(value) {
386
392
  this.fill = value ? {
387
- type: "image",
393
+ type: this.__urlType,
388
394
  mode: "stretch",
389
395
  url: value
390
396
  } : undefined;
@@ -423,7 +429,7 @@ const UIBounds = {
423
429
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
424
430
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
425
431
  boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
426
- if (!data.__boxStroke) {
432
+ if (!data.__boxStroke || data.__useArrow) {
427
433
  const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
428
434
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
429
435
  spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
@@ -580,6 +586,12 @@ let UI = UI_1 = class UI extends Leaf {
580
586
  get isFrame() {
581
587
  return false;
582
588
  }
589
+ set strokeWidthFixed(value) {
590
+ this.strokeScaleFixed = value;
591
+ }
592
+ get strokeWidthFixed() {
593
+ return this.strokeScaleFixed;
594
+ }
583
595
  set scale(value) {
584
596
  MathHelper.assignScale(this, value);
585
597
  }
@@ -635,6 +647,9 @@ let UI = UI_1 = class UI extends Leaf {
635
647
  getPathString(curve, pathForRender, floatLength) {
636
648
  return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
637
649
  }
650
+ asPath(curve, pathForRender) {
651
+ this.path = this.getPath(curve, pathForRender);
652
+ }
638
653
  load() {
639
654
  this.__.__computePaint();
640
655
  }
@@ -644,16 +659,18 @@ let UI = UI_1 = class UI extends Leaf {
644
659
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
645
660
  }
646
661
  }
647
- __updateRenderPath() {
662
+ __updateRenderPath(updateCache) {
648
663
  const data = this.__;
649
664
  if (data.path) {
650
665
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
651
- if (data.__useArrow) PathArrow.addArrows(this);
666
+ if (data.__useArrow) PathArrow.addArrows(this, updateCache);
652
667
  } else data.__pathForRender && (data.__pathForRender = undefined);
653
668
  }
654
669
  __drawRenderPath(canvas) {
670
+ const data = this.__;
655
671
  canvas.beginPath();
656
- this.__drawPathByData(canvas, this.__.__pathForRender);
672
+ if (data.__useArrow) PathArrow.updateArrow(this);
673
+ this.__drawPathByData(canvas, data.__pathForRender);
657
674
  }
658
675
  __drawPath(canvas) {
659
676
  canvas.beginPath();
@@ -702,6 +719,7 @@ let UI = UI_1 = class UI extends Leaf {
702
719
  static setEditOuter(_toolName) {}
703
720
  static setEditInner(_editorName) {}
704
721
  destroy() {
722
+ this.__.__willDestroy = true;
705
723
  this.fill = this.stroke = null;
706
724
  if (this.__animate) this.killAnimate();
707
725
  super.destroy();
@@ -818,7 +836,7 @@ __decorate([ strokeType("inside") ], UI.prototype, "strokeAlign", void 0);
818
836
 
819
837
  __decorate([ strokeType(1, true) ], UI.prototype, "strokeWidth", void 0);
820
838
 
821
- __decorate([ strokeType(false) ], UI.prototype, "strokeWidthFixed", void 0);
839
+ __decorate([ strokeType(false) ], UI.prototype, "strokeScaleFixed", void 0);
822
840
 
823
841
  __decorate([ strokeType("none") ], UI.prototype, "strokeCap", void 0);
824
842
 
@@ -884,7 +902,10 @@ let Group = class Group extends UI {
884
902
  }
885
903
  toJSON(options) {
886
904
  const data = super.toJSON(options);
887
- if (!this.childlessJSON) data.children = this.children.map(child => child.toJSON(options));
905
+ if (!this.childlessJSON) {
906
+ const children = data.children = [];
907
+ this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
908
+ }
888
909
  return data;
889
910
  }
890
911
  pick(_hitPoint, _options) {
@@ -1033,12 +1054,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
1033
1054
  this.emitLeafer(LeaferEvent.STOP);
1034
1055
  }
1035
1056
  }
1036
- unlockLayout() {
1057
+ unlockLayout(updateLayout = true) {
1037
1058
  this.layouter.start();
1038
- this.updateLayout();
1059
+ if (updateLayout) this.updateLayout();
1039
1060
  }
1040
- lockLayout() {
1041
- this.updateLayout();
1061
+ lockLayout(updateLayout = true) {
1062
+ if (updateLayout) this.updateLayout();
1042
1063
  this.layouter.stop();
1043
1064
  }
1044
1065
  resize(size) {
@@ -1447,9 +1468,9 @@ let Ellipse = class Ellipse extends UI {
1447
1468
  return "Ellipse";
1448
1469
  }
1449
1470
  __updatePath() {
1450
- const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
1471
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
1451
1472
  const rx = width / 2, ry = height / 2;
1452
- const path = this.__.path = [];
1473
+ const path = data.path = [];
1453
1474
  let open;
1454
1475
  if (innerRadius) {
1455
1476
  if (startAngle || endAngle) {
@@ -1471,7 +1492,7 @@ let Ellipse = class Ellipse extends UI {
1471
1492
  }
1472
1493
  }
1473
1494
  if (!open) closePath$2(path);
1474
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
1495
+ if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
1475
1496
  }
1476
1497
  };
1477
1498
 
@@ -1,2 +1,2 @@
1
- import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,UnitConvertHelper as r,PathConvert as a,DataHelper as n,Debug as _,LeafData as h,isString as d,isObject as l,isUndefined as p,isArray as u,canvasSizeAttrs as c,UICreator as g,FourNumberHelper as y,dataProcessor as v,dataType as f,surfaceType as w,opacityType as x,visibleType as S,dimType as m,sortType as R,maskType as k,eraserType as B,positionType as A,boundsType as C,scaleType as b,rotationType as P,scrollType as F,autoLayoutType as W,naturalBoundsType as E,affectRenderBoundsType as D,pathInputType as I,pathType as T,hitType as L,strokeType as z,cursorType as M,rewrite as O,Leaf as N,useModule as V,rewriteAble as H,MathHelper as Y,pen as U,PathCorner as X,PathDrawer as j,isNumber as J,registerUI as q,Branch as G,LeafList as $,Resource as K,getBoundsData as Q,Creator as Z,CanvasManager as tt,WaitHelper as et,LeaferEvent as it,Bounds as st,ResizeEvent as ot,AutoBounds as rt,Run as at,LayoutEvent as nt,RenderEvent as _t,WatchEvent as ht,ImageManager as dt,BoundsHelper as lt,PathCommandDataHelper as pt,Platform as ut,PointHelper as ct,affectStrokeBoundsType as gt,getPointData as yt,LeaferImage as vt,ImageEvent as ft,Matrix as wt,PathCreator as xt}from"@leafer/core";export*from"@leafer/core";function St(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 mt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Rt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function kt(){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 Bt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const At={},Ct={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}},bt=r,Pt={},Ft={},Wt={},Et={},Dt={},It={apply(){o.need("filter")}},Tt={},Lt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},zt={list:{},register(t,e){zt.list[t]=e},get:t=>zt.list[t]},{parse:Mt,objectToCanvasData:Ot}=a,{stintSet:Nt}=n,{hasTransparent:Vt}=Ct,Ht={originPaint:{}},Yt=_.get("UIData");class Ut extends h{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,Yt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Yt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Nt(this,"__isTransparentFill",Vt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):l(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Nt(this,"__isTransparentStroke",Vt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):l(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&l(t[0])?(this.__setInput("path",t),this._path=e?Mt(t):Ot(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Xt(this,"shadow",t)}setInnerShadow(t){Xt(this,"innerShadow",t)}setFilter(t){Xt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ft.compute("fill",this.__leaf),e&&Ft.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),p(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Ht)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ht))}__removePaint(t,e){e&&this.__removeInput(t),Wt.recycleImage(t,this),"fill"===t?(Nt(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Nt(this,"__isAlphaPixelStroke",void 0),Nt(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Xt(t,e,i){t.__setInput(e,i),u(i)?(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 jt extends Ut{}class Jt extends jt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class qt extends jt{__getInputData(t,e){const i=super.__getInputData(t,e);return c.forEach(t=>delete i[t]),i}}class Gt extends Jt{}class $t extends Ut{get __usePathBox(){return this.points||this.__pathInputed}}class Kt extends Ut{get __boxStroke(){return!this.__pathInputed}}class Qt extends Ut{get __boxStroke(){return!this.__pathInputed}}class Zt extends $t{}class te extends Ut{}class ee extends Ut{get __pathInputed(){return 2}}class ie extends jt{}const se={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class oe extends Ut{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=se[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=g.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()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class re extends Kt{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 t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class ae extends Kt{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{max:ne,add:_e}=y,he={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth: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=ne(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__,{strokeSpread:n}=this.__layout,_=this.__box;e&&(t=Dt.getShadowRenderSpread(this,e)),s&&(t=ne(t,s)),r&&(t=_e(t,It.getSpread(r))),a&&(t=_e(t,a)),n&&(t=_e(t,n));let h=t;return i&&(h=ne(h,Dt.getInnerShadowSpread(this,i))),o&&(h=ne(h,o)),this.__layout.renderShapeSpread=h,_?ne(_.__updateRenderSpread(),t):t}},{stintSet:de}=n,le={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);de(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),de(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;de(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Dt.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),de(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){pe(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 _=Ft.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Dt.shadow(this,t,_),n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e)),o&&(s.__isFills?Ft.fills(o,this,t,e):Ft.fill(o,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Dt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e)),l&&It.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Ct.string(e.color))}o&&(s.__isFills?Ft.fills(o,this,t,e):Ft.fill(o,this,t,e)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e))}}else s.__pathForRender?pe(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?Ft.fills(s,this,t,e):Ft.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ft.strokes(o,this,t,e):Ft.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function pe(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Ft.stroke(o,t,e,i),s&&Ft.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),o&&!a&&Ft.stroke(o,t,e,i)}const ue={__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 ce;let ge=ce=class extends N{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){Y.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return U.set(this.path=t||[]),t||this.__drawPathByBox(U),U}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return o.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return o.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(U.set(i=[]),this.__drawPathByBox(U,!e)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Tt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?X.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Pt.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?j.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,o,r,J(e)?[e]:e)}else t.rect(i,s,o,r);t.closePath()}drawImagePlaceholder(t,e,i){Ft.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),o.need("animate")}killAnimate(t,e){}export(t,e){return o.need("export")}syncExport(t,e){return o.need("export")}clone(t){const e=n.clone(this.toJSON());return t&&Object.assign(e,t),ce.one(e)}static one(t,e,i,s,o){return g.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){q()(this)}static registerData(t){v(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};St([v(Ut)],ge.prototype,"__",void 0),St([kt()],ge.prototype,"zoomLayer",void 0),St([f("")],ge.prototype,"id",void 0),St([f("")],ge.prototype,"name",void 0),St([f("")],ge.prototype,"className",void 0),St([w("pass-through")],ge.prototype,"blendMode",void 0),St([x(1)],ge.prototype,"opacity",void 0),St([S(!0)],ge.prototype,"visible",void 0),St([w(!1)],ge.prototype,"locked",void 0),St([m(!1)],ge.prototype,"dim",void 0),St([m(!1)],ge.prototype,"dimskip",void 0),St([R(0)],ge.prototype,"zIndex",void 0),St([k(!1)],ge.prototype,"mask",void 0),St([B(!1)],ge.prototype,"eraser",void 0),St([A(0,!0)],ge.prototype,"x",void 0),St([A(0,!0)],ge.prototype,"y",void 0),St([C(100,!0)],ge.prototype,"width",void 0),St([C(100,!0)],ge.prototype,"height",void 0),St([b(1,!0)],ge.prototype,"scaleX",void 0),St([b(1,!0)],ge.prototype,"scaleY",void 0),St([P(0,!0)],ge.prototype,"rotation",void 0),St([P(0,!0)],ge.prototype,"skewX",void 0),St([P(0,!0)],ge.prototype,"skewY",void 0),St([A(0,!0)],ge.prototype,"offsetX",void 0),St([A(0,!0)],ge.prototype,"offsetY",void 0),St([F(0,!0)],ge.prototype,"scrollX",void 0),St([F(0,!0)],ge.prototype,"scrollY",void 0),St([W()],ge.prototype,"origin",void 0),St([W()],ge.prototype,"around",void 0),St([f(!1)],ge.prototype,"lazy",void 0),St([E(1)],ge.prototype,"pixelRatio",void 0),St([D(0)],ge.prototype,"renderSpread",void 0),St([I()],ge.prototype,"path",void 0),St([T()],ge.prototype,"windingRule",void 0),St([T(!0)],ge.prototype,"closed",void 0),St([C(0)],ge.prototype,"padding",void 0),St([C(!1)],ge.prototype,"lockRatio",void 0),St([C()],ge.prototype,"widthRange",void 0),St([C()],ge.prototype,"heightRange",void 0),St([f(!1)],ge.prototype,"draggable",void 0),St([f()],ge.prototype,"dragBounds",void 0),St([f("auto")],ge.prototype,"dragBoundsType",void 0),St([f(!1)],ge.prototype,"editable",void 0),St([L(!0)],ge.prototype,"hittable",void 0),St([L("path")],ge.prototype,"hitFill",void 0),St([z("path")],ge.prototype,"hitStroke",void 0),St([L(!1)],ge.prototype,"hitBox",void 0),St([L(!0)],ge.prototype,"hitChildren",void 0),St([L(!0)],ge.prototype,"hitSelf",void 0),St([L()],ge.prototype,"hitRadius",void 0),St([M("")],ge.prototype,"cursor",void 0),St([w()],ge.prototype,"fill",void 0),St([z(void 0,!0)],ge.prototype,"stroke",void 0),St([z("inside")],ge.prototype,"strokeAlign",void 0),St([z(1,!0)],ge.prototype,"strokeWidth",void 0),St([z(!1)],ge.prototype,"strokeWidthFixed",void 0),St([z("none")],ge.prototype,"strokeCap",void 0),St([z("miter")],ge.prototype,"strokeJoin",void 0),St([z()],ge.prototype,"dashPattern",void 0),St([z(0)],ge.prototype,"dashOffset",void 0),St([z(10)],ge.prototype,"miterLimit",void 0),St([T(0)],ge.prototype,"cornerRadius",void 0),St([T()],ge.prototype,"cornerSmoothing",void 0),St([mt()],ge.prototype,"shadow",void 0),St([mt()],ge.prototype,"innerShadow",void 0),St([mt()],ge.prototype,"blur",void 0),St([mt()],ge.prototype,"backgroundBlur",void 0),St([mt()],ge.prototype,"grayscale",void 0),St([mt()],ge.prototype,"filter",void 0),St([w()],ge.prototype,"placeholderColor",void 0),St([f(100)],ge.prototype,"placeholderDelay",void 0),St([f({})],ge.prototype,"data",void 0),St([O(N.prototype.reset)],ge.prototype,"reset",null),ge=ce=St([V(he),V(le),H()],ge);let ye=class extends ge{get __tag(){return"Group"}get isBranch(){return!0}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 this.childlessJSON||(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 ve;St([v(jt)],ye.prototype,"__",void 0),St([C(0)],ye.prototype,"width",void 0),St([C(0)],ye.prototype,"height",void 0),ye=St([V(G),q()],ye);const fe=_.get("Leafer");let we=ve=class extends ye{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&K.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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)||Q()}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),ve.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,n.assign(s,t));const o=this.canvas=Z.canvas(s);this.__controllers.push(this.renderer=Z.renderer(this,o,s),this.watcher=Z.watcher(this,s),this.layouter=Z.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=Z.selector(this),this.interaction=Z.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Z.hitCanvasManager()),this.canvasManager=new tt,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))),et.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(it.RESTART):this.emitLeafer(it.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(it.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,c);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new st(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=n.copyAttrs({},this.canvas,c);e.resize(t),this.updateLazyBounds(),this.__onResize(new ot(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,c),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(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new rt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(c.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())):"mode"===t&&this.emit(it.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&c.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,c);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(it.BEFORE_READY),this.emitLeafer(it.READY),this.emitLeafer(it.AFTER_READY),et.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(it.VIEW_READY),et.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){et.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(it.VIEW_COMPLETED),et.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,s){return o.need("view")}getValidMove(t,e,i){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 it(t,this))}__listenEvents(){const t=at.start("FirstCreate "+this.innerName);this.once([[it.START,()=>at.end(t)],[nt.START,this.updateLazyBounds,this],[_t.START,this.__onCreated,this],[_t.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ht.DATA,this.__onWatchData,this],[nt.END,this.__onLayoutEnd,this],[_t.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ve.list.remove(this);try{this.stop(),this.emitLeafer(it.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&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{dt.clearRecycled()},100)}catch(t){fe.error(t)}}};t?e():setTimeout(e)}};we.list=new $,St([v(qt)],we.prototype,"__",void 0),St([C()],we.prototype,"pixelRatio",void 0),St([f("normal")],we.prototype,"mode",void 0),we=ve=St([q()],we);let xe=class extends ge{get __tag(){return"Rect"}};St([v(Kt)],xe.prototype,"__",void 0),xe=St([V(ue),H(),q()],xe);const{add:Se,includes:me,scroll:Re}=lt,ke=xe.prototype,Be=ye.prototype;let Ae=class extends ye{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){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=Q());super.__updateRenderBounds(n),(e=a&&a.includes("scroll"))&&(Se(n,r),Re(n,i)),this.__updateRectRenderBounds(),t=!me(r,n),t&&"show"===a&&Se(o,n)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__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)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};St([v(Jt)],Ae.prototype,"__",void 0),St([C(100)],Ae.prototype,"width",void 0),St([C(100)],Ae.prototype,"height",void 0),St([f(!1)],Ae.prototype,"resizeChildren",void 0),St([D("show")],Ae.prototype,"overflow",void 0),St([O(ke.__updateStrokeSpread)],Ae.prototype,"__updateStrokeSpread",null),St([O(ke.__updateRenderSpread)],Ae.prototype,"__updateRectRenderSpread",null),St([O(ke.__updateBoxBounds)],Ae.prototype,"__updateRectBoxBounds",null),St([O(ke.__updateStrokeBounds)],Ae.prototype,"__updateStrokeBounds",null),St([O(ke.__updateRenderBounds)],Ae.prototype,"__updateRectRenderBounds",null),St([O(ke.__updateChange)],Ae.prototype,"__updateRectChange",null),St([O(ke.__render)],Ae.prototype,"__renderRect",null),St([O(Be.__render)],Ae.prototype,"__renderGroup",null),Ae=St([H(),q()],Ae);let Ce=class extends Ae{get __tag(){return"Frame"}get isFrame(){return!0}};St([v(Gt)],Ce.prototype,"__",void 0),St([w("#FFFFFF")],Ce.prototype,"fill",void 0),St([D("hide")],Ce.prototype,"overflow",void 0),Ce=St([q()],Ce);const{moveTo:be,closePath:Pe,ellipse:Fe}=pt;let We=class extends ge{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];let _;i?s||o?(i<1?Fe(n,r,a,r*i,a*i,0,s,o,!1):_=!0,Fe(n,r,a,r,a,0,o,s,!0)):(i<1&&(Fe(n,r,a,r*i,a*i),be(n,t,a)),Fe(n,r,a,r,a,0,360,0,!0)):s||o?(be(n,r,a),Fe(n,r,a,r,a,0,s,o,!1)):Fe(n,r,a,r,a),_||Pe(n),ut.ellipseToCurve&&(this.__.path=this.getPath(!0))}};St([v(Qt)],We.prototype,"__",void 0),St([T(0)],We.prototype,"innerRadius",void 0),St([T(0)],We.prototype,"startAngle",void 0),St([T(0)],We.prototype,"endAngle",void 0),We=St([q()],We);const{sin:Ee,cos:De,PI:Ie}=Math,{moveTo:Te,lineTo:Le,closePath:ze,drawPoints:Me}=pt;let Oe=class extends ge{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Me(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Te(e,r,0);for(let t=1;t<o;t++)Le(e,r+r*Ee(2*t*Ie/o),a-a*De(2*t*Ie/o));ze(e)}}};St([v(Zt)],Oe.prototype,"__",void 0),St([T(3)],Oe.prototype,"sides",void 0),St([T()],Oe.prototype,"points",void 0),St([T(0)],Oe.prototype,"curve",void 0),Oe=St([H(),q()],Oe);const{sin:Ne,cos:Ve,PI:He}=Math,{moveTo:Ye,lineTo:Ue,closePath:Xe}=pt;let je=class extends ge{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ye(a,o,0);for(let t=1;t<2*i;t++)Ue(a,o+(t%2==0?o:o*s)*Ne(t*He/i),r-(t%2==0?r:r*s)*Ve(t*He/i));Xe(a)}};St([v(te)],je.prototype,"__",void 0),St([T(5)],je.prototype,"corners",void 0),St([T(.382)],je.prototype,"innerRadius",void 0),je=St([q()],je);const{moveTo:Je,lineTo:qe,drawPoints:Ge}=pt,{rotate:$e,getAngle:Ke,getDistance:Qe,defaultPoint:Ze}=ct;let ti=class extends ge{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=yt();return t&&(i.x=t),e&&$e(i,e),i}set toPoint(t){this.width=Qe(Ze,t),this.rotation=Ke(Ze,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ge(e,t.points,t.curve,t.closed):(Je(e,0,0),qe(e,this.width,0))}};St([v($t)],ti.prototype,"__",void 0),St([gt("center")],ti.prototype,"strokeAlign",void 0),St([C(0)],ti.prototype,"height",void 0),St([T()],ti.prototype,"points",void 0),St([T(0)],ti.prototype,"curve",void 0),St([T(!1)],ti.prototype,"closed",void 0),ti=St([q()],ti);let ei=class extends xe{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};St([v(re)],ei.prototype,"__",void 0),St([C("")],ei.prototype,"url",void 0),ei=St([q()],ei);const ii=ei;let si=class extends xe{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Z.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new vt({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ft(ft.LOADED,{image:t}))})}draw(t,e,i,s){const o=new wt(t.worldTransform).invert(),r=new wt;e&&r.translate(e.x,e.y),i&&(J(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()}};St([v(ae)],si.prototype,"__",void 0),St([Rt(100)],si.prototype,"width",void 0),St([Rt(100)],si.prototype,"height",void 0),St([Rt(1)],si.prototype,"pixelRatio",void 0),St([Rt(!0)],si.prototype,"smooth",void 0),St([f(!1)],si.prototype,"safeResize",void 0),St([Rt()],si.prototype,"contextSettings",void 0),si=St([q()],si);const{copyAndSpread:oi,includes:ri,spread:ai,setList:ni}=lt,{stintSet:_i}=n;let hi=class extends ge{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h,width:d,height:l}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o||12}px ${s||"caption"}`,_i(t,"__padding",h&&Y.fourNumber(h)),_i(t,"__clipText","show"!==_&&!t.__autoSize),_i(t,"__isCharMode",d||l||t.__letterSpacing||"none"!==n),t.__textDrawData=At.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:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&ai(_,i/2),r||a){if(h.x=r?_.x:0,h.y=a?_.y:0,h.width=r?_.width:t.width,h.height=a?_.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(h.x-=o,h.width+=i+o),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),n.stintSet(this,"isOverflow",!ri(h,_)),this.isOverflow?(ni(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;oi(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__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()}};St([v(oe)],hi.prototype,"__",void 0),St([C(0)],hi.prototype,"width",void 0),St([C(0)],hi.prototype,"height",void 0),St([w()],hi.prototype,"boxStyle",void 0),St([f(!1)],hi.prototype,"resizeFontSize",void 0),St([w("#000000")],hi.prototype,"fill",void 0),St([gt("outside")],hi.prototype,"strokeAlign",void 0),St([L("all")],hi.prototype,"hitFill",void 0),St([C("")],hi.prototype,"text",void 0),St([C("")],hi.prototype,"placeholder",void 0),St([C("caption")],hi.prototype,"fontFamily",void 0),St([C(12)],hi.prototype,"fontSize",void 0),St([C("normal")],hi.prototype,"fontWeight",void 0),St([C(!1)],hi.prototype,"italic",void 0),St([C("none")],hi.prototype,"textCase",void 0),St([C("none")],hi.prototype,"textDecoration",void 0),St([C(0)],hi.prototype,"letterSpacing",void 0),St([C({type:"percent",value:1.5})],hi.prototype,"lineHeight",void 0),St([C(0)],hi.prototype,"paraIndent",void 0),St([C(0)],hi.prototype,"paraSpacing",void 0),St([C("x")],hi.prototype,"writingMode",void 0),St([C("left")],hi.prototype,"textAlign",void 0),St([C("top")],hi.prototype,"verticalAlign",void 0),St([C(!0)],hi.prototype,"autoSizeAlign",void 0),St([C("normal")],hi.prototype,"textWrap",void 0),St([C("show")],hi.prototype,"textOverflow",void 0),St([w(!1)],hi.prototype,"textEditing",void 0),hi=St([q()],hi);let di=class extends ge{get __tag(){return"Path"}};St([v(ee)],di.prototype,"__",void 0),St([gt("center")],di.prototype,"strokeAlign",void 0),di=St([q()],di);let li=class extends ye{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new di(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")}};St([v(ie)],li.prototype,"__",void 0),St([(e,i)=>{t(e,i,{get(){return this.__path}})}],li.prototype,"path",void 0),li=St([V(xt,["set","path","paint"]),q()],li);export{Ae as Box,Jt as BoxData,si as Canvas,ae as CanvasData,Ct as ColorConvert,Dt as Effect,We as Ellipse,Qt as EllipseData,Tt as Export,It as Filter,Ce as Frame,Gt as FrameData,ye as Group,jt as GroupData,ei as Image,re as ImageData,we as Leafer,qt as LeaferData,ti as Line,$t as LineData,ii as MyImage,Ft as Paint,Et as PaintGradient,Wt as PaintImage,di as Path,Pt as PathArrow,ee as PathData,li as Pen,ie as PenData,Oe as Polygon,Zt as PolygonData,xe as Rect,Kt as RectData,ue as RectRender,je as Star,te as StarData,Lt as State,hi as Text,At as TextConvert,oe as TextData,zt as Transition,ge as UI,he as UIBounds,Ut as UIData,le as UIRender,bt as UnitConvert,Bt as createAttr,mt as effectType,Rt as resizeType,kt as zoomLayerType};
1
+ import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,UnitConvertHelper as r,PathConvert as a,DataHelper as n,Debug as _,LeafData as h,isString as d,isObject as l,isUndefined as p,isArray as u,canvasSizeAttrs as c,UICreator as g,FourNumberHelper as y,dataProcessor as v,dataType as f,surfaceType as w,opacityType as x,visibleType as S,dimType as m,sortType as k,maskType as R,eraserType as A,positionType as B,boundsType as C,scaleType as b,rotationType as P,scrollType as F,autoLayoutType as W,naturalBoundsType as D,affectRenderBoundsType as E,pathInputType as T,pathType as I,hitType as L,strokeType as z,cursorType as M,rewrite as O,Leaf as N,useModule as V,rewriteAble as H,MathHelper as Y,pen as U,PathCorner as X,PathDrawer as j,isNumber as J,registerUI as q,Branch as G,LeafList as $,Resource as K,getBoundsData as Q,Creator as Z,CanvasManager as tt,WaitHelper as et,LeaferEvent as it,Bounds as st,ResizeEvent as ot,AutoBounds as rt,Run as at,LayoutEvent as nt,RenderEvent as _t,WatchEvent as ht,ImageManager as dt,BoundsHelper as lt,PathCommandDataHelper as pt,Platform as ut,PointHelper as ct,affectStrokeBoundsType as gt,getPointData as yt,LeaferImage as vt,ImageEvent as ft,Matrix as wt,PathCreator as xt}from"@leafer/core";export*from"@leafer/core";function St(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 mt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function kt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Rt(){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 At(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Bt={},Ct={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}},bt=r,Pt={},Ft={},Wt={},Dt={},Et={},Tt={apply(){o.need("filter")}},It={},Lt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},zt={list:{},register(t,e){zt.list[t]=e},get:t=>zt.list[t]},{parse:Mt,objectToCanvasData:Ot}=a,{stintSet:Nt}=n,{hasTransparent:Vt}=Ct,Ht={originPaint:{}},Yt=_.get("UIData");class Ut extends h{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,Yt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Yt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Nt(this,"__isTransparentFill",Vt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):l(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Nt(this,"__isTransparentStroke",Vt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):l(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&l(t[0])?(this.__setInput("path",t),this._path=e?Mt(t):Ot(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Xt(this,"shadow",t)}setInnerShadow(t){Xt(this,"innerShadow",t)}setFilter(t){Xt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ft.compute("fill",this.__leaf),e&&Ft.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),p(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Ht)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ht))}__removePaint(t,e){e&&this.__removeInput(t),Wt.recycleImage(t,this),"fill"===t?(Nt(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Nt(this,"__isAlphaPixelStroke",void 0),Nt(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Xt(t,e,i){t.__setInput(e,i),u(i)?(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 jt extends Ut{}class Jt extends jt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class qt extends jt{__getInputData(t,e){const i=super.__getInputData(t,e);return c.forEach(t=>delete i[t]),i}}class Gt extends Jt{}class $t extends Ut{get __usePathBox(){return this.points||this.__pathInputed}}class Kt extends Ut{get __boxStroke(){return!this.__pathInputed}}class Qt extends Ut{get __boxStroke(){return!this.__pathInputed}}class Zt extends $t{}class te extends Ut{}class ee extends Ut{get __pathInputed(){return 2}}class ie extends jt{}const se={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class oe extends Ut{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=se[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=g.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()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class re extends Kt{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class ae extends Kt{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{max:ne,add:_e}=y,he={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke||i.__useArrow)){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=ne(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__,{strokeSpread:n}=this.__layout,_=this.__box;e&&(t=Et.getShadowRenderSpread(this,e)),s&&(t=ne(t,s)),r&&(t=_e(t,Tt.getSpread(r))),a&&(t=_e(t,a)),n&&(t=_e(t,n));let h=t;return i&&(h=ne(h,Et.getInnerShadowSpread(this,i))),o&&(h=ne(h,o)),this.__layout.renderShapeSpread=h,_?ne(_.__updateRenderSpread(),t):t}},{stintSet:de}=n,le={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);de(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),de(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;de(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Et.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),de(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){pe(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 _=Ft.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Et.shadow(this,t,_),n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e)),o&&(s.__isFills?Ft.fills(o,this,t,e):Ft.fill(o,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Et.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e)),l&&Tt.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Ct.string(e.color))}o&&(s.__isFills?Ft.fills(o,this,t,e):Ft.fill(o,this,t,e)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Ft.strokes(r,this,t,e):Ft.stroke(r,this,t,e))}}else s.__pathForRender?pe(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?Ft.fills(s,this,t,e):Ft.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ft.strokes(o,this,t,e):Ft.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function pe(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Ft.stroke(o,t,e,i),s&&Ft.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),o&&!a&&Ft.stroke(o,t,e,i)}const ue={__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 ce;let ge=ce=class extends N{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){Y.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return U.set(this.path=t||[]),t||this.__drawPathByBox(U),U}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return o.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return o.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(U.set(i=[]),this.__drawPathByBox(U,!e)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||It.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius?X.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&Pt.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&Pt.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?j.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,o,r,J(e)?[e]:e)}else t.rect(i,s,o,r);t.closePath()}drawImagePlaceholder(t,e,i){Ft.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),o.need("animate")}killAnimate(t,e){}export(t,e){return o.need("export")}syncExport(t,e){return o.need("export")}clone(t){const e=n.clone(this.toJSON());return t&&Object.assign(e,t),ce.one(e)}static one(t,e,i,s,o){return g.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){q()(this)}static registerData(t){v(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};St([v(Ut)],ge.prototype,"__",void 0),St([Rt()],ge.prototype,"zoomLayer",void 0),St([f("")],ge.prototype,"id",void 0),St([f("")],ge.prototype,"name",void 0),St([f("")],ge.prototype,"className",void 0),St([w("pass-through")],ge.prototype,"blendMode",void 0),St([x(1)],ge.prototype,"opacity",void 0),St([S(!0)],ge.prototype,"visible",void 0),St([w(!1)],ge.prototype,"locked",void 0),St([m(!1)],ge.prototype,"dim",void 0),St([m(!1)],ge.prototype,"dimskip",void 0),St([k(0)],ge.prototype,"zIndex",void 0),St([R(!1)],ge.prototype,"mask",void 0),St([A(!1)],ge.prototype,"eraser",void 0),St([B(0,!0)],ge.prototype,"x",void 0),St([B(0,!0)],ge.prototype,"y",void 0),St([C(100,!0)],ge.prototype,"width",void 0),St([C(100,!0)],ge.prototype,"height",void 0),St([b(1,!0)],ge.prototype,"scaleX",void 0),St([b(1,!0)],ge.prototype,"scaleY",void 0),St([P(0,!0)],ge.prototype,"rotation",void 0),St([P(0,!0)],ge.prototype,"skewX",void 0),St([P(0,!0)],ge.prototype,"skewY",void 0),St([B(0,!0)],ge.prototype,"offsetX",void 0),St([B(0,!0)],ge.prototype,"offsetY",void 0),St([F(0,!0)],ge.prototype,"scrollX",void 0),St([F(0,!0)],ge.prototype,"scrollY",void 0),St([W()],ge.prototype,"origin",void 0),St([W()],ge.prototype,"around",void 0),St([f(!1)],ge.prototype,"lazy",void 0),St([D(1)],ge.prototype,"pixelRatio",void 0),St([E(0)],ge.prototype,"renderSpread",void 0),St([T()],ge.prototype,"path",void 0),St([I()],ge.prototype,"windingRule",void 0),St([I(!0)],ge.prototype,"closed",void 0),St([C(0)],ge.prototype,"padding",void 0),St([C(!1)],ge.prototype,"lockRatio",void 0),St([C()],ge.prototype,"widthRange",void 0),St([C()],ge.prototype,"heightRange",void 0),St([f(!1)],ge.prototype,"draggable",void 0),St([f()],ge.prototype,"dragBounds",void 0),St([f("auto")],ge.prototype,"dragBoundsType",void 0),St([f(!1)],ge.prototype,"editable",void 0),St([L(!0)],ge.prototype,"hittable",void 0),St([L("path")],ge.prototype,"hitFill",void 0),St([z("path")],ge.prototype,"hitStroke",void 0),St([L(!1)],ge.prototype,"hitBox",void 0),St([L(!0)],ge.prototype,"hitChildren",void 0),St([L(!0)],ge.prototype,"hitSelf",void 0),St([L()],ge.prototype,"hitRadius",void 0),St([M("")],ge.prototype,"cursor",void 0),St([w()],ge.prototype,"fill",void 0),St([z(void 0,!0)],ge.prototype,"stroke",void 0),St([z("inside")],ge.prototype,"strokeAlign",void 0),St([z(1,!0)],ge.prototype,"strokeWidth",void 0),St([z(!1)],ge.prototype,"strokeScaleFixed",void 0),St([z("none")],ge.prototype,"strokeCap",void 0),St([z("miter")],ge.prototype,"strokeJoin",void 0),St([z()],ge.prototype,"dashPattern",void 0),St([z(0)],ge.prototype,"dashOffset",void 0),St([z(10)],ge.prototype,"miterLimit",void 0),St([I(0)],ge.prototype,"cornerRadius",void 0),St([I()],ge.prototype,"cornerSmoothing",void 0),St([mt()],ge.prototype,"shadow",void 0),St([mt()],ge.prototype,"innerShadow",void 0),St([mt()],ge.prototype,"blur",void 0),St([mt()],ge.prototype,"backgroundBlur",void 0),St([mt()],ge.prototype,"grayscale",void 0),St([mt()],ge.prototype,"filter",void 0),St([w()],ge.prototype,"placeholderColor",void 0),St([f(100)],ge.prototype,"placeholderDelay",void 0),St([f({})],ge.prototype,"data",void 0),St([O(N.prototype.reset)],ge.prototype,"reset",null),ge=ce=St([V(he),V(le),H()],ge);let ye=class extends ge{get __tag(){return"Group"}get isBranch(){return!0}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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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 ve;St([v(jt)],ye.prototype,"__",void 0),St([C(0)],ye.prototype,"width",void 0),St([C(0)],ye.prototype,"height",void 0),ye=St([V(G),q()],ye);const fe=_.get("Leafer");let we=ve=class extends ye{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&K.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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)||Q()}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),ve.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,n.assign(s,t));const o=this.canvas=Z.canvas(s);this.__controllers.push(this.renderer=Z.renderer(this,o,s),this.watcher=Z.watcher(this,s),this.layouter=Z.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=Z.selector(this),this.interaction=Z.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Z.hitCanvasManager()),this.canvasManager=new tt,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))),et.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(it.RESTART):this.emitLeafer(it.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(it.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,c);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new st(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=n.copyAttrs({},this.canvas,c);e.resize(t),this.updateLazyBounds(),this.__onResize(new ot(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,c),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(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new rt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(c.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())):"mode"===t&&this.emit(it.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&c.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,c);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(it.BEFORE_READY),this.emitLeafer(it.READY),this.emitLeafer(it.AFTER_READY),et.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(it.VIEW_READY),et.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){et.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(it.VIEW_COMPLETED),et.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,s){return o.need("view")}getValidMove(t,e,i){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 it(t,this))}__listenEvents(){const t=at.start("FirstCreate "+this.innerName);this.once([[it.START,()=>at.end(t)],[nt.START,this.updateLazyBounds,this],[_t.START,this.__onCreated,this],[_t.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ht.DATA,this.__onWatchData,this],[nt.END,this.__onLayoutEnd,this],[_t.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ve.list.remove(this);try{this.stop(),this.emitLeafer(it.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&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{dt.clearRecycled()},100)}catch(t){fe.error(t)}}};t?e():setTimeout(e)}};we.list=new $,St([v(qt)],we.prototype,"__",void 0),St([C()],we.prototype,"pixelRatio",void 0),St([f("normal")],we.prototype,"mode",void 0),we=ve=St([q()],we);let xe=class extends ge{get __tag(){return"Rect"}};St([v(Kt)],xe.prototype,"__",void 0),xe=St([V(ue),H(),q()],xe);const{add:Se,includes:me,scroll:ke}=lt,Re=xe.prototype,Ae=ye.prototype;let Be=class extends ye{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){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=Q());super.__updateRenderBounds(n),(e=a&&a.includes("scroll"))&&(Se(n,r),ke(n,i)),this.__updateRectRenderBounds(),t=!me(r,n),t&&"show"===a&&Se(o,n)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__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)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};St([v(Jt)],Be.prototype,"__",void 0),St([C(100)],Be.prototype,"width",void 0),St([C(100)],Be.prototype,"height",void 0),St([f(!1)],Be.prototype,"resizeChildren",void 0),St([E("show")],Be.prototype,"overflow",void 0),St([O(Re.__updateStrokeSpread)],Be.prototype,"__updateStrokeSpread",null),St([O(Re.__updateRenderSpread)],Be.prototype,"__updateRectRenderSpread",null),St([O(Re.__updateBoxBounds)],Be.prototype,"__updateRectBoxBounds",null),St([O(Re.__updateStrokeBounds)],Be.prototype,"__updateStrokeBounds",null),St([O(Re.__updateRenderBounds)],Be.prototype,"__updateRectRenderBounds",null),St([O(Re.__updateChange)],Be.prototype,"__updateRectChange",null),St([O(Re.__render)],Be.prototype,"__renderRect",null),St([O(Ae.__render)],Be.prototype,"__renderGroup",null),Be=St([H(),q()],Be);let Ce=class extends Be{get __tag(){return"Frame"}get isFrame(){return!0}};St([v(Gt)],Ce.prototype,"__",void 0),St([w("#FFFFFF")],Ce.prototype,"fill",void 0),St([E("hide")],Ce.prototype,"overflow",void 0),Ce=St([q()],Ce);const{moveTo:be,closePath:Pe,ellipse:Fe}=pt;let We=class extends ge{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:o,endAngle:r}=t,a=e/2,n=i/2,_=t.path=[];let h;s?o||r?(s<1?Fe(_,a,n,a*s,n*s,0,o,r,!1):h=!0,Fe(_,a,n,a,n,0,r,o,!0)):(s<1&&(Fe(_,a,n,a*s,n*s),be(_,e,n)),Fe(_,a,n,a,n,0,360,0,!0)):o||r?(be(_,a,n),Fe(_,a,n,a,n,0,o,r,!1)):Fe(_,a,n,a,n),h||Pe(_),(ut.ellipseToCurve||t.__useArrow)&&(t.path=this.getPath(!0))}};St([v(Qt)],We.prototype,"__",void 0),St([I(0)],We.prototype,"innerRadius",void 0),St([I(0)],We.prototype,"startAngle",void 0),St([I(0)],We.prototype,"endAngle",void 0),We=St([q()],We);const{sin:De,cos:Ee,PI:Te}=Math,{moveTo:Ie,lineTo:Le,closePath:ze,drawPoints:Me}=pt;let Oe=class extends ge{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Me(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Ie(e,r,0);for(let t=1;t<o;t++)Le(e,r+r*De(2*t*Te/o),a-a*Ee(2*t*Te/o));ze(e)}}};St([v(Zt)],Oe.prototype,"__",void 0),St([I(3)],Oe.prototype,"sides",void 0),St([I()],Oe.prototype,"points",void 0),St([I(0)],Oe.prototype,"curve",void 0),Oe=St([H(),q()],Oe);const{sin:Ne,cos:Ve,PI:He}=Math,{moveTo:Ye,lineTo:Ue,closePath:Xe}=pt;let je=class extends ge{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ye(a,o,0);for(let t=1;t<2*i;t++)Ue(a,o+(t%2==0?o:o*s)*Ne(t*He/i),r-(t%2==0?r:r*s)*Ve(t*He/i));Xe(a)}};St([v(te)],je.prototype,"__",void 0),St([I(5)],je.prototype,"corners",void 0),St([I(.382)],je.prototype,"innerRadius",void 0),je=St([q()],je);const{moveTo:Je,lineTo:qe,drawPoints:Ge}=pt,{rotate:$e,getAngle:Ke,getDistance:Qe,defaultPoint:Ze}=ct;let ti=class extends ge{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=yt();return t&&(i.x=t),e&&$e(i,e),i}set toPoint(t){this.width=Qe(Ze,t),this.rotation=Ke(Ze,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ge(e,t.points,t.curve,t.closed):(Je(e,0,0),qe(e,this.width,0))}};St([v($t)],ti.prototype,"__",void 0),St([gt("center")],ti.prototype,"strokeAlign",void 0),St([C(0)],ti.prototype,"height",void 0),St([I()],ti.prototype,"points",void 0),St([I(0)],ti.prototype,"curve",void 0),St([I(!1)],ti.prototype,"closed",void 0),ti=St([q()],ti);let ei=class extends xe{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};St([v(re)],ei.prototype,"__",void 0),St([C("")],ei.prototype,"url",void 0),ei=St([q()],ei);const ii=ei;let si=class extends xe{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Z.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new vt({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ft(ft.LOADED,{image:t}))})}draw(t,e,i,s){const o=new wt(t.worldTransform).invert(),r=new wt;e&&r.translate(e.x,e.y),i&&(J(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()}};St([v(ae)],si.prototype,"__",void 0),St([kt(100)],si.prototype,"width",void 0),St([kt(100)],si.prototype,"height",void 0),St([kt(1)],si.prototype,"pixelRatio",void 0),St([kt(!0)],si.prototype,"smooth",void 0),St([f(!1)],si.prototype,"safeResize",void 0),St([kt()],si.prototype,"contextSettings",void 0),si=St([q()],si);const{copyAndSpread:oi,includes:ri,spread:ai,setList:ni}=lt,{stintSet:_i}=n;let hi=class extends ge{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h,width:d,height:l}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o||12}px ${s||"caption"}`,_i(t,"__padding",h&&Y.fourNumber(h)),_i(t,"__clipText","show"!==_&&!t.__autoSize),_i(t,"__isCharMode",d||l||t.__letterSpacing||"none"!==n),t.__textDrawData=Bt.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:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&ai(_,i/2),r||a){if(h.x=r?_.x:0,h.y=a?_.y:0,h.width=r?_.width:t.width,h.height=a?_.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(h.x-=o,h.width+=i+o),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),n.stintSet(this,"isOverflow",!ri(h,_)),this.isOverflow?(ni(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;oi(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__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()}};St([v(oe)],hi.prototype,"__",void 0),St([C(0)],hi.prototype,"width",void 0),St([C(0)],hi.prototype,"height",void 0),St([w()],hi.prototype,"boxStyle",void 0),St([f(!1)],hi.prototype,"resizeFontSize",void 0),St([w("#000000")],hi.prototype,"fill",void 0),St([gt("outside")],hi.prototype,"strokeAlign",void 0),St([L("all")],hi.prototype,"hitFill",void 0),St([C("")],hi.prototype,"text",void 0),St([C("")],hi.prototype,"placeholder",void 0),St([C("caption")],hi.prototype,"fontFamily",void 0),St([C(12)],hi.prototype,"fontSize",void 0),St([C("normal")],hi.prototype,"fontWeight",void 0),St([C(!1)],hi.prototype,"italic",void 0),St([C("none")],hi.prototype,"textCase",void 0),St([C("none")],hi.prototype,"textDecoration",void 0),St([C(0)],hi.prototype,"letterSpacing",void 0),St([C({type:"percent",value:1.5})],hi.prototype,"lineHeight",void 0),St([C(0)],hi.prototype,"paraIndent",void 0),St([C(0)],hi.prototype,"paraSpacing",void 0),St([C("x")],hi.prototype,"writingMode",void 0),St([C("left")],hi.prototype,"textAlign",void 0),St([C("top")],hi.prototype,"verticalAlign",void 0),St([C(!0)],hi.prototype,"autoSizeAlign",void 0),St([C("normal")],hi.prototype,"textWrap",void 0),St([C("show")],hi.prototype,"textOverflow",void 0),St([w(!1)],hi.prototype,"textEditing",void 0),hi=St([q()],hi);let di=class extends ge{get __tag(){return"Path"}};St([v(ee)],di.prototype,"__",void 0),St([gt("center")],di.prototype,"strokeAlign",void 0),di=St([q()],di);let li=class extends ye{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new di(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")}};St([v(ie)],li.prototype,"__",void 0),St([(e,i)=>{t(e,i,{get(){return this.__path}})}],li.prototype,"path",void 0),li=St([V(xt,["set","path","paint"]),q()],li);export{Be as Box,Jt as BoxData,si as Canvas,ae as CanvasData,Ct as ColorConvert,Et as Effect,We as Ellipse,Qt as EllipseData,It as Export,Tt as Filter,Ce as Frame,Gt as FrameData,ye as Group,jt as GroupData,ei as Image,re as ImageData,we as Leafer,qt as LeaferData,ti as Line,$t as LineData,ii as MyImage,Ft as Paint,Dt as PaintGradient,Wt as PaintImage,di as Path,Pt as PathArrow,ee as PathData,li as Pen,ie as PenData,Oe as Polygon,Zt as PolygonData,xe as Rect,Kt as RectData,ue as RectRender,je as Star,te as StarData,Lt as State,hi as Text,Bt as TextConvert,oe as TextData,zt as Transition,ge as UI,he as UIBounds,Ut as UIData,le as UIRender,bt as UnitConvert,At as createAttr,mt as effectType,kt as resizeType,Rt as zoomLayerType};
2
2
  //# sourceMappingURL=draw.esm.min.js.map