@leafer-editor/worker 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +101 -65
- package/dist/worker.esm.js +19 -10
- package/dist/worker.js +7008 -7230
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +7940 -6976
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +17 -17
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e,{round:s,pow:o,PI:n}=Math,r={within:(t,e,i)=>("object"==typeof e&&(i=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==i&&t>i&&(t=i),t),fourNumber(t,e){let i;if(t instanceof Array)switch(t.length){case 4:i=void 0===e?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),r.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=void 0!==e?o(10,e):1e12;return-0===(t=s(t*i)/i)?0:t},getScaleData(t,e,i,s){if(s||(s={}),e){const t=("number"==typeof e?e:e.width||0)/i.width,o=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&r.assignScale(s,t);return s},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:a,randColor:t=>`rgba(${a(255)},${a(255)},${a(255)},${t||1})`};function a(t){return Math.round(Math.random()*t)}const h=n/180,l=2*n,d=n/2;function c(){return{x:0,y:0}}function u(){return{x:0,y:0,width:0,height:0}}function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:p,cos:g,acos:f,sqrt:y}=Math,{float:m}=r,v={};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 x={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:_,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){b.toInnerPoint(t,e,v),b.scaleOfInner(t,v,i,s)},scaleOfInner(t,e,i,s=i){b.translateInner(t,e.x,e.y),b.scale(t,i,s),b.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=g(e*=h),a=p(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){b.toInnerPoint(t,e,v),b.rotateOfInner(t,v,i)},rotateOfInner(t,e,i){b.translateInner(t,e.x,e.y),b.rotate(t,i),b.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=h,t.a=s+n*i,t.b=o+r*i),e&&(e*=h,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){b.toInnerPoint(t,e,v),b.skewOfInner(t,v,i,s)},skewOfInner(t,e,i,s=0){b.translateInner(t,e.x,e.y),b.skew(t,i,s),b.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,o,n){let{e:r,f:a}=t;if(n&&(r+=n.scrollX,a+=n.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){b.multiply(t,b.tempInvert(e))},divideParent(t,e){b.multiplyParent(t,b.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=b;return b.copy(e,t),b.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,s,o){const{x:n,y:r,scaleX:a,scaleY:l}=e;if(void 0===o&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*h,r=g(n),d=p(n);if(s||o){const e=s*h,i=o*h;t.a=(r+i*-d)*a,t.b=(d+i*r)*a,t.c=(e*r-d)*l,t.d=(r+e*d)*l}else t.a=r*a,t.b=d*a,t.c=-d*l,t.d=r*l}else t.a=a,t.b=0,t.c=0,t.d=l;t.e=n,t.f=r,(i=i||s)&&b.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:l,f:c}=t;let u,_,v,w,x,b=l,k=c;if(n||r){const t=o*a-n*r;if(r&&!s){u=y(o*o+n*n),_=t/u;const e=o/u;v=n>0?f(e):-f(e)}else{_=y(r*r+a*a),u=t/_;const e=r/_;v=d-(a>0?f(-e):-f(e))}const e=m(g(v)),i=p(v);u=m(u),_=m(_),w=e?m((r/_+i)/e/h,9):0,x=e?m((n/u-i)/e/h,9):0,v=m(v/h)}else u=o,_=a,v=w=x=0;return(e=i||e)&&(b+=e.x*o+e.y*r,k+=e.x*n+e.y*a,i||(b-=e.x,k-=e.y)),{x:b,y:k,scaleX:u,scaleY:_,rotation:v,skewX:w,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=y(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){b.set(t)}},b=x,{toInnerPoint:k,toOuterPoint:E}=x,{sin:B,cos:S,abs:R,sqrt:C,atan2:L,min:T,round:O}=Math,P={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=void 0===i?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?O(t.x-.5)+.5:O(t.x),t.y=e?O(t.y-.5)+.5:O(t.y)},move(t,e,i){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=A.defaultPoint);const s=S(e*=h),o=B(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=A;return D(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=A;return D(i,t),E(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=A;return D(i,t),A.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),k(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){k(e,t,i)},toOuterOf(t,e,i){E(e,t,i)},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)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=R(i-t),n=R(s-e);return C(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>T(M(t,e,i,s),M(i,s,o,n)),getAngle:(t,e)=>I(t,e)/h,getRotation:(t,e,i,s)=>(s||(s=e),A.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/h),getRadianFrom(t,e,i,s,o,n,r,a){void 0===r&&(r=i,a=s);const h=t-i,l=e-s,d=o-r,c=n-a;return Math.atan2(h*c-l*d,h*d+l*c)},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=I(t,e);return(e=s?e:{}).x=t.x+S(o)*i,e.y=t.y+B(o)*i,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){A.reset(t)}},A=P,{getDistanceFrom:M,copy:D,getAtan2:I}=A;class W{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?P.copy(this,t):P.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new W(this)}move(t,e){return P.move(this,t,e),this}scale(t,e){return P.scale(this,t,e),this}scaleOf(t,e,i){return P.scaleOf(this,t,e,i),this}rotate(t,e){return P.rotate(this,t,e),this}rotateOf(t,e){return P.rotate(this,e,t),this}getRotation(t,e,i){return P.getRotation(this,t,e,i)}toInnerOf(t,e){return P.toInnerOf(this,t,e),this}toOuterOf(t,e){return P.toOuterOf(this,t,e),this}getCenter(t){return new W(P.getCenter(this,t))}getDistance(t){return P.getDistance(this,t)}getDistancePoint(t,e,i){return new W(P.getDistancePoint(this,t,e,i))}getAngle(t){return P.getAngle(this,t)}getAtan2(t){return P.getAtan2(this,t)}reset(){return P.reset(this),this}}const F=new W;class z{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return"object"==typeof t?x.copy(this,t):x.set(this,t,e,i,s,o,n),this}setWith(t){return x.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new z(this)}translate(t,e){return x.translate(this,t,e),this}translateInner(t,e){return x.translateInner(this,t,e),this}scale(t,e){return x.scale(this,t,e),this}scaleWith(t,e){return x.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return x.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return x.scaleOfInner(this,t,e,i),this}rotate(t){return x.rotate(this,t),this}rotateOfOuter(t,e){return x.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return x.rotateOfInner(this,t,e),this}skew(t,e){return x.skew(this,t,e),this}skewOfOuter(t,e,i){return x.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return x.skewOfInner(this,t,e,i),this}multiply(t){return x.multiply(this,t),this}multiplyParent(t){return x.multiplyParent(this,t),this}divide(t){return x.divide(this,t),this}divideParent(t){return x.divideParent(this,t),this}invert(){return x.invert(this),this}invertWith(){return x.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){x.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){x.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return x.setLayout(this,t,e,i),this}getLayout(t,e,i){return x.getLayout(this,t,e,i)}withScale(t,e){return x.withScale(this,t,e)}reset(){x.reset(this)}}const N=new z,Y={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,o){H(t,e,i),H(t,e+s,i+o)},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:H}=Y;var X,V;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(X||(X={})),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"}(V||(V={}));const j=[{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}];j.forEach((t=>t.type="percent"));const U={directionData:j,tempPoint:{},get:G,toPoint(t,e,i,s,o,n){const r=G(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)}};function G(t){return"string"==typeof t?j[V[t]]:t}const{toPoint:Z}=U,K={toPoint(t,e,i,s,o,n){Z(t,i,s,o,e,n)}},{tempPointBounds:q,setPoint:J,addPoint:$,toBounds:Q}=Y,{toOuterPoint:tt}=x,{float:et,fourNumber:it}=r,{floor:st,ceil:ot}=Math;let nt,rt,at,ht;const lt={},dt={},ct={},ut={tempBounds:ct,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(i instanceof Array){const e=it(i);s?_t.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):_t.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),_t.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,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,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),_t.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?gt(e,t):e=t,i?(e.offsetX=-(_t.maxX(i)-t.x),e.offsetY=-(_t.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),_t.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||P.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){P.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(_t.copy(ct,t),_t.toOuterOf(ct,e),ct),getOuterOf:(t,e)=>(t=Object.assign({},t),_t.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=e.f+t.y*o):(i.height=t.height*-o,i.y=e.f+t.y*o-i.height)}else lt.x=t.x,lt.y=t.y,tt(e,lt,dt),J(q,dt.x,dt.y),lt.x=t.x+t.width,tt(e,lt,dt),$(q,dt.x,dt.y),lt.y=t.y+t.height,tt(e,lt,dt),$(q,dt.x,dt.y),lt.x=t.x,tt(e,lt,dt),$(q,dt.x,dt.y),Q(q,i)},toInnerOf(t,e,i){i||(i=t),_t.move(i,-e.e,-e.f),_t.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,_t.getFitScale(t,e));return new z(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,n){n||(n=e),"string"==typeof s&&(s=_t.getFitScale(t,e,"cover"===s)),ct.width=o?e.width*=s:e.width*s,ct.height=o?e.height*=s:e.height*s,K.toPoint(i,ct,t,n,!0,!0)},getSpread(t,e,i){const s={};return _t.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){_t.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){_t.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=st(t.x),t.y=st(t.y),t.width=e>t.x?ot(t.width+e-t.x):ot(t.width),t.height=i>t.y?ot(t.height+i-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=et(t.x,e),t.y=et(t.y,e),t.width=et(t.width,e),t.height=et(t.height,e)},add(t,e,i){nt=t.x+t.width,rt=t.y+t.height,at=e.x,ht=e.y,i||(at+=e.width,ht+=e.height),nt=nt>at?nt:at,rt=rt>ht?rt:ht,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=nt-t.x,t.height=rt-t.y},addList(t,e){_t.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){_t.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){_t.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r]):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||gt(t,o)):pt(t,o));n&&_t.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?J(q,t.x,t.y):$(q,t.x,t.y))),Q(q,t)},setPoint(t,e){_t.set(t,e.x,e.y)},addPoint(t,e){pt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=P.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=P.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=_t.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=_t.tempToOuterOf(e,i)),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,i){if(i&&(e=_t.tempToOuterOf(e,i)),!_t.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return nt=s+n,rt=o+r,at=t.x+t.width,ht=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,nt=nt<at?nt:at,rt=rt<ht?rt:ht,n=nt-s,r=rt-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){_t.copy(t,_t.getIntersectData(t,e,i))},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){_t.set(t)}},_t=ut,{add:pt,copy:gt}=_t;class ft{get minX(){return ut.minX(this)}get minY(){return ut.minY(this)}get maxX(){return ut.maxX(this)}get maxY(){return ut.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?ut.copy(this,t):ut.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new ft(this)}move(t,e){return ut.move(this,t,e),this}scale(t,e,i){return ut.scale(this,t,e,i),this}scaleOf(t,e,i){return ut.scaleOf(this,t,e,i),this}toOuterOf(t,e){return ut.toOuterOf(this,t,e),this}toInnerOf(t,e){return ut.toInnerOf(this,t,e),this}getFitMatrix(t,e){return ut.getFitMatrix(this,t,e)}put(t,e,i){ut.put(this,t,e,i)}spread(t,e){return ut.spread(this,t,e),this}shrink(t,e){return ut.shrink(this,t,e),this}ceil(){return ut.ceil(this),this}unsign(){return ut.unsign(this),this}float(t){return ut.float(this,t),this}add(t){return ut.add(this,t),this}addList(t){return ut.setList(this,t,!0),this}setList(t){return ut.setList(this,t),this}addListWithFn(t,e){return ut.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return ut.setListWithFn(this,t,e),this}setPoint(t){return ut.setPoint(this,t),this}setPoints(t){return ut.setPoints(this,t),this}addPoint(t){return ut.addPoint(this,t),this}getPoints(){return ut.getPoints(this)}hitPoint(t,e){return ut.hitPoint(this,t,e)}hitRadiusPoint(t,e){return ut.hitRadiusPoint(this,t,e)}hit(t,e){return ut.hit(this,t,e)}includes(t,e){return ut.includes(this,t,e)}intersect(t,e){return ut.intersect(this,t,e),this}getIntersect(t,e){return new ft(ut.getIntersectData(this,t,e))}isSame(t){return ut.isSame(this,t)}isEmpty(){return ut.isEmpty(this)}reset(){ut.reset(this)}}const yt=new ft;class mt{constructor(t,e,i,s,o,n){"object"==typeof t?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new ft(o,e,n||t.width-o-i,r||t.height-e-s)}}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:wt}=r;class xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=bt(t)}static set exclude(t){this.excludeList=bt(t)}static drawRepaint(t,e){const i=wt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===xt.showBounds,o=t.__nowWorld,n=wt();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(kt.enable){if(kt.filterList.length&&kt.filterList.every((t=>t!==this.name)))return;if(kt.excludeList.length&&kt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){kt.enable&&this.warn(...t)}warn(...t){kt.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 bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const kt=xt,Et=xt.get("RunTime"),Bt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return St.currentId=St.idMap[s]=i?performance.now():Date.now(),St.currentName=St.nameMap[s]=t,St.nameToIdMap[t]=s,s},end(t,e){const i=St.idMap[t],s=St.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;St.idMap[t]=St.nameMap[t]=St.nameToIdMap[s]=void 0,Et.log(s,o,"ms")},endOfName(t,e){const i=St.nameToIdMap[t];void 0!==i&&St.end(i,e)}},St=Bt,Rt=[],Ct={list:{},add(t,...e){this.list[t]=!0,Rt.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Rt.forEach((t=>Ct.has(t,!0)))));const Lt={editor:t=>Ct.need("editor")},Tt=xt.get("UICreator"),Ot={list:{},register(t){const{__tag:e}=t.prototype;Pt[e]&&Tt.repeat(e),Pt[e]=t},get(t,e,i,s,o,n){Pt[t]||Tt.error("not register "+t);const r=new Pt[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),o&&(r.width=o),n&&(r.height=n)),r}},{list:Pt}=Ot,At=xt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Dt[e]&&At.repeat(e),Dt[e]=t)}))},changeName(t,e){const i=Dt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Dt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Dt[t](...e)},{nameList:Dt}=Mt;class It{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=Lt.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}const Wt={default:(t,e)=>(Ft(e,t),Ft(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return Ft(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&Ft(t[o]={},e[o],i[o]):t[o]=e[o]}))},copyAttrs:(t,e,i)=>(i.forEach((i=>{void 0!==e[i]&&(t[i]=e[i])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:Ft}=Wt;class zt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}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(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(t instanceof Array)for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],void 0!==t)){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}return i}__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}}var Nt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Nt||(Nt={}));const Yt={};function Ht(t){return null==t}function Xt(t){return"{}"===JSON.stringify(t)}function Vt(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function jt(t,e,i,s){return new(i||(i=Promise))((function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}h((s=s.apply(t,e||[])).next())}))}function Ut(t){return(e,i)=>{t||(t=i),Object.defineProperty(e,i,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const Gt=[];function Zt(){return(t,e)=>{Gt.push(e)}}const Kt=[];let qt=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||Kt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Gt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};Vt([Ut("imageSmoothingEnabled")],qt.prototype,"smooth",void 0),Vt([Ut("imageSmoothingQuality")],qt.prototype,"smoothLevel",void 0),Vt([Ut("globalAlpha")],qt.prototype,"opacity",void 0),Vt([Ut()],qt.prototype,"fillStyle",void 0),Vt([Ut()],qt.prototype,"strokeStyle",void 0),Vt([Ut("lineWidth")],qt.prototype,"strokeWidth",void 0),Vt([Ut("lineCap")],qt.prototype,"strokeCap",void 0),Vt([Ut("lineJoin")],qt.prototype,"strokeJoin",void 0),Vt([Ut("lineDashOffset")],qt.prototype,"dashOffset",void 0),Vt([Ut()],qt.prototype,"miterLimit",void 0),Vt([Ut()],qt.prototype,"shadowBlur",void 0),Vt([Ut()],qt.prototype,"shadowColor",void 0),Vt([Ut()],qt.prototype,"shadowOffsetX",void 0),Vt([Ut()],qt.prototype,"shadowOffsetY",void 0),Vt([Ut()],qt.prototype,"filter",void 0),Vt([Ut()],qt.prototype,"font",void 0),Vt([Ut()],qt.prototype,"fontKerning",void 0),Vt([Ut()],qt.prototype,"fontStretch",void 0),Vt([Ut()],qt.prototype,"fontVariantCaps",void 0),Vt([Ut()],qt.prototype,"textAlign",void 0),Vt([Ut()],qt.prototype,"textBaseline",void 0),Vt([Ut()],qt.prototype,"textRendering",void 0),Vt([Ut()],qt.prototype,"wordSpacing",void 0),Vt([Ut()],qt.prototype,"letterSpacing",void 0),Vt([Ut()],qt.prototype,"direction",void 0),Vt([Zt()],qt.prototype,"setTransform",null),Vt([Zt()],qt.prototype,"resetTransform",null),Vt([Zt()],qt.prototype,"getTransform",null),Vt([Zt()],qt.prototype,"save",null),Vt([Zt()],qt.prototype,"restore",null),Vt([Zt()],qt.prototype,"translate",null),Vt([Zt()],qt.prototype,"scale",null),Vt([Zt()],qt.prototype,"rotate",null),Vt([Zt()],qt.prototype,"fill",null),Vt([Zt()],qt.prototype,"stroke",null),Vt([Zt()],qt.prototype,"clip",null),Vt([Zt()],qt.prototype,"fillRect",null),Vt([Zt()],qt.prototype,"strokeRect",null),Vt([Zt()],qt.prototype,"clearRect",null),Vt([Zt()],qt.prototype,"beginPath",null),Vt([Zt()],qt.prototype,"moveTo",null),Vt([Zt()],qt.prototype,"lineTo",null),Vt([Zt()],qt.prototype,"bezierCurveTo",null),Vt([Zt()],qt.prototype,"quadraticCurveTo",null),Vt([Zt()],qt.prototype,"closePath",null),Vt([Zt()],qt.prototype,"arc",null),Vt([Zt()],qt.prototype,"arcTo",null),Vt([Zt()],qt.prototype,"ellipse",null),Vt([Zt()],qt.prototype,"rect",null),Vt([Zt()],qt.prototype,"roundRect",null),Vt([Zt()],qt.prototype,"createConicGradient",null),Vt([Zt()],qt.prototype,"createLinearGradient",null),Vt([Zt()],qt.prototype,"createPattern",null),Vt([Zt()],qt.prototype,"createRadialGradient",null),Vt([Zt()],qt.prototype,"fillText",null),Vt([Zt()],qt.prototype,"measureText",null),Vt([Zt()],qt.prototype,"strokeText",null);const{copy:Jt,multiplyParent:$t}=x,{round:Qt}=Math,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class ie extends qt{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}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(i,s){super(),this.size={},this.worldTransform={},i||(i=te),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:o,height:n,pixelRatio:r}=i;this.autoLayout=!o||!n,this.size.pixelRatio=r|t.devicePixelRatio,this.config=i,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 i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;Wt.copyAttrs(s,t,ee),ee.forEach((t=>s[t]||(s[t]=1))),this.bounds=new ft(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&$t(t,e,o),o.a=t.a*i,o.b=t.b*i,o.c=t.c*i,o.d=t.d*i,o.e=t.e*i,o.f=t.f*i,s&&(t.half&&t.half*i%2?(o.e=Qt(o.e-.5)+.5,o.f=Qt(o.f-.5)+.5):(o.e=Qt(o.e),o.f=Qt(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i)}setStrokeOptions(t){this.strokeCap="none"===t.strokeCap?"butt":t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,ut.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,o){this.resetTransform(),this.copyWorld(t,e,i,s),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(yt.x,yt.y,yt.width,yt.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,yt.x,yt.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i){i&&(this.blendMode=i),this.fillStyle=e,this.setTempBounds(t),this.fillRect(yt.x,yt.y,yt.width,yt.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(yt.x,yt.y,yt.width,yt.height),i&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(yt.x,yt.y,yt.width,yt.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(yt.x,yt.y,yt.width,yt.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){yt.set(t),i&&yt.intersect(this.bounds),yt.scale(this.pixelRatio),e&&yt.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,o=this.manager?this.manager.get(i):Lt.canvas(Object.assign({},i));return o.save(),t&&(Jt(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):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){}},oe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ne=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},oe),re={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},ae={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},he=Object.assign(Object.assign({},ae),oe),le=ne,de={};for(let t in le)de[le[t]]=t;const ce={};for(let t in le)ce[le[t]]=re[t];const ue={drawRoundRect(t,e,i,s,o,n){const a=r.fourNumber(n,Math.min(s/2,o/2)),h=e+s,l=i+o;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(h,i,h,l,a[1]):t.lineTo(h,i),a[2]?t.arcTo(h,l,e,l,a[2]):t.lineTo(h,l),a[3]?t.arcTo(e,l,e,i,a[3]):t.lineTo(e,l),a[0]?t.arcTo(e,i,h,i,a[0]):t.lineTo(e,i)}},{sin:_e,cos:pe,atan2:ge,ceil:fe,abs:ye,PI:me,sqrt:ve,pow:we}=Math,{setPoint:xe,addPoint:be}=Y,{set:ke,toNumberPoints:Ee}=P,{M:Be,L:Se,C:Re,Q:Ce,Z:Le}=ne,Te={},Oe={points(t,e,i,s){let o=Ee(e);if(t.push(Be,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,_,p,g,f,y=o.length;const m=!0===i?.5:i;s&&(o=[o[y-2],o[y-1],...o,o[0],o[1],o[2],o[3]],y=o.length);for(let i=2;i<y-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],p=ve(we(r-e,2)+we(a-n,2)),g=ve(we(h-r,2)+we(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=r-p*h,c=a-p*l,2===i?s||t.push(Ce,d,c,r,a):t.push(Re,u,_,d,c,r,a),u=r+g*h,_=a+g*l);s||t.push(Ce,u,_,o[y-2],o[y-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(Se,o[e],o[e+1]);s&&t.push(Le)},rect(t,e,i,s,o){se.creator.path=t,se.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){se.creator.path=[],ue.drawRoundRect(se.creator,e,i,s,o,n),t.push(...se.convertToCanvasData(se.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,c,u,_){const p=s-e,g=o-i,f=n-s,y=r-o;let m=ge(g,p),v=ge(y,f),w=v-m;if(w<0&&(w+=l),w===me||ye(p+g)<1e-12||ye(f+y)<1e-12)return t&&t.push(Se,s,o),c&&(xe(c,e,i),be(c,s,o)),_&&ke(_,e,i),void(u&&ke(u,s,o));const x=p*y-f*g<0,b=x?-1:1,k=a/pe(w/2),E=s+k*pe(m+w/2+d*b),B=o+k*_e(m+w/2+d*b);return m-=d*b,v-=d*b,Me(t,E,B,a,a,0,m/h,v/h,x,c,u,_)},arc:(t,e,i,s,o,n,r,a,h,l)=>Me(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,c,u,_,p){const g=n*h,f=_e(g),y=pe(g);let m=r*h,v=a*h;m>me&&(m-=l),v<0&&(v+=l);let w=v-m;w<0?w+=l:w>l&&(w-=l),c&&(w-=l);const x=fe(ye(w/d)),b=w/x,k=_e(b/4),E=8/3*k*k/_e(b/2);v=m+b;let B,S,R,C,L,T,O,P,A=pe(m),M=_e(m),D=R=y*s*A-f*o*M,I=C=f*s*A+y*o*M,W=e+R,F=i+C;t&&t.push(t.length?Se:Be,W,F),u&&xe(u,W,F),p&&ke(p,W,F);for(let n=0;n<x;n++)B=pe(v),S=_e(v),R=y*s*B-f*o*S,C=f*s*B+y*o*S,L=e+D-E*(y*s*M+f*o*A),T=i+I-E*(f*s*M-y*o*A),O=e+R+E*(y*s*S+f*o*B),P=i+C+E*(f*s*S-y*o*B),t&&t.push(Re,L,T,O,P,e+R,i+C),u&&Ae(e+D,i+I,L,T,O,P,e+R,i+C,u,!0),D=R,I=C,A=B,M=S,m=v,v+=b;_&&ke(_,e+R,i+C)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Re,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){Ae(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,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?be(h,t,e):xe(h,t,e),be(h,r,a);for(let l=0,c=d.length;l<c;l++)Pe(d[l],t,e,i,s,o,n,r,a,Te),be(h,Te.x,Te.y)},getPointAndSet(t,e,i,s,o,n,r,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*s+_*n+p*a,l.y=c*i+u*o+_*r+p*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return Pe(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:Pe,toTwoPointBounds:Ae,ellipse:Me}=Oe,{sin:De,cos:Ie,sqrt:We,atan2:Fe}=Math,{ellipse:ze}=Oe,Ne={ellipticalArc(e,i,s,o,n,r,a,d,c,u,_){const p=(c-i)/2,g=(u-s)/2,f=r*h,y=De(f),m=Ie(f),v=-m*p-y*g,w=-m*g+y*p,x=o*o,b=n*n,k=w*w,E=v*v,B=x*b-x*k-b*E;let S=0;if(B<0){const t=We(1-B/(x*b));o*=t,n*=t}else S=(a===d?-1:1)*We(B/(x*k+b*E));const R=S*o*w/n,C=-S*n*v/o,L=Fe((w-C)/n,(v-R)/o),T=Fe((-w-C)/n,(-v-R)/o);let O=T-L;0===d&&O>0?O-=l:1===d&&O<0&&(O+=l);const P=i+p+m*R-y*C,A=s+g+y*R+m*C,M=O<0?1:0;_||t.ellipseToCurve?ze(e,P,A,o,n,r,L/h,T/h,M):o!==n||r?e.push(ne.G,P,A,o,n,r,L/h,T/h,M):e.push(ne.O,P,A,o,L/h,T/h,M)}},{M:Ye,m:He,L:Xe,l:Ve,H:je,h:Ue,V:Ge,v:Ze,C:Ke,c:qe,S:Je,s:$e,Q:Qe,q:ti,T:ei,t:ii,A:si,a:oi,Z:ni,z:ri,N:ai,D:hi,X:li,G:di,F:ci,O:ui,P:_i,U:pi}=ne,{rect:gi,roundRect:fi,arcTo:yi,arc:mi,ellipse:vi,quadraticCurveTo:wi}=Oe,{ellipticalArc:xi}=Ne,bi=xt.get("PathConvert"),ki={},Ei={current:{dot:0},stringify(t,e){let i,s,o,n=0,a=t.length,h="";for(;n<a;){s=t[n],i=ce[s],h+=s===o?" ":de[s];for(let s=1;s<i;s++)h+=r.float(t[n+s],e),s===i-1||(h+=" ");o=s,n+=i}return h},parse(t,e){let i,s,o,n="";const r=[],a=e?he:ae;for(let e=0,h=t.length;e<h;e++)s=t[e],vt[s]?("."===s&&(Bi.dot&&(Si(r,n),n=""),Bi.dot++),"0"===n&&"."!==s&&(Si(r,n),n=""),n+=s):ne[s]?(n&&(Si(r,n),n=""),Bi.name=ne[s],Bi.length=re[s],Bi.index=0,Si(r,Bi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&Si(r,n),n=s):n&&(Si(r,n),n=""),o=s;return n&&Si(r,n),i?Ei.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(o=t[c],o){case He:t[c+1]+=a,t[c+2]+=h;case Ye:a=t[c+1],h=t[c+2],_.push(Ye,a,h),c+=3;break;case Ue:t[c+1]+=a;case je:a=t[c+1],_.push(Xe,a,h),c+=2;break;case Ze:t[c+1]+=h;case Ge:h=t[c+1],_.push(Xe,a,h),c+=2;break;case Ve:t[c+1]+=a,t[c+2]+=h;case Xe:a=t[c+1],h=t[c+2],_.push(Xe,a,h),c+=3;break;case $e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Je;case Je:r=n===Ke||n===Je,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(Ke,l,d,i,s,a,h),c+=5;break;case qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=Ke;case Ke:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ke,t[c+1],t[c+2],i,s,a,h),c+=7;break;case ii:t[c+1]+=a,t[c+2]+=h,o=ei;case ei:r=n===Qe||n===ei,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?wi(_,a,h,i,s,t[c+1],t[c+2]):_.push(Qe,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Qe;case Qe:i=t[c+1],s=t[c+2],e?wi(_,a,h,i,s,t[c+3],t[c+4]):_.push(Qe,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case oi:t[c+6]+=a,t[c+7]+=h;case si:xi(_,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 ri:case ni:_.push(ni),c++;break;case ai:a=t[c+1],h=t[c+2],e?gi(_,a,h,t[c+3],t[c+4]):Ri(_,t,c,5),c+=5;break;case hi:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ri(_,t,c,9),c+=9;break;case li:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4],t[c+5]):Ri(_,t,c,6),c+=6;break;case di:vi(e?_:Ri(_,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,ki),a=ki.x,h=ki.y,c+=9;break;case ci:e?vi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ri(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ui:mi(e?_:Ri(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ki),a=ki.x,h=ki.y,c+=7;break;case _i:e?mi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ri(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case pi:yi(e?_:Ri(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ki),a=ki.x,h=ki.y,c+=6;break;default:return bi.error(`command: ${o} [index:${c}]`,t),_}n=o}return _},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ye,t.x,t.y);break;case"L":e.push(Xe,t.x,t.y);break;case"C":e.push(Ke,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Qe,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ni)}})),e},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){Bi.index===Bi.length&&(Bi.index=1,t.push(Bi.name)),t.push(Number(e)),Bi.index++,Bi.dot=0}},{current:Bi,pushData:Si,copyData:Ri}=Ei,{M:Ci,L:Li,C:Ti,Q:Oi,Z:Pi,N:Ai,D:Mi,X:Di,G:Ii,F:Wi,O:Fi,P:zi,U:Ni}=ne,{getMinDistanceFrom:Yi,getRadianFrom:Hi}=P,{tan:Xi,min:Vi,abs:ji}=Math,Ui={},Gi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ci,e,i)},lineTo(t,e,i){t.push(Li,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(Ti,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(Oi,e,i,s,o)},closePath(t){t.push(Pi)},rect(t,e,i,s,o){t.push(Ai,e,i,s,o)},roundRect(t,e,i,s,o,n){if("number"==typeof n)t.push(Di,e,i,s,o,n);else{const a=r.fourNumber(n);a?t.push(Mi,e,i,s,o,...a):t.push(Ai,e,i,s,o)}},ellipse(t,e,i,s,o,n,r,a,h){void 0===n?t.push(Wi,e,i,s,o):(void 0===r&&(r=0),void 0===a&&(a=360),t.push(Ii,e,i,s,o,n,r,a,h?1:0))},arc(t,e,i,s,o,n,r){void 0===o?t.push(zi,e,i,s):(void 0===n&&(n=360),t.push(Fi,e,i,s,o,n,r?1:0))},arcTo(t,e,i,s,o,n,r,a){if(void 0!==r){const t=Yi(r,a,e,i,s,o);n=Vi(n,Vi(t/2,t/2*ji(Xi(Hi(r,a,e,i,s,o)/2))))}t.push(Ni,e,i,s,o,n)},drawEllipse(t,e,i,s,o,n,r,a,h){Oe.ellipse(null,e,i,s,o,void 0===n?0:n,void 0===r?0:r,void 0===a?360:a,h,null,null,Ui),t.push(Ci,Ui.x,Ui.y),Zi(t,e,i,s,o,n,r,a,h)},drawArc(t,e,i,s,o,n,r){Oe.arc(null,e,i,s,void 0===o?0:o,void 0===n?360:n,r,null,null,Ui),t.push(Ci,Ui.x,Ui.y),Ki(t,e,i,s,o,n,r)},drawPoints(t,e,i,s){Oe.points(t,e,i,s)}},{ellipse:Zi,arc:Ki}=Gi,{moveTo:qi,lineTo:Ji,quadraticCurveTo:$i,bezierCurveTo:Qi,closePath:ts,beginPath:es,rect:is,roundRect:ss,ellipse:os,arc:ns,arcTo:rs,drawEllipse:as,drawArc:hs,drawPoints:ls}=Gi;class ds{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?se.parse(t):t:[],this}beginPath(){return es(this.__path),this.paint(),this}moveTo(t,e){return qi(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ji(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return Qi(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return $i(this.__path,t,e,i,s),this.paint(),this}closePath(){return ts(this.__path),this.paint(),this}rect(t,e,i,s){return is(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return ss(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return os(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return ns(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return rs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return as(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return hs(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return ls(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:cs,L:us,C:_s,Q:ps,Z:gs,N:fs,D:ys,X:ms,G:vs,F:ws,O:xs,P:bs,U:ks}=ne,Es=xt.get("PathDrawer"),Bs={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case cs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case _s:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case ps:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case gs:t.closePath(),s+=1;break;case fs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ys:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case ms:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case vs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*h,e[s+6]*h,e[s+7]*h,e[s+8]),s+=9;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,l,!1),s+=5;break;case xs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*h,e[s+5]*h,e[s+6]),s+=7;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],0,l,!1),s+=4;break;case ks:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Es.error(`command: ${i} [index:${s}]`,e)}}},{M:Ss,L:Rs,C:Cs,Q:Ls,Z:Ts,N:Os,D:Ps,X:As,G:Ms,F:Ds,O:Is,P:Ws,U:Fs}=ne,{toTwoPointBounds:zs,toTwoPointBoundsByQuadraticCurve:Ns,arcTo:Ys,arc:Hs,ellipse:Xs}=Oe,{addPointBounds:Vs,copy:js,addPoint:Us,setPoint:Gs,addBounds:Zs,toBounds:Ks}=Y,qs=xt.get("PathBounds");let Js,$s,Qs;const to={},eo={},io={},so={toBounds(t,e){so.toTwoPointBounds(t,eo),Ks(eo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Gs(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===Ts||r===Cs||r===Ls?Gs(e,h,l):Gs(e,t[a+1],t[a+2])),r){case Ss:case Rs:h=t[a+1],l=t[a+2],Us(e,h,l),a+=3;break;case Cs:o=t[a+5],n=t[a+6],zs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,to),Vs(e,to),h=o,l=n,a+=7;break;case Ls:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],Ns(h,l,i,s,o,n,to),Vs(e,to),h=o,l=n,a+=5;break;case Ts:a+=1;break;case Os:h=t[a+1],l=t[a+2],Zs(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ps:case As:h=t[a+1],l=t[a+2],Zs(e,h,l,t[a+3],t[a+4]),a+=r===Ps?9:6;break;case Ms:Xs(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],to,io),0===a?js(e,to):Vs(e,to),h=io.x,l=io.y,a+=9;break;case Ds:h=t[a+1],l=t[a+2],$s=t[a+3],Qs=t[a+4],Zs(e,h-$s,l-Qs,2*$s,2*Qs),h+=$s,a+=5;break;case Is:Hs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],to,io),0===a?js(e,to):Vs(e,to),h=io.x,l=io.y,a+=7;break;case Ws:h=t[a+1],l=t[a+2],Js=t[a+3],Zs(e,h-Js,l-Js,2*Js,2*Js),h+=Js,a+=4;break;case Fs:Ys(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],to,io),0===a?js(e,to):Vs(e,to),h=io.x,l=io.y,a+=6;break;default:return void qs.error(`command: ${r} [index:${a}]`,t)}}},{M:oo,L:no,Z:ro}=ne,{getCenterX:ao,getCenterY:ho}=P,{arcTo:lo}=Gi,co={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;r<g;){switch(s=t[r],s){case oo:l=_=t[r+1],d=p=t[r+2],r+=3,t[r]===no?(c=t[r+1],u=t[r+2],f.push(oo,ao(l,c),ho(d,u))):f.push(oo,l,d);break;case no:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case no:lo(f,a,h,t[r+1],t[r+2],e,_,p);break;case ro:lo(f,a,h,l,d,e,_,p);break;default:f.push(no,a,h)}_=a,p=h;break;case ro:o!==ro&&(lo(f,l,d,c,u,e,_,p),f.push(ro)),r+=1;break;default:n=ce[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==ro&&(f[1]=l,f[2]=d),f}};se.creator=new ds,se.parse=Ei.parse,se.convertToCanvasData=Ei.toCanvasData;const uo=new ds,{drawRoundRect:_o}=ue;function po(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){_o(this,t,e,i,s,o)})}(t)}const go={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=fo.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{}}}},fo=go;fo.alphaPixelTypes.forEach((t=>fo.upperCaseTypeMap[t]=t.toUpperCase()));const yo=xt.get("TaskProcessor");class mo{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return jt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){yo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class vo{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Wt.assign(this.config,t),this.empty()}add(t,e){let i,s,o,n;const r=new mo(t);return r.parent=this,"number"==typeof e?n=e:e&&(s=e.parallel,i=e.start,o=e.time,n=e.delay),o&&(r.time=o),!1===s&&(r.parallel=!1),void 0===n?this.push(r,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(r,i))}),n)),this.isComplete=!1,r}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 i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 wo=xt.get("Resource"),xo={tasker:new vo,map:{},get isComplete(){return bo.tasker.isComplete},set(t,e){bo.map[t]&&wo.repeat(t),bo.map[t]=e},get:t=>bo.map[t],remove(t){const e=bo.map[t];e&&(e.destroy&&e.destroy(),delete bo.map[t])},loadImage(t,e){return new Promise(((i,s)=>{const o=this.setImage(t,t,e);o.load((()=>i(o)),(t=>s(t)))}))},setImage(t,e,i){let s;return"string"==typeof e?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Lt.image(s)),bo.set(t,e),e},destroy(){bo.map={}}},bo=xo,ko={maxRecycled:10,recycledList:[],patternTasker:new vo,get(t){let e=xo.get(t.url);return e||xo.set(t.url,e=Lt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Eo.recycledList.push(t)}))},clearRecycled(){const t=Eo.recycledList;t.length>Eo.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&xo.remove(t.url))),t.length=0)},hasAlphaPixel:t=>go.alphaPixelTypes.some((e=>Eo.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+go.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+go.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Eo.recycledList=[]}},Eo=ko,{IMAGE:Bo,create:So}=e;class Ro{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=So(Bo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ko.isFormat("svg",t)&&(this.isSVG=!0),ko.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),xo.tasker.add((()=>jt(this,void 0,void 0,(function*(){return yield e(this.url,s).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[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(((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,i,s,o){if(e||(e=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const n=t.origin.createCanvas(e,i),r=n.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=void 0)}catch(t){}return o&&Wt.stintSet(o,"transform",s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Co(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Lo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function To(t,e){return(i,s)=>Po(i,s,t,e&&e(s))}function Oo(t){return t}function Po(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Co(t,e,Object.assign(o,s||{})),rn(t,e,i)}function Ao(t){return To(t)}function Mo(t,e){return To(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Do(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),No(this))}})))}function Io(t,e){return To(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wo(t,e){return To(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Fo(t,e){return To(t,(t=>({set(i){this.__setAttr(t,i,e)&&No(this)}})))}function zo(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(No(this),this.__.__removeNaturalSize())}})))}function No(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Yo(t){return To(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),No(this)}})))}const Ho=Fo;function Xo(t,e){return To(t,(t=>({set(i){this.__setAttr(t,i)&&(Vo(this),e&&(this.__.__useStroke=!0))}})))}function Vo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&No(t)}const jo=Xo;function Uo(t){return To(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Go(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Zo(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&qo(this)}})))}function Ko(t){return To(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Jo(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Jo(this,t,e,i),this.mask&&qo(this)}})))}function qo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Jo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||No(t))}function $o(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function Qo(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function tn(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function en(t){return To(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===xt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function sn(t){return To(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function on(t){return(e,i)=>{Co(e,"__DataProcessor",{get:()=>t})}}function nn(t){return(e,i)=>{Co(e,"__LayoutProcessor",{get:()=>t})}}function rn(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[o];return void 0===t?i:t},set(t){this[o]=t}};if(void 0===i)r.get=function(){return this[o]};else if("function"==typeof i)r.get=function(){let t=this[o];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Xt(i);r.get=function(){let e=this[o];return void 0===e?this[o]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?r.get=function(){const t=this[o];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(r.get=function(){const t=this[o];if(void 0===t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&s.children.length?s.boxBounds.height:i}return t});let h,l=s;for(;!h&&l;)h=Lo(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[n]&&(r.set=s[n],delete s[n]),Co(s,e,r)}const an=new xt("rewrite"),hn=[],ln=["destroy","constructor"];function dn(t){return(e,i)=>{hn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function cn(){return t=>{un()}}function un(t){hn.length&&(hn.forEach((e=>{t&&an.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),hn.length=0)}function _n(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(ln.includes(s)||e&&e.includes(s)))if(t.prototype){Lo(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function pn(){return t=>{Ot.register(t)}}function gn(){return t=>{Mt.register(t)}}setTimeout((()=>un(!0)));const{copy:fn,toInnerPoint:yn,toOuterPoint:mn,scaleOfOuter:vn,rotateOfOuter:wn,skewOfOuter:xn,multiplyParent:bn,divideParent:kn,getLayout:En}=x,Bn={},{round:Sn}=Math,Rn={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Tn(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)Ln(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)On(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&On(t),t.__updateChange()},updateAllChange(t){if(An(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Pn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,o){const n="object"==typeof e?Object.assign({},e):{x:e,y:i};s?mn(t.localTransform,n,n,!0):t.parent&&yn(t.parent.worldTransform,n,n,!0),Cn.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){"object"==typeof e&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Sn(e),i=Sn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){Cn.zoomOfLocal(t,Mn(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if("number"!=typeof s&&(s&&(n=s),s=i),fn(Bn,r),vn(Bn,e,i,s),t.origin||t.around)Cn.setTransform(t,Bn,o,n);else{const e=t.x+Bn.e-r.e,a=t.y+Bn.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){Cn.rotateOfLocal(t,Mn(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;fn(Bn,o),wn(Bn,e,i),t.origin||t.around?Cn.setTransform(t,Bn,!1,s):t.set({x:t.x+Bn.e-o.e,y:t.y+Bn.f-o.f,rotation:r.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){Cn.skewOfLocal(t,Mn(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){fn(Bn,t.__localMatrix),xn(Bn,e,i,s),Cn.setTransform(t,Bn,o,n)},transformWorld(t,e,i,s){fn(Bn,t.worldTransform),bn(Bn,e),t.parent&&kn(Bn,t.parent.worldTransform),Cn.setTransform(t,Bn,i,s)},transform(t,e,i,s){fn(Bn,t.localTransform),bn(Bn,e),Cn.setTransform(t,Bn,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&Cn.getInnerOrigin(t,o.origin),r=En(e,n,o.around&&Cn.getInnerOrigin(t,o.around));if(i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){ut.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Cn.getInnerOrigin(t,o.origin);P.move(r,n.x-s.x,n.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return vn(i,Cn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>P.tempToOuterOf(Cn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return U.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(fn(Bn,t.worldTransform),kn(Bn,e.worldTransform),i?Bn:Object.assign({},Bn)),drop(t,e,i,s){t.setTransform(Cn.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Cn=Rn,{updateAllMatrix:Ln,updateMatrix:Tn,updateAllWorldOpacity:On,updateAllChange:Pn,updateChange:An}=Cn;function Mn(t,e){return t.__layout.update(),t.parent?P.tempToInnerOf(e,t.parent.__world):e}const Dn={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=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:In}=Rn,Wn={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:i}=t;for(let s=0,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Fn(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&void 0===i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)zn(e[t],e)},updateBounds(t,e){const i=[t];zn(t,i),Nn(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)In(s[t]);e&&e===i||In(i)}}},{pushAllChildBranch:Fn,pushAllBranchStack:zn,updateBoundsByBranchStack:Nn}=Wn,Yn={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Hn,updateBounds:Xn}=Rn,{toOuterOf:Vn,getPoints:jn,copy:Un}=ut,Gn="_localContentBounds",Zn="_worldContentBounds",Kn="_worldBoxBounds",qn="_worldStrokeBounds";class Jn{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 Vn(this.contentBounds,this.leaf.__localMatrix,this[Gn]||(this[Gn]={})),this[Gn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Vn(this.contentBounds,this.leaf.__world,this[Zn]||(this[Zn]={})),this[Zn]}get worldBoxBounds(){return Vn(this.boxBounds,this.leaf.__world,this[Kn]||(this[Kn]={})),this[Kn]}get worldStrokeBounds(){return Vn(this.strokeBounds,this.leaf.__world,this[qn]||(this[qn]={})),this[qn]}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:i}=e;if(e.isApp)return Xn(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__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 x.defaultMatrix;case"page":t=e.zoomLayer;default:return Hn(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 ft(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",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=x.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=Hn(s,e,!0)}if(r||(r=x.getLayout(n)),Un(r,a),P.copy(r,o),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=jn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return void 0!==o&&s.forEach((t=>i.innerToWorld(t,null,!1,o))),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}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.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.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 $n{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 Qn extends $n{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Qn.ADD="child.add",Qn.REMOVE="child.remove",Qn.CREATED="created",Qn.MOUNTED="mounted",Qn.UNMOUNTED="unmounted",Qn.DESTROY="destroy";class tr extends $n{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}tr.CHANGE="property.change",tr.LEAFER_CHANGE="property.leafer_change";class er extends $n{constructor(t,e){super(t),Object.assign(this,e)}}er.LOAD="image.load",er.LOADED="image.loaded",er.ERROR="image.error";class ir extends $n{static checkHas(t,e,i){"on"===i?e===rr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(sr)||t.hasEvent(or)||t.hasEvent(nr),t.__hasWorldEvent=t.hasEvent(rr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(sr,t),"inner"===e&&t.emit(or,t)),t.emit(nr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(rr,this)}}ir.RESIZE="bounds.resize",ir.INNER="bounds.inner",ir.LOCAL="bounds.local",ir.WORLD="bounds.world";const{RESIZE:sr,INNER:or,LOCAL:nr,WORLD:rr}=ir,ar={};[sr,or,nr,rr].forEach((t=>ar[t]=1));class hr extends $n{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){"object"==typeof t?(super(hr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}hr.RESIZE="resize";class lr extends $n{constructor(t,e){super(t),this.data=e}}lr.REQUEST="watch.request",lr.DATA="watch.data";class dr extends $n{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}dr.REQUEST="layout.request",dr.START="layout.start",dr.BEFORE="layout.before",dr.LAYOUT="layout",dr.AFTER="layout.after",dr.AGAIN="layout.again",dr.END="layout.end";class cr extends $n{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}cr.REQUEST="render.request",cr.CHILD_START="render.child_start",cr.CHILD_END="render.child_end",cr.START="render.start",cr.BEFORE="render.before",cr.RENDER="render",cr.AFTER="render.after",cr.AGAIN="render.again",cr.END="render.end",cr.NEXT="render.next";class ur extends $n{}ur.START="leafer.start",ur.BEFORE_READY="leafer.before_ready",ur.READY="leafer.ready",ur.AFTER_READY="leafer.after_ready",ur.VIEW_READY="leafer.view_ready",ur.VIEW_COMPLETED="leafer.view_completed",ur.STOP="leafer.stop",ur.RESTART="leafer.restart",ur.END="leafer.end";const _r={};class pr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(t instanceof Array)t.forEach((t=>this.on(t[0],t[1],t[2])));else for(let i in t)(e=t[i])instanceof Array?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=gr(this,s,!0),a="string"==typeof t?t.split(" "):t,h=o?{listener:e,once:o}:{listener:e};a.forEach((t=>{t&&(n=r[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):r[t]=[h],ar[t]&&ir.checkHas(this,t,"on"))}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=gr(this,t);s.forEach((t=>{t&&(o=r[t],o&&(n=o.findIndex((t=>t.listener===e)),n>-1&&o.splice(n,1),o.length||delete r[t],ar[t]&&ir.checkHas(this,t,"off")))}))}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach((i=>{t&&delete t[i],e&&delete e[i]}))}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):t instanceof Array&&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:s}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{t.listener?t.current.off(t.type,t.listener,t.options):t.type instanceof Array&&t.type.forEach((e=>t.current.off(e[0],e[1],e[3])))})),e.length=0}once(t,e,i,s){if(!e)return t instanceof Array&&t.forEach((t=>this.once(t[0],t[1],t[2],t[3])));"object"==typeof i?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Mt.has(t)&&(e=Mt.get(t,{type:t,target:this,current:this}));const s=gr(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:i,__captureMap:s}=this,o=i&&i[t],n=s&&s[t];return!!(void 0===e?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function gr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:_r)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:_r)}}const{on:fr,on_:yr,off:mr,off_:vr,once:wr,emit:xr,emitEvent:br,hasEvent:kr,destroy:Er}=pr.prototype,Br={on:fr,on_:yr,off:mr,off_:vr,once:wr,emit:xr,emitEvent:br,hasEvent:kr,destroyEventer:Er},{isFinite:Sr}=Number,Rr=xt.get("setAttr"),Cr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!Sr(e)&&void 0!==e&&(Rr.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=tr,o=new tr(i,this,t,s,e);return this.isLeafer?this.emitEvent(new tr(tr.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(o),this.leafer.emitEvent(o),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||void 0===i.normalStyle[t]||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Lr,multiplyParent:Tr,translateInner:Or,defaultWorld:Pr}=x,{toPoint:Ar,tempPoint:Mr}=U,Dr={__updateWorldMatrix(){Tr(this.__local||this.__layout,this.parent?this.parent.__world:Pr,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized="scale")||t.rotationChanged)&&(Lr(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Ar(i.around||i.origin,t.boxBounds,Mr),Or(e,-Mr.x,-Mr.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ir,updateAllMatrix:Wr}=Rn,{updateBounds:Fr}=Wn,{toOuterOf:zr,copyAndSpread:Nr,copy:Yr}=ut,{toBounds:Hr}=so,Xr={__updateWorldBounds(){const t=this.__layout;zr(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&ir.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&ir.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(),zr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){zr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){zr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Hr(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Wr(this),Fr(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Wr(this),Fr(this,this))):Ir(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Nr(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Nr(t.renderBounds,t.boxBounds,t.renderSpread):Yr(t.renderBounds,t.strokeBounds)}},Vr={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,i.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,i.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e);xt.showBounds&&xt.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:jr}=Dn,Ur={__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 i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)jr(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)jr(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Gr,create:Zr}=e,{toInnerPoint:Kr,toOuterPoint:qr,multiplyParent:Jr}=x,{toOuterOf:$r}=ut,{copy:Qr,move:ta}=P,{moveLocal:ea,zoomOfLocal:ia,rotateOfLocal:sa,skewOfLocal:oa,moveWorld:na,zoomOfWorld:ra,rotateOfWorld:aa,skewOfWorld:ha,transform:la,transformWorld:da,setTransform:ca,getFlipTransform:ua,getLocalOrigin:_a,getRelativeWorld:pa,drop:ga}=Rn;let fa=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 zt}get __LayoutProcessor(){return Jn}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 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.__layout.update(),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=Zr(Gr),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Qn.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(Qn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Qn.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer((()=>this.leafer.nextRender(t,e,i)))}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(Qn.MOUNTED)):this.__emitLifeEvent(Qn.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===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(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Jr(i,t.matrix,e,void 0,i),$r(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?pa(this,e):this.worldTransform,o=i?t:{};return $r(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Qr(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Qr(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Kr(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){qr(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return ta(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return ta(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){ca(this,t,e,i)}transform(t,e,i){la(this,t,e,i)}move(t,e,i){ea(this,t,e,i)}moveInner(t,e,i){na(this,t,e,!0,i)}scaleOf(t,e,i,s,o){ia(this,_a(this,t),e,i,s,o)}rotateOf(t,e,i){sa(this,_a(this,t),e,i)}skewOf(t,e,i,s,o){oa(this,_a(this,t),e,i,s,o)}transformWorld(t,e,i){da(this,t,e,i)}moveWorld(t,e,i){na(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){ra(this,t,e,i,s,o)}rotateOfWorld(t,e){aa(this,t,e)}skewOfWorld(t,e,i,s,o){ha(this,t,e,i,s,o)}flip(t,e){la(this,ua(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct.need("path")}getMotionPoint(t){return Ct.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,i){ga(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):rn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Fo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Qn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Qn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};fa=Vt([_n(Cr),_n(Dr),_n(Xr),_n(Br),_n(Vr)],fa);const{setListWithFn:ya}=ut,{sort:ma}=Wn,{localBoxBounds:va,localStrokeBounds:wa,localRenderBounds:xa,maskLocalBoxBounds:ba,maskLocalStrokeBounds:ka,maskLocalRenderBounds:Ea}=Dn,Ba=new xt("Branch");let Sa=class extends fa{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ya(this.__layout.boxBounds,this.children,this.__hasMask?ba:va)}__updateStrokeBounds(){ya(this.__layout.strokeBounds,this.children,this.__hasMask?ka:wa)}__updateRenderBounds(){ya(this.__layout.renderBounds,this.children,this.__hasMask?Ea:xa)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(ma),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ba.warn("add self or destroyed");const i=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),i||e++}));t=Ot.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Qn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Qn.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))):void 0===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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(Qn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Qn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Qn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Sa=Vt([_n(Ur)],Sa);class Ra{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:i}=this;void 0===i[t.innerId]&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(void 0===i[t.innerId]){const{list:s}=this;for(let t=e,o=s.length;t<o;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,o=e.length;s<o;s++)void 0!==i?this.keys[e[s].innerId]=s-1:e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]);void 0!==i&&e.splice(i,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 Ra;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Ca{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const La="1.7.0";class Ta extends ie{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}po(OffscreenCanvasRenderingContext2D.prototype),po(Path2D.prototype);const{mineType:Oa}=go;function Pa(e,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,o)=>{t.convertToBlob({type:Oa(e),quality:i}).then((t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>o(t),e.readAsDataURL(t)})).catch((t=>{o(t)}))})),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Oa(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((i,s)=>{let o=new XMLHttpRequest;o.open("GET",t.image.getRealURL(e),!0),o.responseType="blob",o.onload=()=>{createImageBitmap(o.response).then((t=>{i(t)})).catch((t=>{s(t)}))},o.onerror=t=>s(t),o.send()}))},t.canvas=Lt.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(Lt,{canvas:(t,e)=>new Ta(t,e),image:t=>new Ro(t)}),t.name="web",t.isWorker=!0,t.backgrounder=!0,t.requestRender=function(t){requestAnimationFrame(t)},Co(t,"devicePixelRatio",{get:()=>1});const{userAgent:Aa}=navigator;Aa.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):Aa.indexOf("Safari")>-1&&-1===Aa.indexOf("Chrome")&&(t.fullImageShadow=!0),Aa.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):Aa.indexOf("Mac")>-1?t.os="Mac":Aa.indexOf("Linux")>-1&&(t.os="Linux");class Ma{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ra;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 Ra,this.target=t,e&&(this.config=Wt.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(cr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Qn.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new lr(lr.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ra,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[tr.CHANGE,this.__onAttrChange,this],[[Qn.ADD,Qn.REMOVE],this.__onChildEvent,this],[lr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Da,updateBounds:Ia,updateChange:Wa}=Rn,{pushAllChildBranch:Fa,pushAllParent:za}=Wn;const{worldBounds:Na}=Dn;class Ya{constructor(t){this.updatedBounds=new ft,this.beforeBounds=new ft,this.afterBounds=new ft,t instanceof Array&&(t=new Ra(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Na)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Na),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:Ha,updateAllChange:Xa}=Rn,Va=xt.get("Layouter");class ja{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Ca,this.target=t,e&&(this.config=Wt.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(dr.START),this.layoutOnce(),t.emitEvent(new dr(dr.END,this.layoutedBlocks,this.times))}catch(t){Va.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Va.warn("layouting"):this.times>3?Va.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(lr.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=Bt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=dr,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new dr(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Da(t,!0),e.add(t),t.isBranch&&Fa(t,e),za(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),za(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ia(s[t])}Ia(i)}}))}(this.__levelList),function(t){t.list.forEach(Wa)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new dr(n,a,this.times)),i.emitEvent(new dr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Bt.end(e)}fullLayout(){const t=Bt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=dr,n=this.getBlocks(new Ra(e));e.emitEvent(new dr(i,n,this.times)),ja.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new dr(s,n,this.times)),e.emitEvent(new dr(o,n,this.times)),this.addBlocks(n),Bt.end(t)}static fullLayout(t){Ha(t,!0),t.isBranch?Wn.updateBounds(t):Rn.updateBounds(t),Xa(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ya([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ya(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_([[dr.REQUEST,this.layout,this],[dr.AGAIN,this.layoutAgain,this],[lr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ua=xt.get("Renderer");class Ga{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=Wt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(dr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(cr.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(cr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(cr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new ft,Ua.log(e.innerName,"---\x3e");try{this.emitRender(cr.START),this.renderOnce(t),this.emitRender(cr.END,this.totalBounds),ko.clearRecycled()}catch(t){this.rendering=!1,Ua.error(t)}Ua.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ua.warn("rendering");if(this.times>3)return Ua.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new ft,this.renderOptions={},t)this.emitRender(cr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(cr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(cr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(cr.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=Bt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new ft(s);i.save(),s.spread(Ga.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,o),i.restore(),Bt.end(e)}fullRender(){const t=Bt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Bt.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),o=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),xt.showRepaint&&xt.drawRepaint(i,t),this.target.__render(i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new ft;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 i=this.requestTime=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new ft(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new ft(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||Ua.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,i){this.target.emitEvent(new cr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[cr.REQUEST,this.update,this],[dr.END,this.__onLayoutEnd,this],[cr.AGAIN,this.renderAgain,this],[hr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Ga.clipSpread=10;const{hitRadiusPoint:Za}=ut;class Ka{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ra(i.findList),i.findList||this.hitBranch(n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new Ra;const{x:s,y:o}=this.point,n={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||Rn.worldHittable(e))&&(this.hitChild(e,n),this.findList.length))return this.findList.list[0]}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),this.findList.length)return this.findList.list[0];return t[0]}getPath(t){const e=new Ra;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Ra;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new Ra,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Za(i.__world,o),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)):s&&this.hitChild(i,o))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask&&!s.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class qa{constructor(t,e){this.config={},e&&(this.config=Wt.default(e,this.config)),this.picker=new Ka(this.target=t,this),this.finder=Lt.finder&&Lt.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Ct.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ja(t){return To(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function $a(t){return To(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Qa(){return(t,e)=>{const i="_"+e;Co(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(Lt,{watcher:(t,e)=>new Ma(t,e),layouter:(t,e)=>new ja(t,e),renderer:(t,e,i)=>new Ga(t,e,i),selector:(t,e)=>new qa(t,e)}),t.layout=ja.fullLayout;const th={},eh={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}},ih={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},sh={},oh={},nh={},rh={},ah={},hh={apply(){Ct.need("filter")}},lh={},dh={setStyleName:()=>Ct.need("state"),set:()=>Ct.need("state")},ch={list:{},register(t,e){ch.list[t]=e},get:t=>ch.list[t]},{parse:uh,objectToCanvasData:_h}=Ei,{stintSet:ph}=Wt,{hasTransparent:gh}=eh,fh={},yh=xt.get("UIData");class mh extends zt{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,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(),"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("fill",t):(ph(this,"__isTransparentFill",gh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(ph(this,"__isTransparentStroke",gh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t)}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?uh(t):_h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){vh(this,"shadow",t)}setInnerShadow(t){vh(this,"innerShadow",t)}setFilter(t){vh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&oh.compute("fill",this.__leaf),e&&oh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),e instanceof Array&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=fh)):(this.__isStrokes=!0,this._stroke||(this._stroke=fh))}__removePaint(t,e){e&&this.__removeInput(t),nh.recycleImage(t,this),"fill"===t?(ph(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ph(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function vh(t,e,i){t.__setInput(e,i),i instanceof Array?(i.some((t=>!1===t.visible))&&(i=i.filter((t=>!1!==t.visible))),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class wh extends mh{}class xh extends wh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class bh extends wh{__getInputData(t,e){const i=super.__getInputData(t,e);return ee.forEach((t=>delete i[t])),i}}class kh extends xh{}class Eh extends mh{}class Bh extends mh{get __boxStroke(){return!this.__pathInputed}}class Sh extends mh{get __boxStroke(){return!this.__pathInputed}}class Rh extends mh{}class Ch extends mh{}class Lh extends mh{get __pathInputed(){return 2}}class Th extends wh{}const Oh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ph extends mh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=Oh[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Ot.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange(),n.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Ah extends Bh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class Mh extends Bh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const Dh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=Math.max(n.__layout.strokeSpread=n.__updateStrokeSpread(),t),e=n.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),n&&(t+=hh.getSpread(n));let r=t=Math.ceil(t);return i&&i.forEach((t=>r=Math.max(r,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(r=Math.max(r,o)),this.__layout.renderShapeSpread=r,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:Ih}=Wt,Wh={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ih(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ih(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ih(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!(e[0].box&&t.__isTransparentFill)&&i&&!(i instanceof Array&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Ih(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Fh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=oh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&ah.shadow(this,t,h),a&&(s.__isStrokes?oh.strokes(n,this,t):oh.stroke(n,this,t)),o&&(s.__isFills?oh.fills(o,this,t):oh.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&ah.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?oh.strokes(n,this,t):oh.stroke(n,this,t)),c&&hh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?oh.strokes(n,this,t):oh.stroke(n,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,eh.string(e.color))}o&&(s.__isFills?oh.fills(o,this,t):oh.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?oh.strokes(n,this,t):oh.stroke(n,this,t))}}else s.__pathInputed?Fh(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?oh.fills(s,this,t):oh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?oh.strokes(o,this,t):oh.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 Fh(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&oh.stroke(o,t,e),s&&oh.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&oh.stroke(o,t,e)}const zh={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var Nh;let Yh=Nh=class extends fa{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){r.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return uo.set(this.path=t||[]),t||this.__drawPathByBox(uo),uo}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Ct.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Ct.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(uo.set(i=[]),this.__drawPathByBox(uo)),t?Ei.toCanvasData(i,!0):i}getPathString(t,e,i){return Ei.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||lh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?co.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&sh.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Bs.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,"number"==typeof n?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){oh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Ct.need("animate")}killAnimate(t,e){}export(t,e){return Ct.need("export")}syncExport(t,e){return Ct.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Nh.one(e)}static one(t,e,i,s,o){return Ot.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){pn()(this)}static registerData(t){on(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};Vt([on(mh)],Yh.prototype,"__",void 0),Vt([Qa()],Yh.prototype,"zoomLayer",void 0),Vt([Ao("")],Yh.prototype,"id",void 0),Vt([Ao("")],Yh.prototype,"name",void 0),Vt([Ao("")],Yh.prototype,"className",void 0),Vt([Go("pass-through")],Yh.prototype,"blendMode",void 0),Vt([Zo(1)],Yh.prototype,"opacity",void 0),Vt([Ko(!0)],Yh.prototype,"visible",void 0),Vt([Go(!1)],Yh.prototype,"locked",void 0),Vt([Go(!1)],Yh.prototype,"dim",void 0),Vt([Go(!1)],Yh.prototype,"dimskip",void 0),Vt([$o(0)],Yh.prototype,"zIndex",void 0),Vt([Qo(!1)],Yh.prototype,"mask",void 0),Vt([tn(!1)],Yh.prototype,"eraser",void 0),Vt([Mo(0,!0)],Yh.prototype,"x",void 0),Vt([Mo(0,!0)],Yh.prototype,"y",void 0),Vt([Fo(100,!0)],Yh.prototype,"width",void 0),Vt([Fo(100,!0)],Yh.prototype,"height",void 0),Vt([Io(1,!0)],Yh.prototype,"scaleX",void 0),Vt([Io(1,!0)],Yh.prototype,"scaleY",void 0),Vt([Wo(0,!0)],Yh.prototype,"rotation",void 0),Vt([Wo(0,!0)],Yh.prototype,"skewX",void 0),Vt([Wo(0,!0)],Yh.prototype,"skewY",void 0),Vt([Mo(0,!0)],Yh.prototype,"offsetX",void 0),Vt([Mo(0,!0)],Yh.prototype,"offsetY",void 0),Vt([Mo(0,!0)],Yh.prototype,"scrollX",void 0),Vt([Mo(0,!0)],Yh.prototype,"scrollY",void 0),Vt([Do()],Yh.prototype,"origin",void 0),Vt([Do()],Yh.prototype,"around",void 0),Vt([Ao(!1)],Yh.prototype,"lazy",void 0),Vt([zo(1)],Yh.prototype,"pixelRatio",void 0),Vt([Yo()],Yh.prototype,"path",void 0),Vt([Ho()],Yh.prototype,"windingRule",void 0),Vt([Ho(!0)],Yh.prototype,"closed",void 0),Vt([Fo(0)],Yh.prototype,"padding",void 0),Vt([Fo(!1)],Yh.prototype,"lockRatio",void 0),Vt([Fo()],Yh.prototype,"widthRange",void 0),Vt([Fo()],Yh.prototype,"heightRange",void 0),Vt([Ao(!1)],Yh.prototype,"draggable",void 0),Vt([Ao()],Yh.prototype,"dragBounds",void 0),Vt([Ao(!1)],Yh.prototype,"editable",void 0),Vt([en(!0)],Yh.prototype,"hittable",void 0),Vt([en("path")],Yh.prototype,"hitFill",void 0),Vt([jo("path")],Yh.prototype,"hitStroke",void 0),Vt([en(!1)],Yh.prototype,"hitBox",void 0),Vt([en(!0)],Yh.prototype,"hitChildren",void 0),Vt([en(!0)],Yh.prototype,"hitSelf",void 0),Vt([en()],Yh.prototype,"hitRadius",void 0),Vt([sn("")],Yh.prototype,"cursor",void 0),Vt([Go()],Yh.prototype,"fill",void 0),Vt([jo(void 0,!0)],Yh.prototype,"stroke",void 0),Vt([jo("inside")],Yh.prototype,"strokeAlign",void 0),Vt([jo(1,!0)],Yh.prototype,"strokeWidth",void 0),Vt([jo(!1)],Yh.prototype,"strokeWidthFixed",void 0),Vt([jo("none")],Yh.prototype,"strokeCap",void 0),Vt([jo("miter")],Yh.prototype,"strokeJoin",void 0),Vt([jo()],Yh.prototype,"dashPattern",void 0),Vt([jo(0)],Yh.prototype,"dashOffset",void 0),Vt([jo(10)],Yh.prototype,"miterLimit",void 0),Vt([Ho(0)],Yh.prototype,"cornerRadius",void 0),Vt([Ho()],Yh.prototype,"cornerSmoothing",void 0),Vt([Ja()],Yh.prototype,"shadow",void 0),Vt([Ja()],Yh.prototype,"innerShadow",void 0),Vt([Ja()],Yh.prototype,"blur",void 0),Vt([Ja()],Yh.prototype,"backgroundBlur",void 0),Vt([Ja()],Yh.prototype,"grayscale",void 0),Vt([Ja()],Yh.prototype,"filter",void 0),Vt([Go()],Yh.prototype,"placeholderColor",void 0),Vt([Ao(100)],Yh.prototype,"placeholderDelay",void 0),Vt([Ao({})],Yh.prototype,"data",void 0),Vt([dn(fa.prototype.reset)],Yh.prototype,"reset",null),Yh=Nh=Vt([_n(Dh),_n(Wh),cn()],Yh);let Hh=class extends Yh{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach((t=>this.add(t))),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return e.children=this.children.map((e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Xh;Vt([on(wh)],Hh.prototype,"__",void 0),Vt([Fo(0)],Hh.prototype,"width",void 0),Vt([Fo(0)],Hh.prototype,"height",void 0),Hh=Vt([_n(Sa),pn()],Hh);const Vh=xt.get("Leafer");let jh=Xh=class extends Hh{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&xo.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),Xh.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,Wt.assign(s,t));const o=this.canvas=Lt.canvas(s);this.__controllers.push(this.renderer=Lt.renderer(this,o,s),this.watcher=Lt.watcher(this,s),this.layouter=Lt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=Lt.selector(this),this.interaction=Lt.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Lt.hitCanvasManager()),this.canvasManager=new It,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Yn.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(ur.RESTART):this.emitLeafer(ur.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(ur.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=Wt.copyAttrs({},t,ee);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new ft(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=Wt.copyAttrs({},this.canvas,ee);e.resize(t),this.updateLazyBounds(),this.__onResize(new hr(t,i))}__onResize(t){this.emitEvent(t),Wt.copyAttrs(this.__,t,ee),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new mt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ee.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout((()=>this.parent&&this.parent.__updateSortChildren())))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ee.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=Wt.copyAttrs({},this.canvas,ee);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(ur.BEFORE_READY),this.emitLeafer(ur.READY),this.emitLeafer(ur.AFTER_READY),Yn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ur.VIEW_READY),Yn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Yn.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(ur.VIEW_COMPLETED),Yn.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Ct.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ur(t,this))}__listenEvents(){const t=Bt.start("FirstCreate "+this.innerName);this.once([[ur.START,()=>Bt.end(t)],[dr.START,this.updateLazyBounds,this],[cr.START,this.__onCreated,this],[cr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[lr.DATA,this.__onWatchData,this],[dr.END,this.__onLayoutEnd,this],[cr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Xh.list.remove(this);try{this.stop(),this.emitLeafer(ur.END),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{ko.clearRecycled()}),100)}catch(t){Vh.error(t)}}};t?e():setTimeout(e)}};jh.list=new Ra,Vt([on(bh)],jh.prototype,"__",void 0),Vt([Fo()],jh.prototype,"pixelRatio",void 0),jh=Xh=Vt([pn()],jh);let Uh=class extends Yh{get __tag(){return"Rect"}constructor(t){super(t)}};Vt([on(Bh)],Uh.prototype,"__",void 0),Uh=Vt([_n(zh),cn(),pn()],Uh);const{copy:Gh,add:Zh,includes:Kh}=ut,qh=Uh.prototype,Jh=Hh.prototype,$h={};let Qh=class extends Hh{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;const{renderBounds:e}=this.__layout;this.children.length?(super.__updateRenderBounds(),Gh($h,e),this.__updateRectRenderBounds(),t=!Kh(e,$h),t&&"hide"!==this.__.overflow&&Zh(e,$h)):this.__updateRectRenderBounds(),Wt.stintSet(this,"isOverflow",t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__useStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};Vt([on(xh)],Qh.prototype,"__",void 0),Vt([Fo(100)],Qh.prototype,"width",void 0),Vt([Fo(100)],Qh.prototype,"height",void 0),Vt([Ao(!1)],Qh.prototype,"resizeChildren",void 0),Vt([Uo("show")],Qh.prototype,"overflow",void 0),Vt([dn(qh.__updateStrokeSpread)],Qh.prototype,"__updateStrokeSpread",null),Vt([dn(qh.__updateRenderSpread)],Qh.prototype,"__updateRectRenderSpread",null),Vt([dn(qh.__updateBoxBounds)],Qh.prototype,"__updateRectBoxBounds",null),Vt([dn(qh.__updateStrokeBounds)],Qh.prototype,"__updateStrokeBounds",null),Vt([dn(qh.__updateRenderBounds)],Qh.prototype,"__updateRectRenderBounds",null),Vt([dn(qh.__updateChange)],Qh.prototype,"__updateRectChange",null),Vt([dn(qh.__render)],Qh.prototype,"__renderRect",null),Vt([dn(Jh.__render)],Qh.prototype,"__renderGroup",null),Qh=Vt([cn(),pn()],Qh);let tl=class extends Qh{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};Vt([on(kh)],tl.prototype,"__",void 0),Vt([Go("#FFFFFF")],tl.prototype,"fill",void 0),Vt([Uo("hide")],tl.prototype,"overflow",void 0),tl=Vt([pn()],tl);const{moveTo:el,closePath:il,ellipse:sl}=Gi;let ol=class extends Yh{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&sl(h,r,a,r*s,a*s,0,o,n,!1),sl(h,r,a,r,a,0,n,o,!0),s<1&&il(h)):(s<1&&(sl(h,r,a,r*s,a*s),el(h,e,a)),sl(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(el(h,r,a),sl(h,r,a,r,a,0,o,n,!1),il(h)):sl(h,r,a,r,a)}};Vt([on(Sh)],ol.prototype,"__",void 0),Vt([Ho(0)],ol.prototype,"innerRadius",void 0),Vt([Ho(0)],ol.prototype,"startAngle",void 0),Vt([Ho(0)],ol.prototype,"endAngle",void 0),ol=Vt([pn()],ol);const{moveTo:nl,lineTo:rl,drawPoints:al}=Gi,{rotate:hl,getAngle:ll,getDistance:dl,defaultPoint:cl}=P,{toBounds:ul}=so;let _l=class extends Yh{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&hl(i,e),i}set toPoint(t){this.width=dl(cl,t),this.rotation=ll(cl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?al(e,t.points,!1,t.closed):(nl(e,0,0),rl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(al(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&sh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?ul(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};Vt([on(Eh)],_l.prototype,"__",void 0),Vt([Xo("center")],_l.prototype,"strokeAlign",void 0),Vt([Fo(0)],_l.prototype,"height",void 0),Vt([Ho()],_l.prototype,"points",void 0),Vt([Ho(0)],_l.prototype,"curve",void 0),Vt([Ho(!1)],_l.prototype,"closed",void 0),_l=Vt([pn()],_l);const{sin:pl,cos:gl,PI:fl}=Math,{moveTo:yl,lineTo:ml,closePath:vl,drawPoints:wl}=Gi,xl=_l.prototype;let bl=class extends Yh{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)wl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,n=i/2;yl(t,o,0);for(let e=1;e<s;e++)ml(t,o+o*pl(2*e*fl/s),n-n*gl(2*e*fl/s));vl(t)}}__updateRenderPath(){}__updateBoxBounds(){}};Vt([on(Rh)],bl.prototype,"__",void 0),Vt([Ho(3)],bl.prototype,"sides",void 0),Vt([Ho()],bl.prototype,"points",void 0),Vt([Ho(0)],bl.prototype,"curve",void 0),Vt([dn(xl.__updateRenderPath)],bl.prototype,"__updateRenderPath",null),Vt([dn(xl.__updateBoxBounds)],bl.prototype,"__updateBoxBounds",null),bl=Vt([cn(),pn()],bl);const{sin:kl,cos:El,PI:Bl}=Math,{moveTo:Sl,lineTo:Rl,closePath:Cl}=Gi;let Ll=class extends Yh{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];Sl(r,o,0);for(let t=1;t<2*i;t++)Rl(r,o+(t%2==0?o:o*s)*kl(t*Bl/i),n-(t%2==0?n:n*s)*El(t*Bl/i));Cl(r)}};Vt([on(Ch)],Ll.prototype,"__",void 0),Vt([Ho(5)],Ll.prototype,"corners",void 0),Vt([Ho(.382)],Ll.prototype,"innerRadius",void 0),Ll=Vt([pn()],Ll);let Tl=class extends Uh{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return t instanceof Array&&t[0].image}constructor(t){super(t)}};Vt([on(Ah)],Tl.prototype,"__",void 0),Vt([Fo("")],Tl.prototype,"url",void 0),Tl=Vt([pn()],Tl);const Ol=Tl;let Pl=class extends Uh{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Lt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Ro({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new er(er.LOADED,{image:t}))}))}draw(t,e,i,s){const o=new z(t.worldTransform).invert(),n=new z;e&&n.translate(e.x,e.y),i&&("number"==typeof i?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};Vt([on(Mh)],Pl.prototype,"__",void 0),Vt([$a(100)],Pl.prototype,"width",void 0),Vt([$a(100)],Pl.prototype,"height",void 0),Vt([$a(1)],Pl.prototype,"pixelRatio",void 0),Vt([$a(!0)],Pl.prototype,"smooth",void 0),Vt([Ao(!1)],Pl.prototype,"safeResize",void 0),Vt([$a()],Pl.prototype,"contextSettings",void 0),Pl=Vt([pn()],Pl);const{copyAndSpread:Al,includes:Ml,spread:Dl,setList:Il}=ut;let Wl=class extends Yh{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:a,textCase:h,textOverflow:l,padding:d}=t;t.__lineHeight=ih.number(e,o),t.__letterSpacing=ih.number(i,o),t.__padding=d?r.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==n?n+" ":""}${o}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=th.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Dl(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),Wt.stintSet(this,"isOverflow",!Ml(h,a)),this.isOverflow?(Il(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Al(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Vt([on(Ph)],Wl.prototype,"__",void 0),Vt([Fo(0)],Wl.prototype,"width",void 0),Vt([Fo(0)],Wl.prototype,"height",void 0),Vt([Go()],Wl.prototype,"boxStyle",void 0),Vt([Ao(!1)],Wl.prototype,"resizeFontSize",void 0),Vt([Go("#000000")],Wl.prototype,"fill",void 0),Vt([Xo("outside")],Wl.prototype,"strokeAlign",void 0),Vt([en("all")],Wl.prototype,"hitFill",void 0),Vt([Fo("")],Wl.prototype,"text",void 0),Vt([Fo("")],Wl.prototype,"placeholder",void 0),Vt([Fo("caption")],Wl.prototype,"fontFamily",void 0),Vt([Fo(12)],Wl.prototype,"fontSize",void 0),Vt([Fo("normal")],Wl.prototype,"fontWeight",void 0),Vt([Fo(!1)],Wl.prototype,"italic",void 0),Vt([Fo("none")],Wl.prototype,"textCase",void 0),Vt([Fo("none")],Wl.prototype,"textDecoration",void 0),Vt([Fo(0)],Wl.prototype,"letterSpacing",void 0),Vt([Fo({type:"percent",value:1.5})],Wl.prototype,"lineHeight",void 0),Vt([Fo(0)],Wl.prototype,"paraIndent",void 0),Vt([Fo(0)],Wl.prototype,"paraSpacing",void 0),Vt([Fo("x")],Wl.prototype,"writingMode",void 0),Vt([Fo("left")],Wl.prototype,"textAlign",void 0),Vt([Fo("top")],Wl.prototype,"verticalAlign",void 0),Vt([Fo(!0)],Wl.prototype,"autoSizeAlign",void 0),Vt([Fo("normal")],Wl.prototype,"textWrap",void 0),Vt([Fo("show")],Wl.prototype,"textOverflow",void 0),Vt([Go(!1)],Wl.prototype,"textEditing",void 0),Wl=Vt([pn()],Wl);let Fl=class extends Yh{get __tag(){return"Path"}constructor(t){super(t)}};Vt([on(Lh)],Fl.prototype,"__",void 0),Vt([Xo("center")],Fl.prototype,"strokeAlign",void 0),Fl=Vt([pn()],Fl);let zl=class extends Hh{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Fl(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};Vt([on(Th)],zl.prototype,"__",void 0),Vt([(t,e)=>{Co(t,e,{get(){return this.__path}})}],zl.prototype,"path",void 0),zl=Vt([_n(ds,["set","path","paint"]),pn()],zl);let Nl=class extends jh{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&Lt.editor(o,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach((t=>t.updateLayout())),super.__updateLocalBounds()}start(){super.start(),this.forEach((t=>t.start()))}stop(){this.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.forEach((t=>t.lockLayout()))}forceRender(t,e){this.forEach((i=>i.forceRender(t,e)))}addLeafer(t){const e=new jh(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach((i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e&&e.bounds)))}__onResize(t){this.forEach((e=>e.resize(t))),super.__onResize(t)}updateLayout(){this.forEach((t=>t.updateLayout()))}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&Wt.assign(e,t),this.autoLayout&&Wt.copyAttrs(e,this,ee),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[dr.END,this.__onReady,this],[cr.START,this.__onCreated,this],[cr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(cr.END,this.__onChildRenderEnd,this))}};Nl=Vt([pn()],Nl);const Yl={},Hl={isHoldSpaceKey:()=>Hl.isHold("Space"),isHold:t=>Yl[t],setDownCode(t){Yl[t]||(Yl[t]=!0)},setUpCode(t){Yl[t]=!1}},Xl={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Vl extends $n{get spaceKey(){return Hl.isHoldSpaceKey()}get left(){return Xl.left(this)}get right(){return Xl.right(this)}get middle(){return Xl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){Mt.changeName(t,e)}}let jl=class extends Vl{};jl.POINTER="pointer",jl.BEFORE_DOWN="pointer.before_down",jl.BEFORE_MOVE="pointer.before_move",jl.BEFORE_UP="pointer.before_up",jl.DOWN="pointer.down",jl.MOVE="pointer.move",jl.UP="pointer.up",jl.OVER="pointer.over",jl.OUT="pointer.out",jl.ENTER="pointer.enter",jl.LEAVE="pointer.leave",jl.TAP="tap",jl.DOUBLE_TAP="double_tap",jl.CLICK="click",jl.DOUBLE_CLICK="double_click",jl.LONG_PRESS="long_press",jl.LONG_TAP="long_tap",jl.MENU="pointer.menu",jl.MENU_TAP="pointer.menu_tap",jl=Vt([gn()],jl);const Ul=jl,Gl={};let Zl=class extends jl{static setList(t){this.list=t instanceof Ra?t:new Ra(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:o}=t,n=t.getLocalPoint(i,null,!0);return P.move(n,e.x-t.x,e.y-t.y),o&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===o?t.parent.boxBounds:o,n,!0),"x"===s&&(n.y=0),"y"===s&&(n.x=0),n}static getMoveInDragBounds(t,e,i,s){const o=t.x+i.x,n=t.y+i.y,r=o+t.width,a=n+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),ut.includes(t,e)?(o>e.x?i.x+=e.x-o:r<h&&(i.x+=h-r),n>e.y?i.y+=e.y-n:a<l&&(i.y+=l-a)):(o<e.x?i.x+=e.x-o:r>h&&(i.x+=h-r),n<e.y?i.y+=e.y-n:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Gl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Gl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Gl,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return ut.set(i,e.x-t.x,e.y-t.y,t.x,t.y),ut.unsign(i),i}assignMove(t){Gl.x=t?this.totalX:this.moveX,Gl.y=t?this.totalY:this.moveY}};Zl.BEFORE_DRAG="drag.before_drag",Zl.START="drag.start",Zl.DRAG="drag",Zl.END="drag.end",Zl.OVER="drag.over",Zl.OUT="drag.out",Zl.ENTER="drag.enter",Zl.LEAVE="drag.leave",Zl=Vt([gn()],Zl);const Kl=Zl;let ql=class extends jl{static setList(t){Zl.setList(t)}static setData(t){Zl.setData(t)}};ql.DROP="drop",ql=Vt([gn()],ql);let Jl=class extends Zl{};Jl.BEFORE_MOVE="move.before_move",Jl.START="move.start",Jl.MOVE="move",Jl.END="move.end",Jl=Vt([gn()],Jl);let $l=class extends jl{};$l.BEFORE_ROTATE="rotate.before_rotate",$l.START="rotate.start",$l.ROTATE="rotate",$l.END="rotate.end",$l=Vt([gn()],$l);let Ql=class extends Zl{};Ql.SWIPE="swipe",Ql.LEFT="swipe.left",Ql.RIGHT="swipe.right",Ql.UP="swipe.up",Ql.DOWN="swipe.down",Ql=Vt([gn()],Ql);let td=class extends jl{};td.BEFORE_ZOOM="zoom.before_zoom",td.START="zoom.start",td.ZOOM="zoom",td.END="zoom.end",td=Vt([gn()],td);let ed=class extends Vl{};ed.DOWN="key.down",ed.HOLD="key.hold",ed.UP="key.up",ed=Vt([gn()],ed);const id={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Ql.UP:t>45&&t<135?Ql.DOWN:t<=45&&t>=-45?Ql.RIGHT:Ql.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:sd.getSwipeDirection(P.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Ra,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(Zl.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},sd=id,od=new Ra,{getDragEventData:nd,getDropEventData:rd,getSwipeEventData:ad}=id;class hd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=nd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Zl.list||this.draggableList||od;return this.dragging&&(s?t?od:new Ra(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Jl.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Xl.left(t),this.dragging&&(this.interaction.emit(Zl.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],(e.draggable||e.editable)&&e.hitSelf&&!e.locked){this.draggableList=new Ra(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=nd(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(Jl.BEFORE_MOVE,this.dragData),e.emit(Jl.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Zl.BEFORE_DRAG,this.dragData),e.emit(Zl.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(Zl.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Zl.OUT,t,i),e.emit(Zl.OVER,t,s)):e.emit(Zl.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Zl.LEAVE,t,i,s),e.emit(Zl.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=nd(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Jl.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.emit(Zl.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(P.getDistance(e,t)>o.config.pointer.swipeDistance){const t=ad(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=rd(t,e,Zl.data);s.path=i,this.interaction.emit(ql.DROP,s),this.interaction.emit(Zl.LEAVE,t,i)}dragReset(){Zl.list=Zl.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const ld=xt.get("emit");const dd=["move","zoom","rotate","key"];function cd(t,e,i,s,o){if(dd.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!_d(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&ud(n,e,i,s,o)}}function ud(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!_d(t,o)&&(dh.updateEventStyle&&!s&&dh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=Mt.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function _d(t,e){return e&&e.has(t)}const pd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:gd,pathCanDrag:fd,pathHasOutside:yd}=id;class md{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Xl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Xl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Hl.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=Wt.clone(pd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ra(t),this.createTransformer(),this.dragger=new hd(this),s&&(this.config=Wt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Xl.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(jl.BEFORE_DOWN,t),this.emit(jl.DOWN,t),Xl.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Xl.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Xl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(jl.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=P.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(jl.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Xl.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(jl.BEFORE_UP,t),this.emit(jl.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(jl.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(jl.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Hl.setDownCode(e),this.emit(ed.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(ed.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,Hl.setUpCode(e),this.emit(ed.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Ra),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(jl.OUT,t,i),this.emit(jl.OVER,t,e)):this.emit(jl.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(jl.LEAVE,t,i,e),this.emit(jl.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(jl.LEAVE,t),this.dragger.dragging&&this.emit(ql.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[jl.DOUBLE_TAP,jl.DOUBLE_CLICK].some((e=>gd(t.path,e)));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!yd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!fd(t.path))&&!yd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:jl.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,o=s.length;t<o&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y};return this.p.snap&&P.round(s),s}emitTap(t){this.emit(jl.TAP,t),this.emit(jl.CLICK,t)}emitDoubleTap(t){this.emit(jl.DOUBLE_TAP,t),this.emit(jl.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(jl.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(jl.LONG_TAP,t),(gd(t.path,jl.LONG_TAP)||gd(t.path,jl.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new ft(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(hr.RESIZE,this.__onResize,this)],t.once(ur.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],ud(o,t,e,!0,s))return;o.isApp&&cd(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&cd(o,t,e,!1,s),ud(o,t,e,!1,s))return}catch(t){ld.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class vd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}vd.custom={};class wd extends It{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ra,this.pixelList=new Ra}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Lt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Lt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}const{toInnerRadiusPointOf:xd,copy:bd,setRadius:kd}=P,Ed={},Bd=fa.prototype;Bd.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(bd(Ed,t),kd(t=Ed,e.hitRadius)),xd(t,i,Ed),e.hitBox||o){if(ut.hitRadiusPoint(s.boxBounds,Ed))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Ed)},Bd.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Bd.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Bd.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Bd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Sd=new z,Rd=Yh.prototype;Rd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,o=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=s||o;this.__hitCanvas||(this.__hitCanvas=n?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:i}=this.__layout,n=t.image.hitCanvasSize,a=r.hitScale=yt.set(0,0,n,n).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=yt.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),ko.patternLocked=!0,this.__renderShape(r,{matrix:Sd.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l),ignoreFill:!s,ignoreStroke:!o}),ko.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Rd.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__strokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Cd=Yh.prototype,Ld=Uh.prototype,Td=Qh.prototype;Ld.__updateHitCanvas=Td.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Cd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Ld.__hitFill=Td.__hitFill=function(t){return this.__hitCanvas?Cd.__hitFill.call(this,t):ut.hitRadiusPoint(this.__layout.boxBounds,t)},Wl.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach((o=>t.rect(o.x,o.y-s,o.width,e<i?i:e)))},Hh.prototype.pick=function(e,i){return i||(i=Yt),this.updateLayout(),function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Lt.selector())}(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Od=ie.prototype;function Pd(t,e){const i=t.__,{rows:s,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[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(o){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>o.forEach((i=>e.fillRect(t.x,t.y+i,t.width,n)))))}}function Ad(t,e){t.__.__font?Pd(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Md(t,e,i){switch(e.__.strokeAlign){case"center":Dd(t,1,e,i);break;case"inside":Id(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Dd(t,2,e,i):Id(t,"outside",e,i)}}function Dd(t,e,i,s){const o=i.__;s.setStroke(!o.__isStrokes&&t,o.strokeWidth*e,o),o.__isStrokes?zd(t,!0,i,s):Fd(i,s)}function Id(t,e,i,s){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,Dd(t,2,i,o),o.blendMode="outside"===e?"destination-out":"destination-in",Pd(i,o),o.blendMode="normal",Wd(s,o,i),o.recycle(i.__nowWorld)}function Wd(e,i,s){s.__worldFlipped||t.fullImageShadow?e.copyWorldByReset(i,s.__nowWorld):e.copyWorldToInner(i,s.__nowWorld,s.__layout.renderBounds)}function Fd(t,e){let i,s=t.__.__textDrawData;const{rows:o,decorationY:n}=s;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(n){const{decorationHeight:t}=s;o.forEach((i=>n.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function zd(t,e,i,s){let o;for(let n=0,r=t.length;n<r;n++)o=t[n],o.image&&nh.checkImage(i,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?Fd(i,s):s.stroke(),s.restoreBlendMode()):e?Fd(i,s):s.stroke())}function Nd(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Md(t,e,i);else switch(s.strokeAlign){case"center":Yd(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Yd(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Yd(t,2,e,i);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),Yd(t,2,e,n),n.clipUI(s),n.clearWorld(o),Wd(i,n,e),n.recycle(e.__nowWorld)}}(t,e,i)}}function Yd(t,e,i,s){const o=i.__;s.setStroke(!o.__isStrokes&&t,o.__strokeWidth*e,o),o.__isStrokes?zd(t,!1,i,s):s.stroke(),o.__useArrow&&oh.strokeArrow(t,i,s)}Od.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Od.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Od.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),yt.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(yt.x,yt.y,yt.width||1,yt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Hd,getOuterOf:Xd,getByMove:Vd,getIntersectData:jd}=ut;let Ud;const{stintSet:Gd}=Wt,{hasTransparent:Zd}=eh;function Kd(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout;switch(e.type){case"image":s=nh.image(i,t,e,o,!Ud||!Ud[e.url]);break;case"linear":s=rh.linearGradient(e,o);break;case"radial":s=rh.radialGradient(e,o);break;case"angular":s=rh.conicGradient(e,o);break;case"solid":const{type:n,color:r,opacity:a}=e;s={type:n,style:eh.string(r,a)};break;default:void 0!==e.r&&(s={type:"solid",style:eh.string(e)})}return s&&("string"==typeof s.style&&Zd(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const qd={compute:function(t,e){const i=e.__,s=[];let o,n,r=i.__input[t];r instanceof Array||(r=[r]),Ud=nh.recycleImage(t,i);for(let i,o=0,n=r.length;o<n;o++)(i=Kd(t,r[o],e))&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(o=!0),n=!0),"fill"===t?(Gd(i,"__isAlphaPixelFill",o),Gd(i,"__isTransparentFill",n)):(Gd(i,"__isAlphaPixelStroke",o),Gd(i,"__isTransparentStroke",n))},fill:function(t,e,i){i.fillStyle=t,Ad(e,i)},fills:function(t,e,i){let s;for(let o=0,n=t.length;o<n;o++){if(s=t[o],s.image){if(nh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),Ad(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),Ad(e,i),i.restoreBlendMode()):Ad(e,i)}},fillPathOrText:Ad,fillText:Pd,stroke:Nd,strokes:function(t,e,i){Nd(t,e,i)},strokeText:Md,drawTextStroke:Fd,shape:function(t,e,i){const s=e.getSameCanvas(),o=t.__nowWorld;let n,r,a,h,{scaleX:l,scaleY:d}=o;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(o))h=s,n=a=o;else{const{renderShapeSpread:s}=t.__layout,c=jd(s?Hd(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,o);r=e.bounds.getFitMatrix(c);let{a:u,d:_}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=_),a=Xd(o,r),n=Vd(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,_*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,_)})}return t.__renderShape(s,i),{canvas:s,matrix:r,bounds:n,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let Jd={};const{get:$d,rotateOfOuter:Qd,translate:tc,scaleOfOuter:ec,scale:ic,rotate:sc,skew:oc}=x;function nc(t,e,i,s,o,n,r){const a=$d();tc(a,e.x+i,e.y+s),ic(a,o,n),r&&Qd(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function rc(t,e,i,s,o,n,r,a){const h=$d();r&&sc(h,r),a&&oc(h,a.x,a.y),o&&ic(h,o,n),tc(h,e.x+i,e.y+s),t.transform=h}function ac(t,e,i,s,o,n,r,a,h,l){const d=$d();if(h)if("center"===l)Qd(d,{x:i/2,y:s/2},h);else switch(sc(d,h),h){case 90:tc(d,s,0);break;case 180:tc(d,i,s);break;case 270:tc(d,0,i)}Jd.x=e.x+o,Jd.y=e.y+n,tc(d,Jd.x,Jd.y),r&&ec(d,Jd,r,a),t.transform=d}const{get:hc,translate:lc}=x,dc=new ft,cc={},uc={};function _c(t,e,i,s){const{changeful:o,sync:n,editing:r}=i;o&&(t.changeful=o),n&&(t.sync=n),r&&(t.editing=r),t.data=pc(i,s,e)}function pc(t,e,i){t.padding&&(e=dc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:a,align:h,offset:l,scale:d,size:c,rotation:u,skew:_,repeat:p,filters:g}=t,f=e.width===s&&e.height===o,y={mode:a},m="center"!==h&&(u||0)%180==90;let v,w;switch(ut.set(uc,0,0,m?o:s,m?s:o),a&&"cover"!==a&&"fit"!==a?((d||c)&&(r.getScaleData(d,c,i,cc),v=cc.scaleX,w=cc.scaleY),h&&(v&&ut.scale(uc,v,w,!0),K.toPoint(h,uc,e,uc,!0,!0))):f&&!u||(v=w=ut.getFitScale(e,uc,"fit"!==a),ut.put(e,i,h,v,!1,uc),ut.scale(uc,v,w,!0)),l&&P.move(uc,l),a){case"stretch":f||(s=e.width,o=e.height);break;case"normal":case"clip":(uc.x||uc.y||v||u||_)&&rc(y,e,uc.x,uc.y,v,w,u,_);break;case"repeat":(!f||v||u)&&ac(y,e,s,o,uc.x,uc.y,v,w,u,h),p||(y.repeat="repeat");break;default:v&&nc(y,e,uc.x,uc.y,v,w,u)}return y.transform||(e.x||e.y)&&(y.transform=hc(),lc(y.transform,e.x,e.y)),v&&"stretch"!==a&&(y.scaleX=v,y.scaleY=w),y.width=s,y.height=o,n&&(y.opacity=n),g&&(y.filters=g),p&&(y.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),y}let gc,fc=new ft;const{isSame:yc}=ut;function mc(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||_c(o,s,i,n),!0}function vc(t,e){bc(t,er.LOAD,e)}function wc(t,e){bc(t,er.LOADED,e)}function xc(t,e,i){e.error=i,t.forceUpdate("surface"),bc(t,er.ERROR,e)}function bc(t,e,i){t.hasEvent(e)&&t.emitEvent(new er(e,i))}function kc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Ec,scale:Bc,copy:Sc}=x,{ceil:Rc,abs:Cc}=Math;function Lc(e,i,s){let{scaleX:o,scaleY:n}=ko.patternLocked?e.__world:e.__nowWorld;const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{o=Cc(o),n=Cc(n);const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g}=a;u&&(u=Cc(u),_=Cc(_),l=Ec(),Sc(l,p),Bc(l,1/u,1/_),o*=u,n*=_),o*=s,n*=s,d*=o,c*=n;const f=d*c;if(!g&&f>t.image.maxCacheSize)return!1;let y=t.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}f>y&&(h=Math.sqrt(f/y)),h&&(o/=h,n/=h,d/=h,c/=h),u&&(o/=u,n/=_),(p||1!==o||1!==n)&&(l||(l=Ec(),p&&Sc(l,p)),Bc(l,1/o,1/n));const m=e.getCanvas(Rc(d)||1,Rc(c)||1,a.opacity,a.filters),v=e.getPattern(m,g||t.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=r,!0}}const{abs:Tc}=Math;const Oc={image:function(t,e,i,s,o){let n,r;const a=ko.get(i);return gc&&i===gc.paint&&yc(s,gc.boxBounds)?n=gc.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),gc=a.use>1?{leafPaint:n,paint:i,boxBounds:fc.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(mc(t,e,i,a,n,s),o&&(vc(t,r),wc(t,r))):a.error?o&&xc(t,r,a.error):(o&&(kc(t,!0),vc(t,r)),n.loadId=a.load((()=>{kc(t,!1),t.destroyed||(mc(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),wc(t,r)),n.loadId=void 0}),(e=>{kc(t,!1),xc(t,r,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,i,s,o){const{scaleX:n,scaleY:r}=ko.patternLocked?e.__world:e.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!lh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||hr.isResizing(e)||lh.running)){let{width:e,height:i}=h;e*=Tc(n)*a,i*=Tc(r)*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||lh.running?Lc(e,s,a):s.patternTask||(s.patternTask=ko.patternTasker.add((()=>jt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&Lc(e,s,a),e.forceUpdate("surface")}))),300)),!1)},createPattern:Lc,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,ko.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],r instanceof Array||(r=[r])),o.unload(i[h].loadId,!r.some((t=>t.url===a)))));return n}return null},createData:_c,getPatternData:pc,fillOrFitMode:nc,clipMode:rc,repeatMode:ac},{toPoint:Pc}=U,{hasTransparent:Ac}=eh,Mc={},Dc={};function Ic(t,e,i,s){if(i){let o,n,r,a;for(let t=0,h=i.length;t<h;t++)o=i[t],"string"==typeof o?(r=t/(h-1),n=eh.string(o,s)):(r=o.offset,n=eh.string(o.color,s)),e.addColorStop(r,n),!a&&Ac(n)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Wc,getDistance:Fc}=P,{get:zc,rotateOfOuter:Nc,scaleOfOuter:Yc}=x,{toPoint:Hc}=U,Xc={},Vc={};function jc(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Wc(e,i);n=zc(),o?(Yc(n,e,r/a*(s||1),1),Nc(n,e,t+90)):(Yc(n,e,1,r/a*(s||1)),Nc(n,e,t))}return n}const{getDistance:Uc}=P,{toPoint:Gc}=U,Zc={},Kc={};const qc={linearGradient:function(e,i){let{from:s,to:o,type:n,opacity:r}=e;Pc(s||"top",i,Mc),Pc(o||"bottom",i,Dc);const a=t.canvas.createLinearGradient(Mc.x,Mc.y,Dc.x,Dc.y),h={type:n,style:a};return Ic(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Hc(s||"center",i,Xc),Hc(o||"bottom",i,Vc);const h=t.canvas.createRadialGradient(Xc.x,Xc.y,0,Xc.x,Xc.y,Fc(Xc,Vc)),l={type:n,style:h};Ic(l,h,e.stops,r);const d=jc(i,Xc,Vc,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Gc(s||"center",i,Zc),Gc(o||"bottom",i,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,Uc(Zc,Kc)),l={type:n,style:h};Ic(l,h,e.stops,r);const d=jc(i,Zc,Kc,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:jc},{copy:Jc,toOffsetOutBounds:$c}=ut,Qc={},tu={};function eu(e,i,s,o){const{bounds:n,shapeBounds:r}=o;if(t.fullImageShadow){if(Jc(Qc,e.bounds),Qc.x+=i.x-r.x,Qc.y+=i.y-r.y,s){const{matrix:t}=o;Qc.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),Qc.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),Qc.width*=s,Qc.height*=s}e.copyWorld(o.canvas,e.bounds,Qc)}else s&&(Jc(Qc,i),Qc.x-=i.width/2*(s-1),Qc.y-=i.height/2*(s-1),Qc.width*=s,Qc.height*=s),e.copyWorld(o.canvas,r,s?Qc:i)}const{toOffsetOutBounds:iu}=ut,su={};const ou={shadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;$c(l,tu),a.forEach(((a,g)=>{_.setWorldShadow(tu.offsetX+a.x*c,tu.offsetY+a.y*u,a.blur*c,eh.string(a.color)),o=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,eu(_,tu,o,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),s=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,s,n,a.blendMode):e.copyWorldToInner(_,s,r.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;iu(l,su),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(su.offsetX+a.x*c,su.offsetY+a.y*u,a.blur*c),o=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,eu(_,su,o,i),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,eh.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(_,s,n,a.blendMode):e.copyWorldToInner(_,s,r.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:nu}=Dn;function ru(t,e,i,s,o,n){switch(e){case"grayscale":o.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),s.recycle(o),hu(t,e,i,1)}(t,i,s,o);break;case"opacity-path":hu(t,i,s,n);break;case"path":i.restore()}}function au(t){return t.getSameCanvas(!1,!0)}function hu(t,e,i,s){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o),i.recycle(o)}Hh.prototype.__renderMask=function(t,e){let i,s,o,n,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(r&&(ru(this,r,t,o,s,n),s=o=null),"path"===a||"clipping-path"===a?(i.opacity<1?(r="opacity-path",n=i.opacity,o||(o=au(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=au(t)),o||(o=au(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||nu(i,e)||i.__render(o||t,e);ru(this,r,t,o,s,n)};const lu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",du=lu+"_#~&*+\\=|≮≯≈≠=…",cu=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 uu(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const _u=uu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),pu=uu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),gu=uu(lu),fu=uu(du),yu=uu("- —/~|┆·");var mu;!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"}(mu||(mu={}));const{Letter:vu,Single:wu,Before:xu,After:bu,Symbol:ku,Break:Eu}=mu;function Bu(t){return _u[t]?vu:yu[t]?Eu:pu[t]?xu:gu[t]?bu:fu[t]?ku:cu.test(t)?wu:vu}const Su={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function Ru(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Cu}=Su,{Letter:Lu,Single:Tu,Before:Ou,After:Pu,Symbol:Au,Break:Mu}=mu;let Du,Iu,Wu,Fu,zu,Nu,Yu,Hu,Xu,Vu,ju,Uu,Gu,Zu,Ku,qu,Ju,$u=[];function Qu(t,e){Xu&&!Hu&&(Hu=Xu),Du.data.push({char:t,width:e}),Wu+=e}function t_(){Fu+=Wu,Du.width=Wu,Iu.words.push(Du),Du={data:[]},Wu=0}function e_(){Zu&&(Ku.paraNumber++,Iu.paraStart=!0,Zu=!1),Xu&&(Iu.startCharSize=Hu,Iu.endCharSize=Xu,Hu=0),Iu.width=Fu,qu.width?Cu(Iu):Ju&&i_(),$u.push(Iu),Iu={words:[]},Fu=0}function i_(){Fu>(Ku.maxWidth||0)&&(Ku.maxWidth=Fu)}const{top:s_,right:o_,bottom:n_,left:r_}=X;function a_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const h_={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let s=0,o=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(n?(s=l[r_],n-=l[o_]+l[r_]):i.autoSizeAlign||(s=l[r_]),r?(o=l[s_],r-=l[s_]+l[n_]):i.autoSizeAlign||(o=l[s_]));const d={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=h};return function(e,i,s){Ku=e,$u=e.rows,qu=e.bounds,Ju=!qu.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=qu;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Zu=!0,ju=null,Hu=Yu=Xu=Wu=Fu=0,Du={data:[]},Iu={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)Nu=i[s],"\n"===Nu?(Wu&&t_(),Iu.paraEnd=!0,e_(),Zu=!0):(Vu=Bu(Nu),Vu===Lu&&"none"!==r&&(Nu=Ru(Nu,r,!Wu)),Yu=a.measureText(Nu).width,o&&(o<0&&(Xu=Yu),Yu+=o),Uu=Vu===Tu&&(ju===Tu||ju===Lu)||ju===Tu&&Vu!==Pu,Gu=!(Vu!==Ou&&Vu!==Tu||ju!==Au&&ju!==Pu),zu=Zu&&n?h-n:h,t&&h&&Fu+Wu+Yu>zu&&(e?(Wu&&t_(),Fu&&e_()):(Gu||(Gu=Vu===Lu&&ju==Pu),Uu||Gu||Vu===Mu||Vu===Ou||Vu===Tu||Wu+Yu>zu?(Wu&&t_(),Fu&&e_()):Fu&&e_()))," "===Nu&&!0!==Zu&&Fu+Wu===0||(Vu===Mu?(" "===Nu&&Wu&&t_(),Qu(Nu,Yu),t_()):Uu||Gu?(Wu&&t_(),Qu(Nu,Yu)):Qu(Nu,Yu)),ju=Vu);Wu&&t_(),Fu&&e_(),$u.length>0&&($u[$u.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ku.paraNumber++,Fu=a.measureText(t).width,$u.push({x:n||0,text:t,width:Fu,paraStart:!0}),Ju&&i_()}))}(d,e,i),l&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":a_(e,"x",t[r_]);break;case"right":a_(e,"x",-t[o_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":a_(e,"y",t[s_]);break;case"bottom":a_(e,"y",-t[n_])}}(l,d,i,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*o+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(m+=c),v.y=m,m+=n,t.overflow>r&&m>y&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(d,i),function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===o||"both"===o)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(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,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==o||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,n),d.overflow&&function(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+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)}}))}}(d,i,s,n),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:o}=e;switch(t.decorationHeight=s/11,"object"==typeof o?(i=o.type,o.color&&(t.decorationColor=eh.string(o.color))):i=o,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,i),d}};const l_={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!eh.object)return t;t=eh.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};function d_(t){return t?t instanceof Array?t:[t]:[]}Object.assign(th,h_),Object.assign(eh,l_),Object.assign(oh,qd),Object.assign(nh,Oc),Object.assign(rh,qc),Object.assign(ah,ou),Object.assign(Lt,{interaction:(t,e,i,s)=>new md(t,e,i,s),hitCanvas:(t,e)=>new Ta(t,e),hitCanvasManager:()=>new wd}),Pa();class c_ extends $n{get list(){return d_(this.value)}get oldList(){return d_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function u_(t){return(e,i)=>{const s="_"+i;Co(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){if(this.config){const t="target"===i;if(t){e instanceof Array&&e.length>1&&e[0].locked&&e.splice(0,1);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if("object"==typeof i)e=i;else if(!1===i)return}}const s=t?c_.BEFORE_SELECT:c_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new c_(s,{editor:this,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}c_.BEFORE_SELECT="editor.before_select",c_.SELECT="editor.select",c_.AFTER_SELECT="editor.after_select",c_.BEFORE_HOVER="editor.before_hover",c_.HOVER="editor.hover";const{abs:__}=Math,{copy:p_,scale:g_}=x,{setListWithFn:f_}=ut,{worldBounds:y_}=Dn,m_={a:1,b:0,c:0,d:1,e:0,f:0},v_={x:0,y:0,width:0,height:0};class w_ extends Yh{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){this.set(e),this.target=t,this.update()}update(){const{list:t}=this;t.length?(f_(v_,t,y_),this.set(v_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:n,strokeWidth:r,fill:a}=o,{bounds:h}=e;for(let l=0;l<i.length;l++){s=i[l];const{worldTransform:d,worldRenderBounds:c}=s;if(c.width&&c.height&&(!h||h.hit(c,e.matrix))){const i=__(d.scaleX),h=__(d.scaleY);if(p_(m_,d),m_.half=r%2,i!==h){g_(m_,1/i,1/h),t.setWorld(m_,e.matrix),t.beginPath(),o.strokeWidth=r;const{x:n,y:a,width:l,height:d}=s.__layout.boxBounds;t.rect(n*i,a*h,l*i,d*h)}else t.setWorld(m_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/__(d.scaleX);n&&("string"==typeof n?oh.stroke(n,this,t):oh.strokes(n,this,t)),a&&("string"==typeof a?oh.fill(a,this,t):oh.fills(a,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}Vt([u_((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],w_.prototype,"target",void 0);class x_ extends Hh{constructor(t){super(t),this.strokeArea=new Uh({strokeAlign:"center"}),this.fillArea=new Uh,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const b_={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return k_([t],i,e),i}};function k_(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&o.hitSelf&&e.push(s)}s.isBranch&&k_(s.children,e,i)}}const{findOne:E_,findByBounds:B_}=b_;class S_ extends Hh{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new w_,this.targetStroker=new w_,this.bounds=new ft,this.selectArea=new x_,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:o}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},o||{}))}}onSelect(){if(this.running){const{mergeConfig:t,list:e}=this.editor,{stroke:i,strokeWidth:s,selectedStyle:o}=t;this.targetStroker.setTarget(e,Object.assign({stroke:i,strokeWidth:Math.max(1,s/2)},o||{})),this.hoverStroker.target=null}}update(){this.hoverStroker.update(),this.targetStroker.update()}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(t.shiftKey||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),o=new Ra(B_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach((e=>{o.has(e)||t.push(e)})),o.forEach((e=>{this.originList.has(e)||t.push(e)})),(t.length!==e.list.length||e.list.some(((e,i)=>e!==t[i])))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||t.shiftKey&&!E_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ra(this.editor.editBox.rect)};return E_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):E_(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(t.shiftKey||i)}__listenEvents(){const{editor:t}=this;t.waitLeafer((()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[c_.HOVER,this.onHover,this],[c_.SELECT,this.onSelect,this]]),e.on_([[jl.MOVE,this.onPointerMove,this],[jl.BEFORE_DOWN,this.onBeforeDown,this],[jl.TAP,this.onTap,this],[Zl.START,this.onDragStart,this,!0],[Zl.DRAG,this.onDrag,this],[Zl.END,this.onDragEnd,this],[Jl.MOVE,this.onAutoMove,this],[[td.ZOOM,Jl.MOVE],()=>{this.editor.hoverTarget=null}]])]}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:R_,top:C_,topRight:L_,right:T_,bottomRight:O_,bottom:P_,bottomLeft:A_,left:M_}=V,{toPoint:D_}=U,{within:I_}=r,W_={getScaleData(t,e,i,s,o,n,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:p,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;n&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=v<0?-1:1,b=w<0?-1:1,k=a?v:x*u.width/y,E=a?w:b*u.height/m;s.x*=a?v:x,s.y*=a?w:b;const B=(-s.y+m)/m,S=(s.x+y)/y,R=(s.y+m)/m,C=(-s.x+y)/y;switch(i){case C_:c=B,h="bottom";break;case T_:d=S,h="left";break;case P_:c=R,h="top";break;case M_:d=C,h="right";break;case R_:c=B,d=C,h="bottom-right";break;case L_:c=B,d=S,h="bottom-left";break;case O_:c=R,d=S,h="top-left";break;case A_:c=R,d=C,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case C_:case P_:t=c;break;case M_:case T_:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const L=1!==d,T=1!==c;if(L&&(d/=k),T&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(D_(n||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new ft(t.__localBoxBounds);if(i.scaleOf(t.getLocalPointByInner(l),d,c),!ut.includes(e,i)){const t=i.getIntersect(e),s=t.width/i.width,o=t.height/i.height;L&&(d*=s),T&&(c*=o)}}if(L&&_){const e=u.width*t.scaleX;d=I_(e*d,_)/e}if(T&&p){const e=u.height*t.scaleY;c=I_(e*c,p)/e}return L&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),T&&Math.abs(c*f.height)<1&&(c=(c<0?-1:1)/f.height),o&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case R_:n="bottom-right";break;case L_:n="bottom-left";break;case O_:n="top-left";break;case A_:n="top-right";break;default:n="center"}return D_(o||n,t.boxBounds,r,!0),{origin:r,rotation:P.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case C_:case R_:n={x:.5,y:0},o="bottom",a=1;break;case P_:case O_:n={x:.5,y:1},o="top",a=1;break;case M_:case A_:n={x:0,y:.5},o="right",h=1;break;case T_:case L_:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,D_(s||o,t,r,!0);const c=P.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case M_:t=T_;break;case R_:t=L_;break;case A_:t=O_;break;case T_:t=M_;break;case L_:t=R_;break;case O_:t=A_}if(i)switch(t){case C_:t=P_;break;case R_:t=A_;break;case L_:t=O_;break;case P_:t=C_;break;case A_:t=R_;break;case O_:t=L_}return t}},F_={};function z_(t,e){const{enterPoint:i}=t;if(!i||!t.editor.editing||!t.visible)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:s,flippedX:o,flippedY:n}=t;const{pointType:a}=i,{resizeCursor:h,rotateCursor:l,skewCursor:d,resizeable:c,rotateable:u,skewable:_}=t.mergeConfig;let p=a.includes("resize");p&&u&&(e.metaKey||e.ctrlKey||!c)&&(p=!1);const g=_&&!p&&("resize-line"===i.name||"skew"===a)?d:p?h:l;s+=45*(W_.getFlipDirection(i.direction,o,n)+1),s=2*Math.round(r.formatRotation(s,!0)/2);const{url:f,x:y,y:m}=g,v=f+s;F_[v]?i.cursor=F_[v]:F_[v]=i.cursor={url:Y_(f,s),x:y,y:m}}function N_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.rect.cursor=i?e:void 0}function Y_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class H_ extends Qh{constructor(t){super(t),this.useFastShadow=!0}}const X_=["top","right","bottom","left"],V_=void 0;class j_ extends Hh{get mergeConfig(){const{config:t}=this,{mergeConfig:e}=this.editor;return this.mergedConfig=t?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}constructor(t){super(),this.view=new Hh,this.rect=new Qh({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new H_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Hh({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new H_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new H_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new H_({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:n}=this,{stroke:r,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;for(let t=0;t<8;t++)d=n[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),t%2||(d.rotation=t/2*90);o.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:V_},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),N_(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.set({x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:o,circle:n,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{middlePoint:d,resizeable:c,rotateable:u,hideOnSmall:_,editBox:p,mask:g}=i;if(this.visible=!this.target.locked,e.visible=!!g||0,this.view.worldOpacity){const{width:e,height:g}=t,f="number"==typeof _?_:10,y=p&&!(_&&e<f&&g<f);let m,v,w,x={};for(let s=0;s<8;s++)U.toPoint(U.directionData[s],t,x),v=a[s],m=h[s],w=l[Math.floor(s/2)],v.set(x),m.set(x),w.set(x),v.visible=w.visible=y&&!(!c&&!u),m.visible=y&&u&&c&&!i.rotatePoint,s%2&&(v.visible=m.visible=y&&!!d,(s+1)/2%2?(w.width=e,_&&2*v.width>e&&(v.visible=!1)):(w.height=g,v.rotation=90,_&&2*v.width>g&&(v.visible=!1)));n.visible=y&&u&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||p})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=X_.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=X_.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?W_.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}unload(){this.visible=!1}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:V_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return t instanceof Array?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return t instanceof Array?t:t?[t]:this.getPointsStyle()}onSelect(t){1===t.oldList.length&&(t.oldList[0].syncEventer=null,this.app&&(this.app.interaction.bottomList=null))}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:o}=this,{target:n}=this;"rect"===e.name&&(this.moving=!0,s.opacity=this.mergeConfig.hideOnMove?0:1),o.x=t.x,o.y=t.y,o.point={x:n.x,y:n.y},o.bounds=Object.assign({},n.getLayoutBounds("box","local")),o.rotation=n.rotation,i&&i.includes("resize")&&(hr.resizingKeys=s.leafList.keys)}onDragEnd(t){this.dragging=!1,this.dragPoint=null,this.moving=!1;const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(hr.resizingKeys=null)}onDrag(t){const{transformTool:e}=this,i=t.current;if("rect"===i.name)e.onMove(t),N_(this);else{const{pointType:s}=this.enterPoint=i;s.includes("rotate")||t.metaKey||t.ctrlKey||!this.mergeConfig.resizeable?(e.onRotate(t),"resize-rotate"===s&&e.onScale(t)):"resize"===s&&e.onScale(t),"skew"===s&&e.onSkew(t),z_(this,t)}}onKey(t){z_(this,t)}onArrow(t){const{editor:e}=this;if(e.editing&&this.mergeConfig.keyEvent){let i=0,s=0;const o=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=o;break;case"ArrowUp":s=-o;break;case"ArrowLeft":i=-o;break;case"ArrowRight":i=o}(i||s)&&e.move(i,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find((t=>t.editable&&t instanceof Wl))||t.find((t=>t instanceof Wl));if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e;const s=[[Zl.START,this.onDragStart,this],[Zl.DRAG,this.onDrag,this],[Zl.END,this.onDragEnd,this],[jl.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&s.push([jl.ENTER,e=>{this.enterPoint=t,z_(this,e)}]),this.__eventIds.push(t.on_(s))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(e.on_(c_.SELECT,this.onSelect,this),t.on_([[Zl.START,this.onDragStart,this],[Zl.DRAG,this.onDrag,this],[Zl.END,this.onDragEnd,this],[jl.ENTER,()=>N_(this)],[jl.DOUBLE_TAP,this.onDoubleTap,this],[jl.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer((()=>{i.push(e.app.on_([[[ed.HOLD,ed.UP],this.onKey,this],[ed.DOWN,this.onArrow,this]]))}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const U_={x:0,y:0,width:1e5,height:1e5};class G_ extends Yh{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,U_),Object.assign(this.__world,U_)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach((i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)})),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const Z_='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',K_={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${Z_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${Z_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${Z_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},q_=new ft;function J_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange((()=>{q_.setListWithFn(i,(t=>t.getBounds("box","page"))),0===q_.width&&(q_.width=.1),0===q_.height&&(q_.height=.1),e.reset(q_.get())})),s.add(e)}const $_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Q_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),tp={group(t,e,i){t.sort(Q_);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Hh(i),o.addAt(n,o.children.indexOf(t[0])),t.sort($_);const r=new z(e.worldTransform);return r.divideParent(o.worldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach((t=>t.dropTo(n))),s.unlockLayout(),n},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach((t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)})),e.unlockLayout(),i},toTop(t){t.sort($_),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(Q_),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},ep=xt.get("EditToolCreator");function ip(){return t=>{op.register(t)}}const sp=ip,op={list:{},register(t){const{tag:e}=t.prototype;np[e]&&ep.repeat(e),np[e]=t},get:(t,e)=>new np[t](e)},{list:np}=op;class rp extends c_{constructor(t,e){super(t,e)}}rp.BEFORE_OPEN="innerEditor.before_open",rp.OPEN="innerEditor.open",rp.BEFORE_CLOSE="innerEditor.before_close",rp.CLOSE="innerEditor.close";class ap extends c_{constructor(t,e){super(t,e)}}ap.BEFORE_GROUP="editor.before_group",ap.GROUP="editor.group",ap.BEFORE_UNGROUP="editor.before_ungroup",ap.UNGROUP="editor.ungroup",ap.BEFORE_OPEN="editor.before_open_group",ap.OPEN="editor.open_group",ap.BEFORE_CLOSE="editor.before_close_group",ap.CLOSE="editor.close_group";const{updateMatrix:hp}=Rn,lp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},dp="top-left";class cp extends Uh{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(tr.CHANGE,(e=>{if(this.checkChange&&lp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,hp(this.parent),hp(this);const a=new z(this.__world);switch(r[i]=s,this.__layout.rotationChange(),hp(this),this.changedTransform=new z(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(dp,n);break;case"scaleX":t.scaleOf(dp,n,1);break;case"scaleY":t.scaleOf(dp,1,n);break;case"skewX":t.skewOf(dp,n,0);break;case"skewY":t.skewOf(dp,0,n)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class up extends c_{constructor(t,e){super(t,e)}}up.BEFORE_MOVE="editor.before_move",up.MOVE="editor.move";class _p extends c_{constructor(t,e){super(t,e)}}_p.BEFORE_SCALE="editor.before_scale",_p.SCALE="editor.scale";class pp extends c_{constructor(t,e){super(t,e)}}pp.BEFORE_ROTATE="editor.before_rotate",pp.ROTATE="editor.rotate";class gp extends c_{constructor(t,e){super(t,e)}}gp.BEFORE_SKEW="editor.before_skew",gp.SKEW="editor.skew";class fp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;if(t instanceof Jl){if("drag"!==t.moveType){const{moveable:s,resizeable:o}=i,n=t.getLocalMove(e);"move"===s?(t.stop(),this.move(n.x,n.y)):"zoom"===o&&t.stop()}}else{const i={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),this.move(Zl.getValidMove(e,s.point,i))}}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let{around:n,lockRatio:r,resizeable:a,flipable:h,editSize:l}=i;if(t instanceof td)"zoom"===a&&(t.stop(),this.scaleOf(e.getBoxPoint(t),t.scale,t.scale));else{const{direction:i}=t.current;(t.shiftKey||e.lockRatio)&&(r=!0);const a=W_.getScaleData(e,o.bounds,i,t.getInnerTotal(e),r,W_.getAround(n,t.altKey),h,!s||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(a.drag=t,this.scaleWithDrag(a)):this.scaleOf(a.origin,a.scaleX,a.scaleY)}}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{skewable:o,rotateable:n,around:a,rotateGap:h}=i,{direction:l,name:d}=t.current;if(o&&"resize-line"===d)return this.onSkew(t);let c,u;if(t instanceof $l){if("rotate"!==n)return;t.stop(),u=t.rotation,c=e.getBoxPoint(t),e.scaleX*e.scaleY<0&&(u=-u)}else{const i=W_.getRotateData(e,l,t,s,t.shiftKey?null:e.around||e.origin||a||"center");u=i.rotation,c=i.origin}e.scaleX*e.scaleY<0&&(u=-u),t instanceof Zl&&(u=s.rotation+u-e.rotation),u=r.float(r.getGapRotation(u,h,e.rotation),2),u&&this.rotateOf(c,u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=W_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),W_.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;"object"==typeof t&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if("object"==typeof s)t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange((()=>i.move(t,e)));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new up(up.BEFORE_MOVE,h));const l=new up(up.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new _p(_p.BEFORE_SCALE,t));const n=new _p(_p.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if("object"==typeof s)e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform((()=>o.safeChange((()=>o.scaleOf(t,e,i))))),c={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new _p(_p.BEFORE_SCALE,c));const u=new _p(_p.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new z(Rn.getFlipTransform(e,t)):this.getChangedTransform((()=>e.safeChange((()=>e.flip(t))))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new _p(_p.BEFORE_SCALE,r));const a=new _p(_p.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if("number"==typeof s)e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!o&&this.getChangedTransform((()=>i.safeChange((()=>i.rotateOf(t,e))))),l={target:i,editor:n,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new pp(pp.BEFORE_ROTATE,l));const d=new pp(pp.ROTATE,l);this.doRotate(d),this.emitEvent(d)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if("object"==typeof s)e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform((()=>o.safeChange((()=>o.skewOf(t,e,i))))),c={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new gp(gp.BEFORE_SKEW,c));const u=new gp(gp.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(Rn.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new z(e.worldTransform);return t(),new z(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let yp=class extends Hh{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragging(){return this.editBox.dragging}get moving(){return this.editBox.moving}get dragPoint(){return this.editBox.dragPoint}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}constructor(t,e){super(e),this.leafList=new Ra,this.openedGroupList=new Ra,this.simulateTarget=new cp(this),this.editBox=new j_(this),this.editToolList={},this.selector=new S_(this),this.editMask=new G_(this),this.targetEventIds=[];let i=Wt.clone(K_);t&&(i=Wt.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Ct.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&J_(this),this.update()}updateEditTool(){let t=this.editTool;if(t&&(this.editBox.unload(),t.unload(),this.editTool=null),this.editing){const e=this.element.editOuter||"EditTool";t=this.editTool=this.editToolList[e]=this.editToolList[e]||op.get(e,this),this.editBox.load(),t.load(),this.update()}}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(ap.BEFORE_GROUP),this.target=tp.group(this.list,this.element,t),this.emitGroupEvent(ap.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(ap.BEFORE_UNGROUP,t))),this.target=tp.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(ap.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(ap.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(ap.OPEN,t)}closeGroup(t){this.emitGroupEvent(ap.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(ap.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Rn.hasParent(e,t)))&&e.push(t)))),e.forEach((t=>this.closeGroup(t)))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new ap(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e){if(t&&e&&(this.target=t),this.single){const e=t||this.element,i=e.editInner;i&&op.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||op.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(rp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(rp.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(rp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(rp.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new rp(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach((t=>t.locked=!0)),this.update()}unlock(){this.list.forEach((t=>t.locked=!1)),this.update()}toTop(){this.list.length&&(tp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(tp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some((t=>t!==this.leafer&&t.renderer.changed)))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editMask:i}=this;this.targetEventIds=[e.on_(cr.START,this.onRenderStart,this),t.on_([[cr.CHILD_START,this.onAppRenderStart,this],[Jl.BEFORE_MOVE,this.onMove,this,!0],[td.BEFORE_ZOOM,this.onScale,this,!0],[$l.BEFORE_ROTATE,this.onRotate,this,!0]])],i.visible&&i.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach((t=>t.destroy())),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};Vt([(t,e)=>{Co(t,e,{get(){const{config:t,element:e,dragPoint:i}=this,s=Object.assign({},t);return e&&e.editConfig&&Object.assign(s,e.editConfig),i&&(i.editConfig&&Object.assign(s,i.editConfig),"font-size"===s.editSize&&(s.lockRatio=!0),"resize-rotate"===i.pointType&&(s.around||(s.around="center"),Ht(s.lockRatio)&&(s.lockRatio=!0))),this.mergedConfig=s}})}],yp.prototype,"mergeConfig",void 0),Vt([u_((function(t,e){t.emitEvent(new c_(c_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],yp.prototype,"hoverTarget",void 0),Vt([u_((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ra?i:new Ra(i),t.multiple&&J_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor();const s={editor:t,value:i,oldValue:e};t.emitEvent(new c_(c_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{t.updateEditTool(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new c_(c_.AFTER_SELECT,s))}))],yp.prototype,"target",void 0),yp=Vt([_n(fp,["editBox","editTool","emitEvent"])],yp);class mp{static registerInnerEditor(){op.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Hh,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let vp=class extends mp{static registerEditTool(){op.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach((t=>{t.moveWorld(e,i)})),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach((t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)})),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach((t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)})),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach((t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,e,i,r)})),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};vp=Vt([ip()],vp);const{left:wp,right:xp}=V,{move:bp,copy:kp,toNumberPoints:Ep}=P;let Bp=class extends vp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===wp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=Ep(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(bp(t,n,r),s&&bp(e,-n,-r)):(s&&bp(t,-n,-r),bp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),kp(s[7],i),kp(e[7],i),kp(s[3],a),kp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===wp||t===xp,s[t].visible=a,e[t].visible=!r&&a}};Bp=Vt([ip()],Bp);const{M:Sp,L:Rp,C:Cp,Q:Lp,Z:Tp,N:Op,D:Pp,X:Ap,G:Mp,F:Dp,O:Ip,P:Wp,U:Fp}=ne,zp={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case Sp:case Rp:Np(t,e,i,o,1),o+=3;break;case Cp:Np(t,e,i,o,3),o+=7;break;case Lp:Np(t,e,i,o,2),o+=5;break;case Tp:o+=1;break;case Op:Np(t,e,i,o,2),o+=5;break;case Pp:Np(t,e,i,o,2),o+=9;break;case Ap:Np(t,e,i,o,2),o+=6;break;case Mp:Np(t,e,i,o,2),o+=9;break;case Dp:Np(t,e,i,o,2),o+=5;break;case Ip:t[o]=Mp,t.splice(o+4,0,t[o+3],0),Np(t,e,i,o,2),o+=9,n+=2;break;case Wp:t[o]=Dp,t.splice(o+4,0,t[o+3]),Np(t,e,i,o,2),o+=5,n+=1;break;case Fp:Np(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:Np}=zp,Yp=x.get(),{topLeft:Hp,top:Xp,topRight:Vp,right:jp,bottom:Up,left:Gp}=V;function Zp(t,e,i){t.pathInputed?Kp(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Kp(t,e,i){zp.scale(t.__.path,e,i),t.path=t.__.path}function qp(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):zp.scalePoints(s,e,i),t.points=s}function Jp(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Yp.a=e,Yp.d=i,s[t].transform(Yp,!0)}const $p=fa.prototype;function Qp(t,e,i){tg(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Jl.BEFORE_MOVE,(e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY))})),t.on_(td.BEFORE_ZOOM,(e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)})))}function tg(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&Wt.assign(i,e),Wt.assign(t.config,i,t.userConfig)}$p.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},$p.__scaleResize=function(t,e){Zp(this,t,e)},$p.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},$p.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Wl.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint,{__autoWidth:r,__autoHeight:a,textAlign:h,verticalAlign:l}=this.__,{boxBounds:d}=this.__layout;r&&"left"!==h&&1!==t&&(this.x+=d.x),a&&"top"!==l&&1!==e&&(this.y+=d.y),this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize?function(t,e,i,s){let o=e;if(void 0!==s){const n=t.__layout;let{width:r,height:a}=n.boxBounds;switch(r*=i-e,a*=e-i,s){case Xp:case Up:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Gp:case jp:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Hp:case Vp:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const n=t.__,{padding:r}=n;r&&(t.padding=r instanceof Array?r.map((t=>t*o)):r*o),n.__autoWidth||(t.width*=o),n.__autoHeight||(t.height*=o)}(this,t,e,n&&n.direction):Zp(this,t,e)},Fl.prototype.__scaleResize=function(t,e){Kp(this,t,e)},_l.prototype.__scaleResize=function(t,e){this.pathInputed?Kp(this,t,e):this.points?qp(this,t,e):this.width*=t},bl.prototype.__scaleResize=function(t,e){this.pathInputed?Kp(this,t,e):this.points?qp(this,t,e):Zp(this,t,e)},Hh.prototype.__scaleResize=function(t,e){Jp(this,t,e)},Qh.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Zp(this,t,e),i&&Jp(this,t,e)},Ct.add("resize"),Ct.add("editor","resize"),Lt.editor=function(t,e){const i=new yp(t);return e&&e.sky.add(e.editor=i),i},Qh.addAttr("textBox",!1,Ao),Yh.addAttr("editConfig",void 0,Ao),Yh.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),Ao),Yh.addAttr("editInner","PathEditor",Ao),Hh.addAttr("editInner","",Ao),Wl.addAttr("editInner","TextEditor",Ao),Yh.setEditConfig=function(t){this.changeAttr("editConfig",t)},Yh.setEditOuter=function(t){this.changeAttr("editOuter",t)},Yh.setEditInner=function(t){this.changeAttr("editInner",t)};const eg=xt.get("LeaferTypeCreator"),ig={list:{},register(t,e){sg[t]&&eg.repeat(t),sg[t]=e},run(t,e){const i=sg[t];i&&i(e)}},{list:sg,register:og}=ig;og("viewport",Qp),og("custom",(function(t){Qp(t,null,!0)})),og("design",(function(t){Qp(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),og("document",(function(t){Qp(t,{zoom:{min:1},move:{scroll:"limit"}})}));const ng={getData(t){const e=t[0],i=t[1],s=P.getCenter(e.from,i.from),o=P.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=P.getDistance(e.from,i.from);return{move:n,scale:P.getDistance(e.to,i.to)/r,rotation:P.getRotation(e.from,i.from,e.to,i.to),center:o}}},rg={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;return t.shiftKey&&!s&&(s=o,o=0),s>50&&(s=Math.max(50,s/3)),o>50&&(o=Math.max(50,o/3)),{x:-s*i*2,y:-o*i*2}},getScale(e,i){let s,o=1,{zoomMode:n,zoomSpeed:a}=i;const h=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){a=r.within(a,0,1);o=1-h/(4*(e.deltaY?i.delta.y:i.delta.x))*a,o<.5&&(o=.5),o>=1.5&&(o=1.5)}return o}};class ag{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Jl.START,this.moveData)),t.path=this.moveData.path,e.emit(Jl.BEFORE_MOVE,t),e.emit(Jl.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(td.START,this.zoomData)),t.path=this.zoomData.path,e.emit(td.BEFORE_ZOOM,t),e.emit(td.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit($l.START,this.rotateData)),t.path=this.rotateData.path,e.emit($l.BEFORE_ROTATE,t),e.emit($l.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Jl.END,e),i&&t.emit(td.END,i),s&&t.emit($l.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const hg=jh.prototype,lg=new ft;function dg(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function cg(t,e){return Object.assign(Object.assign({},e),{scale:t})}hg.initType=function(t){ig.run(t,this)},hg.getValidMove=function(t,e){const{scroll:i,disabled:s}=this.app.config.move;if(i){const s=!0===i?"":i;if(s.includes("x")?(t=t||e,e=0):s.includes("y")?(e=e||t,t=0):Math.abs(t)>Math.abs(e)?e=0:t=0,s.includes("limit")){const{x:i,y:s,width:o,height:n}=lg.set(this.__world).addPoint(this.zoomLayer),r=i+o-this.width,a=s+n-this.height;i>=0&&r<=0?t=0:t>0?i+t>0&&(t=-i):t<0&&r+t<0&&(t=-r),s>=0&&a<=0?e=0:e>0?s+e>0&&(e=-s):e<0&&a+e<0&&(e=-a)}}return{x:s?0:t,y:s?0:e}},hg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const ug=md.prototype;ug.createTransformer=function(){this.transformer=new ag(this)},ug.move=function(t){this.transformer.move(t)},ug.zoom=function(t){this.transformer.zoom(t)},ug.rotate=function(t){this.transformer.rotate(t)},ug.transformEnd=function(){this.transformer.transformEnd()},ug.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):rg.getScale(t,e);if(1!==n)this.zoom(cg(n,t));else{const s=e.getMove?e.getMove(t,e):rg.getMove(t,e);i.snap&&P.round(s),this.move(dg(s,t))}},ug.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:o,center:n}=ng.getData(e);Object.assign(t,n),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(cg(o,t)),this.move(dg(i,t))};const _g=hd.prototype,{abs:pg}=Math;function gg(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}_g.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=pg(i),n=pg(s),r=e?1:.1,a=this.interaction.m.dragAnimate&&this.canAnimate&&this.moving&&(o>r||n>r);if(a){const r="touch"===t.pointerType?3:1,a=70;o*(e=e?.95:r)>a?e=a/o:n*e>a&&(e=a/n),t=Object.assign({},t),P.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},_g.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},_g.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},_g.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=ut.maxX(r),d=ut.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let _=0,p=0;this.autoMoveTimer=setInterval((()=>{_+=c,p+=u,P.move(i,c,u),P.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)}),10)},_g.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Ct.add("viewport"),Ct.add("view"),jh.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),"object"!=typeof e||e instanceof Array?o=e:(o=e.padding,i=e.scroll,s=e.transition);const{zoomLayer:n}=this,r=this.canvas.bounds.clone().shrink(void 0!==o?o:30),a=new ft,h={x:r.x+r.width/2,y:r.y+r.height/2};let l;const{x:d,y:c,scaleX:u,scaleY:_}=n.__;if("string"==typeof t)switch(t){case"in":l=gg(u,"in");break;case"out":l=gg(u,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new ft(this.boxBounds)).height=0;break;case"fit-height":(t=new ft(this.boxBounds)).width=0}else"number"==typeof t&&(l=t/u);if(l)l=this.getValidScale(l),n.scaleOfWorld(h,l,l,!1,s);else if("object"==typeof t){const e={x:d,y:c,scaleX:u,scaleY:_},o=t instanceof Array;if(o||t.tag){const e=o?t:[t];a.setListWithFn(e,Dn.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,r);a.set(n.getWorldBounds(e))}const{width:h,height:p}=a;let g=r.x-a.x,f=r.y-a.y;return i?(g+=Math.max((r.width-h)/2,0),f+=Math.max((r.height-p)/2,0)):(l=this.getValidScale(Math.min(r.width/h,r.height/p)),g+=(r.width-h*l)/2,f+=(r.height-p*l)/2,P.scaleOf(e,a,l),a.scaleOf(a,l),e.scaleX*=l,e.scaleY*=l),"x"===i?f=0:"y"===i&&(g=0),P.move(e,g,f),a.move(g,f),n.set(e,s),a}return n.worldBoxBounds};class fg extends Hh{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&Wt.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;"string"==typeof t?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Qh,this.scrollYBar=new Qh),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new ft(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,_=l<1,{scrollXBar:p,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,_?g.width+6:2,u?p.height+6:2,2]);p.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Zl.DRAG,this.onDrag,this),e.on_(Zl.DRAG,this.onDrag,this),t.on_(Zl.END,this.onDragEnd,this),e.on_(Zl.END,this.onDragEnd,this),this.target.on_(cr.BEFORE,(()=>this.update(!0))),this.target.leafer.on_(hr.RESIZE,(()=>this.update()))]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Ct.add("scroll");class yg extends Eh{}function mg(t){return To(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,Vo(this)}}})))}let vg=class extends _l{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};Vt([on(yg)],vg.prototype,"__",void 0),Vt([mg("angle")],vg.prototype,"endArrow",void 0),vg=Vt([pn()],vg);const{M:wg,L:xg,C:bg,Q:kg,O:Eg}=ne,{rotate:Bg,copyFrom:Sg,scale:Rg}=P,Cg={},Lg={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case wg:case xg:Tg(t,l+1,e,i,s,o,n,r),l+=3;break;case bg:for(h=1;h<6;h+=2)Tg(t,l+h,e,i,s,o,n,r);l+=7;break;case kg:for(h=1;h<4;h+=2)Tg(t,l+h,e,i,s,o,n,r);l+=5;break;case Eg:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){Lg.layout(t,0,0,1,1,e,i)}};function Tg(t,e,i,s,o,n,r,a){Sg(Cg,t[e],t[e+1]),r&&Bg(Cg,r,a),o&&Rg(Cg,o,n),t[e]=i+Cg.x,t[e+1]=s+Cg.y}const{layout:Og,rotate:Pg}=Lg,{getAngle:Ag}=P,Mg={x:-.5},Dg={connect:Mg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Ig={connect:Mg,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Wg={connect:Mg,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},Fg={connect:Mg,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},zg={offset:Mg,path:[...Wg.path],dashPath:[1,-2.5,0,2,-1,0]};Pg(zg.path,180,{x:-1.5,y:0});const Ng={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Yg={connect:{x:.5},path:[...Ng.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Hg={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},Xg={path:[...Hg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Vg=Wt.clone(Hg),jg=Wt.clone(Xg);Pg(Vg.path,45),Pg(jg.path,45);const Ug={angle:Dg,"angle-side":Ig,arrow:Fg,triangle:Wg,"triangle-flip":zg,circle:Yg,"circle-line":Ng,square:Xg,"square-line":Hg,diamond:jg,"diamond-line":Vg,mark:{offset:Mg,path:[1,0,-2,2,0,2]}};function Gg(t,e,i,s,o,n,r){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}="object"==typeof e?e:Ug[e];let _=d?d.x:0,p=l?l.x:0;const g=[...c];return r&&u&&g.push(...u),"none"!==a&&(_-=.5),l&&("round"===h&&l.roundJoin?p+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(p+=l.bevelJoin)),p&&Og(g,p,0),Og(g,s.x,s.y,o,o,Ag(i,s)),n.x=(_+p)*o,g}const{M:Zg,L:Kg,C:qg,Q:Jg,Z:$g,N:Qg,D:tf,X:ef,G:sf,F:of,O:nf,P:rf,U:af}=ne,{copy:hf,copyFrom:lf,getDistancePoint:df}=P,cf={},uf={},_f={},pf={},gf={},ff={list:Ug,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:o,dashPattern:n,__pathForRender:r}=t.__;let a,h=0,l=r.length,d=0,c=i&&"none"!==i;for(;h<l;){switch(a=r[h],a){case Zg:case Kg:(d<2||h+6>=l)&&(lf(gf,r[h+1],r[h+2]),!d&&c&&hf(uf,gf)),h+=3;break;case qg:1!==d&&h+7!==l||yf(r,pf,gf,h+3),h+=7;break;case Jg:1!==d&&h+5!==l||yf(r,pf,gf,h+1),h+=5;break;case $g:return;case Qg:h+=5;break;case tf:h+=9;break;case ef:h+=6;break;case sf:h+=9;break;case of:h+=5;break;case nf:h+=7;break;case rf:h+=4;break;case af:1!==d&&h+6!==l||yf(r,pf,gf,h+1),h+=6}if(d++,1===d&&a!==Zg)return;if(2===d&&c&&hf(_f,a===Kg?gf:pf),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=Gg(t,i,_f,uf,o,cf,!!n);n?d.push(...e):l.push(...e),cf.x&&(df(uf,_f,-cf.x,!0),l[1]=_f.x,l[2]=_f.y)}if(s&&"none"!==s){const e=Gg(t,s,pf,gf,o,cf,!!n);if(n?d.push(...e):l.push(...e),cf.x){let t;switch(df(gf,pf,-cf.x,!0),a){case Kg:t=h-3+1;break;case qg:t=h-7+5;break;case Jg:t=h-5+3;break;case af:t=h-6+3}t&&mf(l,pf,t)}}}else hf(pf,gf)}}};function yf(t,e,i,s){lf(e,t[s],t[s+1]),lf(i,t[s+2],t[s+3])}function mf(t,e,i){t[i]=e.x,t[i+1]=e.y}Ct.add("arrow"),Yh.addAttr("startArrow","none",mg),Yh.addAttr("endArrow","none",mg),Object.assign(sh,ff),Object.assign(oh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:vf,NoAndSkip:wf,YesAndSkip:xf}=Nt,bf={},kf={},Ef={};class Bf{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":bf.id=t.substring(1),t=bf;break;case".":kf.className=t.substring(1),t=kf;break;default:Ef.tag=t,t=Ef}case"object":if(void 0!==t.id){const s=this.getById(t.id,e);return i?s:s?[s]:[]}if(t.tag){const{tag:s}=t,o=s instanceof Array;return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?Wt.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className);case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Rn.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===vf||n===xf){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<wf&&this.eachFind(o.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Qn.REMOVE,this.__onRemoveChild,this),this.target.on_(tr.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Sf=Yh.prototype;function Rf(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Lt.selector())}Sf.find=function(t,e){return Rf(this).getBy(t,this,!1,e)},Sf.findOne=function(t,e){return Rf(this).getBy(t,this,!0,e)},Ct.add("find"),Lt.finder=function(t){return new Bf(t)};const{setPoint:Cf,addPoint:Lf,toBounds:Tf}=Y;const Of={syncExport(e,i,s){let o;this.running=!0;const n=go.fileType(i),a=i.includes(".");s=go.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===n)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),o={data:!!a||e.toJSON(s.json)};else if("svg"===n)a&&l(h(e.toSVG(),"svg"),i),o={data:!!a||e.toSVG()};else{let t,n,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=e,{slice:_,clip:p,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=void 0===s.smooth?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&void 0===s.fill?e.fill:s.fill,b=go.isOpaqueImage(i)||x,k=new z;if(f)t=!0===f?d?c.canvas.bounds:e.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":k.set(l);break;case"local":k.set(l).divide(e.localTransform),a/=e.scaleX,h/=e.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||e;default:k.set(l).divide(e.getTransform(i));const t=i.worldTransform;a/=a/t.scaleX,h/=h/t.scaleY}t=e.getBounds("render",i)}const E={scaleX:1,scaleY:1};r.getScaleData(s.scale,s.size,t,E);let B=s.pixelRatio||1,{x:S,y:R,width:C,height:L}=new ft(t).scale(E.scaleX,E.scaleY);p&&(S+=p.x,R+=p.y,C=p.width,L=p.height);const T={exporting:!0,matrix:k.scale(1/E.scaleX,1/E.scaleY).invert().translate(-S,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let O,P=Lt.canvas({width:Math.floor(C),height:Math.floor(L),pixelRatio:B,smooth:v,contextSettings:w});if(_&&(O=e,O.__worldOpacity=0,e=c||e,T.bounds=P.bounds),P.save(),u&&void 0!==x){const t=e.get("fill");e.fill="",e.__render(P,T),e.fill=t}else e.__render(P,T);if(P.restore(),O&&O.__updateWorldOpacity(),g){n=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?Lf(r,o,n):Cf(r={},o,n)),a++;const h=new ft;return Tf(r,h),h.scale(1/t.pixelRatio).ceil()}(P);const t=P,{width:e,height:i}=n,s={x:0,y:0,width:e,height:i,pixelRatio:B};P=Lt.canvas(s),P.copyWorld(t,n,s)}if(y){const[t,e,i,s]=r.fourNumber(y),o=P,{width:n,height:a}=o;P=Lt.canvas({width:n+s+e,height:a+t+i,pixelRatio:B}),P.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:a})}b&&P.fillWorld(P.bounds,x||"#FFFFFF","destination-over"),m&&m(P);o={data:"canvas"===i?P:P.export(i,s),width:P.pixelWidth,height:P.pixelHeight,renderBounds:t,trimBounds:n}}return this.running=!1,o},export(e,i,s){return this.running=!0,function(t){Pf||(Pf=new vo);return new Promise((e=>{Pf.add((()=>jt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((o=>new Promise((n=>{const r=()=>jt(this,void 0,void 0,(function*(){if(!xo.isComplete)return t.requestRender(r);const a=Of.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()}));e.updateLayout(),Af(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))))}};let Pf;function Af(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>Af(t)))}const Mf=ie.prototype,Df=xt.get("@leafer-in/export");Mf.export=function(t,e){const{quality:i,blob:s}=go.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Mf.toBlob=function(e,i){return new Promise((s=>{t.origin.canvasToBolb(this.view,e,i).then((t=>{s(t)})).catch((t=>{Df.error(t),s(null)}))}))},Mf.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Mf.saveAs=function(e,i){return new Promise((s=>{t.origin.canvasSaveAs(this.view,e,i).then((()=>{s(!0)})).catch((t=>{Df.error(t),s(!1)}))}))},Ct.add("export"),Object.assign(lh,Of),Yh.prototype.export=function(t,e){return lh.export(this,t,e)},Yh.prototype.syncExport=function(t,e){return lh.syncExport(this,t,e)};const If={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Wf={top:"flex-start",middle:"center",bottom:"flex-end"},Ff={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function zf(t,e,i){const{style:s}=t,{fill:o,padding:n,textWrap:r,textOverflow:a,textDecoration:h}=e;let l;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";e instanceof Array&&(e=e[0]);if("object"==typeof e)switch(e.type){case"solid":i=eh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=eh.string("string"==typeof t?t:t.color);break;default:void 0!==e.r&&(i=eh.string(e))}else i=e;t.color=i}(s,o),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,"object"==typeof h?(l=h.type,h.color&&(s.textDecorationColor=eh.string(h.color))):l=h,s.textDecoration=Ff[l],s.textTransform=If[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Wf[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===r||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===r?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=n instanceof Array?n.map((t=>t*i+"px")).join(" "):(n||0)*i+"px",s.textOverflow="show"===a?"":"hide"===a?"clip":a}let Nf=class extends mp{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof Wl),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div"),{style:o}=s;s.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:n}=t.app;(this.inBody=n instanceof HTMLCanvasElement)?document.body.appendChild(s):n.appendChild(s),this.eventIds=[t.app.on_(jl.DOWN,(e=>{let i,{target:o}=e.origin;for(;o;)o===s&&(i=!0),o=o.parentElement;i||t.closeInnerEditor()}))],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];a.setStartAfter(t),a.setEndAfter(t),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const o=s.getRangeAt(0);o.deleteContents();const n=i.split("\n"),r=document.createDocumentFragment();n.forEach(((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))})),o.insertNode(r),o.collapse(!1),s.removeAllRanges(),s.addRange(o),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,o=0,n=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth&&(i+=20,r.autoSizeAlign))switch(r.textAlign){case"center":o=-i/2;break;case"right":o=-i}if(r.__autoHeight&&(s+=20,r.autoSizeAlign))switch(r.verticalAlign){case"middle":n=-s/2;break;case"bottom":n=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:_,f:p}=new z(t.worldTransform).scale(1/e).translateInner(o,n),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${_},${p})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||zf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};Nf=Vt([sp()],Nf),Ct.add("text-editor","editor");class Yf extends Ah{setText(t){this._text=t,this.__htmlChanged=!0}}let Hf=class extends Tl{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:o}=e.getBoundingClientRect(),n=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${o}">\n <foreignObject width="${n}" height="${o}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=n/t.pixelRatio,t.__naturalHeight=o/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}};Vt([on(Yf)],Hf.prototype,"__",void 0),Vt([Fo("")],Hf.prototype,"text",void 0),Vt([Ao("TextEditor")],Hf.prototype,"editInner",void 0),Vt([Go(!1)],Hf.prototype,"textEditing",void 0),Hf=Vt([pn()],Hf),Ct.add("html");export{K as AlignHelper,Nt as Answer,Nl as App,U as AroundHelper,vg as Arrow,yg as ArrowData,mt as AutoBounds,Oe as BezierHelper,ft as Bounds,ir as BoundsEvent,ut as BoundsHelper,Qh as Box,xh as BoxData,Sa as Branch,Wn as BranchHelper,Ur as BranchRender,Pl as Canvas,Mh as CanvasData,It as CanvasManager,Qn as ChildEvent,eh as ColorConvert,Lt as Creator,vd as Cursor,Wt as DataHelper,xt as Debug,X as Direction4,V as Direction9,Zl as DragEvent,hd as Dragger,ql as DropEvent,j_ as EditBox,W_ as EditDataHelper,H_ as EditPoint,S_ as EditSelect,b_ as EditSelectHelper,vp as EditTool,op as EditToolCreator,yp as Editor,c_ as EditorEvent,ap as EditorGroupEvent,tp as EditorHelper,up as EditorMoveEvent,pp as EditorRotateEvent,_p as EditorScaleEvent,gp as EditorSkewEvent,ah as Effect,ol as Ellipse,Sh as EllipseData,Ne as EllipseHelper,$n as Event,Mt as EventCreator,pr as Eventer,lh as Export,go as FileHelper,hh as Filter,Bf as Finder,tl as Frame,kh as FrameData,Hh as Group,wh as GroupData,Hf as HTMLText,Yf as HTMLTextData,wd as HitCanvasManager,Tl as Image,Ah as ImageData,er as ImageEvent,ko as ImageManager,e as IncrementId,mp as InnerEditor,rp as InnerEditorEvent,md as InteractionBase,id as InteractionHelper,ed as KeyEvent,Hl as Keyboard,dr as LayoutEvent,ja as Layouter,fa as Leaf,Xr as LeafBounds,Dn as LeafBoundsHelper,zt as LeafData,Cr as LeafDataProxy,Br as LeafEventer,Rn as LeafHelper,Jn as LeafLayout,Ca as LeafLevelList,Ra as LeafList,Dr as LeafMatrix,Vr as LeafRender,jh as Leafer,Ta as LeaferCanvas,ie as LeaferCanvasBase,bh as LeaferData,ur as LeaferEvent,Ro as LeaferImage,ig as LeaferTypeCreator,_l as Line,Eh as LineData,Bp as LineEditTool,r as MathHelper,z as Matrix,x as MatrixHelper,Jl as MoveEvent,ng as MultiTouchHelper,Kl as MyDragEvent,Ol as MyImage,Ul as MyPointerEvent,ae as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,oh as Paint,rh as PaintGradient,nh as PaintImage,Fl as Path,sh as PathArrow,ff as PathArrowModule,so as PathBounds,Gi as PathCommandDataHelper,ne as PathCommandMap,Ei as PathConvert,co as PathCorner,ds as PathCreator,Lh as PathData,Bs as PathDrawer,se as PathHelper,Lg as PathMatrixHelper,ce as PathNumberCommandLengthMap,de as PathNumberCommandMap,zl as Pen,Th as PenData,Ka as Picker,t as Platform,Ct as Plugin,W as Point,P as PointHelper,Xl as PointerButton,jl as PointerEvent,bl as Polygon,Rh as PolygonData,tr as PropertyEvent,Uh as Rect,Bh as RectData,ue as RectHelper,zh as RectRender,cr as RenderEvent,Ga as Renderer,hr as ResizeEvent,xo as Resource,$l as RotateEvent,Bt as Run,fg as ScrollBar,x_ as SelectArea,qa as Selector,Ll as Star,Ch as StarData,dh as State,vt as StringNumberMap,w_ as Stroker,Ql as SwipeEvent,mo as TaskItem,vo as TaskProcessor,Wl as Text,th as TextConvert,Ph as TextData,Nf as TextEditor,fp as TransformTool,ag as Transformer,ch as Transition,Y as TwoPointBoundsHelper,Yh as UI,Dh as UIBounds,Ot as UICreator,mh as UIData,Vl as UIEvent,Wh as UIRender,ih as UnitConvert,Yn as WaitHelper,lr as WatchEvent,Ma as Watcher,rg as WheelEventHelper,td as ZoomEvent,Qp as addViewport,tg as addViewportConfig,Uo as affectRenderBoundsType,Xo as affectStrokeBoundsType,mg as arrowType,Oo as attr,Do as autoLayoutType,Fo as boundsType,po as canvasPatch,ee as canvasSizeAttrs,sn as cursorType,on as dataProcessor,Ao as dataType,To as decorateLeafAttr,rn as defineDataProcessor,Co as defineKey,Po as defineLeafAttr,No as doBoundsType,Vo as doStrokeType,Ja as effectType,Yt as emptyData,tn as eraserType,u as getBoundsData,Lo as getDescriptor,_ as getMatrixData,c as getPointData,en as hitType,Xt as isEmptyData,Ht as isNull,nn as layoutProcessor,Qo as maskType,zo as naturalBoundsType,Zo as opacityType,Yo as pathInputType,Ho as pathType,uo as pen,Mo as positionType,ip as registerEditTool,sp as registerInnerEditor,pn as registerUI,gn as registerUIEvent,$a as resizeType,dn as rewrite,cn as rewriteAble,Wo as rotationType,Io as scaleType,$o as sortType,jo as strokeType,Go as surfaceType,yt as tempBounds,N as tempMatrix,F as tempPoint,Pa as useCanvas,_n as useModule,La as version,Ko as visibleType,Qa as zoomLayerType};
|
|
1
|
+
const t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const n={};function r(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,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return y(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&y(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}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(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__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:v,pow:x,PI:w}=Math,b={within:(t,e,i)=>(_(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(u(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),b.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:x(10,e);return-0===(t=v(t*i)/i)?0:t},getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,n=(l(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&b.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:k,randColor:t=>`rgba(${k(255)},${k(255)},${k(255)},${t||1})`};function k(t){return Math.round(Math.random()*t)}const E=w/180,B=2*w,S=w/2;function R(){return{x:0,y:0}}function C(){return{x:0,y:0,width:0,height:0}}function O(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:T,cos:L,acos:P,sqrt:M}=Math,{float:A}=b,D={};function I(){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 W={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:I(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:O,getWorld:I,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){F.toInnerPoint(t,e,D),F.scaleOfInner(t,D,i,s)},scaleOfInner(t,e,i,s=i){F.translateInner(t,e.x,e.y),F.scale(t,i,s),F.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=L(e*=E),a=T(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){F.toInnerPoint(t,e,D),F.rotateOfInner(t,D,i)},rotateOfInner(t,e,i){F.translateInner(t,e.x,e.y),F.rotate(t,i),F.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=E,t.a=s+r*i,t.b=n+o*i),e&&(e*=E,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){F.toInnerPoint(t,e,D),F.skewOfInner(t,D,i,s)},skewOfInner(t,e,i,s=0){F.translateInner(t,e.x,e.y),F.skew(t,i,s),F.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n,o){let{e:a,f:h}=t;if(o&&(a+=o.scrollX,h+=o.scrollY),i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+h*e.c+e.e,i.f=a*e.b+h*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:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*E,o=L(r),a=T(r);if(s||n){const e=s*E,i=n*E;t.a=(o+i*-a)*h,t.b=(a+i*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,(i=i||s)&&F.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=M(n*n+r*r),c=t/d;const e=n/d;u=r>0?P(e):-P(e)}else{c=M(o*o+a*a),d=t/c;const e=o/c;u=S-(a>0?P(-e):-P(e))}const e=A(L(u)),i=T(u);d=A(d),c=A(c),_=e?A((o/c+i)/e/E,9):0,p=e?A((r/d-i)/e/E,9):0,u=A(u/E)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=M(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){F.set(t)}},F=W,{toInnerPoint:z,toOuterPoint:N}=W,{sin:H,cos:Y,abs:X,sqrt:V,atan2:U,min:j,round:G}=Math,K={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},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,i){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=Z.defaultPoint);const s=Y(e*=E),n=H(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=Z;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=Z;return J(i,t),N(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=Z;return J(i,t),Z.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){z(e,t,i)},toOuterOf(t,e,i){N(e,t,i)},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)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=X(i-t),r=X(s-e);return V(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>j(q(t,e,i,s),q(i,s,n,r)),getAngle:(t,e)=>$(t,e)/E,getRotation:(t,e,i,s)=>(s||(s=e),Z.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/E),getRadianFrom(t,e,i,s,n,o,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>U(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=$(t,e);return(e=s?e:{}).x=t.x+Y(n)*i,e.y=t.y+H(n)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){Z.reset(t)}},Z=K,{getDistanceFrom:q,copy:J,getAtan2:$}=Z;class Q{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Q(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new Q(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new Q(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new Q;class et{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return _(t)?W.copy(this,t):W.set(this,t,e,i,s,n,r),this}setWith(t){return W.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new et(this)}translate(t,e){return W.translate(this,t,e),this}translateInner(t,e){return W.translateInner(this,t,e),this}scale(t,e){return W.scale(this,t,e),this}scaleWith(t,e){return W.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return W.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return W.scaleOfInner(this,t,e,i),this}rotate(t){return W.rotate(this,t),this}rotateOfOuter(t,e){return W.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return W.rotateOfInner(this,t,e),this}skew(t,e){return W.skew(this,t,e),this}skewOfOuter(t,e,i){return W.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return W.skewOfInner(this,t,e,i),this}multiply(t){return W.multiply(this,t),this}multiplyParent(t){return W.multiplyParent(this,t),this}divide(t){return W.divide(this,t),this}divideParent(t){return W.divideParent(this,t),this}invert(){return W.invert(this),this}invertWith(){return W.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){W.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){W.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return W.setLayout(this,t,e,i),this}getLayout(t,e,i){return W.getLayout(this,t,e,i)}withScale(t,e){return W.withScale(this,t,e)}reset(){W.reset(this)}}const it=new et,st={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){nt(t,e,i),nt(t,e+s,i+n)},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:nt}=st;var rt,ot;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(rt||(rt={})),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"}(ot||(ot={}));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,i,s,n,r){const o=lt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),ht.toPoint(t,e,i,!0),i)};function lt(t){return a(t)?at[ot[t]]:t}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,n,r){dt(t,i,s,n,e,r)}},{tempPointBounds:ut,setPoint:_t,addPoint:pt,toBounds:gt}=st,{toOuterPoint:ft}=W,{float:yt,fourNumber:mt}=b,{floor:vt,ceil:xt}=Math;let wt,bt,kt,Et;const Bt={},St={},Rt={},Ct={tempBounds:Rt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=mt(i);s?Ot.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ot.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ot.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,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,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),Ot.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Lt(e,t):e=t,i?(e.offsetX=-(Ot.maxX(i)-t.x),e.offsetY=-(Ot.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ot.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||K.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){K.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ot.copy(Rt,t),Ot.toOuterOf(Rt,e),Rt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ot.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else Bt.x=t.x,Bt.y=t.y,ft(e,Bt,St),_t(ut,St.x,St.y),Bt.x=t.x+t.width,ft(e,Bt,St),pt(ut,St.x,St.y),Bt.y=t.y+t.height,ft(e,Bt,St),pt(ut,St.x,St.y),Bt.x=t.x,ft(e,Bt,St),pt(ut,St.x,St.y),gt(ut,i)},toInnerOf(t,e,i){i||(i=t),Ot.move(i,-e.e,-e.f),Ot.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ot.getFitScale(t,e));return new et(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),a(s)&&(s=Ot.getFitScale(t,e,"cover"===s)),Rt.width=n?e.width*=s:e.width*s,Rt.height=n?e.height*=s:e.height*s,ct.toPoint(i,Rt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Ot.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ot.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ot.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?xt(t.width+e-t.x):xt(t.width),t.height=i>t.y?xt(t.height+i-t.y):xt(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,i){wt=t.x+t.width,bt=t.y+t.height,kt=e.x,Et=e.y,i||(kt+=e.width,Et+=e.height),wt=wt>kt?wt:kt,bt=bt>Et?bt:Et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=wt-t.x,t.height=bt-t.y},addList(t,e){Ot.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ot.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ot.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Lt(t,n)):Tt(t,n));r&&Ot.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){Ot.set(t,e.x,e.y)},addPoint(t,e){Tt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=K.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=K.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ot.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=Ot.tempToOuterOf(e,i)),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,i){if(i&&(e=Ot.tempToOuterOf(e,i)),!Ot.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return wt=s+r,bt=n+o,kt=t.x+t.width,Et=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,wt=wt<kt?wt:kt,bt=bt<Et?bt:Et,r=wt-s,o=bt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Ot.copy(t,Ot.getIntersectData(t,e,i))},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){Ot.set(t)}},Ot=Ct,{add:Tt,copy:Lt}=Ot;class Pt{get minX(){return Ct.minX(this)}get minY(){return Ct.minY(this)}get maxX(){return Ct.maxX(this)}get maxY(){return Ct.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Ct.copy(this,t):Ct.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Pt(this)}move(t,e){return Ct.move(this,t,e),this}scale(t,e,i){return Ct.scale(this,t,e,i),this}scaleOf(t,e,i){return Ct.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ct.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ct.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ct.getFitMatrix(this,t,e)}put(t,e,i){Ct.put(this,t,e,i)}spread(t,e){return Ct.spread(this,t,e),this}shrink(t,e){return Ct.shrink(this,t,e),this}ceil(){return Ct.ceil(this),this}unsign(){return Ct.unsign(this),this}float(t){return Ct.float(this,t),this}add(t){return Ct.add(this,t),this}addList(t){return Ct.setList(this,t,!0),this}setList(t){return Ct.setList(this,t),this}addListWithFn(t,e){return Ct.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ct.setListWithFn(this,t,e),this}setPoint(t){return Ct.setPoint(this,t),this}setPoints(t){return Ct.setPoints(this,t),this}addPoint(t){return Ct.addPoint(this,t),this}getPoints(){return Ct.getPoints(this)}hitPoint(t,e){return Ct.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ct.hitRadiusPoint(this,t,e)}hit(t,e){return Ct.hit(this,t,e)}includes(t,e){return Ct.includes(this,t,e)}intersect(t,e){return Ct.intersect(this,t,e),this}getIntersect(t,e){return new Pt(Ct.getIntersectData(this,t,e))}isSame(t){return Ct.isSame(this,t)}isEmpty(){return Ct.isEmpty(this)}reset(){Ct.reset(this)}}const Mt=new Pt;class At{constructor(t,e,i,s,n,r){_(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Pt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Dt={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:It}=b;class Wt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Wt(t)}static set filter(t){this.filterList=Ft(t)}static set exclude(t){this.excludeList=Ft(t)}static drawRepaint(t,e){const i=It();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Wt.showBounds,n=t.__nowWorld,r=It();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}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}Wt.filterList=[],Wt.excludeList=[],Wt.showWarn=!0;const zt=Wt,Nt=Wt.get("RunTime"),Ht={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Yt.currentId=Yt.idMap[s]=i?performance.now():Date.now(),Yt.currentName=Yt.nameMap[s]=t,Yt.nameToIdMap[t]=s,s},end(t,e){const i=Yt.idMap[t],s=Yt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Yt.idMap[t]=Yt.nameMap[t]=Yt.nameToIdMap[s]=void 0,Nt.log(s,n,"ms")},endOfName(t,e){const i=Yt.nameToIdMap[t];r(i)||Yt.end(i,e)}},Yt=Ht,Xt=[],Vt={list:{},add(t,...e){this.list[t]=!0,Xt.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>Xt.forEach(t=>Vt.has(t,!0)));const Ut={editor:t=>Vt.need("editor")},jt=Wt.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&jt.repeat(e),Kt[e]=t},get(t,e,i,s,n,o){Kt[t]||jt.error("not register "+t);const a=new Kt[t](e);return r(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),o&&(a.height=o)),a}},{list:Kt}=Gt,Zt=Wt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(Jt[e]&&Zt.repeat(e),Jt[e]=t)})},changeName(t,e){const i=Jt[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,Jt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Jt[t](...e)},{nameList:Jt}=qt;class $t{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=Ut.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 Qt(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function te(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function ee(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ie=[];function se(){return(t,e)=>{ie.push(e)}}const ne=[];let re=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||ne)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};Qt([ee("imageSmoothingEnabled")],re.prototype,"smooth",void 0),Qt([ee("imageSmoothingQuality")],re.prototype,"smoothLevel",void 0),Qt([ee("globalAlpha")],re.prototype,"opacity",void 0),Qt([ee()],re.prototype,"fillStyle",void 0),Qt([ee()],re.prototype,"strokeStyle",void 0),Qt([ee("lineWidth")],re.prototype,"strokeWidth",void 0),Qt([ee("lineCap")],re.prototype,"strokeCap",void 0),Qt([ee("lineJoin")],re.prototype,"strokeJoin",void 0),Qt([ee("lineDashOffset")],re.prototype,"dashOffset",void 0),Qt([ee()],re.prototype,"miterLimit",void 0),Qt([ee()],re.prototype,"shadowBlur",void 0),Qt([ee()],re.prototype,"shadowColor",void 0),Qt([ee()],re.prototype,"shadowOffsetX",void 0),Qt([ee()],re.prototype,"shadowOffsetY",void 0),Qt([ee()],re.prototype,"filter",void 0),Qt([ee()],re.prototype,"font",void 0),Qt([ee()],re.prototype,"fontKerning",void 0),Qt([ee()],re.prototype,"fontStretch",void 0),Qt([ee()],re.prototype,"fontVariantCaps",void 0),Qt([ee()],re.prototype,"textAlign",void 0),Qt([ee()],re.prototype,"textBaseline",void 0),Qt([ee()],re.prototype,"textRendering",void 0),Qt([ee()],re.prototype,"wordSpacing",void 0),Qt([ee()],re.prototype,"letterSpacing",void 0),Qt([ee()],re.prototype,"direction",void 0),Qt([se()],re.prototype,"setTransform",null),Qt([se()],re.prototype,"resetTransform",null),Qt([se()],re.prototype,"getTransform",null),Qt([se()],re.prototype,"save",null),Qt([se()],re.prototype,"restore",null),Qt([se()],re.prototype,"translate",null),Qt([se()],re.prototype,"scale",null),Qt([se()],re.prototype,"rotate",null),Qt([se()],re.prototype,"fill",null),Qt([se()],re.prototype,"stroke",null),Qt([se()],re.prototype,"clip",null),Qt([se()],re.prototype,"fillRect",null),Qt([se()],re.prototype,"strokeRect",null),Qt([se()],re.prototype,"clearRect",null),Qt([se()],re.prototype,"beginPath",null),Qt([se()],re.prototype,"moveTo",null),Qt([se()],re.prototype,"lineTo",null),Qt([se()],re.prototype,"bezierCurveTo",null),Qt([se()],re.prototype,"quadraticCurveTo",null),Qt([se()],re.prototype,"closePath",null),Qt([se()],re.prototype,"arc",null),Qt([se()],re.prototype,"arcTo",null),Qt([se()],re.prototype,"ellipse",null),Qt([se()],re.prototype,"rect",null),Qt([se()],re.prototype,"roundRect",null),Qt([se()],re.prototype,"createConicGradient",null),Qt([se()],re.prototype,"createLinearGradient",null),Qt([se()],re.prototype,"createPattern",null),Qt([se()],re.prototype,"createRadialGradient",null),Qt([se()],re.prototype,"fillText",null),Qt([se()],re.prototype,"measureText",null),Qt([se()],re.prototype,"strokeText",null);const{copy:oe,multiplyParent:ae}=W,{round:he}=Math,le={width:1,height:1,pixelRatio:1},de=["width","height","pixelRatio"];class ce extends re{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(i,s){super(),this.size={},this.worldTransform={},i||(i=le),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:n,height:r,pixelRatio:o}=i;this.autoLayout=!n||!r,this.size.pixelRatio=o|t.devicePixelRatio,this.config=i,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 i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,de),de.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Pt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&ae(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=he(n.e-.5)+.5,n.f=he(n.f-.5)+.5):(n.e=he(n.e),n.f=he(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.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,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,Ct.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,n){this.resetTransform(),this.copyWorld(t,e,i,s),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Mt.x,Mt.y,Mt.width,Mt.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Mt.x,Mt.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i){i&&(this.blendMode=i),this.fillStyle=e,this.setTempBounds(t),this.fillRect(Mt.x,Mt.y,Mt.width,Mt.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(Mt.x,Mt.y,Mt.width,Mt.height),i&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(Mt.x,Mt.y,Mt.width,Mt.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(Mt.x,Mt.y,Mt.width,Mt.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){Mt.set(t),i&&Mt.intersect(this.bounds),Mt.scale(this.pixelRatio),e&&Mt.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):Ut.canvas(Object.assign({},i));return n.save(),t&&(oe(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const ue={creator:{},parse(t,e){},convertToCanvasData(t,e){}},_e={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},pe=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},_e),ge={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},fe={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},ye=Object.assign(Object.assign({},fe),_e),me=pe,ve={};for(let t in me)ve[me[t]]=t;const xe={};for(let t in me)xe[me[t]]=ge[t];const we={drawRoundRect(t,e,i,s,n,r){const o=b.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:be,cos:ke,atan2:Ee,ceil:Be,abs:Se,PI:Re,sqrt:Ce,pow:Oe}=Math,{setPoint:Te,addPoint:Le}=st,{set:Pe,toNumberPoints:Me}=K,{M:Ae,L:De,C:Ie,Q:We,Z:Fe}=pe,ze={},Ne={points(t,e,i,s){let n=Me(e);if(t.push(Ae,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,p,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=Ce(Oe(o-e,2)+Oe(a-r,2)),g=Ce(Oe(h-o,2)+Oe(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=r,d=o-p*h,c=a-p*l,2===i?s||t.push(We,d,c,o,a):t.push(Ie,u,_,d,c,o,a),u=o+g*h,_=a+g*l);s||t.push(We,u,_,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(De,n[e],n[e+1]);s&&t.push(Fe)},rect(t,e,i,s,n){ue.creator.path=t,ue.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){ue.creator.path=[],we.drawRoundRect(ue.creator,e,i,s,n,r),t.push(...ue.convertToCanvasData(ue.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,_=r-s,p=o-n;let g=Ee(u,c),f=Ee(p,_),y=f-g;if(y<0&&(y+=B),y===Re||Se(c+u)<1e-12||Se(_+p)<1e-12)return t&&t.push(De,s,n),h&&(Te(h,e,i),Le(h,s,n)),d&&Pe(d,e,i),void(l&&Pe(l,s,n));const m=c*p-_*u<0,v=m?-1:1,x=a/ke(y/2),w=s+x*ke(g+y/2+S*v),b=n+x*be(g+y/2+S*v);return g-=S*v,f-=S*v,Xe(t,w,b,a,a,0,g/E,f/E,m,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>Xe(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*E,_=be(u),p=ke(u);let g=o*E,f=a*E;g>Re&&(g-=B),f<0&&(f+=B);let y=f-g;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Be(Se(y/S)),v=y/m,x=be(v/4),w=8/3*x*x/be(v/2);f=g+v;let b,k,R,C,O,T,L,P,M=ke(g),A=be(g),D=R=p*s*M-_*n*A,I=C=_*s*M+p*n*A,W=e+R,F=i+C;t&&t.push(t.length?De:Ae,W,F),l&&Te(l,W,F),c&&Pe(c,W,F);for(let r=0;r<m;r++)b=ke(f),k=be(f),R=p*s*b-_*n*k,C=_*s*b+p*n*k,O=e+D-w*(p*s*A+_*n*M),T=i+I-w*(_*s*A-p*n*M),L=e+R+w*(p*s*k+_*n*b),P=i+C+w*(_*s*k-p*n*b),t&&t.push(Ie,O,T,L,P,e+R,i+C),l&&Ye(e+D,i+I,O,T,L,P,e+R,i+C,l,!0),D=R,I=C,M=b,A=k,g=f,f+=v;d&&Pe(d,e+R,i+C)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(Ie,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){Ye(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,b=a),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,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?Le(h,t,e):Te(h,t,e),Le(h,o,a);for(let l=0,c=d.length;l<c;l++)He(d[l],t,e,i,s,n,r,o,a,ze),Le(h,ze.x,ze.y)},getPointAndSet(t,e,i,s,n,r,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*s+_*r+p*a,l.y=c*i+u*n+_*o+p*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return He(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:He,toTwoPointBounds:Ye,ellipse:Xe}=Ne,{sin:Ve,cos:Ue,sqrt:je,atan2:Ge}=Math,{ellipse:Ke}=Ne,Ze={ellipticalArc(e,i,s,n,r,o,a,h,l,d,c){const u=(l-i)/2,_=(d-s)/2,p=o*E,g=Ve(p),f=Ue(p),y=-f*u-g*_,m=-f*_+g*u,v=n*n,x=r*r,w=m*m,b=y*y,k=v*x-v*w-x*b;let S=0;if(k<0){const t=je(1-k/(v*x));n*=t,r*=t}else S=(a===h?-1:1)*je(k/(v*w+x*b));const R=S*n*m/r,C=-S*r*y/n,O=Ge((m-C)/r,(y-R)/n),T=Ge((-m-C)/r,(-y-R)/n);let L=T-O;0===h&&L>0?L-=B:1===h&&L<0&&(L+=B);const P=i+u+f*R-g*C,M=s+_+g*R+f*C,A=L<0?1:0;c||t.ellipseToCurve?Ke(e,P,M,n,r,o,O/E,T/E,A):n!==r||o?e.push(pe.G,P,M,n,r,o,O/E,T/E,A):e.push(pe.O,P,M,n,O/E,T/E,A)}},{M:qe,m:Je,L:$e,l:Qe,H:ti,h:ei,V:ii,v:si,C:ni,c:ri,S:oi,s:ai,Q:hi,q:li,T:di,t:ci,A:ui,a:_i,Z:pi,z:gi,N:fi,D:yi,X:mi,G:vi,F:xi,O:wi,P:bi,U:ki}=pe,{rect:Ei,roundRect:Bi,arcTo:Si,arc:Ri,ellipse:Ci,quadraticCurveTo:Oi}=Ne,{ellipticalArc:Ti}=Ze,Li=Wt.get("PathConvert"),Pi={},Mi={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=xe[s],a+=s===n?" ":ve[s];for(let s=1;s<i;s++)a+=b.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?ye:fe;for(let e=0,h=t.length;e<h;e++)s=t[e],Dt[s]?("."===s&&(Ai.dot&&(Di(o,r),r=""),Ai.dot++),"0"===r&&"."!==s&&(Di(o,r),r=""),r+=s):pe[s]?(r&&(Di(o,r),r=""),Ai.name=pe[s],Ai.length=ge[s],Ai.index=0,Di(o,Ai.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&Di(o,r),r=s):r&&(Di(o,r),r=""),n=s;return r&&Di(o,r),i?Mi.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){case Je:t[c+1]+=a,t[c+2]+=h;case qe:a=t[c+1],h=t[c+2],_.push(qe,a,h),c+=3;break;case ei:t[c+1]+=a;case ti:a=t[c+1],_.push($e,a,h),c+=2;break;case si:t[c+1]+=h;case ii:h=t[c+1],_.push($e,a,h),c+=2;break;case Qe:t[c+1]+=a,t[c+2]+=h;case $e:a=t[c+1],h=t[c+2],_.push($e,a,h),c+=3;break;case ai:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=oi;case oi:o=r===ni||r===oi,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(ni,l,d,i,s,a,h),c+=5;break;case ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=ni;case ni:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(ni,t[c+1],t[c+2],i,s,a,h),c+=7;break;case ci:t[c+1]+=a,t[c+2]+=h,n=di;case di:o=r===hi||r===di,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Oi(_,a,h,i,s,t[c+1],t[c+2]):_.push(hi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=hi;case hi:i=t[c+1],s=t[c+2],e?Oi(_,a,h,i,s,t[c+3],t[c+4]):_.push(hi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case _i:t[c+6]+=a,t[c+7]+=h;case ui:Ti(_,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 gi:case pi:_.push(pi),c++;break;case fi:a=t[c+1],h=t[c+2],e?Ei(_,a,h,t[c+3],t[c+4]):Ii(_,t,c,5),c+=5;break;case yi:a=t[c+1],h=t[c+2],e?Bi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ii(_,t,c,9),c+=9;break;case mi:a=t[c+1],h=t[c+2],e?Bi(_,a,h,t[c+3],t[c+4],t[c+5]):Ii(_,t,c,6),c+=6;break;case vi:Ci(e?_:Ii(_,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,Pi),a=Pi.x,h=Pi.y,c+=9;break;case xi:e?Ci(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ii(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case wi:Ri(e?_:Ii(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Pi),a=Pi.x,h=Pi.y,c+=7;break;case bi:e?Ri(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ii(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ki:Si(e?_:Ii(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Pi),a=Pi.x,h=Pi.y,c+=6;break;default:return Li.error(`command: ${n} [index:${c}]`,t),_}r=n}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(qe,t.x,t.y);break;case"L":e.push($e,t.x,t.y);break;case"C":e.push(ni,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(hi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(pi)}}),e},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){Ai.index===Ai.length&&(Ai.index=1,t.push(Ai.name)),t.push(Number(e)),Ai.index++,Ai.dot=0}},{current:Ai,pushData:Di,copyData:Ii}=Mi,{M:Wi,L:Fi,C:zi,Q:Ni,Z:Hi,N:Yi,D:Xi,X:Vi,G:Ui,F:ji,O:Gi,P:Ki,U:Zi}=pe,{getMinDistanceFrom:qi,getRadianFrom:Ji}=K,{tan:$i,min:Qi,abs:ts}=Math,es={},is={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Wi,e,i)},lineTo(t,e,i){t.push(Fi,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(zi,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(Ni,e,i,s,n)},closePath(t){t.push(Hi)},rect(t,e,i,s,n){t.push(Yi,e,i,s,n)},roundRect(t,e,i,s,n,r){if(l(r))t.push(Vi,e,i,s,n,r);else{const o=b.fourNumber(r);o?t.push(Xi,e,i,s,n,...o):t.push(Yi,e,i,s,n)}},ellipse(t,e,i,s,n,r,a,h,l){o(r)?t.push(ji,e,i,s,n):(o(a)&&(a=0),o(h)&&(h=360),t.push(Ui,e,i,s,n,r,a,h,l?1:0))},arc(t,e,i,s,n,r,a){o(n)?t.push(Ki,e,i,s):(o(r)&&(r=360),t.push(Gi,e,i,s,n,r,a?1:0))},arcTo(t,e,i,s,n,o,a,h){if(!r(a)){const t=qi(a,h,e,i,s,n);o=Qi(o,Qi(t/2,t/2*ts($i(Ji(a,h,e,i,s,n)/2))))}t.push(Zi,e,i,s,n,o)},drawEllipse(t,e,i,s,n,r,a,h,l){Ne.ellipse(null,e,i,s,n,o(r)?0:r,o(a)?0:a,o(h)?360:h,l,null,null,es),t.push(Wi,es.x,es.y),ss(t,e,i,s,n,r,a,h,l)},drawArc(t,e,i,s,n,r,a){Ne.arc(null,e,i,s,o(n)?0:n,o(r)?360:r,a,null,null,es),t.push(Wi,es.x,es.y),ns(t,e,i,s,n,r,a)},drawPoints(t,e,i,s){Ne.points(t,e,i,s)}},{ellipse:ss,arc:ns}=is,{moveTo:rs,lineTo:os,quadraticCurveTo:as,bezierCurveTo:hs,closePath:ls,beginPath:ds,rect:cs,roundRect:us,ellipse:_s,arc:ps,arcTo:gs,drawEllipse:fs,drawArc:ys,drawPoints:ms}=is;class vs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?ue.parse(t):t:[],this}beginPath(){return ds(this.__path),this.paint(),this}moveTo(t,e){return rs(this.__path,t,e),this.paint(),this}lineTo(t,e){return os(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return hs(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return as(this.__path,t,e,i,s),this.paint(),this}closePath(){return ls(this.__path),this.paint(),this}rect(t,e,i,s){return cs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return us(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return _s(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return ps(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return gs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return fs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return ys(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return ms(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:xs,L:ws,C:bs,Q:ks,Z:Es,N:Bs,D:Ss,X:Rs,G:Cs,F:Os,O:Ts,P:Ls,U:Ps}=pe,Ms=Wt.get("PathDrawer"),As={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case ws:t.lineTo(e[s+1],e[s+2]),s+=3;break;case bs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case ks:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Es:t.closePath(),s+=1;break;case Bs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ss:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Rs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Cs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*E,e[s+6]*E,e[s+7]*E,e[s+8]),s+=9;break;case Os:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,B,!1),s+=5;break;case Ts:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*E,e[s+5]*E,e[s+6]),s+=7;break;case Ls:t.arc(e[s+1],e[s+2],e[s+3],0,B,!1),s+=4;break;case Ps:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ms.error(`command: ${i} [index:${s}]`,e)}}},{M:Ds,L:Is,C:Ws,Q:Fs,Z:zs,N:Ns,D:Hs,X:Ys,G:Xs,F:Vs,O:Us,P:js,U:Gs}=pe,{toTwoPointBounds:Ks,toTwoPointBoundsByQuadraticCurve:Zs,arcTo:qs,arc:Js,ellipse:$s}=Ne,{addPointBounds:Qs,copy:tn,addPoint:en,setPoint:sn,addBounds:nn,toBounds:rn}=st,on=Wt.get("PathBounds");let an,hn,ln;const dn={},cn={},un={},_n={toBounds(t,e){_n.toTwoPointBounds(t,cn),rn(cn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return sn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===zs||o===Ws||o===Fs?sn(e,h,l):sn(e,t[a+1],t[a+2])),o){case Ds:case Is:h=t[a+1],l=t[a+2],en(e,h,l),a+=3;break;case Ws:n=t[a+5],r=t[a+6],Ks(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,dn),Qs(e,dn),h=n,l=r,a+=7;break;case Fs:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],Zs(h,l,i,s,n,r,dn),Qs(e,dn),h=n,l=r,a+=5;break;case zs:a+=1;break;case Ns:h=t[a+1],l=t[a+2],nn(e,h,l,t[a+3],t[a+4]),a+=5;break;case Hs:case Ys:h=t[a+1],l=t[a+2],nn(e,h,l,t[a+3],t[a+4]),a+=o===Hs?9:6;break;case Xs:$s(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],dn,un),0===a?tn(e,dn):Qs(e,dn),h=un.x,l=un.y,a+=9;break;case Vs:h=t[a+1],l=t[a+2],hn=t[a+3],ln=t[a+4],nn(e,h-hn,l-ln,2*hn,2*ln),h+=hn,a+=5;break;case Us:Js(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],dn,un),0===a?tn(e,dn):Qs(e,dn),h=un.x,l=un.y,a+=7;break;case js:h=t[a+1],l=t[a+2],an=t[a+3],nn(e,h-an,l-an,2*an,2*an),h+=an,a+=4;break;case Gs:qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],dn,un),0===a?tn(e,dn):Qs(e,dn),h=un.x,l=un.y,a+=6;break;default:return void on.error(`command: ${o} [index:${a}]`,t)}}},{M:pn,L:gn,Z:fn}=pe,{getCenterX:yn,getCenterY:mn}=K,{arcTo:vn}=is,xn={smooth(t,e,i){let s,n,r,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(s=t[o],s){case pn:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===gn?(c=t[o+1],u=t[o+2],f.push(pn,yn(l,c),mn(d,u))):f.push(pn,l,d);break;case gn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case gn:vn(f,a,h,t[o+1],t[o+2],e,_,p);break;case fn:vn(f,a,h,l,d,e,_,p);break;default:f.push(gn,a,h)}_=a,p=h;break;case fn:n!==fn&&(vn(f,l,d,c,u,e,_,p),f.push(fn)),o+=1;break;default:r=xe[s];for(let e=0;e<r;e++)f.push(t[o+e]);o+=r}n=s}return s!==fn&&(f[1]=l,f[2]=d),f}};ue.creator=new vs,ue.parse=Mi.parse,ue.convertToCanvasData=Mi.toCanvasData;const wn=new vs,{drawRoundRect:bn}=we;function kn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){bn(this,t,e,i,s,n)})}(t)}const En={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=Bn.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{}}}},Bn=En;Bn.alphaPixelTypes.forEach(t=>Bn.upperCaseTypeMap[t]=t.toUpperCase());const Sn=Wt.get("TaskProcessor");class Rn{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){Sn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Cn{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/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 i,s,n,o;const a=new Rn(t);return a.parent=this,l(e)?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),r(o)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},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 i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 On=Wt.get("Resource"),Tn={tasker:new Cn,map:{},get isComplete(){return Ln.tasker.isComplete},set(t,e){Ln.map[t]&&On.repeat(t),Ln.map[t]=e},get:t=>Ln.map[t],remove(t){const e=Ln.map[t];e&&(e.destroy&&e.destroy(),delete Ln.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Ut.image(s)),Ln.set(t,e),e},destroy(){Ln.map={}}},Ln=Tn,Pn={maxRecycled:10,recycledList:[],patternTasker:new Cn,get(t){let e=Tn.get(t.url);return e||Tn.set(t.url,e=Ut.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Mn.recycledList.push(t)})},clearRecycled(){const t=Mn.recycledList;t.length>Mn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Tn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>En.alphaPixelTypes.some(e=>Mn.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+En.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+En.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Mn.recycledList=[]}},Mn=Pn,{IMAGE:An,create:Dn}=e,{floor:In,max:Wn}=Math;class Fn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Dn(An),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Pn.isFormat("svg",t)&&(this.isSVG=!0),Pn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),Tn.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[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((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,i,s,n,r,o){if(e||(e=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=t.origin.createCanvas(Wn(In(e+(r||0)),1),Wn(In(i+(o||0)),1)),h=a.getContext("2d");return s&&(h.globalAlpha=s),h.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(e,i,s,n){const r=t.canvas.createPattern(e,i);try{s&&r.setTransform&&(r.setTransform(s),s=void 0)}catch(t){}return n&&f.stintSet(n,"transform",s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function zn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Nn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Hn(t,e){const i="_"+t;return{get(){const t=this[i];return r(t)?e:t},set(t){this[i]=t}}}function Yn(t,e){return(i,s)=>Vn(i,s,t,e&&e(s))}function Xn(t){return t}function Vn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};zn(t,e,Object.assign(n,s||{})),yr(t,e,i)}function Un(t){return Yn(t)}function jn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Gn(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),$n(this))}}))}function Kn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Zn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function qn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&$n(this)}}))}function Jn(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&($n(this),this.__.__removeNaturalSize())}}))}function $n(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Qn(t){return Yn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),$n(this)}}))}const tr=qn;function er(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i)&&(ir(this),e&&(this.__.__useStroke=!0))}}))}function ir(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&$n(t)}const sr=er;function nr(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function rr(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function or(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&hr(this)}}))}function ar(t){return Yn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>lr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");lr(this,t,e,i),this.mask&&hr(this)}}))}function hr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function lr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||$n(t))}function dr(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function cr(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function ur(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function _r(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Wt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function pr(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function gr(t){return(e,i)=>{zn(e,"__DataProcessor",{get:()=>t})}}function fr(t){return(e,i)=>{zn(e,"__LayoutProcessor",{get:()=>t})}}function yr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Hn(e,i);if(r(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if(_(i)){const t=g(i);a.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=Nn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),zn(s,e,a)}const mr=new Wt("rewrite"),vr=[],xr=["destroy","constructor"];function wr(t){return(e,i)=>{vr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function br(){return t=>{kr()}}function kr(t){vr.length&&(vr.forEach(e=>{t&&mr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),vr.length=0)}function Er(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(xr.includes(s)||e&&e.includes(s)))if(t.prototype){Nn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Br(){return t=>{Gt.register(t)}}function Sr(){return t=>{qt.register(t)}}setTimeout(()=>kr(!0));const{copy:Rr,toInnerPoint:Cr,toOuterPoint:Or,scaleOfOuter:Tr,rotateOfOuter:Lr,skewOfOuter:Pr,multiplyParent:Mr,divideParent:Ar,getLayout:Dr}=W,Ir={},{round:Wr}=Math,Fr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Hr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Nr(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)Yr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Yr(t),t.__updateChange()},updateAllChange(t){if(Vr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Xr(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,i,s,n,r,o){n||(n=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,n,e.__nowWorld,r,o):i.copyWorldToInner(s,n,e.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,n){const r=_(e)?Object.assign({},e):{x:e,y:i};s?Or(t.localTransform,r,r,!0):t.parent&&Cr(t.parent.worldTransform,r,r,!0),zr.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Wr(e),i=Wr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){zr.zoomOfLocal(t,Ur(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(l(s)||(s&&(r=s),s=i),Rr(Ir,o),Tr(Ir,e,i,s),t.origin||t.around)zr.setTransform(t,Ir,n,r);else{const e=t.x+Ir.e-o.e,a=t.y+Ir.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){zr.rotateOfLocal(t,Ur(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Rr(Ir,n),Lr(Ir,e,i),t.origin||t.around?zr.setTransform(t,Ir,!1,s):t.set({x:t.x+Ir.e-n.e,y:t.y+Ir.f-n.f,rotation:b.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){zr.skewOfLocal(t,Ur(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Rr(Ir,t.__localMatrix),Pr(Ir,e,i,s),zr.setTransform(t,Ir,n,r)},transformWorld(t,e,i,s){Rr(Ir,t.worldTransform),Mr(Ir,e),t.parent&&Ar(Ir,t.parent.worldTransform),zr.setTransform(t,Ir,i,s)},transform(t,e,i,s){Rr(Ir,t.localTransform),Mr(Ir,e),zr.setTransform(t,Ir,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&zr.getInnerOrigin(t,n.origin),o=Dr(e,r,n.around&&zr.getInnerOrigin(t,n.around));if(i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Ct.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=zr.getInnerOrigin(t,n.origin);K.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Tr(i,zr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(zr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Rr(Ir,t.worldTransform),Ar(Ir,e.worldTransform),i?Ir:Object.assign({},Ir)),drop(t,e,i,s){t.setTransform(zr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const n=i.x*s,r=i.y*s;i.x-=n,i.y-=r,e.move(n,r),t.requestRender(()=>zr.animateMove(e,i,s))}}},zr=Fr,{updateAllMatrix:Nr,updateMatrix:Hr,updateAllWorldOpacity:Yr,updateAllChange:Xr,updateChange:Vr}=zr;function Ur(t,e){return t.__layout.update(),t.parent?K.tempToInnerOf(e,t.parent.__world):e}const jr={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)=>Kr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Kr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>Kr(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 Gr;function Kr(t,e){return e||(Gr=0),t.__.mask&&(Gr=1),Gr<0?null:(Gr&&(Gr=-1),!0)}const{updateBounds:Zr}=Fr,qr={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:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Jr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)$r(e[t],e)},updateBounds(t,e){const i=[t];$r(t,i),Qr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Zr(s[t]);e&&e===i||Zr(i)}}},{pushAllChildBranch:Jr,pushAllBranchStack:$r,updateBoundsByBranchStack:Qr}=qr,to={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:eo,updateBounds:io}=Fr,{toOuterOf:so,getPoints:no,copy:ro}=Ct,oo="_localContentBounds",ao="_worldContentBounds",ho="_worldBoxBounds",lo="_worldStrokeBounds";class co{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 so(this.contentBounds,this.leaf.__localMatrix,this[oo]||(this[oo]={})),this[oo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return so(this.contentBounds,this.leaf.__world,this[ao]||(this[ao]={})),this[ao]}get worldBoxBounds(){return so(this.boxBounds,this.leaf.__world,this[ho]||(this[ho]={})),this[ho]}get worldStrokeBounds(){return so(this.strokeBounds,this.leaf.__world,this[lo]||(this[lo]={})),this[lo]}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:i}=e;if(e.isApp)return io(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__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 W.defaultMatrix;case"page":t=e.zoomLayer;default:return eo(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 Pt(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",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=W.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=eo(s,e,!0)}if(o||(o=W.getLayout(r)),ro(o,a),K.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=no(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}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.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.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 uo{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 _o extends uo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}_o.ADD="child.add",_o.REMOVE="child.remove",_o.CREATED="created",_o.MOUNTED="mounted",_o.UNMOUNTED="unmounted",_o.DESTROY="destroy";class po extends uo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}po.CHANGE="property.change",po.LEAFER_CHANGE="property.leafer_change";class go extends uo{constructor(t,e){super(t),Object.assign(this,e)}}go.LOAD="image.load",go.LOADED="image.loaded",go.ERROR="image.error";class fo extends uo{static checkHas(t,e,i){"on"===i?e===xo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(yo)||t.hasEvent(mo)||t.hasEvent(vo),t.__hasWorldEvent=t.hasEvent(xo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(yo,t),"inner"===e&&t.emit(mo,t)),t.emit(vo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(xo,this)}}fo.RESIZE="bounds.resize",fo.INNER="bounds.inner",fo.LOCAL="bounds.local",fo.WORLD="bounds.world";const{RESIZE:yo,INNER:mo,LOCAL:vo,WORLD:xo}=fo,wo={};[yo,mo,vo,xo].forEach(t=>wo[t]=1);class bo extends uo{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(bo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}bo.RESIZE="resize";class ko extends uo{constructor(t,e){super(t),this.data=e}}ko.REQUEST="watch.request",ko.DATA="watch.data";class Eo extends uo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Eo.REQUEST="layout.request",Eo.START="layout.start",Eo.BEFORE="layout.before",Eo.LAYOUT="layout",Eo.AFTER="layout.after",Eo.AGAIN="layout.again",Eo.END="layout.end";class Bo extends uo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Bo.REQUEST="render.request",Bo.CHILD_START="render.child_start",Bo.CHILD_END="render.child_end",Bo.START="render.start",Bo.BEFORE="render.before",Bo.RENDER="render",Bo.AFTER="render.after",Bo.AGAIN="render.again",Bo.END="render.end",Bo.NEXT="render.next";class So extends uo{}So.START="leafer.start",So.BEFORE_READY="leafer.before_ready",So.READY="leafer.ready",So.AFTER_READY="leafer.after_ready",So.VIEW_READY="leafer.view_ready",So.VIEW_COMPLETED="leafer.view_completed",So.STOP="leafer.stop",So.RESTART="leafer.restart",So.END="leafer.end",So.TRANSFORM="leafer.transform",So.MOVE="leafer.move",So.SCALE="leafer.scale",So.ROTATE="leafer.rotate",So.SKEW="leafer.skew";const{MOVE:Ro,SCALE:Co,ROTATE:Oo,SKEW:To}=So,Lo={x:Ro,y:Ro,scaleX:Co,scaleY:Co,rotation:Oo,skewX:To,skewY:To},Po={};class Mo{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=Ao(this,s,!0),h=a(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],wo[t]&&fo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=Ao(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],wo[t]&&fo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):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:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(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,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const s=Ao(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:i,__captureMap:s}=this,n=i&&i[t],o=s&&s[t];return!!(r(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Ao(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Po)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Po)}}const{on:Do,on_:Io,off:Wo,off_:Fo,once:zo,emit:No,emitEvent:Ho,hasEvent:Yo,destroy:Xo}=Mo.prototype,Vo={on:Do,on_:Io,off:Wo,off_:Fo,once:zo,emit:No,emitEvent:Ho,hasEvent:Yo,destroyEventer:Xo},Uo=Wt.get("setAttr"),jo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||r(e)||(Uo.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=po,n=new po(i,this,t,s,e);if(this.isLeafer){this.emitEvent(new po(po.LEAFER_CHANGE,this,t,s,e));const i=Lo[t];i&&(this.emitEvent(new So(i,this)),this.emitEvent(new So(So.TRANSFORM,this)))}else this.hasEvent(i)&&this.emitEvent(n);return this.leafer.emitEvent(n),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Go,multiplyParent:Ko,translateInner:Zo,defaultWorld:qo}=W,{toPoint:Jo,tempPoint:$o}=ht,Qo={__updateWorldMatrix(){const{parent:t,__layout:e}=this;Ko(this.__local||e,t?t.__world:qo,this.__world,!!e.affectScaleOrRotation,this.__,t&&(t.scrollY||t.scrollX)&&t.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Go(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Jo(i.around||i.origin,t.boxBounds,$o),Zo(e,-$o.x,-$o.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ta,updateAllMatrix:ea}=Fr,{updateBounds:ia}=qr,{toOuterOf:sa,copyAndSpread:na,copy:ra}=Ct,{toBounds:oa}=_n,aa={__updateWorldBounds(){const t=this.__layout;sa(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&fo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&fo.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(),sa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){sa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){sa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?oa(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ea(this),ia(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ea(this),ia(this,this))):ta(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;na(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?na(t.renderBounds,t.boxBounds,t.renderSpread):ra(t.renderBounds,t.strokeBounds)}},ha={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),Fr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Wt.showBounds&&Wt.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:la}=jr,da={__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 i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)la(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)la(i[s],e)||i[s].__clip(t,e)}}},ca={},{LEAF:ua,create:_a}=e,{toInnerPoint:pa,toOuterPoint:ga,multiplyParent:fa}=W,{toOuterOf:ya}=Ct,{copy:ma,move:va}=K,{moveLocal:xa,zoomOfLocal:wa,rotateOfLocal:ba,skewOfLocal:ka,moveWorld:Ea,zoomOfWorld:Ba,rotateOfWorld:Sa,skewOfWorld:Ra,transform:Ca,transformWorld:Oa,setTransform:Ta,getFlipTransform:La,getLocalOrigin:Pa,getRelativeWorld:Ma,drop:Aa}=Fr;let Da=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 co}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 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.__layout.update(),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=_a(ua),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(_o.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(_o.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(_o.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(_o.MOUNTED)):this.__emitLifeEvent(_o.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(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(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return fa(i,t.matrix,e,void 0,i),ya(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.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:i,scaleY:s}=Pn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),ca.scaleX=i,ca.scaleY=s,ca}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?Ma(this,e):this.worldTransform,n=i?t:{};return ya(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ma(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ma(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),pa(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){ga(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return va(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return va(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Ta(this,t,e,i)}transform(t,e,i){Ca(this,t,e,i)}move(t,e,i){xa(this,t,e,i)}moveInner(t,e,i){Ea(this,t,e,!0,i)}scaleOf(t,e,i,s,n){wa(this,Pa(this,t),e,i,s,n)}rotateOf(t,e,i){ba(this,Pa(this,t),e,i)}skewOf(t,e,i,s,n){ka(this,Pa(this,t),e,i,s,n)}transformWorld(t,e,i){Oa(this,t,e,i)}moveWorld(t,e,i){Ea(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Ba(this,t,e,i,s,n)}rotateOfWorld(t,e){Sa(this,t,e)}skewOfWorld(t,e,i,s,n){Ra(this,t,e,i,s,n)}flip(t,e){Ca(this,La(this,t),!1,e)}scaleResize(t,e=t,i){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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Vt.need("path")}getMotionPoint(t){return Vt.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,i){Aa(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):yr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=qn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new _o(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(_o.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};Da=Qt([Er(jo),Er(Qo),Er(aa),Er(Vo),Er(ha)],Da);const{setListWithFn:Ia}=Ct,{sort:Wa}=qr,{localBoxBounds:Fa,localStrokeBounds:za,localRenderBounds:Na,maskLocalBoxBounds:Ha,maskLocalStrokeBounds:Ya,maskLocalRenderBounds:Xa}=jr,Va=new Wt("Branch");let Ua=class extends Da{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Ia(this.__layout.boxBounds,this.children,this.__hasMask?Ha:Fa)}__updateStrokeBounds(){Ia(this.__layout.strokeBounds,this.children,this.__hasMask?Ya:za)}__updateRenderBounds(){Ia(this.__layout.renderBounds,this.children,this.__hasMask?Xa:Na)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(Wa),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Va.warn("add self or destroyed");const i=r(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Gt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(_o.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(_o.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)):r(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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(_o.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(_o.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new _o(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Ua=Qt([Er(da)],Ua);class ja{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,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 ja;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Ga{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Ka="1.9.0";class Za extends ce{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}kn(OffscreenCanvasRenderingContext2D.prototype),kn(Path2D.prototype);const{mineType:qa}=En;function Ja(e,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:qa(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:qa(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",t.image.getRealURL(e),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},t.canvas=Ut.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(Ut,{canvas:(t,e)=>new Za(t,e),image:t=>new Fn(t)}),t.name="web",t.isWorker=!0,t.backgrounder=!0,t.requestRender=function(t){requestAnimationFrame(t)},zn(t,"devicePixelRatio",{get:()=>1});const{userAgent:$a}=navigator;$a.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.fullImageShadow=!0),$a.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):$a.indexOf("Mac")>-1?t.os="Mac":$a.indexOf("Linux")>-1&&(t.os="Linux");class Qa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ja;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 ja,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(Bo.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===_o.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new ko(ko.DATA,{updatedList:this.updatedList})),this.__updatedList=new ja,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[po.CHANGE,this.__onAttrChange,this],[[_o.ADD,_o.REMOVE],this.__onChildEvent,this],[ko.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:th,updateBounds:eh,updateChange:ih}=Fr,{pushAllChildBranch:sh,pushAllParent:nh}=qr;const{worldBounds:rh}=jr;class oh{constructor(t){this.updatedBounds=new Pt,this.beforeBounds=new Pt,this.afterBounds=new Pt,u(t)&&(t=new ja(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,rh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,rh),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:ah,updateAllChange:hh}=Fr,lh=Wt.get("Layouter");class dh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Ga,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(Eo.START),this.layoutOnce(),t.emitEvent(new Eo(Eo.END,this.layoutedBlocks,this.times))}catch(t){lh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?lh.warn("layouting"):this.times>3?lh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ko.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=Ht.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=Eo,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Eo(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(th(t,!0),e.add(t),t.isBranch&&sh(t,e),nh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),nh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||eh(s[t])}eh(i)}})}(this.__levelList),function(t){t.list.forEach(ih)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Eo(r,a,this.times)),i.emitEvent(new Eo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Ht.end(e)}fullLayout(){const t=Ht.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Eo,r=this.getBlocks(new ja(e));e.emitEvent(new Eo(i,r,this.times)),dh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Eo(s,r,this.times)),e.emitEvent(new Eo(n,r,this.times)),this.addBlocks(r),Ht.end(t)}static fullLayout(t){ah(t,!0),t.isBranch?qr.updateBounds(t):Fr.updateBounds(t),hh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new oh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new oh(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_([[Eo.REQUEST,this.layout,this],[Eo.AGAIN,this.layoutAgain,this],[ko.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ch=Wt.get("Renderer");class uh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Eo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Bo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Bo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Bo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Pt,ch.log(e.innerName,"---\x3e");try{this.emitRender(Bo.START),this.renderOnce(t),this.emitRender(Bo.END,this.totalBounds),Pn.clearRecycled()}catch(t){this.rendering=!1,ch.error(t)}ch.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ch.warn("rendering");if(this.times>3)return ch.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Pt,this.renderOptions={},t)this.emitRender(Bo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Bo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Bo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Bo.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=Ht.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Pt(s);i.save(),s.spread(uh.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Ht.end(e)}fullRender(){const t=Ht.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Ht.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Wt.showRepaint&&Wt.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Pt;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 i=this.requestTime=Date.now();t.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Pt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Pt(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||ch.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Bo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Bo.REQUEST,this.update,this],[Eo.END,this.__onLayoutEnd,this],[Bo.AGAIN,this.renderAgain,this],[bo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}uh.clipSpread=10;const{hitRadiusPoint:_h}=Ct;class ph{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ja(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new ja;if(t.length){let e;const{x:n,y:r}=this.point,o={x:n,y:r,radiusX:0,radiusY:0};for(let n=0,r=t.length;n<r;n++)if(e=t[n],(i||Fr.worldHittable(e))&&(this.hitChild(e,o),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Fr.hasParent(t,e))){s.reset();break}return s.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),s.length)return s.list[0];return i?t[0]:t.find(t=>Fr.worldHittable(t))}getPath(t){const e=new ja;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new ja;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new ja,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let r=t.length-1;r>-1;r--)i=t[r],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||_h(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class gh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new ph(this.target=t,this),this.finder=Ut.finder&&Ut.finder()}getByPoint(e,i,s){const{target:n,picker:r}=this;return t.backgrounder&&n&&n.updateLayout(),r.getByPoint(e,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Vt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function fh(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function yh(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function mh(){return(t,e)=>{const i="_"+e;zn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function vh(t){return(e,i)=>{zn(e,i,Hn(i,t))}}Object.assign(Ut,{watcher:(t,e)=>new Qa(t,e),layouter:(t,e)=>new dh(t,e),renderer:(t,e,i)=>new uh(t,e,i),selector:(t,e)=>new gh(t,e)}),t.layout=dh.fullLayout;const xh={},wh={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}},bh={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},kh={},Eh={},Bh={},Sh={},Rh={},Ch={apply(){Vt.need("filter")}},Oh={},Th={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Lh={list:{},register(t,e){Lh.list[t]=e},get:t=>Lh.list[t]},{parse:Ph,objectToCanvasData:Mh}=Mi,{stintSet:Ah}=f,{hasTransparent:Dh}=wh,Ih={},Wh=Wt.get("UIData");class Fh 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,Wh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Wh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Ah(this,"__isTransparentFill",Dh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Ah(this,"__isTransparentStroke",Dh(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?Ph(t):Mh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){zh(this,"shadow",t)}setInnerShadow(t){zh(this,"innerShadow",t)}setFilter(t){zh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Eh.compute("fill",this.__leaf),e&&Eh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Ih)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ih))}__removePaint(t,e){e&&this.__removeInput(t),Bh.recycleImage(t,this),"fill"===t?(Ah(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ah(this,"__isAlphaPixelStroke",void 0),Ah(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function zh(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Nh extends Fh{}class Hh extends Nh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"hide"===t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Yh extends Nh{__getInputData(t,e){const i=super.__getInputData(t,e);return de.forEach(t=>delete i[t]),i}}class Xh extends Hh{}class Vh extends Fh{}class Uh extends Fh{get __boxStroke(){return!this.__pathInputed}}class jh extends Fh{get __boxStroke(){return!this.__pathInputed}}class Gh extends Fh{}class Kh extends Fh{}class Zh extends Fh{get __pathInputed(){return 2}}class qh extends Nh{}const Jh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class $h extends Fh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Jh[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Gt.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange(),r.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Qh extends Uh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class tl extends Uh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const el={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),r&&(t+=Ch.getSpread(r)),o&&(t+=o);let a=t=Math.ceil(t);return i&&i.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),n&&(a=Math.max(a,n)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:il}=f,sl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);il(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),il(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;il(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),il(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){nl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Eh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Rh.shadow(this,t,h),a&&(s.__isStrokes?Eh.strokes(r,this,t):Eh.stroke(r,this,t)),n&&(s.__isFills?Eh.fills(n,this,t):Eh.fill(n,this,t)),o&&this.__drawAfterFill(t,e),d&&Rh.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?Eh.strokes(r,this,t):Eh.stroke(r,this,t)),c&&Ch.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Eh.strokes(r,this,t):Eh.stroke(r,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,wh.string(e.color))}n&&(s.__isFills?Eh.fills(n,this,t):Eh.fill(n,this,t)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?Eh.strokes(r,this,t):Eh.stroke(r,this,t))}}else s.__pathInputed?nl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Eh.fills(s,this,t):Eh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Eh.strokes(n,this,t):Eh.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 nl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Eh.stroke(n,t,e),s&&Eh.fill(s,t,e),r&&t.__drawAfterFill(e,i),n&&!o&&Eh.stroke(n,t,e)}const rl={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),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,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var ol;let al=ol=class extends Da{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 wn.set(this.path=t||[]),t||this.__drawPathByBox(wn),wn}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Vt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Vt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(wn.set(i=[]),this.__drawPathByBox(wn)),t?Mi.toCanvasData(i,!0):i}getPathString(t,e,i){return Mi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Oh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?xn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&kh.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?As.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,l(r)?[r]:r)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Eh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Vt.need("animate")}killAnimate(t,e){}export(t,e){return Vt.need("export")}syncExport(t,e){return Vt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),ol.one(e)}static one(t,e,i,s,n){return Gt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Br()(this)}static registerData(t){gr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};Qt([gr(Fh)],al.prototype,"__",void 0),Qt([mh()],al.prototype,"zoomLayer",void 0),Qt([Un("")],al.prototype,"id",void 0),Qt([Un("")],al.prototype,"name",void 0),Qt([Un("")],al.prototype,"className",void 0),Qt([rr("pass-through")],al.prototype,"blendMode",void 0),Qt([or(1)],al.prototype,"opacity",void 0),Qt([ar(!0)],al.prototype,"visible",void 0),Qt([rr(!1)],al.prototype,"locked",void 0),Qt([rr(!1)],al.prototype,"dim",void 0),Qt([rr(!1)],al.prototype,"dimskip",void 0),Qt([dr(0)],al.prototype,"zIndex",void 0),Qt([cr(!1)],al.prototype,"mask",void 0),Qt([ur(!1)],al.prototype,"eraser",void 0),Qt([jn(0,!0)],al.prototype,"x",void 0),Qt([jn(0,!0)],al.prototype,"y",void 0),Qt([qn(100,!0)],al.prototype,"width",void 0),Qt([qn(100,!0)],al.prototype,"height",void 0),Qt([Kn(1,!0)],al.prototype,"scaleX",void 0),Qt([Kn(1,!0)],al.prototype,"scaleY",void 0),Qt([Zn(0,!0)],al.prototype,"rotation",void 0),Qt([Zn(0,!0)],al.prototype,"skewX",void 0),Qt([Zn(0,!0)],al.prototype,"skewY",void 0),Qt([jn(0,!0)],al.prototype,"offsetX",void 0),Qt([jn(0,!0)],al.prototype,"offsetY",void 0),Qt([jn(0,!0)],al.prototype,"scrollX",void 0),Qt([jn(0,!0)],al.prototype,"scrollY",void 0),Qt([Gn()],al.prototype,"origin",void 0),Qt([Gn()],al.prototype,"around",void 0),Qt([Un(!1)],al.prototype,"lazy",void 0),Qt([Jn(1)],al.prototype,"pixelRatio",void 0),Qt([nr(0)],al.prototype,"renderSpread",void 0),Qt([Qn()],al.prototype,"path",void 0),Qt([tr()],al.prototype,"windingRule",void 0),Qt([tr(!0)],al.prototype,"closed",void 0),Qt([qn(0)],al.prototype,"padding",void 0),Qt([qn(!1)],al.prototype,"lockRatio",void 0),Qt([qn()],al.prototype,"widthRange",void 0),Qt([qn()],al.prototype,"heightRange",void 0),Qt([Un(!1)],al.prototype,"draggable",void 0),Qt([Un()],al.prototype,"dragBounds",void 0),Qt([Un(!1)],al.prototype,"editable",void 0),Qt([_r(!0)],al.prototype,"hittable",void 0),Qt([_r("path")],al.prototype,"hitFill",void 0),Qt([sr("path")],al.prototype,"hitStroke",void 0),Qt([_r(!1)],al.prototype,"hitBox",void 0),Qt([_r(!0)],al.prototype,"hitChildren",void 0),Qt([_r(!0)],al.prototype,"hitSelf",void 0),Qt([_r()],al.prototype,"hitRadius",void 0),Qt([pr("")],al.prototype,"cursor",void 0),Qt([rr()],al.prototype,"fill",void 0),Qt([sr(void 0,!0)],al.prototype,"stroke",void 0),Qt([sr("inside")],al.prototype,"strokeAlign",void 0),Qt([sr(1,!0)],al.prototype,"strokeWidth",void 0),Qt([sr(!1)],al.prototype,"strokeWidthFixed",void 0),Qt([sr("none")],al.prototype,"strokeCap",void 0),Qt([sr("miter")],al.prototype,"strokeJoin",void 0),Qt([sr()],al.prototype,"dashPattern",void 0),Qt([sr(0)],al.prototype,"dashOffset",void 0),Qt([sr(10)],al.prototype,"miterLimit",void 0),Qt([tr(0)],al.prototype,"cornerRadius",void 0),Qt([tr()],al.prototype,"cornerSmoothing",void 0),Qt([fh()],al.prototype,"shadow",void 0),Qt([fh()],al.prototype,"innerShadow",void 0),Qt([fh()],al.prototype,"blur",void 0),Qt([fh()],al.prototype,"backgroundBlur",void 0),Qt([fh()],al.prototype,"grayscale",void 0),Qt([fh()],al.prototype,"filter",void 0),Qt([rr()],al.prototype,"placeholderColor",void 0),Qt([Un(100)],al.prototype,"placeholderDelay",void 0),Qt([Un({})],al.prototype,"data",void 0),Qt([wr(Da.prototype.reset)],al.prototype,"reset",null),al=ol=Qt([Er(el),Er(sl),br()],al);let hl=class extends al{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return 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 ll;Qt([gr(Nh)],hl.prototype,"__",void 0),Qt([qn(0)],hl.prototype,"width",void 0),Qt([qn(0)],hl.prototype,"height",void 0),hl=Qt([Er(Ua),Br()],hl);const dl=Wt.get("Leafer");let cl=ll=class extends hl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Tn.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),ll.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const n=this.canvas=Ut.canvas(s);this.__controllers.push(this.renderer=Ut.renderer(this,n,s),this.watcher=Ut.watcher(this,s),this.layouter=Ut.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=n.view,e||(this.selector=Ut.selector(this),this.interaction=Ut.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Ut.hitCanvasManager()),this.canvasManager=new $t,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),to.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(So.RESTART):this.emitLeafer(So.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(So.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,de);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Pt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=f.copyAttrs({},this.canvas,de);e.resize(t),this.updateLazyBounds(),this.__onResize(new bo(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,de),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new At(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(de.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&de.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=f.copyAttrs({},this.canvas,de);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(So.BEFORE_READY),this.emitLeafer(So.READY),this.emitLeafer(So.AFTER_READY),to.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(So.VIEW_READY),to.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){to.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(So.VIEW_COMPLETED),to.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Vt.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new So(t,this))}__listenEvents(){const t=Ht.start("FirstCreate "+this.innerName);this.once([[So.START,()=>Ht.end(t)],[Eo.START,this.updateLazyBounds,this],[Bo.START,this.__onCreated,this],[Bo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ko.DATA,this.__onWatchData,this],[Eo.END,this.__onLayoutEnd,this],[Bo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ll.list.remove(this);try{this.stop(),this.emitLeafer(So.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Pn.clearRecycled()},100)}catch(t){dl.error(t)}}};t?e():setTimeout(e)}};cl.list=new ja,Qt([gr(Yh)],cl.prototype,"__",void 0),Qt([qn()],cl.prototype,"pixelRatio",void 0),cl=ll=Qt([Br()],cl);let ul=class extends al{get __tag(){return"Rect"}constructor(t){super(t)}};Qt([gr(Uh)],ul.prototype,"__",void 0),ul=Qt([Er(rl),br(),Br()],ul);const{copy:_l,add:pl,includes:gl}=Ct,fl=ul.prototype,yl=hl.prototype,ml={};let vl=class extends hl{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;if(this.children.length){const e=this.__,{renderBounds:i,boxBounds:s}=this.__layout;super.__updateRenderBounds(),_l(ml,i),this.__updateRectRenderBounds(),(e.scrollY||e.scrollX)&&(ml.x+=e.scrollX,ml.y+=e.scrollY),t=!gl(s,ml),t&&"hide"!==e.overflow&&pl(i,ml)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__updateScrollBar()}__updateRectRenderBounds(){}__updateScrollBar(){}__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.scrollBar&&this.scrollBar.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};Qt([gr(Hh)],vl.prototype,"__",void 0),Qt([qn(100)],vl.prototype,"width",void 0),Qt([qn(100)],vl.prototype,"height",void 0),Qt([Un(!1)],vl.prototype,"resizeChildren",void 0),Qt([nr("show")],vl.prototype,"overflow",void 0),Qt([wr(fl.__updateStrokeSpread)],vl.prototype,"__updateStrokeSpread",null),Qt([wr(fl.__updateRenderSpread)],vl.prototype,"__updateRectRenderSpread",null),Qt([wr(fl.__updateBoxBounds)],vl.prototype,"__updateRectBoxBounds",null),Qt([wr(fl.__updateStrokeBounds)],vl.prototype,"__updateStrokeBounds",null),Qt([wr(fl.__updateRenderBounds)],vl.prototype,"__updateRectRenderBounds",null),Qt([wr(fl.__updateChange)],vl.prototype,"__updateRectChange",null),Qt([wr(fl.__render)],vl.prototype,"__renderRect",null),Qt([wr(yl.__render)],vl.prototype,"__renderGroup",null),vl=Qt([br(),Br()],vl);let xl=class extends vl{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};Qt([gr(Xh)],xl.prototype,"__",void 0),Qt([rr("#FFFFFF")],xl.prototype,"fill",void 0),Qt([nr("hide")],xl.prototype,"overflow",void 0),xl=Qt([Br()],xl);const{moveTo:wl,closePath:bl,ellipse:kl}=is;let El=class extends al{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:n,endAngle:r}=this.__,o=e/2,a=i/2,h=this.__.path=[];s?(n||r?(s<1&&kl(h,o,a,o*s,a*s,0,n,r,!1),kl(h,o,a,o,a,0,r,n,!0),s<1&&bl(h)):(s<1&&(kl(h,o,a,o*s,a*s),wl(h,e,a)),kl(h,o,a,o,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||r?(wl(h,o,a),kl(h,o,a,o,a,0,n,r,!1),bl(h)):kl(h,o,a,o,a)}};Qt([gr(jh)],El.prototype,"__",void 0),Qt([tr(0)],El.prototype,"innerRadius",void 0),Qt([tr(0)],El.prototype,"startAngle",void 0),Qt([tr(0)],El.prototype,"endAngle",void 0),El=Qt([Br()],El);const{moveTo:Bl,lineTo:Sl,drawPoints:Rl}=is,{rotate:Cl,getAngle:Ol,getDistance:Tl,defaultPoint:Ll}=K,{toBounds:Pl}=_n;let Ml=class extends al{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Cl(i,e),i}set toPoint(t){this.width=Tl(Ll,t),this.rotation=Ol(Ll,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Rl(e,t.points,!1,t.closed):(Bl(e,0,0),Sl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Rl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&kh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Pl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};Qt([gr(Vh)],Ml.prototype,"__",void 0),Qt([er("center")],Ml.prototype,"strokeAlign",void 0),Qt([qn(0)],Ml.prototype,"height",void 0),Qt([tr()],Ml.prototype,"points",void 0),Qt([tr(0)],Ml.prototype,"curve",void 0),Qt([tr(!1)],Ml.prototype,"closed",void 0),Ml=Qt([Br()],Ml);const{sin:Al,cos:Dl,PI:Il}=Math,{moveTo:Wl,lineTo:Fl,closePath:zl,drawPoints:Nl}=is,Hl=Ml.prototype;let Yl=class extends al{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Nl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,r=i/2;Wl(t,n,0);for(let e=1;e<s;e++)Fl(t,n+n*Al(2*e*Il/s),r-r*Dl(2*e*Il/s));zl(t)}}__updateRenderPath(){}__updateBoxBounds(){}};Qt([gr(Gh)],Yl.prototype,"__",void 0),Qt([tr(3)],Yl.prototype,"sides",void 0),Qt([tr()],Yl.prototype,"points",void 0),Qt([tr(0)],Yl.prototype,"curve",void 0),Qt([wr(Hl.__updateRenderPath)],Yl.prototype,"__updateRenderPath",null),Qt([wr(Hl.__updateBoxBounds)],Yl.prototype,"__updateBoxBounds",null),Yl=Qt([br(),Br()],Yl);const{sin:Xl,cos:Vl,PI:Ul}=Math,{moveTo:jl,lineTo:Gl,closePath:Kl}=is;let Zl=class extends al{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];jl(o,n,0);for(let t=1;t<2*i;t++)Gl(o,n+(t%2==0?n:n*s)*Xl(t*Ul/i),r-(t%2==0?r:r*s)*Vl(t*Ul/i));Kl(o)}};Qt([gr(Kh)],Zl.prototype,"__",void 0),Qt([tr(5)],Zl.prototype,"corners",void 0),Qt([tr(.382)],Zl.prototype,"innerRadius",void 0),Zl=Qt([Br()],Zl);let ql=class extends ul{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}constructor(t){super(t)}};Qt([gr(Qh)],ql.prototype,"__",void 0),Qt([qn("")],ql.prototype,"url",void 0),ql=Qt([Br()],ql);const Jl=ql;let $l=class extends ul{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Ut.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Fn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new go(go.LOADED,{image:t}))})}draw(t,e,i,s){const n=new et(t.worldTransform).invert(),r=new et;e&&r.translate(e.x,e.y),i&&(l(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};Qt([gr(tl)],$l.prototype,"__",void 0),Qt([yh(100)],$l.prototype,"width",void 0),Qt([yh(100)],$l.prototype,"height",void 0),Qt([yh(1)],$l.prototype,"pixelRatio",void 0),Qt([yh(!0)],$l.prototype,"smooth",void 0),Qt([Un(!1)],$l.prototype,"safeResize",void 0),Qt([yh()],$l.prototype,"contextSettings",void 0),$l=Qt([Br()],$l);const{copyAndSpread:Ql,includes:td,spread:ed,setList:id}=Ct;let sd=class extends al{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=bh.number(e,n),t.__letterSpacing=bh.number(i,n),t.__padding=l?b.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n}px ${s}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=xh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&ed(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!td(h,a)),this.isOverflow?(id(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ql(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Qt([gr($h)],sd.prototype,"__",void 0),Qt([qn(0)],sd.prototype,"width",void 0),Qt([qn(0)],sd.prototype,"height",void 0),Qt([rr()],sd.prototype,"boxStyle",void 0),Qt([Un(!1)],sd.prototype,"resizeFontSize",void 0),Qt([rr("#000000")],sd.prototype,"fill",void 0),Qt([er("outside")],sd.prototype,"strokeAlign",void 0),Qt([_r("all")],sd.prototype,"hitFill",void 0),Qt([qn("")],sd.prototype,"text",void 0),Qt([qn("")],sd.prototype,"placeholder",void 0),Qt([qn("caption")],sd.prototype,"fontFamily",void 0),Qt([qn(12)],sd.prototype,"fontSize",void 0),Qt([qn("normal")],sd.prototype,"fontWeight",void 0),Qt([qn(!1)],sd.prototype,"italic",void 0),Qt([qn("none")],sd.prototype,"textCase",void 0),Qt([qn("none")],sd.prototype,"textDecoration",void 0),Qt([qn(0)],sd.prototype,"letterSpacing",void 0),Qt([qn({type:"percent",value:1.5})],sd.prototype,"lineHeight",void 0),Qt([qn(0)],sd.prototype,"paraIndent",void 0),Qt([qn(0)],sd.prototype,"paraSpacing",void 0),Qt([qn("x")],sd.prototype,"writingMode",void 0),Qt([qn("left")],sd.prototype,"textAlign",void 0),Qt([qn("top")],sd.prototype,"verticalAlign",void 0),Qt([qn(!0)],sd.prototype,"autoSizeAlign",void 0),Qt([qn("normal")],sd.prototype,"textWrap",void 0),Qt([qn("show")],sd.prototype,"textOverflow",void 0),Qt([rr(!1)],sd.prototype,"textEditing",void 0),sd=Qt([Br()],sd);let nd=class extends al{get __tag(){return"Path"}constructor(t){super(t)}};Qt([gr(Zh)],nd.prototype,"__",void 0),Qt([er("center")],nd.prototype,"strokeAlign",void 0),nd=Qt([Br()],nd);let rd=class extends hl{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new nd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};Qt([gr(qh)],rd.prototype,"__",void 0),Qt([(t,e)=>{zn(t,e,{get(){return this.__path}})}],rd.prototype,"path",void 0),rd=Qt([Er(vs,["set","path","paint"]),Br()],rd);let od=class extends cl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&Ut.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new cl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e&&e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,de),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Eo.END,this.__onReady,this],[Bo.START,this.__onCreated,this],[Bo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Bo.END,this.__onChildRenderEnd,this))}};od=Qt([Br()],od);const ad={},hd={isHoldSpaceKey:()=>hd.isHold("Space"),isHold:t=>ad[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){ad[t]||(ad[t]=!0)},setUpCode(t){ad[t]=!1}},ld={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class dd extends uo{get spaceKey(){return hd.isHoldSpaceKey()}get left(){return ld.left(this)}get right(){return ld.right(this)}get middle(){return ld.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return hd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){qt.changeName(t,e)}}let cd=class extends dd{};cd.POINTER="pointer",cd.BEFORE_DOWN="pointer.before_down",cd.BEFORE_MOVE="pointer.before_move",cd.BEFORE_UP="pointer.before_up",cd.DOWN="pointer.down",cd.MOVE="pointer.move",cd.UP="pointer.up",cd.OVER="pointer.over",cd.OUT="pointer.out",cd.ENTER="pointer.enter",cd.LEAVE="pointer.leave",cd.TAP="tap",cd.DOUBLE_TAP="double_tap",cd.CLICK="click",cd.DOUBLE_CLICK="double_click",cd.LONG_PRESS="long_press",cd.LONG_TAP="long_tap",cd.MENU="pointer.menu",cd.MENU_TAP="pointer.menu_tap",cd=Qt([Sr()],cd);const ud=cd,_d={};let pd=class extends cd{static setList(t){this.list=t instanceof ja?t:new ja(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return K.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),n}static limitMove(t,e){const{draggable:i,dragBounds:s}=t;s&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===s?t.parent.boxBounds:s,e,!0),"x"===i&&(e.y=0),"y"===i&&(e.x=0)}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,r=t.y+i.y,o=n+t.width,a=r+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),Ct.includes(t,e)?(n>e.x?i.x+=e.x-n:o<h&&(i.x+=h-o),r>e.y?i.y+=e.y-r:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:o>h&&(i.x+=h-o),r<e.y?i.y+=e.y-r:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(_d,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(_d,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(_d,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Ct.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ct.unsign(i),i}assignMove(t){_d.x=t?this.totalX:this.moveX,_d.y=t?this.totalY:this.moveY}};pd.BEFORE_DRAG="drag.before_drag",pd.START="drag.start",pd.DRAG="drag",pd.END="drag.end",pd.OVER="drag.over",pd.OUT="drag.out",pd.ENTER="drag.enter",pd.LEAVE="drag.leave",pd=Qt([Sr()],pd);const gd=pd;let fd=class extends cd{static setList(t){pd.setList(t)}static setData(t){pd.setData(t)}};fd.DROP="drop",fd=Qt([Sr()],fd);let yd=class extends pd{};yd.BEFORE_MOVE="move.before_move",yd.START="move.start",yd.MOVE="move",yd.END="move.end",yd=Qt([Sr()],yd);let md=class extends cd{};md.BEFORE_ROTATE="rotate.before_rotate",md.START="rotate.start",md.ROTATE="rotate",md.END="rotate.end",md=Qt([Sr()],md);let vd=class extends pd{};vd.SWIPE="swipe",vd.LEFT="swipe.left",vd.RIGHT="swipe.right",vd.UP="swipe.up",vd.DOWN="swipe.down",vd=Qt([Sr()],vd);let xd=class extends cd{};xd.BEFORE_ZOOM="zoom.before_zoom",xd.START="zoom.start",xd.ZOOM="zoom",xd.END="zoom.end",xd=Qt([Sr()],xd);let wd=class extends dd{};wd.BEFORE_DOWN="key.before_down",wd.BEFORE_UP="key.before_up",wd.DOWN="key.down",wd.HOLD="key.hold",wd.UP="key.up",wd=Qt([Sr()],wd);const bd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?vd.UP:t>45&&t<135?vd.DOWN:t<=45&&t>=-45?vd.RIGHT:vd.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:kd.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new ja,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>Fr.draggable(t)||!t.isLeafer&&t.hasEvent(pd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},kd=bd,Ed=new ja,{getDragEventData:Bd,getDropEventData:Sd,getSwipeEventData:Rd}=bd;class Cd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Bd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=pd.list||this.draggableList||Ed;return this.dragging&&(s?t?Ed:new ja(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(yd.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&ld.left(t),this.dragging&&(this.interaction.emit(pd.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],Fr.draggable(e)){this.draggableList=new ja(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:r}=s;this.dragData=Bd(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",e.emit(yd.BEFORE_MOVE,this.dragData),e.emit(yd.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(pd.BEFORE_DRAG,this.dragData),e.emit(pd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:r}=e.p,o=!r||!!t;s.forEach(e=>{if(e.draggable){const s=pd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},o);r&&t?Fr.animateMove(e,s,l(r)?r:.3):e.move(s)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(pd.OUT,t,i),e.emit(pd.OVER,t,s)):e.emit(pd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(pd.LEAVE,t,i,s),e.emit(pd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:r}=i,o=Bd(i,t,t);if(r&&(o.throughPath=r),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",e.emit(yd.END,o)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(pd.END,o),this.swipe(t,i,s,o),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(K.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Rd(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Sd(t,e,pd.data);s.path=i,this.interaction.emit(fd.DROP,s),this.interaction.emit(pd.LEAVE,t,i)}dragReset(){pd.list=pd.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Od=Wt.get("emit");const Td=["move","zoom","rotate","key"];function Ld(t,e,i,s,n){if(Td.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Md(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Pd(r,e,i,s,n)}}function Pd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Md(t,n)&&(Th.updateEventStyle&&!s&&Th.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=qt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Md(t,e){return e&&e.has(t)}const Ad={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Dd,pathCanDrag:Id,pathHasOutside:Wd}=bd;class Fd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&ld.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&ld.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&hd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Ad),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ja(t),this.createTransformer(),this.dragger=new Cd(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(ld.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(cd.BEFORE_DOWN,t),this.emit(cd.DOWN,t),ld.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=ld.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&ld.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(cd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=K.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(cd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;ld.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(cd.BEFORE_UP,t),this.emit(cd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(cd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(cd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(wd.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,hd.setDownCode(e),this.emit(wd.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(wd.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(wd.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,hd.setUpCode(e),this.emit(wd.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ja),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(cd.OUT,t,i),this.emit(cd.OVER,t,e)):this.emit(cd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(cd.LEAVE,t,i,e),this.emit(cd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(cd.LEAVE,t),this.dragger.dragging&&this.emit(fd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[cd.DOUBLE_TAP,cd.DOUBLE_CLICK].some(e=>Dd(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:n}=this.p,{bottomList:r,target:o}=this;t.backgrounder||e.origin||o&&o.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:r,name:e.type},i||{through:n}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Wd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Id(t.path))&&!Wd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:cd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&K.round(s),s}emitTap(t){this.emit(cd.TAP,t),this.emit(cd.CLICK,t)}emitDoubleTap(t){this.emit(cd.DOUBLE_TAP,t),this.emit(cd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(cd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(cd.LONG_TAP,t),(Dd(t.path,cd.LONG_TAP)||Dd(t.path,cd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Pt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(bo.RESIZE,this.__onResize,this)],t.once(So.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Pd(n,t,e,!0,s))return;n.isApp&&Ld(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Ld(n,t,e,!1,s),Pd(n,t,e,!1,s))return}catch(t){Od.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class zd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}zd.custom={};class Nd extends $t{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ja,this.pixelList=new ja}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Ut.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Ut.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Ut.selector())};const{toInnerRadiusPointOf:Hd,copy:Yd,setRadius:Xd}=K,{hitRadiusPoint:Vd,hitPoint:Ud}=Ct,jd={},Gd={},Kd=Da.prototype;Kd.hit=function(e,i=0){this.updateLayout(),Yd(Gd,e),Xd(Gd,i);const s=this.__world;return!!(i?Vd(s,Gd):Ud(s,Gd))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},Gd),i,{target:this}):this.__hitWorld(Gd))},Kd.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Yd(jd,t),Xd(t=jd,e.hitRadius)),Hd(t,i,jd),e.hitBox||n){if(Ct.hitRadiusPoint(s.boxBounds,jd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(jd)},Kd.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Kd.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Kd.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Kd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Zd=new et,qd=al.prototype;qd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,n=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,r=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,o=n||r;this.__hitCanvas||(this.__hitCanvas=o?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(o){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,o=a.hitScale=Mt.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=Mt.set(e).scale(o);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Pn.patternLocked=!0,this.__renderShape(a,{matrix:Zd.setWith(this.__world).scaleWith(1/o).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!r}),Pn.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},qd.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Jd=al.prototype,$d=ul.prototype,Qd=vl.prototype;$d.__updateHitCanvas=Qd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Jd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},$d.__hitFill=Qd.__hitFill=function(t){return this.__hitCanvas?Jd.__hitFill.call(this,t):Ct.hitRadiusPoint(this.__layout.boxBounds,t)},sd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},hl.prototype.pick=function(e,i){return i||(i=n),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const tc=ce.prototype;function ec(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let r;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)r=s[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(n){const{decorationColor:t,decorationHeight:r}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,r)))}}function ic(t,e){t.__.__font?ec(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function sc(t,e,i){switch(e.__.strokeAlign){case"center":nc(t,1,e,i);break;case"inside":rc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?nc(t,2,e,i):rc(t,"outside",e,i)}}function nc(t,e,i,s){const n=i.__;_(t)?ac(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),oc(i,s))}function rc(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,nc(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",ec(i,n),n.blendMode="normal",Fr.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function oc(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(r){const{decorationHeight:t}=s;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function ac(t,e,i,s,n){let r;const o=s.__,{__hasMultiStrokeStyle:a}=o;a||n.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,l=t.length;h<l;h++)if(r=t[h],(!r.image||!Bh.checkImage(s,n,r,!1))&&r.style){if(a){const{strokeStyle:t}=r;t?n.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(r.style,o.__strokeWidth*e,o)}else n.strokeStyle=r.style;r.blendMode?(n.saveBlendMode(r.blendMode),i?oc(s,n):n.stroke(),n.restoreBlendMode()):i?oc(s,n):n.stroke()}}function hc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)sc(t,e,i);else switch(s.strokeAlign){case"center":lc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),lc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)lc(t,2,e,i);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),lc(t,2,e,r),r.clipUI(s),r.clearWorld(n),Fr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i)}}function lc(t,e,i,s){const n=i.__;_(t)?ac(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Eh.strokeArrow(t,i,s)}tc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},tc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},tc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Mt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Mt.x,Mt.y,Mt.width||1,Mt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:dc,getOuterOf:cc,getByMove:uc,getIntersectData:_c}=Ct;let pc;const{stintSet:gc}=f,{hasTransparent:fc}=wh;function yc(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Bh.image(i,t,e,n,!pc||!pc[e.url]);break;case"linear":s=Sh.linearGradient(e,n);break;case"radial":s=Sh.radialGradient(e,n);break;case"angular":s=Sh.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:wh.string(a,h)};break;default:r(e.r)||(s={type:"solid",style:wh.string(e)})}if(s){if(a(s.style)&&fc(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const mc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),pc=Bh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=yc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(gc(i,"__isAlphaPixelFill",n),gc(i,"__isTransparentFill",r)):(gc(i,"__isAlphaPixelStroke",n),gc(i,"__isTransparentStroke",r),gc(i,"__hasMultiStrokeStyle",o))},fill:function(t,e,i){i.fillStyle=t,ic(e,i)},fills:function(t,e,i){let s;for(let n=0,r=t.length;n<r;n++){if(s=t[n],s.image){if(Bh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),ic(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),ic(e,i),i.restoreBlendMode()):ic(e,i)}},fillPathOrText:ic,fillText:ec,stroke:hc,strokes:function(t,e,i){hc(t,e,i)},strokeText:sc,drawTextStroke:oc,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let r,o,a,h,l,{scaleX:d,scaleY:c}=n;if(d<0&&(d=-d),c<0&&(c=-c),e.bounds.includes(n))l=s,r=h=n;else{const{renderShapeSpread:s}=t.__layout,u=_c(s?dc(e.bounds,d===c?s*d:[s*c,s*d]):e.bounds,n);a=e.bounds.getFitMatrix(u);let{a:_,d:p}=a;a.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,i),d*=_,c*=p),h=cc(n,a),r=uc(h,-a.e,-a.f);const g=i.matrix;g?(o=new et(a),o.multiply(g),_*=g.scaleX,p*=g.scaleY):o=a,o.withScale(_,p),i=Object.assign(Object.assign({},i),{matrix:o})}return t.__renderShape(s,i),{canvas:s,matrix:o,fitMatrix:a,bounds:r,worldCanvas:l,shapeBounds:h,scaleX:d,scaleY:c}}};let vc={},xc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:wc,rotateOfOuter:bc,translate:kc,scaleOfOuter:Ec,multiplyParent:Bc,scale:Sc,rotate:Rc,skew:Cc}=W;function Oc(t,e,i,s,n,r,o){const a=wc();kc(a,e.x+i,e.y+s),Sc(a,n,r),o&&bc(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function Tc(t,e,i,s,n,r,o,a,h){const l=wc();Pc(l,e,i,s,n,r,o,a),h&&(xc.a=e.width/h.width,xc.d=e.height/h.height,Bc(l,xc)),t.transform=l}function Lc(t,e,i,s,n,r,o,a,h,l,d,c){const u=wc();if(c)Pc(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)bc(u,{x:i/2,y:s/2},h);else switch(Rc(u,h),h){case 90:kc(u,s,0);break;case 180:kc(u,i,s);break;case 270:kc(u,0,i)}vc.x=e.x+n,vc.y=e.y+r,kc(u,vc.x,vc.y),o&&Ec(u,vc,o,a)}t.transform=u}function Pc(t,e,i,s,n,r,o,a){o&&Rc(t,o),a&&Cc(t,a.x,a.y),n&&Sc(t,n,r),kc(t,e.x+i,e.y+s)}const{get:Mc,translate:Ac}=W,Dc=new Pt,Ic={},Wc={};function Fc(t,e,i,s){const{changeful:n,sync:r,scaleFixed:o}=i;n&&(t.changeful=n),r&&(t.sync=r),o&&(t.scaleFixed=o),t.data=zc(i,s,e)}function zc(t,e,i){t.padding&&(e=Dc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:r,mode:o,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,x={mode:o},w="center"!==h&&(u||0)%180==90;let k,E;switch(Ct.set(Wc,0,0,w?n:s,w?s:n),o&&"cover"!==o&&"fit"!==o?((d||c)&&(b.getScaleData(d,c,i,Ic),k=Ic.scaleX,E=Ic.scaleY),(h||y||f)&&(k&&Ct.scale(Wc,k,E,!0),h&&ct.toPoint(h,Wc,e,Wc,!0,!0))):v&&!u||(k=E=Ct.getFitScale(e,Wc,"fit"!==o),Ct.put(e,i,h,k,!1,Wc),Ct.scale(Wc,k,E,!0)),l&&K.move(Wc,l),o){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(Wc.x||Wc.y||k||g||u||p)&&Tc(x,e,Wc.x,Wc.y,k,E,u,p,t.clipSize);break;case"repeat":(!v||k||u||p)&&Lc(x,e,s,n,Wc.x,Wc.y,k,E,u,p,h,t.freeTransform),f||(x.repeat="repeat");const i=_(f);(y||i)&&(x.gap=function(t,e,i,s,n){let r,o;_(t)?(r=t.x,o=t.y):r=o=t;return{x:Nc(r,i,n.width,e&&e.x),y:Nc(o,s,n.height,e&&e.y)}}(y,i&&f,Wc.width,Wc.height,e));break;default:k&&Oc(x,e,Wc.x,Wc.y,k,E,u)}return x.transform||(e.x||e.y)&&(x.transform=Mc(),Ac(x.transform,e.x,e.y)),k&&"stretch"!==o&&(x.scaleX=k,x.scaleY=E),x.width=s,x.height=n,r&&(x.opacity=r),m&&(x.filters=m),f&&(x.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x}function Nc(t,e,i,s){const n=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Hc,Yc=new Pt;const{isSame:Xc}=Ct;function Vc(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Fc(n,s,i,r),!0}function Uc(t,e){Kc(t,go.LOAD,e)}function jc(t,e){Kc(t,go.LOADED,e)}function Gc(t,e,i){e.error=i,t.forceUpdate("surface"),Kc(t,go.ERROR,e)}function Kc(t,e,i){t.hasEvent(e)&&t.emitEvent(new go(e,i))}function Zc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:qc,scale:Jc,copy:$c}=W,{floor:Qc,max:tu,abs:eu}=Math;function iu(e,i,s){let{scaleX:n,scaleY:r}=e.getRenderScaleData(!0,i.scaleFixed);const o=n+"-"+r+"-"+s;if(i.patternId===o||e.destroyed)return!1;{const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g,gap:f}=a;n*=s,r*=s;const y=f&&f.x*n,m=f&&f.y*r;u&&(u=eu(u),_=eu(_),l=qc(),$c(l,p),Jc(l,1/u,1/_),n*=u,r*=_),d*=n,c*=r;const v=d*c;if(!g&&v>t.image.maxCacheSize)return!1;let x=t.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;x>t&&(x=t)}if(v>x&&(h=Math.sqrt(v/x)),h&&(n/=h,r/=h,d/=h,c/=h),u&&(n/=u,r/=_),(p||1!==n||1!==r)&&(l||(l=qc(),p&&$c(l,p)),Jc(l,1/n,1/r)),l){const t=d+(y||0),e=c+(m||0);Jc(l,t/tu(Qc(t),1),e/tu(Qc(e),1))}const w=e.getCanvas(d,c,a.opacity,a.filters,y,m),b=e.getPattern(w,g||t.origin.noRepeat||"no-repeat",l,i);return i.style=b,i.patternId=o,!0}}const su={image:function(t,e,i,s,n){let r,o;const a=Pn.get(i);return Hc&&i===Hc.paint&&Xc(s,Hc.boxBounds)?r=Hc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Hc=a.use>1?{leafPaint:r,paint:i,boxBounds:Yc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Vc(t,e,i,a,r,s),n&&(Uc(t,o),jc(t,o))):a.error?n&&Gc(t,o,a.error):(n&&(Zc(t,!0),Uc(t,o)),r.loadId=a.load(()=>{Zc(t,!1),t.destroyed||(Vc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),jc(t,o)),r.loadId=void 0},e=>{Zc(t,!1),Gc(t,o,e),r.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(e,i,s,n){const{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+a&&!Oh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===t.name&&bo.isResizing(e)||Oh.running)){let{width:e,height:i}=h;e*=r*a,i*=o*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),n=e*i>t.image.maxCacheSize}return n?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||Oh.running?iu(e,s,a):s.patternTask||(s.patternTask=Pn.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&iu(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:iu,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,Pn.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createData:Fc,getPatternData:zc,fillOrFitMode:Oc,clipMode:Tc,repeatMode:Lc},{toPoint:nu}=ht,{hasTransparent:ru}=wh,ou={},au={};function hu(t,e,i,s){if(i){let n,r,o,h;for(let t=0,l=i.length;t<l;t++)n=i[t],a(n)?(o=t/(l-1),r=wh.string(n,s)):(o=n.offset,r=wh.string(n.color,s)),e.addColorStop(o,r),!h&&ru(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:lu,getDistance:du}=K,{get:cu,rotateOfOuter:uu,scaleOfOuter:_u}=W,{toPoint:pu}=ht,gu={},fu={};function yu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=lu(e,i);r=cu(),n?(_u(r,e,o/a*(s||1),1),uu(r,e,t+90)):(_u(r,e,1,o/a*(s||1)),uu(r,e,t))}return r}const{getDistance:mu}=K,{toPoint:vu}=ht,xu={},wu={};const bu={linearGradient:function(e,i){let{from:s,to:n,type:r,opacity:o}=e;nu(s||"top",i,ou),nu(n||"bottom",i,au);const a=t.canvas.createLinearGradient(ou.x,ou.y,au.x,au.y),h={type:r,style:a};return hu(h,a,e.stops,o),h},radialGradient:function(e,i){let{from:s,to:n,type:r,opacity:o,stretch:a}=e;pu(s||"center",i,gu),pu(n||"bottom",i,fu);const h=t.canvas.createRadialGradient(gu.x,gu.y,0,gu.x,gu.y,du(gu,fu)),l={type:r,style:h};hu(l,h,e.stops,o);const d=yu(i,gu,fu,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:n,type:r,opacity:o,stretch:a}=e;vu(s||"center",i,xu),vu(n||"bottom",i,wu);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,xu.x,xu.y):t.canvas.createRadialGradient(xu.x,xu.y,0,xu.x,xu.y,mu(xu,wu)),l={type:r,style:h};hu(l,h,e.stops,o);const d=yu(i,xu,wu,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:yu},{copy:ku,toOffsetOutBounds:Eu}=Ct,Bu={},Su={};function Ru(e,i,s,n){const{bounds:r,shapeBounds:o}=n;if(t.fullImageShadow){if(ku(Bu,e.bounds),Bu.x+=i.x-o.x,Bu.y+=i.y-o.y,s){const{fitMatrix:t}=n;Bu.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),Bu.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),Bu.width*=s,Bu.height*=s}e.copyWorld(n.canvas,e.bounds,Bu)}else s&&(ku(Bu,i),Bu.x-=i.width/2*(s-1),Bu.y-=i.height/2*(s-1),Bu.width*=s,Bu.height*=s),e.copyWorld(n.canvas,o,s?Bu:i)}const{toOffsetOutBounds:Cu}=Ct,Ou={};const Tu={shadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Eu(l,Su),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Su.offsetX+a.x*c*f,Su.offsetY+a.y*u*f,a.blur*c*f,wh.string(a.color)),n=a.spread?1+2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0))*f:0,Ru(_,Su,n,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,r,"copy"),s=r),h?_.copyWorld(h,r,r,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),Fr.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s,!0)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Cu(l,Ou),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Ou.offsetX+a.x*c*f,Ou.offsetY+a.y*u*f,a.blur*c*f),n=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0))*f:0,Ru(_,Ou,n,i),_.restore(),h?(_.copyWorld(_,l,r,"copy"),_.copyWorld(h,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,wh.string(a.color),"source-in"),Fr.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s,!0)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Lu}=jr;let Pu;function Mu(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Pu||(Pu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);Du(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":Du(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Au(t){return t.getSameCanvas(!1,!0)}function Du(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o,!0)}hl.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(Mu(this,o,t,n,s,r,void 0,!0),s=n=null),r=i.__.opacity,Pu=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Au(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Au(t)),n||(n=Au(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||Lu(i,e)||i.__render(t,e);continue}const d=1===r&&i.__.__blendMode;d&&Mu(this,o,t,n,s,r,void 0,!1),Lu(i,e)||i.__render(n||t,e),d&&Mu(this,o,t,n,s,r,d,!1)}Mu(this,o,t,n,s,r,void 0,!0)};const Iu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Wu=Iu+"_#~&*+\\=|≮≯≈≠=…",Fu=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 zu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Nu=zu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Hu=zu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Yu=zu(Iu),Xu=zu(Wu),Vu=zu("- —/~|┆·");var Uu;!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"}(Uu||(Uu={}));const{Letter:ju,Single:Gu,Before:Ku,After:Zu,Symbol:qu,Break:Ju}=Uu;function $u(t){return Nu[t]?ju:Vu[t]?Ju:Hu[t]?Ku:Yu[t]?Zu:Xu[t]?qu:Fu.test(t)?Gu:ju}const Qu={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function t_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:e_}=Qu,{Letter:i_,Single:s_,Before:n_,After:r_,Symbol:o_,Break:a_}=Uu;let h_,l_,d_,c_,u_,__,p_,g_,f_,y_,m_,v_,x_,w_,b_,k_,E_,B_=[];function S_(t,e){f_&&!g_&&(g_=f_),h_.data.push({char:t,width:e}),d_+=e}function R_(){c_+=d_,h_.width=d_,l_.words.push(h_),h_={data:[]},d_=0}function C_(){w_&&(b_.paraNumber++,l_.paraStart=!0,w_=!1),f_&&(l_.startCharSize=g_,l_.endCharSize=f_,g_=0),l_.width=c_,k_.width?e_(l_):E_&&O_(),B_.push(l_),l_={words:[]},c_=0}function O_(){c_>(b_.maxWidth||0)&&(b_.maxWidth=c_)}const{top:T_,right:L_,bottom:P_,left:M_}=rt;function A_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const D_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,n=0,r=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(r?(s=d[M_],r-=d[L_]+d[M_]):i.autoSizeAlign||(s=d[M_]),o?(n=d[T_],o-=d[T_]+d[P_]):i.autoSizeAlign||(n=d[T_]));const c={bounds:{x:s,y:n,width:r,height:o},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){b_=e,B_=e.rows,k_=e.bounds,E_=!k_.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:o}=s,{canvas:a}=t,{width:h,height:l}=k_;if(h||l||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;w_=!0,m_=null,g_=p_=f_=d_=c_=0,h_={data:[]},l_={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)__=i[s],"\n"===__?(d_&&R_(),l_.paraEnd=!0,C_(),w_=!0):(y_=$u(__),y_===i_&&"none"!==o&&(__=t_(__,o,!d_)),p_=a.measureText(__).width,n&&(n<0&&(f_=p_),p_+=n),v_=y_===s_&&(m_===s_||m_===i_)||m_===s_&&y_!==r_,x_=!(y_!==n_&&y_!==s_||m_!==o_&&m_!==r_),u_=w_&&r?h-r:h,t&&h&&c_+d_+p_>u_&&(e?(d_&&R_(),c_&&C_()):(x_||(x_=y_===i_&&m_==r_),v_||x_||y_===a_||y_===n_||y_===s_||d_+p_>u_?(d_&&R_(),c_&&C_()):c_&&C_()))," "===__&&!0!==w_&&c_+d_===0||(y_===a_?(" "===__&&d_&&R_(),S_(__,p_),R_()):v_||x_?(d_&&R_(),S_(__,p_)):S_(__,p_)),m_=y_);d_&&R_(),c_&&C_(),B_.length>0&&(B_[B_.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{b_.paraNumber++,c_=a.measureText(t).width,B_.push({x:r||0,text:t,width:c_,paraStart:!0}),E_&&O_()})}(c,e,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":A_(e,"x",t[M_]);break;case"right":A_(e,"x",-t[L_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":A_(e,"y",t[T_]);break;case"bottom":A_(e,"y",-t[P_])}}(d,c,i,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-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,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,r),c.overflow&&function(e,i,s,n){if(!n)return;const{rows:r,overflow:o}=e;let{textOverflow:a}=i;if(r.splice(o),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?r:[r[o-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+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,i,s,r),"none"!==h&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,_(n)?(i=n.type,n.color&&(t.decorationColor=wh.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const I_={string:function(t,e){const i=l(e)&&e<1;if(a(t)){if(!i||!wh.object)return t;t=wh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function W_(t){return t?u(t)?t:[t]:[]}Object.assign(xh,D_),Object.assign(wh,I_),Object.assign(Eh,mc),Object.assign(Bh,su),Object.assign(Sh,bu),Object.assign(Rh,Tu),Object.assign(Ut,{interaction:(t,e,i,s)=>new Fd(t,e,i,s),hitCanvas:(t,e)=>new Za(t,e),hitCanvasManager:()=>new Nd}),Ja();class F_ extends uo{get list(){return W_(this.value)}get oldList(){return W_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function z_(t){return(e,i)=>{const s="_"+i;zn(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){if(this.config){const t="target"===i;if(t){u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(_(i))e=i;else if(!1===i)return}}const s=t?F_.BEFORE_SELECT:F_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new F_(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}F_.BEFORE_SELECT="editor.before_select",F_.SELECT="editor.select",F_.AFTER_SELECT="editor.after_select",F_.BEFORE_HOVER="editor.before_hover",F_.HOVER="editor.hover";const{abs:N_}=Math,{copy:H_,scale:Y_}=W,{setListWithFn:X_}=Ct,{worldBounds:V_}=jr,U_={a:1,b:0,c:0,d:1,e:0,f:0},j_={x:0,y:0,width:0,height:0};class G_ extends al{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(X_(j_,e,V_),t&&this.set(t),this.set(j_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:o,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=N_(c.scaleX),l=N_(c.scaleY);if(H_(U_,c),U_.half=o%2,i!==l){Y_(U_,1/i,1/l),t.setWorld(U_,e.matrix),t.beginPath(),n.strokeWidth=o;const{x:r,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(r*i,a*l,h*i,d*l)}else t.setWorld(U_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=o/N_(c.scaleX);r&&(a(r)?Eh.stroke(r,this,t):Eh.strokes(r,this,t)),h&&(a(h)?Eh.fill(h,this,t):Eh.fills(h,this,t))}}n.strokeWidth=o}}destroy(){this.target=null,super.destroy()}}Qt([z_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],G_.prototype,"target",void 0);class K_ extends hl{constructor(t){super(t),this.strokeArea=new ul({strokeAlign:"center"}),this.fillArea=new ul,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Z_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return q_([t],i,e),i}};function q_(t,e,i){let s,n;for(let r=0,o=t.length;r<o;r++)if(s=t[r],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&q_(s.children,e,i)}}const{findOne:J_,findByBounds:$_}=Z_;class Q_ extends hl{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new G_,this.targetStroker=new G_,this.bounds=new Pt,this.selectArea=new K_,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:n}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},n||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new ja($_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!J_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new ja(this.editor.editBox.rect)};return J_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):J_(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[F_.HOVER,this.onHover,this],[F_.SELECT,this.onSelect,this]]),e.on_([[cd.MOVE,this.onPointerMove,this],[cd.BEFORE_DOWN,this.onBeforeDown,this],[cd.TAP,this.onTap,this],[pd.START,this.onDragStart,this,!0],[pd.DRAG,this.onDrag,this],[pd.END,this.onDragEnd,this],[yd.MOVE,this.onAutoMove,this],[[xd.ZOOM,yd.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:tp,top:ep,topRight:ip,right:sp,bottomRight:np,bottom:rp,bottomLeft:op,left:ap}=ot,{toPoint:hp}=ht,{within:lp}=b,dp={getScaleData(t,e,i,s,n,r,o,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:p,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;r&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,x=t.scaleY/e.scaleY,w=v<0?-1:1,b=x<0?-1:1,k=a?v:w*u.width/y,E=a?x:b*u.height/m;s.x*=a?v:w,s.y*=a?x:b;const B=(-s.y+m)/m,S=(s.x+y)/y,R=(s.y+m)/m,C=(-s.x+y)/y;switch(i){case ep:c=B,h="bottom";break;case sp:d=S,h="left";break;case rp:c=R,h="top";break;case ap:d=C,h="right";break;case tp:c=B,d=C,h="bottom-right";break;case ip:c=B,d=S,h="bottom-left";break;case np:c=R,d=S,h="top-left";break;case op:c=R,d=C,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case ep:case rp:t=c;break;case ap:case sp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const O=1!==d,T=1!==c;if(O&&(d/=k),T&&(c/=E),!o){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(hp(r||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new Pt(t.__localBoxBounds);if(Ct.includes(new Pt(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Ct.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;O&&(d*=s),T&&(c*=n)}}if(O&&_){const e=u.width*t.scaleX;d=lp(e*d,_)/e}if(T&&p){const e=u.height*t.scaleY;c=lp(e*c,p)/e}return O&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),T&&Math.abs(c*f.height)<1&&(c=(c<0?-1:1)/f.height),n&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case tp:r="bottom-right";break;case ip:r="bottom-left";break;case np:r="top-left";break;case op:r="top-right";break;default:r="center"}return hp(n||r,t.boxBounds,o,!0),{origin:o,rotation:K.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case ep:case tp:r={x:.5,y:0},n="bottom",a=1;break;case rp:case np:r={x:.5,y:1},n="top",a=1;break;case ap:case op:r={x:0,y:.5},n="right",h=1;break;case sp:case ip:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,hp(s||n,t,o,!0);const c=K.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case ap:t=sp;break;case tp:t=ip;break;case op:t=np;break;case sp:t=ap;break;case ip:t=tp;break;case np:t=op}if(i)switch(t){case ep:t=rp;break;case tp:t=op;break;case ip:t=np;break;case rp:t=ep;break;case op:t=tp;break;case np:t=ip}return t}},cp={};function up(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:_,rotateable:p,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&p&&(t.isHoldRotateKey(e)||!_)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?n?u:r?d:c:y?u:f?d:c;h+=45*(dp.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(b.formatRotation(h,!0)/2);const{url:v,x:x,y:w}=m,k=v+h;cp[k]?i.cursor=cp[k]:cp[k]=i.cursor={url:pp(v,h),x:x,y:w}}function _p(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function pp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class gp extends vl{constructor(t){super(t),this.useFastShadow=!0}}const fp=["top","right","bottom","left"],yp=void 0;class mp extends hl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}constructor(t){super(),this.view=new hl,this.rect=new vl({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new gp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new hl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:r,resizeLines:o,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new gp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new gp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new gp({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...r,a,h,l,...o,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:r}=this,{stroke:o,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;this.visible=!t.locked;for(let t=0;t<8;t++)d=r[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;n.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:o,strokeWidth:a,editConfig:yp},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),_p(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:n,circle:r,buttons:o,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{middlePoint:c,resizeable:u,rotateable:_,hideOnSmall:p,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Ct.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=l(p)?p:10,x=g&&!(p&&e<y&&f<y);let w,b,k,E={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,E),b=a[i],w=h[i],b.set(E),w.set(E),b.visible=x&&!(!u&&!_),w.visible=x&&_&&u&&!m,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=b.visible&&!v,b.visible=w.visible=x&&!!c,(i+1)/2%2?(k.width=e,p&&2*b.width>e&&(b.visible=!1)):(k.height=f,p&&2*b.width>f&&(b.visible=!1)));r.visible=x&&_&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||g})),o.visible=x&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=fp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=fp.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?dp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:yp};return t?Object.assign(o,t):o}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:n}=this,{target:r}=this,{moveable:o,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(o&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||this.isHoldRotateKey(t)||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),n.x=t.x,n.y=t.y,n.point={x:r.x,y:r.y},n.bounds=Object.assign({},r.getLayoutBounds("box","local")),n.rotation=r.rotation,i&&i.includes("resize")&&(bo.resizingKeys=s.leafList.keys)}onDragEnd(t){this.mergeConfig.dragLimitAnimate&&this.moving&&this.transformTool.onMove(t),this.dragPoint=null,this.resetDoing();const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(bo.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t),_p(this);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&e.onSkew(t),up(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onScale(t){this.canGesture&&(t.stop(),a(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){up(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":e=-n;break;case"ArrowRight":e=n}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof sd)||t.find(t=>t instanceof sd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e;const s=[[pd.START,this.onDragStart,this],[pd.DRAG,this.onDrag,this],[pd.END,this.onDragEnd,this],[cd.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&s.push([cd.ENTER,e=>{this.enterPoint=t,up(this,e)}]),this.__eventIds.push(t.on_(s))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[pd.START,this.onDragStart,this],[pd.DRAG,this.onDrag,this],[pd.END,this.onDragEnd,this],[cd.ENTER,()=>_p(this)],[cd.DOUBLE_TAP,this.onDoubleTap,this],[cd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[wd.HOLD,wd.UP],this.onKey,this],[wd.DOWN,this.onArrow,this],[yd.BEFORE_MOVE,this.onMove,this,!0],[xd.BEFORE_ZOOM,this.onScale,this,!0],[md.BEFORE_ROTATE,this.onRotate,this,!0],[yd.END,this.resetDoing,this],[xd.END,this.resetDoing,this],[md.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const vp={x:0,y:0,width:1e5,height:1e5};class xp extends al{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,vp),Object.assign(this.__world,vp)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const wp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',bp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${wp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${wp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${wp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},kp=new Pt;function Ep(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{kp.setListWithFn(i,t=>t.getBounds("box","page")),0===kp.width&&(kp.width=.1),0===kp.height&&(kp.height=.1),e.reset(kp.get())}),s.add(e)}const Bp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Sp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Rp={group(t,e,i){t.sort(Sp);const{app:s,parent:n}=t[0];let r;r=i&&i.add?i:new hl(i),n.addAt(r,n.children.indexOf(t[0])),t.sort(Bp);const o=new et(e.worldTransform);return o.divideParent(n.worldTransform),r.setTransform(o),r.editable=!0,r.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(r)),s.unlockLayout(),r},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(Bp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Sp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},Cp=Wt.get("EditToolCreator");function Op(){return t=>{Lp.register(t)}}const Tp=Op,Lp={list:{},register(t){const{tag:e}=t.prototype;Pp[e]&&Cp.repeat(e),Pp[e]=t},get:(t,e)=>new Pp[t](e)},{list:Pp}=Lp;class Mp extends F_{constructor(t,e){super(t,e)}}Mp.BEFORE_OPEN="innerEditor.before_open",Mp.OPEN="innerEditor.open",Mp.BEFORE_CLOSE="innerEditor.before_close",Mp.CLOSE="innerEditor.close";class Ap extends F_{constructor(t,e){super(t,e)}}Ap.BEFORE_GROUP="editor.before_group",Ap.GROUP="editor.group",Ap.BEFORE_UNGROUP="editor.before_ungroup",Ap.UNGROUP="editor.ungroup",Ap.BEFORE_OPEN="editor.before_open_group",Ap.OPEN="editor.open_group",Ap.BEFORE_CLOSE="editor.before_close_group",Ap.CLOSE="editor.close_group";const{updateMatrix:Dp}=Fr,Ip={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Wp="top-left";class Fp extends ul{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(po.CHANGE,e=>{if(this.checkChange&&Ip[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,Dp(this.parent),Dp(this);const a=new et(this.__world);switch(o[i]=s,this.__layout.rotationChange(),Dp(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Wp,r);break;case"scaleX":t.scaleOf(Wp,r,1);break;case"scaleY":t.scaleOf(Wp,1,r);break;case"skewX":t.skewOf(Wp,r,0);break;case"skewY":t.skewOf(Wp,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class zp extends F_{constructor(t,e){super(t,e)}}zp.BEFORE_MOVE="editor.before_move",zp.MOVE="editor.move";class Np extends F_{constructor(t,e){super(t,e)}}Np.BEFORE_SCALE="editor.before_scale",Np.SCALE="editor.scale";class Hp extends F_{constructor(t,e){super(t,e)}}Hp.BEFORE_ROTATE="editor.before_rotate",Hp.ROTATE="editor.rotate";class Yp extends F_{constructor(t,e){super(t,e)}}Yp.BEFORE_SKEW="editor.before_skew",Yp.SKEW="editor.skew";class Xp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s,app:n}=this.editBox;let o,{dragLimitAnimate:a}=i;r(a)&&(a=n&&n.config.pointer.dragLimitAnimate);const h=t.type===pd.END||t.type===pd.END,d=!a||h;if(t instanceof yd)o=t.getLocalMove(e),d&&pd.limitMove(e,o);else{const i={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),o=pd.getValidMove(e,s.point,i,d)}a&&h?Fr.animateMove(this,o,l(a)?a:.3):this.move(o)}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let{around:r,lockRatio:o,flipable:a,editSize:h}=i;if(t instanceof xd)this.scaleOf(e.getBoxPoint(t),t.scale,t.scale);else{const{direction:i}=t.current;(t.shiftKey||e.lockRatio)&&(o=!0);const l=dp.getScaleData(e,n.bounds,i,t.getInnerTotal(e),o,dp.getAround(r,t.altKey),a,!s||"scale"===h);this.editTool&&this.editTool.onScaleWithDrag?(l.drag=t,this.scaleWithDrag(l)):this.scaleOf(l.origin,l.scaleX,l.scaleY)}}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:r,rotateGap:o}=i,{direction:a}=t.current;let h,l;if(t instanceof md)l=t.rotation,h=r?ht.getPoint(r,e.boxBounds):e.getBoxPoint(t);else{const i=dp.getRotateData(e,a,t,s,t.shiftKey?null:r||e.around||e.origin||n||"center");l=s.rotation+i.rotation-e.rotation,h=i.origin}l=b.float(b.getGapRotation(l,o,e.rotation),2),l&&this.rotateOf(h,l)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=dp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),dp.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;_(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({target:i,x:t,y:e});if(_(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:r,moveX:a.x,moveY:a.y};this.emitEvent(new zp(zp.BEFORE_MOVE,h));const l=new zp(zp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Np(Np.BEFORE_SCALE,t));const r=new Np(Np.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(_(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Np(Np.BEFORE_SCALE,c));const u=new Np(Np.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new et(Fr.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new Np(Np.BEFORE_SCALE,o));const a=new Np(Np.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:r,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Hp(Hp.BEFORE_ROTATE,d));const c=new Hp(Hp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(_(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Yp(Yp.BEFORE_SKEW,c));const u=new Yp(Yp.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(Fr.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new et(e.worldTransform);return t(),new et(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Vp=class extends hl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}constructor(t,e){super(e),this.leafList=new ja,this.openedGroupList=new ja,this.simulateTarget=new Fp(this),this.editBox=new mp(this),this.editToolList={},this.selector=new Q_(this),this.editMask=new xp(this),this.targetEventIds=[];let i=f.clone(bp);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Vt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Ep(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element.editOuter||"EditTool",e=this.editTool=this.editToolList[t]=this.editToolList[t]||Lp.get(t,this);this.editBox.load(),e.load(),this.update()}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Ap.BEFORE_GROUP),this.target=Rp.group(this.list,this.element,t),this.emitGroupEvent(Ap.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Ap.BEFORE_UNGROUP,t)),this.target=Rp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Ap.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Ap.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Ap.OPEN,t)}closeGroup(t){this.emitGroupEvent(Ap.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Ap.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Fr.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Ap(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){const e=t||this.element;s||(s=e.editInner),s&&Lp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||Lp.get(s,this),this.innerEditor.editTarget=e,this.emitInnerEvent(Mp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Mp.OPEN),console.log("hello"))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Mp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Mp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Mp(t,{editTarget:i,innerEditor:e});i.syncEventer||this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(Rp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Rp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editMask:i}=this;this.targetEventIds=[e.on_(Bo.START,this.onRenderStart,this),t.on_(Bo.CHILD_START,this.onAppRenderStart,this)],i.visible&&i.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};Qt([(t,e)=>{zn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s}=this,n=Object.assign({},t);return e&&e.editConfig&&Object.assign(n,e.editConfig),s.config&&Object.assign(n,s.config),i&&(i.editConfig&&Object.assign(n,i.editConfig),"font-size"===n.editSize&&(n.lockRatio=!0),"resize-rotate"===i.pointType&&(n.around||(n.around="center"),o(n.lockRatio)&&(n.lockRatio=!0))),this.mergedConfig=n}})}],Vp.prototype,"mergeConfig",void 0),Qt([z_(function(t,e){t.emitEvent(new F_(F_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Vp.prototype,"hoverTarget",void 0),Qt([z_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof ja?i:new ja(i),t.multiple&&Ep(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new F_(F_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new F_(F_.AFTER_SELECT,s))})],Vp.prototype,"target",void 0),Vp=Qt([Er(Xp,["editBox","editTool","emitEvent"])],Vp);class Up{static registerInnerEditor(){Lp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new hl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let jp=class extends Up{static registerEditTool(){Lp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};jp=Qt([Op()],jp);const{left:Gp,right:Kp}=ot,{move:Zp,copy:qp,toNumberPoints:Jp}=K;let $p=class extends jp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,r=t.target,o=i===Gp;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=Jp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:r,y:o}=n;i?(Zp(t,r,o),s&&Zp(e,-r,-o)):(s&&Zp(t,-r,-o),Zp(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),qp(s[7],i),qp(e[7],i),qp(s[3],a),qp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Gp||t===Kp,s[t].visible=a,e[t].visible=!o&&a}};$p=Qt([Op()],$p);const{M:Qp,L:tg,C:eg,Q:ig,Z:sg,N:ng,D:rg,X:og,G:ag,F:hg,O:lg,P:dg,U:cg}=pe,ug={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case Qp:case tg:_g(t,e,i,n,1),n+=3;break;case eg:_g(t,e,i,n,3),n+=7;break;case ig:_g(t,e,i,n,2),n+=5;break;case sg:n+=1;break;case ng:_g(t,e,i,n,2),n+=5;break;case rg:_g(t,e,i,n,2),n+=9;break;case og:_g(t,e,i,n,2),n+=6;break;case ag:_g(t,e,i,n,2),n+=9;break;case hg:_g(t,e,i,n,2),n+=5;break;case lg:t[n]=ag,t.splice(n+4,0,t[n+3],0),_g(t,e,i,n,2),n+=9,r+=2;break;case dg:t[n]=hg,t.splice(n+4,0,t[n+3]),_g(t,e,i,n,2),n+=5,r+=1;break;case cg:_g(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:_g}=ug,pg=W.get(),{topLeft:gg,top:fg,topRight:yg,right:mg,bottom:vg,left:xg}=ot;function wg(t,e,i){t.pathInputed?bg(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function bg(t,e,i){ug.scale(t.__.path,e,i),t.path=t.__.path}function kg(t,e,i){const{points:s}=t;_(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):ug.scalePoints(s,e,i),t.points=s}function Eg(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)pg.a=e,pg.d=i,s[t].transform(pg,!0)}const Bg=Da.prototype;function Sg(t,e,i){Rg(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(yd.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY))}),t.on_(xd.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function Rg(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}Bg.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},Bg.__scaleResize=function(t,e){wg(this,t,e)},Bg.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Bg.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},sd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)!function(t,e,i,s){let n=e;if(!r(s)){const r=t.__layout;let{width:o,height:a}=r.boxBounds;switch(o*=i-e,a*=e-i,s){case fg:case vg:n=i,r.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case xg:case mg:r.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case gg:case yg:r.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:a}=o;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),wg(this,t,e)}},nd.prototype.__scaleResize=function(t,e){bg(this,t,e)},Ml.prototype.__scaleResize=function(t,e){this.pathInputed?bg(this,t,e):this.points?kg(this,t,e):this.width*=t},Yl.prototype.__scaleResize=function(t,e){this.pathInputed?bg(this,t,e):this.points?kg(this,t,e):wg(this,t,e)},hl.prototype.__scaleResize=function(t,e){Eg(this,t,e)},vl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||wg(this,t,e),i&&Eg(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),Ut.editor=function(t,e){const i=new Vp(t);return e&&e.sky.add(e.editor=i),i},vl.addAttr("textBox",!1,Un),al.addAttr("editConfig",void 0,Un),al.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),Un),al.addAttr("editInner","PathEditor",Un),hl.addAttr("editInner","",Un),sd.addAttr("editInner","TextEditor",Un),al.setEditConfig=function(t){this.changeAttr("editConfig",t)},al.setEditOuter=function(t){this.changeAttr("editOuter",t)},al.setEditInner=function(t){this.changeAttr("editInner",t)};const Cg=Wt.get("LeaferTypeCreator"),Og={list:{},register(t,e){Tg[t]&&Cg.repeat(t),Tg[t]=e},run(t,e){const i=Tg[t];i&&i(e)}},{list:Tg,register:Lg}=Og;Lg("viewport",Sg),Lg("custom",function(t){Sg(t,null,!0)}),Lg("design",function(t){Sg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Lg("document",function(t){Sg(t,{zoom:{min:1},move:{scroll:"limit"}})});const Pg={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),n=K.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=K.getDistance(e.from,i.from);return{move:r,scale:K.getDistance(e.to,i.to)/o,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:n}}},Mg={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;return t.shiftKey&&!s&&(s=n,n=0),s>50&&(s=Math.max(50,s/3)),n>50&&(n=Math.max(50,n/3)),{x:-s*i*2,y:-n*i*2}},getScale(e,i){let s,n=1,{zoomMode:r,zoomSpeed:o}=i;const a=e.deltaY||e.deltaX;if(r?(s="mouse"===r||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){o=b.within(o,0,1);n=1-a/(4*(e.deltaY?i.delta.y:i.delta.x))*o,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class Ag{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(yd.START,this.moveData)),t.path=this.moveData.path,e.emit(yd.BEFORE_MOVE,t),e.emit(yd.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(xd.START,this.zoomData)),t.path=this.zoomData.path,e.emit(xd.BEFORE_ZOOM,t),e.emit(xd.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(md.START,this.rotateData)),t.path=this.rotateData.path,e.emit(md.BEFORE_ROTATE,t),e.emit(md.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(yd.END,e),i&&t.emit(xd.END,i),s&&t.emit(md.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Dg=cl.prototype,Ig=new Pt;function Wg(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Fg(t,e){return Object.assign(Object.assign({},e),{scale:t})}Dg.initType=function(t){Og.run(t,this)},Dg.getValidMove=function(t,e){const{scroll:i,disabled:s}=this.app.config.move;if(i){const s=!0===i?"":i;if(s.includes("x")?(t=t||e,e=0):s.includes("y")?(e=e||t,t=0):Math.abs(t)>Math.abs(e)?e=0:t=0,s.includes("limit")){const{x:i,y:s,width:n,height:r}=Ig.set(this.__world).addPoint(this.zoomLayer),o=i+n-this.width,a=s+r-this.height;i>=0&&o<=0?t=0:t>0?i+t>0&&(t=-i):t<0&&o+t<0&&(t=-o),s>=0&&a<=0?e=0:e>0?s+e>0&&(e=-s):e<0&&a+e<0&&(e=-a)}}return{x:s?0:t,y:s?0:e}},Dg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const zg=Fd.prototype;zg.createTransformer=function(){this.transformer=new Ag(this)},zg.move=function(t){this.transformer.move(t)},zg.zoom=function(t){this.transformer.zoom(t)},zg.rotate=function(t){this.transformer.rotate(t)},zg.transformEnd=function(){this.transformer.transformEnd()},zg.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const r=e.getScale?e.getScale(t,e):Mg.getScale(t,e);if(1!==r)this.zoom(Fg(r,t));else{const s=e.getMove?e.getMove(t,e):Mg.getMove(t,e);i.snap&&K.round(s),this.move(Wg(s,t))}},zg.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:r}=Pg.getData(e);Object.assign(t,r),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(Fg(n,t)),this.move(Wg(i,t))};const Ng=Cd.prototype,{abs:Hg}=Math;function Yg(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Ng.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=Hg(i),r=Hg(s),o=e?1:.1,a=this.canAnimate&&this.moving&&(n>o||r>o)&&this.interaction.m.dragAnimate;if(a){const o="touch"===t.pointerType?3:1,h=70;n*(e=e?l(a)?a:.95:o)>h?e=h/n:r*e>h&&(e=h/r),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},Ng.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Ng.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Ng.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Ct.maxX(o),d=Ct.maxY(o),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let _=0,p=0;this.autoMoveTimer=setInterval(()=>{_+=c,p+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},Ng.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),cl.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),p(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:r}=this,h=this.canvas.bounds.clone().shrink(o(n)?30:n),d=new Pt,c={x:h.x+h.width/2,y:h.y+h.height/2};let g;const{x:f,y:y,scaleX:m,scaleY:v}=r.__;if(a(t))switch(t){case"in":g=Yg(m,"in");break;case"out":g=Yg(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Pt(this.boxBounds)).height=0;break;case"fit-height":(t=new Pt(this.boxBounds)).width=0}else l(t)&&(g=t/m);if(g)g=this.getValidScale(g),r.scaleOfWorld(c,g,g,!1,s);else if(_(t)){const e={x:f,y:y,scaleX:m,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];d.setListWithFn(e,jr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,h);d.set(r.getWorldBounds(e))}const{width:o,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-o)/2,0),c+=Math.max((h.height-a)/2,0)):(g=this.getValidScale(Math.min(h.width/o,h.height/a)),l+=(h.width-o*g)/2,c+=(h.height-a*g)/2,K.scaleOf(e,d,g),d.scaleOf(d,g),e.scaleX*=g,e.scaleY*=g),"x"===i?c=0:"y"===i&&(l=0),K.move(e,l,c),d.move(l,c),r.set(e,s),d}return r.worldBoxBounds};class Xg extends hl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new vl,this.scrollYBar=new vl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new Pt(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,_=l<1,{scrollXBar:p,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=o.shrink([2,_?g.width+6:2,u?p.height+6:2,2]);p.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(pd.DRAG,this.onDrag,this),e.on_(pd.DRAG,this.onDrag,this),t.on_(pd.END,this.onDragEnd,this),e.on_(pd.END,this.onDragEnd,this),this.target.on_(Bo.BEFORE,()=>this.update(!0)),this.target.leafer.on_(bo.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Vt.add("scroll");class Vg extends Vh{}function Ug(t){return Yn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,ir(this)}}}))}let jg=class extends Ml{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};Qt([gr(Vg)],jg.prototype,"__",void 0),Qt([Ug("angle")],jg.prototype,"endArrow",void 0),jg=Qt([Br()],jg);const{M:Gg,L:Kg,C:Zg,Q:qg,O:Jg}=pe,{rotate:$g,copyFrom:Qg,scale:tf}=K,ef={},sf={layout(t,e,i,s,n,r,o){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Gg:case Kg:nf(t,l+1,e,i,s,n,r,o),l+=3;break;case Zg:for(h=1;h<6;h+=2)nf(t,l+h,e,i,s,n,r,o);l+=7;break;case qg:for(h=1;h<4;h+=2)nf(t,l+h,e,i,s,n,r,o);l+=5;break;case Jg:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){sf.layout(t,0,0,1,1,e,i)}};function nf(t,e,i,s,n,r,o,a){Qg(ef,t[e],t[e+1]),o&&$g(ef,o,a),n&&tf(ef,n,r),t[e]=i+ef.x,t[e+1]=s+ef.y}const{layout:rf,rotate:of}=sf,{getAngle:af}=K,hf={x:-.5},lf={connect:hf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},df={connect:hf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},cf={connect:hf,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},uf={connect:hf,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},_f={offset:hf,path:[...cf.path],dashPath:[1,-2.5,0,2,-1,0]};of(_f.path,180,{x:-1.5,y:0});const pf={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},gf={connect:{x:.5},path:[...pf.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},ff={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},yf={path:[...ff.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},mf=f.clone(ff),vf=f.clone(yf);of(mf.path,45),of(vf.path,45);const xf={angle:lf,"angle-side":df,arrow:uf,triangle:cf,"triangle-flip":_f,circle:gf,"circle-line":pf,square:yf,"square-line":ff,diamond:vf,"diamond-line":mf,mark:{offset:hf,path:[1,0,-2,2,0,2]}};function wf(t,e,i,s,n,r,o){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}=_(e)?e:xf[e];let p=d?d.x:0,g=l?l.x:0;const f=[...c];return o&&u&&f.push(...u),"none"!==a&&(p-=.5),l&&("round"===h&&l.roundJoin?g+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(g+=l.bevelJoin)),g&&rf(f,g,0),rf(f,s.x,s.y,n,n,af(i,s)),r.x=(p+g)*n,f}const{M:bf,L:kf,C:Ef,Q:Bf,Z:Sf,N:Rf,D:Cf,X:Of,G:Tf,F:Lf,O:Pf,P:Mf,U:Af}=pe,{copy:Df,copyFrom:If,getDistancePoint:Wf}=K,Ff={},zf={},Nf={},Hf={},Yf={},Xf={list:xf,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:n,dashPattern:r,__pathForRender:o}=t.__;let a,h=0,l=o.length,d=0,c=i&&"none"!==i;for(;h<l;){switch(a=o[h],a){case bf:case kf:(d<2||h+6>=l)&&(If(Yf,o[h+1],o[h+2]),!d&&c&&Df(zf,Yf)),h+=3;break;case Ef:1!==d&&h+7!==l||Vf(o,Hf,Yf,h+3),h+=7;break;case Bf:1!==d&&h+5!==l||Vf(o,Hf,Yf,h+1),h+=5;break;case Sf:return;case Rf:h+=5;break;case Cf:h+=9;break;case Of:h+=6;break;case Tf:h+=9;break;case Lf:h+=5;break;case Pf:h+=7;break;case Mf:h+=4;break;case Af:1!==d&&h+6!==l||Vf(o,Hf,Yf,h+1),h+=6}if(d++,1===d&&a!==bf)return;if(2===d&&c&&Df(Nf,a===kf?Yf:Hf),h===l){const l=t.__.__pathForRender=e?[...o]:o,d=t.__.__pathForArrow=[];if(c){const e=wf(t,i,Nf,zf,n,Ff,!!r);r?d.push(...e):l.push(...e),Ff.x&&(Wf(zf,Nf,-Ff.x,!0),l[1]=Nf.x,l[2]=Nf.y)}if(s&&"none"!==s){const e=wf(t,s,Hf,Yf,n,Ff,!!r);if(r?d.push(...e):l.push(...e),Ff.x){let t;switch(Wf(Yf,Hf,-Ff.x,!0),a){case kf:t=h-3+1;break;case Ef:t=h-7+5;break;case Bf:t=h-5+3;break;case Af:t=h-6+3}t&&Uf(l,Hf,t)}}}else Df(Hf,Yf)}}};function Vf(t,e,i,s){If(e,t[s],t[s+1]),If(i,t[s+2],t[s+3])}function Uf(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),al.addAttr("startArrow","none",Ug),al.addAttr("endArrow","none",Ug),Object.assign(kh,Xf),Object.assign(Eh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:jf,NoAndSkip:Gf,YesAndSkip:Kf}=s,Zf={},qf={},Jf={};class $f{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Zf.id=t.substring(1),t=Zf;break;case".":qf.className=t.substring(1),t=qf;break;default:Jf.tag=t,t=Jf}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Fr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),r===jf||r===Kf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Gf&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(_o.REMOVE,this.__onRemoveChild,this),this.target.on_(po.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Qf=al.prototype;function ty(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Ut.selector())}Qf.find=function(t,e){return ty(this).getBy(t,this,!1,e)},Qf.findOne=function(t,e){return ty(this).getBy(t,this,!0,e)},Vt.add("find"),Ut.finder=function(t){return new $f(t)};const{setPoint:ey,addPoint:iy,toBounds:sy}=st;const ny={syncExport(e,i,s){let n;Oh.running=!0;try{const o=En.fileType(i),a=i.includes(".");s=En.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===o)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),n={data:!!a||e.toJSON(s.json)};else if("svg"===o)a&&l(h(e.toSVG(),"svg"),i),n={data:!!a||e.toSVG()};else{let t,o,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=e,{slice:_,clip:p,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=r(s.smooth)?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),w=d&&f&&r(s.fill)?e.fill:s.fill,k=En.isOpaqueImage(i)||w,E=new et;if(f)t=!0===f?d?c.canvas.bounds:e.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":E.set(l);break;case"local":E.set(l).divide(e.localTransform),a/=e.scaleX,h/=e.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||e;default:E.set(l).divide(e.getTransform(i));const t=i.worldTransform;a/=a/t.scaleX,h/=h/t.scaleY}t=e.getBounds("render",i)}const B={scaleX:1,scaleY:1};b.getScaleData(s.scale,s.size,t,B);let S=s.pixelRatio||1,{x:R,y:C,width:O,height:T}=new Pt(t).scale(B.scaleX,B.scaleY);p&&(R+=p.x,C+=p.y,O=p.width,T=p.height);const L={exporting:!0,matrix:E.scale(1/B.scaleX,1/B.scaleY).invert().translate(-R,-C).withScale(1/a*B.scaleX,1/h*B.scaleY)};let P,M=Ut.canvas({width:Math.floor(O),height:Math.floor(T),pixelRatio:S,smooth:v,contextSettings:x});if(_&&(P=e,P.__worldOpacity=0,e=c||e,L.bounds=M.bounds),M.save(),u&&!r(w)){const t=e.get("fill");e.fill="",e.__render(M,L),e.fill=t}else e.__render(M,L);if(M.restore(),P&&P.__updateWorldOpacity(),g){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?iy(o,n,r):ey(o={},n,r)),a++;const h=new Pt;return o&&(sy(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:S};M=Ut.canvas(s),M.copyWorld(t,o,s),t.destroy()}if(y){const[t,e,i,s]=b.fourNumber(y),n=M,{width:r,height:o}=n;M=Ut.canvas({width:r+s+e,height:o+t+i,pixelRatio:S}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}k&&M.fillWorld(M.bounds,w||"#FFFFFF","destination-over"),m&&m(M);n={data:"canvas"===i?M:M.export(i,s),width:M.pixelWidth,height:M.pixelHeight,renderBounds:t,trimBounds:o}}}catch(t){n={data:"",error:t}}return Oh.running=!1,n},export(e,i,s){return Oh.running=!0,function(t){ry||(ry=new Cn);return new Promise(e=>{ry.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(r=>{const o=()=>te(this,void 0,void 0,function*(){if(!Tn.isComplete)return t.requestRender(o);const a=Oh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),r()});e.updateLayout(),oy(e);const{leafer:a}=e;a?a.waitViewCompleted(o):o()}))}};let ry;function oy(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>oy(t))}const ay=ce.prototype,hy=Wt.get("@leafer-in/export");ay.export=function(t,e){const{quality:i,blob:s}=En.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},ay.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{hy.error(t),s(null)})})},ay.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},ay.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{hy.error(t),s(!1)})})},Vt.add("export"),Object.assign(Oh,ny),al.prototype.export=function(t,e){return Oh.export(this,t,e)},al.prototype.syncExport=function(t,e){return Oh.syncExport(this,t,e)};const ly={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},dy={top:"flex-start",middle:"center",bottom:"flex-end"},cy={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function uy(t,e,i){const{style:s}=t,{fill:n,padding:o,textWrap:h,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(_(e))switch(e.type){case"solid":i=wh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=wh.string(a(t)?t:t.color);break;default:r(e.r)||(i=wh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,_(d)?(c=d.type,d.color&&(s.textDecorationColor=wh.string(d.color))):c=d,s.textDecoration=cy[c],s.textTransform=ly[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=dy[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(o)?o.map(t=>t*i+"px").join(" "):(o||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}let _y=class extends Up{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof sd),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div"),{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:r}=t.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(s):r.appendChild(s),this.eventIds=[t.app.on_(cd.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const o=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];a.setStartAfter(t),a.setEndAfter(t),a.collapse(!0)}o.removeAllRanges(),o.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth&&(i+=20,o.autoSizeAlign))switch(o.textAlign){case"center":n=-i/2;break;case"right":n=-i}if(o.__autoHeight&&(s+=20,o.autoSizeAlign))switch(o.verticalAlign){case"middle":r=-s/2;break;case"bottom":r=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:_,f:p}=new et(t.worldTransform).scale(1/e).translateInner(n,r),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${_},${p})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||uy(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};_y=Qt([Tp()],_y),Vt.add("text-editor","editor");class py extends Qh{setText(t){this._text=t,this.__htmlChanged=!0}}let gy=class extends ql{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}};Qt([gr(py)],gy.prototype,"__",void 0),Qt([qn("")],gy.prototype,"text",void 0),Qt([Un("TextEditor")],gy.prototype,"editInner",void 0),Qt([rr(!1)],gy.prototype,"textEditing",void 0),gy=Qt([Br()],gy),Vt.add("html");export{ct as AlignHelper,s as Answer,od as App,ht as AroundHelper,jg as Arrow,Vg as ArrowData,At as AutoBounds,Ne as BezierHelper,Pt as Bounds,fo as BoundsEvent,Ct as BoundsHelper,vl as Box,Hh as BoxData,Ua as Branch,qr as BranchHelper,da as BranchRender,$l as Canvas,tl as CanvasData,$t as CanvasManager,_o as ChildEvent,wh as ColorConvert,Ut as Creator,zd as Cursor,f as DataHelper,Wt as Debug,rt as Direction4,ot as Direction9,pd as DragEvent,Cd as Dragger,fd as DropEvent,mp as EditBox,dp as EditDataHelper,gp as EditPoint,Q_ as EditSelect,Z_ as EditSelectHelper,jp as EditTool,Lp as EditToolCreator,Vp as Editor,F_ as EditorEvent,Ap as EditorGroupEvent,Rp as EditorHelper,zp as EditorMoveEvent,Hp as EditorRotateEvent,Np as EditorScaleEvent,Yp as EditorSkewEvent,Rh as Effect,El as Ellipse,jh as EllipseData,Ze as EllipseHelper,uo as Event,qt as EventCreator,Mo as Eventer,Oh as Export,En as FileHelper,Ch as Filter,$f as Finder,xl as Frame,Xh as FrameData,hl as Group,Nh as GroupData,gy as HTMLText,py as HTMLTextData,Nd as HitCanvasManager,ql as Image,Qh as ImageData,go as ImageEvent,Pn as ImageManager,e as IncrementId,Up as InnerEditor,Mp as InnerEditorEvent,Fd as InteractionBase,bd as InteractionHelper,wd as KeyEvent,hd as Keyboard,Eo as LayoutEvent,dh as Layouter,Da as Leaf,aa as LeafBounds,jr as LeafBoundsHelper,m as LeafData,jo as LeafDataProxy,Vo as LeafEventer,Fr as LeafHelper,co as LeafLayout,Ga as LeafLevelList,ja as LeafList,Qo as LeafMatrix,ha as LeafRender,cl as Leafer,Za as LeaferCanvas,ce as LeaferCanvasBase,Yh as LeaferData,So as LeaferEvent,Fn as LeaferImage,Og as LeaferTypeCreator,Ml as Line,Vh as LineData,$p as LineEditTool,b as MathHelper,et as Matrix,W as MatrixHelper,yd as MoveEvent,Pg as MultiTouchHelper,gd as MyDragEvent,Jl as MyImage,ud as MyPointerEvent,fe as NeedConvertToCanvasCommandMap,E as OneRadian,B as PI2,S as PI_2,Eh as Paint,Sh as PaintGradient,Bh as PaintImage,nd as Path,kh as PathArrow,Xf as PathArrowModule,_n as PathBounds,is as PathCommandDataHelper,pe as PathCommandMap,Mi as PathConvert,xn as PathCorner,vs as PathCreator,Zh as PathData,As as PathDrawer,ue as PathHelper,sf as PathMatrixHelper,xe as PathNumberCommandLengthMap,ve as PathNumberCommandMap,rd as Pen,qh as PenData,ph as Picker,t as Platform,Vt as Plugin,Q as Point,K as PointHelper,ld as PointerButton,cd as PointerEvent,Yl as Polygon,Gh as PolygonData,po as PropertyEvent,ul as Rect,Uh as RectData,we as RectHelper,rl as RectRender,Bo as RenderEvent,uh as Renderer,bo as ResizeEvent,Tn as Resource,md as RotateEvent,Ht as Run,Xg as ScrollBar,K_ as SelectArea,gh as Selector,Zl as Star,Kh as StarData,Th as State,Dt as StringNumberMap,G_ as Stroker,vd as SwipeEvent,Rn as TaskItem,Cn as TaskProcessor,sd as Text,xh as TextConvert,$h as TextData,_y as TextEditor,Xp as TransformTool,Ag as Transformer,Lh as Transition,st as TwoPointBoundsHelper,al as UI,el as UIBounds,Gt as UICreator,Fh as UIData,dd as UIEvent,sl as UIRender,bh as UnitConvert,to as WaitHelper,ko as WatchEvent,Qa as Watcher,Mg as WheelEventHelper,xd as ZoomEvent,Sg as addViewport,Rg as addViewportConfig,nr as affectRenderBoundsType,er as affectStrokeBoundsType,Ug as arrowType,Xn as attr,Gn as autoLayoutType,qn as boundsType,kn as canvasPatch,de as canvasSizeAttrs,vh as createAttr,Hn as createDescriptor,pr as cursorType,gr as dataProcessor,Un as dataType,Yn as decorateLeafAttr,yr as defineDataProcessor,zn as defineKey,Vn as defineLeafAttr,$n as doBoundsType,ir as doStrokeType,fh as effectType,n as emptyData,ur as eraserType,C as getBoundsData,Nn as getDescriptor,O as getMatrixData,R as getPointData,_r 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,r as isUndefined,fr as layoutProcessor,Lo as leaferTransformAttrMap,cr as maskType,Jn as naturalBoundsType,or as opacityType,Qn as pathInputType,tr as pathType,wn as pen,jn as positionType,Op as registerEditTool,Tp as registerInnerEditor,Br as registerUI,Sr as registerUIEvent,yh as resizeType,wr as rewrite,br as rewriteAble,Zn as rotationType,Kn as scaleType,dr as sortType,sr as strokeType,rr as surfaceType,Mt as tempBounds,it as tempMatrix,tt as tempPoint,c as tryToNumber,Ja as useCanvas,Er as useModule,Ka as version,ar as visibleType,mh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=worker.module.min.js.map
|