@leafer-draw/miniapp 1.9.6 → 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +116 -80
- package/dist/miniapp.esm.js +118 -82
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +282 -180
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:i}=t.image;return!i||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+i),s&&"/"===e[0]&&(e=s+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=e;var i;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(i||(i={}));const r={};function o(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return y(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&y(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{o(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=o(s)?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(u(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!o(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:x,pow:w,PI:v}=Math,b={within:(t,e,s)=>(_(e)&&(s=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(s)&&t>s&&(t=s),t),fourNumber(t,e){let s;if(u(t))switch(t.length){case 4:s=o(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),b.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=o(e)?1e12:w(10,e);return-0===(t=x(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&b.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:B,randColor:t=>`rgba(${B(255)},${B(255)},${B(255)},${t||1})`};function B(t){return Math.round(Math.random()*t)}const k=v/180,S=2*v,R=v/2;function C(){return{x:0,y:0}}function P(){return{x:0,y:0,width:0,height:0}}function T(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:E,cos:O,acos:L,sqrt:A}=Math,{float:I}=b,M={};function W(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const D={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:W(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:T,getWorld:W,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i){F.toInnerPoint(t,e,M),F.scaleOfInner(t,M,s,i)},scaleOfInner(t,e,s,i=s){F.translateInner(t,e.x,e.y),F.scale(t,s,i),F.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=O(e*=k),a=E(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){F.toInnerPoint(t,e,M),F.rotateOfInner(t,M,s)},rotateOfInner(t,e,s){F.translateInner(t,e.x,e.y),F.rotate(t,s),F.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=k,t.a=i+o*s,t.b=r+n*s),e&&(e*=k,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){F.toInnerPoint(t,e,M),F.skewOfInner(t,M,s,i)},skewOfInner(t,e,s,i=0){F.translateInner(t,e.x,e.y),F.skew(t,s,i),F.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,i,r){const{e:n,f:a}=t;if(s||(s=t),o(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:o,c:n,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){F.multiply(t,F.tempInvert(e))},divideParent(t,e){F.multiplyParent(t,F.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=F;return F.copy(e,t),F.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,i,r){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(o(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,o=s*k,n=O(o),a=E(o);if(i||r){const e=i*k,s=r*k;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||i)&&F.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=A(r*r+o*o),c=t/d;const e=r/d;u=o>0?L(e):-L(e)}else{c=A(n*n+a*a),d=t/c;const e=n/c;u=R-(a>0?L(-e):-L(e))}const e=I(O(u)),s=E(u);d=I(d),c=I(c),_=e?I((n/c+s)/e/k,9):0,p=e?I((o/d-s)/e/k,9):0,u=I(u/k)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*n,f+=e.x*o+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=A(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){F.set(t)}},F=D,{toInnerPoint:z,toOuterPoint:N}=D,{sin:Y,cos:X,abs:U,sqrt:j,atan2:V,min:H,round:G}=Math,q={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=o(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(t.y)},move(t,e,s){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=Q.defaultPoint);const i=X(e*=k),r=Y(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=Q;return $(s,t),z(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=Q;return $(s,t),N(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=Q;return $(s,t),Q.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),z(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){z(e,t,s)},toOuterOf(t,e,s){N(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>J(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=U(s-t),o=U(i-e);return j(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>H(J(t,e,s,i),J(s,i,r,o)),getAngle:(t,e)=>Z(t,e)/k,getRotation:(t,e,s,i)=>(i||(i=e),Q.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/k),getRadianFrom(t,e,s,i,r,n,a,h){o(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>V(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=Z(t,e);return(e=i?e:{}).x=t.x+X(r)*s,e.y=t.y+Y(r)*s,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){Q.reset(t)}},Q=q,{getDistanceFrom:J,copy:$,getAtan2:Z}=Q;class K{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?q.copy(this,t):q.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new K(this)}move(t,e){return q.move(this,t,e),this}scale(t,e){return q.scale(this,t,e),this}scaleOf(t,e,s){return q.scaleOf(this,t,e,s),this}rotate(t,e){return q.rotate(this,t,e),this}rotateOf(t,e){return q.rotate(this,e,t),this}getRotation(t,e,s){return q.getRotation(this,t,e,s)}toInnerOf(t,e){return q.toInnerOf(this,t,e),this}toOuterOf(t,e){return q.toOuterOf(this,t,e),this}getCenter(t){return new K(q.getCenter(this,t))}getDistance(t){return q.getDistance(this,t)}getDistancePoint(t,e,s){return new K(q.getDistancePoint(this,t,e,s))}getAngle(t){return q.getAngle(this,t)}getAtan2(t){return q.getAtan2(this,t)}reset(){return q.reset(this),this}}const tt=new K;class et{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return _(t)?D.copy(this,t):D.set(this,t,e,s,i,r,o),this}setWith(t){return D.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}clone(){return new et(this)}translate(t,e){return D.translate(this,t,e),this}translateInner(t,e){return D.translateInner(this,t,e),this}scale(t,e){return D.scale(this,t,e),this}scaleWith(t,e){return D.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return D.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return D.scaleOfInner(this,t,e,s),this}rotate(t){return D.rotate(this,t),this}rotateOfOuter(t,e){return D.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return D.rotateOfInner(this,t,e),this}skew(t,e){return D.skew(this,t,e),this}skewOfOuter(t,e,s){return D.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return D.skewOfInner(this,t,e,s),this}multiply(t){return D.multiply(this,t),this}multiplyParent(t){return D.multiplyParent(this,t),this}divide(t){return D.divide(this,t),this}divideParent(t){return D.divideParent(this,t),this}invert(){return D.invert(this),this}invertWith(){return D.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){D.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){D.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return D.setLayout(this,t,e,s),this}getLayout(t,e,s){return D.getLayout(this,t,e,s)}withScale(t,e){return D.withScale(this,t,e)}reset(){D.reset(this)}}const st=new et,it={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){rt(t,e,s),rt(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:rt}=it;var ot,nt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(ot||(ot={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(nt||(nt={}));const at=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,s,i,r,o){const n=lt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),ht.toPoint(t,e,s,!0),s)};function lt(t){return a(t)?at[nt[t]]:t}const{toPoint:dt}=ht,ct={toPoint(t,e,s,i,r,o){dt(t,s,i,r,e,o)}},{tempPointBounds:ut,setPoint:_t,addPoint:pt,toBounds:gt}=it,{toOuterPoint:ft}=D,{float:yt,fourNumber:mt}=b,{floor:xt,ceil:wt}=Math;let vt,bt,Bt,kt;const St={},Rt={},Ct={},Pt={tempBounds:Ct,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(u(s)){const e=mt(s);i?Tt.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Tt.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Tt.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Tt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Ot(e,t):e=t,s?(e.offsetX=-(Tt.maxX(s)-t.x),e.offsetY=-(Tt.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Tt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||q.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){q.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Tt.copy(Ct,t),Tt.toOuterOf(Ct,e),Ct),getOuterOf:(t,e)=>(t=Object.assign({},t),Tt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else St.x=t.x,St.y=t.y,ft(e,St,Rt),_t(ut,Rt.x,Rt.y),St.x=t.x+t.width,ft(e,St,Rt),pt(ut,Rt.x,Rt.y),St.y=t.y+t.height,ft(e,St,Rt),pt(ut,Rt.x,Rt.y),St.x=t.x,ft(e,St,Rt),pt(ut,Rt.x,Rt.y),gt(ut,s)},toInnerOf(t,e,s){s||(s=t),Tt.move(s,-e.e,-e.f),Tt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Tt.getFitScale(t,e));return new et(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,o){o||(o=e),a(i)&&(i=Tt.getFitScale(t,e,"cover"===i)),Ct.width=r?e.width*=i:e.width*i,Ct.height=r?e.height*=i:e.height*i,ct.toPoint(s,Ct,t,o,!0,!0)},getSpread(t,e,s){const i={};return Tt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Tt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Tt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=xt(t.x),t.y=xt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=s>t.y?wt(t.height+s-t.y):wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,s){vt=t.x+t.width,bt=t.y+t.height,Bt=e.x,kt=e.y,s||(Bt+=e.width,kt+=e.height),vt=vt>Bt?vt:Bt,bt=bt>kt?bt:kt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=vt-t.x,t.height=bt-t.y},addList(t,e){Tt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Tt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Tt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Ot(t,r)):Et(t,r));o&&Tt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ut,t.x,t.y):pt(ut,t.x,t.y)),gt(ut,t)},setPoint(t,e){Tt.set(t,e.x,e.y)},addPoint(t,e){Et(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=q.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=q.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Tt.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Tt.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=Tt.tempToOuterOf(e,s)),!Tt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return vt=i+o,bt=r+n,Bt=t.x+t.width,kt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,vt=vt<Bt?vt:Bt,bt=bt<kt?bt:kt,o=vt-i,n=bt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Tt.copy(t,Tt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Tt.set(t)}},Tt=Pt,{add:Et,copy:Ot}=Tt;class Lt{get minX(){return Pt.minX(this)}get minY(){return Pt.minY(this)}get maxX(){return Pt.maxX(this)}get maxY(){return Pt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return _(t)?Pt.copy(this,t):Pt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Lt(this)}move(t,e){return Pt.move(this,t,e),this}scale(t,e,s){return Pt.scale(this,t,e,s),this}scaleOf(t,e,s){return Pt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Pt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Pt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Pt.getFitMatrix(this,t,e)}put(t,e,s){Pt.put(this,t,e,s)}spread(t,e){return Pt.spread(this,t,e),this}shrink(t,e){return Pt.shrink(this,t,e),this}ceil(){return Pt.ceil(this),this}unsign(){return Pt.unsign(this),this}float(t){return Pt.float(this,t),this}add(t){return Pt.add(this,t),this}addList(t){return Pt.setList(this,t,!0),this}setList(t){return Pt.setList(this,t),this}addListWithFn(t,e){return Pt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Pt.setListWithFn(this,t,e),this}setPoint(t){return Pt.setPoint(this,t),this}setPoints(t){return Pt.setPoints(this,t),this}addPoint(t){return Pt.addPoint(this,t),this}getPoints(){return Pt.getPoints(this)}hitPoint(t,e){return Pt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Pt.hitRadiusPoint(this,t,e)}hit(t,e){return Pt.hit(this,t,e)}includes(t,e){return Pt.includes(this,t,e)}intersect(t,e){return Pt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Pt.getIntersectData(this,t,e))}isSame(t){return Pt.isSame(this,t)}isEmpty(){return Pt.isEmpty(this)}reset(){Pt.reset(this)}}const At=new Lt;class It{constructor(t,e,s,i,r,o){_(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Lt(r,e,o||t.width-r-s,n||t.height-e-i)}}const Mt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Wt}=b;class Dt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Dt(t)}static set filter(t){this.filterList=Ft(t)}static set exclude(t){this.excludeList=Ft(t)}static drawRepaint(t,e){const s=Wt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Dt.showBounds,r=t.__nowWorld,o=Wt();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(zt.enable){if(zt.filterList.length&&zt.filterList.every(t=>t!==this.name))return;if(zt.excludeList.length&&zt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){zt.enable&&this.warn(...t)}warn(...t){zt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Ft(t){return t?a(t)&&(t=[t]):t=[],t}Dt.filterList=[],Dt.excludeList=[],Dt.showWarn=!0;const zt=Dt,Nt=Dt.get("RunTime"),Yt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,s){const i=e.create(e.RUNTIME);return Xt.currentId=Xt.idMap[i]=s?performance.now():Date.now(),Xt.currentName=Xt.nameMap[i]=t,Xt.nameToIdMap[t]=i,i},end(t,e){const s=Xt.idMap[t],i=Xt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Xt.idMap[t]=Xt.nameMap[t]=Xt.nameToIdMap[i]=void 0,Nt.log(i,r,"ms")},endOfName(t,e){const s=Xt.nameToIdMap[t];o(s)||Xt.end(s,e)}},Xt=Yt,Ut=[],jt={list:{},add(t,...e){this.list[t]=!0,Ut.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>Ut.forEach(t=>jt.has(t,!0)));const Vt={editor:t=>jt.need("editor")},Ht=Dt.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;qt[e]&&Ht.repeat(e),qt[e]=t},get(t,e,s,i,r,n){qt[t]||Ht.error("not register "+t);const a=new qt[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:qt}=Gt,Qt=Dt.get("EventCreator"),Jt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&($t[e]&&Qt.repeat(e),$t[e]=t)})},changeName(t,e){const s=$t[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,$t[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new $t[t](...e)},{nameList:$t}=Jt;class Zt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Vt.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function Kt(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function te(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function ee(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const se=[];function ie(){return(t,e)=>{se.push(e)}}const re=[];let oe=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||re)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;se.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};Kt([ee("imageSmoothingEnabled")],oe.prototype,"smooth",void 0),Kt([ee("imageSmoothingQuality")],oe.prototype,"smoothLevel",void 0),Kt([ee("globalAlpha")],oe.prototype,"opacity",void 0),Kt([ee()],oe.prototype,"fillStyle",void 0),Kt([ee()],oe.prototype,"strokeStyle",void 0),Kt([ee("lineWidth")],oe.prototype,"strokeWidth",void 0),Kt([ee("lineCap")],oe.prototype,"strokeCap",void 0),Kt([ee("lineJoin")],oe.prototype,"strokeJoin",void 0),Kt([ee("lineDashOffset")],oe.prototype,"dashOffset",void 0),Kt([ee()],oe.prototype,"miterLimit",void 0),Kt([ee()],oe.prototype,"shadowBlur",void 0),Kt([ee()],oe.prototype,"shadowColor",void 0),Kt([ee()],oe.prototype,"shadowOffsetX",void 0),Kt([ee()],oe.prototype,"shadowOffsetY",void 0),Kt([ee()],oe.prototype,"filter",void 0),Kt([ee()],oe.prototype,"font",void 0),Kt([ee()],oe.prototype,"fontKerning",void 0),Kt([ee()],oe.prototype,"fontStretch",void 0),Kt([ee()],oe.prototype,"fontVariantCaps",void 0),Kt([ee()],oe.prototype,"textAlign",void 0),Kt([ee()],oe.prototype,"textBaseline",void 0),Kt([ee()],oe.prototype,"textRendering",void 0),Kt([ee()],oe.prototype,"wordSpacing",void 0),Kt([ee()],oe.prototype,"letterSpacing",void 0),Kt([ee()],oe.prototype,"direction",void 0),Kt([ie()],oe.prototype,"setTransform",null),Kt([ie()],oe.prototype,"resetTransform",null),Kt([ie()],oe.prototype,"getTransform",null),Kt([ie()],oe.prototype,"save",null),Kt([ie()],oe.prototype,"restore",null),Kt([ie()],oe.prototype,"translate",null),Kt([ie()],oe.prototype,"scale",null),Kt([ie()],oe.prototype,"rotate",null),Kt([ie()],oe.prototype,"fill",null),Kt([ie()],oe.prototype,"stroke",null),Kt([ie()],oe.prototype,"clip",null),Kt([ie()],oe.prototype,"fillRect",null),Kt([ie()],oe.prototype,"strokeRect",null),Kt([ie()],oe.prototype,"clearRect",null),Kt([ie()],oe.prototype,"beginPath",null),Kt([ie()],oe.prototype,"moveTo",null),Kt([ie()],oe.prototype,"lineTo",null),Kt([ie()],oe.prototype,"bezierCurveTo",null),Kt([ie()],oe.prototype,"quadraticCurveTo",null),Kt([ie()],oe.prototype,"closePath",null),Kt([ie()],oe.prototype,"arc",null),Kt([ie()],oe.prototype,"arcTo",null),Kt([ie()],oe.prototype,"ellipse",null),Kt([ie()],oe.prototype,"rect",null),Kt([ie()],oe.prototype,"roundRect",null),Kt([ie()],oe.prototype,"createConicGradient",null),Kt([ie()],oe.prototype,"createLinearGradient",null),Kt([ie()],oe.prototype,"createPattern",null),Kt([ie()],oe.prototype,"createRadialGradient",null),Kt([ie()],oe.prototype,"fillText",null),Kt([ie()],oe.prototype,"measureText",null),Kt([ie()],oe.prototype,"strokeText",null);const{copy:ne,multiplyParent:ae}=D,{round:he}=Math,le=new Lt,de=new Lt,ce={width:1,height:1,pixelRatio:1},ue=["width","height","pixelRatio"];class _e extends oe{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(s,i){super(),this.size={},this.worldTransform={},s||(s=ce),this.manager=i,this.innerId=e.create(e.CNAVAS);const{width:r,height:o,pixelRatio:n}=s;this.autoLayout=!r||!o,this.size.pixelRatio=n||t.devicePixelRatio,this.config=s,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;f.copyAttrs(i,t,ue),ue.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&ae(t,e,r),r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s,i&&(t.half&&t.half*s%2?(r.e=he(r.e-.5)+.5,r.f=he(r.f-.5)+.5):(r.e=he(r.e),r.f=he(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),o(e.dashPattern)||(r=e.dashPattern),o(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=de):s=le,this.drawImage(t.view,le.x,le.y,le.width,le.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Pt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,le.x,le.y,le.width,le.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(le.x,le.y,le.width,le.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,le.x,le.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(le.x,le.y,le.width,le.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(le.x,le.y,le.width,le.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(le,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(de,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):Vt.canvas(Object.assign({},s));return r.save(),t&&(ne(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ge={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},fe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},ge),ye={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},me={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},xe=Object.assign(Object.assign({},me),ge),we=fe,ve={};for(let t in we)ve[we[t]]=t;const be={};for(let t in we)be[we[t]]=ye[t];const Be={drawRoundRect(t,e,s,i,r,o){const n=b.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:ke,cos:Se,hypot:Re,atan2:Ce,ceil:Pe,abs:Te,PI:Ee,sqrt:Oe,pow:Le}=Math,{setPoint:Ae,addPoint:Ie}=it,{set:Me,toNumberPoints:We}=q,{M:De,L:Fe,C:ze,Q:Ne,Z:Ye}=fe,Xe={},Ue={points(t,e,s,i){let r=We(e);if(t.push(De,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Oe(Le(n-e,2)+Le(a-o,2)),g=Oe(Le(h-n,2)+Le(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(Ne,d,c,n,a):t.push(ze,u,_,d,c,n,a),u=n+g*h,_=a+g*l);i||t.push(Ne,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Fe,r[e],r[e+1]);i&&t.push(Ye)},rect(t,e,s,i,r){pe.creator.path=t,pe.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){pe.creator.path=[],Be.drawRoundRect(pe.creator,e,s,i,r,o),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let g=Ce(u,c),f=Ce(p,_);const y=Re(c,u),m=Re(_,p);let x=f-g;if(x<0&&(x+=S),y<1e-12||m<1e-12||x<1e-12||Te(x-Ee)<1e-12)return t&&t.push(Fe,i,r),h&&(Ae(h,e,s),Ie(h,i,r)),d&&Me(d,e,s),void(l&&Me(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Se(x/2),B=i+b*Se(g+x/2+R*v),C=r+b*ke(g+x/2+R*v);return g-=R*v,f-=R*v,He(t,B,C,a,a,0,g/k,f/k,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>He(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*k,_=ke(u),p=Se(u);let g=n*k,f=a*k;g>Ee&&(g-=S),f<0&&(f+=S);let y=f-g;y<0?y+=S:y>S&&(y-=S),h&&(y-=S);const m=Pe(Te(y/R)),x=y/m,w=ke(x/4),v=8/3*w*w/ke(x/2);f=g+x;let b,B,C,P,T,E,O,L,A=Se(g),I=ke(g),M=C=p*i*A-_*r*I,W=P=_*i*A+p*r*I,D=e+C,F=s+P;t&&t.push(t.length?Fe:De,D,F),l&&Ae(l,D,F),c&&Me(c,D,F);for(let o=0;o<m;o++)b=Se(f),B=ke(f),C=p*i*b-_*r*B,P=_*i*b+p*r*B,T=e+M-v*(p*i*I+_*r*A),E=s+W-v*(_*i*I-p*r*A),O=e+C+v*(p*i*B+_*r*b),L=s+P+v*(_*i*B-p*r*b),t&&t.push(ze,T,E,O,L,e+C,s+P),l&&Ve(e+M,s+W,T,E,O,L,e+C,s+P,l,!0),M=C,W=P,A=b,I=B,g=f,f+=x;d&&Me(d,e+C,s+P)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(ze,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){Ve(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ie(h,t,e):Ae(h,t,e),Ie(h,n,a);for(let l=0,c=d.length;l<c;l++)je(d[l],t,e,s,i,r,o,n,a,Xe),Ie(h,Xe.x,Xe.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return je(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:je,toTwoPointBounds:Ve,ellipse:He}=Ue,{sin:Ge,cos:qe,sqrt:Qe,atan2:Je}=Math,{ellipse:$e}=Ue,Ze={ellipticalArc(e,s,i,r,o,n,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=n*k,g=Ge(p),f=qe(p),y=-f*u-g*_,m=-f*_+g*u,x=r*r,w=o*o,v=m*m,b=y*y,B=x*w-x*v-w*b;let R=0;if(B<0){const t=Qe(1-B/(x*w));r*=t,o*=t}else R=(a===h?-1:1)*Qe(B/(x*v+w*b));const C=R*r*m/o,P=-R*o*y/r,T=Je((m-P)/o,(y-C)/r),E=Je((-m-P)/o,(-y-C)/r);let O=E-T;0===h&&O>0?O-=S:1===h&&O<0&&(O+=S);const L=s+u+f*C-g*P,A=i+_+g*C+f*P,I=O<0?1:0;c||t.ellipseToCurve?$e(e,L,A,r,o,n,T/k,E/k,I):r!==o||n?e.push(fe.G,L,A,r,o,n,T/k,E/k,I):e.push(fe.O,L,A,r,T/k,E/k,I)}},{M:Ke,m:ts,L:es,l:ss,H:is,h:rs,V:os,v:ns,C:as,c:hs,S:ls,s:ds,Q:cs,q:us,T:_s,t:ps,A:gs,a:fs,Z:ys,z:ms,N:xs,D:ws,X:vs,G:bs,F:Bs,O:ks,P:Ss,U:Rs}=fe,{rect:Cs,roundRect:Ps,arcTo:Ts,arc:Es,ellipse:Os,quadraticCurveTo:Ls}=Ue,{ellipticalArc:As}=Ze,Is=Dt.get("PathConvert"),Ms={},Ws={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=be[i],a+=i===r?" ":ve[i];for(let i=1;i<s;i++)a+=b.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?xe:me;for(let e=0,h=t.length;e<h;e++)i=t[e],Mt[i]?("."===i&&(Ds.dot&&(Fs(n,o),o=""),Ds.dot++),"0"===o&&"."!==i&&(Fs(n,o),o=""),o+=i):fe[i]?(o&&(Fs(n,o),o=""),Ds.name=fe[i],Ds.length=ye[i],Ds.index=0,Fs(n,Ds.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Fs(n,o),o=i):o&&(Fs(n,o),o=""),r=i;return o&&Fs(n,o),s?Ws.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ts:t[c+1]+=a,t[c+2]+=h;case Ke:a=t[c+1],h=t[c+2],_.push(Ke,a,h),c+=3;break;case rs:t[c+1]+=a;case is:a=t[c+1],_.push(es,a,h),c+=2;break;case ns:t[c+1]+=h;case os:h=t[c+1],_.push(es,a,h),c+=2;break;case ss:t[c+1]+=a,t[c+2]+=h;case es:a=t[c+1],h=t[c+2],_.push(es,a,h),c+=3;break;case ds:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ls;case ls:n=o===as||o===ls,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(as,l,d,s,i,a,h),c+=5;break;case hs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=as;case as:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(as,t[c+1],t[c+2],s,i,a,h),c+=7;break;case ps:t[c+1]+=a,t[c+2]+=h,r=_s;case _s:n=o===cs||o===_s,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ls(_,a,h,s,i,t[c+1],t[c+2]):_.push(cs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case us:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=cs;case cs:s=t[c+1],i=t[c+2],e?Ls(_,a,h,s,i,t[c+3],t[c+4]):_.push(cs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case fs:t[c+6]+=a,t[c+7]+=h;case gs:As(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case ms:case ys:_.push(ys),c++;break;case xs:a=t[c+1],h=t[c+2],e?Cs(_,a,h,t[c+3],t[c+4]):zs(_,t,c,5),c+=5;break;case ws:a=t[c+1],h=t[c+2],e?Ps(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):zs(_,t,c,9),c+=9;break;case vs:a=t[c+1],h=t[c+2],e?Ps(_,a,h,t[c+3],t[c+4],t[c+5]):zs(_,t,c,6),c+=6;break;case bs:Os(e?_:zs(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Ms),a=Ms.x,h=Ms.y,c+=9;break;case Bs:e?Os(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):zs(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ks:Es(e?_:zs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ms),a=Ms.x,h=Ms.y,c+=7;break;case Ss:e?Es(_,t[c+1],t[c+2],t[c+3],0,360,!1):zs(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Rs:Ts(e?_:zs(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ms),a=Ms.x,h=Ms.y,c+=6;break;default:return Is.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Ke,t.x,t.y);break;case"L":e.push(es,t.x,t.y);break;case"C":e.push(as,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(cs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ys)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Ds.index===Ds.length&&(Ds.index=1,t.push(Ds.name)),t.push(Number(e)),Ds.index++,Ds.dot=0}},{current:Ds,pushData:Fs,copyData:zs}=Ws,{M:Ns,L:Ys,C:Xs,Q:Us,Z:js,N:Vs,D:Hs,X:Gs,G:qs,F:Qs,O:Js,P:$s,U:Zs}=fe,{getMinDistanceFrom:Ks,getRadianFrom:ti}=q,{tan:ei,min:si,abs:ii}=Math,ri={},oi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ns,e,s)},lineTo(t,e,s){t.push(Ys,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(Xs,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Us,e,s,i,r)},closePath(t){t.push(js)},rect(t,e,s,i,r){t.push(Vs,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(Gs,e,s,i,r,o);else{const n=b.fourNumber(o);n?t.push(Hs,e,s,i,r,...n):t.push(Vs,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){n(o)?t.push(Qs,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(qs,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push($s,e,s,i):(n(o)&&(o=360),t.push(Js,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h){if(!o(a)){const t=Ks(a,h,e,s,i,r);n=si(n,si(t/2,t/2*ii(ei(ti(a,h,e,s,i,r)/2))))}t.push(Zs,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){Ue.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,ri),t.push(Ns,ri.x,ri.y),ni(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){Ue.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,ri),t.push(Ns,ri.x,ri.y),ai(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){Ue.points(t,e,s,i)}},{ellipse:ni,arc:ai}=oi,{moveTo:hi,lineTo:li,quadraticCurveTo:di,bezierCurveTo:ci,closePath:ui,beginPath:_i,rect:pi,roundRect:gi,ellipse:fi,arc:yi,arcTo:mi,drawEllipse:xi,drawArc:wi,drawPoints:vi}=oi;class bi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?pe.parse(t):t:[],this}beginPath(){return _i(this.__path),this.paint(),this}moveTo(t,e){return hi(this.__path,t,e),this.paint(),this}lineTo(t,e){return li(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return ci(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return di(this.__path,t,e,s,i),this.paint(),this}closePath(){return ui(this.__path),this.paint(),this}rect(t,e,s,i){return pi(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return gi(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return fi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return yi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return mi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return xi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return wi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return vi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Bi,L:ki,C:Si,Q:Ri,Z:Ci,N:Pi,D:Ti,X:Ei,G:Oi,F:Li,O:Ai,P:Ii,U:Mi}=fe,Wi=Dt.get("PathDrawer"),Di={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Bi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case ki:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Si:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ri:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ci:t.closePath(),i+=1;break;case Pi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ti:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Ei:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Oi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*k,e[i+6]*k,e[i+7]*k,e[i+8]),i+=9;break;case Li:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,S,!1),i+=5;break;case Ai:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*k,e[i+5]*k,e[i+6]),i+=7;break;case Ii:t.arc(e[i+1],e[i+2],e[i+3],0,S,!1),i+=4;break;case Mi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Wi.error(`command: ${s} [index:${i}]`,e)}}},{M:Fi,L:zi,C:Ni,Q:Yi,Z:Xi,N:Ui,D:ji,X:Vi,G:Hi,F:Gi,O:qi,P:Qi,U:Ji}=fe,{toTwoPointBounds:$i,toTwoPointBoundsByQuadraticCurve:Zi,arcTo:Ki,arc:tr,ellipse:er}=Ue,{addPointBounds:sr,copy:ir,addPoint:rr,setPoint:or,addBounds:nr,toBounds:ar}=it,hr=Dt.get("PathBounds");let lr,dr,cr;const ur={},_r={},pr={},gr={toBounds(t,e){gr.toTwoPointBounds(t,_r),ar(_r,e)},toTwoPointBounds(t,e){if(!t||!t.length)return or(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===Xi||n===Ni||n===Yi?or(e,h,l):or(e,t[a+1],t[a+2])),n){case Fi:case zi:h=t[a+1],l=t[a+2],rr(e,h,l),a+=3;break;case Ni:r=t[a+5],o=t[a+6],$i(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,ur),sr(e,ur),h=r,l=o,a+=7;break;case Yi:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],Zi(h,l,s,i,r,o,ur),sr(e,ur),h=r,l=o,a+=5;break;case Xi:a+=1;break;case Ui:h=t[a+1],l=t[a+2],nr(e,h,l,t[a+3],t[a+4]),a+=5;break;case ji:case Vi:h=t[a+1],l=t[a+2],nr(e,h,l,t[a+3],t[a+4]),a+=n===ji?9:6;break;case Hi:er(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],ur,pr),0===a?ir(e,ur):sr(e,ur),h=pr.x,l=pr.y,a+=9;break;case Gi:h=t[a+1],l=t[a+2],dr=t[a+3],cr=t[a+4],nr(e,h-dr,l-cr,2*dr,2*cr),h+=dr,a+=5;break;case qi:tr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ur,pr),0===a?ir(e,ur):sr(e,ur),h=pr.x,l=pr.y,a+=7;break;case Qi:h=t[a+1],l=t[a+2],lr=t[a+3],nr(e,h-lr,l-lr,2*lr,2*lr),h+=lr,a+=4;break;case Ji:Ki(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ur,pr),0===a?ir(e,ur):sr(e,ur),h=pr.x,l=pr.y,a+=6;break;default:return void hr.error(`command: ${n} [index:${a}]`,t)}}},{M:fr,L:yr,Z:mr}=fe,{getCenterX:xr,getCenterY:wr}=q,{arcTo:vr}=oi,br={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;n<g;){switch(i=t[n],i){case fr:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===yr?(c=t[n+1],u=t[n+2],f.push(fr,xr(l,c),wr(d,u))):f.push(fr,l,d);break;case yr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case yr:vr(f,a,h,t[n+1],t[n+2],e,_,p);break;case mr:vr(f,a,h,l,d,e,_,p);break;default:f.push(yr,a,h)}_=a,p=h;break;case mr:r!==mr&&(vr(f,l,d,c,u,e,_,p),f.push(mr)),n+=1;break;default:o=be[i];for(let e=0;e<o;e++)f.push(t[n+e]);n+=o}r=i}return i!==mr&&(f[1]=l,f[2]=d),f}};function Br(t){return new bi(t)}const kr=Br();pe.creator=Br(),pe.parse=Ws.parse,pe.convertToCanvasData=Ws.toCanvasData;const{drawRoundRect:Sr}=Be;function Rr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Sr(this,t,e,s,i,r)})}(t)}const Cr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Pr.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Pr=Cr;Pr.alphaPixelTypes.forEach(t=>Pr.upperCaseTypeMap[t]=t.toUpperCase());const Tr=Dt.get("TaskProcessor");class Er{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Tr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Or{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e){let s,i,r,n;const a=new Er(t);return a.parent=this,l(e)?n=e:e&&(i=e.parallel,s=e.start,r=e.time,n=e.delay),r&&(a.time=r),!1===i&&(a.parallel=!1),o(n)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},n)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Lr=Dt.get("Resource"),Ar={tasker:new Or,map:{},get isComplete(){return Ir.tasker.isComplete},set(t,e){Ir.map[t]&&Lr.repeat(t),Ir.map[t]=e},get:t=>Ir.map[t],remove(t){const e=Ir.map[t];e&&(e.destroy&&e.destroy(),delete Ir.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return a(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=Vt.image(i)),Ir.set(t,e),e},destroy(){Ir.map={}}},Ir=Ar,Mr={maxRecycled:10,recycledList:[],patternTasker:new Or,get(t){let e=Ar.get(t.url);return e||Ar.set(t.url,e=Vt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Wr.recycledList.push(t)})},clearRecycled(){const t=Wr.recycledList;t.length>Wr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Ar.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Cr.alphaPixelTypes.some(e=>Wr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Cr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Cr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Wr.recycledList=[]}},Wr=Mr,{IMAGE:Dr,create:Fr}=e,{floor:zr,max:Nr}=Math;class Yr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Fr(Dr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Mr.isFormat("svg",t)&&(this.isSVG=!0),Mr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,s){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:s}=t.origin,i=this.config.showProgress&&s&&this.onProgress.bind(this);i&&(e=s),Ar.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,i).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,s,i,r,o,n,a){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=t.origin.createCanvas(Nr(zr(e+(o||0)),1),Nr(zr(s+(n||0)),1)),l=h.getContext("2d");return i&&(l.globalAlpha=i),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,s,i,r){const o=t.canvas.createPattern(e,s);try{i&&o.setTransform&&(o.setTransform(i),i=void 0)}catch(t){}return r&&f.stintSet(r,"transform",i),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Xr(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Ur(t,e){return Object.getOwnPropertyDescriptor(t,e)}function jr(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function Vr(t,e){return(s,i)=>Gr(s,i,t,e&&e(i))}function Hr(t){return t}function Gr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Xr(t,e,Object.assign(r,i||{})),bo(t,e,s)}function qr(t){return Vr(t)}function Qr(t,e){return Vr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Jr(t,e){return Vr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function $r(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),so(this))}}))}function Zr(t,e){return Vr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Kr(t,e){return Vr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function to(t,e){return Vr(t,t=>({set(s){this.__setAttr(t,s,e)&&so(this)}}))}function eo(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(so(this),this.__.__removeNaturalSize())}}))}function so(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function io(t){return Vr(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),so(this)}}))}const ro=to;function oo(t,e){return Vr(t,t=>({set(s){this.__setAttr(t,s)&&(no(this),e&&(this.__.__useStroke=!0))}}))}function no(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&so(t)}const ao=oo;function ho(t){return Vr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function lo(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function co(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&_o(this)}}))}function uo(t){return Vr(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>po(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");po(this,t,e,s),this.mask&&_o(this)}}))}function _o(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function po(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||so(t))}function go(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function fo(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function yo(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function mo(t){return Vr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Dt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function xo(t){return Vr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function wo(t){return(e,s)=>{Xr(e,"__DataProcessor",{get:()=>t})}}function vo(t){return(e,s)=>{Xr(e,"__LayoutProcessor",{get:()=>t})}}function bo(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=jr(e,s);if(o(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){const t=this[r];return null==t?s(this.__leaf):t};else if(_(s)){const t=g(s);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:f.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,d=i;for(;!l&&d;)l=Ur(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[n]&&(a.set=i[n],delete i[n]),Xr(i,e,a)}const Bo=new Dt("rewrite"),ko=[],So=["destroy","constructor"];function Ro(t){return(e,s)=>{ko.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Co(){return t=>{Po()}}function Po(t){ko.length&&(ko.forEach(e=>{t&&Bo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),ko.length=0)}function To(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(So.includes(i)||e&&e.includes(i)))if(t.prototype){Ur(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Eo(){return t=>{Gt.register(t)}}function Oo(){return t=>{Jt.register(t)}}setTimeout(()=>Po(!0));const{copy:Lo,toInnerPoint:Ao,toOuterPoint:Io,scaleOfOuter:Mo,rotateOfOuter:Wo,skewOfOuter:Do,multiplyParent:Fo,divideParent:zo,getLayout:No}=D,Yo={},{round:Xo}=Math,Uo={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Ho(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)Vo(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Go(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Go(t),t.__updateChange()},updateAllChange(t){if(Qo(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)qo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,s,i,r,o,n){r||(r=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?s.copyWorldByReset(i,r,e.__nowWorld,o,n):s.copyWorldToInner(i,r,e.__layout.renderBounds,o)},moveWorld(t,e,s=0,i,r){const o=_(e)?Object.assign({},e):{x:e,y:s};i?Io(t.localTransform,o,o,!0):t.parent&&Ao(t.parent.scrollWorldTransform,o,o,!0),jo.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){_(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Xo(e),s=Xo(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){jo.zoomOfLocal(t,Jo(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(l(i)||(i&&(o=i),i=s),Lo(Yo,n),Mo(Yo,e,s,i),jo.hasHighPosition(t))jo.setTransform(t,Yo,r,o);else{const e=t.x+Yo.e-n.e,a=t.y+Yo.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){jo.rotateOfLocal(t,Jo(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Lo(Yo,r),Wo(Yo,e,s),jo.hasHighPosition(t)?jo.setTransform(t,Yo,!1,i):t.set({x:t.x+Yo.e-r.e,y:t.y+Yo.f-r.f,rotation:b.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){jo.skewOfLocal(t,Jo(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Lo(Yo,t.__localMatrix),Do(Yo,e,s,i),jo.setTransform(t,Yo,r,o)},transformWorld(t,e,s,i){Lo(Yo,t.worldTransform),Fo(Yo,e),t.parent&&zo(Yo,t.parent.scrollWorldTransform),jo.setTransform(t,Yo,s,i)},transform(t,e,s,i){Lo(Yo,t.localTransform),Fo(Yo,e),jo.setTransform(t,Yo,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&jo.getInnerOrigin(t,r.origin),n=No(e,o,r.around&&jo.getInnerOrigin(t,r.around));if(jo.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Pt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=jo.getInnerOrigin(t,r.origin);q.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return Mo(s,jo.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>q.tempToOuterOf(jo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return ht.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Lo(Yo,t.worldTransform),zo(Yo,e.scrollWorldTransform),s?Yo:Object.assign({},Yo)),drop(t,e,s,i){t.setTransform(jo.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||jo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,s,i=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)e.move(s);else{const r=s.x*i,o=s.y*i;s.x-=r,s.y-=o,e.move(r,o),t.requestRender(()=>jo.animateMove(e,s,i))}}},jo=Uo,{updateAllMatrix:Vo,updateMatrix:Ho,updateAllWorldOpacity:Go,updateAllChange:qo,updateChange:Qo}=jo;function Jo(t,e){return t.updateLayout(),t.parent?q.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const $o={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>Ko(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Ko(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>Ko(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Zo;function Ko(t,e){return e||(Zo=0),t.__.mask&&(Zo=1),Zo<0?null:(Zo&&(Zo=-1),!0)}const{updateBounds:tn}=Uo,en={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),sn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&o(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)rn(e[t],e)},updateBounds(t,e){const s=[t];rn(t,s),on(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)tn(i[t]);e&&e===s||tn(s)}}},{pushAllChildBranch:sn,pushAllBranchStack:rn,updateBoundsByBranchStack:on}=en,nn={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:an,updateBounds:hn}=Uo,{toOuterOf:ln,getPoints:dn,copy:cn}=Pt,un="_localContentBounds",_n="_worldContentBounds",pn="_worldBoxBounds",gn="_worldStrokeBounds";class fn{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return ln(this.contentBounds,this.leaf.__localMatrix,this[un]||(this[un]={})),this[un]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ln(this.contentBounds,this.leaf.__world,this[_n]||(this[_n]={})),this[_n]}get worldBoxBounds(){return ln(this.boxBounds,this.leaf.__world,this[pn]||(this[pn]={})),this[pn]}get worldStrokeBounds(){return ln(this.strokeBounds,this.leaf.__world,this[gn]||(this[gn]={})),this[gn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:s}=e;if(e.isApp)return hn(e);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=e;for(;s.parent&&!s.parent.leafer;)s=s.parent;const i=s;if(i.__fullLayouting)return;i.__fullLayouting=!0,t.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return D.defaultMatrix;case"page":t=e.zoomLayer;default:return an(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=D.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=an(i,e,!0)}if(n||(n=D.getLayout(o)),cn(n,a),q.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=dn(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:r=e}return o(r)||i.forEach(t=>s.innerToWorld(t,null,!1,r)),i}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class yn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class mn extends yn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}mn.ADD="child.add",mn.REMOVE="child.remove",mn.CREATED="created",mn.MOUNTED="mounted",mn.UNMOUNTED="unmounted",mn.DESTROY="destroy";const xn="property.scroll";class wn extends yn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}wn.CHANGE="property.change",wn.LEAFER_CHANGE="property.leafer_change",wn.SCROLL=xn;const vn={scrollX:xn,scrollY:xn};class bn extends yn{constructor(t,e){super(t),Object.assign(this,e)}}bn.LOAD="image.load",bn.LOADED="image.loaded",bn.ERROR="image.error";class Bn extends yn{static checkHas(t,e,s){"on"===s?e===Cn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(kn)||t.hasEvent(Sn)||t.hasEvent(Rn),t.__hasWorldEvent=t.hasEvent(Cn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(kn,t),"inner"===e&&t.emit(Sn,t)),t.emit(Rn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Cn,this)}}Bn.RESIZE="bounds.resize",Bn.INNER="bounds.inner",Bn.LOCAL="bounds.local",Bn.WORLD="bounds.world";const{RESIZE:kn,INNER:Sn,LOCAL:Rn,WORLD:Cn}=Bn,Pn={};[kn,Sn,Rn,Cn].forEach(t=>Pn[t]=1);class Tn extends yn{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){_(t)?(super(Tn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Tn.RESIZE="resize";class En extends yn{constructor(t,e){super(t),this.data=e}}En.REQUEST="watch.request",En.DATA="watch.data";class On extends yn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}On.REQUEST="layout.request",On.START="layout.start",On.BEFORE="layout.before",On.LAYOUT="layout",On.AFTER="layout.after",On.AGAIN="layout.again",On.END="layout.end";class Ln extends yn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Ln.REQUEST="render.request",Ln.CHILD_START="render.child_start",Ln.CHILD_END="render.child_end",Ln.START="render.start",Ln.BEFORE="render.before",Ln.RENDER="render",Ln.AFTER="render.after",Ln.AGAIN="render.again",Ln.END="render.end",Ln.NEXT="render.next";class An extends yn{}An.START="leafer.start",An.BEFORE_READY="leafer.before_ready",An.READY="leafer.ready",An.AFTER_READY="leafer.after_ready",An.VIEW_READY="leafer.view_ready",An.VIEW_COMPLETED="leafer.view_completed",An.STOP="leafer.stop",An.RESTART="leafer.restart",An.END="leafer.end",An.UPDATE_MODE="leafer.update_mode",An.TRANSFORM="leafer.transform",An.MOVE="leafer.move",An.SCALE="leafer.scale",An.ROTATE="leafer.rotate",An.SKEW="leafer.skew";const{MOVE:In,SCALE:Mn,ROTATE:Wn,SKEW:Dn}=An,Fn={x:In,y:In,scaleX:Mn,scaleY:Mn,rotation:Wn,skewX:Dn,skewY:Dn},zn={};class Nn{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)u(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,o;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Yn(this,i,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=n[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):n[t]=[l],Pn[t]&&Bn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=a(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Yn(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],Pn[t]&&Bn.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&Jt.has(t)&&(e=Jt.get(t,{type:t,target:this,current:this}));const i=Yn(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:i}=this,r=s&&s[t],n=i&&i[t];return!!(o(e)?r||n:e?n:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Yn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:zn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:zn)}}const{on:Xn,on_:Un,off:jn,off_:Vn,once:Hn,emit:Gn,emitEvent:qn,hasEvent:Qn,destroy:Jn}=Nn.prototype,$n={on:Xn,on_:Un,off:jn,off_:Vn,once:Hn,emit:Gn,emitEvent:qn,hasEvent:Qn,destroyEventer:Jn},Zn=Dt.get("setAttr"),Kn={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||o(e)||(Zn.warn(this.innerName,t,e),e=void 0),_(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new wn(wn.LEAFER_CHANGE,this,t,i,e));const s=Fn[t];s&&(this.emitEvent(new An(s,this)),this.emitEvent(new An(An.TRANSFORM,this)))}this.emitPropertyEvent(wn.CHANGE,t,i,e);const s=vn[t];return s&&this.emitPropertyEvent(s,t,i,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new wn(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||o(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ta,multiplyParent:ea,translateInner:sa,defaultWorld:ia}=D,{toPoint:ra,tempPoint:oa}=ht,na={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;ea(this.__local||e,t?t.__scrollWorld||t.__world:ia,s,!!e.affectScaleOrRotation,r),i&&sa(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ta(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(ra(s.around||s.origin,t.boxBounds,oa),sa(e,-oa.x,-oa.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:aa,updateAllMatrix:ha}=Uo,{updateBounds:la}=en,{toOuterOf:da,copyAndSpread:ca,copy:ua}=Pt,{toBounds:_a}=gr,pa={__updateWorldBounds(){const t=this.__layout;da(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Bn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Bn.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),da(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){da(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){da(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?_a(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ha(this),la(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ha(this),la(this,this))):aa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ca(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?ca(e.renderBounds,e.boxBounds,e.renderSpread):ua(e.renderBounds,e.strokeBounds)}},ga={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),Uo.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Dt.showBounds&&Dt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:fa}=$o,ya={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)fa(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)fa(s[i],e)||s[i].__clip(t,e)}}},ma={},{LEAF:xa,create:wa}=e,{toInnerPoint:va,toOuterPoint:ba,multiplyParent:Ba}=D,{toOuterOf:ka}=Pt,{copy:Sa,move:Ra}=q,{moveLocal:Ca,zoomOfLocal:Pa,rotateOfLocal:Ta,skewOfLocal:Ea,moveWorld:Oa,zoomOfWorld:La,rotateOfWorld:Aa,skewOfWorld:Ia,transform:Ma,transformWorld:Wa,setTransform:Da,getFlipTransform:Fa,getLocalOrigin:za,getRelativeWorld:Na,drop:Ya}=Uo;let Xa=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return fn}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=wa(xa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(mn.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(mn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(mn.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(mn.MOUNTED)):this.__emitLifeEvent(mn.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Ba(s,t.matrix,e,void 0,s),ka(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:i}=Mr.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),ma.scaleX=s,ma.scaleY=i,ma}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?Na(this,e):this.worldTransform,r=s?t:{};return ka(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Sa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Sa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),va(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){ba(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Ra(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Ra(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){Da(this,t,e,s)}transform(t,e,s){Ma(this,t,e,s)}move(t,e,s){Ca(this,t,e,s)}moveInner(t,e,s){Oa(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Pa(this,za(this,t),e,s,i,r)}rotateOf(t,e,s){Ta(this,za(this,t),e,s)}skewOf(t,e,s,i,r){Ea(this,za(this,t),e,s,i,r)}transformWorld(t,e,s){Wa(this,t,e,s)}moveWorld(t,e,s){Oa(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){La(this,t,e,s,i,r)}rotateOfWorld(t,e){Aa(this,t,e)}skewOfWorld(t,e,s,i,r){Ia(this,t,e,s,i,r)}flip(t,e){Ma(this,Fa(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return jt.need("path")}getMotionPoint(t){return jt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Ya(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):bo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=to),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new mn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(mn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};Xa=Kt([To(Kn),To(na),To(pa),To($n),To(ga)],Xa);const{setListWithFn:Ua}=Pt,{sort:ja}=en,{localBoxBounds:Va,localStrokeBounds:Ha,localRenderBounds:Ga,maskLocalBoxBounds:qa,maskLocalStrokeBounds:Qa,maskLocalRenderBounds:Ja}=$o,$a=new Dt("Branch");let Za=class extends Xa{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){Ua(e||this.__layout.boxBounds,this.children,this.__hasMask?qa:Va)}__updateStrokeBounds(t){Ua(t||this.__layout.strokeBounds,this.children,this.__hasMask?Qa:Ha)}__updateRenderBounds(t){Ua(t||this.__layout.renderBounds,this.children,this.__hasMask?Ja:Ga)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(ja),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return $a.warn("add self or destroyed");const s=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),s||e++});t=Gt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const i=t.__layout;i.boxChanged||i.boxChange(),i.matrixChanged||i.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(mn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(mn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(mn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(mn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new mn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Za=Kt([To(ya)],Za);class Ka{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:s}=this;o(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(o(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)o(s)?e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]):this.keys[e[i].innerId]=i-1;o(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Ka;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class th{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const eh="1.9.6";class sh extends _e{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let s=e.view||e.canvas;s?(a(s)?("#"!==s[0]&&(s="#"+s),this.viewSelect=t.miniapp.select(s)):s.fields?this.viewSelect=s:this.initView(s),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:s,height:i,pixelRatio:r}=this.config,o={width:s||e.width,height:i||e.height,pixelRatio:r};this.resize(o),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,s,i,r){this.context.roundRect(t,e,s,i,l(r)?[r]:r)}),Rr(this.context.__proto__))}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:s}=this;this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,s){this.resizeListener||(this.resizeListener=s,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:s}=this,i={width:t,height:e,pixelRatio:s};this.isSameSize(i)||this.emitResize(i)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};f.copyAttrs(e,this,ue),this.resize(t),o(this.width)||this.resizeListener(new Tn(t,e))}}const{mineType:ih,fileType:rh}=Cr;function oh(e,s){t.origin={createCanvas:(t,e,i)=>{const r={type:"2d",width:t,height:e};return s.createOffscreenCanvas?s.createOffscreenCanvas(r):s.createOffScreenCanvas(r)},canvasToDataURL:(t,e,s)=>t.toDataURL(ih(e),s),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(e,s,i)=>{let r=e.toDataURL(ih(rh(s)),i);return r=r.substring(r.indexOf("64,")+3),t.origin.download(r,s)},download:(e,i)=>new Promise((r,o)=>{let n;i.includes("/")||(i=`${s.env.USER_DATA_PATH}/`+i,n=!0);const a=s.getFileSystemManager();a.writeFile({filePath:i,data:e,encoding:"base64",success(){n?t.miniapp.saveToAlbum(i).then(()=>{a.unlink({filePath:i}),r()}):r()},fail(t){o(t)}})}),loadImage:e=>new Promise((s,i)=>{const r=t.canvas.view.createImage();r.onload=()=>{s(r)},r.onerror=t=>{i(t)},r.src=t.image.getRealURL(e)}),noRepeat:"repeat-x"},t.miniapp={select:t=>s.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const s=t[1];e({x:s.top,y:s.left,width:s.width,height:s.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const s=t[0];e({view:s.node,width:s.width,height:s.height})})}),saveToAlbum:t=>new Promise(e=>{s.getSetting({success:i=>{i.authSetting["scope.writePhotosAlbum"]?s.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):s.authorize({scope:"scope.writePhotosAlbum",success:()=>{s.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){s.onWindowResize(t)},offWindowResize(t){s.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=Vt.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(Vt,{canvas:(t,e)=>new sh(t,e),image:t=>new Yr(t)}),t.name="miniapp",t.requestRender=function(e){const{view:s}=t.renderCanvas||t.canvas;s.requestAnimationFrame?s.requestAnimationFrame(e):setTimeout(e,16)},Xr(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class nh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ka;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new Ka,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Ln.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===mn.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new En(En.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ka,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[wn.CHANGE,this.__onAttrChange,this],[[mn.ADD,mn.REMOVE],this.__onChildEvent,this],[En.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:ah,updateBounds:hh,updateChange:lh}=Uo,{pushAllChildBranch:dh,pushAllParent:ch}=en;const{worldBounds:uh}=$o;class _h{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,u(t)&&(t=new Ka(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,uh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,uh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:ph,updateAllChange:gh}=Uo,fh=Dt.get("Layouter");class yh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new th,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(On.START),this.layoutOnce(),t.emitEvent(new On(On.END,this.layoutedBlocks,this.times))}catch(t){fh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?fh.warn("layouting"):this.times>3?fh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(En.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Yt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=On,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new On(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(ah(t,!0),e.add(t),t.isBranch&&dh(t,e),ch(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ch(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||hh(i[t])}hh(s)}})}(this.__levelList),function(t){t.list.forEach(lh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new On(o,a,this.times)),s.emitEvent(new On(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Yt.end(e)}fullLayout(){const t=Yt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=On,o=this.getBlocks(new Ka(e));e.emitEvent(new On(s,o,this.times)),yh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new On(i,o,this.times)),e.emitEvent(new On(r,o,this.times)),this.addBlocks(o),Yt.end(t)}static fullLayout(t){ph(t,!0),t.isBranch?en.updateBounds(t):Uo.updateBounds(t),gh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new _h([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new _h(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[On.REQUEST,this.layout,this],[On.AGAIN,this.layoutAgain,this],[En.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const mh=Dt.get("Renderer");class xh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=t,this.canvas=e,s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(On.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Ln.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Ln.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Ln.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,mh.log(e.innerName,"---\x3e");try{this.emitRender(Ln.START),this.renderOnce(t),this.emitRender(Ln.END,this.totalBounds),Mr.clearRecycled()}catch(t){this.rendering=!1,mh.error(t)}mh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return mh.warn("rendering");if(this.times>3)return mh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Ln.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Ln.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Ln.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Ln.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Yt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Lt(i);s.save(),i.spread(xh.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),Yt.end(e)}fullRender(){const t=Yt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Yt.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Dt.showRepaint&&Dt.drawRepaint(s,t),this.target.__render(s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const s=this.requestTime=Date.now(),i=()=>{const e=1e3/(Date.now()-s),{maxFPS:r}=this.config;if(r&&e>r-.5)return t.requestRender(i);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Lt(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||mh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Ln(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Ln.REQUEST,this.update,this],[On.END,this.__onLayoutEnd,this],[Ln.AGAIN,this.renderAgain,this],[Tn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function wh(t){return Vr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function vh(t){return Vr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function bh(){return(t,e)=>{const s="_"+e;Xr(t,e,{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 Bh(t){return(e,s)=>{Xr(e,s,jr(s,t))}}xh.clipSpread=10,Object.assign(Vt,{watcher:(t,e)=>new nh(t,e),layouter:(t,e)=>new yh(t,e),renderer:(t,e,s)=>new xh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),t.layout=yh.fullLayout;const kh={},Sh={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}},Rh={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Ch={},Ph={},Th={},Eh={},Oh={},Lh={apply(){jt.need("filter")}},Ah={},Ih={setStyleName:()=>jt.need("state"),set:()=>jt.need("state")},Mh={list:{},register(t,e){Mh.list[t]=e},get:t=>Mh.list[t]},{parse:Wh,objectToCanvasData:Dh}=Ws,{stintSet:Fh}=f,{hasTransparent:zh}=Sh,Nh={},Yh=Dt.get("UIData");class Xh extends m{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!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,Yh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Yh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Fh(this,"__isTransparentFill",zh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Fh(this,"__isTransparentStroke",zh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?Wh(t):Dh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Uh(this,"shadow",t)}setInnerShadow(t){Uh(this,"innerShadow",t)}setFilter(t){Uh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ph.compute("fill",this.__leaf),e&&Ph.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Nh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Nh))}__removePaint(t,e){e&&this.__removeInput(t),Th.recycleImage(t,this),"fill"===t?(Fh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Fh(this,"__isAlphaPixelStroke",void 0),Fh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Uh(t,e,s){t.__setInput(e,s),u(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class jh extends Xh{}class Vh extends jh{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 Hh extends jh{__getInputData(t,e){const s=super.__getInputData(t,e);return ue.forEach(t=>delete s[t]),s}}class Gh extends Vh{}class qh extends Xh{get __usePathBox(){return this.points||this.__pathInputed}}class Qh extends Xh{get __boxStroke(){return!this.__pathInputed}}class Jh extends Xh{get __boxStroke(){return!this.__pathInputed}}class $h extends qh{}class Zh extends Xh{}class Kh extends Xh{get __pathInputed(){return 2}}class tl extends jh{}const el={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class sl extends Xh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=el[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=Gt.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class il extends Qh{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 s=super.__getInputData(t,e);return delete s.fill,s}}class rl extends Qh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const ol={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__;e&&(t=Oh.getShadowSpread(this,e)),i&&(t=Math.max(t,i)),o&&(t+=Lh.getSpread(o)),n&&(t+=n);let a=t=Math.ceil(t);return s&&s.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)),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{float:nl}=b,al=new Lt,hl=new Lt,ll=new Lt,dl={limitMove(t,e){const{dragBounds:s,dragBoundsType:i}=t;s&&cl.getValidMove(t.__localBoxBounds,cl.getDragBounds(t),i,e,!0),cl.axisMove(t,e)},limitScaleOf(t,e,s){const{dragBounds:i,dragBoundsType:r}=t;i&&cl.getValidScaleOf(t.__localBoxBounds,cl.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),s,!0)},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,s,i)=>"inner"===s||"auto"===s&&t[i]>e[i],getValidMove(t,e,s,i,r){const o=t.x+i.x,n=t.y+i.y,a=o+t.width,h=n+t.height,l=e.x+e.width,d=e.y+e.height;return r||(i=Object.assign({},i)),cl.isInnerMode(t,e,s,"width")?o>e.x?i.x+=e.x-o:a<l&&(i.x+=l-a):o<e.x?i.x+=e.x-o:a>l&&(i.x+=l-a),cl.isInnerMode(t,e,s,"height")?n>e.y?i.y+=e.y-n:h<d&&(i.y+=d-h):n<e.y?i.y+=e.y-n:h>d&&(i.y+=d-h),i.x=nl(i.x),i.y=nl(i.y),i},getValidScaleOf(t,e,s,i,r,o){let n,a;return o||(r=Object.assign({},r)),al.set(t).scaleOf(i,r.x,r.y).unsign(),hl.set(al).add(e),ll.set(al).intersect(e),n=cl.isInnerMode(t,e,s,"width")?hl.width/al.width:ll.width/al.width,a=cl.isInnerMode(t,e,s,"height")?hl.height/al.height:ll.height/al.height,r.x=nl(ll.width)?r.x*n:1,r.y=nl(ll.height)?r.y*a:1,r}},cl=dl,{stintSet:ul}=f,_l={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);ul(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),ul(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;ul(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Oh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(u(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),ul(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){pl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Ph.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Oh.shadow(this,t,h),a&&(i.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t)),r&&(i.__isFills?Ph.fills(r,this,t):Ph.fill(r,this,t)),n&&this.__drawAfterFill(t,e),d&&Oh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t)),c&&Lh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Sh.string(e.color))}r&&(i.__isFills?Ph.fills(r,this,t):Ph.fill(r,this,t)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t))}}else i.__pathInputed?pl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Ph.fills(i,this,t):Ph.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Ph.strokes(r,this,t):Ph.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 pl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&Ph.stroke(r,t,e),i&&Ph.fill(i,t,e),o&&t.__drawAfterFill(e,s),r&&!n&&Ph.stroke(r,t,e)}const gl={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var fl;let yl=fl=class extends Xa{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){b.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 kr.set(this.path=t||[]),t||this.__drawPathByBox(kr),kr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return jt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return jt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(kr.set(s=[]),this.__drawPathByBox(kr)),t?Ws.toCanvasData(s,!0):s}getPathString(t,e,s){return Ws.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Ah.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?br.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ch.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)}__drawPathByData(t,e){e?Di.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,l(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e){Ph.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return this.set(t),jt.need("animate")}killAnimate(t,e){}export(t,e){return jt.need("export")}syncExport(t,e){return jt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),fl.one(e)}static one(t,e,s,i,r){return Gt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Eo()(this)}static registerData(t){wo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};Kt([wo(Xh)],yl.prototype,"__",void 0),Kt([bh()],yl.prototype,"zoomLayer",void 0),Kt([qr("")],yl.prototype,"id",void 0),Kt([qr("")],yl.prototype,"name",void 0),Kt([qr("")],yl.prototype,"className",void 0),Kt([lo("pass-through")],yl.prototype,"blendMode",void 0),Kt([co(1)],yl.prototype,"opacity",void 0),Kt([uo(!0)],yl.prototype,"visible",void 0),Kt([lo(!1)],yl.prototype,"locked",void 0),Kt([lo(!1)],yl.prototype,"dim",void 0),Kt([lo(!1)],yl.prototype,"dimskip",void 0),Kt([go(0)],yl.prototype,"zIndex",void 0),Kt([fo(!1)],yl.prototype,"mask",void 0),Kt([yo(!1)],yl.prototype,"eraser",void 0),Kt([Qr(0,!0)],yl.prototype,"x",void 0),Kt([Qr(0,!0)],yl.prototype,"y",void 0),Kt([to(100,!0)],yl.prototype,"width",void 0),Kt([to(100,!0)],yl.prototype,"height",void 0),Kt([Zr(1,!0)],yl.prototype,"scaleX",void 0),Kt([Zr(1,!0)],yl.prototype,"scaleY",void 0),Kt([Kr(0,!0)],yl.prototype,"rotation",void 0),Kt([Kr(0,!0)],yl.prototype,"skewX",void 0),Kt([Kr(0,!0)],yl.prototype,"skewY",void 0),Kt([Qr(0,!0)],yl.prototype,"offsetX",void 0),Kt([Qr(0,!0)],yl.prototype,"offsetY",void 0),Kt([Jr(0,!0)],yl.prototype,"scrollX",void 0),Kt([Jr(0,!0)],yl.prototype,"scrollY",void 0),Kt([$r()],yl.prototype,"origin",void 0),Kt([$r()],yl.prototype,"around",void 0),Kt([qr(!1)],yl.prototype,"lazy",void 0),Kt([eo(1)],yl.prototype,"pixelRatio",void 0),Kt([ho(0)],yl.prototype,"renderSpread",void 0),Kt([io()],yl.prototype,"path",void 0),Kt([ro()],yl.prototype,"windingRule",void 0),Kt([ro(!0)],yl.prototype,"closed",void 0),Kt([to(0)],yl.prototype,"padding",void 0),Kt([to(!1)],yl.prototype,"lockRatio",void 0),Kt([to()],yl.prototype,"widthRange",void 0),Kt([to()],yl.prototype,"heightRange",void 0),Kt([qr(!1)],yl.prototype,"draggable",void 0),Kt([qr()],yl.prototype,"dragBounds",void 0),Kt([qr("auto")],yl.prototype,"dragBoundsType",void 0),Kt([qr(!1)],yl.prototype,"editable",void 0),Kt([mo(!0)],yl.prototype,"hittable",void 0),Kt([mo("path")],yl.prototype,"hitFill",void 0),Kt([ao("path")],yl.prototype,"hitStroke",void 0),Kt([mo(!1)],yl.prototype,"hitBox",void 0),Kt([mo(!0)],yl.prototype,"hitChildren",void 0),Kt([mo(!0)],yl.prototype,"hitSelf",void 0),Kt([mo()],yl.prototype,"hitRadius",void 0),Kt([xo("")],yl.prototype,"cursor",void 0),Kt([lo()],yl.prototype,"fill",void 0),Kt([ao(void 0,!0)],yl.prototype,"stroke",void 0),Kt([ao("inside")],yl.prototype,"strokeAlign",void 0),Kt([ao(1,!0)],yl.prototype,"strokeWidth",void 0),Kt([ao(!1)],yl.prototype,"strokeWidthFixed",void 0),Kt([ao("none")],yl.prototype,"strokeCap",void 0),Kt([ao("miter")],yl.prototype,"strokeJoin",void 0),Kt([ao()],yl.prototype,"dashPattern",void 0),Kt([ao(0)],yl.prototype,"dashOffset",void 0),Kt([ao(10)],yl.prototype,"miterLimit",void 0),Kt([ro(0)],yl.prototype,"cornerRadius",void 0),Kt([ro()],yl.prototype,"cornerSmoothing",void 0),Kt([wh()],yl.prototype,"shadow",void 0),Kt([wh()],yl.prototype,"innerShadow",void 0),Kt([wh()],yl.prototype,"blur",void 0),Kt([wh()],yl.prototype,"backgroundBlur",void 0),Kt([wh()],yl.prototype,"grayscale",void 0),Kt([wh()],yl.prototype,"filter",void 0),Kt([lo()],yl.prototype,"placeholderColor",void 0),Kt([qr(100)],yl.prototype,"placeholderDelay",void 0),Kt([qr({})],yl.prototype,"data",void 0),Kt([Ro(Xa.prototype.reset)],yl.prototype,"reset",null),yl=fl=Kt([To(ol),To(_l),Co()],yl);let ml=class extends yl{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:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}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 xl;Kt([wo(jh)],ml.prototype,"__",void 0),Kt([to(0)],ml.prototype,"width",void 0),Kt([to(0)],ml.prototype,"height",void 0),ml=Kt([To(Za),Eo()],ml);const wl=Dt.get("Leafer");let vl=xl=class extends ml{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Ar.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)||{x:0,y:0,width:0,height:0}}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),xl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(i,t));const r=this.canvas=Vt.canvas(i);this.__controllers.push(this.renderer=Vt.renderer(this,r,i),this.watcher=Vt.watcher(this,i),this.layouter=Vt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=Vt.selector(this),this.interaction=Vt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Vt.hitCanvasManager()),this.canvasManager=new Zt,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),nn.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(An.RESTART):this.emitLeafer(An.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(An.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,ue);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.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 s=f.copyAttrs({},this.canvas,ue);e.resize(t),this.updateLazyBounds(),this.__onResize(new Tn(t,s))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ue),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 It(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ue.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(An.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ue.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=f.copyAttrs({},i,ue);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(An.BEFORE_READY),this.emitLeafer(An.READY),this.emitLeafer(An.AFTER_READY),nn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(An.VIEW_READY),nn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){nn.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(An.VIEW_COMPLETED),nn.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,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return jt.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new An(t,this))}__listenEvents(){const t=Yt.start("FirstCreate "+this.innerName);this.once([[An.START,()=>Yt.end(t)],[On.START,this.updateLazyBounds,this],[Ln.START,this.__onCreated,this],[Ln.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[En.DATA,this.__onWatchData,this],[On.END,this.__onLayoutEnd,this],[Ln.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){xl.list.remove(this);try{this.stop(),this.emitLeafer(An.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.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Mr.clearRecycled()},100)}catch(t){wl.error(t)}}};t?e():setTimeout(e)}};vl.list=new Ka,Kt([wo(Hh)],vl.prototype,"__",void 0),Kt([to()],vl.prototype,"pixelRatio",void 0),Kt([qr("normal")],vl.prototype,"mode",void 0),vl=xl=Kt([Eo()],vl);let bl=class extends yl{get __tag(){return"Rect"}};Kt([wo(Qh)],bl.prototype,"__",void 0),bl=Kt([To(gl),Co(),Eo()],bl);const{add:Bl,includes:kl,scroll:Sl}=Pt,Rl=bl.prototype,Cl=ml.prototype;let Pl=class extends ml{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 s=this.__,i=this.__layout,{renderBounds:r,boxBounds:o}=i,{overflow:n}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n.includes("scroll"))&&(Bl(a,o),Sl(a,s)),this.__updateRectRenderBounds(),t=!kl(o,a),t&&"show"===n&&Bl(r,a)}else this.__updateRectRenderBounds();f.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))}};Kt([wo(Vh)],Pl.prototype,"__",void 0),Kt([to(100)],Pl.prototype,"width",void 0),Kt([to(100)],Pl.prototype,"height",void 0),Kt([qr(!1)],Pl.prototype,"resizeChildren",void 0),Kt([ho("show")],Pl.prototype,"overflow",void 0),Kt([Ro(Rl.__updateStrokeSpread)],Pl.prototype,"__updateStrokeSpread",null),Kt([Ro(Rl.__updateRenderSpread)],Pl.prototype,"__updateRectRenderSpread",null),Kt([Ro(Rl.__updateBoxBounds)],Pl.prototype,"__updateRectBoxBounds",null),Kt([Ro(Rl.__updateStrokeBounds)],Pl.prototype,"__updateStrokeBounds",null),Kt([Ro(Rl.__updateRenderBounds)],Pl.prototype,"__updateRectRenderBounds",null),Kt([Ro(Rl.__updateChange)],Pl.prototype,"__updateRectChange",null),Kt([Ro(Rl.__render)],Pl.prototype,"__renderRect",null),Kt([Ro(Cl.__render)],Pl.prototype,"__renderGroup",null),Pl=Kt([Co(),Eo()],Pl);let Tl=class extends Pl{get __tag(){return"Frame"}get isFrame(){return!0}};Kt([wo(Gh)],Tl.prototype,"__",void 0),Kt([lo("#FFFFFF")],Tl.prototype,"fill",void 0),Kt([ho("hide")],Tl.prototype,"overflow",void 0),Tl=Kt([Eo()],Tl);const{moveTo:El,closePath:Ol,ellipse:Ll}=oi;let Al=class extends yl{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:s,innerRadius:i,startAngle:r,endAngle:o}=this.__,n=e/2,a=s/2,h=this.__.path=[];i?(r||o?(i<1&&Ll(h,n,a,n*i,a*i,0,r,o,!1),Ll(h,n,a,n,a,0,o,r,!0),i<1&&Ol(h)):(i<1&&(Ll(h,n,a,n*i,a*i),El(h,e,a)),Ll(h,n,a,n,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(El(h,n,a),Ll(h,n,a,n,a,0,r,o,!1),Ol(h)):Ll(h,n,a,n,a)}};Kt([wo(Jh)],Al.prototype,"__",void 0),Kt([ro(0)],Al.prototype,"innerRadius",void 0),Kt([ro(0)],Al.prototype,"startAngle",void 0),Kt([ro(0)],Al.prototype,"endAngle",void 0),Al=Kt([Eo()],Al);const{sin:Il,cos:Ml,PI:Wl}=Math,{moveTo:Dl,lineTo:Fl,closePath:zl,drawPoints:Nl}=oi;let Yl=class extends yl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Nl(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Dl(e,o,0);for(let t=1;t<r;t++)Fl(e,o+o*Il(2*t*Wl/r),n-n*Ml(2*t*Wl/r));zl(e)}}};Kt([wo($h)],Yl.prototype,"__",void 0),Kt([ro(3)],Yl.prototype,"sides",void 0),Kt([ro()],Yl.prototype,"points",void 0),Kt([ro(0)],Yl.prototype,"curve",void 0),Yl=Kt([Co(),Eo()],Yl);const{sin:Xl,cos:Ul,PI:jl}=Math,{moveTo:Vl,lineTo:Hl,closePath:Gl}=oi;let ql=class extends yl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Vl(n,r,0);for(let t=1;t<2*s;t++)Hl(n,r+(t%2==0?r:r*i)*Xl(t*jl/s),o-(t%2==0?o:o*i)*Ul(t*jl/s));Gl(n)}};Kt([wo(Zh)],ql.prototype,"__",void 0),Kt([ro(5)],ql.prototype,"corners",void 0),Kt([ro(.382)],ql.prototype,"innerRadius",void 0),ql=Kt([Eo()],ql);const{moveTo:Ql,lineTo:Jl,drawPoints:$l}=oi,{rotate:Zl,getAngle:Kl,getDistance:td,defaultPoint:ed}=q;let sd=class extends yl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Zl(s,e),s}set toPoint(t){this.width=td(ed,t),this.rotation=Kl(ed,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?$l(e,t.points,t.curve,t.closed):(Ql(e,0,0),Jl(e,this.width,0))}};Kt([wo(qh)],sd.prototype,"__",void 0),Kt([oo("center")],sd.prototype,"strokeAlign",void 0),Kt([to(0)],sd.prototype,"height",void 0),Kt([ro()],sd.prototype,"points",void 0),Kt([ro(0)],sd.prototype,"curve",void 0),Kt([ro(!1)],sd.prototype,"closed",void 0),sd=Kt([Eo()],sd);let id=class extends bl{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}};Kt([wo(il)],id.prototype,"__",void 0),Kt([to("")],id.prototype,"url",void 0),id=Kt([Eo()],id);const rd=id;let od=class extends bl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Vt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Yr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new bn(bn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new et(t.worldTransform).invert(),o=new et;e&&o.translate(e.x,e.y),s&&(l(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};Kt([wo(rl)],od.prototype,"__",void 0),Kt([vh(100)],od.prototype,"width",void 0),Kt([vh(100)],od.prototype,"height",void 0),Kt([vh(1)],od.prototype,"pixelRatio",void 0),Kt([vh(!0)],od.prototype,"smooth",void 0),Kt([qr(!1)],od.prototype,"safeResize",void 0),Kt([vh()],od.prototype,"contextSettings",void 0),od=Kt([Eo()],od);const{copyAndSpread:nd,includes:ad,spread:hd,setList:ld}=Pt;let dd=class extends yl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Rh.number(e,r),t.__letterSpacing=Rh.number(s,r),t.__padding=l?b.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=kh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&hd(a,s/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),f.stintSet(this,"isOverflow",!ad(h,a)),this.isOverflow?(ld(t.__textBoxBounds={},[h,a]),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;nd(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,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Kt([wo(sl)],dd.prototype,"__",void 0),Kt([to(0)],dd.prototype,"width",void 0),Kt([to(0)],dd.prototype,"height",void 0),Kt([lo()],dd.prototype,"boxStyle",void 0),Kt([qr(!1)],dd.prototype,"resizeFontSize",void 0),Kt([lo("#000000")],dd.prototype,"fill",void 0),Kt([oo("outside")],dd.prototype,"strokeAlign",void 0),Kt([mo("all")],dd.prototype,"hitFill",void 0),Kt([to("")],dd.prototype,"text",void 0),Kt([to("")],dd.prototype,"placeholder",void 0),Kt([to("caption")],dd.prototype,"fontFamily",void 0),Kt([to(12)],dd.prototype,"fontSize",void 0),Kt([to("normal")],dd.prototype,"fontWeight",void 0),Kt([to(!1)],dd.prototype,"italic",void 0),Kt([to("none")],dd.prototype,"textCase",void 0),Kt([to("none")],dd.prototype,"textDecoration",void 0),Kt([to(0)],dd.prototype,"letterSpacing",void 0),Kt([to({type:"percent",value:1.5})],dd.prototype,"lineHeight",void 0),Kt([to(0)],dd.prototype,"paraIndent",void 0),Kt([to(0)],dd.prototype,"paraSpacing",void 0),Kt([to("x")],dd.prototype,"writingMode",void 0),Kt([to("left")],dd.prototype,"textAlign",void 0),Kt([to("top")],dd.prototype,"verticalAlign",void 0),Kt([to(!0)],dd.prototype,"autoSizeAlign",void 0),Kt([to("normal")],dd.prototype,"textWrap",void 0),Kt([to("show")],dd.prototype,"textOverflow",void 0),Kt([lo(!1)],dd.prototype,"textEditing",void 0),dd=Kt([Eo()],dd);let cd=class extends yl{get __tag(){return"Path"}};Kt([wo(Kh)],cd.prototype,"__",void 0),Kt([oo("center")],cd.prototype,"strokeAlign",void 0),cd=Kt([Eo()],cd);let ud=class extends ml{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new cd(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,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};function _d(t,e){const s=t.__,{rows:i,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,s=i.length;t<s;t++)o=i[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:o}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,o)))}}function pd(t,e){t.__.__font?_d(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function gd(t,e,s){switch(e.__.strokeAlign){case"center":fd(t,1,e,s);break;case"inside":yd(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?fd(t,2,e,s):yd(t,"outside",e,s)}}function fd(t,e,s,i){const r=s.__;_(t)?xd(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),md(s,i))}function yd(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,fd(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",_d(s,r),r.blendMode="normal",Uo.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function md(t,e){let s,i=t.__.__textDrawData;const{rows:r,decorationY:o}=i;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=i;r.forEach(s=>o.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}}function xd(t,e,s,i,r){let o;const n=i.__,{__hasMultiStrokeStyle:a}=n;a||r.setStroke(void 0,n.__strokeWidth*e,n);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!Th.checkImage(i,r,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?r.setStroke(o.style,n.__getRealStrokeWidth(t)*e,n,t):r.setStroke(o.style,n.__strokeWidth*e,n)}else r.strokeStyle=o.style;o.blendMode?(r.saveBlendMode(o.blendMode),s?md(i,r):r.stroke(),r.restoreBlendMode()):s?md(i,r):r.stroke()}}function wd(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)gd(t,e,s);else switch(i.strokeAlign){case"center":vd(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),vd(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)vd(t,2,e,s);else{const{renderBounds:r}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),vd(t,2,e,o),o.clipUI(i),o.clearWorld(r),Uo.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s)}}function vd(t,e,s,i){const r=s.__;_(t)?xd(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&Ph.strokeArrow(t,s,i)}Kt([wo(tl)],ud.prototype,"__",void 0),Kt([(t,e)=>{Xr(t,e,{get(){return this.__path}})}],ud.prototype,"path",void 0),ud=Kt([To(bi,["set","path","paint"]),Eo()],ud);const{getSpread:bd,getOuterOf:Bd,getByMove:kd,getIntersectData:Sd}=Pt;let Rd;const{stintSet:Cd}=f,{hasTransparent:Pd}=Sh;function Td(t,e,s){if(!_(e)||!1===e.visible||0===e.opacity)return;let i;const{boxBounds:r}=s.__layout;switch(e.type){case"image":i=Th.image(s,t,e,r,!Rd||!Rd[e.url]);break;case"linear":i=Eh.linearGradient(e,r);break;case"radial":i=Eh.radialGradient(e,r);break;case"angular":i=Eh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;i={type:n,style:Sh.string(a,h)};break;default:o(e.r)||(i={type:"solid",style:Sh.string(e)})}if(i){if(a(i.style)&&Pd(i.style)&&(i.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;i.strokeStyle=e.style}e.editing&&(i.editing=e.editing),e.blendMode&&(i.blendMode=e.blendMode)}return i}const Ed={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];u(a)||(a=[a]),Rd=Th.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=Td(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length&&i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(Cd(s,"__isAlphaPixelFill",r),Cd(s,"__isTransparentFill",o)):(Cd(s,"__isAlphaPixelStroke",r),Cd(s,"__isTransparentStroke",o),Cd(s,"__hasMultiStrokeStyle",n))},fill:function(t,e,s){s.fillStyle=t,pd(e,s)},fills:function(t,e,s){let i;for(let r=0,o=t.length;r<o;r++){if(i=t[r],i.image){if(Th.checkImage(e,s,i,!e.__.__font))continue;if(!i.style){!r&&i.image.isPlacehold&&e.drawImagePlaceholder(s,i.image);continue}}if(s.fillStyle=i.style,i.transform||i.scaleFixed){if(s.save(),i.transform&&s.transform(i.transform),i.scaleFixed){const{scaleX:t,scaleY:r}=e.getRenderScaleData(!0);(!0===i.scaleFixed||"zoom-in"===i.scaleFixed&&t>1&&r>1)&&s.scale(1/t,1/r)}i.blendMode&&(s.blendMode=i.blendMode),pd(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),pd(e,s),s.restoreBlendMode()):pd(e,s)}},fillPathOrText:pd,fillText:_d,stroke:wd,strokes:function(t,e,s){wd(t,e,s)},strokeText:gd,drawTextStroke:md,shape:function(e,s,i){const r=s.getSameCanvas(),o=e.__nowWorld,n=s.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=e.getRenderScaleData(!0);if(n.includes(o))c=r,a=d=o;else{const{renderShapeSpread:r}=e.__layout;let p;if(t.fullImageShadow)p=o;else{const t=r?bd(n,u===_?r*u:[r*_,r*u]):n;p=Sd(t,o)}l=n.getFitMatrix(p);let{a:g,d:f}=l;l.a<1&&(c=s.getSameCanvas(),e.__renderShape(c,i),u*=g,_*=f),d=Bd(o,l),a=kd(d,-l.e,-l.f);const y=i.matrix;y?(h=new et(l),h.multiply(y),g*=y.scaleX,f*=y.scaleY):h=l,h.withScale(g,f),i=Object.assign(Object.assign({},i),{matrix:h})}return e.__renderShape(r,i),{canvas:r,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let Od={},Ld={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Ad,rotateOfOuter:Id,translate:Md,scaleOfOuter:Wd,multiplyParent:Dd,scale:Fd,rotate:zd,skew:Nd}=D;function Yd(t,e,s,i,r,o,n){const a=Ad();Md(a,e.x+s,e.y+i),Fd(a,r,o),n&&Id(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function Xd(t,e,s,i,r,o,n,a,h){const l=Ad();jd(l,e,s,i,r,o,n,a),h&&(Ld.a=e.width/h.width,Ld.d=e.height/h.height,Dd(l,Ld)),t.transform=l}function Ud(t,e,s,i,r,o,n,a,h,l,d,c){const u=Ad();if(c)jd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Id(u,{x:s/2,y:i/2},h);else switch(zd(u,h),h){case 90:Md(u,i,0);break;case 180:Md(u,s,i);break;case 270:Md(u,0,s)}Od.x=e.x+r,Od.y=e.y+o,Md(u,Od.x,Od.y),n&&Wd(u,Od,n,a)}t.transform=u}function jd(t,e,s,i,r,o,n,a){n&&zd(t,n),a&&Nd(t,a.x,a.y),r&&Fd(t,r,o),Md(t,e.x+s,e.y+i)}const{get:Vd,translate:Hd}=D,Gd=new Lt,qd={},Qd={};function Jd(t,e,s,i){const{changeful:r,sync:o,scaleFixed:n}=s;r&&(t.changeful=r),o&&(t.sync=o),n&&(t.scaleFixed=n),t.data=$d(s,i,e)}function $d(t,e,s){t.padding&&(e=Gd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:i,height:r}=s;const{opacity:o,mode:n,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===r,w={mode:n},v="center"!==h&&(u||0)%180==90;let B,k;switch(Pt.set(Qd,0,0,v?r:i,v?i:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(b.getScaleData(d,c,s,qd),B=qd.scaleX,k=qd.scaleY),(h||y||f)&&(B&&Pt.scale(Qd,B,k,!0),h&&ct.toPoint(h,Qd,e,Qd,!0,!0))):x&&!u||(B=k=Pt.getFitScale(e,Qd,"fit"!==n),Pt.put(e,s,h,B,!1,Qd),Pt.scale(Qd,B,k,!0)),l&&q.move(Qd,l),n){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":(Qd.x||Qd.y||B||g||u||p)&&Xd(w,e,Qd.x,Qd.y,B,k,u,p,t.clipSize);break;case"repeat":(!x||B||u||p)&&Ud(w,e,i,r,Qd.x,Qd.y,B,k,u,p,h,t.freeTransform),f||(w.repeat="repeat");const s=_(f);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;_(t)?(o=t.x,n=t.y):o=n=t;return{x:Zd(o,s,r.width,e&&e.x),y:Zd(n,i,r.height,e&&e.y)}}(y,s&&f,Qd.width,Qd.height,e));break;default:B&&Yd(w,e,Qd.x,Qd.y,B,k,u)}return w.transform||(e.x||e.y)&&(w.transform=Vd(),Hd(w.transform,e.x,e.y)),B&&"stretch"!==n&&(w.scaleX=B,w.scaleY=k),w.width=i,w.height=r,o&&(w.opacity=o),m&&(w.filters=m),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function Zd(t,e,s,i){const r=a(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let Kd,tc=new Lt;const{isSame:ec}=Pt;function sc(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Jd(r,i,s,o),!0}function ic(t,e){nc(t,bn.LOAD,e)}function rc(t,e){nc(t,bn.LOADED,e)}function oc(t,e,s){e.error=s,t.forceUpdate("surface"),nc(t,bn.ERROR,e)}function nc(t,e,s){t.hasEvent(e)&&t.emitEvent(new bn(e,s))}function ac(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:hc,scale:lc,copy:dc}=D,{floor:cc,ceil:uc,max:_c,abs:pc}=Math;function gc(e,s,i){let{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,s.scaleFixed);const n=r+"-"+o+"-"+i;if(s.patternId===n||e.destroyed)return!1;{const{image:a,data:h}=s;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:g,repeat:f,gap:y}=h;r*=i,o*=i,_&&(_=pc(_),p=pc(p),d=hc(),dc(d,g),lc(d,1/_,1/p),r*=_,o*=p),c*=r,u*=o;const m=c*u;if(!f&&m>t.image.maxCacheSize)return!1;let x=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/uc(t))}else{const t=a.width*a.height;x>t&&(x=t)}m>x&&(l=Math.sqrt(m/x)),l&&(r/=l,o/=l,c/=l,u/=l),_&&(r/=_,o/=p);const w=y&&y.x*r,v=y&&y.y*o;if(g||1!==r||1!==o){const t=c+(w||0),e=u+(v||0);r/=t/_c(cc(t),1),o/=e/_c(cc(e),1),d||(d=hc(),g&&dc(d,g)),lc(d,1/r,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,v,e.leafer&&e.leafer.config.smooth),B=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,s);return s.style=B,s.patternId=n,!0}}const fc={image:function(t,e,s,i,r){let o,n;const a=Mr.get(s);return Kd&&s===Kd.paint&&ec(i,Kd.boxBounds)?o=Kd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Kd=a.use>1?{leafPaint:o,paint:s,boxBounds:tc.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(sc(t,e,s,a,o,i),r&&(ic(t,n),rc(t,n))):a.error?r&&oc(t,n,a.error):(r&&(ac(t,!0),ic(t,n)),o.loadId=a.load(()=>{ac(t,!1),t.destroyed||(sc(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),rc(t,n)),o.loadId=void 0},e=>{ac(t,!1),oc(t,n,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(e,s,i,r){const{scaleX:o,scaleY:n}=e.getRenderScaleData(!0,i.scaleFixed),{pixelRatio:a}=s,{data:h}=i;if(!h||i.patternId===o+"-"+n+"-"+a&&!Ah.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===t.name&&Tn.isResizing(e)||Ah.running)){let{width:e,height:s}=h;e*=o*a,s*=n*a,h.scaleX&&(e*=h.scaleX,s*=h.scaleY),r=e*s>t.image.maxCacheSize}return r?(e.__.__isFastShadow&&(s.fillStyle=i.style||"#000",s.fill()),function(t,e,s,i){e.save(),e.clipUI(t),s.blendMode&&(e.blendMode=s.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(s.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,s,i,h),!0):(!i.style||i.sync||Ah.running?gc(e,i,a):i.patternTask||(i.patternTask=Mr.patternTasker.add(()=>te(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(e.__nowWorld)&&gc(e,i,a),e.forceUpdate("surface")}),300)),!1)},createPattern:gc,recycleImage:function(t,e){const s=e["_"+t];if(u(s)){let i,r,o,n,a;for(let h=0,l=s.length;h<l;h++)i=s[h],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,Mr.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],u(n)||(n=[n])),r.unload(s[h].loadId,!n.some(t=>t.url===a))));return o}return null},createData:Jd,getPatternData:$d,fillOrFitMode:Yd,clipMode:Xd,repeatMode:Ud},{toPoint:yc}=ht,{hasTransparent:mc}=Sh,xc={},wc={};function vc(t,e,s,i){if(s){let r,o,n,h;for(let t=0,l=s.length;t<l;t++)r=s[t],a(r)?(n=t/(l-1),o=Sh.string(r,i)):(n=r.offset,o=Sh.string(r.color,i)),e.addColorStop(n,o),!h&&mc(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:bc,getDistance:Bc}=q,{get:kc,rotateOfOuter:Sc,scaleOfOuter:Rc}=D,{toPoint:Cc}=ht,Pc={},Tc={};function Ec(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=bc(e,s);o=kc(),r?(Rc(o,e,n/a*(i||1),1),Sc(o,e,t+90)):(Rc(o,e,1,n/a*(i||1)),Sc(o,e,t))}return o}const{getDistance:Oc}=q,{toPoint:Lc}=ht,Ac={},Ic={};const Mc={linearGradient:function(e,s){let{from:i,to:r,type:o,opacity:n}=e;yc(i||"top",s,xc),yc(r||"bottom",s,wc);const a=t.canvas.createLinearGradient(xc.x,xc.y,wc.x,wc.y),h={type:o,style:a};return vc(h,a,e.stops,n),h},radialGradient:function(e,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=e;Cc(i||"center",s,Pc),Cc(r||"bottom",s,Tc);const h=t.canvas.createRadialGradient(Pc.x,Pc.y,0,Pc.x,Pc.y,Bc(Pc,Tc)),l={type:o,style:h};vc(l,h,e.stops,n);const d=Ec(s,Pc,Tc,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=e;Lc(i||"center",s,Ac),Lc(r||"bottom",s,Ic);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Ac.x,Ac.y):t.canvas.createRadialGradient(Ac.x,Ac.y,0,Ac.x,Ac.y,Oc(Ac,Ic)),l={type:o,style:h};vc(l,h,e.stops,n);const d=Ec(s,Ac,Ic,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Ec},{copy:Wc,toOffsetOutBounds:Dc}=Pt,Fc={},zc={};function Nc(e,s,i,r){const{bounds:o,shapeBounds:n}=r;if(t.fullImageShadow){if(Wc(Fc,e.bounds),Fc.x+=s.x-n.x,Fc.y+=s.y-n.y,i){const{fitMatrix:t}=r;Fc.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),Fc.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),Fc.width*=i,Fc.height*=i}e.copyWorld(r.canvas,e.bounds,Fc)}else i&&(Wc(Fc,s),Fc.x-=s.width/2*(i-1),Fc.y-=s.height/2*(i-1),Fc.width*=i,Fc.height*=i),e.copyWorld(r.canvas,n,i?Fc:s)}const{toOffsetOutBounds:Yc}=Pt,Xc={};const Uc={shadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;Dc(l,zc),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(zc.offsetX+a.x*c*f,zc.offsetY+a.y*u*f,a.blur*c*f,Sh.string(a.color)),r=a.spread?1+2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*f:0,Nc(_,zc,r,s),i=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),i=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),Oh.isTransformShadow(a)?Oh.renderTransformShadow(t,e,_,i,a):Uo.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;Yc(l,Xc),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Xc.offsetX+a.x*c*f,Xc.offsetY+a.y*u*f,a.blur*c*f),r=a.spread?1-2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*f:0,Nc(_,Xc,r,s),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,Sh.string(a.color),"source-in"),Uo.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowSpread:function(t,e){let s=0;return e.forEach(t=>s=Math.max(s,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),s},isTransformShadow(t){}},{excludeRenderBounds:jc}=$o;let Vc;function Hc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":Vc||(Vc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);qc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":qc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function Gc(t){return t.getSameCanvas(!1,!0)}function qc(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}ml.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(Hc(this,n,t,r,i,o,void 0,!0),i=r=null),o=s.__.opacity,Vc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=Gc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=Gc(t)),r||(r=Gc(t)),s.__render(i,e)),"clipping"!==a&&"clipping-path"!==a||jc(s,e)||s.__render(t,e);continue}const d=1===o&&s.__.__blendMode;d&&Hc(this,n,t,r,i,o,void 0,!1),jc(s,e)||s.__render(r||t,e),d&&Hc(this,n,t,r,i,o,d,!1)}Hc(this,n,t,r,i,o,void 0,!0)};const Qc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Jc=Qc+"_#~&*+\\=|≮≯≈≠=…",$c=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Zc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Kc=Zc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),tu=Zc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),eu=Zc(Qc),su=Zc(Jc),iu=Zc("- —/~|┆·");var ru;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ru||(ru={}));const{Letter:ou,Single:nu,Before:au,After:hu,Symbol:lu,Break:du}=ru;function cu(t){return Kc[t]?ou:iu[t]?du:tu[t]?au:eu[t]?hu:su[t]?lu:$c.test(t)?nu:ou}const uu={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function _u(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:pu}=uu,{Letter:gu,Single:fu,Before:yu,After:mu,Symbol:xu,Break:wu}=ru;let vu,bu,Bu,ku,Su,Ru,Cu,Pu,Tu,Eu,Ou,Lu,Au,Iu,Mu,Wu,Du,Fu=[];function zu(t,e){Tu&&!Pu&&(Pu=Tu),vu.data.push({char:t,width:e}),Bu+=e}function Nu(){ku+=Bu,vu.width=Bu,bu.words.push(vu),vu={data:[]},Bu=0}function Yu(){Iu&&(Mu.paraNumber++,bu.paraStart=!0,Iu=!1),Tu&&(bu.startCharSize=Pu,bu.endCharSize=Tu,Pu=0),bu.width=ku,Wu.width?pu(bu):Du&&Xu(),Fu.push(bu),bu={words:[]},ku=0}function Xu(){ku>(Mu.maxWidth||0)&&(Mu.maxWidth=ku)}const{top:Uu,right:ju,bottom:Vu,left:Hu}=ot;function Gu(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const qu={getDrawData:function(e,s){a(e)||(e=String(e));let i=0,r=0,o=s.__getInput("width")||0,n=s.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=s;d&&(o?(i=d[Hu],o-=d[ju]+d[Hu]):s.autoSizeAlign||(i=d[Hu]),n?(r=d[Uu],n-=d[Uu]+d[Vu]):s.autoSizeAlign||(r=d[Uu]));const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,s,i){Mu=e,Fu=e.rows,Wu=e.bounds,Du=!Wu.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=t,{width:h,height:l}=Wu;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;Iu=!0,Ou=null,Pu=Cu=Tu=Bu=ku=0,vu={data:[]},bu={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)Ru=s[i],"\n"===Ru?(Bu&&Nu(),bu.paraEnd=!0,Yu(),Iu=!0):(Eu=cu(Ru),Eu===gu&&"none"!==n&&(Ru=_u(Ru,n,!Bu)),Cu=a.measureText(Ru).width,r&&(r<0&&(Tu=Cu),Cu+=r),Lu=Eu===fu&&(Ou===fu||Ou===gu)||Ou===fu&&Eu!==mu,Au=!(Eu!==yu&&Eu!==fu||Ou!==xu&&Ou!==mu),Su=Iu&&o?h-o:h,t&&h&&ku+Bu+Cu>Su&&(e?(Bu&&Nu(),ku&&Yu()):(Au||(Au=Eu===gu&&Ou==mu),Lu||Au||Eu===wu||Eu===yu||Eu===fu||Bu+Cu>Su?(Bu&&Nu(),ku&&Yu()):ku&&Yu()))," "===Ru&&!0!==Iu&&ku+Bu===0||(Eu===wu?(" "===Ru&&Bu&&Nu(),zu(Ru,Cu),Nu()):Lu||Au?(Bu&&Nu(),zu(Ru,Cu)):zu(Ru,Cu)),Ou=Eu);Bu&&Nu(),ku&&Yu(),Fu.length>0&&(Fu[Fu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{Mu.paraNumber++,ku=a.measureText(t).width,Fu.push({x:o||0,text:t,width:ku,paraStart:!0}),Du&&Xu()})}(c,e,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":Gu(e,"x",t[Hu]);break;case"right":Gu(e,"x",-t[ju])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":Gu(e,"y",t[Uu]);break;case"bottom":Gu(e,"y",-t[Vu])}}(d,c,s,o,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>f)y=Math.max(f,o),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(c,s),function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,letterSpacing:n}=e;let a,h,l,d,c,u;i.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=s&&("justify"===r||"both"===r)&&u>1?(s-t.width-l)/(u-1):0,d=n||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!n&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,s)=>{1===d?(c={char:"",x:a},a=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,s,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||s===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,s,o),c.overflow&&function(e,s,i,r){if(!r)return;const{rows:o,overflow:n}=e;let{textOverflow:a}=s;if(o.splice(n),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=i+r-l;("none"===s.textWrap?o:[o[n-1]]).forEach(t=>{if(t.isOverflow&&t.data){let s=t.data.length-1;for(let i=s;i>-1&&(e=t.data[i],h=e.x+e.width,!(i===s&&h<d));i--){if(h<d&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,s,i,o),"none"!==h&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,_(o)?(s=o.type,o.color&&(t.decorationColor=Sh.string(o.color)),o.offset&&(i=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(c,s),c}};const Qu={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!Sh.object)return t;t=Sh.object(t)}let i=o(t.a)?1:t.a;s&&(i*=e);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};Object.assign(kh,qu),Object.assign(Sh,Qu),Object.assign(Ph,Ed),Object.assign(Th,fc),Object.assign(Eh,Mc),Object.assign(Oh,Uc);try{wx&&oh(0,wx)}catch(t){}export{ct as AlignHelper,i as Answer,ht as AroundHelper,It as AutoBounds,Ue as BezierHelper,Lt as Bounds,Bn as BoundsEvent,Pt as BoundsHelper,Pl as Box,Vh as BoxData,Za as Branch,en as BranchHelper,ya as BranchRender,od as Canvas,rl as CanvasData,Zt as CanvasManager,mn as ChildEvent,Sh as ColorConvert,Vt as Creator,f as DataHelper,Dt as Debug,ot as Direction4,nt as Direction9,dl as DragBoundsHelper,Oh as Effect,Al as Ellipse,Jh as EllipseData,Ze as EllipseHelper,yn as Event,Jt as EventCreator,Nn as Eventer,Ah as Export,Cr as FileHelper,Lh as Filter,Tl as Frame,Gh as FrameData,ml as Group,jh as GroupData,id as Image,il as ImageData,bn as ImageEvent,Mr as ImageManager,e as IncrementId,On as LayoutEvent,yh as Layouter,Xa as Leaf,pa as LeafBounds,$o as LeafBoundsHelper,m as LeafData,Kn as LeafDataProxy,$n as LeafEventer,Uo as LeafHelper,fn as LeafLayout,th as LeafLevelList,Ka as LeafList,na as LeafMatrix,ga as LeafRender,vl as Leafer,sh as LeaferCanvas,_e as LeaferCanvasBase,Hh as LeaferData,An as LeaferEvent,Yr as LeaferImage,sd as Line,qh as LineData,b as MathHelper,et as Matrix,D as MatrixHelper,rd as MyImage,me as NeedConvertToCanvasCommandMap,k as OneRadian,S as PI2,R as PI_2,Ph as Paint,Eh as PaintGradient,Th as PaintImage,cd as Path,Ch as PathArrow,gr as PathBounds,oi as PathCommandDataHelper,fe as PathCommandMap,Ws as PathConvert,br as PathCorner,bi as PathCreator,Kh as PathData,Di as PathDrawer,pe as PathHelper,be as PathNumberCommandLengthMap,ve as PathNumberCommandMap,ud as Pen,tl as PenData,t as Platform,jt as Plugin,K as Point,q as PointHelper,Yl as Polygon,$h as PolygonData,wn as PropertyEvent,bl as Rect,Qh as RectData,Be as RectHelper,gl as RectRender,Ln as RenderEvent,xh as Renderer,Tn as ResizeEvent,Ar as Resource,Yt as Run,ql as Star,Zh as StarData,Ih as State,Mt as StringNumberMap,Er as TaskItem,Or as TaskProcessor,dd as Text,kh as TextConvert,sl as TextData,Mh as Transition,it as TwoPointBoundsHelper,yl as UI,ol as UIBounds,Gt as UICreator,Xh as UIData,_l as UIRender,Rh as UnitConvert,nn as WaitHelper,En as WatchEvent,nh as Watcher,ho as affectRenderBoundsType,oo as affectStrokeBoundsType,Hr as attr,$r as autoLayoutType,to as boundsType,Rr as canvasPatch,ue as canvasSizeAttrs,Bh as createAttr,jr as createDescriptor,xo as cursorType,wo as dataProcessor,qr as dataType,Vr as decorateLeafAttr,bo as defineDataProcessor,Xr as defineKey,Gr as defineLeafAttr,so as doBoundsType,no as doStrokeType,wh as effectType,r as emptyData,yo as eraserType,vn as extraPropertyEventMap,P as getBoundsData,Ur as getDescriptor,T as getMatrixData,C as getPointData,mo as hitType,u as isArray,p as isData,g as isEmptyData,h as isFinite,n as isNull,l as isNumber,_ as isObject,a as isString,o as isUndefined,vo as layoutProcessor,Fn as leaferTransformAttrMap,fo as maskType,eo as naturalBoundsType,co as opacityType,Br as path,io as pathInputType,ro as pathType,kr as pen,Qr as positionType,Eo as registerUI,Oo as registerUIEvent,vh as resizeType,Ro as rewrite,Co as rewriteAble,Kr as rotationType,Zr as scaleType,Jr as scrollType,go as sortType,ao as strokeType,lo as surfaceType,At as tempBounds,st as tempMatrix,tt as tempPoint,c as tryToNumber,oh as useCanvas,To as useModule,eh as version,uo as visibleType,bh as zoomLayerType};
|
|
1
|
+
const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:i}=t.image;return!i||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+i),s&&"/"===e[0]&&(e=s+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=e;var i;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(i||(i={}));const r={};function n(t){return void 0===t}function o(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var n,o;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return y(t[r],e[r],s&&s[r]);s&&r in s?(null===(o=s[r])||void 0===o?void 0:o.constructor)===Object&&y(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{n(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=n(s)?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(u(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!n(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:n,f:o}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:n,f:o}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}let x,w,v;const{max:b}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>S(B,t,e,s,i),toTempAB(t,e,s){v=s?l(t)?e:t:[],l(t)?(x=C(t),w=e):l(e)?(x=t,w=C(e)):(x=t,w=e),4!==x.length&&(x=R(x)),4!==w.length&&(w=R(w))},get(t,e){let s;if(!l(t))switch(t.length){case 4:s=n(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!n(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>l(t)&&l(e)?b(t,e):(T(t,e,s),S(v,b(x[0],w[0]),b(x[1],w[1]),b(x[2],w[2]),b(x[3],w[3]))),add:(t,e,s)=>l(t)&&l(e)?t+e:(T(t,e,s),S(v,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,s,i){if(l(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[n,o,a,h]=4===t.length?t:R(t);return S(r,a*s,h*e,n*s,o*e)}},{set:S,get:R,setTemp:C,toTempAB:T}=k,{round:P,pow:O,PI:E}=Math,A={within:(t,e,s)=>(_(e)&&(s=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(s)&&t>s&&(t=s),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),A.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=n(e)?1e12:O(10,e);return-0===(t=P(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&A.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:L,randColor:t=>`rgba(${L(255)},${L(255)},${L(255)},${t||1})`};function L(t){return Math.round(Math.random()*t)}const I=E/180,W=2*E,M=E/2;function D(){return{x:0,y:0}}function F(){return{x:0,y:0,width:0,height:0}}function z(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:N,cos:Y,acos:X,sqrt:U}=Math,{float:j}=A,V={};function H(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const G={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:H(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:z,getWorld:H,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,i){q.toInnerPoint(t,e,V),q.scaleOfInner(t,V,s,i)},scaleOfInner(t,e,s,i=s){q.translateInner(t,e.x,e.y),q.scale(t,s,i),q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:n}=t,o=Y(e*=I),a=N(e);t.a=s*o-i*a,t.b=s*a+i*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,s){q.toInnerPoint(t,e,V),q.rotateOfInner(t,V,s)},rotateOfInner(t,e,s){q.translateInner(t,e.x,e.y),q.rotate(t,s),q.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=I,t.a=i+n*s,t.b=r+o*s),e&&(e*=I,t.c=n+i*e,t.d=o+r*e)},skewOfOuter(t,e,s,i){q.toInnerPoint(t,e,V),q.skewOfInner(t,V,s,i)},skewOfInner(t,e,s,i=0){q.translateInner(t,e.x,e.y),q.skew(t,s,i),q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},multiplyParent(t,e,s,i,r){const{e:o,f:a}=t;if(s||(s=t),n(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:n,c:o,d:a}=t;s.a=i*e.a+n*e.c,s.b=i*e.b+n*e.d,s.c=o*e.a+a*e.c,s.d=o*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},divide(t,e){q.multiply(t,q.tempInvert(e))},divideParent(t,e){q.multiplyParent(t,q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=q;return q.copy(e,t),q.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-n*r*s,t.f=-o*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*r-l*n)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*o)*h,s.y-=(i*r-e*n)*h}},setLayout(t,e,s,i,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(n(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,n=s*I,o=Y(n),a=N(n);if(i||r){const e=i*I,s=r*I;t.a=(o+s*-a)*h,t.b=(a+s*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(s=s||i)&&q.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!i){d=U(r*r+n*n),c=t/d;const e=r/d;u=n>0?X(e):-X(e)}else{c=U(o*o+a*a),d=t/c;const e=o/c;u=M-(a>0?X(-e):-X(e))}const e=j(Y(u)),s=N(u);d=j(d),c=j(c),_=e?j((o/c+s)/e/I,9):0,p=e?j((n/d-s)/e/I,9):0,u=j(u/I)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:n,d:o}=t;r||n?s=(i*o-r*n)/(e=U(i*i+r*r)):(e=i,s=o)}return i.scaleX=e,i.scaleY=s,i},reset(t){q.set(t)}},q=G,{toInnerPoint:Q,toOuterPoint:J}=G,{sin:$,cos:Z,abs:K,sqrt:tt,atan2:et,min:st,round:it}=Math,rt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=n(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?it(t.x-.5)+.5:it(t.x),t.y=e?it(t.y-.5)+.5:it(t.y)},move(t,e,s){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=nt.defaultPoint);const i=Z(e*=I),r=$(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r+o*i},tempToInnerOf(t,e){const{tempPoint:s}=nt;return at(s,t),Q(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=nt;return at(s,t),J(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=nt;return at(s,t),nt.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),Q(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){Q(e,t,s)},toOuterOf(t,e,s){J(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ot(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=K(s-t),n=K(i-e);return tt(r*r+n*n)},getMinDistanceFrom:(t,e,s,i,r,n)=>st(ot(t,e,s,i),ot(s,i,r,n)),getAngle:(t,e)=>ht(t,e)/I,getRotation:(t,e,s,i)=>(i||(i=e),nt.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/I),getRadianFrom(t,e,s,i,r,o,a,h){n(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>et(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=ht(t,e);return(e=i?e:{}).x=t.x+Z(r)*s,e.y=t.y+$(r)*s,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){nt.reset(t)}},nt=rt,{getDistanceFrom:ot,copy:at,getAtan2:ht}=nt;class lt{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?rt.copy(this,t):rt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new lt(this)}move(t,e){return rt.move(this,t,e),this}scale(t,e){return rt.scale(this,t,e),this}scaleOf(t,e,s){return rt.scaleOf(this,t,e,s),this}rotate(t,e){return rt.rotate(this,t,e),this}rotateOf(t,e){return rt.rotate(this,e,t),this}getRotation(t,e,s){return rt.getRotation(this,t,e,s)}toInnerOf(t,e){return rt.toInnerOf(this,t,e),this}toOuterOf(t,e){return rt.toOuterOf(this,t,e),this}getCenter(t){return new lt(rt.getCenter(this,t))}getDistance(t){return rt.getDistance(this,t)}getDistancePoint(t,e,s){return new lt(rt.getDistancePoint(this,t,e,s))}getAngle(t){return rt.getAngle(this,t)}getAtan2(t){return rt.getAtan2(this,t)}reset(){return rt.reset(this),this}}const dt=new lt;class ct{constructor(t,e,s,i,r,n){this.set(t,e,s,i,r,n)}set(t,e,s,i,r,n){return _(t)?G.copy(this,t):G.set(this,t,e,s,i,r,n),this}setWith(t){return G.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:n}=this;return{a:t,b:e,c:s,d:i,e:r,f:n}}clone(){return new ct(this)}translate(t,e){return G.translate(this,t,e),this}translateInner(t,e){return G.translateInner(this,t,e),this}scale(t,e){return G.scale(this,t,e),this}scaleWith(t,e){return G.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return G.pixelScale(this,t),this}scaleOfOuter(t,e,s){return G.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return G.scaleOfInner(this,t,e,s),this}rotate(t){return G.rotate(this,t),this}rotateOfOuter(t,e){return G.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return G.rotateOfInner(this,t,e),this}skew(t,e){return G.skew(this,t,e),this}skewOfOuter(t,e,s){return G.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return G.skewOfInner(this,t,e,s),this}multiply(t){return G.multiply(this,t),this}multiplyParent(t){return G.multiplyParent(this,t),this}divide(t){return G.divide(this,t),this}divideParent(t){return G.divideParent(this,t),this}invert(){return G.invert(this),this}invertWith(){return G.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){G.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){G.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return G.setLayout(this,t,e,s),this}getLayout(t,e,s){return G.getLayout(this,t,e,s)}withScale(t,e){return G.withScale(this,t,e)}reset(){G.reset(this)}}const ut=new ct,_t={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){pt(t,e,s),pt(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:pt}=_t;var gt,ft;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(gt||(gt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(ft||(ft={}));const yt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];yt.forEach(t=>t.type="percent");const mt={directionData:yt,tempPoint:{},get:xt,toPoint(t,e,s,i,r,n){const o=xt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,r&&(n||(s.x-=r.x,s.y-=r.y),o.x&&(s.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(s.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),mt.toPoint(t,e,s,!0),s)};function xt(t){return a(t)?yt[ft[t]]:t}const{toPoint:wt}=mt,vt={toPoint(t,e,s,i,r,n){wt(t,s,i,r,e,n)}},{tempPointBounds:bt,setPoint:Bt,addPoint:kt,toBounds:St}=_t,{toOuterPoint:Rt}=G,{float:Ct,fourNumber:Tt}=A,{floor:Pt,ceil:Ot}=Math;let Et,At,Lt,It;const Wt={},Mt={},Dt={},Ft={tempBounds:Dt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:n,y:o,width:a,height:h}=e;if(u(s)){const e=Tt(s);i?zt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):zt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),zt.set(t,n-s,o-s,a+2*s,h+2*s);r&&("width"===r?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),zt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Yt(e,t):e=t,s||(s=t),e.offsetX=zt.maxX(s),e.offsetY=zt.maxY(s),zt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||rt.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){rt.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(zt.copy(Dt,t),zt.toOuterOf(Dt,e),Dt),getOuterOf:(t,e)=>(t=Object.assign({},t),zt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else Wt.x=t.x,Wt.y=t.y,Rt(e,Wt,Mt),Bt(bt,Mt.x,Mt.y),Wt.x=t.x+t.width,Rt(e,Wt,Mt),kt(bt,Mt.x,Mt.y),Wt.y=t.y+t.height,Rt(e,Wt,Mt),kt(bt,Mt.x,Mt.y),Wt.x=t.x,Rt(e,Wt,Mt),kt(bt,Mt.x,Mt.y),St(bt,s)},toInnerOf(t,e,s){s||(s=t),zt.move(s,-e.e,-e.f),zt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,zt.getFitScale(t,e));return new ct(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,n){n||(n=e),a(i)&&(i=zt.getFitScale(t,e,"cover"===i)),Dt.width=r?e.width*=i:e.width*i,Dt.height=r?e.height*=i:e.height*i,vt.toPoint(s,Dt,t,n,!0,!0)},getSpread(t,e,s){const i={};return zt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){zt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){zt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Pt(t.x),t.y=Pt(t.y),t.width=e>t.x?Ot(t.width+e-t.x):Ot(t.width),t.height=s>t.y?Ot(t.height+s-t.y):Ot(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Ct(t.x,e),t.y=Ct(t.y,e),t.width=Ct(t.width,e),t.height=Ct(t.height,e)},add(t,e,s){Et=t.x+t.width,At=t.y+t.height,Lt=e.x,It=e.y,s||(Lt+=e.width,It+=e.height),Et=Et>Lt?Et:Lt,At=At>It?At:It,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Et-t.x,t.height=At-t.y},addList(t,e){zt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){zt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){zt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||Yt(t,r)):Nt(t,r));n&&zt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Bt(bt,t.x,t.y):kt(bt,t.x,t.y)),St(bt,t)},setPoint(t,e){zt.set(t,e.x,e.y)},addPoint(t,e){Nt(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=rt.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=rt.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=zt.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=zt.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=zt.tempToOuterOf(e,s)),!zt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:n,height:o}=e;return Et=i+n,At=r+o,Lt=t.x+t.width,It=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Et=Et<Lt?Et:Lt,At=At<It?At:It,n=Et-i,o=At-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){zt.copy(t,zt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){zt.set(t)}},zt=Ft,{add:Nt,copy:Yt}=zt;class Xt{get minX(){return Ft.minX(this)}get minY(){return Ft.minY(this)}get maxX(){return Ft.maxX(this)}get maxY(){return Ft.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return _(t)?Ft.copy(this,t):Ft.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Xt(this)}move(t,e){return Ft.move(this,t,e),this}scale(t,e,s){return Ft.scale(this,t,e,s),this}scaleOf(t,e,s){return Ft.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Ft.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ft.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ft.getFitMatrix(this,t,e)}put(t,e,s){Ft.put(this,t,e,s)}spread(t,e){return Ft.spread(this,t,e),this}shrink(t,e){return Ft.shrink(this,t,e),this}ceil(){return Ft.ceil(this),this}unsign(){return Ft.unsign(this),this}float(t){return Ft.float(this,t),this}add(t){return Ft.add(this,t),this}addList(t){return Ft.setList(this,t,!0),this}setList(t){return Ft.setList(this,t),this}addListWithFn(t,e){return Ft.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ft.setListWithFn(this,t,e),this}setPoint(t){return Ft.setPoint(this,t),this}setPoints(t){return Ft.setPoints(this,t),this}addPoint(t){return Ft.addPoint(this,t),this}getPoints(){return Ft.getPoints(this)}hitPoint(t,e){return Ft.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ft.hitRadiusPoint(this,t,e)}hit(t,e){return Ft.hit(this,t,e)}includes(t,e){return Ft.includes(this,t,e)}intersect(t,e){return Ft.intersect(this,t,e),this}getIntersect(t,e){return new Xt(Ft.getIntersectData(this,t,e))}isSame(t){return Ft.isSame(this,t)}isEmpty(){return Ft.isEmpty(this)}reset(){Ft.reset(this)}}const Ut=new Xt;class jt{constructor(t,e,s,i,r,n){_(t)?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new Xt(r,e,n||t.width-r-s,o||t.height-e-i)}}const Vt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Ht}=A;class Gt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Gt(t)}static set filter(t){this.filterList=qt(t)}static set exclude(t){this.excludeList=qt(t)}static drawRepaint(t,e){const s=Ht();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Gt.showBounds,r=t.__nowWorld,n=Ht();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),i?e.stroke():e.strokeWorld(r,n)}log(...t){if(Qt.enable){if(Qt.filterList.length&&Qt.filterList.every(t=>t!==this.name))return;if(Qt.excludeList.length&&Qt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Qt.enable&&this.warn(...t)}warn(...t){Qt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function qt(t){return t?a(t)&&(t=[t]):t=[],t}Gt.filterList=[],Gt.excludeList=[],Gt.showWarn=!0;const Qt=Gt,Jt=Gt.get("RunTime"),$t={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,s){const i=e.create(e.RUNTIME);return Zt.currentId=Zt.idMap[i]=s?performance.now():Date.now(),Zt.currentName=Zt.nameMap[i]=t,Zt.nameToIdMap[t]=i,i},end(t,e){const s=Zt.idMap[t],i=Zt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Zt.idMap[t]=Zt.nameMap[t]=Zt.nameToIdMap[i]=void 0,Jt.log(i,r,"ms")},endOfName(t,e){const s=Zt.nameToIdMap[t];n(s)||Zt.end(s,e)}},Zt=$t,Kt=[],te={list:{},add(t,...e){this.list[t]=!0,Kt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>Kt.forEach(t=>te.has(t,!0)));const ee={editor:t=>te.need("editor")},se=Gt.get("UICreator"),ie={list:{},register(t){const{__tag:e}=t.prototype;re[e]&&se.repeat(e),re[e]=t},get(t,e,s,i,r,o){re[t]||se.error("not register "+t);const a=new re[t](e);return n(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),o&&(a.height=o)),a}},{list:re}=ie,ne=Gt.get("EventCreator"),oe={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(ae[e]&&ne.repeat(e),ae[e]=t)})},changeName(t,e){const s=ae[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ae[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ae[t](...e)},{nameList:ae}=oe;class he{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=ee.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function le(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function de(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}h((i=i.apply(t,e||[])).next())})}function ce(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const ue=[];function _e(){return(t,e)=>{ue.push(e)}}const pe=[];let ge=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||pe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ue.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};le([ce("imageSmoothingEnabled")],ge.prototype,"smooth",void 0),le([ce("imageSmoothingQuality")],ge.prototype,"smoothLevel",void 0),le([ce("globalAlpha")],ge.prototype,"opacity",void 0),le([ce()],ge.prototype,"fillStyle",void 0),le([ce()],ge.prototype,"strokeStyle",void 0),le([ce("lineWidth")],ge.prototype,"strokeWidth",void 0),le([ce("lineCap")],ge.prototype,"strokeCap",void 0),le([ce("lineJoin")],ge.prototype,"strokeJoin",void 0),le([ce("lineDashOffset")],ge.prototype,"dashOffset",void 0),le([ce()],ge.prototype,"miterLimit",void 0),le([ce()],ge.prototype,"shadowBlur",void 0),le([ce()],ge.prototype,"shadowColor",void 0),le([ce()],ge.prototype,"shadowOffsetX",void 0),le([ce()],ge.prototype,"shadowOffsetY",void 0),le([ce()],ge.prototype,"filter",void 0),le([ce()],ge.prototype,"font",void 0),le([ce()],ge.prototype,"fontKerning",void 0),le([ce()],ge.prototype,"fontStretch",void 0),le([ce()],ge.prototype,"fontVariantCaps",void 0),le([ce()],ge.prototype,"textAlign",void 0),le([ce()],ge.prototype,"textBaseline",void 0),le([ce()],ge.prototype,"textRendering",void 0),le([ce()],ge.prototype,"wordSpacing",void 0),le([ce()],ge.prototype,"letterSpacing",void 0),le([ce()],ge.prototype,"direction",void 0),le([_e()],ge.prototype,"setTransform",null),le([_e()],ge.prototype,"resetTransform",null),le([_e()],ge.prototype,"getTransform",null),le([_e()],ge.prototype,"save",null),le([_e()],ge.prototype,"restore",null),le([_e()],ge.prototype,"translate",null),le([_e()],ge.prototype,"scale",null),le([_e()],ge.prototype,"rotate",null),le([_e()],ge.prototype,"fill",null),le([_e()],ge.prototype,"stroke",null),le([_e()],ge.prototype,"clip",null),le([_e()],ge.prototype,"fillRect",null),le([_e()],ge.prototype,"strokeRect",null),le([_e()],ge.prototype,"clearRect",null),le([_e()],ge.prototype,"beginPath",null),le([_e()],ge.prototype,"moveTo",null),le([_e()],ge.prototype,"lineTo",null),le([_e()],ge.prototype,"bezierCurveTo",null),le([_e()],ge.prototype,"quadraticCurveTo",null),le([_e()],ge.prototype,"closePath",null),le([_e()],ge.prototype,"arc",null),le([_e()],ge.prototype,"arcTo",null),le([_e()],ge.prototype,"ellipse",null),le([_e()],ge.prototype,"rect",null),le([_e()],ge.prototype,"roundRect",null),le([_e()],ge.prototype,"createConicGradient",null),le([_e()],ge.prototype,"createLinearGradient",null),le([_e()],ge.prototype,"createPattern",null),le([_e()],ge.prototype,"createRadialGradient",null),le([_e()],ge.prototype,"fillText",null),le([_e()],ge.prototype,"measureText",null),le([_e()],ge.prototype,"strokeText",null);const{copy:fe,multiplyParent:ye,pixelScale:me}=G,{round:xe}=Math,we=new Xt,ve=new Xt,be={width:1,height:1,pixelRatio:1},Be=["width","height","pixelRatio"];class ke extends ge{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(s,i){super(),this.size={},this.worldTransform={},s||(s=be),this.manager=i,this.innerId=e.create(e.CNAVAS);const{width:r,height:n,pixelRatio:o}=s;this.autoLayout=!r||!n,this.size.pixelRatio=o||t.devicePixelRatio,this.config=s,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;f.copyAttrs(i,t,Be),Be.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Xt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&ye(t,e,r),me(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=xe(r.e-.5)+.5,r.f=xe(r.f-.5)+.5):(r.e=xe(r.e),r.f=xe(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),n(e.dashPattern)||(r=e.dashPattern),n(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=ve):s=we,this.drawImage(t.view,we.x,we.y,we.width,we.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ft.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,we.x,we.y,we.width,we.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,n=!0){this.resetTransform(),this.copyWorld(t,e,s,i,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(we.x,we.y,we.width,we.height),{data:n}=r;for(let t=0,i=n.length;t<i;t+=4)s=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?s:e*(s/255));i.putImageData(r,we.x,we.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(we.x,we.y,we.width,we.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(we.x,we.y,we.width,we.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(we.x,we.y,we.width,we.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(we.x,we.y,we.width,we.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(we,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(ve,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):ee.canvas(Object.assign({},s));return r.save(),t&&(fe(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Se={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Re={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ce=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Re),Te={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Pe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Oe=Object.assign(Object.assign({},Pe),Re),Ee=Ce,Ae={};for(let t in Ee)Ae[Ee[t]]=t;const Le={};for(let t in Ee)Le[Ee[t]]=Te[t];const Ie={drawRoundRect(t,e,s,i,r,n){const o=A.fourNumber(n,Math.min(i/2,r/2)),a=e+i,h=s+r;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(a,s,a,h,o[1]):t.lineTo(a,s),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,s,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,s,a,s,o[0]):t.lineTo(e,s)}},{sin:We,cos:Me,hypot:De,atan2:Fe,ceil:ze,abs:Ne,PI:Ye,sqrt:Xe,pow:Ue}=Math,{setPoint:je,addPoint:Ve}=_t,{set:He,toNumberPoints:Ge}=rt,{M:qe,L:Qe,C:Je,Q:$e,Z:Ze}=Ce,Ke={},ts={points(t,e,s,i){let r=Ge(e);if(t.push(qe,r[0],r[1]),s&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],n=r[s-1],o=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Xe(Ue(o-e,2)+Ue(a-n,2)),g=Xe(Ue(h-o,2)+Ue(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=o-p*h,c=a-p*l,2===s?i||t.push($e,d,c,o,a):t.push(Je,u,_,d,c,o,a),u=o+g*h,_=a+g*l);i||t.push($e,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Qe,r[e],r[e+1]);i&&t.push(Ze)},rect(t,e,s,i,r){Se.creator.path=t,Se.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,n){Se.creator.path=[],Ie.drawRoundRect(Se.creator,e,s,i,r,n),t.push(...Se.convertToCanvasData(Se.creator.path,!0))},arcTo(t,e,s,i,r,n,o,a,h,l,d){const c=i-e,u=r-s,_=n-i,p=o-r;let g=Fe(u,c),f=Fe(p,_);const y=De(c,u),m=De(_,p);let x=f-g;if(x<0&&(x+=W),y<1e-12||m<1e-12||x<1e-12||Ne(x-Ye)<1e-12)return t&&t.push(Qe,i,r),h&&(je(h,e,s),Ve(h,i,r)),d&&He(d,e,s),void(l&&He(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Me(x/2),B=i+b*Me(g+x/2+M*v),k=r+b*We(g+x/2+M*v);return g-=M*v,f-=M*v,is(t,B,k,a,a,0,g/I,f/I,w,h,l,d)},arc:(t,e,s,i,r,n,o,a,h,l)=>is(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,n,o,a,h,l,d,c){const u=n*I,_=We(u),p=Me(u);let g=o*I,f=a*I;g>Ye&&(g-=W),f<0&&(f+=W);let y=f-g;y<0?y+=W:y>W&&(y-=W),h&&(y-=W);const m=ze(Ne(y/M)),x=y/m,w=We(x/4),v=8/3*w*w/We(x/2);f=g+x;let b,B,k,S,R,C,T,P,O=Me(g),E=We(g),A=k=p*i*O-_*r*E,L=S=_*i*O+p*r*E,D=e+k,F=s+S;t&&t.push(t.length?Qe:qe,D,F),l&&je(l,D,F),c&&He(c,D,F);for(let n=0;n<m;n++)b=Me(f),B=We(f),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+A-v*(p*i*E+_*r*O),C=s+L-v*(_*i*E-p*r*O),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(Je,R,C,T,P,e+k,s+S),l&&ss(e+A,s+L,R,C,T,P,e+k,s+S,l,!0),A=k,L=S,O=b,E=B,g=f,f+=x;d&&He(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Je,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){ss(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=n,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ve(h,t,e):je(h,t,e),Ve(h,o,a);for(let l=0,c=d.length;l<c;l++)es(d[l],t,e,s,i,r,n,o,a,Ke),Ve(h,Ke.x,Ke.y)},getPointAndSet(t,e,s,i,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return es(t,e,s,i,r,n,o,a,h,l),l},getDerivative(t,e,s,i,r){const n=1-t;return 3*n*n*(s-e)+6*n*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:es,toTwoPointBounds:ss,ellipse:is}=ts,{sin:rs,cos:ns,sqrt:os,atan2:as}=Math,{ellipse:hs}=ts,ls={ellipticalArc(e,s,i,r,n,o,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=o*I,g=rs(p),f=ns(p),y=-f*u-g*_,m=-f*_+g*u,x=r*r,w=n*n,v=m*m,b=y*y,B=x*w-x*v-w*b;let k=0;if(B<0){const t=os(1-B/(x*w));r*=t,n*=t}else k=(a===h?-1:1)*os(B/(x*v+w*b));const S=k*r*m/n,R=-k*n*y/r,C=as((m-R)/n,(y-S)/r),T=as((-m-R)/n,(-y-S)/r);let P=T-C;0===h&&P>0?P-=W:1===h&&P<0&&(P+=W);const O=s+u+f*S-g*R,E=i+_+g*S+f*R,A=P<0?1:0;c||t.ellipseToCurve?hs(e,O,E,r,n,o,C/I,T/I,A):r!==n||o?e.push(Ce.G,O,E,r,n,o,C/I,T/I,A):e.push(Ce.O,O,E,r,C/I,T/I,A)}},{M:ds,m:cs,L:us,l:_s,H:ps,h:gs,V:fs,v:ys,C:ms,c:xs,S:ws,s:vs,Q:bs,q:Bs,T:ks,t:Ss,A:Rs,a:Cs,Z:Ts,z:Ps,N:Os,D:Es,X:As,G:Ls,F:Is,O:Ws,P:Ms,U:Ds}=Ce,{rect:Fs,roundRect:zs,arcTo:Ns,arc:Ys,ellipse:Xs,quadraticCurveTo:Us}=ts,{ellipticalArc:js}=ls,Vs=Gt.get("PathConvert"),Hs={},Gs={current:{dot:0},stringify(t,e){let s,i,r,n=0,o=t.length,a="";for(;n<o;){i=t[n],s=Le[i],a+=i===r?" ":Ae[i];for(let i=1;i<s;i++)a+=A.float(t[n+i],e),i===s-1||(a+=" ");r=i,n+=s}return a},parse(t,e){let s,i,r,n="";const o=[],a=e?Oe:Pe;for(let e=0,h=t.length;e<h;e++)i=t[e],Vt[i]?("."===i&&(qs.dot&&(Qs(o,n),n=""),qs.dot++),"0"===n&&"."!==i&&(Qs(o,n),n=""),n+=i):Ce[i]?(n&&(Qs(o,n),n=""),qs.name=Ce[i],qs.length=Te[i],qs.index=0,Qs(o,qs.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&Qs(o,n),n=i):n&&(Qs(o,n),n=""),r=i;return n&&Qs(o,n),s?Gs.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case cs:t[c+1]+=a,t[c+2]+=h;case ds:a=t[c+1],h=t[c+2],_.push(ds,a,h),c+=3;break;case gs:t[c+1]+=a;case ps:a=t[c+1],_.push(us,a,h),c+=2;break;case ys:t[c+1]+=h;case fs:h=t[c+1],_.push(us,a,h),c+=2;break;case _s:t[c+1]+=a,t[c+2]+=h;case us:a=t[c+1],h=t[c+2],_.push(us,a,h),c+=3;break;case vs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ws;case ws:o=n===ms||n===ws,l=o?2*a-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(ms,l,d,s,i,a,h),c+=5;break;case xs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=ms;case ms:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ms,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Ss:t[c+1]+=a,t[c+2]+=h,r=ks;case ks:o=n===bs||n===ks,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Us(_,a,h,s,i,t[c+1],t[c+2]):_.push(bs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Bs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=bs;case bs:s=t[c+1],i=t[c+2],e?Us(_,a,h,s,i,t[c+3],t[c+4]):_.push(bs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Cs:t[c+6]+=a,t[c+7]+=h;case Rs:js(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ps:case Ts:_.push(Ts),c++;break;case Os:a=t[c+1],h=t[c+2],e?Fs(_,a,h,t[c+3],t[c+4]):Js(_,t,c,5),c+=5;break;case Es:a=t[c+1],h=t[c+2],e?zs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Js(_,t,c,9),c+=9;break;case As:a=t[c+1],h=t[c+2],e?zs(_,a,h,t[c+3],t[c+4],t[c+5]):Js(_,t,c,6),c+=6;break;case Ls:Xs(e?_:Js(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Hs),a=Hs.x,h=Hs.y,c+=9;break;case Is:e?Xs(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Js(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ws:Ys(e?_:Js(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Hs),a=Hs.x,h=Hs.y,c+=7;break;case Ms:e?Ys(_,t[c+1],t[c+2],t[c+3],0,360,!1):Js(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ds:Ns(e?_:Js(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Hs),a=Hs.x,h=Hs.y,c+=6;break;default:return Vs.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ds,t.x,t.y);break;case"L":e.push(us,t.x,t.y);break;case"C":e.push(ms,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(bs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ts)}}),e},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){qs.index===qs.length&&(qs.index=1,t.push(qs.name)),t.push(Number(e)),qs.index++,qs.dot=0}},{current:qs,pushData:Qs,copyData:Js}=Gs,{M:$s,L:Zs,C:Ks,Q:ti,Z:ei,N:si,D:ii,X:ri,G:ni,F:oi,O:ai,P:hi,U:li}=Ce,{getMinDistanceFrom:di,getRadianFrom:ci}=rt,{tan:ui,min:_i,abs:pi}=Math,gi={},fi={beginPath(t){t.length=0},moveTo(t,e,s){t.push($s,e,s)},lineTo(t,e,s){t.push(Zs,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(Ks,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(ti,e,s,i,r)},closePath(t){t.push(ei)},rect(t,e,s,i,r){t.push(si,e,s,i,r)},roundRect(t,e,s,i,r,n){if(l(n))t.push(ri,e,s,i,r,n);else{const o=A.fourNumber(n);o?t.push(ii,e,s,i,r,...o):t.push(si,e,s,i,r)}},ellipse(t,e,s,i,r,n,a,h,l){o(n)?t.push(oi,e,s,i,r):(o(a)&&(a=0),o(h)&&(h=360),t.push(ni,e,s,i,r,n,a,h,l?1:0))},arc(t,e,s,i,r,n,a){o(r)?t.push(hi,e,s,i):(o(n)&&(n=360),t.push(ai,e,s,i,r,n,a?1:0))},arcTo(t,e,s,i,r,o,a,h){if(!n(a)){const t=di(a,h,e,s,i,r);o=_i(o,_i(t/2,t/2*pi(ui(ci(a,h,e,s,i,r)/2))))}t.push(li,e,s,i,r,o)},drawEllipse(t,e,s,i,r,n,a,h,l){ts.ellipse(null,e,s,i,r,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,gi),t.push($s,gi.x,gi.y),yi(t,e,s,i,r,n,a,h,l)},drawArc(t,e,s,i,r,n,a){ts.arc(null,e,s,i,o(r)?0:r,o(n)?360:n,a,null,null,gi),t.push($s,gi.x,gi.y),mi(t,e,s,i,r,n,a)},drawPoints(t,e,s,i){ts.points(t,e,s,i)}},{ellipse:yi,arc:mi}=fi,{moveTo:xi,lineTo:wi,quadraticCurveTo:vi,bezierCurveTo:bi,closePath:Bi,beginPath:ki,rect:Si,roundRect:Ri,ellipse:Ci,arc:Ti,arcTo:Pi,drawEllipse:Oi,drawArc:Ei,drawPoints:Ai}=fi;class Li{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Se.parse(t):t:[],this}beginPath(){return ki(this.__path),this.paint(),this}moveTo(t,e){return xi(this.__path,t,e),this.paint(),this}lineTo(t,e){return wi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,n){return bi(this.__path,t,e,s,i,r,n),this.paint(),this}quadraticCurveTo(t,e,s,i){return vi(this.__path,t,e,s,i),this.paint(),this}closePath(){return Bi(this.__path),this.paint(),this}rect(t,e,s,i){return Si(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return Ri(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,n,o,a){return Ci(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}arc(t,e,s,i,r,n){return Ti(this.__path,t,e,s,i,r,n),this.paint(),this}arcTo(t,e,s,i,r){return Pi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,n,o,a){return Oi(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}drawArc(t,e,s,i,r,n){return Ei(this.__path,t,e,s,i,r,n),this.paint(),this}drawPoints(t,e,s){return Ai(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ii,L:Wi,C:Mi,Q:Di,Z:Fi,N:zi,D:Ni,X:Yi,G:Xi,F:Ui,O:ji,P:Vi,U:Hi}=Ce,Gi=Gt.get("PathDrawer"),qi={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Ii:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Wi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Mi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Di:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Fi:t.closePath(),i+=1;break;case zi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ni:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Yi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Xi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*I,e[i+6]*I,e[i+7]*I,e[i+8]),i+=9;break;case Ui:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,W,!1),i+=5;break;case ji:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*I,e[i+5]*I,e[i+6]),i+=7;break;case Vi:t.arc(e[i+1],e[i+2],e[i+3],0,W,!1),i+=4;break;case Hi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Gi.error(`command: ${s} [index:${i}]`,e)}}},{M:Qi,L:Ji,C:$i,Q:Zi,Z:Ki,N:tr,D:er,X:sr,G:ir,F:rr,O:nr,P:or,U:ar}=Ce,{toTwoPointBounds:hr,toTwoPointBoundsByQuadraticCurve:lr,arcTo:dr,arc:cr,ellipse:ur}=ts,{addPointBounds:_r,copy:pr,addPoint:gr,setPoint:fr,addBounds:yr,toBounds:mr}=_t,xr=Gt.get("PathBounds");let wr,vr,br;const Br={},kr={},Sr={},Rr={toBounds(t,e){Rr.toTwoPointBounds(t,kr),mr(kr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return fr(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Ki||o===$i||o===Zi?fr(e,h,l):fr(e,t[a+1],t[a+2])),o){case Qi:case Ji:h=t[a+1],l=t[a+2],gr(e,h,l),a+=3;break;case $i:r=t[a+5],n=t[a+6],hr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,Br),_r(e,Br),h=r,l=n,a+=7;break;case Zi:s=t[a+1],i=t[a+2],r=t[a+3],n=t[a+4],lr(h,l,s,i,r,n,Br),_r(e,Br),h=r,l=n,a+=5;break;case Ki:a+=1;break;case tr:h=t[a+1],l=t[a+2],yr(e,h,l,t[a+3],t[a+4]),a+=5;break;case er:case sr:h=t[a+1],l=t[a+2],yr(e,h,l,t[a+3],t[a+4]),a+=o===er?9:6;break;case ir:ur(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Br,Sr),0===a?pr(e,Br):_r(e,Br),h=Sr.x,l=Sr.y,a+=9;break;case rr:h=t[a+1],l=t[a+2],vr=t[a+3],br=t[a+4],yr(e,h-vr,l-br,2*vr,2*br),h+=vr,a+=5;break;case nr:cr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Br,Sr),0===a?pr(e,Br):_r(e,Br),h=Sr.x,l=Sr.y,a+=7;break;case or:h=t[a+1],l=t[a+2],wr=t[a+3],yr(e,h-wr,l-wr,2*wr,2*wr),h+=wr,a+=4;break;case ar:dr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Br,Sr),0===a?pr(e,Br):_r(e,Br),h=Sr.x,l=Sr.y,a+=6;break;default:return void xr.error(`command: ${o} [index:${a}]`,t)}}},{M:Cr,L:Tr,Z:Pr}=Ce,{getCenterX:Or,getCenterY:Er}=rt,{arcTo:Ar}=fi,Lr={smooth(t,e,s){let i,r,n,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;o<g;){switch(i=t[o],i){case Cr:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===Tr?(c=t[o+1],u=t[o+2],f.push(Cr,Or(l,c),Er(d,u))):f.push(Cr,l,d);break;case Tr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Tr:Ar(f,a,h,t[o+1],t[o+2],e,_,p);break;case Pr:Ar(f,a,h,l,d,e,_,p);break;default:f.push(Tr,a,h)}_=a,p=h;break;case Pr:r!==Pr&&(Ar(f,l,d,c,u,e,_,p),f.push(Pr)),o+=1;break;default:n=Le[i];for(let e=0;e<n;e++)f.push(t[o+e]);o+=n}r=i}return i!==Pr&&(f[1]=l,f[2]=d),f}};function Ir(t){return new Li(t)}const Wr=Ir();Se.creator=Ir(),Se.parse=Gs.parse,Se.convertToCanvasData=Gs.toCanvasData;const{drawRoundRect:Mr}=Ie;function Dr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Mr(this,t,e,s,i,r)})}(t)}const Fr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=zr.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},zr=Fr;zr.alphaPixelTypes.forEach(t=>zr.upperCaseTypeMap[t]=t.toUpperCase());const Nr=Gt.get("TaskProcessor");class Yr{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return de(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Nr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Xr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e){let s,i,r,o;const a=new Yr(t);return a.parent=this,l(e)?o=e:e&&(i=e.parallel,s=e.start,r=e.time,o=e.delay),r&&(a.time=r),!1===i&&(a.parallel=!1),n(o)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},o)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Ur=Gt.get("Resource"),jr={tasker:new Xr,map:{},get isComplete(){return Vr.tasker.isComplete},set(t,e){Vr.map[t]&&Ur.repeat(t),Vr.map[t]=e},get:t=>Vr.map[t],remove(t){const e=Vr.map[t];e&&(e.destroy&&e.destroy(),delete Vr.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return a(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=ee.image(i)),Vr.set(t,e),e},destroy(){Vr.map={}}},Vr=jr,Hr={maxRecycled:10,recycledList:[],patternTasker:new Xr,get(t){let e=jr.get(t.url);return e||jr.set(t.url,e=ee.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Gr.recycledList.push(t)})},clearRecycled(){const t=Gr.recycledList;t.length>Gr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&jr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Fr.alphaPixelTypes.some(e=>Gr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Fr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Fr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Gr.recycledList=[]}},Gr=Hr,{IMAGE:qr,create:Qr}=e,{floor:Jr,max:$r}=Math;class Zr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Qr(qr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Hr.isFormat("svg",t)&&(this.isSVG=!0),Hr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,s){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:s}=t.origin,i=this.config.showProgress&&s&&this.onProgress.bind(this);i&&(e=s),jr.tasker.add(()=>de(this,void 0,void 0,function*(){return yield e(this.url,i).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,s,i,r,n,o,a){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=t.origin.createCanvas($r(Jr(e+(n||0)),1),$r(Jr(s+(o||0)),1)),l=h.getContext("2d");return i&&(l.globalAlpha=i),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,s,i,r){const n=t.canvas.createPattern(e,s);try{i&&n.setTransform&&(n.setTransform(i),i=void 0)}catch(t){}return r&&f.stintSet(r,"transform",i),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Kr(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function tn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function en(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function sn(t,e){return(s,i)=>nn(s,i,t,e&&e(i))}function rn(t){return t}function nn(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Kr(t,e,Object.assign(r,i||{})),In(t,e,s)}function on(t){return sn(t)}function an(t,e){return sn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function hn(t,e){return sn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function ln(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),pn(this))}}))}function dn(t,e){return sn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function cn(t,e){return sn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function un(t,e){return sn(t,t=>({set(s){this.__setAttr(t,s,e)&&pn(this)}}))}function _n(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(pn(this),this.__.__removeNaturalSize())}}))}function pn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function gn(t){return sn(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),pn(this)}}))}const fn=un;function yn(t,e){return sn(t,t=>({set(s){this.__setAttr(t,s)&&(mn(this),e&&(this.__.__useStroke=!0))}}))}function mn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&pn(t)}const xn=yn;function wn(t){return sn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function vn(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function bn(t){return sn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Bn(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Sn(this)}}))}function kn(t){return sn(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Rn(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Rn(this,t,e,s),this.mask&&Sn(this)}}))}function Sn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Rn(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||pn(t))}function Cn(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Tn(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Pn(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function On(t){return sn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Gt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function En(t){return sn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function An(t){return(e,s)=>{Kr(e,"__DataProcessor",{get:()=>t})}}function Ln(t){return(e,s)=>{Kr(e,"__LayoutProcessor",{get:()=>t})}}function In(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=en(e,s);if(n(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){const t=this[r];return null==t?s(this.__leaf):t};else if(_(s)){const t=g(s);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:f.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,d=i;for(;!l&&d;)l=tn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[o]&&(a.set=i[o],delete i[o]),Kr(i,e,a)}const Wn=new Gt("rewrite"),Mn=[],Dn=["destroy","constructor"];function Fn(t){return(e,s)=>{Mn.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function zn(){return t=>{Nn()}}function Nn(t){Mn.length&&(Mn.forEach(e=>{t&&Wn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Mn.length=0)}function Yn(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(Dn.includes(i)||e&&e.includes(i)))if(t.prototype){tn(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Xn(){return t=>{ie.register(t)}}function Un(){return t=>{oe.register(t)}}setTimeout(()=>Nn(!0));const{copy:jn,toInnerPoint:Vn,toOuterPoint:Hn,scaleOfOuter:Gn,rotateOfOuter:qn,skewOfOuter:Qn,multiplyParent:Jn,divideParent:$n,getLayout:Zn}=G,Kn={},{round:to}=Math,eo={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),ro(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)io(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)no(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&no(t),t.__updateChange()},updateAllChange(t){if(ao(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)oo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,s,i,r,n,o){r||(r=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?s.copyWorldByReset(i,r,e.__nowWorld,n,o):s.copyWorldToInner(i,r,e.__layout.renderBounds,n)},moveWorld(t,e,s=0,i,r){const n=_(e)?Object.assign({},e):{x:e,y:s};i?Hn(t.localTransform,n,n,!0):t.parent&&Vn(t.parent.scrollWorldTransform,n,n,!0),so.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,s=0,i){_(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=to(e),s=to(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,n){so.zoomOfLocal(t,ho(t,e),s,i,r,n)},zoomOfLocal(t,e,s,i=s,r,n){const o=t.__localMatrix;if(l(i)||(i&&(n=i),i=s),jn(Kn,o),Gn(Kn,e,s,i),so.hasHighPosition(t))so.setTransform(t,Kn,r,n);else{const e=t.x+Kn.e-o.e,a=t.y+Kn.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},n):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){so.rotateOfLocal(t,ho(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;jn(Kn,r),qn(Kn,e,s),so.hasHighPosition(t)?so.setTransform(t,Kn,!1,i):t.set({x:t.x+Kn.e-r.e,y:t.y+Kn.f-r.f,rotation:A.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,n){so.skewOfLocal(t,ho(t,e),s,i,r,n)},skewOfLocal(t,e,s,i=0,r,n){jn(Kn,t.__localMatrix),Qn(Kn,e,s,i),so.setTransform(t,Kn,r,n)},transformWorld(t,e,s,i){jn(Kn,t.worldTransform),Jn(Kn,e),t.parent&&$n(Kn,t.parent.scrollWorldTransform),so.setTransform(t,Kn,s,i)},transform(t,e,s,i){jn(Kn,t.localTransform),Jn(Kn,e),so.setTransform(t,Kn,s,i)},setTransform(t,e,s,i){const r=t.__,n=r.origin&&so.getInnerOrigin(t,r.origin),o=Zn(e,n,r.around&&so.getInnerOrigin(t,r.around));if(so.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),s){const e=o.scaleX/t.scaleX,s=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Ft.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=so.getInnerOrigin(t,r.origin);rt.move(o,n.x-i.x,n.y-i.y)}t.set(o),t.scaleResize(e,s,!1)}else t.set(o,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return Gn(s,so.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>rt.tempToOuterOf(so.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return mt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(jn(Kn,t.worldTransform),$n(Kn,e.scrollWorldTransform),s?Kn:Object.assign({},Kn)),drop(t,e,s,i){t.setTransform(so.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||so.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,s,i=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)e.move(s);else{const r=s.x*i,n=s.y*i;s.x-=r,s.y-=n,e.move(r,n),t.requestRender(()=>so.animateMove(e,s,i))}}},so=eo,{updateAllMatrix:io,updateMatrix:ro,updateAllWorldOpacity:no,updateAllChange:oo,updateChange:ao}=so;function ho(t,e){return t.updateLayout(),t.parent?rt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const lo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>uo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>uo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>uo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let co;function uo(t,e){return e||(co=0),t.__.mask&&(co=1),co<0?null:(co&&(co=-1),!0)}const{updateBounds:_o}=eo,po={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),go(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&n(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)fo(e[t],e)},updateBounds(t,e){const s=[t];fo(t,s),yo(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)_o(i[t]);e&&e===s||_o(s)}}},{pushAllChildBranch:go,pushAllBranchStack:fo,updateBoundsByBranchStack:yo}=po,mo={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:xo,updateBounds:wo}=eo,{toOuterOf:vo,getPoints:bo,copy:Bo}=Ft,ko="_localContentBounds",So="_worldContentBounds",Ro="_worldBoxBounds",Co="_worldStrokeBounds";class To{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return vo(this.contentBounds,this.leaf.__localMatrix,this[ko]||(this[ko]={})),this[ko]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return vo(this.contentBounds,this.leaf.__world,this[So]||(this[So]={})),this[So]}get worldBoxBounds(){return vo(this.boxBounds,this.leaf.__world,this[Ro]||(this[Ro]={})),this[Ro]}get worldStrokeBounds(){return vo(this.strokeBounds,this.leaf.__world,this[Co]||(this[Co]={})),this[Co]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:s}=e;if(e.isApp)return wo(e);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=e;for(;s.parent&&!s.parent.leafer;)s=s.parent;const i=s;if(i.__fullLayouting)return;i.__fullLayouting=!0,t.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return G.defaultMatrix;case"page":t=e.zoomLayer;default:return xo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Xt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),n=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;o={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,n=G.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),n=xo(i,e,!0)}if(o||(o=G.getLayout(n)),Bo(o,a),rt.copy(o,r),s){const{scaleX:t,scaleY:e}=o,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(o.scaleX/=s,o.scaleY/=i,o.width*=s,o.height*=i)}return o}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=bo(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:r=e}return n(r)||i.forEach(t=>s.innerToWorld(t,null,!1,r)),i}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Po{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class Oo extends Po{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Oo.ADD="child.add",Oo.REMOVE="child.remove",Oo.CREATED="created",Oo.MOUNTED="mounted",Oo.UNMOUNTED="unmounted",Oo.DESTROY="destroy";const Eo="property.scroll";class Ao extends Po{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Ao.CHANGE="property.change",Ao.LEAFER_CHANGE="property.leafer_change",Ao.SCROLL=Eo;const Lo={scrollX:Eo,scrollY:Eo};class Io extends Po{constructor(t,e){super(t),Object.assign(this,e)}}Io.LOAD="image.load",Io.LOADED="image.loaded",Io.ERROR="image.error";class Wo extends Po{static checkHas(t,e,s){"on"===s?e===zo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Mo)||t.hasEvent(Do)||t.hasEvent(Fo),t.__hasWorldEvent=t.hasEvent(zo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Mo,t),"inner"===e&&t.emit(Do,t)),t.emit(Fo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(zo,this)}}Wo.RESIZE="bounds.resize",Wo.INNER="bounds.inner",Wo.LOCAL="bounds.local",Wo.WORLD="bounds.world";const{RESIZE:Mo,INNER:Do,LOCAL:Fo,WORLD:zo}=Wo,No={};[Mo,Do,Fo,zo].forEach(t=>No[t]=1);class Yo extends Po{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){_(t)?(super(Yo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Yo.RESIZE="resize";class Xo extends Po{constructor(t,e){super(t),this.data=e}}Xo.REQUEST="watch.request",Xo.DATA="watch.data";class Uo extends Po{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Uo.REQUEST="layout.request",Uo.START="layout.start",Uo.BEFORE="layout.before",Uo.LAYOUT="layout",Uo.AFTER="layout.after",Uo.AGAIN="layout.again",Uo.END="layout.end";class jo extends Po{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}jo.REQUEST="render.request",jo.CHILD_START="render.child_start",jo.CHILD_END="render.child_end",jo.START="render.start",jo.BEFORE="render.before",jo.RENDER="render",jo.AFTER="render.after",jo.AGAIN="render.again",jo.END="render.end",jo.NEXT="render.next";class Vo extends Po{}Vo.START="leafer.start",Vo.BEFORE_READY="leafer.before_ready",Vo.READY="leafer.ready",Vo.AFTER_READY="leafer.after_ready",Vo.VIEW_READY="leafer.view_ready",Vo.VIEW_COMPLETED="leafer.view_completed",Vo.STOP="leafer.stop",Vo.RESTART="leafer.restart",Vo.END="leafer.end",Vo.UPDATE_MODE="leafer.update_mode",Vo.TRANSFORM="leafer.transform",Vo.MOVE="leafer.move",Vo.SCALE="leafer.scale",Vo.ROTATE="leafer.rotate",Vo.SKEW="leafer.skew";const{MOVE:Ho,SCALE:Go,ROTATE:qo,SKEW:Qo}=Vo,Jo={x:Ho,y:Ho,scaleX:Go,scaleY:Go,rotation:qo,skewX:Qo,skewY:Qo},$o={};class Zo{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)u(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,n;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const o=Ko(this,i,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],No[t]&&Wo.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=a(t)?t.split(" "):t;if(e){let t,r,n;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const o=Ko(this,t);i.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],No[t]&&Wo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&oe.has(t)&&(e=oe.get(t,{type:t,target:this,current:this}));const i=Ko(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&!((r=i[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:i}=this,r=s&&s[t],o=i&&i[t];return!!(n(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Ko(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:$o)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:$o)}}const{on:ta,on_:ea,off:sa,off_:ia,once:ra,emit:na,emitEvent:oa,hasEvent:aa,destroy:ha}=Zo.prototype,la={on:ta,on_:ea,off:sa,off_:ia,once:ra,emit:na,emitEvent:oa,hasEvent:aa,destroyEventer:ha},da=Gt.get("setAttr"),ca={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||n(e)||(da.warn(this.innerName,t,e),e=void 0),_(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ao(Ao.LEAFER_CHANGE,this,t,i,e));const s=Jo[t];s&&(this.emitEvent(new Vo(s,this)),this.emitEvent(new Vo(Vo.TRANSFORM,this)))}this.emitPropertyEvent(Ao.CHANGE,t,i,e);const s=Lo[t];return s&&this.emitPropertyEvent(s,t,i,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new Ao(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||n(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ua,multiplyParent:_a,translateInner:pa,defaultWorld:ga}=G,{toPoint:fa,tempPoint:ya}=mt,ma={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;_a(this.__local||e,t?t.__scrollWorld||t.__world:ga,s,!!e.affectScaleOrRotation,r),i&&pa(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ua(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(fa(s.around||s.origin,t.boxBounds,ya),pa(e,-ya.x,-ya.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:xa,updateAllMatrix:wa}=eo,{updateBounds:va}=po,{toOuterOf:ba,copyAndSpread:Ba,copy:ka}=Ft,{toBounds:Sa}=Rr,Ra={__updateWorldBounds(){const t=this.__layout;ba(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Wo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Wo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?Sa(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),wa(this),va(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(wa(this),va(this,this))):xa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ba(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;l(s)&&s<=0?ka(e.renderBounds,e.strokeBounds):Ba(e.renderBounds,e.boxBounds,s)}},Ca={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),eo.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Gt.showBounds&&Gt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ta}=lo,Pa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ta(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)Ta(s[i],e)||s[i].__clip(t,e)}}},Oa={},{LEAF:Ea,create:Aa}=e,{stintSet:La}=f,{toInnerPoint:Ia,toOuterPoint:Wa,multiplyParent:Ma}=G,{toOuterOf:Da}=Ft,{copy:Fa,move:za}=rt,{moveLocal:Na,zoomOfLocal:Ya,rotateOfLocal:Xa,skewOfLocal:Ua,moveWorld:ja,zoomOfWorld:Va,rotateOfWorld:Ha,skewOfWorld:Ga,transform:qa,transformWorld:Qa,setTransform:Ja,getFlipTransform:$a,getLocalOrigin:Za,getRelativeWorld:Ka,drop:th}=eo;let eh=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return To}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Aa(Ea),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Oo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Oo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Oo.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Oo.MOUNTED)):this.__emitLifeEvent(Oo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Ma(s,t.matrix,e,void 0,s),Da(this.__layout.renderBounds,e,e),La(e,"half",s.half),La(e,"ignorePixelSnap",s.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:i}=Hr.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),Oa.scaleX=s,Oa.scaleY=i,Oa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?Ka(this,e):this.worldTransform,r=s?t:{};return Da(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Fa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Fa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Ia(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Wa(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return za(r,-n,-o),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return za(r,n,o),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){Ja(this,t,e,s)}transform(t,e,s){qa(this,t,e,s)}move(t,e,s){Na(this,t,e,s)}moveInner(t,e,s){ja(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Ya(this,Za(this,t),e,s,i,r)}rotateOf(t,e,s){Xa(this,Za(this,t),e,s)}skewOf(t,e,s,i,r){Ua(this,Za(this,t),e,s,i,r)}transformWorld(t,e,s){Qa(this,t,e,s)}moveWorld(t,e,s){ja(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Va(this,t,e,s,i,r)}rotateOfWorld(t,e){Ha(this,t,e)}skewOfWorld(t,e,s,i,r){Ga(this,t,e,s,i,r)}flip(t,e){qa(this,$a(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return te.need("path")}getMotionPoint(t){return te.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){th(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):In(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=un),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Oo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Oo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};eh=le([Yn(ca),Yn(ma),Yn(Ra),Yn(la),Yn(Ca)],eh);const{setListWithFn:sh}=Ft,{sort:ih}=po,{localBoxBounds:rh,localStrokeBounds:nh,localRenderBounds:oh,maskLocalBoxBounds:ah,maskLocalStrokeBounds:hh,maskLocalRenderBounds:lh}=lo,dh=new Gt("Branch");let ch=class extends eh{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){sh(e||this.__layout.boxBounds,this.children,this.__hasMask?ah:rh)}__updateStrokeBounds(t){sh(t||this.__layout.strokeBounds,this.children,this.__hasMask?hh:nh)}__updateRenderBounds(t){sh(t||this.__layout.renderBounds,this.children,this.__hasMask?lh:oh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(ih),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return dh.warn("add self or destroyed");const s=n(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),s||e++});t=ie.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const i=t.__layout;i.boxChanged||i.boxChange(),i.matrixChanged||i.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Oo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Oo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Oo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Oo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Oo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};ch=le([Yn(Pa)],ch);class uh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:s}=this;n(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(n(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)n(s)?e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]):this.keys[e[i].innerId]=i-1;n(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new uh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class _h{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const ph="1.9.8";class gh extends ke{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let s=e.view||e.canvas;s?(a(s)?("#"!==s[0]&&(s="#"+s),this.viewSelect=t.miniapp.select(s)):s.fields?this.viewSelect=s:this.initView(s),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:s,height:i,pixelRatio:r}=this.config,n={width:s||e.width,height:i||e.height,pixelRatio:r};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,s,i,r){this.context.roundRect(t,e,s,i,l(r)?[r]:r)}),Dr(this.context.__proto__))}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:s}=this;this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,s){this.resizeListener||(this.resizeListener=s,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:s}=this,i={width:t,height:e,pixelRatio:s};this.isSameSize(i)||this.emitResize(i)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};f.copyAttrs(e,this,Be),this.resize(t),n(this.width)||this.resizeListener(new Yo(t,e))}}const{mineType:fh,fileType:yh}=Fr;function mh(e,s){t.origin={createCanvas:(t,e,i)=>{const r={type:"2d",width:t,height:e};return s.createOffscreenCanvas?s.createOffscreenCanvas(r):s.createOffScreenCanvas(r)},canvasToDataURL:(t,e,s)=>t.toDataURL(fh(e),s),canvasToBolb:(t,e,s)=>t.toBuffer(e,{quality:s}),canvasSaveAs:(e,s,i)=>{let r=e.toDataURL(fh(yh(s)),i);return r=r.substring(r.indexOf("64,")+3),t.origin.download(r,s)},download:(e,i)=>new Promise((r,n)=>{let o;i.includes("/")||(i=`${s.env.USER_DATA_PATH}/`+i,o=!0);const a=s.getFileSystemManager();a.writeFile({filePath:i,data:e,encoding:"base64",success(){o?t.miniapp.saveToAlbum(i).then(()=>{a.unlink({filePath:i}),r()}):r()},fail(t){n(t)}})}),loadImage:e=>new Promise((s,i)=>{const r=t.canvas.view.createImage();r.onload=()=>{s(r)},r.onerror=t=>{i(t)},r.src=t.image.getRealURL(e)}),noRepeat:"repeat-x"},t.miniapp={select:t=>s.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const s=t[1];e({x:s.top,y:s.left,width:s.width,height:s.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const s=t[0];e({view:s.node,width:s.width,height:s.height})})}),saveToAlbum:t=>new Promise(e=>{s.getSetting({success:i=>{i.authSetting["scope.writePhotosAlbum"]?s.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):s.authorize({scope:"scope.writePhotosAlbum",success:()=>{s.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){s.onWindowResize(t)},offWindowResize(t){s.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=ee.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(ee,{canvas:(t,e)=>new gh(t,e),image:t=>new Zr(t)}),t.name="miniapp",t.requestRender=function(e){const{view:s}=t.renderCanvas||t.canvas;s.requestAnimationFrame?s.requestAnimationFrame(e):setTimeout(e,16)},Kr(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class xh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new uh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new uh,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(jo.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Oo.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Xo(Xo.DATA,{updatedList:this.updatedList})),this.__updatedList=new uh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ao.CHANGE,this.__onAttrChange,this],[[Oo.ADD,Oo.REMOVE],this.__onChildEvent,this],[Xo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wh,updateBounds:vh,updateChange:bh}=eo,{pushAllChildBranch:Bh,pushAllParent:kh}=po;const{worldBounds:Sh}=lo;class Rh{constructor(t){this.updatedBounds=new Xt,this.beforeBounds=new Xt,this.afterBounds=new Xt,u(t)&&(t=new uh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Sh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Sh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Ch,updateAllChange:Th}=eo,Ph=Gt.get("Layouter");class Oh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new _h,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Uo.START),this.layoutOnce(),t.emitEvent(new Uo(Uo.END,this.layoutedBlocks,this.times))}catch(t){Ph.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ph.warn("layouting"):this.times>3?Ph.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Xo.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=$t.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=Uo,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Uo(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(wh(t,!0),e.add(t),t.isBranch&&Bh(t,e),kh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),kh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||vh(i[t])}vh(s)}})}(this.__levelList),function(t){t.list.forEach(bh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Uo(n,a,this.times)),s.emitEvent(new Uo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,$t.end(e)}fullLayout(){const t=$t.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Uo,n=this.getBlocks(new uh(e));e.emitEvent(new Uo(s,n,this.times)),Oh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Uo(i,n,this.times)),e.emitEvent(new Uo(r,n,this.times)),this.addBlocks(n),$t.end(t)}static fullLayout(t){Ch(t,!0),t.isBranch?po.updateBounds(t):eo.updateBounds(t),Th(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Rh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new Rh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Uo.REQUEST,this.layout,this],[Uo.AGAIN,this.layoutAgain,this],[Xo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Eh=Gt.get("Renderer");class Ah{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Uo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(jo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(jo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(jo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Xt,Eh.log(e.innerName,"---\x3e");try{this.emitRender(jo.START),this.renderOnce(t),this.emitRender(jo.END,this.totalBounds),Hr.clearRecycled()}catch(t){this.rendering=!1,Eh.error(t)}Eh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Eh.warn("rendering");if(this.times>3)return Eh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Xt,this.renderOptions={},t)this.emitRender(jo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(jo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(jo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(jo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=$t.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Xt(i);s.save(),i.spread(Ah.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),$t.end(e)}fullRender(){const t=$t.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),$t.end(t)}__render(e,s){const{canvas:i}=this,r=e.includes(this.target.__world),n=r?{includes:r}:{bounds:e,includes:r};this.needFill&&i.fillWorld(e,this.config.fill),Gt.showRepaint&&Gt.drawRepaint(i,e),t.render(this.target,i,n),this.renderBounds=s=s||e,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=s:this.totalBounds.add(s),i.updateRender(s)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Xt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const s=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&e>i)return t.requestRender(s);const{frames:r}=this;r.length>30&&r.shift(),r.push(e),this.FPS=Math.round(r.reduce((t,e)=>t+e,0)/r.length),this.requestTime=0,this.checkRender()};t.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Xt(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Xt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Eh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new jo(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[jo.REQUEST,this.update,this],[Uo.END,this.__onLayoutEnd,this],[jo.AGAIN,this.renderAgain,this],[Yo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Lh(t){return sn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ih(t){return sn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Wh(){return(t,e)=>{const s="_"+e;Kr(t,e,{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 Mh(t){return(e,s)=>{Kr(e,s,en(s,t))}}Ah.clipSpread=10,Object.assign(ee,{watcher:(t,e)=>new xh(t,e),layouter:(t,e)=>new Oh(t,e),renderer:(t,e,s)=>new Ah(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),t.layout=Oh.fullLayout,t.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new uh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Dh={},Fh={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}},zh={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Nh={},Yh={},Xh={},Uh={},jh={},Vh={apply(){te.need("filter")}},Hh={},Gh={setStyleName:()=>te.need("state"),set:()=>te.need("state")},qh={list:{},register(t,e){qh.list[t]=e},get:t=>qh.list[t]},{parse:Qh,objectToCanvasData:Jh}=Gs,{stintSet:$h}=f,{hasTransparent:Zh}=Fh,Kh={},tl=Gt.get("UIData");class el extends m{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!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,tl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,tl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?($h(this,"__isTransparentFill",Zh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?($h(this,"__isTransparentStroke",Zh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?Qh(t):Jh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){sl(this,"shadow",t)}setInnerShadow(t){sl(this,"innerShadow",t)}setFilter(t){sl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Yh.compute("fill",this.__leaf),e&&Yh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Kh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Kh))}__removePaint(t,e){e&&this.__removeInput(t),Xh.recycleImage(t,this),"fill"===t?($h(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):($h(this,"__isAlphaPixelStroke",void 0),$h(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function sl(t,e,s){t.__setInput(e,s),u(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class il extends el{}class rl extends il{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 nl extends il{__getInputData(t,e){const s=super.__getInputData(t,e);return Be.forEach(t=>delete s[t]),s}}class ol extends rl{}class al extends el{get __usePathBox(){return this.points||this.__pathInputed}}class hl extends el{get __boxStroke(){return!this.__pathInputed}}class ll extends el{get __boxStroke(){return!this.__pathInputed}}class dl extends al{}class cl extends el{}class ul extends el{get __pathInputed(){return 2}}class _l extends il{}const pl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class gl extends el{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=pl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=ie.get("Rect",0);const r=e.__layout,n=s.__layout;i||(s.parent=e,s.__world=e.__world,n.boxBounds=r.boxBounds),s.set(t),n.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class fl extends hl{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 s=super.__getInputData(t,e);return delete s.fill,s}}class yl extends hl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:ml,add:xl}=k,wl={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,n=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),n&&(t=ml(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=jh.getShadowRenderSpread(this,e)),i&&(t=ml(t,i)),n&&(t=xl(t,Vh.getSpread(n))),o&&(t=xl(t,o)),a&&(t=xl(t,a));let l=t;return s&&(l=ml(l,jh.getInnerShadowSpread(this,s))),r&&(l=ml(l,r)),this.__layout.renderShapeSpread=l,h?ml(h.__updateRenderSpread(),t):t}},{float:vl}=A,bl=new Xt,Bl=new Xt,kl=new Xt,Sl={limitMove(t,e){const{dragBounds:s,dragBoundsType:i}=t;s&&Rl.getValidMove(t.__localBoxBounds,Rl.getDragBounds(t),i,e,!0),Rl.axisMove(t,e)},limitScaleOf(t,e,s){const{dragBounds:i,dragBoundsType:r}=t;i&&Rl.getValidScaleOf(t.__localBoxBounds,Rl.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),s,!0)},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,s,i)=>"inner"===s||"auto"===s&&t[i]>e[i],getValidMove(t,e,s,i,r){const n=t.x+i.x,o=t.y+i.y,a=n+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return r||(i=Object.assign({},i)),Rl.isInnerMode(t,e,s,"width")?n>e.x?i.x+=e.x-n:a<l&&(i.x+=l-a):n<e.x?i.x+=e.x-n:a>l&&(i.x+=l-a),Rl.isInnerMode(t,e,s,"height")?o>e.y?i.y+=e.y-o:h<d&&(i.y+=d-h):o<e.y?i.y+=e.y-o:h>d&&(i.y+=d-h),i.x=vl(i.x),i.y=vl(i.y),i},getValidScaleOf(t,e,s,i,r,n){let o,a;return n||(r=Object.assign({},r)),bl.set(t).scaleOf(i,r.x,r.y).unsign(),Bl.set(bl).add(e),kl.set(bl).intersect(e),o=Rl.isInnerMode(t,e,s,"width")?Bl.width/bl.width:kl.width/bl.width,a=Rl.isInnerMode(t,e,s,"height")?Bl.height/bl.height:kl.height/bl.height,r.x=vl(kl.width)?r.x*o:1,r.y=vl(kl.height)?r.y*a:1,r}},Rl=Sl,{stintSet:Cl}=f,Tl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Cl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Cl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Cl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!jh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(u(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Cl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Pl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Yh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&jh.shadow(this,t,h),a&&(i.__isStrokes?Yh.strokes(n,this,t):Yh.stroke(n,this,t)),r&&(i.__isFills?Yh.fills(r,this,t):Yh.fill(r,this,t)),o&&this.__drawAfterFill(t,e),d&&jh.innerShadow(this,t,h),n&&!a&&(i.__isStrokes?Yh.strokes(n,this,t):Yh.stroke(n,this,t)),c&&Vh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Yh.strokes(n,this,t):Yh.stroke(n,this,t)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Fh.string(e.color))}r&&(i.__isFills?Yh.fills(r,this,t):Yh.fill(r,this,t)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(i.__isStrokes?Yh.strokes(n,this,t):Yh.stroke(n,this,t))}}else i.__pathInputed?Pl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Yh.fills(i,this,t):Yh.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Yh.strokes(r,this,t):Yh.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 Pl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Yh.stroke(r,t,e),i&&Yh.fill(i,t,e),n&&t.__drawAfterFill(e,s),r&&!o&&Yh.stroke(r,t,e)}const Ol={__drawFast(t,e){let{x:s,y:i,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(s,i,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,n),t.restore()):t.strokeRect(s+l,i+l,r,n);break;case"outside":t.strokeRect(s-l,i-l,r+h,n+h)}}}};var El;let Al=El=class extends eh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){A.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 Wr.set(this.path=t||[]),t||this.__drawPathByBox(Wr),Wr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return te.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return te.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(Wr.set(s=[]),this.__drawPathByBox(Wr)),t?Gs.toCanvasData(s,!0):s}getPathString(t,e,s){return Gs.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Hh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Lr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Nh.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)}__drawPathByData(t,e){e?qi.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,s,i,r,l(n)?[n]:n)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e){Yh.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return this.set(t),te.need("animate")}killAnimate(t,e){}export(t,e){return te.need("export")}syncExport(t,e){return te.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),El.one(e)}static one(t,e,s,i,r){return ie.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Xn()(this)}static registerData(t){An(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};le([An(el)],Al.prototype,"__",void 0),le([Wh()],Al.prototype,"zoomLayer",void 0),le([on("")],Al.prototype,"id",void 0),le([on("")],Al.prototype,"name",void 0),le([on("")],Al.prototype,"className",void 0),le([vn("pass-through")],Al.prototype,"blendMode",void 0),le([Bn(1)],Al.prototype,"opacity",void 0),le([kn(!0)],Al.prototype,"visible",void 0),le([vn(!1)],Al.prototype,"locked",void 0),le([bn(!1)],Al.prototype,"dim",void 0),le([bn(!1)],Al.prototype,"dimskip",void 0),le([Cn(0)],Al.prototype,"zIndex",void 0),le([Tn(!1)],Al.prototype,"mask",void 0),le([Pn(!1)],Al.prototype,"eraser",void 0),le([an(0,!0)],Al.prototype,"x",void 0),le([an(0,!0)],Al.prototype,"y",void 0),le([un(100,!0)],Al.prototype,"width",void 0),le([un(100,!0)],Al.prototype,"height",void 0),le([dn(1,!0)],Al.prototype,"scaleX",void 0),le([dn(1,!0)],Al.prototype,"scaleY",void 0),le([cn(0,!0)],Al.prototype,"rotation",void 0),le([cn(0,!0)],Al.prototype,"skewX",void 0),le([cn(0,!0)],Al.prototype,"skewY",void 0),le([an(0,!0)],Al.prototype,"offsetX",void 0),le([an(0,!0)],Al.prototype,"offsetY",void 0),le([hn(0,!0)],Al.prototype,"scrollX",void 0),le([hn(0,!0)],Al.prototype,"scrollY",void 0),le([ln()],Al.prototype,"origin",void 0),le([ln()],Al.prototype,"around",void 0),le([on(!1)],Al.prototype,"lazy",void 0),le([_n(1)],Al.prototype,"pixelRatio",void 0),le([wn(0)],Al.prototype,"renderSpread",void 0),le([gn()],Al.prototype,"path",void 0),le([fn()],Al.prototype,"windingRule",void 0),le([fn(!0)],Al.prototype,"closed",void 0),le([un(0)],Al.prototype,"padding",void 0),le([un(!1)],Al.prototype,"lockRatio",void 0),le([un()],Al.prototype,"widthRange",void 0),le([un()],Al.prototype,"heightRange",void 0),le([on(!1)],Al.prototype,"draggable",void 0),le([on()],Al.prototype,"dragBounds",void 0),le([on("auto")],Al.prototype,"dragBoundsType",void 0),le([on(!1)],Al.prototype,"editable",void 0),le([On(!0)],Al.prototype,"hittable",void 0),le([On("path")],Al.prototype,"hitFill",void 0),le([xn("path")],Al.prototype,"hitStroke",void 0),le([On(!1)],Al.prototype,"hitBox",void 0),le([On(!0)],Al.prototype,"hitChildren",void 0),le([On(!0)],Al.prototype,"hitSelf",void 0),le([On()],Al.prototype,"hitRadius",void 0),le([En("")],Al.prototype,"cursor",void 0),le([vn()],Al.prototype,"fill",void 0),le([xn(void 0,!0)],Al.prototype,"stroke",void 0),le([xn("inside")],Al.prototype,"strokeAlign",void 0),le([xn(1,!0)],Al.prototype,"strokeWidth",void 0),le([xn(!1)],Al.prototype,"strokeWidthFixed",void 0),le([xn("none")],Al.prototype,"strokeCap",void 0),le([xn("miter")],Al.prototype,"strokeJoin",void 0),le([xn()],Al.prototype,"dashPattern",void 0),le([xn(0)],Al.prototype,"dashOffset",void 0),le([xn(10)],Al.prototype,"miterLimit",void 0),le([fn(0)],Al.prototype,"cornerRadius",void 0),le([fn()],Al.prototype,"cornerSmoothing",void 0),le([Lh()],Al.prototype,"shadow",void 0),le([Lh()],Al.prototype,"innerShadow",void 0),le([Lh()],Al.prototype,"blur",void 0),le([Lh()],Al.prototype,"backgroundBlur",void 0),le([Lh()],Al.prototype,"grayscale",void 0),le([Lh()],Al.prototype,"filter",void 0),le([vn()],Al.prototype,"placeholderColor",void 0),le([on(100)],Al.prototype,"placeholderDelay",void 0),le([on({})],Al.prototype,"data",void 0),le([Fn(eh.prototype.reset)],Al.prototype,"reset",null),Al=El=le([Yn(wl),Yn(Tl),zn()],Al);let Ll=class extends Al{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:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}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 Il;le([An(il)],Ll.prototype,"__",void 0),le([un(0)],Ll.prototype,"width",void 0),le([un(0)],Ll.prototype,"height",void 0),Ll=le([Yn(ch),Xn()],Ll);const Wl=Gt.get("Leafer");let Ml=Il=class extends Ll{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&jr.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)||{x:0,y:0,width:0,height:0}}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),Il.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(i,t));const r=this.canvas=ee.canvas(i);this.__controllers.push(this.renderer=ee.renderer(this,r,i),this.watcher=ee.watcher(this,i),this.layouter=ee.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ee.selector(this),this.interaction=ee.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ee.hitCanvasManager()),this.canvasManager=new he,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),mo.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(Vo.RESTART):this.emitLeafer(Vo.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(Vo.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,Be);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Xt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.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 s=f.copyAttrs({},this.canvas,Be);e.resize(t),this.updateLazyBounds(),this.__onResize(new Yo(t,s))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,Be),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 jt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Be.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(Vo.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Be.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=f.copyAttrs({},i,Be);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(Vo.BEFORE_READY),this.emitLeafer(Vo.READY),this.emitLeafer(Vo.AFTER_READY),mo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Vo.VIEW_READY),mo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,o.x+o.width)),s||(r=Math.max(1,o.y+o.height)),this.__doResize({width:i,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){mo.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(Vo.VIEW_COMPLETED),mo.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,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return te.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Vo(t,this))}__listenEvents(){const t=$t.start("FirstCreate "+this.innerName);this.once([[Vo.START,()=>$t.end(t)],[Uo.START,this.updateLazyBounds,this],[jo.START,this.__onCreated,this],[jo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Xo.DATA,this.__onWatchData,this],[Uo.END,this.__onLayoutEnd,this],[jo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Il.list.remove(this);try{this.stop(),this.emitLeafer(Vo.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.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Hr.clearRecycled()},100)}catch(t){Wl.error(t)}}};t?e():setTimeout(e)}};Ml.list=new uh,le([An(nl)],Ml.prototype,"__",void 0),le([un()],Ml.prototype,"pixelRatio",void 0),le([on("normal")],Ml.prototype,"mode",void 0),Ml=Il=le([Xn()],Ml);let Dl=class extends Al{get __tag(){return"Rect"}};le([An(hl)],Dl.prototype,"__",void 0),Dl=le([Yn(Ol),zn(),Xn()],Dl);const{add:Fl,includes:zl,scroll:Nl}=Ft,Yl=Dl.prototype,Xl=Ll.prototype;let Ul=class extends Ll{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 s=this.__,i=this.__layout,{renderBounds:r,boxBounds:n}=i,{overflow:o}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o.includes("scroll"))&&(Fl(a,n),Nl(a,s)),this.__updateRectRenderBounds(),t=!zl(n,a),t&&"show"===o&&Fl(r,a)}else this.__updateRectRenderBounds();f.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))}};le([An(rl)],Ul.prototype,"__",void 0),le([un(100)],Ul.prototype,"width",void 0),le([un(100)],Ul.prototype,"height",void 0),le([on(!1)],Ul.prototype,"resizeChildren",void 0),le([wn("show")],Ul.prototype,"overflow",void 0),le([Fn(Yl.__updateStrokeSpread)],Ul.prototype,"__updateStrokeSpread",null),le([Fn(Yl.__updateRenderSpread)],Ul.prototype,"__updateRectRenderSpread",null),le([Fn(Yl.__updateBoxBounds)],Ul.prototype,"__updateRectBoxBounds",null),le([Fn(Yl.__updateStrokeBounds)],Ul.prototype,"__updateStrokeBounds",null),le([Fn(Yl.__updateRenderBounds)],Ul.prototype,"__updateRectRenderBounds",null),le([Fn(Yl.__updateChange)],Ul.prototype,"__updateRectChange",null),le([Fn(Yl.__render)],Ul.prototype,"__renderRect",null),le([Fn(Xl.__render)],Ul.prototype,"__renderGroup",null),Ul=le([zn(),Xn()],Ul);let jl=class extends Ul{get __tag(){return"Frame"}get isFrame(){return!0}};le([An(ol)],jl.prototype,"__",void 0),le([vn("#FFFFFF")],jl.prototype,"fill",void 0),le([wn("hide")],jl.prototype,"overflow",void 0),jl=le([Xn()],jl);const{moveTo:Vl,closePath:Hl,ellipse:Gl}=fi;let ql=class extends Al{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:s,innerRadius:i,startAngle:r,endAngle:n}=this.__,o=e/2,a=s/2,h=this.__.path=[];i?(r||n?(i<1&&Gl(h,o,a,o*i,a*i,0,r,n,!1),Gl(h,o,a,o,a,0,n,r,!0),i<1&&Hl(h)):(i<1&&(Gl(h,o,a,o*i,a*i),Vl(h,e,a)),Gl(h,o,a,o,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||n?(Vl(h,o,a),Gl(h,o,a,o,a,0,r,n,!1),Hl(h)):Gl(h,o,a,o,a)}};le([An(ll)],ql.prototype,"__",void 0),le([fn(0)],ql.prototype,"innerRadius",void 0),le([fn(0)],ql.prototype,"startAngle",void 0),le([fn(0)],ql.prototype,"endAngle",void 0),ql=le([Xn()],ql);const{sin:Ql,cos:Jl,PI:$l}=Math,{moveTo:Zl,lineTo:Kl,closePath:td,drawPoints:ed}=fi;let sd=class extends Al{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ed(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,n=s/2,o=i/2;Zl(e,n,0);for(let t=1;t<r;t++)Kl(e,n+n*Ql(2*t*$l/r),o-o*Jl(2*t*$l/r));td(e)}}};le([An(dl)],sd.prototype,"__",void 0),le([fn(3)],sd.prototype,"sides",void 0),le([fn()],sd.prototype,"points",void 0),le([fn(0)],sd.prototype,"curve",void 0),sd=le([zn(),Xn()],sd);const{sin:id,cos:rd,PI:nd}=Math,{moveTo:od,lineTo:ad,closePath:hd}=fi;let ld=class extends Al{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,n=e/2,o=this.__.path=[];od(o,r,0);for(let t=1;t<2*s;t++)ad(o,r+(t%2==0?r:r*i)*id(t*nd/s),n-(t%2==0?n:n*i)*rd(t*nd/s));hd(o)}};le([An(cl)],ld.prototype,"__",void 0),le([fn(5)],ld.prototype,"corners",void 0),le([fn(.382)],ld.prototype,"innerRadius",void 0),ld=le([Xn()],ld);const{moveTo:dd,lineTo:cd,drawPoints:ud}=fi,{rotate:_d,getAngle:pd,getDistance:gd,defaultPoint:fd}=rt;let yd=class extends Al{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&_d(s,e),s}set toPoint(t){this.width=gd(fd,t),this.rotation=pd(fd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ud(e,t.points,t.curve,t.closed):(dd(e,0,0),cd(e,this.width,0))}};le([An(al)],yd.prototype,"__",void 0),le([yn("center")],yd.prototype,"strokeAlign",void 0),le([un(0)],yd.prototype,"height",void 0),le([fn()],yd.prototype,"points",void 0),le([fn(0)],yd.prototype,"curve",void 0),le([fn(!1)],yd.prototype,"closed",void 0),yd=le([Xn()],yd);let md=class extends Dl{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}};le([An(fl)],md.prototype,"__",void 0),le([un("")],md.prototype,"url",void 0),md=le([Xn()],md);const xd=md;let wd=class extends Dl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ee.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Zr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Io(Io.LOADED,{image:t}))})}draw(t,e,s,i){const r=new ct(t.worldTransform).invert(),n=new ct;e&&n.translate(e.x,e.y),s&&(l(s)?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};le([An(yl)],wd.prototype,"__",void 0),le([Ih(100)],wd.prototype,"width",void 0),le([Ih(100)],wd.prototype,"height",void 0),le([Ih(1)],wd.prototype,"pixelRatio",void 0),le([Ih(!0)],wd.prototype,"smooth",void 0),le([on(!1)],wd.prototype,"safeResize",void 0),le([Ih()],wd.prototype,"contextSettings",void 0),wd=le([Xn()],wd);const{copyAndSpread:vd,includes:bd,spread:Bd,setList:kd}=Ft;let Sd=class extends Al{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=zh.number(e,r),t.__letterSpacing=zh.number(s,r),t.__padding=l?A.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${i||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Dh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&Bd(a,s/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,s,i,r]=t.__padding;n&&(h.x-=r,h.width+=s+r),o&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),f.stintSet(this,"isOverflow",!bd(h,a)),this.isOverflow?(kd(t.__textBoxBounds={},[h,a]),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;vd(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,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};le([An(gl)],Sd.prototype,"__",void 0),le([un(0)],Sd.prototype,"width",void 0),le([un(0)],Sd.prototype,"height",void 0),le([vn()],Sd.prototype,"boxStyle",void 0),le([on(!1)],Sd.prototype,"resizeFontSize",void 0),le([vn("#000000")],Sd.prototype,"fill",void 0),le([yn("outside")],Sd.prototype,"strokeAlign",void 0),le([On("all")],Sd.prototype,"hitFill",void 0),le([un("")],Sd.prototype,"text",void 0),le([un("")],Sd.prototype,"placeholder",void 0),le([un("caption")],Sd.prototype,"fontFamily",void 0),le([un(12)],Sd.prototype,"fontSize",void 0),le([un("normal")],Sd.prototype,"fontWeight",void 0),le([un(!1)],Sd.prototype,"italic",void 0),le([un("none")],Sd.prototype,"textCase",void 0),le([un("none")],Sd.prototype,"textDecoration",void 0),le([un(0)],Sd.prototype,"letterSpacing",void 0),le([un({type:"percent",value:1.5})],Sd.prototype,"lineHeight",void 0),le([un(0)],Sd.prototype,"paraIndent",void 0),le([un(0)],Sd.prototype,"paraSpacing",void 0),le([un("x")],Sd.prototype,"writingMode",void 0),le([un("left")],Sd.prototype,"textAlign",void 0),le([un("top")],Sd.prototype,"verticalAlign",void 0),le([un(!0)],Sd.prototype,"autoSizeAlign",void 0),le([un("normal")],Sd.prototype,"textWrap",void 0),le([un("show")],Sd.prototype,"textOverflow",void 0),le([vn(!1)],Sd.prototype,"textEditing",void 0),Sd=le([Xn()],Sd);let Rd=class extends Al{get __tag(){return"Path"}};le([An(ul)],Rd.prototype,"__",void 0),le([yn("center")],Rd.prototype,"strokeAlign",void 0),Rd=le([Xn()],Rd);let Cd=class extends Ll{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Rd(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,s,i,r,n){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,n,o,a){return this}drawArc(t,e,s,i,r,n){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};function Td(t,e){const s=t.__,{rows:i,decorationY:r}=s.__textDrawData;let n;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,s=i.length;t<s;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(r){const{decorationColor:t,decorationHeight:n}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,n)))}}function Pd(t,e){t.__.__font?Td(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Od(t,e,s){switch(e.__.strokeAlign){case"center":Ed(t,1,e,s);break;case"inside":Ad(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?Ed(t,2,e,s):Ad(t,"outside",e,s)}}function Ed(t,e,s,i){const r=s.__;_(t)?Id(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),Ld(s,i))}function Ad(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,Ed(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",Td(s,r),r.blendMode="normal",eo.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function Ld(t,e){let s,i=t.__.__textDrawData;const{rows:r,decorationY:n}=i;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(n){const{decorationHeight:t}=i;r.forEach(s=>n.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}}function Id(t,e,s,i,r){let n;const o=i.__,{__hasMultiStrokeStyle:a}=o;a||r.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!Xh.checkImage(i,r,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?r.setStroke(n.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(n.style,o.__strokeWidth*e,o)}else r.strokeStyle=n.style;n.blendMode?(r.saveBlendMode(n.blendMode),s?Ld(i,r):r.stroke(),r.restoreBlendMode()):s?Ld(i,r):r.stroke()}}function Wd(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)Od(t,e,s);else switch(i.strokeAlign){case"center":Md(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),Md(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)Md(t,2,e,s);else{const{renderBounds:r}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),Md(t,2,e,n),n.clipUI(i),n.clearWorld(r),eo.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s)}}function Md(t,e,s,i){const r=s.__;_(t)?Id(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&Yh.strokeArrow(t,s,i)}le([An(_l)],Cd.prototype,"__",void 0),le([(t,e)=>{Kr(t,e,{get(){return this.__path}})}],Cd.prototype,"path",void 0),Cd=le([Yn(Li,["set","path","paint"]),Xn()],Cd);const{getSpread:Dd,copyAndSpread:Fd,toOuterOf:zd,getOuterOf:Nd,getByMove:Yd,move:Xd,getIntersectData:Ud}=Ft,jd={};let Vd;const{stintSet:Hd}=f,{hasTransparent:Gd}=Fh;function qd(t,e,s){if(!_(e)||!1===e.visible||0===e.opacity)return;let i;const{boxBounds:r}=s.__layout;switch(e.type){case"image":i=Xh.image(s,t,e,r,!Vd||!Vd[e.url]);break;case"linear":i=Uh.linearGradient(e,r);break;case"radial":i=Uh.radialGradient(e,r);break;case"angular":i=Uh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;i={type:o,style:Fh.string(a,h)};break;default:n(e.r)||(i={type:"solid",style:Fh.string(e)})}if(i){if(a(i.style)&&Gd(i.style)&&(i.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;i.strokeStyle=e.style}e.editing&&(i.editing=e.editing),e.blendMode&&(i.blendMode=e.blendMode)}return i}const Qd={compute:function(t,e){const s=e.__,i=[];let r,n,o,a=s.__input[t];u(a)||(a=[a]),Vd=Xh.recycleImage(t,s);for(let s,r=0,n=a.length;r<n;r++)(s=qd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(o||(o=1),s.strokeStyle.strokeWidth&&(o=Math.max(o,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length&&i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Hd(s,"__isAlphaPixelFill",r),Hd(s,"__isTransparentFill",n)):(Hd(s,"__isAlphaPixelStroke",r),Hd(s,"__isTransparentStroke",n),Hd(s,"__hasMultiStrokeStyle",o))},fill:function(t,e,s){s.fillStyle=t,Pd(e,s)},fills:function(t,e,s){let i;for(let r=0,n=t.length;r<n;r++){if(i=t[r],i.image){if(Xh.checkImage(e,s,i,!e.__.__font))continue;if(!i.style){!r&&i.image.isPlacehold&&e.drawImagePlaceholder(s,i.image);continue}}if(s.fillStyle=i.style,i.transform||i.scaleFixed){if(s.save(),i.transform&&s.transform(i.transform),i.scaleFixed){const{scaleX:t,scaleY:r}=e.getRenderScaleData(!0);(!0===i.scaleFixed||"zoom-in"===i.scaleFixed&&t>1&&r>1)&&s.scale(1/t,1/r)}i.blendMode&&(s.blendMode=i.blendMode),Pd(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),Pd(e,s),s.restoreBlendMode()):Pd(e,s)}},fillPathOrText:Pd,fillText:Td,stroke:Wd,strokes:function(t,e,s){Wd(t,e,s)},strokeText:Od,drawTextStroke:Ld,shape:function(e,s,i){const r=s.getSameCanvas(),n=s.bounds,o=e.__nowWorld,a=e.__layout,h=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let l,d,c,u,_,p;zd(a.strokeSpread?(Fd(jd,a.boxBounds,a.strokeSpread),jd):a.boxBounds,o,h);let{scaleX:g,scaleY:f}=e.getRenderScaleData(!0);if(n.includes(h))p=r,l=_=h,d=o;else{let r;if(t.fullImageShadow)r=h;else{const t=a.renderShapeSpread?Dd(n,k.swapAndScale(a.renderShapeSpread,g,f)):n;r=Ud(t,h)}u=n.getFitMatrix(r);let{a:y,d:m}=u;u.a<1&&(p=s.getSameCanvas(),e.__renderShape(p,i),g*=y,f*=m),_=Nd(h,u),l=Yd(_,-u.e,-u.f),d=Nd(o,u),Xd(d,-u.e,-u.f);const x=i.matrix;x?(c=new ct(u),c.multiply(x),y*=x.scaleX,m*=x.scaleY):c=u,c.withScale(y,m),i=Object.assign(Object.assign({},i),{matrix:c})}return e.__renderShape(r,i),{canvas:r,matrix:c,fitMatrix:u,bounds:l,renderBounds:d,worldCanvas:p,shapeBounds:_,scaleX:g,scaleY:f}}};let Jd={},$d={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Zd,rotateOfOuter:Kd,translate:tc,scaleOfOuter:ec,multiplyParent:sc,scale:ic,rotate:rc,skew:nc}=G;function oc(t,e,s,i,r,n,o){const a=Zd();tc(a,e.x+s,e.y+i),ic(a,r,n),o&&Kd(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function ac(t,e,s,i,r,n,o,a,h,l){const d=Zd();lc(d,e,s,i,r,n,o,a),h&&($d.a=h,$d.d=l,sc(d,$d)),t.transform=d}function hc(t,e,s,i,r,n,o,a,h,l,d,c){const u=Zd();if(c)lc(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)Kd(u,{x:s/2,y:i/2},h);else switch(rc(u,h),h){case 90:tc(u,i,0);break;case 180:tc(u,s,i);break;case 270:tc(u,0,s)}Jd.x=e.x+r,Jd.y=e.y+n,tc(u,Jd.x,Jd.y),o&&ec(u,Jd,o,a)}t.transform=u}function lc(t,e,s,i,r,n,o,a){o&&rc(t,o),a&&nc(t,a.x,a.y),r&&ic(t,r,n),tc(t,e.x+s,e.y+i)}const{get:dc,translate:cc}=G,uc=new Xt,_c={},pc={};function gc(t,e,s,i){const{changeful:r,sync:n,scaleFixed:o}=s;r&&(t.changeful=r),n&&(t.sync=n),o&&(t.scaleFixed=o),t.data=fc(s,i,e)}function fc(t,e,s){t.padding&&(e=uc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:i,height:r}=s;const{opacity:n,mode:o,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===r,w={mode:o},v="center"!==h&&(u||0)%180==90;let b,B;switch(Ft.set(pc,0,0,v?r:i,v?i:r),o&&"cover"!==o&&"fit"!==o?((d||c)&&(A.getScaleData(d,c,s,_c),b=_c.scaleX,B=_c.scaleY),(h||y||f)&&(b&&Ft.scale(pc,b,B,!0),h&&vt.toPoint(h,pc,e,pc,!0,!0))):x&&!u||(b=B=Ft.getFitScale(e,pc,"fit"!==o),Ft.put(e,s,h,b,!1,pc),Ft.scale(pc,b,B,!0)),l&&rt.move(pc,l),o){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":if(pc.x||pc.y||b||g||u||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),ac(w,e,pc.x,pc.y,b,B,u,p,t,s),t&&(b=b?b*t:b,B=B?B*s:s)}break;case"repeat":(!x||b||u||p)&&hc(w,e,i,r,pc.x,pc.y,b,B,u,p,h,t.freeTransform),f||(w.repeat="repeat");const s=_(f);(y||s)&&(w.gap=function(t,e,s,i,r){let n,o;_(t)?(n=t.x,o=t.y):n=o=t;return{x:yc(n,s,r.width,e&&e.x),y:yc(o,i,r.height,e&&e.y)}}(y,s&&f,pc.width,pc.height,e));break;default:b&&oc(w,e,pc.x,pc.y,b,B,u)}return w.transform||(e.x||e.y)&&(w.transform=dc(),cc(w.transform,e.x,e.y)),b&&"stretch"!==o&&(w.scaleX=b,w.scaleY=B),w.width=i,w.height=r,n&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function yc(t,e,s,i){const r=a(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let mc,xc=new Xt;const{isSame:wc}=Ft;function vc(t,e,s,i,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||gc(r,i,s,n),!0}function bc(t,e){Sc(t,Io.LOAD,e)}function Bc(t,e){Sc(t,Io.LOADED,e)}function kc(t,e,s){e.error=s,t.forceUpdate("surface"),Sc(t,Io.ERROR,e)}function Sc(t,e,s){t.hasEvent(e)&&t.emitEvent(new Io(e,s))}function Rc(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Cc,scale:Tc,copy:Pc}=G,{floor:Oc,ceil:Ec,max:Ac,abs:Lc}=Math;function Ic(e,s,i){let{scaleX:r,scaleY:n}=e.getRenderScaleData(!0,s.scaleFixed);const o=r+"-"+n+"-"+i;if(s.patternId===o||e.destroyed)return!1;{const{image:a,data:h}=s;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:g,repeat:f,gap:y}=h;r*=i,n*=i,_&&(_=Lc(_),p=Lc(p),d=Cc(),Pc(d,g),Tc(d,1/_,1/p),r*=_,n*=p),c*=r,u*=n;const m=c*u;if(!f&&m>t.image.maxCacheSize)return!1;let x=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Ec(t))}else{const t=a.width*a.height;x>t&&(x=t)}m>x&&(l=Math.sqrt(m/x)),l&&(r/=l,n/=l,c/=l,u/=l),_&&(r/=_,n/=p);const w=y&&y.x*r,v=y&&y.y*n;if(g||1!==r||1!==n){const t=c+(w||0),e=u+(v||0);r/=t/Ac(Oc(t),1),n/=e/Ac(Oc(e),1),d||(d=Cc(),g&&Pc(d,g)),Tc(d,1/r,1/n)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,v,e.leafer&&e.leafer.config.smooth),B=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,s);return s.style=B,s.patternId=o,!0}}const Wc={image:function(t,e,s,i,r){let n,o;const a=Hr.get(s);return mc&&s===mc.paint&&wc(i,mc.boxBounds)?n=mc.leafPaint:(n={type:s.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),mc=a.use>1?{leafPaint:n,paint:s,boxBounds:xc.set(i)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:s}),a.ready?(vc(t,e,s,a,n,i),r&&(bc(t,o),Bc(t,o))):a.error?r&&kc(t,o,a.error):(r&&(Rc(t,!0),bc(t,o)),n.loadId=a.load(()=>{Rc(t,!1),t.destroyed||(vc(t,e,s,a,n,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Bc(t,o)),n.loadId=void 0},e=>{Rc(t,!1),kc(t,o,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(e,s,i,r){const{scaleX:n,scaleY:o}=e.getRenderScaleData(!0,i.scaleFixed),{pixelRatio:a}=s,{data:h}=i;if(!h||i.patternId===n+"-"+o+"-"+a&&!Hh.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===t.name&&Yo.isResizing(e)||Hh.running)){let{width:e,height:s}=h;e*=n*a,s*=o*a,h.scaleX&&(e*=h.scaleX,s*=h.scaleY),r=e*s>t.image.maxCacheSize}return r?(e.__.__isFastShadow&&(s.fillStyle=i.style||"#000",s.fill()),function(t,e,s,i){e.save(),e.clipUI(t),s.blendMode&&(e.blendMode=s.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(s.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,s,i,h),!0):(!i.style||i.sync||Hh.running?Ic(e,i,a):i.patternTask||(i.patternTask=Hr.patternTasker.add(()=>de(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(e.__nowWorld)&&Ic(e,i,a),e.forceUpdate("surface")}),300)),!1)},createPattern:Ic,recycleImage:function(t,e){const s=e["_"+t];if(u(s)){let i,r,n,o,a;for(let h=0,l=s.length;h<l;h++)i=s[h],r=i.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,Hr.recycle(r),r.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),r.unload(s[h].loadId,!o.some(t=>t.url===a))));return n}return null},createData:gc,getPatternData:fc,fillOrFitMode:oc,clipMode:ac,repeatMode:hc},{toPoint:Mc}=mt,{hasTransparent:Dc}=Fh,Fc={},zc={};function Nc(t,e,s,i){if(s){let r,n,o,h;for(let t=0,l=s.length;t<l;t++)r=s[t],a(r)?(o=t/(l-1),n=Fh.string(r,i)):(o=r.offset,n=Fh.string(r.color,i)),e.addColorStop(o,n),!h&&Dc(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Yc,getDistance:Xc}=rt,{get:Uc,rotateOfOuter:jc,scaleOfOuter:Vc}=G,{toPoint:Hc}=mt,Gc={},qc={};function Qc(t,e,s,i,r){let n;const{width:o,height:a}=t;if(o!==a||i){const t=Yc(e,s);n=Uc(),r?(Vc(n,e,o/a*(i||1),1),jc(n,e,t+90)):(Vc(n,e,1,o/a*(i||1)),jc(n,e,t))}return n}const{getDistance:Jc}=rt,{toPoint:$c}=mt,Zc={},Kc={};const tu={linearGradient:function(e,s){let{from:i,to:r,type:n,opacity:o}=e;Mc(i||"top",s,Fc),Mc(r||"bottom",s,zc);const a=t.canvas.createLinearGradient(Fc.x,Fc.y,zc.x,zc.y),h={type:n,style:a};return Nc(h,a,e.stops,o),h},radialGradient:function(e,s){let{from:i,to:r,type:n,opacity:o,stretch:a}=e;Hc(i||"center",s,Gc),Hc(r||"bottom",s,qc);const h=t.canvas.createRadialGradient(Gc.x,Gc.y,0,Gc.x,Gc.y,Xc(Gc,qc)),l={type:n,style:h};Nc(l,h,e.stops,o);const d=Qc(s,Gc,qc,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,s){let{from:i,to:r,type:n,opacity:o,stretch:a}=e;$c(i||"center",s,Zc),$c(r||"bottom",s,Kc);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Zc.x,Zc.y):t.canvas.createRadialGradient(Zc.x,Zc.y,0,Zc.x,Zc.y,Jc(Zc,Kc)),l={type:n,style:h};Nc(l,h,e.stops,o);const d=Qc(s,Zc,Kc,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Qc},{copy:eu,move:su,toOffsetOutBounds:iu}=Ft,{max:ru}=Math,nu={},ou=new ct,au={};function hu(t,e){let s,i,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,r=t.spread||0,n=1.5*(t.blur||0),o=ru(o,r+n-i),a=ru(a,r+n+s),h=ru(h,r+n+i),l=ru(l,r+n-s)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function lu(t,e,s,i,r,n,o){if(i.spread){const s=1+2*i.spread/t.__layout.strokeBounds.width*n*(o?-1:1);return ou.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},s),ou}}function du(e,s,i){const{shapeBounds:r}=i;let n,o;t.fullImageShadow?(eu(nu,e.bounds),su(nu,s.x-r.x,s.y-r.y),n=e.bounds,o=nu):(n=r,o=s),e.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:cu}=Ft,uu={};const _u=hu;const pu={shadow:function(t,e,s){let i,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=o.length-1;iu(h,au,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(au.offsetX+o.x*c*f,au.offsetY+o.y*u*f,o.blur*c*f,Fh.string(o.color)),r=lu(t,_,s,o,au,f),r&&_.setTransform(r),du(_,au,s),r&&_.resetTransform(),i=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),i=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),eo.copyCanvasByWorld(t,e,_,i,o.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=o.length-1;cu(h,uu,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(uu.offsetX+o.x*c*f,uu.offsetY+o.y*u*f,o.blur*c*f),r=lu(t,_,0,o,uu,f,!0),r&&_.setTransform(r),du(_,uu,s),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,Fh.string(o.color),"source-in"),eo.copyCanvasByWorld(t,e,_,i,o.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:hu,getShadowTransform:lu,isTransformShadow(t){},getInnerShadowSpread:_u},{excludeRenderBounds:gu}=lo;let fu;function yu(t,e,s,i,r,n,o,a){switch(e){case"grayscale":fu||(fu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,n){const o=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,o),n&&i.recycle(o);xu(t,e,s,1,r,n)}(t,s,i,r,o,a);break;case"opacity-path":xu(t,s,i,n,o,a);break;case"path":a&&s.restore()}}function mu(t){return t.getSameCanvas(!1,!0)}function xu(t,e,s,i,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,o,void 0,r),n?s.recycle(o):s.clearWorld(o)}Ll.prototype.__renderMask=function(t,e){let s,i,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){o&&(yu(this,o,t,r,i,n,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||gu(s,e)||s.__render(t,e),n=s.__.opacity,fu=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=mu(t))):(o="path",t.save()),s.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",i||(i=mu(t)),r||(r=mu(t)),s.__render(i,e));continue}const d=1===n&&s.__.__blendMode;d&&yu(this,o,t,r,i,n,void 0,!1),gu(s,e)||s.__render(r||t,e),d&&yu(this,o,t,r,i,n,d,!1)}yu(this,o,t,r,i,n,void 0,!0)};const wu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",vu=wu+"_#~&*+\\=|≮≯≈≠=…",bu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Bu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ku=Bu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Su=Bu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ru=Bu(wu),Cu=Bu(vu),Tu=Bu("- —/~|┆·");var Pu;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Pu||(Pu={}));const{Letter:Ou,Single:Eu,Before:Au,After:Lu,Symbol:Iu,Break:Wu}=Pu;function Mu(t){return ku[t]?Ou:Tu[t]?Wu:Su[t]?Au:Ru[t]?Lu:Cu[t]?Iu:bu.test(t)?Eu:Ou}const Du={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Fu(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:zu}=Du,{Letter:Nu,Single:Yu,Before:Xu,After:Uu,Symbol:ju,Break:Vu}=Pu;let Hu,Gu,qu,Qu,Ju,$u,Zu,Ku,t_,e_,s_,i_,r_,n_,o_,a_,h_,l_=[];function d_(t,e){t_&&!Ku&&(Ku=t_),Hu.data.push({char:t,width:e}),qu+=e}function c_(){Qu+=qu,Hu.width=qu,Gu.words.push(Hu),Hu={data:[]},qu=0}function u_(){n_&&(o_.paraNumber++,Gu.paraStart=!0,n_=!1),t_&&(Gu.startCharSize=Ku,Gu.endCharSize=t_,Ku=0),Gu.width=Qu,a_.width?zu(Gu):h_&&__(),l_.push(Gu),Gu={words:[]},Qu=0}function __(){Qu>(o_.maxWidth||0)&&(o_.maxWidth=Qu)}const{top:p_,right:g_,bottom:f_,left:y_}=gt;function m_(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const x_={getDrawData:function(e,s){a(e)||(e=String(e));let i=0,r=0,n=s.__getInput("width")||0,o=s.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=s;d&&(n?(i=d[y_],n-=d[g_]+d[y_]):s.autoSizeAlign||(i=d[y_]),o?(r=d[p_],o-=d[p_]+d[f_]):s.autoSizeAlign||(r=d[p_]));const c={bounds:{x:i,y:r,width:n,height:o},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,s,i){o_=e,l_=e.rows,a_=e.bounds,h_=!a_.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:n,textCase:o}=i,{canvas:a}=t,{width:h,height:l}=a_;if(h||l||r||"none"!==o){const t="none"!==i.textWrap,e="break"===i.textWrap;n_=!0,s_=null,Ku=Zu=t_=qu=Qu=0,Hu={data:[]},Gu={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)$u=s[i],"\n"===$u?(qu&&c_(),Gu.paraEnd=!0,u_(),n_=!0):(e_=Mu($u),e_===Nu&&"none"!==o&&($u=Fu($u,o,!qu)),Zu=a.measureText($u).width,r&&(r<0&&(t_=Zu),Zu+=r),i_=e_===Yu&&(s_===Yu||s_===Nu)||s_===Yu&&e_!==Uu,r_=!(e_!==Xu&&e_!==Yu||s_!==ju&&s_!==Uu),Ju=n_&&n?h-n:h,t&&h&&Qu+qu+Zu>Ju&&(e?(qu&&c_(),Qu&&u_()):(r_||(r_=e_===Nu&&s_==Uu),i_||r_||e_===Vu||e_===Xu||e_===Yu||qu+Zu>Ju?(qu&&c_(),Qu&&u_()):Qu&&u_()))," "===$u&&!0!==n_&&Qu+qu===0||(e_===Vu?(" "===$u&&qu&&c_(),d_($u,Zu),c_()):i_||r_?(qu&&c_(),d_($u,Zu)):d_($u,Zu)),s_=e_);qu&&c_(),Qu&&u_(),l_.length>0&&(l_[l_.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{o_.paraNumber++,Qu=a.measureText(t).width,l_.push({x:n||0,text:t,width:Qu,paraStart:!0}),h_&&__()})}(c,e,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":m_(e,"x",t[y_]);break;case"right":m_(e,"x",-t[g_])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":m_(e,"y",t[p_]);break;case"bottom":m_(e,"y",-t[f_])}}(d,c,s,n,o),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(x=s[o],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&o>0&&(m+=c),x.y=m,m+=n,t.overflow>o&&m>y&&(x.isOverflow=!0,t.overflow=o+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(c,s),function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:n,letterSpacing:o}=e;let a,h,l,d,c,u;i.forEach(t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=s&&("justify"===r||"both"===r)&&u>1?(s-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,s)=>{1===d?(c={char:"",x:a},a=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,s,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||s===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,s,n),c.overflow&&function(e,s,i,r){if(!r)return;const{rows:n,overflow:o}=e;let{textOverflow:a}=s;if(n.splice(o),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=i+r-l;("none"===s.textWrap?n:[n[o-1]]).forEach(t=>{if(t.isOverflow&&t.data){let s=t.data.length-1;for(let i=s;i>-1&&(e=t.data[i],h=e.x+e.width,!(i===s&&h<d));i--){if(h<d&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,s,i,n),"none"!==h&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,_(n)?(s=n.type,n.color&&(t.decorationColor=Fh.string(n.color)),n.offset&&(i=Math.min(.3*r,Math.max(n.offset,.15*-r)))):s=n,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(c,s),c}};const w_={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!Fh.object)return t;t=Fh.object(t)}let i=n(t.a)?1:t.a;s&&(i*=e);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};Object.assign(Dh,x_),Object.assign(Fh,w_),Object.assign(Yh,Qd),Object.assign(Xh,Wc),Object.assign(Uh,tu),Object.assign(jh,pu);try{wx&&mh(0,wx)}catch(t){}export{vt as AlignHelper,i as Answer,mt as AroundHelper,jt as AutoBounds,ts as BezierHelper,Xt as Bounds,Wo as BoundsEvent,Ft as BoundsHelper,Ul as Box,rl as BoxData,ch as Branch,po as BranchHelper,Pa as BranchRender,wd as Canvas,yl as CanvasData,he as CanvasManager,Oo as ChildEvent,Fh as ColorConvert,ee as Creator,f as DataHelper,Gt as Debug,gt as Direction4,ft as Direction9,Sl as DragBoundsHelper,jh as Effect,ql as Ellipse,ll as EllipseData,ls as EllipseHelper,Po as Event,oe as EventCreator,Zo as Eventer,Hh as Export,Fr as FileHelper,Vh as Filter,k as FourNumberHelper,jl as Frame,ol as FrameData,Ll as Group,il as GroupData,md as Image,fl as ImageData,Io as ImageEvent,Hr as ImageManager,e as IncrementId,Uo as LayoutEvent,Oh as Layouter,eh as Leaf,Ra as LeafBounds,lo as LeafBoundsHelper,m as LeafData,ca as LeafDataProxy,la as LeafEventer,eo as LeafHelper,To as LeafLayout,_h as LeafLevelList,uh as LeafList,ma as LeafMatrix,Ca as LeafRender,Ml as Leafer,gh as LeaferCanvas,ke as LeaferCanvasBase,nl as LeaferData,Vo as LeaferEvent,Zr as LeaferImage,yd as Line,al as LineData,A as MathHelper,ct as Matrix,G as MatrixHelper,xd as MyImage,Pe as NeedConvertToCanvasCommandMap,I as OneRadian,W as PI2,M as PI_2,Yh as Paint,Uh as PaintGradient,Xh as PaintImage,Rd as Path,Nh as PathArrow,Rr as PathBounds,fi as PathCommandDataHelper,Ce as PathCommandMap,Gs as PathConvert,Lr as PathCorner,Li as PathCreator,ul as PathData,qi as PathDrawer,Se as PathHelper,Le as PathNumberCommandLengthMap,Ae as PathNumberCommandMap,Cd as Pen,_l as PenData,t as Platform,te as Plugin,lt as Point,rt as PointHelper,sd as Polygon,dl as PolygonData,Ao as PropertyEvent,Dl as Rect,hl as RectData,Ie as RectHelper,Ol as RectRender,jo as RenderEvent,Ah as Renderer,Yo as ResizeEvent,jr as Resource,$t as Run,ld as Star,cl as StarData,Gh as State,Vt as StringNumberMap,Yr as TaskItem,Xr as TaskProcessor,Sd as Text,Dh as TextConvert,gl as TextData,qh as Transition,_t as TwoPointBoundsHelper,Al as UI,wl as UIBounds,ie as UICreator,el as UIData,Tl as UIRender,zh as UnitConvert,mo as WaitHelper,Xo as WatchEvent,xh as Watcher,wn as affectRenderBoundsType,yn as affectStrokeBoundsType,rn as attr,ln as autoLayoutType,un as boundsType,Dr as canvasPatch,Be as canvasSizeAttrs,Mh as createAttr,en as createDescriptor,En as cursorType,An as dataProcessor,on as dataType,sn as decorateLeafAttr,In as defineDataProcessor,Kr as defineKey,nn as defineLeafAttr,bn as dimType,pn as doBoundsType,mn as doStrokeType,Lh as effectType,r as emptyData,Pn as eraserType,Lo as extraPropertyEventMap,F as getBoundsData,tn as getDescriptor,z as getMatrixData,D as getPointData,On as hitType,u as isArray,p as isData,g as isEmptyData,h as isFinite,o as isNull,l as isNumber,_ as isObject,a as isString,n as isUndefined,Ln as layoutProcessor,Jo as leaferTransformAttrMap,Tn as maskType,_n as naturalBoundsType,Bn as opacityType,Ir as path,gn as pathInputType,fn as pathType,Wr as pen,an as positionType,Xn as registerUI,Un as registerUIEvent,Ih as resizeType,Fn as rewrite,zn as rewriteAble,cn as rotationType,dn as scaleType,hn as scrollType,Cn as sortType,xn as strokeType,vn as surfaceType,Ut as tempBounds,ut as tempMatrix,dt as tempPoint,c as tryToNumber,mh as useCanvas,Yn as useModule,ph as version,kn as visibleType,Wh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=miniapp.module.min.js.map
|