@leafer-editor/worker 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +0 -1
- package/dist/worker.esm.js +0 -1
- package/dist/worker.js +690 -502
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +685 -502
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +15 -15
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.esm.js.map +0 -1
- package/dist/worker.js.map +0 -1
- package/dist/worker.module.js.map +0 -1
|
@@ -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={},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i,{round:n,pow:o,PI:r}=Math,a={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)),a.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=n(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,n=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&a.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:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=r/180,d=2*r,c=r/2;function u(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:g,cos:f,acos:y,sqrt:m}=Math,{float:v}=a,w={};function x(){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 b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:x(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:p,getWorld:x,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){k.toInnerPoint(t,e,w),k.scaleOfInner(t,w,i,s)},scaleOfInner(t,e,i,s=i){k.translateInner(t,e.x,e.y),k.scale(t,i,s),k.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=f(e*=l),a=g(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){k.toInnerPoint(t,e,w),k.rotateOfInner(t,w,i)},rotateOfInner(t,e,i){k.translateInner(t,e.x,e.y),k.rotate(t,i),k.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=l,t.a=s+o*i,t.b=n+r*i),e&&(e*=l,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){k.toInnerPoint(t,e,w),k.skewOfInner(t,w,i,s)},skewOfInner(t,e,i,s=0){k.translateInner(t,e.x,e.y),k.skew(t,i,s),k.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n,o){let{e:r,f:a}=t;if(o&&(r+=o.scrollX,a+=o.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*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=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){k.multiply(t,k.tempInvert(e))},divideParent(t,e){k.multiplyParent(t,k.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=k;return k.copy(e,t),k.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=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=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:o,y:r,scaleX:a,scaleY:h}=e;if(void 0===n&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*l,r=f(o),d=g(o);if(s||n){const e=s*l,i=n*l;t.a=(r+i*-d)*a,t.b=(d+i*r)*a,t.c=(e*r-d)*h,t.d=(r+e*d)*h}else t.a=r*a,t.b=d*a,t.c=-d*h,t.d=r*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=o,t.f=r,(i=i||s)&&k.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:d}=t;let u,_,p,w,x,b=h,k=d;if(o||r){const t=n*a-o*r;if(r&&!s){u=m(n*n+o*o),_=t/u;const e=n/u;p=o>0?y(e):-y(e)}else{_=m(r*r+a*a),u=t/_;const e=r/_;p=c-(a>0?y(-e):-y(e))}const e=v(f(p)),i=g(p);u=v(u),_=v(_),w=e?v((r/_+i)/e/l,9):0,x=e?v((o/u-i)/e/l,9):0,p=v(p/l)}else u=n,_=a,p=w=x=0;return(e=i||e)&&(b+=e.x*n+e.y*r,k+=e.x*o+e.y*a,i||(b-=e.x,k-=e.y)),{x:b,y:k,scaleX:u,scaleY:_,rotation:p,skewX:w,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=m(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){k.set(t)}},k=b,{toInnerPoint:E,toOuterPoint:B}=b,{sin:R,cos:S,abs:C,sqrt:O,atan2:L,min:T,round:P,PI:M}=Math,A={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?P(t.x-.5)+.5:P(t.x),t.y=e?P(t.y-.5)+.5:P(t.y)},move(t,e,i){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=D.defaultPoint);const s=S(e*=l),n=R(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=D;return W(i,t),E(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=D;return W(i,t),B(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=D;return W(i,t),D.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),E(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){E(e,t,i)},toOuterOf(t,e,i){B(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)=>I(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=C(i-t),o=C(s-e);return O(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>T(I(t,e,i,s),I(i,s,n,o)),getAngle:(t,e)=>F(t,e)/l,getRotation:(t,e,i,s)=>(s||(s=e),D.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/l),getRadianFrom(t,e,i,s,n,o,r,a){void 0===r&&(r=i,a=s);let h=L(e-s,t-i);const l=L(o-a,n-r)-h;return l<-M?l+d:l},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=F(t,e);return(e=s?e:{}).x=t.x+S(n)*i,e.y=t.y+R(n)*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){D.reset(t)}},D=A,{getDistanceFrom:I,copy:W,getAtan2:F}=D;class z{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?A.copy(this,t):A.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new z(this)}move(t,e){return A.move(this,t,e),this}scale(t,e){return A.scale(this,t,e),this}scaleOf(t,e,i){return A.scaleOf(this,t,e,i),this}rotate(t,e){return A.rotate(this,t,e),this}rotateOf(t,e){return A.rotate(this,e,t),this}getRotation(t,e,i){return A.getRotation(this,t,e,i)}toInnerOf(t,e){return A.toInnerOf(this,t,e),this}toOuterOf(t,e){return A.toOuterOf(this,t,e),this}getCenter(t){return new z(A.getCenter(this,t))}getDistance(t){return A.getDistance(this,t)}getDistancePoint(t,e,i){return new z(A.getDistancePoint(this,t,e,i))}getAngle(t){return A.getAngle(this,t)}getAtan2(t){return A.getAtan2(this,t)}reset(){return A.reset(this),this}}const N=new z;class Y{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,i,s,n,o),this}setWith(t){return b.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:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new Y(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return b.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return b.scaleOfInner(this,t,e,i),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,i){return b.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return b.skewOfInner(this,t,e,i),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){b.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){b.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return b.setLayout(this,t,e,i),this}getLayout(t,e,i){return b.getLayout(this,t,e,i)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new Y,H={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){V(t,e,i),V(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:V}=H,{tempPointBounds:j,setPoint:U,addPoint:G,toBounds:Z}=H,{toOuterPoint:K}=b,{float:q,fourNumber:J}=a,{floor:$,ceil:Q}=Math;let tt,et,it,st;const nt={},ot={},rt={tempBounds:{},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:o,y:r,width:a,height:h}=e;if(i instanceof Array){const e=J(i);s?at.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):at.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),at.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),at.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?lt(e,t):e=t,i?(e.offsetX=-(at.maxX(i)-t.x),e.offsetY=-(at.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),at.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e){A.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){A.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(at.copy(at.tempBounds,t),at.toOuterOf(at.tempBounds,e),at.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),at.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 nt.x=t.x,nt.y=t.y,K(e,nt,ot),U(j,ot.x,ot.y),nt.x=t.x+t.width,K(e,nt,ot),G(j,ot.x,ot.y),nt.y=t.y+t.height,K(e,nt,ot),G(j,ot.x,ot.y),nt.x=t.x,K(e,nt,ot),G(j,ot.x,ot.y),Z(j,i)},toInnerOf(t,e,i){i||(i=t),at.move(i,-e.e,-e.f),at.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Math.min(t.width/e.width,t.height/e.height));return new Y(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,i){const s={};return at.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){at.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){at.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=$(t.x),t.y=$(t.y),t.width=e>t.x?Q(t.width+e-t.x):Q(t.width),t.height=i>t.y?Q(t.height+i-t.y):Q(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=q(t.x,e),t.y=q(t.y,e),t.width=q(t.width,e),t.height=q(t.height,e)},add(t,e,i){tt=t.x+t.width,et=t.y+t.height,it=e.x,st=e.y,i||(it+=e.width,st+=e.height),tt=tt>it?tt:it,et=et>st?et:st,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=tt-t.x,t.height=et-t.y},addList(t,e){at.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){at.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){at.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r]):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||lt(t,n)):ht(t,n));o&&at.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?U(j,t.x,t.y):G(j,t.x,t.y))),Z(j,t)},setPoint(t,e){at.set(t,e.x,e.y)},addPoint(t,e){ht(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=A.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=A.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=at.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=at.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=at.tempToOuterOf(e,i)),!at.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return tt=s+o,et=n+r,it=t.x+t.width,st=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,tt=tt<it?tt:it,et=et<st?et:st,o=tt-s,r=et-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){at.copy(t,at.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){at.set(t)}},at=rt,{add:ht,copy:lt}=at;class dt{get minX(){return rt.minX(this)}get minY(){return rt.minY(this)}get maxX(){return rt.maxX(this)}get maxY(){return rt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?rt.copy(this,t):rt.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 dt(this)}move(t,e){return rt.move(this,t,e),this}scale(t,e){return rt.scale(this,t,e),this}scaleOf(t,e,i){return rt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return rt.getFitMatrix(this,t,e)}spread(t,e){return rt.spread(this,t,e),this}shrink(t,e){return rt.shrink(this,t,e),this}ceil(){return rt.ceil(this),this}unsign(){return rt.unsign(this),this}float(t){return rt.float(this,t),this}add(t){return rt.add(this,t),this}addList(t){return rt.setList(this,t,!0),this}setList(t){return rt.setList(this,t),this}addListWithFn(t,e){return rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return rt.setListWithFn(this,t,e),this}setPoint(t){return rt.setPoint(this,t),this}setPoints(t){return rt.setPoints(this,t),this}addPoint(t){return rt.addPoint(this,t),this}getPoints(){return rt.getPoints(this)}hitPoint(t,e){return rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return rt.hitRadiusPoint(this,t,e)}hit(t,e){return rt.hit(this,t,e)}includes(t,e){return rt.includes(this,t,e)}intersect(t,e){return rt.intersect(this,t,e),this}getIntersect(t,e){return new dt(rt.getIntersectData(this,t,e))}isSame(t){return rt.isSame(this,t)}isEmpty(){return rt.isEmpty(this)}reset(){rt.reset(this)}}const ct=new dt;class ut{constructor(t,e,i,s,n,o){"object"==typeof t?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new dt(n,e,o||t.width-n-i,r||t.height-e-s)}}var _t,pt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(_t||(_t={})),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"}(pt||(pt={}));const gt=[{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}];gt.forEach((t=>t.type="percent"));const ft={directionData:gt,tempPoint:{},get:yt,toPoint(t,e,i,s,n){const o=yt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(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)}};function yt(t){return"string"==typeof t?gt[pt[t]]:t}const{toPoint:mt}=ft,vt={toPoint(t,e,i,s,n){mt(t,i,s,n,e)}},wt={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:xt}=a;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=kt(t)}static set exclude(t){this.excludeList=kt(t)}static drawRepaint(t,e){const i=xt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===bt.showBounds,n=t.__nowWorld,o=xt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(Et.enable){if(Et.filterList.length&&Et.filterList.every((t=>t!==this.name)))return;if(Et.excludeList.length&&Et.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Et.enable&&this.warn(...t)}warn(...t){Et.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 kt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Et=bt,Bt=bt.get("RunTime"),Rt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return St.currentId=St.idMap[s]=e?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],n=e?(performance.now()-i)/1e3:Date.now()-i;St.idMap[t]=St.nameMap[t]=St.nameToIdMap[s]=void 0,Bt.log(s,n,"ms")},endOfName(t,e){const i=St.nameToIdMap[t];void 0!==i&&St.end(i,e)}},St=Rt,Ct=[],Ot={list:{},add(t,...e){this.list[t]=!0,Ct.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Ct.forEach((t=>Ot.has(t,!0)))));const Lt=bt.get("UICreator"),Tt={list:{},register(t){const{__tag:e}=t.prototype;Pt[e]&&Lt.repeat(e),Pt[e]=t},get(t,e,i,s,n,o){Pt[t]||Lt.error("not register "+t);const r=new Pt[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),n&&(r.width=n),o&&(r.height=o)),r}},{list:Pt}=Tt,Mt=bt.get("EventCreator"),At={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Dt[e]&&Mt.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}=At;class It{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let i;const{list:s}=this;for(let e=0,n=s.length;e<n;e++)if(i=s[e],i.recycled&&i.isSameSize(t))return i.recycled=!1,i.manager||(i.manager=this),i;const n=e.canvas(t);return this.add(n),n}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((n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return Ft(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&Ft(t[n]={},e[n],i[n]):t[n]=e[n]}))},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}},{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 n in this)if("_"!==n[0]&&(t=this["_"+n],void 0!==t)){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,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 Xt(t){return null==t}function Ht(t){return"{}"===JSON.stringify(t)}function Vt(t,e,i,s){var n,o=arguments.length,r=o<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--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function jt(t,e,i,s){return new(i||(i=Promise))((function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(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(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,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){"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,n,o)}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,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,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,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,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,o){}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}=b,{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(e,s){super(),this.size={},this.worldTransform={},e||(e=te),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:o,pixelRatio:r}=e;this.autoLayout=!n||!o,this.size.pixelRatio=r|t.devicePixelRatio,this.config=e,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 dt(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&&$t(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=Qt(n.e-.5)+.5,n.f=Qt(n.f-.5)+.5):(n.e=Qt(n.e),n.f=Qt(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){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: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,rt.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(ct.x,ct.y,ct.width,ct.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,ct.x,ct.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(ct.x,ct.y,ct.width,ct.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ct.x,ct.y,ct.width,ct.height),i&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ct.x,ct.y,ct.width,ct.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ct.x,ct.y,ct.width,ct.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){ct.set(t),i&&ct.intersect(this.bounds),ct.scale(this.pixelRatio),e&&ct.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,i){const{size:s,pixelSnap:n}=this,o=this.manager?this.manager.get(s):e.canvas(Object.assign({},s));return o.save(),t&&(Jt(o.worldTransform,this.worldTransform),o.useWorldTransform()),i&&(o.smooth=this.smooth),o.pixelSnap!==n&&(o.pixelSnap=n),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){}},ne={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},oe=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},ne),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),ne),le=oe,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,n,o){const r=a.fourNumber(o,Math.min(s/2,n/2)),h=e+s,l=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(h,i,h,l,r[1]):t.lineTo(h,i),r[2]?t.arcTo(h,l,e,l,r[2]):t.lineTo(h,l),r[3]?t.arcTo(e,l,e,i,r[3]):t.lineTo(e,l),r[0]?t.arcTo(e,i,h,i,r[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}=H,{set:ke,toNumberPoints:Ee}=A,{M:Be,L:Re,C:Se,Q:Ce,Z:Oe}=oe,Le={},Te={points(t,e,i,s){let n=Ee(e);if(t.push(Be,n[0],n[1]),i&&n.length>5){let e,o,r,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],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=ve(we(r-e,2)+we(a-o,2)),g=ve(we(h-r,2)+we(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(Ce,d,c,r,a):t.push(Se,u,_,d,c,r,a),u=r+g*h,_=a+g*l;s||t.push(Ce,u,_,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Re,n[e],n[e+1]);s&&t.push(Oe)},rect(t,e,i,s,n){se.creator.path=t,se.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,o){se.creator.path=[],ue.drawRoundRect(se.creator,e,i,s,n,o),t.push(...se.convertToCanvasData(se.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,u,_){const p=s-e,g=n-i,f=o-s,y=r-n;let m=ge(g,p),v=ge(y,f),w=v-m;if(w<0&&(w+=d),w===me||ye(p+g)<1e-12||ye(f+y)<1e-12)return t&&t.push(Re,s,n),h&&(xe(h,e,i),be(h,s,n)),_&&ke(_,e,i),void(u&&ke(u,s,n));const x=p*y-f*g<0,b=x?-1:1,k=a/pe(w/2),E=s+k*pe(m+w/2+c*b),B=n+k*_e(m+w/2+c*b);return m-=c*b,v-=c*b,Ae(t,E,B,a,a,0,m/l,v/l,x,h,u,_)},arc:(t,e,i,s,n,o,r,a,h,l)=>Ae(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,u,_,p){const g=o*l,f=_e(g),y=pe(g);let m=r*l,v=a*l;m>me&&(m-=d),v<0&&(v+=d);let w=v-m;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const x=fe(ye(w/c)),b=w/x,k=_e(b/4),E=8/3*k*k/_e(b/2);v=m+b;let B,R,S,C,O,L,T,P,M=pe(m),A=_e(m),D=S=y*s*M-f*n*A,I=C=f*s*M+y*n*A,W=e+S,F=i+C;t&&t.push(t.length?Re:Be,W,F),u&&xe(u,W,F),p&&ke(p,W,F);for(let o=0;o<x;o++)B=pe(v),R=_e(v),S=y*s*B-f*n*R,C=f*s*B+y*n*R,O=e+D-E*(y*s*A+f*n*M),L=i+I-E*(f*s*A-y*n*M),T=e+S+E*(y*s*R+f*n*B),P=i+C+E*(f*s*R-y*n*B),t&&t.push(Se,O,L,T,P,e+S,i+C),u&&Me(e+D,i+I,O,L,T,P,e+S,i+C,u,!0),D=S,I=C,M=B,A=R,m=v,v+=b;_&&ke(_,e+S,i+C)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(Se,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){Me(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,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,n,o,r,a,Le),be(h,Le.x,Le.y)},getPointAndSet(t,e,i,s,n,o,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+_*o+p*a,l.y=c*i+u*n+_*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Pe(t,e,i,s,n,o,r,a,h,l),l}},{getPointAndSet:Pe,toTwoPointBounds:Me,ellipse:Ae}=Te,{sin:De,cos:Ie,sqrt:We,atan2:Fe}=Math,{ellipse:ze}=Te,Ne={ellipticalArc(e,i,s,n,o,r,a,h,c,u,_){const p=(c-i)/2,g=(u-s)/2,f=r*l,y=De(f),m=Ie(f),v=-m*p-y*g,w=-m*g+y*p,x=n*n,b=o*o,k=w*w,E=v*v,B=x*b-x*k-b*E;let R=0;if(B<0){const t=We(1-B/(x*b));n*=t,o*=t}else R=(a===h?-1:1)*We(B/(x*k+b*E));const S=R*n*w/o,C=-R*o*v/n,O=Fe((w-C)/o,(v-S)/n),L=Fe((-w-C)/o,(-v-S)/n);let T=L-O;0===h&&T>0?T-=d:1===h&&T<0&&(T+=d);const P=i+p+m*S-y*C,M=s+g+y*S+m*C,A=T<0?1:0;_||t.ellipseToCurve?ze(e,P,M,n,o,r,O/l,L/l,A):n!==o||r?e.push(oe.G,P,M,n,o,r,O/l,L/l,A):e.push(oe.O,P,M,n,O/l,L/l,A)}},{M:Ye,m:Xe,L:He,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:ni,Z:oi,z:ri,N:ai,D:hi,X:li,G:di,F:ci,O:ui,P:_i,U:pi}=oe,{rect:gi,roundRect:fi,arcTo:yi,arc:mi,ellipse:vi,quadraticCurveTo:wi}=Te,{ellipticalArc:xi}=Ne,bi=bt.get("PathConvert"),ki={},Ei={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,h="";for(;o<r;){s=t[o],i=ce[s],h+=s===n?" ":de[s];for(let s=1;s<i;s++)h+=a.float(t[o+s],e),s===i-1||(h+=" ");n=s,o+=i}return h},parse(t,e){let i,s,n,o="";const r=[],a=e?he:ae;for(let e=0,h=t.length;e<h;e++)s=t[e],wt[s]?("."===s&&(Bi.dot&&(Ri(r,o),o=""),Bi.dot++),"0"===o&&"."!==s&&(Ri(r,o),o=""),o+=s):oe[s]?(o&&(Ri(r,o),o=""),Bi.name=oe[s],Bi.length=re[s],Bi.index=0,Ri(r,Bi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Ri(r,o),o=s):o&&(Ri(r,o),o=""),n=s;return o&&Ri(r,o),i?Ei.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){case Xe: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(He,a,h),c+=2;break;case Ze:t[c+1]+=h;case Ge:h=t[c+1],_.push(He,a,h),c+=2;break;case Ve:t[c+1]+=a,t[c+2]+=h;case He:a=t[c+1],h=t[c+2],_.push(He,a,h),c+=3;break;case $e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Je;case Je:r=o===Ke||o===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,n=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,n=ei;case ei:r=o===Qe||o===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,n=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 ni: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 oi:_.push(oi),c++;break;case ai:a=t[c+1],h=t[c+2],e?gi(_,a,h,t[c+3],t[c+4]):Si(_,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]]):Si(_,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]):Si(_,t,c,6),c+=6;break;case di:vi(e?_:Si(_,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):Si(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ui:mi(e?_:Si(_,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):Si(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case pi:yi(e?_:Si(_,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: ${n} [index:${c}]`,t),_}o=n}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(He,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(oi)}})),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},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:Ri,copyData:Si}=Ei,{M:Ci,L:Oi,C:Li,Q:Ti,Z:Pi,N:Mi,D:Ai,X:Di,G:Ii,F:Wi,O:Fi,P:zi,U:Ni}=oe,{getMinDistanceFrom:Yi,getRadianFrom:Xi}=A,{tan:Hi,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(Oi,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Li,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Ti,e,i,s,n)},closePath(t){t.push(Pi)},rect(t,e,i,s,n){t.push(Mi,e,i,s,n)},roundRect(t,e,i,s,n,o){if("number"==typeof o)t.push(Di,e,i,s,n,o);else{const r=a.fourNumber(o);r?t.push(Ai,e,i,s,n,...r):t.push(Mi,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,a,h){void 0===o?t.push(Wi,e,i,s,n):(void 0===r&&(r=0),void 0===a&&(a=360),t.push(Ii,e,i,s,n,o,r,a,h?1:0))},arc(t,e,i,s,n,o,r){void 0===n?t.push(zi,e,i,s):(void 0===o&&(o=360),t.push(Fi,e,i,s,n,o,r?1:0))},arcTo(t,e,i,s,n,o,r,a){if(void 0!==r){const t=Yi(r,a,e,i,s,n);o=Vi(o,Vi(t/2,t/2*ji(Hi(Xi(r,a,e,i,s,n)/2))))}t.push(Ni,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,a,h){Te.ellipse(null,e,i,s,n,void 0===o?0:o,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,n,o,r,a,h)},drawArc(t,e,i,s,n,o,r){Te.arc(null,e,i,s,void 0===n?0:n,void 0===o?360:o,r,null,null,Ui),t.push(Ci,Ui.x,Ui.y),Ki(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){Te.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:ns,arc:os,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,n,o){return Qi(this.__path,t,e,i,s,n,o),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,n){return ss(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return ns(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return os(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return rs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return as(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return hs(this.__path,t,e,i,s,n,o),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}=oe,Es=bt.get("PathDrawer"),Bs={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)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]*l,e[s+6]*l,e[s+7]*l,e[s+8]),s+=9;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,d,!1),s+=5;break;case xs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*l,e[s+5]*l,e[s+6]),s+=7;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],0,d,!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:Rs,L:Ss,C:Cs,Q:Os,Z:Ls,N:Ts,D:Ps,X:Ms,G:As,F:Ds,O:Is,P:Ws,U:Fs}=oe,{toTwoPointBounds:zs,toTwoPointBoundsByQuadraticCurve:Ns,arcTo:Ys,arc:Xs,ellipse:Hs}=Te,{addPointBounds:Vs,copy:js,addPoint:Us,setPoint:Gs,addBounds:Zs,toBounds:Ks}=H,qs=bt.get("PathBounds");let Js,$s,Qs;const tn={},en={},sn={},nn={toBounds(t,e){nn.toTwoPointBounds(t,en),Ks(en,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Gs(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===Ls||r===Cs||r===Os?Gs(e,h,l):Gs(e,t[a+1],t[a+2])),r){case Rs:case Ss:h=t[a+1],l=t[a+2],Us(e,h,l),a+=3;break;case Cs:n=t[a+5],o=t[a+6],zs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,tn),Vs(e,tn),h=n,l=o,a+=7;break;case Os:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],Ns(h,l,i,s,n,o,tn),Vs(e,tn),h=n,l=o,a+=5;break;case Ls:a+=1;break;case Ts:h=t[a+1],l=t[a+2],Zs(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ps:case Ms: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 As:Hs(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],tn,sn),0===a?js(e,tn):Vs(e,tn),h=sn.x,l=sn.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:Xs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],tn,sn),0===a?js(e,tn):Vs(e,tn),h=sn.x,l=sn.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],tn,sn),0===a?js(e,tn):Vs(e,tn),h=sn.x,l=sn.y,a+=6;break;default:return void qs.error(`command: ${r} [index:${a}]`,t)}}},{M:on,L:rn,Z:an}=oe,{getCenterX:hn,getCenterY:ln}=A,{arcTo:dn}=Gi,cn={smooth(t,e,i){let s,n,o=0,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0;const p=t.length,g=[];for(;o<p;)switch(s=t[o],s){case on:h=u=t[o+1],l=_=t[o+2],o+=3,t[o]===rn?(d=t[o+1],c=t[o+2],g.push(on,hn(h,d),ln(l,c))):g.push(on,h,l);break;case rn:switch(r=t[o+1],a=t[o+2],o+=3,t[o]){case rn:dn(g,r,a,t[o+1],t[o+2],e,u,_);break;case an:dn(g,r,a,h,l,e,u,_);break;default:g.push(rn,r,a)}u=r,_=a;break;case an:dn(g,h,l,d,c,e,u,_),g.push(an),o+=1;break;default:n=ce[s];for(let e=0;e<n;e++)g.push(t[o+e]);o+=n}return s!==an&&(g[1]=h,g[2]=l),g}};se.creator=new ds,se.parse=Ei.parse,se.convertToCanvasData=Ei.toCanvasData;const un=new ds,{drawRoundRect:_n}=ue;function pn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){_n(this,t,e,i,s,n)})}(t)}const gn={opacityTypes:["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=fn.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{}}}},fn=gn;fn.opacityTypes.forEach((t=>fn.upperCaseTypeMap[t]=t.toUpperCase()));const yn=bt.get("TaskProcessor");class mn{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.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){yn.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class vn{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,n,o;const r=new mn(t);return r.parent=this,"number"==typeof e?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(r.time=n),!1===s&&(r.parallel=!1),void 0===o?this.push(r,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(r,i))}),o)),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 wn=bt.get("Resource"),xn={tasker:new vn,map:{},get isComplete(){return bn.tasker.isComplete},set(t,e){bn.map[t]&&wn.repeat(t),bn.map[t]=e},get:t=>bn.map[t],remove(t){const e=bn.map[t];e&&(e.destroy&&e.destroy(),delete bn.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,i,s){let n;return"string"==typeof i?n={url:i}:i.url||(n={url:t,view:i}),n&&(s&&(n.format=s),i=e.image(n)),bn.set(t,i),i},destroy(){bn.map={}}},bn=xn,kn={maxRecycled:10,recycledList:[],patternTasker:new vn,get(t){let i=xn.get(t.url);return i||xn.set(t.url,i=e.image(t)),i.use++,i},recycle(t){t.use--,setTimeout((()=>{t.use||En.recycledList.push(t)}))},clearRecycled(){const t=En.recycledList;t.length>En.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&xn.remove(t.url))),t.length=0)},hasOpacityPixel:t=>gn.opacityTypes.some((e=>En.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+gn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+gn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){En.recycledList=[]}},En=kn,{IMAGE:Bn,create:Rn}=i;class Sn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Rn(Bn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}kn.isFormat("svg",t)&&(this.isSVG=!0),kn.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(e,i){return this.loading||(this.loading=!0,xn.tasker.add((()=>jt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),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)}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){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 o=t.origin.createCanvas(e,i),r=o.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,i,s,n){const o=t.canvas.createPattern(e,i);try{s&&o.setTransform&&(o.setTransform(s),s=null)}catch(t){}return n&&(n.transform=s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Cn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function On(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ln(t,e){return(i,s)=>Pn(i,s,t,e&&e(s))}function Tn(t){return t}function Pn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Cn(t,e,Object.assign(n,s||{})),oo(t,e,i)}function Mn(t){return Ln(t)}function An(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Dn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Nn(this))}})))}function In(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Fn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&Nn(this)}})))}function zn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(Nn(this),this.__.__removeNaturalSize())}})))}function Nn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Yn(t){return Ln(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Nn(this)}})))}const Xn=Fn;function Hn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&Vn(this)}})))}function Vn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Nn(t)}const jn=Hn;function Un(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Gn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Zn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&qn(this)}})))}function Kn(t){return Ln(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Jn(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Jn(this,t,e,i),this.mask&&qn(this)}})))}function qn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Jn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Nn(t))}function $n(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function Qn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function to(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function eo(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===bt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function io(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function so(t){return(e,i)=>{Cn(e,"__DataProcessor",{get:()=>t})}}function no(t){return(e,i)=>{Cn(e,"__LayoutProcessor",{get:()=>t})}}function oo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[n];return void 0===t?i:t},set(t){this[n]=t}};if(void 0===i)r.get=function(){return this[n]};else if("function"==typeof i)r.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Ht(i);r.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?r.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:a&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(r.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:a&&s.children.length?s.boxBounds.height:i}return t});let h,l=s;for(;!h&&l;)h=On(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[o]&&(r.set=s[o],delete s[o]),Cn(s,e,r)}const ro=new bt("rewrite"),ao=[],ho=["destroy","constructor"];function lo(t){return(e,i)=>{ao.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function co(){return t=>{uo()}}function uo(t){ao.length&&(ao.forEach((e=>{t&&ro.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ao.length=0)}function _o(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(ho.includes(s)||e&&e.includes(s)))if(t.prototype){On(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function po(){return t=>{Tt.register(t)}}function go(){return t=>{At.register(t)}}setTimeout((()=>uo(!0)));const{copy:fo,toInnerPoint:yo,toOuterPoint:mo,scaleOfOuter:vo,rotateOfOuter:wo,skewOfOuter:xo,multiplyParent:bo,divideParent:ko,getLayout:Eo}=b,Bo={},{round:Ro}=Math,So={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Lo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Oo(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++)To(e[t])}},updateAllChange(t){if(To(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Po(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,n){const o="object"==typeof e?Object.assign({},e):{x:e,y:i};s?mo(t.localTransform,o,o,!0):t.parent&&yo(t.parent.worldTransform,o,o,!0),Co.moveLocal(t,o.x,o.y,n)},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=Ro(e),i=Ro(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){Co.zoomOfLocal(t,Mo(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if("number"!=typeof s&&(s&&(o=s),s=i),fo(Bo,r),vo(Bo,e,i,s),t.origin||t.around)Co.setTransform(t,Bo,n,o);else{const e=t.x+Bo.e-r.e,a=t.y+Bo.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Co.rotateOfLocal(t,Mo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;fo(Bo,n),wo(Bo,e,i),t.origin||t.around?Co.setTransform(t,Bo,!1,s):t.set({x:t.x+Bo.e-n.e,y:t.y+Bo.f-n.f,rotation:a.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Co.skewOfLocal(t,Mo(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){fo(Bo,t.__localMatrix),xo(Bo,e,i,s),Co.setTransform(t,Bo,n,o)},transformWorld(t,e,i,s){fo(Bo,t.worldTransform),bo(Bo,e),t.parent&&ko(Bo,t.parent.worldTransform),Co.setTransform(t,Bo,i,s)},transform(t,e,i,s){fo(Bo,t.localTransform),bo(Bo,e),Co.setTransform(t,Bo,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Co.getInnerOrigin(t,n.origin),r=Eo(e,o,n.around&&Co.getInnerOrigin(t,n.around));if(i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){rt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Co.getInnerOrigin(t,n.origin);A.move(r,o.x-s.x,o.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 vo(i,Co.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>A.tempToOuterOf(Co.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ft.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(fo(Bo,t.worldTransform),ko(Bo,e.worldTransform),i?Bo:Object.assign({},Bo)),drop(t,e,i,s){t.setTransform(Co.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}}},Co=So,{updateAllMatrix:Oo,updateMatrix:Lo,updateAllWorldOpacity:To,updateAllChange:Po}=Co;function Mo(t,e){return t.__layout.update(),t.parent?A.tempToInnerOf(e,t.parent.__world):e}const Ao={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:Do}=So,Io={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),Wo(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++)Fo(e[t],e)},updateBounds(t,e){const i=[t];Fo(t,i),zo(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++)Do(s[t]);e&&e===i||Do(i)}}},{pushAllChildBranch:Wo,pushAllBranchStack:Fo,updateBoundsByBranchStack:zo}=Io,No={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:Yo}=So,{toOuterOf:Xo,getPoints:Ho,copy:Vo}=rt,jo="_localContentBounds",Uo="_worldContentBounds",Go="_worldBoxBounds",Zo="_worldStrokeBounds";class Ko{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 Xo(this.contentBounds,this.leaf.__localMatrix,this[jo]||(this[jo]={})),this[jo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Xo(this.contentBounds,this.leaf.__world,this[Uo]||(this[Uo]={})),this[Uo]}get worldBoxBounds(){return Xo(this.boxBounds,this.leaf.__world,this[Go]||(this[Go]={})),this[Go]}get worldStrokeBounds(){return Xo(this.strokeBounds,this.leaf.__world,this[Zo]||(this[Zo]={})),this[Zo]}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{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,t.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return Yo(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 dt(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,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=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},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=b.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Yo(s,e,!0)}if(r||(r=b.getLayout(o)),Vo(r,a),A.copy(r,n),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=Ho(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 void 0!==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=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class qo{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 Jo extends qo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Jo.ADD="child.add",Jo.REMOVE="child.remove",Jo.CREATED="created",Jo.MOUNTED="mounted",Jo.UNMOUNTED="unmounted",Jo.DESTROY="destroy";class $o extends qo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}$o.CHANGE="property.change",$o.LEAFER_CHANGE="property.leafer_change";class Qo extends qo{constructor(t,e){super(t),Object.assign(this,e)}}Qo.LOAD="image.load",Qo.LOADED="image.loaded",Qo.ERROR="image.error";class tr extends qo{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(tr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}tr.RESIZE="resize";class er extends qo{constructor(t,e){super(t),this.data=e}}er.REQUEST="watch.request",er.DATA="watch.data";class ir extends qo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ir.REQUEST="layout.request",ir.START="layout.start",ir.BEFORE="layout.before",ir.LAYOUT="layout",ir.AFTER="layout.after",ir.AGAIN="layout.again",ir.END="layout.end";class sr extends qo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}sr.REQUEST="render.request",sr.CHILD_START="render.child_start",sr.CHILD_END="render.child_end",sr.START="render.start",sr.BEFORE="render.before",sr.RENDER="render",sr.AFTER="render.after",sr.AGAIN="render.again",sr.END="render.end",sr.NEXT="render.next";class nr extends qo{}nr.START="leafer.start",nr.BEFORE_READY="leafer.before_ready",nr.READY="leafer.ready",nr.AFTER_READY="leafer.after_ready",nr.VIEW_READY="leafer.view_ready",nr.VIEW_COMPLETED="leafer.view_completed",nr.STOP="leafer.stop",nr.RESTART="leafer.restart",nr.END="leafer.end";const or={};class rr{set event(t){this.on(t)}on(t,e,i){if(!e){let e,i=t;for(let t in i)e=i[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=ar(this,s,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(o=r[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):r[t]=[h])}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=ar(this,t);s.forEach((t=>{t&&(n=r[t],n&&(o=n.findIndex((t=>t.listener===e)),o>-1&&n.splice(o,1),n.length||delete r[t]))}))}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 i&&(e=e.bind(i)),this.on(t,e,s),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,i){this.on(t,e,{once:!0,capture:i})}emit(t,e,i){!e&&At.has(t)&&(e=At.get(t,{type:t,target:this,current:this}));const s=ar(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}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!!(void 0===e?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ar(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:or)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:or)}}const{on:hr,on_:lr,off:dr,off_:cr,once:ur,emit:_r,emitEvent:pr,hasEvent:gr,destroy:fr}=rr.prototype,yr={on:hr,on_:lr,off:dr,off_:cr,once:ur,emit:_r,emitEvent:pr,hasEvent:gr,destroyEventer:fr},{isFinite:mr}=Number,vr=bt.get("setAttr"),wr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!mr(e)&&void 0!==e&&(vr.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=$o,n=new $o(i,this,t,s,e);return this.isLeafer?this.emitEvent(new $o($o.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(n),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||void 0===i.normalStyle[t]||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:xr,multiplyParent:br,translateInner:kr,defaultWorld:Er}=b,{toPoint:Br,tempPoint:Rr}=ft,Sr={__updateWorldMatrix(){br(this.__local||this.__layout,this.parent?this.parent.__world:Er,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.rotationChanged)&&(xr(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Br(i.around||i.origin,t.boxBounds,Rr),kr(e,-Rr.x,-Rr.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Cr,updateAllMatrix:Or}=So,{updateBounds:Lr}=Io,{toOuterOf:Tr,copyAndSpread:Pr,copy:Mr}=rt,{toBounds:Ar}=nn,Dr={__updateWorldBounds(){Tr(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Tr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Tr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Tr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Ar(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(),Or(this),Lr(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Or(this),Lr(this,this))):Cr(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Pr(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Pr(t.renderBounds,t.boxBounds,t.renderSpread):Mr(t.renderBounds,t.strokeBounds)}},Ir={__render(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);bt.showBounds&&bt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Wr}=Ao,Fr={__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 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++)Wr(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++)Wr(i[s],e)||i[s].__clip(t,e)}}},{LEAF:zr,create:Nr}=i,{toInnerPoint:Yr,toOuterPoint:Xr,multiplyParent:Hr}=b,{toOuterOf:Vr}=rt,{copy:jr,move:Ur}=A,{moveLocal:Gr,zoomOfLocal:Zr,rotateOfLocal:Kr,skewOfLocal:qr,moveWorld:Jr,zoomOfWorld:$r,rotateOfWorld:Qr,skewOfWorld:ta,transform:ea,transformWorld:ia,setTransform:sa,getFlipTransform:na,getLocalOrigin:oa,getRelativeWorld:ra,drop:aa}=So;let ha=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 Ko}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=Nr(zr),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Jo.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(Jo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Jo.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(Jo.MOUNTED)):this.__emitLifeEvent(Jo.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 Hr(i,t.matrix,e,void 0,i),Vr(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?ra(this,e):this.worldTransform,n=i?t:{};return Vr(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&jr(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&jr(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Yr(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Xr(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:o,y:r}=this.boxBounds;return Ur(n,-o,-r),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:o,y:r}=this.boxBounds;return Ur(n,o,r),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){sa(this,t,e,i)}transform(t,e,i){ea(this,t,e,i)}move(t,e,i){Gr(this,t,e,i)}moveInner(t,e,i){Jr(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Zr(this,oa(this,t),e,i,s,n)}rotateOf(t,e,i){Kr(this,oa(this,t),e,i)}skewOf(t,e,i,s,n){qr(this,oa(this,t),e,i,s,n)}transformWorld(t,e,i){ia(this,t,e,i)}moveWorld(t,e,i){Jr(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){$r(this,t,e,i,s,n)}rotateOfWorld(t,e){Qr(this,t,e)}skewOfWorld(t,e,i,s,n){ta(this,t,e,i,s,n)}flip(t,e){ea(this,na(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,i,s){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ot.need("path")}getMotionPoint(t){return Ot.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){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):oo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Fn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Jo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Jo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ha=Vt([_o(wr),_o(Sr),_o(Dr),_o(yr),_o(Ir)],ha);const{setListWithFn:la}=rt,{sort:da}=Io,{localBoxBounds:ca,localStrokeBounds:ua,localRenderBounds:_a,maskLocalBoxBounds:pa,maskLocalStrokeBounds:ga,maskLocalRenderBounds:fa}=Ao,ya=new bt("Branch");let ma=class extends ha{__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(){la(this.__layout.boxBounds,this.children,this.__hasMask?pa:ca)}__updateStrokeBounds(){la(this.__layout.strokeBounds,this.children,this.__hasMask?ga:ua)}__updateRenderBounds(){la(this.__layout.renderBounds,this.children,this.__hasMask?fa:_a)}__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(da),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ya.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=Tt.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(Jo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Jo.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(Jo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Jo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Jo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};ma=Vt([_o(Fr)],ma);class va{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,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++)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 va;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 wa{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 xa="1.6.1";class ba 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}}pn(OffscreenCanvasRenderingContext2D.prototype),pn(Path2D.prototype);const{mineType:ka}=gn;function Ea(i,s){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,n)=>{t.convertToBlob({type:ka(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:ka(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=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new ba(t,e),image:t=>new Sn(t)}),t.name="web",t.isWorker=!0,t.backgrounder=!0,t.requestRender=function(t){requestAnimationFrame(t)},Cn(t,"devicePixelRatio",{get:()=>1});const{userAgent:Ba}=navigator;Ba.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):Ba.indexOf("Safari")>-1&&-1===Ba.indexOf("Chrome")&&(t.fullImageShadow=!0),Ba.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):Ba.indexOf("Mac")>-1?t.os="Mac":Ba.indexOf("Linux")>-1&&(t.os="Linux");class Ra{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new va;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 va,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(sr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Jo.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 er(er.DATA,{updatedList:this.updatedList})),this.__updatedList=new va,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($o.CHANGE,this.__onAttrChange,this),t.on_([Jo.ADD,Jo.REMOVE],this.__onChildEvent,this),t.on_(er.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:Sa,updateBounds:Ca,updateAllWorldOpacity:Oa}=So,{pushAllChildBranch:La,pushAllParent:Ta}=Io;const{worldBounds:Pa}=Ao;class Ma{constructor(t){this.updatedBounds=new dt,this.beforeBounds=new dt,this.afterBounds=new dt,t instanceof Array&&(t=new va(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Pa)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Pa),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:Aa,updateAllChange:Da}=So,Ia=bt.get("Layouter");class Wa{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new wa,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.running)return;const{target:t}=this;this.times=0;try{t.emit(ir.START),this.layoutOnce(),t.emitEvent(new ir(ir.END,this.layoutedBlocks,this.times))}catch(t){Ia.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ia.warn("layouting"):this.times>3?Ia.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(er.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=Rt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=ir,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new ir(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?(Sa(t,!0),e.add(t),t.isBranch&&La(t,e),Ta(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ta(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||Ca(s[t])}Ca(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&Oa(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new ir(o,a,this.times)),i.emitEvent(new ir(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Rt.end(e)}fullLayout(){const t=Rt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ir,o=this.getBlocks(new va(e));e.emitEvent(new ir(i,o,this.times)),Wa.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new ir(s,o,this.times)),e.emitEvent(new ir(n,o,this.times)),this.addBlocks(o),Rt.end(t)}static fullLayout(t){Aa(t,!0),t.isBranch?Io.updateBounds(t):So.updateBounds(t),Da(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ma([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ma(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ir.REQUEST,this.layout,this),t.on_(ir.AGAIN,this.layoutAgain,this),t.on_(er.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fa=bt.get("Renderer");class za{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(ir.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(sr.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(sr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(sr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new dt,Fa.log(e.innerName,"---\x3e");try{this.emitRender(sr.START),this.renderOnce(t),this.emitRender(sr.END,this.totalBounds),kn.clearRecycled()}catch(t){this.rendering=!1,Fa.error(t)}Fa.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Fa.warn("rendering");if(this.times>3)return Fa.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new dt,this.renderOptions={},t)this.emitRender(sr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(sr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(sr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(sr.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=Rt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new dt(s);i.save(),s.spread(za.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Rt.end(e)}fullRender(){const t=Rt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Rt.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),bt.showRepaint&&bt.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 dt;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 dt(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 dt(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||Fa.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 sr(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(sr.REQUEST,this.update,this),t.on_(ir.END,this.__onLayoutEnd,this),t.on_(sr.AGAIN,this.renderAgain,this),t.on_(tr.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}za.clipSpread=10;const{hitRadiusPoint:Na}=rt;class Ya{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,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new va(i.findList),i.findList||this.hitBranch(o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n),h=n?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 va;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||So.worldHittable(e))&&(this.hitChild(e,o),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 va;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 va;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 va,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Na(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&&!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 Xa{constructor(t,i){this.config={},i&&(this.config=Wt.default(i,this.config)),this.picker=new Ya(this.target=t,this),this.finder=e.finder&&e.finder()}getByPoint(e,i,s){const{target:n,picker:o}=this;return t.backgrounder&&n&&n.updateLayout(),o.getByPoint(e,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Ot.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ha(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Va(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function ja(){return(t,e)=>{const i="_"+e;Cn(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(e,{watcher:(t,e)=>new Ra(t,e),layouter:(t,e)=>new Wa(t,e),renderer:(t,e,i)=>new za(t,e,i),selector:(t,e)=>new Xa(t,e)}),t.layout=Wa.fullLayout;const Ua={},Ga={},Za={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},Ka={},qa={},Ja={},$a={},Qa={},th={apply(){Ot.need("filter")}},eh={},ih={setStyleName:()=>Ot.need("state"),set:()=>Ot.need("state")},sh={list:{},register(t,e){sh.list[t]=e},get:t=>sh.list[t]},{parse:nh,objectToCanvasData:oh}=Ei,rh={},ah=bt.get("UIData");class hh 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 __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,ah.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ah.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){if(this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t){if("object"==typeof t){this.__setInput("fill",t);const e=this.__leaf.__layout;e.boxChanged||e.boxChange(),this.__isFills=!0,this._fill||(this._fill=rh)}}else this.__isFills&&(this.__removeInput("fill"),Ja.recycleImage("fill",this),this.__isFills=!1,this.__pixelFill&&(this.__pixelFill=!1)),this._fill=t}setStroke(t){if("string"!=typeof t&&t){if("object"==typeof t){this.__setInput("stroke",t);const e=this.__leaf.__layout;e.boxChanged||e.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=rh)}}else this.__isStrokes&&(this.__removeInput("stroke"),Ja.recycleImage("stroke",this),this.__isStrokes=!1,this.__pixelStroke&&(this.__pixelStroke=!1)),this._stroke=t}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?nh(t):oh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){lh(this,"shadow",t)}setInnerShadow(t){lh(this,"innerShadow",t)}setFilter(t){lh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&qa.compute("fill",this.__leaf),e&&qa.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function lh(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=null)):i=i&&!1!==i.visible?[i]:null,t["_"+e]=i}class dh extends hh{}class ch extends dh{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 uh extends dh{__getInputData(t,e){const i=super.__getInputData(t,e);return ee.forEach((t=>delete i[t])),i}}class _h extends ch{}class ph extends hh{}class gh extends hh{get __boxStroke(){return!this.__pathInputed}}class fh extends hh{get __boxStroke(){return!this.__pathInputed}}class yh extends hh{}class mh extends hh{}class vh extends hh{get __pathInputed(){return 2}}class wh extends dh{}const xh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class bh extends hh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=xh[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=Tt.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange(),o.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class kh extends gh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.__leaf.image&&(this.__leaf.image=null),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 Eh extends gh{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 Bh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:n}=i,o=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),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter: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)),o&&(t+=th.getSpread(o));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))),n&&(r=Math.max(r,n)),this.__layout.renderShapeSpread=r,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},Rh={__updateChange(){const t=this.__,e=this.__world;if(t.__useEffect){const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o}=this.__;t.__useEffect=!!(e||i||s||n||o)}const i=t.__hasHalf;e.half!==i&&(e.half=i),t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){Sh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r}=s;if(this.__drawRenderPath(t),s.__useEffect){const a=qa.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:l,filter:d}=s;h&&Qa.shadow(this,t,a),n&&(s.__isFills?qa.fills(n,this,t):qa.fill(n,this,t)),r&&this.__drawAfterFill(t,e),l&&Qa.innerShadow(this,t,a),o&&(s.__isStrokes?qa.strokes(o,this,t):qa.stroke(o,this,t)),d&&th.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else n&&(s.__isFills?qa.fills(n,this,t):qa.fill(n,this,t)),r&&this.__drawAfterFill(t,e),o&&(s.__isStrokes?qa.strokes(o,this,t):qa.stroke(o,this,t))}else s.__pathInputed?Sh(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,i,s){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:n,stroke:o}=this.__;this.__drawRenderPath(t),n&&!i&&(this.__.__pixelFill?qa.fills(n,this,t):qa.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),o&&!s&&(this.__.__pixelStroke?qa.strokes(o,this,t):qa.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),this.windingRule?t.clip(this.windingRule):t.clip(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Sh(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o}=t.__;t.__drawRenderPath(e),s&&qa.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&qa.stroke(n,t,e)}const Ch={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),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,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Oh;let Lh=Oh=class extends ha{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){a.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return un.set(this.path=t||[]),t||this.__drawPathByBox(un),un}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 Ot.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Ot.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(un.set(i=[]),this.__drawPathByBox(un)),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||eh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?cn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ka.addArrows(this,!t.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Bs.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:o}=this.__;t.roundRect(e,i,s,n,"number"==typeof o?[o]:o)}else t.rect(e,i,s,n)}animate(t,e,i,s){return Ot.need("animate")}killAnimate(t,e){}export(t,e){return Ot.need("export")}syncExport(t,e){return Ot.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Oh.one(e)}static one(t,e,i,s,n){return Tt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){po()(this)}static registerData(t){so(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([so(hh)],Lh.prototype,"__",void 0),Vt([ja()],Lh.prototype,"zoomLayer",void 0),Vt([Mn("")],Lh.prototype,"id",void 0),Vt([Mn("")],Lh.prototype,"name",void 0),Vt([Mn("")],Lh.prototype,"className",void 0),Vt([Gn("pass-through")],Lh.prototype,"blendMode",void 0),Vt([Zn(1)],Lh.prototype,"opacity",void 0),Vt([Kn(!0)],Lh.prototype,"visible",void 0),Vt([Gn(!1)],Lh.prototype,"locked",void 0),Vt([Gn(!1)],Lh.prototype,"dim",void 0),Vt([Gn(!1)],Lh.prototype,"dimskip",void 0),Vt([$n(0)],Lh.prototype,"zIndex",void 0),Vt([Qn(!1)],Lh.prototype,"mask",void 0),Vt([to(!1)],Lh.prototype,"eraser",void 0),Vt([An(0,!0)],Lh.prototype,"x",void 0),Vt([An(0,!0)],Lh.prototype,"y",void 0),Vt([Fn(100,!0)],Lh.prototype,"width",void 0),Vt([Fn(100,!0)],Lh.prototype,"height",void 0),Vt([In(1,!0)],Lh.prototype,"scaleX",void 0),Vt([In(1,!0)],Lh.prototype,"scaleY",void 0),Vt([Wn(0,!0)],Lh.prototype,"rotation",void 0),Vt([Wn(0,!0)],Lh.prototype,"skewX",void 0),Vt([Wn(0,!0)],Lh.prototype,"skewY",void 0),Vt([An(0,!0)],Lh.prototype,"offsetX",void 0),Vt([An(0,!0)],Lh.prototype,"offsetY",void 0),Vt([An(0,!0)],Lh.prototype,"scrollX",void 0),Vt([An(0,!0)],Lh.prototype,"scrollY",void 0),Vt([Dn()],Lh.prototype,"origin",void 0),Vt([Dn()],Lh.prototype,"around",void 0),Vt([Mn(!1)],Lh.prototype,"lazy",void 0),Vt([zn(1)],Lh.prototype,"pixelRatio",void 0),Vt([Yn()],Lh.prototype,"path",void 0),Vt([Xn()],Lh.prototype,"windingRule",void 0),Vt([Xn(!0)],Lh.prototype,"closed",void 0),Vt([Fn(0)],Lh.prototype,"padding",void 0),Vt([Fn(!1)],Lh.prototype,"lockRatio",void 0),Vt([Fn()],Lh.prototype,"widthRange",void 0),Vt([Fn()],Lh.prototype,"heightRange",void 0),Vt([Mn(!1)],Lh.prototype,"draggable",void 0),Vt([Mn()],Lh.prototype,"dragBounds",void 0),Vt([Mn(!1)],Lh.prototype,"editable",void 0),Vt([eo(!0)],Lh.prototype,"hittable",void 0),Vt([eo("path")],Lh.prototype,"hitFill",void 0),Vt([jn("path")],Lh.prototype,"hitStroke",void 0),Vt([eo(!1)],Lh.prototype,"hitBox",void 0),Vt([eo(!0)],Lh.prototype,"hitChildren",void 0),Vt([eo(!0)],Lh.prototype,"hitSelf",void 0),Vt([eo()],Lh.prototype,"hitRadius",void 0),Vt([io("")],Lh.prototype,"cursor",void 0),Vt([Gn()],Lh.prototype,"fill",void 0),Vt([jn()],Lh.prototype,"stroke",void 0),Vt([jn("inside")],Lh.prototype,"strokeAlign",void 0),Vt([jn(1)],Lh.prototype,"strokeWidth",void 0),Vt([jn(!1)],Lh.prototype,"strokeWidthFixed",void 0),Vt([jn("none")],Lh.prototype,"strokeCap",void 0),Vt([jn("miter")],Lh.prototype,"strokeJoin",void 0),Vt([jn()],Lh.prototype,"dashPattern",void 0),Vt([jn(0)],Lh.prototype,"dashOffset",void 0),Vt([jn(10)],Lh.prototype,"miterLimit",void 0),Vt([Xn(0)],Lh.prototype,"cornerRadius",void 0),Vt([Xn()],Lh.prototype,"cornerSmoothing",void 0),Vt([Ha()],Lh.prototype,"shadow",void 0),Vt([Ha()],Lh.prototype,"innerShadow",void 0),Vt([Ha()],Lh.prototype,"blur",void 0),Vt([Ha()],Lh.prototype,"backgroundBlur",void 0),Vt([Ha()],Lh.prototype,"grayscale",void 0),Vt([Ha()],Lh.prototype,"filter",void 0),Vt([Mn({})],Lh.prototype,"data",void 0),Vt([lo(ha.prototype.reset)],Lh.prototype,"reset",null),Lh=Oh=Vt([_o(Bh),_o(Rh),co()],Lh);let Th=class extends Lh{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 Ph;Vt([so(dh)],Th.prototype,"__",void 0),Vt([Fn(0)],Th.prototype,"width",void 0),Vt([Fn(0)],Th.prototype,"height",void 0),Th=Vt([_o(ma),po()],Th);const Mh=bt.get("Leafer");let Ah=Ph=class extends Th{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&xn.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),Ph.list.add(this)}init(t,i){if(this.canvas)return;let s;const{config:n}=this;this.__setLeafer(this),i&&(this.parentApp=i,this.__bindApp(i),s=i.running),t&&(this.parent=i,this.initType(t.type),this.parent=void 0,Wt.assign(n,t));const o=this.canvas=e.canvas(n);this.__controllers.push(this.renderer=e.renderer(this,o,n),this.watcher=e.watcher(this,n),this.layouter=e.layouter(this,n)),this.isApp&&this.__setApp(),this.__checkAutoLayout(n,i),this.view=o.view,i||(this.selector=e.selector(this),this.interaction=e.interaction(this,o,this.selector,n),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=e.hitCanvasManager()),this.canvasManager=new It,s=n.start),this.hittable=n.hittable,this.fill=n.fill,this.canvasManager.add(o),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),No.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(nr.RESTART):this.emitLeafer(nr.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(nr.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 dt(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 tr(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 ut(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(nr.BEFORE_READY),this.emitLeafer(nr.READY),this.emitLeafer(nr.AFTER_READY),No.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(nr.VIEW_READY),No.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){No.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(nr.VIEW_COMPLETED),No.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 Ot.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 nr(t,this))}__listenEvents(){const t=Rt.start("FirstCreate "+this.innerName);this.once(nr.START,(()=>Rt.end(t))),this.once(ir.START,(()=>this.updateLazyBounds())),this.once(sr.START,(()=>this.__onCreated())),this.once(sr.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(er.DATA,this.__onWatchData,this),this.on_(ir.END,this.__onLayoutEnd,this),this.on_(sr.NEXT,this.__onNextRender,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(t){const e=()=>{if(!this.destroyed){Ph.list.remove(this);try{this.stop(),this.emitEvent(new nr(nr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{kn.clearRecycled()}),100)}catch(t){Mh.error(t)}}};t?e():setTimeout(e)}};Ah.list=new va,Vt([so(uh)],Ah.prototype,"__",void 0),Vt([Fn()],Ah.prototype,"pixelRatio",void 0),Ah=Ph=Vt([po()],Ah);let Dh=class extends Lh{get __tag(){return"Rect"}constructor(t){super(t)}};Vt([so(gh)],Dh.prototype,"__",void 0),Dh=Vt([_o(Ch),co(),po()],Dh);const{copy:Ih,add:Wh,includes:Fh}=rt,zh=Dh.prototype,Nh=Th.prototype,Yh={};let Xh=class extends Th{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(),Ih(Yh,e),this.__updateRectRenderBounds(),t=!Fh(e,Yh)||void 0,t&&"hide"!==this.__.overflow&&Wh(e,Yh)):this.__updateRectRenderBounds(),this.isOverflow!==t&&(this.isOverflow=t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};Vt([so(ch)],Xh.prototype,"__",void 0),Vt([Fn(100)],Xh.prototype,"width",void 0),Vt([Fn(100)],Xh.prototype,"height",void 0),Vt([Mn(!1)],Xh.prototype,"resizeChildren",void 0),Vt([Un("show")],Xh.prototype,"overflow",void 0),Vt([lo(zh.__updateStrokeSpread)],Xh.prototype,"__updateStrokeSpread",null),Vt([lo(zh.__updateRenderSpread)],Xh.prototype,"__updateRectRenderSpread",null),Vt([lo(zh.__updateBoxBounds)],Xh.prototype,"__updateRectBoxBounds",null),Vt([lo(zh.__updateStrokeBounds)],Xh.prototype,"__updateStrokeBounds",null),Vt([lo(zh.__updateRenderBounds)],Xh.prototype,"__updateRectRenderBounds",null),Vt([lo(zh.__updateChange)],Xh.prototype,"__updateRectChange",null),Vt([lo(zh.__render)],Xh.prototype,"__renderRect",null),Vt([lo(Nh.__render)],Xh.prototype,"__renderGroup",null),Xh=Vt([co(),po()],Xh);let Hh=class extends Xh{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};Vt([so(_h)],Hh.prototype,"__",void 0),Vt([Gn("#FFFFFF")],Hh.prototype,"fill",void 0),Vt([Un("hide")],Hh.prototype,"overflow",void 0),Hh=Vt([po()],Hh);const{moveTo:Vh,closePath:jh,ellipse:Uh}=Gi;let Gh=class extends Lh{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Uh(h,r,a,r*s,a*s,0,n,o,!1),Uh(h,r,a,r,a,0,o,n,!0),s<1&&jh(h)):(s<1&&(Uh(h,r,a,r*s,a*s),Vh(h,e,a)),Uh(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Vh(h,r,a),Uh(h,r,a,r,a,0,n,o,!1),jh(h)):Uh(h,r,a,r,a)}};Vt([so(fh)],Gh.prototype,"__",void 0),Vt([Xn(0)],Gh.prototype,"innerRadius",void 0),Vt([Xn(0)],Gh.prototype,"startAngle",void 0),Vt([Xn(0)],Gh.prototype,"endAngle",void 0),Gh=Vt([po()],Gh);const{moveTo:Zh,lineTo:Kh,drawPoints:qh}=Gi,{rotate:Jh,getAngle:$h,getDistance:Qh,defaultPoint:tl}=A,{toBounds:el}=nn;let il=class extends Lh{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Jh(i,e),i}set toPoint(t){this.width=Qh(tl,t),this.rotation=$h(tl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?qh(e,t.points,!1,t.closed):(Zh(e,0,0),Kh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(qh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&Ka.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?el(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};Vt([so(ph)],il.prototype,"__",void 0),Vt([Hn("center")],il.prototype,"strokeAlign",void 0),Vt([Fn(0)],il.prototype,"height",void 0),Vt([Xn()],il.prototype,"points",void 0),Vt([Xn(0)],il.prototype,"curve",void 0),Vt([Xn(!1)],il.prototype,"closed",void 0),il=Vt([po()],il);const{sin:sl,cos:nl,PI:ol}=Math,{moveTo:rl,lineTo:al,closePath:hl,drawPoints:ll}=Gi,dl=il.prototype;let cl=class extends Lh{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)ll(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,o=i/2;rl(t,n,0);for(let e=1;e<s;e++)al(t,n+n*sl(2*e*ol/s),o-o*nl(2*e*ol/s))}hl(t)}__updateRenderPath(){}__updateBoxBounds(){}};Vt([so(yh)],cl.prototype,"__",void 0),Vt([Xn(3)],cl.prototype,"sides",void 0),Vt([Xn()],cl.prototype,"points",void 0),Vt([Xn(0)],cl.prototype,"curve",void 0),Vt([lo(dl.__updateRenderPath)],cl.prototype,"__updateRenderPath",null),Vt([lo(dl.__updateBoxBounds)],cl.prototype,"__updateBoxBounds",null),cl=Vt([co(),po()],cl);const{sin:ul,cos:_l,PI:pl}=Math,{moveTo:gl,lineTo:fl,closePath:yl}=Gi;let ml=class extends Lh{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];gl(r,n,0);for(let t=1;t<2*i;t++)fl(r,n+(t%2==0?n:n*s)*ul(t*pl/i),o-(t%2==0?o:o*s)*_l(t*pl/i));yl(r)}};Vt([so(mh)],ml.prototype,"__",void 0),Vt([Xn(5)],ml.prototype,"corners",void 0),Vt([Xn(.382)],ml.prototype,"innerRadius",void 0),ml=Vt([po()],ml);let vl=class extends Dh{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t),this.on(Qo.LOADED,(t=>{"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}))}destroy(){this.image=null,super.destroy()}};Vt([so(kh)],vl.prototype,"__",void 0),Vt([Fn("")],vl.prototype,"url",void 0),vl=Vt([po()],vl);const wl=vl;let xl=class extends Dh{get __tag(){return"Canvas"}get ready(){return!this.url}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,t&&t.url&&this.drawImage(t.url)}drawImage(t){new Sn({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Qo(Qo.LOADED,{image:t}))}))}draw(t,e,i,s){const n=new Y(t.worldTransform).invert(),o=new Y;e&&o.translate(e.x,e.y),i&&("number"==typeof i?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),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=this.context=null),super.destroy()}};Vt([so(Eh)],xl.prototype,"__",void 0),Vt([Va(100)],xl.prototype,"width",void 0),Vt([Va(100)],xl.prototype,"height",void 0),Vt([Va(1)],xl.prototype,"pixelRatio",void 0),Vt([Va(!0)],xl.prototype,"smooth",void 0),Vt([Mn(!1)],xl.prototype,"safeResize",void 0),Vt([Va()],xl.prototype,"contextSettings",void 0),xl=Vt([po()],xl);const{copyAndSpread:bl,includes:kl,spread:El,setList:Bl}=rt;let Rl=class extends Lh{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:o,italic:r,textCase:h,textOverflow:l,padding:d}=t;t.__lineHeight=Za.number(e,n),t.__letterSpacing=Za.number(i,n),t.__padding=d?a.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==o?o+" ":""}${n}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=Ua.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&El(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i);const l=!kl(h,a)||void 0;l?(Bl(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h,this.isOverflow!==l&&(this.isOverflow=l)}__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;bl(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&&!eh.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Vt([so(bh)],Rl.prototype,"__",void 0),Vt([Fn(0)],Rl.prototype,"width",void 0),Vt([Fn(0)],Rl.prototype,"height",void 0),Vt([Gn()],Rl.prototype,"boxStyle",void 0),Vt([Mn(!1)],Rl.prototype,"resizeFontSize",void 0),Vt([Gn("#000000")],Rl.prototype,"fill",void 0),Vt([Hn("outside")],Rl.prototype,"strokeAlign",void 0),Vt([eo("all")],Rl.prototype,"hitFill",void 0),Vt([Fn("")],Rl.prototype,"text",void 0),Vt([Fn("caption")],Rl.prototype,"fontFamily",void 0),Vt([Fn(12)],Rl.prototype,"fontSize",void 0),Vt([Fn("normal")],Rl.prototype,"fontWeight",void 0),Vt([Fn(!1)],Rl.prototype,"italic",void 0),Vt([Fn("none")],Rl.prototype,"textCase",void 0),Vt([Fn("none")],Rl.prototype,"textDecoration",void 0),Vt([Fn(0)],Rl.prototype,"letterSpacing",void 0),Vt([Fn({type:"percent",value:1.5})],Rl.prototype,"lineHeight",void 0),Vt([Fn(0)],Rl.prototype,"paraIndent",void 0),Vt([Fn(0)],Rl.prototype,"paraSpacing",void 0),Vt([Fn("x")],Rl.prototype,"writingMode",void 0),Vt([Fn("left")],Rl.prototype,"textAlign",void 0),Vt([Fn("top")],Rl.prototype,"verticalAlign",void 0),Vt([Fn(!0)],Rl.prototype,"autoSizeAlign",void 0),Vt([Fn("normal")],Rl.prototype,"textWrap",void 0),Vt([Fn("show")],Rl.prototype,"textOverflow",void 0),Rl=Vt([po()],Rl);let Sl=class extends Lh{get __tag(){return"Path"}constructor(t){super(t)}};Vt([so(vh)],Sl.prototype,"__",void 0),Vt([Hn("center")],Sl.prototype,"strokeAlign",void 0),Sl=Vt([po()],Sl);let Cl=class extends Th{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Sl(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,o){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,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};Vt([so(wh)],Cl.prototype,"__",void 0),Vt([(t,e)=>{Cn(t,e,{get(){return this.__path}})}],Cl.prototype,"path",void 0),Cl=Vt([_o(ds,["set","path","paint"]),po()],Cl);let Ol=class extends Ah{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,i){if(super.init(t,i),t){const{ground:i,tree:s,sky:n,editor:o}=t;i&&(this.ground=this.addLeafer(i)),(s||o)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(n||o)&&(this.sky=this.addLeafer(n)),o&&this.sky.add(this.editor=e.editor(o))}}__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()}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 Ah(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){if(t.context){const i=e.matrix;i&&t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this.forEach((e=>t.copyWorld(e.canvas)))}}__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(ir.END,(()=>this.__onReady())),t.once(sr.START,(()=>this.__onCreated())),t.once(sr.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(sr.END,this.__onChildRenderEnd,this))}};Ol=Vt([po()],Ol);const Ll={},Tl={isHoldSpaceKey:()=>Tl.isHold("Space"),isHold:t=>Ll[t],setDownCode(t){Ll[t]||(Ll[t]=!0)},setUpCode(t){Ll[t]=!1}},Pl={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 Ml extends qo{get spaceKey(){return Tl.isHoldSpaceKey()}get left(){return Pl.left(this)}get right(){return Pl.right(this)}get middle(){return Pl.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){At.changeName(t,e)}}let Al=class extends Ml{};Al.POINTER="pointer",Al.BEFORE_DOWN="pointer.before_down",Al.BEFORE_MOVE="pointer.before_move",Al.BEFORE_UP="pointer.before_up",Al.DOWN="pointer.down",Al.MOVE="pointer.move",Al.UP="pointer.up",Al.OVER="pointer.over",Al.OUT="pointer.out",Al.ENTER="pointer.enter",Al.LEAVE="pointer.leave",Al.TAP="tap",Al.DOUBLE_TAP="double_tap",Al.CLICK="click",Al.DOUBLE_CLICK="double_click",Al.LONG_PRESS="long_press",Al.LONG_TAP="long_tap",Al.MENU="pointer.menu",Al.MENU_TAP="pointer.menu_tap",Al=Vt([go()],Al);const Dl=Al,Il={};let Wl=class extends Al{static setList(t){this.list=t instanceof va?t:new va(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:n}=t,o=t.getLocalPoint(i,null,!0);return A.move(o,e.x-t.x,e.y-t.y),n&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===n?t.parent.boxBounds:n,o,!0),"x"===s&&(o.y=0),"y"===s&&(o.x=0),o}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,o=t.y+i.y,r=n+t.width,a=o+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),rt.includes(t,e)?(n>e.x?i.x+=e.x-n:r<h&&(i.x+=h-r),o>e.y?i.y+=e.y-o:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:r>h&&(i.x+=h-r),o<e.y?i.y+=e.y-o:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Il,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Il,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Il,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 rt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),rt.unsign(i),i}assignMove(t){Il.x=t?this.totalX:this.moveX,Il.y=t?this.totalY:this.moveY}};Wl.BEFORE_DRAG="drag.before_drag",Wl.START="drag.start",Wl.DRAG="drag",Wl.END="drag.end",Wl.OVER="drag.over",Wl.OUT="drag.out",Wl.ENTER="drag.enter",Wl.LEAVE="drag.leave",Wl=Vt([go()],Wl);const Fl=Wl;let zl=class extends Al{static setList(t){Wl.setList(t)}static setData(t){Wl.setData(t)}};zl.DROP="drop",zl=Vt([go()],zl);let Nl=class extends Wl{};Nl.BEFORE_MOVE="move.before_move",Nl.START="move.start",Nl.MOVE="move",Nl.END="move.end",Nl=Vt([go()],Nl);let Yl=class extends Ml{};Yl.BEFORE_ROTATE="rotate.before_rotate",Yl.START="rotate.start",Yl.ROTATE="rotate",Yl.END="rotate.end",Yl=Vt([go()],Yl);let Xl=class extends Wl{};Xl.SWIPE="swipe",Xl.LEFT="swipe.left",Xl.RIGHT="swipe.right",Xl.UP="swipe.up",Xl.DOWN="swipe.down",Xl=Vt([go()],Xl);let Hl=class extends Ml{};Hl.BEFORE_ZOOM="zoom.before_zoom",Hl.START="zoom.start",Hl.ZOOM="zoom",Hl.END="zoom.end",Hl=Vt([go()],Hl);let Vl=class extends Ml{};Vl.DOWN="key.down",Vl.HOLD="key.hold",Vl.UP="key.up",Vl=Vt([go()],Vl);const jl={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?Xl.UP:t>45&&t<135?Xl.DOWN:t<=45&&t>=-45?Xl.RIGHT:Xl.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:Ul.getSwipeDirection(A.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 va,{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=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(Wl.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},Ul=jl,Gl=new va,{getDragEventData:Zl,getDropEventData:Kl,getSwipeEventData:ql}=jl;class Jl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Zl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=Wl.list||this.draggableList||Gl;return this.dragging&&(s?t?Gl:new va(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(Nl.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Pl.left(t),this.dragging&&(this.interaction.emit(Wl.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 va(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=Zl(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",e.emit(Nl.BEFORE_MOVE,this.dragData),e.emit(Nl.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Wl.BEFORE_DRAG,this.dragData),e.emit(Wl.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(Wl.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(Wl.OUT,t,i),e.emit(Wl.OVER,t,s)):e.emit(Wl.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Wl.LEAVE,t,i,s),e.emit(Wl.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:o}=i,r=Zl(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Nl.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.emit(Wl.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(A.getDistance(e,t)>n.config.pointer.swipeDistance){const t=ql(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Kl(t,e,Wl.data);s.path=i,this.interaction.emit(zl.DROP,s),this.interaction.emit(Wl.LEAVE,t,i)}dragReset(){Wl.list=Wl.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 $l=bt.get("emit");const Ql=["move","zoom","rotate","key"];function td(t,e,i,s,n){if(Ql.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!id(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&ed(o,e,i,s,n)}}function ed(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!id(t,n)&&(ih.updateEventStyle&&!s&&ih.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=At.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function id(t,e){return e&&e.has(t)}const sd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},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:nd,pathCanDrag:od,pathHasOutside:rd}=jl;class ad{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&&Pl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Pl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Tl.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(sd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new va(t),this.createTransformer(),this.dragger=new Jl(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&&(Pl.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Al.BEFORE_DOWN,t),this.emit(Al.DOWN,t),Pl.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Pl.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&&Pl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Al.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=A.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(Al.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;Pl.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(Al.BEFORE_UP,t),this.emit(Al.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(Al.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Al.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,Tl.setDownCode(e),this.emit(Vl.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Vl.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,Tl.setUpCode(e),this.emit(Vl.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new va),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(Al.OUT,t,i),this.emit(Al.OVER,t,e)):this.emit(Al.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(Al.LEAVE,t,i,e),this.emit(Al.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Al.LEAVE,t),this.dragger.dragging&&this.emit(zl.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=[Al.DOUBLE_TAP,Al.DOUBLE_CLICK].some((e=>nd(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:o,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:o,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&&!rd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!od(t.path))&&!rd(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:Al.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};return this.p.snap&&A.round(s),s}emitTap(t){this.emit(Al.TAP,t),this.emit(Al.CLICK,t)}emitDoubleTap(t){this.emit(Al.DOUBLE_TAP,t),this.emit(Al.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(Al.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Al.LONG_TAP,t),(nd(t.path,Al.LONG_TAP)||nd(t.path,Al.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 dt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(tr.RESIZE,this.__onResize,this)],t.once(nr.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 o=i.length-1;o>-1;o--){if(n=i.list[o],ed(n,t,e,!0,s))return;n.isApp&&td(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&td(n,t,e,!1,s),ed(n,t,e,!1,s))return}catch(t){$l.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 hd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}hd.custom={};class ld extends It{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new va,this.pixelList=new va}getPixelType(t,i){return this.__autoClear(),this.pixelList.add(t),e.hitCanvas(i)}getPathType(t){return this.__autoClear(),this.pathList.add(t),e.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:dd,copy:cd,setRadius:ud}=A,_d={},pd=ha.prototype;pd.__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&&(cd(_d,t),ud(t=_d,e.hitRadius)),dd(t,i,_d),e.hitBox||n){if(rt.hitRadiusPoint(s.boxBounds,_d))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(_d)},pd.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},pd.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},pd.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},pd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const gd=new Y,fd=Lh.prototype;fd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(e.__pixelFill||e.__isCanvas)&&"pixel"===e.hitFill,n=e.__pixelStroke&&"pixel"===e.hitStroke,o=s||n;this.__hitCanvas||(this.__hitCanvas=o?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const r=this.__hitCanvas;if(o){const{renderBounds:i}=this.__layout,o=t.image.hitCanvasSize,a=r.hitScale=ct.set(0,0,o,o).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ct.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),kn.patternLocked=!0,this.__renderShape(r,{matrix:gd.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),kn.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},fd.__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.__pixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__strokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__pixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const yd=Lh.prototype,md=Dh.prototype,vd=Xh.prototype;md.__updateHitCanvas=vd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?yd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},md.__hitFill=vd.__hitFill=function(t){return this.__hitCanvas?yd.__hitFill.call(this,t):rt.hitRadiusPoint(this.__layout.boxBounds,t)},Rl.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach((n=>t.rect(n.x,n.y-s,n.width,e<i?i:e)))},Th.prototype.pick=function(i,s){return s||(s=Yt),this.updateLayout(),function(i){return i.leafer?i.leafer.selector:t.selector||(t.selector=e.selector())}(this).getByPoint(i,s.hitRadius||0,Object.assign(Object.assign({},s),{target:this}))};const wd=ie.prototype;function xd(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)}));if(o){const{decorationColor:t,decorationHeight:i}=s;t&&(e.fillStyle=t),n.forEach((t=>o.forEach((s=>e.fillRect(t.x,t.y+s,t.width,i)))))}}function bd(t,e,i){const{strokeAlign:s}=e.__,n="string"!=typeof t;switch(s){case"center":i.setStroke(n?void 0:t,e.__.strokeWidth,e.__),n?Bd(t,!0,e,i):Ed(e,i);break;case"inside":kd("inside",t,n,e,i);break;case"outside":kd("outside",t,n,e,i)}}function kd(t,e,i,s,n){const{__strokeWidth:o,__font:r}=s.__,a=n.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*o,s.__),a.font=r,i?Bd(e,!0,s,a):Ed(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",xd(s,a),a.blendMode="normal",s.__worldFlipped?n.copyWorldByReset(a,s.__nowWorld):n.copyWorldToInner(a,s.__nowWorld,s.__layout.renderBounds),a.recycle(s.__nowWorld)}function Ed(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=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(o){const{decorationHeight:t}=s;n.forEach((i=>o.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function Bd(t,e,i,s){let n;for(let o=0,r=t.length;o<r;o++)n=t[o],n.image&&Ja.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Ed(i,s):s.stroke(),s.restoreBlendMode()):e?Ed(i,s):s.stroke())}function Rd(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}wd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},wd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},wd.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),ct.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(ct.x,ct.y,ct.width||1,ct.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:Sd,getOuterOf:Cd,getByMove:Od,getIntersectData:Ld}=rt;let Td;function Pd(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:n,blendMode:o,color:r,opacity:a}=e;return{type:n,blendMode:o,style:Ga.string(r,a)};case"image":return Ja.image(i,t,e,s,!Td||!Td[e.url]);case"linear":return $a.linearGradient(e,s);case"radial":return $a.radialGradient(e,s);case"angular":return $a.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:Ga.string(e)}:void 0}}const Md={compute:function(t,e){const i=e.__,s=[];let n,o=i.__input[t];o instanceof Array||(o=[o]),Td=Ja.recycleImage(t,i);for(let i,n=0,r=o.length;n<r;n++)i=Pd(t,o[n],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(n=s[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=n:i.__pixelStroke=n},fill:function(t,e,i){i.fillStyle=t,e.__.__font?xd(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,i){let s;const{windingRule:n,__font:o}=e.__;for(let r=0,a=t.length;r<a;r++)s=t[r],s.image&&Ja.checkImage(e,i,s,!o)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),o?xd(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),o?xd(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):o?xd(e,i):n?i.fill(n):i.fill())},fillText:xd,stroke:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:o,__font:r}=s;if(n)if(r)bd(t,e,i);else switch(o){case"center":i.setStroke(t,n,s),i.stroke(),s.__useArrow&&Rd(e,i);break;case"inside":i.save(),i.setStroke(t,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*n,s),e.__drawRenderPath(o),o.stroke(),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:o,__font:r}=s;if(n)if(r)bd(t,e,i);else switch(o){case"center":i.setStroke(void 0,n,s),Bd(t,!1,e,i),s.__useArrow&&Rd(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),Bd(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),r.setStroke(void 0,2*n,s),Bd(t,!1,e,r),s.windingRule?r.clip(s.windingRule):r.clip(),r.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,o),r.recycle(e.__nowWorld)}},strokeText:bd,drawTextStroke:Ed,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let o,r,a,h,{scaleX:l,scaleY:d}=n;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(n))h=s,o=a=n;else{const{renderShapeSpread:s}=t.__layout,c=Ld(s?Sd(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,n);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=Cd(n,r),o=Od(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:o,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let Ad={};const{get:Dd,rotateOfOuter:Id,translate:Wd,scaleOfOuter:Fd,scale:zd,rotate:Nd}=b;function Yd(t,e,i,s,n,o,r){const a=Dd();Wd(a,e.x+i,e.y+s),zd(a,n,o),r&&Id(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Xd(t,e,i,s,n,o,r){const a=Dd();Wd(a,e.x+i,e.y+s),n&&zd(a,n,o),r&&Nd(a,r),t.transform=a}function Hd(t,e,i,s,n,o,r,a,h,l){const d=Dd();if(h)if("center"===l)Id(d,{x:i/2,y:s/2},h);else switch(Nd(d,h),h){case 90:Wd(d,s,0);break;case 180:Wd(d,i,s);break;case 270:Wd(d,0,i)}Ad.x=e.x+n,Ad.y=e.y+o,Wd(d,Ad.x,Ad.y),r&&Fd(d,Ad,r,a),t.transform=d}const{get:Vd,translate:jd}=b,Ud=new dt,Gd={},Zd={};function Kd(t,e,i,s){const{blendMode:n,changeful:o,sync:r}=i;n&&(t.blendMode=n),o&&(t.changeful=o),r&&(t.sync=r),t.data=qd(i,s,e)}function qd(t,e,i){let{width:s,height:n}=i;t.padding&&(e=Ud.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{opacity:o,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,repeat:_,filters:p}=t,g=e.width===s&&e.height===n,f={mode:r},y="center"!==h&&(u||0)%180==90,m=y?n:s,v=y?s:n;let w,x,b=0,k=0;if(r&&"cover"!==r&&"fit"!==r)(d||c)&&(a.getScaleData(d,c,i,Zd),w=Zd.scaleX,x=Zd.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;w=x="fit"===r?Math.min(t,i):Math.max(t,i),b+=(e.width-s*w)/2,k+=(e.height-n*x)/2}if(h){const t={x:b,y:k,width:m,height:v};w&&(t.width*=w,t.height*=x),vt.toPoint(h,t,e,Gd,!0),b+=Gd.x,k+=Gd.y}switch(l&&(b+=l.x,k+=l.y),r){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(b||k||w||u)&&Xd(f,e,b,k,w,x,u);break;case"repeat":(!g||w||u)&&Hd(f,e,s,n,b,k,w,x,u,h),_||(f.repeat="repeat");break;default:w&&Yd(f,e,b,k,w,x,u)}return f.transform||(e.x||e.y)&&(f.transform=Vd(),jd(f.transform,e.x,e.y)),w&&"stretch"!==r&&(f.scaleX=w,f.scaleY=x),f.width=s,f.height=n,o&&(f.opacity=o),p&&(f.filters=p),_&&(f.repeat="string"==typeof _?"x"===_?"repeat-x":"repeat-y":"repeat"),f}let Jd,$d=new dt;const{isSame:Qd}=rt;function tc(t,e,i,s,n,o){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||Kd(n,s,i,o),!0}function ec(t,e){nc(t,Qo.LOAD,e)}function ic(t,e){nc(t,Qo.LOADED,e)}function sc(t,e,i){e.error=i,t.forceUpdate("surface"),nc(t,Qo.ERROR,e)}function nc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Qo(e,i))}function oc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:rc,scale:ac,copy:hc}=b,{ceil:lc,abs:dc}=Math;function cc(e,i,s){let{scaleX:n,scaleY:o}=kn.patternLocked?e.__world:e.__nowWorld;const r=n+"-"+o+"-"+s;if(i.patternId===r||e.destroyed)return!1;{n=dc(n),o=dc(o);const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g}=a;u&&(l=rc(),hc(l,p),ac(l,1/u,1/_),n*=u,o*=_),n*=s,o*=s,d*=n,c*=o;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&&(n/=h,o/=h,d/=h,c/=h),u&&(n/=u,o/=_),(p||1!==n||1!==o)&&(l||(l=rc(),p&&hc(l,p)),ac(l,1/n,1/o));const m=e.getCanvas(lc(d)||1,lc(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:uc}=Math;const _c={image:function(t,e,i,s,n){let o,r;const a=kn.get(i);return Jd&&i===Jd.paint&&Qd(s,Jd.boxBounds)?o=Jd.leafPaint:(o={type:i.type,image:a},Jd=a.use>1?{leafPaint:o,paint:i,boxBounds:$d.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(tc(t,e,i,a,o,s),n&&(ec(t,r),ic(t,r))):a.error?n&&sc(t,r,a.error):(n&&(oc(t,!0),ec(t,r)),o.loadId=a.load((()=>{oc(t,!1),t.destroyed||(tc(t,e,i,a,o,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ic(t,r)),o.loadId=null}),(e=>{oc(t,!1),sc(t,r,e),o.loadId=null}))),o},checkImage:function(e,i,s,n){const{scaleX:o,scaleY:r}=kn.patternLocked?e.__world:e.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!eh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||tr.isResizing(e)||eh.running)){let{width:e,height:i}=h;e*=uc(o)*a,i*=uc(r)*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),n=e*i>t.image.maxCacheSize}return n?(function(t,e,i,s){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),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||eh.running?cc(e,s,a):s.patternTask||(s.patternTask=kn.patternTasker.add((()=>jt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&cc(e,s,a),e.forceUpdate("surface")}))),300)),!1)},createPattern:cc,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,kn.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],r instanceof Array||(r=[r])),n.unload(i[h].loadId,!r.some((t=>t.url===a)))));return o}return null},createData:Kd,getPatternData:qd,fillOrFitMode:Yd,clipMode:Xd,repeatMode:Hd},{toPoint:pc}=ft,gc={},fc={};function yc(t,e,i){if(e){let s;for(let n=0,o=e.length;n<o;n++)s=e[n],"string"==typeof s?t.addColorStop(n/(o-1),Ga.string(s,i)):t.addColorStop(s.offset,Ga.string(s.color,i))}}const{getAngle:mc,getDistance:vc}=A,{get:wc,rotateOfOuter:xc,scaleOfOuter:bc}=b,{toPoint:kc}=ft,Ec={},Bc={};function Rc(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=mc(e,i);o=wc(),n?(bc(o,e,r/a*(s||1),1),xc(o,e,t+90)):(bc(o,e,1,r/a*(s||1)),xc(o,e,t))}return o}const{getDistance:Sc}=A,{toPoint:Cc}=ft,Oc={},Lc={};const Tc={linearGradient:function(e,i){let{from:s,to:n,type:o,blendMode:r,opacity:a}=e;pc(s||"top",i,gc),pc(n||"bottom",i,fc);const h=t.canvas.createLinearGradient(gc.x,gc.y,fc.x,fc.y);yc(h,e.stops,a);const l={type:o,style:h};return r&&(l.blendMode=r),l},radialGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,blendMode:a,stretch:h}=e;kc(s||"center",i,Ec),kc(n||"bottom",i,Bc);const l=t.canvas.createRadialGradient(Ec.x,Ec.y,0,Ec.x,Ec.y,vc(Ec,Bc));yc(l,e.stops,r);const d={type:o,style:l},c=Rc(i,Ec,Bc,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,blendMode:a,stretch:h}=e;Cc(s||"center",i,Oc),Cc(n||"bottom",i,Lc);const l=t.conicGradientSupport?t.canvas.createConicGradient(0,Oc.x,Oc.y):t.canvas.createRadialGradient(Oc.x,Oc.y,0,Oc.x,Oc.y,Sc(Oc,Lc));yc(l,e.stops,r);const d={type:o,style:l},c=Rc(i,Oc,Lc,h||1,t.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:Rc},{copy:Pc,toOffsetOutBounds:Mc}=rt,Ac={},Dc={};function Ic(e,i,s,n){const{bounds:o,shapeBounds:r}=n;if(t.fullImageShadow){if(Pc(Ac,e.bounds),Ac.x+=i.x-r.x,Ac.y+=i.y-r.y,s){const{matrix:t}=n;Ac.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Ac.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Ac.width*=s,Ac.height*=s}e.copyWorld(n.canvas,e.bounds,Ac)}else s&&(Pc(Ac,i),Ac.x-=i.width/2*(s-1),Ac.y-=i.height/2*(s-1),Ac.width*=s,Ac.height*=s),e.copyWorld(n.canvas,r,s?Ac:i)}const{toOffsetOutBounds:Wc}=rt,Fc={};const zc={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Mc(l,Dc),a.forEach(((a,g)=>{_.setWorldShadow(Dc.offsetX+a.x*c,Dc.offsetY+a.y*u,a.blur*c,Ga.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Ic(_,Dc,n,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),s=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,s,o,a.blendMode):e.copyWorldToInner(_,s,r.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Wc(l,Fc),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(Fc.offsetX+a.x*c,Fc.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Ic(_,Fc,n,i),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),s=o):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Ga.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(_,s,o,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:Nc}=Ao;function Yc(t,e,i,s,n,o){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),Hc(t,e,i,1)}(t,i,s,n);break;case"opacity-path":Hc(t,i,s,o);break;case"path":i.restore()}}function Xc(t){return t.getSameCanvas(!1,!0)}function Hc(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}Th.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(r&&(Yc(this,r,t,n,s,o),s=n=null),"path"===a||"clipping-path"===a?(i.opacity<1?(r="opacity-path",o=i.opacity,n||(n=Xc(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Xc(t)),n||(n=Xc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||Nc(i,e)||i.__render(n||t,e);Yc(this,r,t,n,s,o)};const Vc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",jc=Vc+"_#~&*+\\=|≮≯≈≠=…",Uc=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 Gc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Zc=Gc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Kc=Gc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),qc=Gc(Vc),Jc=Gc(jc),$c=Gc("- —/~|┆·");var Qc;!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"}(Qc||(Qc={}));const{Letter:tu,Single:eu,Before:iu,After:su,Symbol:nu,Break:ou}=Qc;function ru(t){return Zc[t]?tu:$c[t]?ou:Kc[t]?iu:qc[t]?su:Jc[t]?nu:Uc.test(t)?eu:tu}const au={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function hu(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:lu}=au,{Letter:du,Single:cu,Before:uu,After:_u,Symbol:pu,Break:gu}=Qc;let fu,yu,mu,vu,wu,xu,bu,ku,Eu,Bu,Ru,Su,Cu,Ou,Lu,Tu,Pu,Mu=[];function Au(t,e){Eu&&!ku&&(ku=Eu),fu.data.push({char:t,width:e}),mu+=e}function Du(){vu+=mu,fu.width=mu,yu.words.push(fu),fu={data:[]},mu=0}function Iu(){Ou&&(Lu.paraNumber++,yu.paraStart=!0,Ou=!1),Eu&&(yu.startCharSize=ku,yu.endCharSize=Eu,ku=0),yu.width=vu,Tu.width?lu(yu):Pu&&Wu(),Mu.push(yu),yu={words:[]},vu=0}function Wu(){vu>(Lu.maxWidth||0)&&(Lu.maxWidth=vu)}const{top:Fu,right:zu,bottom:Nu,left:Yu}=_t;function Xu(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 Hu={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(o?(s=l[Yu],o-=l[zu]+l[Yu]):i.autoSizeAlign||(s=l[Yu]),r?(n=l[Fu],r-=l[Fu]+l[Nu]):i.autoSizeAlign||(n=l[Fu]));const d={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:t.canvas.font=h};return function(e,i,s){Lu=e,Mu=e.rows,Tu=e.bounds,Pu=!Tu.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=Tu;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Ou=!0,Ru=null,ku=bu=Eu=mu=vu=0,fu={data:[]},yu={words:[]};for(let s=0,l=i.length;s<l;s++)xu=i[s],"\n"===xu?(mu&&Du(),yu.paraEnd=!0,Iu(),Ou=!0):(Bu=ru(xu),Bu===du&&"none"!==r&&(xu=hu(xu,r,!mu)),bu=a.measureText(xu).width,n&&(n<0&&(Eu=bu),bu+=n),Su=Bu===cu&&(Ru===cu||Ru===du)||Ru===cu&&Bu!==_u,Cu=!(Bu!==uu&&Bu!==cu||Ru!==pu&&Ru!==_u),wu=Ou&&o?h-o:h,t&&h&&vu+mu+bu>wu&&(e?(mu&&Du(),vu&&Iu()):(Cu||(Cu=Bu===du&&Ru==_u),Su||Cu||Bu===gu||Bu===uu||Bu===cu||mu+bu>wu?(mu&&Du(),vu&&Iu()):vu&&Iu()))," "===xu&&!0!==Ou&&vu+mu===0||(Bu===gu?(" "===xu&&mu&&Du(),Au(xu,bu),Du()):Su||Cu?(mu&&Du(),Au(xu,bu)):Au(xu,bu)),Ru=Bu);mu&&Du(),vu&&Iu(),Mu.length>0&&(Mu[Mu.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Lu.paraNumber++,vu=a.measureText(t).width,Mu.push({x:o||0,text:t,width:vu,paraStart:!0}),Pu&&Wu()}))}(d,e,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Xu(e,"x",t[Yu]);break;case"right":Xu(e,"x",-t[zu])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Xu(e,"y",t[Fu]);break;case"bottom":Xu(e,"y",-t[Nu])}}(l,d,i,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__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=o*n+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,o),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,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=n;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+=o,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:n,paraIndent:o,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&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"!==n||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,o),d.overflow&&function(e,i,s,n){if(!n)return;const{rows:o,overflow:r}=e;let{textOverflow:a}=i;if(o.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+n-l;("none"===i.textWrap?o:[o[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,o),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,"object"==typeof n?(i=n.type,n.color&&(t.decorationColor=Ga.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]}}(d,i),d}};const Vu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!Ga.object)return t;t=Ga.object(t)}let s=void 0===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 ju(t){return t?t instanceof Array?t:[t]:[]}Object.assign(Ua,Hu),Object.assign(Ga,Vu),Object.assign(qa,Md),Object.assign(Ja,_c),Object.assign($a,Tc),Object.assign(Qa,zc),Object.assign(e,{interaction:(t,e,i,s)=>new ad(t,e,i,s),hitCanvas:(t,e)=>new ba(t,e),hitCanvasManager:()=>new ld}),Ea();class Uu extends qo{get list(){return ju(this.value)}get oldList(){return ju(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}Uu.BEFORE_SELECT="editor.before_select",Uu.SELECT="editor.select",Uu.BEFORE_HOVER="editor.before_hover",Uu.HOVER="editor.hover";class Gu extends Uu{constructor(t,e){super(t,e)}}Gu.BEFORE_MOVE="editor.before_move",Gu.MOVE="editor.move";class Zu extends Uu{constructor(t,e){super(t,e)}}Zu.BEFORE_SCALE="editor.before_scale",Zu.SCALE="editor.scale";class Ku extends Uu{constructor(t,e){super(t,e)}}Ku.BEFORE_ROTATE="editor.before_rotate",Ku.ROTATE="editor.rotate";class qu extends Uu{constructor(t,e){super(t,e)}}function Ju(t){return(e,i)=>{const s="_"+i;Cn(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==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?Uu.BEFORE_SELECT:Uu.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Uu(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}qu.BEFORE_SKEW="editor.before_skew",qu.SKEW="editor.skew";const{abs:$u}=Math,{copy:Qu,scale:t_}=b,{setListWithFn:e_}=rt,{worldBounds:i_}=Ao,s_={a:1,b:0,c:0,d:1,e:0,f:0},n_={x:0,y:0,width:0,height:0};class o_ extends Lh{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?(e_(n_,t,i_),this.set(n_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:a}=n,{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=$u(d.scaleX),h=$u(d.scaleY);if(Qu(s_,d),s_.half=r%2,i!==h){t_(s_,1/i,1/h),t.setWorld(s_,e.matrix),t.beginPath(),n.strokeWidth=r;const{x:o,y:a,width:l,height:d}=s.__layout.boxBounds;t.rect(o*i,a*h,l*i,d*h)}else t.setWorld(s_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/$u(d.scaleX);o&&("string"==typeof o?qa.stroke(o,this,t):qa.strokes(o,this,t)),a&&("string"==typeof a?qa.fill(a,this,t):qa.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}Vt([Ju((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],o_.prototype,"target",void 0);class r_ extends Th{constructor(t){super(t),this.strokeArea=new Dh({strokeAlign:"center"}),this.fillArea=new Dh,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 a_={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return h_([t],i,e),i}};function h_(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],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&&h_(s.children,e,i)}}const{findOne:l_,findByBounds:d_}=a_;class c_ extends Th{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 o_,this.targetStroker=new o_,this.bounds=new dt,this.selectArea=new r_,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(){if(this.running){const{mergeConfig:t,list:e}=this.editor,{stroke:i,strokeWidth:s,selectedStyle:n}=t;this.targetStroker.setTarget(e,Object.assign({stroke:i,strokeWidth:Math.max(1,s/2)},n||{})),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:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},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 va(d_(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)||t.shiftKey&&!l_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new va(this.editor.editBox.rect)};return l_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):l_(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_(Uu.HOVER,this.onHover,this),t.on_(Uu.SELECT,this.onSelect,this),e.on_(Al.MOVE,this.onPointerMove,this),e.on_(Al.BEFORE_DOWN,this.onBeforeDown,this),e.on_(Al.TAP,this.onTap,this),e.on_(Wl.START,this.onDragStart,this,!0),e.on_(Wl.DRAG,this.onDrag,this),e.on_(Wl.END,this.onDragEnd,this),e.on_(Nl.MOVE,this.onAutoMove,this),e.on_([Hl.ZOOM,Nl.MOVE],(()=>{this.editor.hoverTarget=null}))]}))}__removeListenEvents(){this.__eventIds&&(this.off_(this.__eventIds),this.__eventIds.length=0)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:u_,top:__,topRight:p_,right:g_,bottomRight:f_,bottom:y_,bottomLeft:m_,left:v_}=pt,{toPoint:w_}=ft,{within:x_}=a,b_={getScaleData(t,e,i,s,n,o,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;o&&(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,R=(s.x+y)/y,S=(s.y+m)/m,C=(-s.x+y)/y;switch(i){case __:c=B,h="bottom";break;case g_:d=R,h="left";break;case y_:c=S,h="top";break;case v_:d=C,h="right";break;case u_:c=B,d=C,h="bottom-right";break;case p_:c=B,d=R,h="bottom-left";break;case f_:c=S,d=R,h="top-left";break;case m_:c=S,d=C,h="top-right"}if(n){if(!("corner"===n&&i%2)){let t;switch(i){case __:case y_:t=c;break;case v_:case g_: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,L=1!==c;if(O&&(d/=k),L&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(w_(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new dt(t.__localBoxBounds);if(i.scaleOf(t.getLocalPointByInner(l),d,c),!rt.includes(e,i)){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;O&&(d*=s),L&&(c*=n)}}if(O&&_){const e=u.width*t.scaleX;d=x_(e*d,_)/e}if(L&&p){const e=u.height*t.scaleY;c=x_(e*c,p)/e}return O&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),L&&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:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case u_:o="bottom-right";break;case p_:o="bottom-left";break;case f_:o="top-left";break;case m_:o="top-right";break;default:o="center"}return w_(n||o,t,r,!0),{origin:r,rotation:A.getRotation(s,r,i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case __:case u_:o={x:.5,y:0},n="bottom",a=1;break;case y_:case f_:o={x:.5,y:1},n="top",a=1;break;case v_:case m_:o={x:0,y:.5},n="right",h=1;break;case g_:case p_:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,w_(s||n,t,r,!0);const c=A.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.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 v_:t=g_;break;case u_:t=p_;break;case m_:t=f_;break;case g_:t=v_;break;case p_:t=u_;break;case f_:t=m_}if(i)switch(t){case __:t=y_;break;case u_:t=m_;break;case p_:t=f_;break;case y_:t=__;break;case m_:t=u_;break;case f_:t=p_}return t}},k_={};function E_(t,e){const{editBox:i}=t,s=i.enterPoint;if(!s||!t.editing||!i.visible)return;if("circle"===s.name)return;if("button"===s.pointType)return void(s.cursor||(s.cursor="pointer"));let{rotation:n}=i;const{resizeCursor:o,rotateCursor:r,skewCursor:h,resizeable:l,rotateable:d,skewable:c}=t.mergeConfig,{pointType:u}=s,{flippedX:_,flippedY:p}=i;let g=u.includes("resize");g&&d&&(e.metaKey||e.ctrlKey||!l)&&(g=!1);const f=c&&!g&&("resize-line"===s.name||"skew"===u)?h:g?o:r;n+=45*(b_.getFlipDirection(s.direction,_,p)+1),n=2*Math.round(a.formatRotation(n,!0)/2);const{url:y,x:m,y:v}=f,w=y+n;k_[w]?s.cursor=k_[w]:k_[w]=s.cursor={url:R_(y,n),x:m,y:v}}function B_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.editBox.rect.cursor=i?e:void 0}function R_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class S_ extends Xh{}const C_=["top","right","bottom","left"],O_=void 0;class L_ extends Th{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 Th,this.rect=new Xh({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new S_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Th({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:o,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 S_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new S_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new S_({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{mergeConfig:t,element:e,single:i}=this.editor,{rect:s,circle:n,resizePoints:o}=this,{stroke:r,strokeWidth:a}=t,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;for(let t=0;t<8;t++)d=o[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);n.set(this.getPointStyle(t.circle||t.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:O_},t.rect||{})),s.hittable=!i,s.syncEventer=i&&this.editor,i&&(e.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:e}])}update(t){const{rect:e,circle:i,buttons:s,resizePoints:n,rotatePoints:o,resizeLines:r,editor:a}=this,{mergeConfig:h,element:l,multiple:d,editMask:c}=a,{middlePoint:u,resizeable:_,rotateable:p,hideOnSmall:g,editBox:f,mask:y}=h;if(this.visible=!l.locked,c.visible=!!y||0,this.view.worldOpacity){const{width:a,height:l}=t,c="number"==typeof g?g:10,y=f&&!(g&&a<c&&l<c);let m,v,w,x={};for(let e=0;e<8;e++)ft.toPoint(ft.directionData[e],t,x),v=n[e],m=o[e],w=r[Math.floor(e/2)],v.set(x),m.set(x),w.set(x),v.visible=w.visible=y&&!(!_&&!p),m.visible=y&&p&&_&&!h.rotatePoint,e%2&&(v.visible=m.visible=y&&!!u,(e+1)/2%2?(w.width=a,g&&2*v.width>a&&(v.visible=!1)):(w.height=l,v.rotation=90,g&&2*v.width>l&&(v.visible=!1)));i.visible=y&&p&&!(!h.circle&&!h.rotatePoint),i.visible&&this.layoutCircle(h),e.path&&(e.path=null),e.set(Object.assign(Object.assign({},t),{visible:!!d||f})),s.visible=y&&s.children.length>0||0,s.visible&&this.layoutButtons(h)}else e.set(t)}layoutCircle(t){const{circleDirection:e,circleMargin:i,buttonsMargin:s,buttonsDirection:n,middlePoint:o}=t,r=C_.indexOf(e||(this.buttons.children.length&&"bottom"===n?"top":"bottom"));this.setButtonPosition(this.circle,r,i||s,!!o)}layoutButtons(t){const{buttons:e}=this,{buttonsDirection:i,buttonsFixed:s,buttonsMargin:n,middlePoint:o}=t,{flippedX:r,flippedY:a}=this;let h=C_.indexOf(i);(h%2&&r||(h+1)%2&&a)&&s&&(h=(h+2)%4);const l=s?b_.getRotateDirection(h,this.flippedOne?this.rotation:-this.rotation,4):h;this.setButtonPosition(e,l,n,!!o),s&&(e.rotation=90*(l-h)),e.scaleX=r?-1:1,e.scaleY=a?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}unload(){this.visible=!1}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.editor.mergeConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:O_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.editor.mergeConfig;return t instanceof Array?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.editor.mergeConfig;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:n}=this,{element:o}=s;"rect"===e.name&&(this.moving=!0,s.opacity=s.mergeConfig.hideOnMove?0:1),n.x=t.x,n.y=t.y,n.point={x:o.x,y:o.y},n.bounds=Object.assign({},o.getLayoutBounds("box","local")),n.rotation=o.rotation,i&&i.includes("resize")&&(tr.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")&&(tr.resizingKeys=null)}onDrag(t){const{editor:e}=this,{pointType:i}=this.enterPoint=t.current;i.includes("rotate")||t.metaKey||t.ctrlKey||!e.mergeConfig.resizeable?(e.onRotate(t),"resize-rotate"===i&&e.onScale(t)):"resize"===i&&e.onScale(t),"skew"===i&&e.onSkew(t),E_(e,t)}onArrow(t){const{editor:e}=this;if(e.editing&&e.mergeConfig.keyEvent){let i=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":i=-n;break;case"ArrowRight":i=n}(i||s)&&e.move(i,s)}}onDoubleTap(t){"double"===this.editor.mergeConfig.openInner&&this.openInner(t)}onLongPress(t){"long"===this.editor.mergeConfig.openInner&&this.openInner(t)}openInner(t){const{editor:e}=this;if(e.single){const{element:i}=e;if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find((t=>t.editable&&t instanceof Rl))||t.find((t=>t instanceof Rl));if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){const{editor:s}=this;t.direction=i,t.pointType=e,t.on_(Wl.START,this.onDragStart,this),t.on_(Wl.DRAG,this.onDrag,this),t.on_(Wl.END,this.onDragEnd,this),t.on_(Al.LEAVE,(()=>this.enterPoint=null)),"circle"!==t.name&&t.on_(Al.ENTER,(e=>{this.enterPoint=t,E_(s,e)}))}__listenEvents(){const{rect:t,editor:e}=this;this.__eventIds=[e.on_(Uu.SELECT,this.onSelect,this),t.on_(Wl.START,this.onDragStart,this),t.on_(Wl.DRAG,e.onMove,e),t.on_(Wl.END,this.onDragEnd,this),t.on_(Al.ENTER,(()=>B_(e))),t.on_(Al.DOUBLE_TAP,this.onDoubleTap,this),t.on_(Al.LONG_PRESS,this.onLongPress,this)]}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const T_={x:0,y:0,width:1e5,height:1e5};class P_ extends Lh{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,T_),Object.assign(this.__world,T_)}__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"),i.list.forEach((i=>{i.__renderShape(t,e);const{__box:s,parent:n}=i;((i=s)||(i=n)&&n.textBox)&&i.__renderShape(t,e)})),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const M_='\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"/>',A_={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${M_}\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${M_}\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${M_}\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},D_=new dt;function I_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer.zoomLayer;e.safeChange((()=>{D_.setListWithFn(i,(t=>t.getBounds("box","page"))),0===D_.width&&(D_.width=.1),0===D_.height&&(D_.height=.1),e.reset(D_.get())})),s.add(e)}const W_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),F_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),z_={group(t,e,i){t.sort(F_);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Th(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(W_);const r=new Y(e.worldTransform);return r.divideParent(n.worldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach((t=>t.dropTo(o))),s.unlockLayout(),o},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(W_),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(F_),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},N_=bt.get("EditToolCreator");function Y_(){return t=>{H_.register(t)}}const X_=Y_,H_={list:{},register(t){const{tag:e}=t.prototype;V_[e]&&N_.repeat(e),V_[e]=t},get:(t,e)=>new V_[t](e)},{list:V_}=H_;class j_ extends Uu{constructor(t,e){super(t,e)}}j_.BEFORE_OPEN="innerEditor.before_open",j_.OPEN="innerEditor.open",j_.BEFORE_CLOSE="innerEditor.before_close",j_.CLOSE="innerEditor.close";class U_ extends Uu{constructor(t,e){super(t,e)}}U_.BEFORE_GROUP="editor.before_group",U_.GROUP="editor.group",U_.BEFORE_UNGROUP="editor.before_ungroup",U_.UNGROUP="editor.ungroup",U_.BEFORE_OPEN="editor.before_open_group",U_.OPEN="editor.open_group",U_.BEFORE_CLOSE="editor.before_close_group",U_.CLOSE="editor.close_group";const{updateMatrix:G_}=So,Z_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},K_="top-left";class q_ extends Dh{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on($o.CHANGE,(e=>{if(this.checkChange&&Z_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,G_(this.parent),G_(this);const a=new Y(this.__world);switch(r[i]=s,this.__layout.rotationChange(),G_(this),this.changedTransform=new Y(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(K_,o);break;case"scaleX":t.scaleOf(K_,o,1);break;case"scaleY":t.scaleOf(K_,1,o);break;case"skewX":t.skewOf(K_,o,0);break;case"skewY":t.skewOf(K_,0,o)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class J_ extends Th{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 va,this.openedGroupList=new va,this.simulateTarget=new q_(this),this.editBox=new L_(this),this.editToolList={},this.selector=new c_(this),this.editMask=new P_(this),this.targetEventIds=[];let i=Wt.clone(A_);t&&(i=Wt.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Ot.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&&I_(this),this.update()}updateEditTool(){const t=this.editTool;if(t&&(this.editBox.unload(),t.unload(),this.editTool=null),this.editing){const t=this.single?this.list[0].editOuter:"EditTool";this.editTool=this.editToolList[t]=this.editToolList[t]||H_.get(t,this),this.editBox.load(),this.editTool.load()}}getEditSize(t){return this.mergeConfig.editSize}onMove(t){if(t instanceof Nl){if("drag"!==t.moveType){const{moveable:e,resizeable:i}=this.mergeConfig,s=t.getLocalMove(this.element);"move"===e?(t.stop(),this.move(s.x,s.y)):"zoom"===i&&t.stop()}}else{const e={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(e.x)>Math.abs(e.y)?e.y=0:e.x=0),this.move(Wl.getValidMove(this.element,this.editBox.dragStartData.point,e))}}onScale(t){const{element:e}=this;let{around:i,lockRatio:s,resizeable:n,flipable:o,editSize:r}=this.mergeConfig;if(t instanceof Hl)"zoom"===n&&(t.stop(),this.scaleOf(e.getBoxPoint(t),t.scale,t.scale));else{const{direction:n}=t.current;(t.shiftKey||e.lockRatio)&&(s=!0);const a=b_.getScaleData(e,this.editBox.dragStartData.bounds,n,t.getInnerTotal(e),s,b_.getAround(i,t.altKey),o,this.multiple||"scale"===r);this.editTool.onScaleWithDrag?(a.drag=t,this.scaleWithDrag(a)):this.scaleOf(a.origin,a.scaleX,a.scaleY)}}onRotate(t){const{skewable:e,rotateable:i,around:s,rotateGap:n}=this.mergeConfig,{direction:o,name:r}=t.current;if(e&&"resize-line"===r)return this.onSkew(t);const{element:h}=this,{dragStartData:l}=this.editBox;let d,c;if(t instanceof Yl){if("rotate"!==i)return;t.stop(),c=t.rotation,d=h.getBoxPoint(t),h.scaleX*h.scaleY<0&&(c=-c)}else{const e=b_.getRotateData(h.boxBounds,o,t.getBoxPoint(h),h.getBoxPoint(l),t.shiftKey?null:h.around||h.origin||s||"center");c=e.rotation,d=e.origin}h.scaleX*h.scaleY<0&&(c=-c),t instanceof Wl&&(c=l.rotation+c-h.rotation),c=a.float(a.getGapRotation(c,n,h.rotation),2),c&&this.rotateOf(d,c)}onSkew(t){const{element:e}=this,{around:i}=this.mergeConfig,{origin:s,skewX:n,skewY:o}=b_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),b_.getAround(i,t.altKey));(n||o)&&this.skewOf(s,n,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;"object"==typeof t&&(e=t.y,t=t.x);const{element:i}=this,{beforeMove:s}=this.mergeConfig;if(s){const n=s({target:i,x:t,y:e});if("object"==typeof n)t=n.x,e=n.y;else if(!1===n)return}const n=i.getWorldPointByLocal({x:t,y:e},null,!0);this.multiple&&i.safeChange((()=>i.move(t,e)));const o={target:i,editor:this,moveX:n.x,moveY:n.y};this.emitEvent(new Gu(Gu.BEFORE_MOVE,o));const r=new Gu(Gu.MOVE,o);this.editTool.onMove(r),this.emitEvent(r)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,{beforeScale:i}=this.mergeConfig;if(i){const{origin:s,scaleX:n,scaleY:o,drag:r}=t;if(!1===i({target:e,drag:r,origin:s,scaleX:n,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:this,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Zu(Zu.BEFORE_SCALE,t));const s=new Zu(Zu.SCALE,t);this.editTool.onScaleWithDrag(s),this.emitEvent(s)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{element:n}=this,{beforeScale:o}=this.mergeConfig;if(o){const s=o({target:n,origin:t,scaleX:e,scaleY:i});if("object"==typeof s)e=s.scaleX,i=s.scaleY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>n.safeChange((()=>n.scaleOf(t,e,i))))),h={target:n,editor:this,worldOrigin:r,scaleX:e,scaleY:i,transform:a};this.emitEvent(new Zu(Zu.BEFORE_SCALE,h));const l=new Zu(Zu.SCALE,h);this.editTool.onScale(l),this.emitEvent(l)}flip(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,i=this.getWorldOrigin("center"),s=this.multiple?this.getChangedTransform((()=>e.safeChange((()=>e.flip(t))))):new Y(So.getFlipTransform(e,t)),n={target:e,editor:this,worldOrigin:i,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:s};this.emitEvent(new Zu(Zu.BEFORE_SCALE,n));const o=new Zu(Zu.SCALE,n);this.editTool.onScale(o),this.emitEvent(o)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{element:i}=this,{beforeRotate:s}=this.mergeConfig;if(s){const n=s({target:i,origin:t,rotation:e});if("number"==typeof n)e=n;else if(!1===n)return}const n=this.getWorldOrigin(t),o=this.multiple&&this.getChangedTransform((()=>i.safeChange((()=>i.rotateOf(t,e))))),r={target:i,editor:this,worldOrigin:n,rotation:e,transform:o};this.emitEvent(new Ku(Ku.BEFORE_ROTATE,r));const a=new Ku(Ku.ROTATE,r);this.editTool.onRotate(a),this.emitEvent(a)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{element:n}=this,{beforeSkew:o}=this.mergeConfig;if(o){const s=o({target:n,origin:t,skewX:e,skewY:i});if("object"==typeof s)e=s.skewX,i=s.skewY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>n.safeChange((()=>n.skewOf(t,e,i))))),h={target:n,editor:this,worldOrigin:r,skewX:e,skewY:i,transform:a};this.emitEvent(new qu(qu.BEFORE_SKEW,h));const l=new qu(qu.SKEW,h);this.editTool.onSkew(l),this.emitEvent(l)}checkTransform(t){return this.element&&!this.element.locked&&this.mergeConfig[t]}getWorldOrigin(t){return this.element.getWorldPoint(So.getInnerOrigin(this.element,t))}getChangedTransform(t){const{element:e}=this;if(this.multiple&&!e.canChange)return e.changedTransform;const i=new Y(e.worldTransform);return t(),new Y(e.worldTransform).divide(i)}group(t){return this.multiple&&(this.emitGroupEvent(U_.BEFORE_GROUP),this.target=z_.group(this.list,this.element,t),this.emitGroupEvent(U_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(U_.BEFORE_UNGROUP,t))),this.target=z_.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(U_.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(U_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(U_.OPEN,t)}closeGroup(t){this.emitGroupEvent(U_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(U_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!So.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 U_(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&&H_.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||H_.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(j_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(j_.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(j_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(j_.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new j_(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&&(z_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(z_.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()}onKey(t){E_(this,t)}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editBox:i,editMask:s}=this;this.targetEventIds=[e.on_(sr.START,this.onRenderStart,this),t.on_(sr.CHILD_START,this.onAppRenderStart,this),t.on_(Nl.BEFORE_MOVE,this.onMove,this,!0),t.on_(Hl.BEFORE_ZOOM,this.onScale,this,!0),t.on_(Yl.BEFORE_ROTATE,this.onRotate,this,!0),t.on_([Vl.HOLD,Vl.UP],this.onKey,this),t.on_(Vl.DOWN,i.onArrow,i)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),t.length=0,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)=>{Cn(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"),Xt(s.lockRatio)&&(s.lockRatio=!0))),this.mergedConfig=s}})}],J_.prototype,"mergeConfig",void 0),Vt([Ju((function(t,e){t.emitEvent(new Uu(Uu.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],J_.prototype,"hoverTarget",void 0),Vt([Ju((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof va?i:new va(i),t.multiple&&I_(t)):(t.simulateTarget.remove(),t.leafList.reset(),t.closeInnerEditor()),t.emitEvent(new Uu(Uu.SELECT,{editor:t,value:i,oldValue:e})),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{B_(t),t.updateEditTool(),t.update(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents())}))],J_.prototype,"target",void 0);class $_{static registerInnerEditor(){H_.register(this)}get tag(){return"InnerEditor"}get editBox(){return this.editor.editBox}constructor(t){this.editor=t,this.create()}onCreate(){}create(){this.view=new Th,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&(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 Q_=class extends $_{static registerEditTool(){H_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach((t=>{t.moveWorld(e,i)})),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach((t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)})),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach((t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)})),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach((t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)})),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){const{editor:t,editBox:e}=this,{x:i,y:s,scaleX:n,scaleY:o,rotation:r,skewX:a,skewY:h,width:l,height:d}=t.element.getLayoutBounds("box",t,!0);e.set({x:i,y:s,scaleX:n,scaleY:o,rotation:r,skewX:a,skewY:h}),e.update({x:0,y:0,width:l,height:d}),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Q_=Vt([Y_()],Q_);const{left:tp,right:ep}=pt,{move:ip,copy:sp,toNumberPoints:np}=A;let op=class extends Q_{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===tp;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.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=np(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(ip(t,o,r),s&&ip(e,-o,-r)):(s&&ip(t,-o,-r),ip(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),sp(s[7],i),sp(e[7],i),sp(s[3],a),sp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===tp||t===ep,s[t].visible=a,e[t].visible=!r&&a}};op=Vt([Y_()],op);const{M:rp,L:ap,C:hp,Q:lp,Z:dp,N:cp,D:up,X:_p,G:pp,F:gp,O:fp,P:yp,U:mp}=oe,vp={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case rp:case ap:wp(t,e,i,n,1),n+=3;break;case hp:wp(t,e,i,n,3),n+=7;break;case lp:wp(t,e,i,n,2),n+=5;break;case dp:n+=1;break;case cp:wp(t,e,i,n,2),n+=5;break;case up:wp(t,e,i,n,2),n+=9;break;case _p:wp(t,e,i,n,2),n+=6;break;case pp:wp(t,e,i,n,2),n+=9;break;case gp:wp(t,e,i,n,2),n+=5;break;case fp:t[n]=pp,t.splice(n+4,0,t[n+3],0),wp(t,e,i,n,2),n+=9,o+=2;break;case yp:t[n]=gp,t.splice(n+4,0,t[n+3]),wp(t,e,i,n,2),n+=5,o+=1;break;case mp:wp(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:wp}=vp,xp=b.get(),{topLeft:bp,top:kp,topRight:Ep,right:Bp,bottom:Rp,left:Sp}=pt;function Cp(t,e,i){t.pathInputed?Op(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Op(t,e,i){vp.scale(t.__.path,e,i),t.path=t.__.path}function Lp(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):vp.scalePoints(s,e,i),t.points=s}function Tp(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)xp.a=e,xp.d=i,s[t].transform(xp,!0)}const Pp=ha.prototype;function Mp(t,e,i){Ap(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Nl.BEFORE_MOVE,(e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY))})),t.on_(Hl.BEFORE_ZOOM,(e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)})))}function Ap(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)}Pp.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))},Pp.__scaleResize=function(t,e){Cp(this,t,e)},Pp.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Pp.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Rl.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.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||o&&"font-size"===n.mergedConfig.editSize?function(t,e,i,s){let n=e;if(void 0!==s){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case kp:case Rp:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Sp:case Bp:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case bp:case Ep:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:r}=o;r&&(t.padding=r instanceof Array?r.map((t=>t*n)):r*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}(this,t,e,o&&o.direction):Cp(this,t,e)},Sl.prototype.__scaleResize=function(t,e){Op(this,t,e)},il.prototype.__scaleResize=function(t,e){this.pathInputed?Op(this,t,e):this.points?Lp(this,t,e):this.width*=t},cl.prototype.__scaleResize=function(t,e){this.pathInputed?Op(this,t,e):this.points?Lp(this,t,e):Cp(this,t,e)},Th.prototype.__scaleResize=function(t,e){Tp(this,t,e)},Xh.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Cp(this,t,e),i&&Tp(this,t,e)},Ot.add("resize"),Ot.add("editor","resize"),e.editor=function(t){return new J_(t)},Xh.addAttr("textBox",!1,Mn),Lh.addAttr("editConfig",void 0,Mn),Lh.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),Mn),Lh.addAttr("editInner","PathEditor",Mn),Th.addAttr("editInner","",Mn),Rl.addAttr("editInner","TextEditor",Mn),Lh.setEditConfig=function(t){this.changeAttr("editConfig",t)},Lh.setEditOuter=function(t){this.changeAttr("editOuter",t)},Lh.setEditInner=function(t){this.changeAttr("editInner",t)};const Dp=bt.get("LeaferTypeCreator"),Ip={list:{},register(t,e){Wp[t]&&Dp.repeat(t),Wp[t]=e},run(t,e){const i=Wp[t];i&&i(e)}},{list:Wp,register:Fp}=Ip;Fp("viewport",Mp),Fp("custom",(function(t){Mp(t,null,!0)})),Fp("design",(function(t){Mp(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),Fp("document",(function(t){Mp(t,{zoom:{min:1},move:{scroll:"limit"}})}));const zp={getData(t){const e=t[0],i=t[1],s=A.getCenter(e.from,i.from),n=A.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=A.getDistance(e.from,i.from);return{move:o,scale:A.getDistance(e.to,i.to)/r,rotation:A.getRotation(e.from,i.from,e.to,i.to),center:n}}},Np={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:o,zoomSpeed:r}=i;const h=e.deltaY||e.deltaX;if(o?(s="mouse"===o||!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){r=a.within(r,0,1);n=1-h/(4*(e.deltaY?i.delta.y:i.delta.x))*r,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class Yp{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(Nl.START,this.moveData)),t.path=this.moveData.path,e.emit(Nl.BEFORE_MOVE,t),e.emit(Nl.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(Hl.START,this.zoomData)),t.path=this.zoomData.path,e.emit(Hl.BEFORE_ZOOM,t),e.emit(Hl.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(Yl.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Yl.BEFORE_ROTATE,t),e.emit(Yl.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(Nl.END,e),i&&t.emit(Hl.END,i),s&&t.emit(Yl.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Xp=Ah.prototype,Hp=new dt;function Vp(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function jp(t,e){return Object.assign(Object.assign({},e),{scale:t})}Xp.initType=function(t){Ip.run(t,this)},Xp.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:o}=Hp.set(this.__world).addPoint(this.zoomLayer),r=i+n-this.width,a=s+o-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}},Xp.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const Up=ad.prototype;Up.createTransformer=function(){this.transformer=new Yp(this)},Up.move=function(t){this.transformer.move(t)},Up.zoom=function(t){this.transformer.zoom(t)},Up.rotate=function(t){this.transformer.rotate(t)},Up.transformEnd=function(){this.transformer.transformEnd()},Up.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 o=e.getScale?e.getScale(t,e):Np.getScale(t,e);if(1!==o)this.zoom(jp(o,t));else{const s=e.getMove?e.getMove(t,e):Np.getMove(t,e);i.snap&&A.round(s),this.move(Vp(s,t))}},Up.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=zp.getData(e);Object.assign(t,o),this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(jp(n,t)),this.move(Vp(i,t))};const Gp=Jl.prototype,{abs:Zp}=Math;function Kp(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}Gp.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=Zp(i),o=Zp(s),r=e?1:.1,a=this.interaction.m.dragAnimate&&this.canAnimate&&this.moving&&(n>r||o>r);if(a){const r="touch"===t.pointerType?3:1,a=70;n*(e=e?.95:r)>a?e=a/n:o*e>a&&(e=a/o),t=Object.assign({},t),A.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},Gp.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Gp.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Gp.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=rt.maxX(r),d=rt.maxY(r),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,A.move(i,c,u),A.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)},Gp.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Ot.add("viewport"),Ot.add("view"),Ah.prototype.zoom=function(t,e,i,s){this.killAnimate();const{zoomLayer:n}=this,o=this.canvas.bounds.clone().shrink(void 0!==e?e:30),r=new dt,a={x:o.x+o.width/2,y:o.y+o.height/2};let h;const{x:l,y:d,scaleX:c,scaleY:u}=n.__;if("string"==typeof t)switch(t){case"in":h=Kp(c,"in");break;case"out":h=Kp(c,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new dt(this.boxBounds)).height=0;break;case"fit-height":(t=new dt(this.boxBounds)).width=0}else"number"==typeof t&&(h=t/c);if(h)h=this.getValidScale(h),n.scaleOfWorld(a,h,h,!1,s);else if("object"==typeof t){const e={x:l,y:d,scaleX:c,scaleY:u},a=t instanceof Array;if(a||t.tag){const e=a?t:[t];r.setListWithFn(e,Ao.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,o);r.set(n.getWorldBounds(e))}const{width:_,height:p}=r;let g=o.x-r.x,f=o.y-r.y;return i?(g+=Math.max((o.width-_)/2,0),f+=Math.max((o.height-p)/2,0)):(h=this.getValidScale(Math.min(o.width/_,o.height/p)),g+=(o.width-_*h)/2,f+=(o.height-p*h)/2,A.scaleOf(e,r,h),r.scaleOf(r,h),e.scaleX*=h,e.scaleY*=h),A.move(e,g,f),r.move(g,f),n.set(e,s),r}return n.worldBoxBounds};class qp extends Th{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 Xh,this.scrollYBar=new Xh),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:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new dt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),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_(Wl.DRAG,this.onDrag,this),e.on_(Wl.DRAG,this.onDrag,this),t.on_(Wl.END,this.onDragEnd,this),e.on_(Wl.END,this.onDragEnd,this),this.target.on_(sr.BEFORE,(()=>this.update(!0))),this.target.leafer.on_(tr.RESIZE,(()=>this.update()))]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Ot.add("scroll");class Jp extends ph{}function $p(t){return Ln(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,Vn(this)}}})))}let Qp=class extends il{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};Vt([so(Jp)],Qp.prototype,"__",void 0),Vt([$p("angle")],Qp.prototype,"endArrow",void 0),Qp=Vt([po()],Qp);const{M:tg,L:eg,C:ig,Q:sg,O:ng}=oe,{rotate:og,copyFrom:rg,scale:ag}=A,hg={},lg={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case tg:case eg:dg(t,l+1,e,i,s,n,o,r),l+=3;break;case ig:for(h=1;h<6;h+=2)dg(t,l+h,e,i,s,n,o,r);l+=7;break;case sg:for(h=1;h<4;h+=2)dg(t,l+h,e,i,s,n,o,r);l+=5;break;case ng:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){lg.layout(t,0,0,1,1,e,i)}};function dg(t,e,i,s,n,o,r,a){rg(hg,t[e],t[e+1]),r&&og(hg,r,a),n&&ag(hg,n,o),t[e]=i+hg.x,t[e+1]=s+hg.y}const{layout:cg,rotate:ug}=lg,{getAngle:_g}=A,pg={x:-.5},gg={connect:pg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},fg={connect:pg,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},yg={connect:pg,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]},mg={connect:pg,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]},vg={offset:pg,path:[...yg.path],dashPath:[1,-2.5,0,2,-1,0]};ug(vg.path,180,{x:-1.5,y:0});const wg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},xg={connect:{x:.5},path:[...wg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},bg={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]},kg={path:[...bg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Eg=Wt.clone(bg),Bg=Wt.clone(kg);ug(Eg.path,45),ug(Bg.path,45);const Rg={angle:gg,"angle-side":fg,arrow:mg,triangle:yg,"triangle-flip":vg,circle:xg,"circle-line":wg,square:kg,"square-line":bg,diamond:Bg,"diamond-line":Eg,mark:{offset:pg,path:[1,0,-2,2,0,2]}};function Sg(t,e,i,s,n,o,r){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}="object"==typeof e?e:Rg[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&&cg(g,p,0),cg(g,s.x,s.y,n,n,_g(i,s)),o.x=(_+p)*n,g}const{M:Cg,L:Og,C:Lg,Q:Tg,Z:Pg,N:Mg,D:Ag,X:Dg,G:Ig,F:Wg,O:Fg,P:zg,U:Ng}=oe,{copy:Yg,copyFrom:Xg,getDistancePoint:Hg}=A,Vg={},jg={},Ug={},Gg={},Zg={},Kg={list:Rg,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:n,dashPattern:o,__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 Cg:case Og:(d<2||h+6>=l)&&(Xg(Zg,r[h+1],r[h+2]),!d&&c&&Yg(jg,Zg)),h+=3;break;case Lg:1!==d&&h+7!==l||qg(r,Gg,Zg,h+3),h+=7;break;case Tg:1!==d&&h+5!==l||qg(r,Gg,Zg,h+1),h+=5;break;case Pg:return;case Mg:h+=5;break;case Ag:h+=9;break;case Dg:h+=6;break;case Ig:h+=9;break;case Wg:h+=5;break;case Fg:h+=7;break;case zg:h+=4;break;case Ng:1!==d&&h+6!==l||qg(r,Gg,Zg,h+1),h+=6}if(d++,1===d&&a!==Cg)return;if(2===d&&c&&Yg(Ug,a===Og?Zg:Gg),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=Sg(t,i,Ug,jg,n,Vg,!!o);o?d.push(...e):l.push(...e),Vg.x&&(Hg(jg,Ug,-Vg.x,!0),l[1]=Ug.x,l[2]=Ug.y)}if(s&&"none"!==s){const e=Sg(t,s,Gg,Zg,n,Vg,!!o);if(o?d.push(...e):l.push(...e),Vg.x){let t;switch(Hg(Zg,Gg,-Vg.x,!0),a){case Og:t=h-3+1;break;case Lg:t=h-7+5;break;case Tg:t=h-5+3;break;case Ng:t=h-6+3}t&&Jg(l,Gg,t)}}}else Yg(Gg,Zg)}}};function qg(t,e,i,s){Xg(e,t[s],t[s+1]),Xg(i,t[s+2],t[s+3])}function Jg(t,e,i){t[i]=e.x,t[i+1]=e.y}Ot.add("arrow"),Lh.addAttr("startArrow","none",$p),Lh.addAttr("endArrow","none",$p),Object.assign(Ka,Kg);const{Yes:$g,NoAndSkip:Qg,YesAndSkip:tf}=Nt,ef={},sf={},nf={};class of{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"#":ef.id=t.substring(1),t=ef;break;case".":sf.className=t.substring(1),t=sf;break;default:nf.tag=t,t=nf}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,n=s instanceof Array;return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?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&&So.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,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===$g||o===tf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Qg&&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_(Jo.REMOVE,this.__onRemoveChild,this),this.target.on_($o.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 rf=Lh.prototype;function af(i){return i.leafer?i.leafer.selector:t.selector||(t.selector=e.selector())}rf.find=function(t,e){return af(this).getBy(t,this,!1,e)},rf.findOne=function(t,e){return af(this).getBy(t,this,!0,e)},Ot.add("find"),e.finder=function(t){return new of(t)};const{setPoint:hf,addPoint:lf,toBounds:df}=H;const cf={syncExport(i,s,n){let o;this.running=!0;const r=gn.fileType(s),h=s.includes(".");n=gn.getExportOptions(n);const{toURL:l}=t,{download:d}=t.origin;if("json"===r)h&&d(l(JSON.stringify(i.toJSON(n.json)),"text"),s),o={data:!!h||i.toJSON(n.json)};else if("svg"===r)h&&d(l(i.toSVG(),"svg"),s),o={data:!!h||i.toSVG()};else{let t,r,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:_}=i,{slice:p,trim:g,padding:f,onCanvas:y}=n,m=void 0===n.smooth?!u||u.config.smooth:n.smooth,v=n.contextSettings||(u?u.config.contextSettings:void 0),w=n.screenshot||i.isApp,x=c&&w&&void 0===n.fill?i.fill:n.fill,b=gn.isOpaqueImage(s)||x,k=new Y;if(w)t=!0===w?c?u.canvas.bounds:i.worldRenderBounds:w;else{let e=n.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,e){case"inner":k.set(d);break;case"local":k.set(d).divide(i.localTransform),h/=i.scaleX,l/=i.scaleY;break;case"world":h=1,l=1;break;case"page":e=u||i;default:k.set(d).divide(i.getTransform(e));const t=e.worldTransform;h/=h/t.scaleX,l/=l/t.scaleY}t=i.getBounds("render",e)}const E={scaleX:1,scaleY:1};a.getScaleData(n.scale,n.size,t,E);let B=n.pixelRatio||1;i.isApp&&(E.scaleX*=B,E.scaleY*=B,B=i.app.pixelRatio);const{x:R,y:S,width:C,height:O}=new dt(t).scale(E.scaleX,E.scaleY),L={matrix:k.scale(1/E.scaleX,1/E.scaleY).invert().translate(-R,-S).withScale(1/h*E.scaleX,1/l*E.scaleY)};let T,P=e.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:m,contextSettings:v});if(p&&(T=i,T.__worldOpacity=0,i=u||i,L.bounds=P.bounds),P.save(),_&&void 0!==x){const t=i.get("fill");i.fill="",i.__render(P,L),i.fill=t}else i.__render(P,L);if(P.restore(),T&&T.__updateWorldOpacity(),g){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?lf(r,n,o):hf(r={},n,o)),a++;const h=new dt;return df(r,h),h.scale(1/t.pixelRatio).ceil()}(P);const t=P,{width:i,height:s}=r,n={x:0,y:0,width:i,height:s,pixelRatio:B};P=e.canvas(n),P.copyWorld(t,r,n)}if(f){const[t,i,s,n]=a.fourNumber(f),o=P,{width:r,height:h}=o;P=e.canvas({width:r+n+i,height:h+t+s,pixelRatio:B}),P.copyWorld(o,o.bounds,{x:n,y:t,width:r,height:h})}b&&P.fillWorld(P.bounds,x||"#FFFFFF","destination-over"),y&&y(P);o={data:"canvas"===s?P:P.export(s,n),width:P.pixelWidth,height:P.pixelHeight,renderBounds:t,trimBounds:r}}return this.running=!1,o},export(e,i,s){return this.running=!0,function(t){uf||(uf=new vn);return new Promise((e=>{uf.add((()=>jt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((n=>new Promise((o=>{const r=()=>jt(this,void 0,void 0,(function*(){if(!xn.isComplete)return t.requestRender(r);const a=cf.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()}));e.updateLayout(),_f(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))))}};let uf;function _f(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>_f(t)))}const pf=ie.prototype,gf=bt.get("@leafer-in/export");pf.export=function(t,e){const{quality:i,blob:s}=gn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},pf.toBlob=function(e,i){return new Promise((s=>{t.origin.canvasToBolb(this.view,e,i).then((t=>{s(t)})).catch((t=>{gf.error(t),s(null)}))}))},pf.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},pf.saveAs=function(e,i){return new Promise((s=>{t.origin.canvasSaveAs(this.view,e,i).then((()=>{s(!0)})).catch((t=>{gf.error(t),s(!1)}))}))},Ot.add("export"),Object.assign(eh,cf),Lh.prototype.export=function(t,e){return eh.export(this,t,e)},Lh.prototype.syncExport=function(t,e){return eh.syncExport(this,t,e)};const ff={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},yf={top:"flex-start",middle:"center",bottom:"flex-end"},mf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function vf(t,e,i){const{style:s}=t,{fill:n,padding:o,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=Ga.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Ga.string("string"==typeof t?t:t.color);break;default:void 0!==e.r&&(i=Ga.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,"object"==typeof h?(l=h.type,h.color&&(s.textDecorationColor=Ga.string(h.color))):l=h,s.textDecoration=mf[l],s.textTransform=ff[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=yf[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px","none"===r?s.whiteSpace="nowrap":"break"===r&&(s.wordBreak="break-all"),s.textIndent=(e.paraIndent||0)*i+"px",s.padding=o instanceof Array?o.map((t=>t*i+"px")).join(" "):(o||0)*i+"px",s.textOverflow="show"===a?"":"hide"===a?"clip":a}let wf=class extends $_{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 Rl),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:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(Al.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.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),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=window.getSelection().getRangeAt(0);i.deleteContents(),i.insertNode(e),i.setStartAfter(e),i.setEndAfter(e),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;const{a:i,b:s,c:n,d:o,e:r,f:a}=new Y(t.worldTransform).scale(1/e);let{x:h,y:l}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds;this.inBody||(h-=window.scrollX,l-=window.scrollY);let{width:d,height:c}=t;d*=e,c*=e;const u=t.__;if(u.__autoWidth&&u.autoSizeAlign)switch(d+=20,u.textAlign){case"center":h-=d/2;break;case"right":h-=d}if(u.__autoHeight&&u.autoSizeAlign)switch(c+=20,u.verticalAlign){case"middle":l-=c/2;break;case"bottom":l-=c}const{style:_}=this.editDom;_.transform=`matrix(${i},${s},${n},${o},${r},${a})`,_.left=h+"px",_.top=l+"px",_.width=d+"px",_.height=c+"px",this.isHTMLText||vf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),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),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};wf=Vt([X_()],wf),Ot.add("text-editor","editor"),Rl.addAttr("textEditing",!1,Gn);class xf extends kh{setText(t){this._text=t,this.__htmlChanged=!0}}let bf=class extends vl{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(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" 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(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}};Vt([so(xf)],bf.prototype,"__",void 0),Vt([Fn("")],bf.prototype,"text",void 0),Vt([Mn("TextEditor")],bf.prototype,"editInner",void 0),bf=Vt([po()],bf),Ot.add("html");export{vt as AlignHelper,Nt as Answer,Ol as App,ft as AroundHelper,Qp as Arrow,Jp as ArrowData,ut as AutoBounds,Te as BezierHelper,dt as Bounds,rt as BoundsHelper,Xh as Box,ch as BoxData,ma as Branch,Io as BranchHelper,Fr as BranchRender,xl as Canvas,Eh as CanvasData,It as CanvasManager,Jo as ChildEvent,Ga as ColorConvert,e as Creator,hd as Cursor,Wt as DataHelper,bt as Debug,_t as Direction4,pt as Direction9,Wl as DragEvent,Jl as Dragger,zl as DropEvent,L_ as EditBox,b_ as EditDataHelper,S_ as EditPoint,c_ as EditSelect,a_ as EditSelectHelper,Q_ as EditTool,H_ as EditToolCreator,J_ as Editor,Uu as EditorEvent,U_ as EditorGroupEvent,z_ as EditorHelper,Gu as EditorMoveEvent,Ku as EditorRotateEvent,Zu as EditorScaleEvent,qu as EditorSkewEvent,Qa as Effect,Gh as Ellipse,fh as EllipseData,Ne as EllipseHelper,qo as Event,At as EventCreator,rr as Eventer,eh as Export,gn as FileHelper,th as Filter,of as Finder,Hh as Frame,_h as FrameData,Th as Group,dh as GroupData,bf as HTMLText,xf as HTMLTextData,ld as HitCanvasManager,vl as Image,kh as ImageData,Qo as ImageEvent,kn as ImageManager,i as IncrementId,$_ as InnerEditor,j_ as InnerEditorEvent,ad as InteractionBase,jl as InteractionHelper,Vl as KeyEvent,Tl as Keyboard,ir as LayoutEvent,Wa as Layouter,ha as Leaf,Dr as LeafBounds,Ao as LeafBoundsHelper,zt as LeafData,wr as LeafDataProxy,yr as LeafEventer,So as LeafHelper,Ko as LeafLayout,wa as LeafLevelList,va as LeafList,Sr as LeafMatrix,Ir as LeafRender,Ah as Leafer,ba as LeaferCanvas,ie as LeaferCanvasBase,uh as LeaferData,nr as LeaferEvent,Sn as LeaferImage,Ip as LeaferTypeCreator,il as Line,ph as LineData,op as LineEditTool,a as MathHelper,Y as Matrix,b as MatrixHelper,Nl as MoveEvent,zp as MultiTouchHelper,Fl as MyDragEvent,wl as MyImage,Dl as MyPointerEvent,ae as NeedConvertToCanvasCommandMap,l as OneRadian,d as PI2,c as PI_2,qa as Paint,$a as PaintGradient,Ja as PaintImage,Sl as Path,Ka as PathArrow,Kg as PathArrowModule,nn as PathBounds,Gi as PathCommandDataHelper,oe as PathCommandMap,Ei as PathConvert,cn as PathCorner,ds as PathCreator,vh as PathData,Bs as PathDrawer,se as PathHelper,lg as PathMatrixHelper,ce as PathNumberCommandLengthMap,de as PathNumberCommandMap,Cl as Pen,wh as PenData,Ya as Picker,t as Platform,Ot as Plugin,z as Point,A as PointHelper,Pl as PointerButton,Al as PointerEvent,cl as Polygon,yh as PolygonData,$o as PropertyEvent,Dh as Rect,gh as RectData,ue as RectHelper,Ch as RectRender,sr as RenderEvent,za as Renderer,tr as ResizeEvent,xn as Resource,Yl as RotateEvent,Rt as Run,qp as ScrollBar,r_ as SelectArea,Xa as Selector,ml as Star,mh as StarData,ih as State,wt as StringNumberMap,o_ as Stroker,Xl as SwipeEvent,mn as TaskItem,vn as TaskProcessor,Rl as Text,Ua as TextConvert,bh as TextData,wf as TextEditor,Yp as Transformer,sh as Transition,H as TwoPointBoundsHelper,Lh as UI,Bh as UIBounds,Tt as UICreator,hh as UIData,Ml as UIEvent,Rh as UIRender,Za as UnitConvert,No as WaitHelper,er as WatchEvent,Ra as Watcher,Np as WheelEventHelper,Hl as ZoomEvent,Mp as addViewport,Ap as addViewportConfig,Un as affectRenderBoundsType,Hn as affectStrokeBoundsType,$p as arrowType,Tn as attr,Dn as autoLayoutType,Fn as boundsType,pn as canvasPatch,ee as canvasSizeAttrs,io as cursorType,so as dataProcessor,Mn as dataType,Ln as decorateLeafAttr,oo as defineDataProcessor,Cn as defineKey,Pn as defineLeafAttr,Nn as doBoundsType,Vn as doStrokeType,Ha as effectType,Yt as emptyData,to as eraserType,_ as getBoundsData,On as getDescriptor,p as getMatrixData,u as getPointData,eo as hitType,Ht as isEmptyData,Xt as isNull,no as layoutProcessor,Qn as maskType,zn as naturalBoundsType,Zn as opacityType,Yn as pathInputType,Xn as pathType,un as pen,An as positionType,Y_ as registerEditTool,X_ as registerInnerEditor,po as registerUI,go as registerUIEvent,Va as resizeType,lo as rewrite,co as rewriteAble,Wn as rotationType,In as scaleType,$n as sortType,jn as strokeType,Gn as surfaceType,ct as tempBounds,X as tempMatrix,N as tempPoint,Ea as useCanvas,_o as useModule,xa as version,Kn as visibleType,ja 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,{round:s,pow:n,PI:o}=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?n(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,n=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||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=o/180,l=2*o,d=o/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,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,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:n,d:o}=t,r=g(e*=h),a=p(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*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:n,c:o,d:r}=t;i&&(i*=h,t.a=s+o*i,t.b=n+r*i),e&&(e*=h,t.c=o+s*e,t.d=r+n*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:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n,o){let{e:r,f:a}=t;if(o&&(r+=o.scrollX,a+=o.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*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=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:n,e:o,f:r}=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=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:o,y:r,scaleX:a,scaleY:l}=e;if(void 0===n&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*h,r=g(o),d=p(o);if(s||n){const e=s*h,i=n*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=o,t.f=r,(i=i||s)&&b.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:l,f:c}=t;let u,_,v,w,x,b=l,k=c;if(o||r){const t=n*a-o*r;if(r&&!s){u=y(n*n+o*o),_=t/u;const e=n/u;v=o>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((o/u-i)/e/h,9):0,v=m(v/h)}else u=n,_=a,v=w=x=0;return(e=i||e)&&(b+=e.x*n+e.y*r,k+=e.x*o+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:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=y(s*s+n*n)):(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:R,abs:S,sqrt:C,atan2:L,min:O,round:T,PI:P}=Math,A={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?T(t.x-.5)+.5:T(t.x),t.y=e?T(t.y-.5)+.5:T(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=M.defaultPoint);const s=R(e*=h),n=B(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=M;return I(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=M;return I(i,t),E(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=M;return I(i,t),M.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)=>D(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=S(i-t),o=S(s-e);return C(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>O(D(t,e,i,s),D(i,s,n,o)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,i,s)=>(s||(s=e),M.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/h),getRadianFrom(t,e,i,s,n,o,r,a){void 0===r&&(r=i,a=s);let h=L(e-s,t-i);const d=L(o-a,n-r)-h;return d<-P?d+l:d},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=W(t,e);return(e=s?e:{}).x=t.x+R(n)*i,e.y=t.y+B(n)*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){M.reset(t)}},M=A,{getDistanceFrom:D,copy:I,getAtan2:W}=M;class F{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?A.copy(this,t):A.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new F(this)}move(t,e){return A.move(this,t,e),this}scale(t,e){return A.scale(this,t,e),this}scaleOf(t,e,i){return A.scaleOf(this,t,e,i),this}rotate(t,e){return A.rotate(this,t,e),this}rotateOf(t,e){return A.rotate(this,e,t),this}getRotation(t,e,i){return A.getRotation(this,t,e,i)}toInnerOf(t,e){return A.toInnerOf(this,t,e),this}toOuterOf(t,e){return A.toOuterOf(this,t,e),this}getCenter(t){return new F(A.getCenter(this,t))}getDistance(t){return A.getDistance(this,t)}getDistancePoint(t,e,i){return new F(A.getDistancePoint(this,t,e,i))}getAngle(t){return A.getAngle(this,t)}getAtan2(t){return A.getAtan2(this,t)}reset(){return A.reset(this),this}}const z=new F;class N{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return"object"==typeof t?x.copy(this,t):x.set(this,t,e,i,s,n,o),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:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new N(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 Y=new N,H={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){X(t,e,i),X(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:X}=H;var V,j;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(V||(V={})),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"}(j||(j={}));const U=[{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}];U.forEach((t=>t.type="percent"));const G={directionData:U,tempPoint:{},get:Z,toPoint(t,e,i,s,n,o){const r=Z(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)}};function Z(t){return"string"==typeof t?U[j[t]]:t}const{toPoint:K}=G,q={toPoint(t,e,i,s,n,o){K(t,i,s,n,e,o)}},{tempPointBounds:J,setPoint:$,addPoint:Q,toBounds:tt}=H,{toOuterPoint:et}=x,{float:it,fourNumber:st}=r,{floor:nt,ceil:ot}=Math;let rt,at,ht,lt;const dt={},ct={},ut={},_t={tempBounds:ut,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:o,y:r,width:a,height:h}=e;if(i instanceof Array){const e=st(i);s?pt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):pt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),pt.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),pt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?ft(e,t):e=t,i?(e.offsetX=-(pt.maxX(i)-t.x),e.offsetY=-(pt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),pt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||A.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){A.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(pt.copy(ut,t),pt.toOuterOf(ut,e),ut),getOuterOf:(t,e)=>(t=Object.assign({},t),pt.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 dt.x=t.x,dt.y=t.y,et(e,dt,ct),$(J,ct.x,ct.y),dt.x=t.x+t.width,et(e,dt,ct),Q(J,ct.x,ct.y),dt.y=t.y+t.height,et(e,dt,ct),Q(J,ct.x,ct.y),dt.x=t.x,et(e,dt,ct),Q(J,ct.x,ct.y),tt(J,i)},toInnerOf(t,e,i){i||(i=t),pt.move(i,-e.e,-e.f),pt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,pt.getFitScale(t,e));return new N(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,o){o||(o=e),"string"==typeof s&&(s=pt.getFitScale(t,e,"cover"===s)),ut.width=n?e.width*=s:e.width*s,ut.height=n?e.height*=s:e.height*s,q.toPoint(i,ut,t,o,!0,!0)},getSpread(t,e,i){const s={};return pt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){pt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){pt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=nt(t.x),t.y=nt(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=it(t.x,e),t.y=it(t.y,e),t.width=it(t.width,e),t.height=it(t.height,e)},add(t,e,i){rt=t.x+t.width,at=t.y+t.height,ht=e.x,lt=e.y,i||(ht+=e.width,lt+=e.height),rt=rt>ht?rt:ht,at=at>lt?at:lt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=rt-t.x,t.height=at-t.y},addList(t,e){pt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){pt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){pt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r]):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||ft(t,n)):gt(t,n));o&&pt.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?$(J,t.x,t.y):Q(J,t.x,t.y))),tt(J,t)},setPoint(t,e){pt.set(t,e.x,e.y)},addPoint(t,e){gt(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=A.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=A.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=pt.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=pt.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=pt.tempToOuterOf(e,i)),!pt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return rt=s+o,at=n+r,ht=t.x+t.width,lt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,rt=rt<ht?rt:ht,at=at<lt?at:lt,o=rt-s,r=at-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){pt.copy(t,pt.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){pt.set(t)}},pt=_t,{add:gt,copy:ft}=pt;class yt{get minX(){return _t.minX(this)}get minY(){return _t.minY(this)}get maxX(){return _t.maxX(this)}get maxY(){return _t.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?_t.copy(this,t):_t.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 yt(this)}move(t,e){return _t.move(this,t,e),this}scale(t,e,i){return _t.scale(this,t,e,i),this}scaleOf(t,e,i){return _t.scaleOf(this,t,e,i),this}toOuterOf(t,e){return _t.toOuterOf(this,t,e),this}toInnerOf(t,e){return _t.toInnerOf(this,t,e),this}getFitMatrix(t,e){return _t.getFitMatrix(this,t,e)}put(t,e,i){_t.put(this,t,e,i)}spread(t,e){return _t.spread(this,t,e),this}shrink(t,e){return _t.shrink(this,t,e),this}ceil(){return _t.ceil(this),this}unsign(){return _t.unsign(this),this}float(t){return _t.float(this,t),this}add(t){return _t.add(this,t),this}addList(t){return _t.setList(this,t,!0),this}setList(t){return _t.setList(this,t),this}addListWithFn(t,e){return _t.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return _t.setListWithFn(this,t,e),this}setPoint(t){return _t.setPoint(this,t),this}setPoints(t){return _t.setPoints(this,t),this}addPoint(t){return _t.addPoint(this,t),this}getPoints(){return _t.getPoints(this)}hitPoint(t,e){return _t.hitPoint(this,t,e)}hitRadiusPoint(t,e){return _t.hitRadiusPoint(this,t,e)}hit(t,e){return _t.hit(this,t,e)}includes(t,e){return _t.includes(this,t,e)}intersect(t,e){return _t.intersect(this,t,e),this}getIntersect(t,e){return new yt(_t.getIntersectData(this,t,e))}isSame(t){return _t.isSame(this,t)}isEmpty(){return _t.isEmpty(this)}reset(){_t.reset(this)}}const mt=new yt;class vt{constructor(t,e,i,s,n,o){"object"==typeof t?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new yt(n,e,o||t.width-n-i,r||t.height-e-s)}}const wt={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:xt}=r;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=kt(t)}static set exclude(t){this.excludeList=kt(t)}static drawRepaint(t,e){const i=xt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===bt.showBounds,n=t.__nowWorld,o=xt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(Et.enable){if(Et.filterList.length&&Et.filterList.every((t=>t!==this.name)))return;if(Et.excludeList.length&&Et.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Et.enable&&this.warn(...t)}warn(...t){Et.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 kt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Et=bt,Bt=bt.get("RunTime"),Rt={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],n=e?(performance.now()-i)/1e3:Date.now()-i;St.idMap[t]=St.nameMap[t]=St.nameToIdMap[s]=void 0,Bt.log(s,n,"ms")},endOfName(t,e){const i=St.nameToIdMap[t];void 0!==i&&St.end(i,e)}},St=Rt,Ct=[],Lt={list:{},add(t,...e){this.list[t]=!0,Ct.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((()=>Ct.forEach((t=>Lt.has(t,!0)))));const Ot={editor:t=>Lt.need("editor")},Tt=bt.get("UICreator"),Pt={list:{},register(t){const{__tag:e}=t.prototype;At[e]&&Tt.repeat(e),At[e]=t},get(t,e,i,s,n,o){At[t]||Tt.error("not register "+t);const r=new At[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),n&&(r.width=n),o&&(r.height=o)),r}},{list:At}=Pt,Mt=bt.get("EventCreator"),Dt={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(It[e]&&Mt.repeat(e),It[e]=t)}))},changeName(t,e){const i=It[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,It[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new It[t](...e)},{nameList:It}=Dt;class Wt{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=Ot.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 Ft={default:(t,e)=>(zt(e,t),zt(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return zt(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&zt(t[n]={},e[n],i[n]):t[n]=e[n]}))},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:zt}=Ft;class Nt{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 n in this)if("_"!==n[0]&&(t=this["_"+n],void 0!==t)){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,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 Yt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Yt||(Yt={}));const Ht={};function Xt(t){return null==t}function Vt(t){return"{}"===JSON.stringify(t)}function jt(t,e,i,s){var n,o=arguments.length,r=o<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--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function Ut(t,e,i,s){return new(i||(i=Promise))((function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(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(r,a)}h((s=s.apply(t,e||[])).next())}))}function Gt(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 Zt=[];function Kt(){return(t,e)=>{Zt.push(e)}}const qt=[];let Jt=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||qt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Zt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){"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,n,o)}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,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,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,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,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,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};jt([Gt("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),jt([Gt("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),jt([Gt("globalAlpha")],Jt.prototype,"opacity",void 0),jt([Gt()],Jt.prototype,"fillStyle",void 0),jt([Gt()],Jt.prototype,"strokeStyle",void 0),jt([Gt("lineWidth")],Jt.prototype,"strokeWidth",void 0),jt([Gt("lineCap")],Jt.prototype,"strokeCap",void 0),jt([Gt("lineJoin")],Jt.prototype,"strokeJoin",void 0),jt([Gt("lineDashOffset")],Jt.prototype,"dashOffset",void 0),jt([Gt()],Jt.prototype,"miterLimit",void 0),jt([Gt()],Jt.prototype,"shadowBlur",void 0),jt([Gt()],Jt.prototype,"shadowColor",void 0),jt([Gt()],Jt.prototype,"shadowOffsetX",void 0),jt([Gt()],Jt.prototype,"shadowOffsetY",void 0),jt([Gt()],Jt.prototype,"filter",void 0),jt([Gt()],Jt.prototype,"font",void 0),jt([Gt()],Jt.prototype,"fontKerning",void 0),jt([Gt()],Jt.prototype,"fontStretch",void 0),jt([Gt()],Jt.prototype,"fontVariantCaps",void 0),jt([Gt()],Jt.prototype,"textAlign",void 0),jt([Gt()],Jt.prototype,"textBaseline",void 0),jt([Gt()],Jt.prototype,"textRendering",void 0),jt([Gt()],Jt.prototype,"wordSpacing",void 0),jt([Gt()],Jt.prototype,"letterSpacing",void 0),jt([Gt()],Jt.prototype,"direction",void 0),jt([Kt()],Jt.prototype,"setTransform",null),jt([Kt()],Jt.prototype,"resetTransform",null),jt([Kt()],Jt.prototype,"getTransform",null),jt([Kt()],Jt.prototype,"save",null),jt([Kt()],Jt.prototype,"restore",null),jt([Kt()],Jt.prototype,"translate",null),jt([Kt()],Jt.prototype,"scale",null),jt([Kt()],Jt.prototype,"rotate",null),jt([Kt()],Jt.prototype,"fill",null),jt([Kt()],Jt.prototype,"stroke",null),jt([Kt()],Jt.prototype,"clip",null),jt([Kt()],Jt.prototype,"fillRect",null),jt([Kt()],Jt.prototype,"strokeRect",null),jt([Kt()],Jt.prototype,"clearRect",null),jt([Kt()],Jt.prototype,"beginPath",null),jt([Kt()],Jt.prototype,"moveTo",null),jt([Kt()],Jt.prototype,"lineTo",null),jt([Kt()],Jt.prototype,"bezierCurveTo",null),jt([Kt()],Jt.prototype,"quadraticCurveTo",null),jt([Kt()],Jt.prototype,"closePath",null),jt([Kt()],Jt.prototype,"arc",null),jt([Kt()],Jt.prototype,"arcTo",null),jt([Kt()],Jt.prototype,"ellipse",null),jt([Kt()],Jt.prototype,"rect",null),jt([Kt()],Jt.prototype,"roundRect",null),jt([Kt()],Jt.prototype,"createConicGradient",null),jt([Kt()],Jt.prototype,"createLinearGradient",null),jt([Kt()],Jt.prototype,"createPattern",null),jt([Kt()],Jt.prototype,"createRadialGradient",null),jt([Kt()],Jt.prototype,"fillText",null),jt([Kt()],Jt.prototype,"measureText",null),jt([Kt()],Jt.prototype,"strokeText",null);const{copy:$t,multiplyParent:Qt}=x,{round:te}=Math,ee={width:1,height:1,pixelRatio:1},ie=["width","height","pixelRatio"];class se extends Jt{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=ee),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:n,height:o,pixelRatio:r}=i;this.autoLayout=!n||!o,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;Ft.copyAttrs(s,t,ie),ie.forEach((t=>s[t]||(s[t]=1))),this.bounds=new yt(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&&Qt(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=te(n.e-.5)+.5,n.f=te(n.f-.5)+.5):(n.e=te(n.e),n.f=te(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){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: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,_t.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:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[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")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(mt.x,mt.y,mt.width,mt.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(mt.x,mt.y,mt.width,mt.height),this.clip()}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):Ot.canvas(Object.assign({},i));return n.save(),t&&($t(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 ne={creator:{},parse(t,e){},convertToCanvasData(t,e){}},oe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},re=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),ae={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},he={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},le=Object.assign(Object.assign({},he),oe),de=re,ce={};for(let t in de)ce[de[t]]=t;const ue={};for(let t in de)ue[de[t]]=ae[t];const _e={drawRoundRect(t,e,i,s,n,o){const a=r.fourNumber(o,Math.min(s/2,n/2)),h=e+s,l=i+n;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:pe,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:we,pow:xe}=Math,{setPoint:be,addPoint:ke}=H,{set:Ee,toNumberPoints:Be}=A,{M:Re,L:Se,C:Ce,Q:Le,Z:Oe}=re,Te={},Pe={points(t,e,i,s){let n=Be(e);if(t.push(Re,n[0],n[1]),i&&n.length>5){let e,o,r,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],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=we(xe(r-e,2)+xe(a-o,2)),g=we(xe(h-r,2)+xe(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(Le,d,c,r,a):t.push(Ce,u,_,d,c,r,a),u=r+g*h,_=a+g*l);s||t.push(Le,u,_,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Se,n[e],n[e+1]);s&&t.push(Oe)},rect(t,e,i,s,n){ne.creator.path=t,ne.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,o){ne.creator.path=[],_e.drawRoundRect(ne.creator,e,i,s,n,o),t.push(...ne.convertToCanvasData(ne.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,c,u,_){const p=s-e,g=n-i,f=o-s,y=r-n;let m=fe(g,p),v=fe(y,f),w=v-m;if(w<0&&(w+=l),w===ve||me(p+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Se,s,n),c&&(be(c,e,i),ke(c,s,n)),_&&Ee(_,e,i),void(u&&Ee(u,s,n));const x=p*y-f*g<0,b=x?-1:1,k=a/ge(w/2),E=s+k*ge(m+w/2+d*b),B=n+k*pe(m+w/2+d*b);return m-=d*b,v-=d*b,De(t,E,B,a,a,0,m/h,v/h,x,c,u,_)},arc:(t,e,i,s,n,o,r,a,h,l)=>De(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,c,u,_,p){const g=o*h,f=pe(g),y=ge(g);let m=r*h,v=a*h;m>ve&&(m-=l),v<0&&(v+=l);let w=v-m;w<0?w+=l:w>l&&(w-=l),c&&(w-=l);const x=ye(me(w/d)),b=w/x,k=pe(b/4),E=8/3*k*k/pe(b/2);v=m+b;let B,R,S,C,L,O,T,P,A=ge(m),M=pe(m),D=S=y*s*A-f*n*M,I=C=f*s*A+y*n*M,W=e+S,F=i+C;t&&t.push(t.length?Se:Re,W,F),u&&be(u,W,F),p&&Ee(p,W,F);for(let o=0;o<x;o++)B=ge(v),R=pe(v),S=y*s*B-f*n*R,C=f*s*B+y*n*R,L=e+D-E*(y*s*M+f*n*A),O=i+I-E*(f*s*M-y*n*A),T=e+S+E*(y*s*R+f*n*B),P=i+C+E*(f*s*R-y*n*B),t&&t.push(Ce,L,O,T,P,e+S,i+C),u&&Me(e+D,i+I,L,O,T,P,e+S,i+C,u,!0),D=S,I=C,A=B,M=R,m=v,v+=b;_&&Ee(_,e+S,i+C)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(Ce,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){Me(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,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?ke(h,t,e):be(h,t,e),ke(h,r,a);for(let l=0,c=d.length;l<c;l++)Ae(d[l],t,e,i,s,n,o,r,a,Te),ke(h,Te.x,Te.y)},getPointAndSet(t,e,i,s,n,o,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+_*o+p*a,l.y=c*i+u*n+_*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Ae(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:Ae,toTwoPointBounds:Me,ellipse:De}=Pe,{sin:Ie,cos:We,sqrt:Fe,atan2:ze}=Math,{ellipse:Ne}=Pe,Ye={ellipticalArc(e,i,s,n,o,r,a,d,c,u,_){const p=(c-i)/2,g=(u-s)/2,f=r*h,y=Ie(f),m=We(f),v=-m*p-y*g,w=-m*g+y*p,x=n*n,b=o*o,k=w*w,E=v*v,B=x*b-x*k-b*E;let R=0;if(B<0){const t=Fe(1-B/(x*b));n*=t,o*=t}else R=(a===d?-1:1)*Fe(B/(x*k+b*E));const S=R*n*w/o,C=-R*o*v/n,L=ze((w-C)/o,(v-S)/n),O=ze((-w-C)/o,(-v-S)/n);let T=O-L;0===d&&T>0?T-=l:1===d&&T<0&&(T+=l);const P=i+p+m*S-y*C,A=s+g+y*S+m*C,M=T<0?1:0;_||t.ellipseToCurve?Ne(e,P,A,n,o,r,L/h,O/h,M):n!==o||r?e.push(re.G,P,A,n,o,r,L/h,O/h,M):e.push(re.O,P,A,n,L/h,O/h,M)}},{M:He,m:Xe,L:Ve,l:je,H:Ue,h:Ge,V:Ze,v:Ke,C:qe,c:Je,S:$e,s:Qe,Q:ti,q:ei,T:ii,t:si,A:ni,a:oi,Z:ri,z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:_i,P:pi,U:gi}=re,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:wi,quadraticCurveTo:xi}=Pe,{ellipticalArc:bi}=Ye,ki=bt.get("PathConvert"),Ei={},Bi={current:{dot:0},stringify(t,e){let i,s,n,o=0,a=t.length,h="";for(;o<a;){s=t[o],i=ue[s],h+=s===n?" ":ce[s];for(let s=1;s<i;s++)h+=r.float(t[o+s],e),s===i-1||(h+=" ");n=s,o+=i}return h},parse(t,e){let i,s,n,o="";const r=[],a=e?le:he;for(let e=0,h=t.length;e<h;e++)s=t[e],wt[s]?("."===s&&(Ri.dot&&(Si(r,o),o=""),Ri.dot++),"0"===o&&"."!==s&&(Si(r,o),o=""),o+=s):re[s]?(o&&(Si(r,o),o=""),Ri.name=re[s],Ri.length=ae[s],Ri.index=0,Si(r,Ri.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Si(r,o),o=s):o&&(Si(r,o),o=""),n=s;return o&&Si(r,o),i?Bi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){case Xe:t[c+1]+=a,t[c+2]+=h;case He:a=t[c+1],h=t[c+2],_.push(He,a,h),c+=3;break;case Ge:t[c+1]+=a;case Ue:a=t[c+1],_.push(Ve,a,h),c+=2;break;case Ke:t[c+1]+=h;case Ze:h=t[c+1],_.push(Ve,a,h),c+=2;break;case je:t[c+1]+=a,t[c+2]+=h;case Ve:a=t[c+1],h=t[c+2],_.push(Ve,a,h),c+=3;break;case Qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=$e;case $e:r=o===qe||o===$e,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(qe,l,d,i,s,a,h),c+=5;break;case Je: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=qe;case qe:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(qe,t[c+1],t[c+2],i,s,a,h),c+=7;break;case si:t[c+1]+=a,t[c+2]+=h,n=ii;case ii:r=o===ti||o===ii,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?xi(_,a,h,i,s,t[c+1],t[c+2]):_.push(ti,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ei:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ti;case ti:i=t[c+1],s=t[c+2],e?xi(_,a,h,i,s,t[c+3],t[c+4]):_.push(ti,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 ni:bi(_,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 ai:case ri:_.push(ri),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4]):Ci(_,t,c,5),c+=5;break;case li:a=t[c+1],h=t[c+2],e?yi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ci(_,t,c,9),c+=9;break;case di:a=t[c+1],h=t[c+2],e?yi(_,a,h,t[c+3],t[c+4],t[c+5]):Ci(_,t,c,6),c+=6;break;case ci:wi(e?_:Ci(_,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,Ei),a=Ei.x,h=Ei.y,c+=9;break;case ui:e?wi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ci(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case _i:vi(e?_:Ci(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ei),a=Ei.x,h=Ei.y,c+=7;break;case pi:e?vi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ci(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?_:Ci(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ei),a=Ei.x,h=Ei.y,c+=6;break;default:return ki.error(`command: ${n} [index:${c}]`,t),_}o=n}return _},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(He,t.x,t.y);break;case"L":e.push(Ve,t.x,t.y);break;case"C":e.push(qe,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ti,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ri)}})),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Ri.index===Ri.length&&(Ri.index=1,t.push(Ri.name)),t.push(Number(e)),Ri.index++,Ri.dot=0}},{current:Ri,pushData:Si,copyData:Ci}=Bi,{M:Li,L:Oi,C:Ti,Q:Pi,Z:Ai,N:Mi,D:Di,X:Ii,G:Wi,F:Fi,O:zi,P:Ni,U:Yi}=re,{getMinDistanceFrom:Hi,getRadianFrom:Xi}=A,{tan:Vi,min:ji,abs:Ui}=Math,Gi={},Zi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Li,e,i)},lineTo(t,e,i){t.push(Oi,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Ti,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Pi,e,i,s,n)},closePath(t){t.push(Ai)},rect(t,e,i,s,n){t.push(Mi,e,i,s,n)},roundRect(t,e,i,s,n,o){if("number"==typeof o)t.push(Ii,e,i,s,n,o);else{const a=r.fourNumber(o);a?t.push(Di,e,i,s,n,...a):t.push(Mi,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,a,h){void 0===o?t.push(Fi,e,i,s,n):(void 0===r&&(r=0),void 0===a&&(a=360),t.push(Wi,e,i,s,n,o,r,a,h?1:0))},arc(t,e,i,s,n,o,r){void 0===n?t.push(Ni,e,i,s):(void 0===o&&(o=360),t.push(zi,e,i,s,n,o,r?1:0))},arcTo(t,e,i,s,n,o,r,a){if(void 0!==r){const t=Hi(r,a,e,i,s,n);o=ji(o,ji(t/2,t/2*Ui(Vi(Xi(r,a,e,i,s,n)/2))))}t.push(Yi,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,a,h){Pe.ellipse(null,e,i,s,n,void 0===o?0:o,void 0===r?0:r,void 0===a?360:a,h,null,null,Gi),t.push(Li,Gi.x,Gi.y),Ki(t,e,i,s,n,o,r,a,h)},drawArc(t,e,i,s,n,o,r){Pe.arc(null,e,i,s,void 0===n?0:n,void 0===o?360:o,r,null,null,Gi),t.push(Li,Gi.x,Gi.y),qi(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){Pe.points(t,e,i,s)}},{ellipse:Ki,arc:qi}=Zi,{moveTo:Ji,lineTo:$i,quadraticCurveTo:Qi,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:ns,ellipse:os,arc:rs,arcTo:as,drawEllipse:hs,drawArc:ls,drawPoints:ds}=Zi;class cs{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?ne.parse(t):t:[],this}beginPath(){return is(this.__path),this.paint(),this}moveTo(t,e){return Ji(this.__path,t,e),this.paint(),this}lineTo(t,e){return $i(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return ts(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Qi(this.__path,t,e,i,s),this.paint(),this}closePath(){return es(this.__path),this.paint(),this}rect(t,e,i,s){return ss(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return ns(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return os(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return rs(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return as(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return hs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return ls(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return ds(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:us,L:_s,C:ps,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:ws,F:xs,O:bs,P:ks,U:Es}=re,Bs=bt.get("PathDrawer"),Rs={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case _s:t.lineTo(e[s+1],e[s+2]),s+=3;break;case ps:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case fs:t.closePath(),s+=1;break;case ys:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ms: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 vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case ws: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 xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,l,!1),s+=5;break;case bs: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 ks:t.arc(e[s+1],e[s+2],e[s+3],0,l,!1),s+=4;break;case Es:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Bs.error(`command: ${i} [index:${s}]`,e)}}},{M:Ss,L:Cs,C:Ls,Q:Os,Z:Ts,N:Ps,D:As,X:Ms,G:Ds,F:Is,O:Ws,P:Fs,U:zs}=re,{toTwoPointBounds:Ns,toTwoPointBoundsByQuadraticCurve:Ys,arcTo:Hs,arc:Xs,ellipse:Vs}=Pe,{addPointBounds:js,copy:Us,addPoint:Gs,setPoint:Zs,addBounds:Ks,toBounds:qs}=H,Js=bt.get("PathBounds");let $s,Qs,tn;const en={},sn={},nn={},on={toBounds(t,e){on.toTwoPointBounds(t,sn),qs(sn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Zs(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===Ts||r===Ls||r===Os?Zs(e,h,l):Zs(e,t[a+1],t[a+2])),r){case Ss:case Cs:h=t[a+1],l=t[a+2],Gs(e,h,l),a+=3;break;case Ls:n=t[a+5],o=t[a+6],Ns(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,en),js(e,en),h=n,l=o,a+=7;break;case Os:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],Ys(h,l,i,s,n,o,en),js(e,en),h=n,l=o,a+=5;break;case Ts:a+=1;break;case Ps:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case As:case Ms:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=r===As?9:6;break;case Ds:Vs(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],en,nn),0===a?Us(e,en):js(e,en),h=nn.x,l=nn.y,a+=9;break;case Is:h=t[a+1],l=t[a+2],Qs=t[a+3],tn=t[a+4],Ks(e,h-Qs,l-tn,2*Qs,2*tn),h+=Qs,a+=5;break;case Ws:Xs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],en,nn),0===a?Us(e,en):js(e,en),h=nn.x,l=nn.y,a+=7;break;case Fs:h=t[a+1],l=t[a+2],$s=t[a+3],Ks(e,h-$s,l-$s,2*$s,2*$s),h+=$s,a+=4;break;case zs:Hs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],en,nn),0===a?Us(e,en):js(e,en),h=nn.x,l=nn.y,a+=6;break;default:return void Js.error(`command: ${r} [index:${a}]`,t)}}},{M:rn,L:an,Z:hn}=re,{getCenterX:ln,getCenterY:dn}=A,{arcTo:cn}=Zi,un={smooth(t,e,i){let s,n,o=0,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0;const p=t.length,g=[];for(;o<p;)switch(s=t[o],s){case rn:h=u=t[o+1],l=_=t[o+2],o+=3,t[o]===an?(d=t[o+1],c=t[o+2],g.push(rn,ln(h,d),dn(l,c))):g.push(rn,h,l);break;case an:switch(r=t[o+1],a=t[o+2],o+=3,t[o]){case an:cn(g,r,a,t[o+1],t[o+2],e,u,_);break;case hn:cn(g,r,a,h,l,e,u,_);break;default:g.push(an,r,a)}u=r,_=a;break;case hn:cn(g,h,l,d,c,e,u,_),g.push(hn),o+=1;break;default:n=ue[s];for(let e=0;e<n;e++)g.push(t[o+e]);o+=n}return s!==hn&&(g[1]=h,g[2]=l),g}};ne.creator=new cs,ne.parse=Bi.parse,ne.convertToCanvasData=Bi.toCanvasData;const _n=new cs,{drawRoundRect:pn}=_e;function gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){pn(this,t,e,i,s,n)})}(t)}const fn={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=yn.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{}}}},yn=fn;yn.alphaPixelTypes.forEach((t=>yn.upperCaseTypeMap[t]=t.toUpperCase()));const mn=bt.get("TaskProcessor");class vn{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return Ut(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){mn.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wn{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&&Ft.assign(this.config,t),this.empty()}add(t,e){let i,s,n,o;const r=new vn(t);return r.parent=this,"number"==typeof e?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(r.time=n),!1===s&&(r.parallel=!1),void 0===o?this.push(r,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(r,i))}),o)),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 xn=bt.get("Resource"),bn={tasker:new wn,map:{},get isComplete(){return kn.tasker.isComplete},set(t,e){kn.map[t]&&xn.repeat(t),kn.map[t]=e},get:t=>kn.map[t],remove(t){const e=kn.map[t];e&&(e.destroy&&e.destroy(),delete kn.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"string"==typeof e?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Ot.image(s)),kn.set(t,e),e},destroy(){kn.map={}}},kn=bn,En={maxRecycled:10,recycledList:[],patternTasker:new wn,get(t){let e=bn.get(t.url);return e||bn.set(t.url,e=Ot.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Bn.recycledList.push(t)}))},clearRecycled(){const t=Bn.recycledList;t.length>Bn.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&bn.remove(t.url))),t.length=0)},hasAlphaPixel:t=>fn.alphaPixelTypes.some((e=>Bn.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+fn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+fn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Bn.recycledList=[]}},Bn=En,{IMAGE:Rn,create:Sn}=e;class Cn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Sn(Rn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}En.isFormat("svg",t)&&(this.isSVG=!0),En.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),bn.tasker.add((()=>Ut(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){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 o=t.origin.createCanvas(e,i),r=o.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,i,s,n){const o=t.canvas.createPattern(e,i);try{s&&o.setTransform&&(o.setTransform(s),s=null)}catch(t){}return n&&(n.transform=s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Ln(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function On(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Tn(t,e){return(i,s)=>An(i,s,t,e&&e(s))}function Pn(t){return t}function An(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Ln(t,e,Object.assign(n,s||{})),ro(t,e,i)}function Mn(t){return Tn(t)}function Dn(t,e){return Tn(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function In(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Yn(this))}})))}function Wn(t,e){return Tn(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Fn(t,e){return Tn(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function zn(t,e){return Tn(t,(t=>({set(i){this.__setAttr(t,i,e)&&Yn(this)}})))}function Nn(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(Yn(this),this.__.__removeNaturalSize())}})))}function Yn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Hn(t){return Tn(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Yn(this)}})))}const Xn=zn;function Vn(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&jn(this)}})))}function jn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Yn(t)}const Un=Vn;function Gn(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Zn(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Kn(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Jn(this)}})))}function qn(t){return Tn(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>$n(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");$n(this,t,e,i),this.mask&&Jn(this)}})))}function Jn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function $n(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Yn(t))}function Qn(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function to(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function eo(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function io(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===bt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function so(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function no(t){return(e,i)=>{Ln(e,"__DataProcessor",{get:()=>t})}}function oo(t){return(e,i)=>{Ln(e,"__LayoutProcessor",{get:()=>t})}}function ro(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[n];return void 0===t?i:t},set(t){this[n]=t}};if(void 0===i)r.get=function(){return this[n]};else if("function"==typeof i)r.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Vt(i);r.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:Ft.clone(i):e}}const a=t.isBranchLeaf;"width"===e?r.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:a&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(r.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:a&&s.children.length?s.boxBounds.height:i}return t});let h,l=s;for(;!h&&l;)h=On(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[o]&&(r.set=s[o],delete s[o]),Ln(s,e,r)}const ao=new bt("rewrite"),ho=[],lo=["destroy","constructor"];function co(t){return(e,i)=>{ho.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function uo(){return t=>{_o()}}function _o(t){ho.length&&(ho.forEach((e=>{t&&ao.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ho.length=0)}function po(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(lo.includes(s)||e&&e.includes(s)))if(t.prototype){On(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function go(){return t=>{Pt.register(t)}}function fo(){return t=>{Dt.register(t)}}setTimeout((()=>_o(!0)));const{copy:yo,toInnerPoint:mo,toOuterPoint:vo,scaleOfOuter:wo,rotateOfOuter:xo,skewOfOuter:bo,multiplyParent:ko,divideParent:Eo,getLayout:Bo}=x,Ro={},{round:So}=Math,Co={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),To(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Oo(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++)Po(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Po(t),t.__updateChange()},updateAllChange(t){if(Mo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Ao(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,n){const o="object"==typeof e?Object.assign({},e):{x:e,y:i};s?vo(t.localTransform,o,o,!0):t.parent&&mo(t.parent.worldTransform,o,o,!0),Lo.moveLocal(t,o.x,o.y,n)},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=So(e),i=So(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){Lo.zoomOfLocal(t,Do(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if("number"!=typeof s&&(s&&(o=s),s=i),yo(Ro,r),wo(Ro,e,i,s),t.origin||t.around)Lo.setTransform(t,Ro,n,o);else{const e=t.x+Ro.e-r.e,a=t.y+Ro.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Lo.rotateOfLocal(t,Do(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;yo(Ro,n),xo(Ro,e,i),t.origin||t.around?Lo.setTransform(t,Ro,!1,s):t.set({x:t.x+Ro.e-n.e,y:t.y+Ro.f-n.f,rotation:r.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Lo.skewOfLocal(t,Do(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){yo(Ro,t.__localMatrix),bo(Ro,e,i,s),Lo.setTransform(t,Ro,n,o)},transformWorld(t,e,i,s){yo(Ro,t.worldTransform),ko(Ro,e),t.parent&&Eo(Ro,t.parent.worldTransform),Lo.setTransform(t,Ro,i,s)},transform(t,e,i,s){yo(Ro,t.localTransform),ko(Ro,e),Lo.setTransform(t,Ro,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Lo.getInnerOrigin(t,n.origin),r=Bo(e,o,n.around&&Lo.getInnerOrigin(t,n.around));if(i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){_t.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Lo.getInnerOrigin(t,n.origin);A.move(r,o.x-s.x,o.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 wo(i,Lo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>A.tempToOuterOf(Lo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return G.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(yo(Ro,t.worldTransform),Eo(Ro,e.worldTransform),i?Ro:Object.assign({},Ro)),drop(t,e,i,s){t.setTransform(Lo.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}}},Lo=Co,{updateAllMatrix:Oo,updateMatrix:To,updateAllWorldOpacity:Po,updateAllChange:Ao,updateChange:Mo}=Lo;function Do(t,e){return t.__layout.update(),t.parent?A.tempToInnerOf(e,t.parent.__world):e}const Io={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:Wo}=Co,Fo={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),zo(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++)No(e[t],e)},updateBounds(t,e){const i=[t];No(t,i),Yo(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++)Wo(s[t]);e&&e===i||Wo(i)}}},{pushAllChildBranch:zo,pushAllBranchStack:No,updateBoundsByBranchStack:Yo}=Fo,Ho={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:Xo,updateBounds:Vo}=Co,{toOuterOf:jo,getPoints:Uo,copy:Go}=_t,Zo="_localContentBounds",Ko="_worldContentBounds",qo="_worldBoxBounds",Jo="_worldStrokeBounds";class $o{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 jo(this.contentBounds,this.leaf.__localMatrix,this[Zo]||(this[Zo]={})),this[Zo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return jo(this.contentBounds,this.leaf.__world,this[Ko]||(this[Ko]={})),this[Ko]}get worldBoxBounds(){return jo(this.boxBounds,this.leaf.__world,this[qo]||(this[qo]={})),this[qo]}get worldStrokeBounds(){return jo(this.strokeBounds,this.leaf.__world,this[Jo]||(this[Jo]={})),this[Jo]}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 Vo(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 Xo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new yt(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,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=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},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=x.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Xo(s,e,!0)}if(r||(r=x.getLayout(o)),Go(r,a),A.copy(r,n),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=Uo(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 void 0!==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 Qo{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 tr extends Qo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}tr.ADD="child.add",tr.REMOVE="child.remove",tr.CREATED="created",tr.MOUNTED="mounted",tr.UNMOUNTED="unmounted",tr.DESTROY="destroy";class er extends Qo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}er.CHANGE="property.change",er.LEAFER_CHANGE="property.leafer_change";class ir extends Qo{constructor(t,e){super(t),Object.assign(this,e)}}ir.LOAD="image.load",ir.LOADED="image.loaded",ir.ERROR="image.error";class sr extends Qo{static checkHas(t,e,i){"on"===i?e===ar?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(nr)||t.hasEvent(or)||t.hasEvent(rr),t.__hasWorldEvent=t.hasEvent(ar))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(nr,t),"inner"===e&&t.emit(or,t)),t.emit(rr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(ar,this)}}sr.RESIZE="bounds.resize",sr.INNER="bounds.inner",sr.LOCAL="bounds.local",sr.WORLD="bounds.world";const{RESIZE:nr,INNER:or,LOCAL:rr,WORLD:ar}=sr,hr={};[nr,or,rr,ar].forEach((t=>hr[t]=1));class lr extends Qo{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(lr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}lr.RESIZE="resize";class dr extends Qo{constructor(t,e){super(t),this.data=e}}dr.REQUEST="watch.request",dr.DATA="watch.data";class cr extends Qo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}cr.REQUEST="layout.request",cr.START="layout.start",cr.BEFORE="layout.before",cr.LAYOUT="layout",cr.AFTER="layout.after",cr.AGAIN="layout.again",cr.END="layout.end";class ur extends Qo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ur.REQUEST="render.request",ur.CHILD_START="render.child_start",ur.CHILD_END="render.child_end",ur.START="render.start",ur.BEFORE="render.before",ur.RENDER="render",ur.AFTER="render.after",ur.AGAIN="render.again",ur.END="render.end",ur.NEXT="render.next";class _r extends Qo{}_r.START="leafer.start",_r.BEFORE_READY="leafer.before_ready",_r.READY="leafer.ready",_r.AFTER_READY="leafer.after_ready",_r.VIEW_READY="leafer.view_ready",_r.VIEW_COMPLETED="leafer.view_completed",_r.STOP="leafer.stop",_r.RESTART="leafer.restart",_r.END="leafer.end";const pr={};class gr{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,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=fr(this,s,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(o=r[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):r[t]=[h],hr[t]&&sr.checkHas(this,t,"on"))}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=fr(this,t);s.forEach((t=>{t&&(n=r[t],n&&(o=n.findIndex((t=>t.listener===e)),o>-1&&n.splice(o,1),n.length||delete r[t],hr[t]&&sr.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&&Dt.has(t)&&(e=Dt.get(t,{type:t,target:this,current:this}));const s=fr(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}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!!(void 0===e?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function fr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:pr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:pr)}}const{on:yr,on_:mr,off:vr,off_:wr,once:xr,emit:br,emitEvent:kr,hasEvent:Er,destroy:Br}=gr.prototype,Rr={on:yr,on_:mr,off:vr,off_:wr,once:xr,emit:br,emitEvent:kr,hasEvent:Er,destroyEventer:Br},{isFinite:Sr}=Number,Cr=bt.get("setAttr"),Lr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!Sr(e)&&void 0!==e&&(Cr.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=er,n=new er(i,this,t,s,e);return this.isLeafer?this.emitEvent(new er(er.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(n),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||void 0===i.normalStyle[t]||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Or,multiplyParent:Tr,translateInner:Pr,defaultWorld:Ar}=x,{toPoint:Mr,tempPoint:Dr}=G,Ir={__updateWorldMatrix(){Tr(this.__local||this.__layout,this.parent?this.parent.__world:Ar,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)&&(Or(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)&&(Mr(i.around||i.origin,t.boxBounds,Dr),Pr(e,-Dr.x,-Dr.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Wr,updateAllMatrix:Fr}=Co,{updateBounds:zr}=Fo,{toOuterOf:Nr,copyAndSpread:Yr,copy:Hr}=_t,{toBounds:Xr}=on,Vr={__updateWorldBounds(){const t=this.__layout;Nr(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&sr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&sr.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(),Nr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Nr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Nr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Xr(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(),Fr(this),zr(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Fr(this),zr(this,this))):Wr(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Yr(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Yr(t.renderBounds,t.boxBounds,t.renderSpread):Hr(t.renderBounds,t.strokeBounds)}},jr={__render(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);bt.showBounds&&bt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ur}=Io,Gr={__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 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++)Ur(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++)Ur(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Zr,create:Kr}=e,{toInnerPoint:qr,toOuterPoint:Jr,multiplyParent:$r}=x,{toOuterOf:Qr}=_t,{copy:ta,move:ea}=A,{moveLocal:ia,zoomOfLocal:sa,rotateOfLocal:na,skewOfLocal:oa,moveWorld:ra,zoomOfWorld:aa,rotateOfWorld:ha,skewOfWorld:la,transform:da,transformWorld:ca,setTransform:ua,getFlipTransform:_a,getLocalOrigin:pa,getRelativeWorld:ga,drop:fa}=Co;let ya=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 Nt}get __LayoutProcessor(){return $o}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=Kr(Zr),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(tr.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(tr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(tr.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(tr.MOUNTED)):this.__emitLifeEvent(tr.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 $r(i,t.matrix,e,void 0,i),Qr(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?ga(this,e):this.worldTransform,n=i?t:{};return Qr(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ta(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ta(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),qr(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Jr(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:o,y:r}=this.boxBounds;return ea(n,-o,-r),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:o,y:r}=this.boxBounds;return ea(n,o,r),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){ua(this,t,e,i)}transform(t,e,i){da(this,t,e,i)}move(t,e,i){ia(this,t,e,i)}moveInner(t,e,i){ra(this,t,e,!0,i)}scaleOf(t,e,i,s,n){sa(this,pa(this,t),e,i,s,n)}rotateOf(t,e,i){na(this,pa(this,t),e,i)}skewOf(t,e,i,s,n){oa(this,pa(this,t),e,i,s,n)}transformWorld(t,e,i){ca(this,t,e,i)}moveWorld(t,e,i){ra(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){aa(this,t,e,i,s,n)}rotateOfWorld(t,e){ha(this,t,e)}skewOfWorld(t,e,i,s,n){la(this,t,e,i,s,n)}flip(t,e){da(this,_a(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,i,s){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Lt.need("path")}getMotionPoint(t){return Lt.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){fa(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):ro(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=zn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new tr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(tr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ya=jt([po(Lr),po(Ir),po(Vr),po(Rr),po(jr)],ya);const{setListWithFn:ma}=_t,{sort:va}=Fo,{localBoxBounds:wa,localStrokeBounds:xa,localRenderBounds:ba,maskLocalBoxBounds:ka,maskLocalStrokeBounds:Ea,maskLocalRenderBounds:Ba}=Io,Ra=new bt("Branch");let Sa=class extends ya{__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(){ma(this.__layout.boxBounds,this.children,this.__hasMask?ka:wa)}__updateStrokeBounds(){ma(this.__layout.strokeBounds,this.children,this.__hasMask?Ea:xa)}__updateRenderBounds(){ma(this.__layout.renderBounds,this.children,this.__hasMask?Ba:ba)}__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(va),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ra.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=Pt.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(tr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(tr.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(tr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(tr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new tr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Sa=jt([po(Gr)],Sa);class Ca{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,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++)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 Ca;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 La{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 Oa="1.6.3";class Ta extends se{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}}gn(OffscreenCanvasRenderingContext2D.prototype),gn(Path2D.prototype);const{mineType:Pa}=fn;function Aa(e,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,n)=>{t.convertToBlob({type:Pa(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:Pa(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=Ot.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(Ot,{canvas:(t,e)=>new Ta(t,e),image:t=>new Cn(t)}),t.name="web",t.isWorker=!0,t.backgrounder=!0,t.requestRender=function(t){requestAnimationFrame(t)},Ln(t,"devicePixelRatio",{get:()=>1});const{userAgent:Ma}=navigator;Ma.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):Ma.indexOf("Safari")>-1&&-1===Ma.indexOf("Chrome")&&(t.fullImageShadow=!0),Ma.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):Ma.indexOf("Mac")>-1?t.os="Mac":Ma.indexOf("Linux")>-1&&(t.os="Linux");class Da{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ca;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 Ca,this.target=t,e&&(this.config=Ft.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(ur.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===tr.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 dr(dr.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ca,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[er.CHANGE,this.__onAttrChange,this],[[tr.ADD,tr.REMOVE],this.__onChildEvent,this],[dr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ia,updateBounds:Wa,updateChange:Fa}=Co,{pushAllChildBranch:za,pushAllParent:Na}=Fo;const{worldBounds:Ya}=Io;class Ha{constructor(t){this.updatedBounds=new yt,this.beforeBounds=new yt,this.afterBounds=new yt,t instanceof Array&&(t=new Ca(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ya)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ya),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:Xa,updateAllChange:Va}=Co,ja=bt.get("Layouter");class Ua{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new La,this.target=t,e&&(this.config=Ft.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(cr.START),this.layoutOnce(),t.emitEvent(new cr(cr.END,this.layoutedBlocks,this.times))}catch(t){ja.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ja.warn("layouting"):this.times>3?ja.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(dr.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=Rt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=cr,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new cr(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?(Ia(t,!0),e.add(t),t.isBranch&&za(t,e),Na(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Na(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||Wa(s[t])}Wa(i)}}))}(this.__levelList),function(t){t.list.forEach(Fa)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new cr(o,a,this.times)),i.emitEvent(new cr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Rt.end(e)}fullLayout(){const t=Rt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=cr,o=this.getBlocks(new Ca(e));e.emitEvent(new cr(i,o,this.times)),Ua.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new cr(s,o,this.times)),e.emitEvent(new cr(n,o,this.times)),this.addBlocks(o),Rt.end(t)}static fullLayout(t){Xa(t,!0),t.isBranch?Fo.updateBounds(t):Co.updateBounds(t),Va(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ha([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ha(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_([[cr.REQUEST,this.layout,this],[cr.AGAIN,this.layoutAgain,this],[dr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ga=bt.get("Renderer");class Za{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=Ft.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(cr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ur.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(ur.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ur.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new yt,Ga.log(e.innerName,"---\x3e");try{this.emitRender(ur.START),this.renderOnce(t),this.emitRender(ur.END,this.totalBounds),En.clearRecycled()}catch(t){this.rendering=!1,Ga.error(t)}Ga.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ga.warn("rendering");if(this.times>3)return Ga.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new yt,this.renderOptions={},t)this.emitRender(ur.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ur.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ur.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ur.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=Rt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new yt(s);i.save(),s.spread(Za.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Rt.end(e)}fullRender(){const t=Rt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Rt.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),bt.showRepaint&&bt.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 yt;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 yt(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 yt(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||Ga.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 ur(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ur.REQUEST,this.update,this],[cr.END,this.__onLayoutEnd,this],[ur.AGAIN,this.renderAgain,this],[lr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Za.clipSpread=10;const{hitRadiusPoint:Ka}=_t;class qa{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,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ca(i.findList),i.findList||this.hitBranch(o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n),h=n?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 Ca;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||Co.worldHittable(e))&&(this.hitChild(e,o),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 Ca;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 Ca;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 Ca,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Ka(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&&!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 Ja{constructor(t,e){this.config={},e&&(this.config=Ft.default(e,this.config)),this.picker=new qa(this.target=t,this),this.finder=Ot.finder&&Ot.finder()}getByPoint(e,i,s){const{target:n,picker:o}=this;return t.backgrounder&&n&&n.updateLayout(),o.getByPoint(e,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Lt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function $a(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Qa(t){return Tn(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function th(){return(t,e)=>{const i="_"+e;Ln(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(Ot,{watcher:(t,e)=>new Da(t,e),layouter:(t,e)=>new Ua(t,e),renderer:(t,e,i)=>new Za(t,e,i),selector:(t,e)=>new Ja(t,e)}),t.layout=Ua.fullLayout;const eh={},ih={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}},sh={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},nh={},oh={},rh={},ah={},hh={},lh={apply(){Lt.need("filter")}},dh={},ch={setStyleName:()=>Lt.need("state"),set:()=>Lt.need("state")},uh={list:{},register(t,e){uh.list[t]=e},get:t=>uh.list[t]},{parse:_h,objectToCanvasData:ph}=Bi,{stintSet:gh}=Ft,{hasTransparent:fh}=ih,yh={},mh=bt.get("UIData");class vh extends Nt{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,mh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,mh.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):(gh(this,"__isTransparentFill",fh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(gh(this,"__isTransparentStroke",fh(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?_h(t):ph(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){wh(this,"shadow",t)}setInnerShadow(t){wh(this,"innerShadow",t)}setFilter(t){wh(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=yh)):(this.__isStrokes=!0,this._stroke||(this._stroke=yh))}__removePaint(t,e){e&&this.__removeInput(t),rh.recycleImage(t,this),"fill"===t?(gh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(gh(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function wh(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 xh extends vh{}class bh extends xh{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 kh extends xh{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class Eh extends bh{}class Bh extends vh{}class Rh extends vh{get __boxStroke(){return!this.__pathInputed}}class Sh extends vh{get __boxStroke(){return!this.__pathInputed}}class Ch extends vh{}class Lh extends vh{}class Oh extends vh{get __pathInputed(){return 2}}class Th extends xh{}const Ph={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ah extends vh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=Ph[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=Pt.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange(),o.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Mh extends Rh{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 Dh extends Rh{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 Ih={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:n}=i,o=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),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter: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)),o&&(t+=lh.getSpread(o));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))),n&&(r=Math.max(r,n)),this.__layout.renderShapeSpread=r,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:Wh}=Ft,Fh={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wh(t,"__isFastShadow",e&&!n&&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&&!n)}Wh(this.__world,"half",t.__hasHalf),Wh(t,"__fillAfterStroke",t.stroke&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill),t.__checkSingle(),Wh(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){zh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__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&&hh.shadow(this,t,h),a&&(s.__isStrokes?oh.strokes(o,this,t):oh.stroke(o,this,t)),n&&(s.__isFills?oh.fills(n,this,t):oh.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&hh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?oh.strokes(o,this,t):oh.stroke(o,this,t)),c&&lh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?oh.strokes(o,this,t):oh.stroke(o,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,ih.string(e.color))}n&&(s.__isFills?oh.fills(n,this,t):oh.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?oh.strokes(o,this,t):oh.stroke(o,this,t))}}else s.__pathInputed?zh(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,i,s){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:n,stroke:o}=this.__;this.__drawRenderPath(t),n&&!i&&(this.__.__isAlphaPixelFill?oh.fills(n,this,t):oh.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),o&&!s&&(this.__.__isAlphaPixelStroke?oh.strokes(o,this,t):oh.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),this.windingRule?t.clip(this.windingRule):t.clip(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function zh(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&oh.stroke(n,t,e),s&&oh.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&oh.stroke(n,t,e)}const Nh={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),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,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var Yh;let Hh=Yh=class extends ya{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 _n.set(this.path=t||[]),t||this.__drawPathByBox(_n),_n}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 Lt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Lt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(_n.set(i=[]),this.__drawPathByBox(_n)),t?Bi.toCanvasData(i,!0):i}getPathString(t,e,i){return Bi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||dh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?un.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&nh.addArrows(this,!t.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Rs.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:o}=this.__;t.roundRect(e,i,s,n,"number"==typeof o?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){oh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Lt.need("animate")}killAnimate(t,e){}export(t,e){return Lt.need("export")}syncExport(t,e){return Lt.need("export")}clone(t){const e=Ft.clone(this.toJSON());return t&&Object.assign(e,t),Yh.one(e)}static one(t,e,i,s,n){return Pt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){go()(this)}static registerData(t){no(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};jt([no(vh)],Hh.prototype,"__",void 0),jt([th()],Hh.prototype,"zoomLayer",void 0),jt([Mn("")],Hh.prototype,"id",void 0),jt([Mn("")],Hh.prototype,"name",void 0),jt([Mn("")],Hh.prototype,"className",void 0),jt([Zn("pass-through")],Hh.prototype,"blendMode",void 0),jt([Kn(1)],Hh.prototype,"opacity",void 0),jt([qn(!0)],Hh.prototype,"visible",void 0),jt([Zn(!1)],Hh.prototype,"locked",void 0),jt([Zn(!1)],Hh.prototype,"dim",void 0),jt([Zn(!1)],Hh.prototype,"dimskip",void 0),jt([Qn(0)],Hh.prototype,"zIndex",void 0),jt([to(!1)],Hh.prototype,"mask",void 0),jt([eo(!1)],Hh.prototype,"eraser",void 0),jt([Dn(0,!0)],Hh.prototype,"x",void 0),jt([Dn(0,!0)],Hh.prototype,"y",void 0),jt([zn(100,!0)],Hh.prototype,"width",void 0),jt([zn(100,!0)],Hh.prototype,"height",void 0),jt([Wn(1,!0)],Hh.prototype,"scaleX",void 0),jt([Wn(1,!0)],Hh.prototype,"scaleY",void 0),jt([Fn(0,!0)],Hh.prototype,"rotation",void 0),jt([Fn(0,!0)],Hh.prototype,"skewX",void 0),jt([Fn(0,!0)],Hh.prototype,"skewY",void 0),jt([Dn(0,!0)],Hh.prototype,"offsetX",void 0),jt([Dn(0,!0)],Hh.prototype,"offsetY",void 0),jt([Dn(0,!0)],Hh.prototype,"scrollX",void 0),jt([Dn(0,!0)],Hh.prototype,"scrollY",void 0),jt([In()],Hh.prototype,"origin",void 0),jt([In()],Hh.prototype,"around",void 0),jt([Mn(!1)],Hh.prototype,"lazy",void 0),jt([Nn(1)],Hh.prototype,"pixelRatio",void 0),jt([Hn()],Hh.prototype,"path",void 0),jt([Xn()],Hh.prototype,"windingRule",void 0),jt([Xn(!0)],Hh.prototype,"closed",void 0),jt([zn(0)],Hh.prototype,"padding",void 0),jt([zn(!1)],Hh.prototype,"lockRatio",void 0),jt([zn()],Hh.prototype,"widthRange",void 0),jt([zn()],Hh.prototype,"heightRange",void 0),jt([Mn(!1)],Hh.prototype,"draggable",void 0),jt([Mn()],Hh.prototype,"dragBounds",void 0),jt([Mn(!1)],Hh.prototype,"editable",void 0),jt([io(!0)],Hh.prototype,"hittable",void 0),jt([io("path")],Hh.prototype,"hitFill",void 0),jt([Un("path")],Hh.prototype,"hitStroke",void 0),jt([io(!1)],Hh.prototype,"hitBox",void 0),jt([io(!0)],Hh.prototype,"hitChildren",void 0),jt([io(!0)],Hh.prototype,"hitSelf",void 0),jt([io()],Hh.prototype,"hitRadius",void 0),jt([so("")],Hh.prototype,"cursor",void 0),jt([Zn()],Hh.prototype,"fill",void 0),jt([Un()],Hh.prototype,"stroke",void 0),jt([Un("inside")],Hh.prototype,"strokeAlign",void 0),jt([Un(1)],Hh.prototype,"strokeWidth",void 0),jt([Un(!1)],Hh.prototype,"strokeWidthFixed",void 0),jt([Un("none")],Hh.prototype,"strokeCap",void 0),jt([Un("miter")],Hh.prototype,"strokeJoin",void 0),jt([Un()],Hh.prototype,"dashPattern",void 0),jt([Un(0)],Hh.prototype,"dashOffset",void 0),jt([Un(10)],Hh.prototype,"miterLimit",void 0),jt([Xn(0)],Hh.prototype,"cornerRadius",void 0),jt([Xn()],Hh.prototype,"cornerSmoothing",void 0),jt([$a()],Hh.prototype,"shadow",void 0),jt([$a()],Hh.prototype,"innerShadow",void 0),jt([$a()],Hh.prototype,"blur",void 0),jt([$a()],Hh.prototype,"backgroundBlur",void 0),jt([$a()],Hh.prototype,"grayscale",void 0),jt([$a()],Hh.prototype,"filter",void 0),jt([Zn()],Hh.prototype,"placeholderColor",void 0),jt([Mn(100)],Hh.prototype,"placeholderDelay",void 0),jt([Mn({})],Hh.prototype,"data",void 0),jt([co(ya.prototype.reset)],Hh.prototype,"reset",null),Hh=Yh=jt([po(Ih),po(Fh),uo()],Hh);let Xh=class extends Hh{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 Vh;jt([no(xh)],Xh.prototype,"__",void 0),jt([zn(0)],Xh.prototype,"width",void 0),jt([zn(0)],Xh.prototype,"height",void 0),Xh=jt([po(Sa),go()],Xh);const jh=bt.get("Leafer");let Uh=Vh=class extends Xh{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&bn.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),Vh.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,Ft.assign(s,t));const n=this.canvas=Ot.canvas(s);this.__controllers.push(this.renderer=Ot.renderer(this,n,s),this.watcher=Ot.watcher(this,s),this.layouter=Ot.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=n.view,e||(this.selector=Ot.selector(this),this.interaction=Ot.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Ot.hitCanvasManager()),this.canvasManager=new Wt,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))),Ho.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(_r.RESTART):this.emitLeafer(_r.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(_r.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=Ft.copyAttrs({},t,ie);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new yt(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=Ft.copyAttrs({},this.canvas,ie);e.resize(t),this.updateLazyBounds(),this.__onResize(new lr(t,i))}__onResize(t){this.emitEvent(t),Ft.copyAttrs(this.__,t,ie),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 vt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ie.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&&ie.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=Ft.copyAttrs({},this.canvas,ie);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(_r.BEFORE_READY),this.emitLeafer(_r.READY),this.emitLeafer(_r.AFTER_READY),Ho.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(_r.VIEW_READY),Ho.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ho.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(_r.VIEW_COMPLETED),Ho.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 Lt.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 _r(t,this))}__listenEvents(){const t=Rt.start("FirstCreate "+this.innerName);this.once([[_r.START,()=>Rt.end(t)],[cr.START,this.updateLazyBounds,this],[ur.START,this.__onCreated,this],[ur.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[dr.DATA,this.__onWatchData,this],[cr.END,this.__onLayoutEnd,this],[ur.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Vh.list.remove(this);try{this.stop(),this.emitEvent(new _r(_r.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{En.clearRecycled()}),100)}catch(t){jh.error(t)}}};t?e():setTimeout(e)}};Uh.list=new Ca,jt([no(kh)],Uh.prototype,"__",void 0),jt([zn()],Uh.prototype,"pixelRatio",void 0),Uh=Vh=jt([go()],Uh);let Gh=class extends Hh{get __tag(){return"Rect"}constructor(t){super(t)}};jt([no(Rh)],Gh.prototype,"__",void 0),Gh=jt([po(Nh),uo(),go()],Gh);const{copy:Zh,add:Kh,includes:qh}=_t,Jh=Gh.prototype,$h=Xh.prototype,Qh={};let tl=class extends Xh{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(),Zh(Qh,e),this.__updateRectRenderBounds(),t=!qh(e,Qh),t&&"hide"!==this.__.overflow&&Kh(e,Qh)):this.__updateRectRenderBounds(),Ft.stintSet(this,"isOverflow",t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};jt([no(bh)],tl.prototype,"__",void 0),jt([zn(100)],tl.prototype,"width",void 0),jt([zn(100)],tl.prototype,"height",void 0),jt([Mn(!1)],tl.prototype,"resizeChildren",void 0),jt([Gn("show")],tl.prototype,"overflow",void 0),jt([co(Jh.__updateStrokeSpread)],tl.prototype,"__updateStrokeSpread",null),jt([co(Jh.__updateRenderSpread)],tl.prototype,"__updateRectRenderSpread",null),jt([co(Jh.__updateBoxBounds)],tl.prototype,"__updateRectBoxBounds",null),jt([co(Jh.__updateStrokeBounds)],tl.prototype,"__updateStrokeBounds",null),jt([co(Jh.__updateRenderBounds)],tl.prototype,"__updateRectRenderBounds",null),jt([co(Jh.__updateChange)],tl.prototype,"__updateRectChange",null),jt([co(Jh.__render)],tl.prototype,"__renderRect",null),jt([co($h.__render)],tl.prototype,"__renderGroup",null),tl=jt([uo(),go()],tl);let el=class extends tl{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};jt([no(Eh)],el.prototype,"__",void 0),jt([Zn("#FFFFFF")],el.prototype,"fill",void 0),jt([Gn("hide")],el.prototype,"overflow",void 0),el=jt([go()],el);const{moveTo:il,closePath:sl,ellipse:nl}=Zi;let ol=class extends Hh{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&nl(h,r,a,r*s,a*s,0,n,o,!1),nl(h,r,a,r,a,0,o,n,!0),s<1&&sl(h)):(s<1&&(nl(h,r,a,r*s,a*s),il(h,e,a)),nl(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(il(h,r,a),nl(h,r,a,r,a,0,n,o,!1),sl(h)):nl(h,r,a,r,a)}};jt([no(Sh)],ol.prototype,"__",void 0),jt([Xn(0)],ol.prototype,"innerRadius",void 0),jt([Xn(0)],ol.prototype,"startAngle",void 0),jt([Xn(0)],ol.prototype,"endAngle",void 0),ol=jt([go()],ol);const{moveTo:rl,lineTo:al,drawPoints:hl}=Zi,{rotate:ll,getAngle:dl,getDistance:cl,defaultPoint:ul}=A,{toBounds:_l}=on;let pl=class extends Hh{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&ll(i,e),i}set toPoint(t){this.width=cl(ul,t),this.rotation=dl(ul,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?hl(e,t.points,!1,t.closed):(rl(e,0,0),al(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(hl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&nh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?_l(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};jt([no(Bh)],pl.prototype,"__",void 0),jt([Vn("center")],pl.prototype,"strokeAlign",void 0),jt([zn(0)],pl.prototype,"height",void 0),jt([Xn()],pl.prototype,"points",void 0),jt([Xn(0)],pl.prototype,"curve",void 0),jt([Xn(!1)],pl.prototype,"closed",void 0),pl=jt([go()],pl);const{sin:gl,cos:fl,PI:yl}=Math,{moveTo:ml,lineTo:vl,closePath:wl,drawPoints:xl}=Zi,bl=pl.prototype;let kl=class extends Hh{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)xl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,o=i/2;ml(t,n,0);for(let e=1;e<s;e++)vl(t,n+n*gl(2*e*yl/s),o-o*fl(2*e*yl/s))}wl(t)}__updateRenderPath(){}__updateBoxBounds(){}};jt([no(Ch)],kl.prototype,"__",void 0),jt([Xn(3)],kl.prototype,"sides",void 0),jt([Xn()],kl.prototype,"points",void 0),jt([Xn(0)],kl.prototype,"curve",void 0),jt([co(bl.__updateRenderPath)],kl.prototype,"__updateRenderPath",null),jt([co(bl.__updateBoxBounds)],kl.prototype,"__updateBoxBounds",null),kl=jt([uo(),go()],kl);const{sin:El,cos:Bl,PI:Rl}=Math,{moveTo:Sl,lineTo:Cl,closePath:Ll}=Zi;let Ol=class extends Hh{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Sl(r,n,0);for(let t=1;t<2*i;t++)Cl(r,n+(t%2==0?n:n*s)*El(t*Rl/i),o-(t%2==0?o:o*s)*Bl(t*Rl/i));Ll(r)}};jt([no(Lh)],Ol.prototype,"__",void 0),jt([Xn(5)],Ol.prototype,"corners",void 0),jt([Xn(.382)],Ol.prototype,"innerRadius",void 0),Ol=jt([go()],Ol);let Tl=class extends Gh{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)}};jt([no(Mh)],Tl.prototype,"__",void 0),jt([zn("")],Tl.prototype,"url",void 0),Tl=jt([go()],Tl);const Pl=Tl;let Al=class extends Gh{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Ot.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Cn({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ir(ir.LOADED,{image:t}))}))}draw(t,e,i,s){const n=new N(t.worldTransform).invert(),o=new N;e&&o.translate(e.x,e.y),i&&("number"==typeof i?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),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()}};jt([no(Dh)],Al.prototype,"__",void 0),jt([Qa(100)],Al.prototype,"width",void 0),jt([Qa(100)],Al.prototype,"height",void 0),jt([Qa(1)],Al.prototype,"pixelRatio",void 0),jt([Qa(!0)],Al.prototype,"smooth",void 0),jt([Mn(!1)],Al.prototype,"safeResize",void 0),jt([Qa()],Al.prototype,"contextSettings",void 0),Al=jt([go()],Al);const{copyAndSpread:Ml,includes:Dl,spread:Il,setList:Wl}=_t;let Fl=class extends Hh{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:o,italic:a,textCase:h,textOverflow:l,padding:d}=t;t.__lineHeight=sh.number(e,n),t.__letterSpacing=sh.number(i,n),t.__padding=d?r.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==o?o+" ":""}${n}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=eh.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:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Il(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),Ft.stintSet(this,"isOverflow",!Dl(h,a)),this.isOverflow?(Wl(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;Ml(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&&!dh.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};jt([no(Ah)],Fl.prototype,"__",void 0),jt([zn(0)],Fl.prototype,"width",void 0),jt([zn(0)],Fl.prototype,"height",void 0),jt([Zn()],Fl.prototype,"boxStyle",void 0),jt([Mn(!1)],Fl.prototype,"resizeFontSize",void 0),jt([Zn("#000000")],Fl.prototype,"fill",void 0),jt([Vn("outside")],Fl.prototype,"strokeAlign",void 0),jt([io("all")],Fl.prototype,"hitFill",void 0),jt([zn("")],Fl.prototype,"text",void 0),jt([zn("")],Fl.prototype,"placeholder",void 0),jt([zn("caption")],Fl.prototype,"fontFamily",void 0),jt([zn(12)],Fl.prototype,"fontSize",void 0),jt([zn("normal")],Fl.prototype,"fontWeight",void 0),jt([zn(!1)],Fl.prototype,"italic",void 0),jt([zn("none")],Fl.prototype,"textCase",void 0),jt([zn("none")],Fl.prototype,"textDecoration",void 0),jt([zn(0)],Fl.prototype,"letterSpacing",void 0),jt([zn({type:"percent",value:1.5})],Fl.prototype,"lineHeight",void 0),jt([zn(0)],Fl.prototype,"paraIndent",void 0),jt([zn(0)],Fl.prototype,"paraSpacing",void 0),jt([zn("x")],Fl.prototype,"writingMode",void 0),jt([zn("left")],Fl.prototype,"textAlign",void 0),jt([zn("top")],Fl.prototype,"verticalAlign",void 0),jt([zn(!0)],Fl.prototype,"autoSizeAlign",void 0),jt([zn("normal")],Fl.prototype,"textWrap",void 0),jt([zn("show")],Fl.prototype,"textOverflow",void 0),Fl=jt([go()],Fl);let zl=class extends Hh{get __tag(){return"Path"}constructor(t){super(t)}};jt([no(Oh)],zl.prototype,"__",void 0),jt([Vn("center")],zl.prototype,"strokeAlign",void 0),zl=jt([go()],zl);let Nl=class extends Xh{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new zl(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,o){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,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};jt([no(Th)],Nl.prototype,"__",void 0),jt([(t,e)=>{Ln(t,e,{get(){return this.__path}})}],Nl.prototype,"path",void 0),Nl=jt([po(cs,["set","path","paint"]),go()],Nl);let Yl=class extends Uh{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&&Ot.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 Uh(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&&Ft.assign(e,t),this.autoLayout&&Ft.copyAttrs(e,this,ie),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[cr.END,this.__onReady,this],[ur.START,this.__onCreated,this],[ur.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ur.END,this.__onChildRenderEnd,this))}};Yl=jt([go()],Yl);const Hl={},Xl={isHoldSpaceKey:()=>Xl.isHold("Space"),isHold:t=>Hl[t],setDownCode(t){Hl[t]||(Hl[t]=!0)},setUpCode(t){Hl[t]=!1}},Vl={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 jl extends Qo{get spaceKey(){return Xl.isHoldSpaceKey()}get left(){return Vl.left(this)}get right(){return Vl.right(this)}get middle(){return Vl.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){Dt.changeName(t,e)}}let Ul=class extends jl{};Ul.POINTER="pointer",Ul.BEFORE_DOWN="pointer.before_down",Ul.BEFORE_MOVE="pointer.before_move",Ul.BEFORE_UP="pointer.before_up",Ul.DOWN="pointer.down",Ul.MOVE="pointer.move",Ul.UP="pointer.up",Ul.OVER="pointer.over",Ul.OUT="pointer.out",Ul.ENTER="pointer.enter",Ul.LEAVE="pointer.leave",Ul.TAP="tap",Ul.DOUBLE_TAP="double_tap",Ul.CLICK="click",Ul.DOUBLE_CLICK="double_click",Ul.LONG_PRESS="long_press",Ul.LONG_TAP="long_tap",Ul.MENU="pointer.menu",Ul.MENU_TAP="pointer.menu_tap",Ul=jt([fo()],Ul);const Gl=Ul,Zl={};let Kl=class extends Ul{static setList(t){this.list=t instanceof Ca?t:new Ca(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:n}=t,o=t.getLocalPoint(i,null,!0);return A.move(o,e.x-t.x,e.y-t.y),n&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===n?t.parent.boxBounds:n,o,!0),"x"===s&&(o.y=0),"y"===s&&(o.x=0),o}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,o=t.y+i.y,r=n+t.width,a=o+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),_t.includes(t,e)?(n>e.x?i.x+=e.x-n:r<h&&(i.x+=h-r),o>e.y?i.y+=e.y-o:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:r>h&&(i.x+=h-r),o<e.y?i.y+=e.y-o:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Zl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Zl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Zl,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 _t.set(i,e.x-t.x,e.y-t.y,t.x,t.y),_t.unsign(i),i}assignMove(t){Zl.x=t?this.totalX:this.moveX,Zl.y=t?this.totalY:this.moveY}};Kl.BEFORE_DRAG="drag.before_drag",Kl.START="drag.start",Kl.DRAG="drag",Kl.END="drag.end",Kl.OVER="drag.over",Kl.OUT="drag.out",Kl.ENTER="drag.enter",Kl.LEAVE="drag.leave",Kl=jt([fo()],Kl);const ql=Kl;let Jl=class extends Ul{static setList(t){Kl.setList(t)}static setData(t){Kl.setData(t)}};Jl.DROP="drop",Jl=jt([fo()],Jl);let $l=class extends Kl{};$l.BEFORE_MOVE="move.before_move",$l.START="move.start",$l.MOVE="move",$l.END="move.end",$l=jt([fo()],$l);let Ql=class extends Ul{};Ql.BEFORE_ROTATE="rotate.before_rotate",Ql.START="rotate.start",Ql.ROTATE="rotate",Ql.END="rotate.end",Ql=jt([fo()],Ql);let td=class extends Kl{};td.SWIPE="swipe",td.LEFT="swipe.left",td.RIGHT="swipe.right",td.UP="swipe.up",td.DOWN="swipe.down",td=jt([fo()],td);let ed=class extends Ul{};ed.BEFORE_ZOOM="zoom.before_zoom",ed.START="zoom.start",ed.ZOOM="zoom",ed.END="zoom.end",ed=jt([fo()],ed);let id=class extends jl{};id.DOWN="key.down",id.HOLD="key.hold",id.UP="key.up",id=jt([fo()],id);const sd={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?td.UP:t>45&&t<135?td.DOWN:t<=45&&t>=-45?td.RIGHT:td.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:nd.getSwipeDirection(A.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 Ca,{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=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(Kl.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},nd=sd,od=new Ca,{getDragEventData:rd,getDropEventData:ad,getSwipeEventData:hd}=sd;class ld{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=rd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=Kl.list||this.draggableList||od;return this.dragging&&(s?t?od:new Ca(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($l.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Vl.left(t),this.dragging&&(this.interaction.emit(Kl.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 Ca(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=rd(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",e.emit($l.BEFORE_MOVE,this.dragData),e.emit($l.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Kl.BEFORE_DRAG,this.dragData),e.emit(Kl.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(Kl.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(Kl.OUT,t,i),e.emit(Kl.OVER,t,s)):e.emit(Kl.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Kl.LEAVE,t,i,s),e.emit(Kl.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:o}=i,r=rd(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit($l.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.emit(Kl.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(A.getDistance(e,t)>n.config.pointer.swipeDistance){const t=hd(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=ad(t,e,Kl.data);s.path=i,this.interaction.emit(Jl.DROP,s),this.interaction.emit(Kl.LEAVE,t,i)}dragReset(){Kl.list=Kl.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 dd=bt.get("emit");const cd=["move","zoom","rotate","key"];function ud(t,e,i,s,n){if(cd.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!pd(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&_d(o,e,i,s,n)}}function _d(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!pd(t,n)&&(ch.updateEventStyle&&!s&&ch.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=Dt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function pd(t,e){return e&&e.has(t)}const gd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},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:fd,pathCanDrag:yd,pathHasOutside:md}=sd;class vd{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&&Vl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Vl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Xl.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=Ft.clone(gd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ca(t),this.createTransformer(),this.dragger=new ld(this),s&&(this.config=Ft.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Vl.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Ul.BEFORE_DOWN,t),this.emit(Ul.DOWN,t),Vl.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Vl.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&&Vl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Ul.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=A.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(Ul.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;Vl.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(Ul.BEFORE_UP,t),this.emit(Ul.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(Ul.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Ul.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,Xl.setDownCode(e),this.emit(id.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(id.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,Xl.setUpCode(e),this.emit(id.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Ca),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(Ul.OUT,t,i),this.emit(Ul.OVER,t,e)):this.emit(Ul.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(Ul.LEAVE,t,i,e),this.emit(Ul.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Ul.LEAVE,t),this.dragger.dragging&&this.emit(Jl.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=[Ul.DOUBLE_TAP,Ul.DOUBLE_CLICK].some((e=>fd(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:o,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:o,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&&!md(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!yd(t.path))&&!md(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:Ul.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};return this.p.snap&&A.round(s),s}emitTap(t){this.emit(Ul.TAP,t),this.emit(Ul.CLICK,t)}emitDoubleTap(t){this.emit(Ul.DOUBLE_TAP,t),this.emit(Ul.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(Ul.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Ul.LONG_TAP,t),(fd(t.path,Ul.LONG_TAP)||fd(t.path,Ul.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 yt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(lr.RESIZE,this.__onResize,this)],t.once(_r.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 o=i.length-1;o>-1;o--){if(n=i.list[o],_d(n,t,e,!0,s))return;n.isApp&&ud(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&ud(n,t,e,!1,s),_d(n,t,e,!1,s))return}catch(t){dd.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 wd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}wd.custom={};class xd extends Wt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ca,this.pixelList=new Ca}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Ot.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Ot.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:bd,copy:kd,setRadius:Ed}=A,Bd={},Rd=ya.prototype;Rd.__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&&(kd(Bd,t),Ed(t=Bd,e.hitRadius)),bd(t,i,Bd),e.hitBox||n){if(_t.hitRadiusPoint(s.boxBounds,Bd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Bd)},Rd.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Rd.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Rd.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Rd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Sd=new N,Cd=Hh.prototype;Cd.__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,n=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,o=s||n;this.__hitCanvas||(this.__hitCanvas=o?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const r=this.__hitCanvas;if(o){const{renderBounds:i}=this.__layout,o=t.image.hitCanvasSize,a=r.hitScale=mt.set(0,0,o,o).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=mt.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),En.patternLocked=!0,this.__renderShape(r,{matrix:Sd.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),En.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Cd.__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,__strokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Ld=Hh.prototype,Od=Gh.prototype,Td=tl.prototype;Od.__updateHitCanvas=Td.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ld.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Od.__hitFill=Td.__hitFill=function(t){return this.__hitCanvas?Ld.__hitFill.call(this,t):_t.hitRadiusPoint(this.__layout.boxBounds,t)},Fl.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach((n=>t.rect(n.x,n.y-s,n.width,e<i?i:e)))},Xh.prototype.pick=function(e,i){return i||(i=Ht),this.updateLayout(),function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Ot.selector())}(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Pd=se.prototype;function Ad(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach((t=>{e.fillText(t.char,t.x,o.y)}));if(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>n.forEach((i=>e.fillRect(t.x,t.y+i,t.width,o)))))}}function Md(t,e){t.__.__font?Ad(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Dd(t,e,i){switch(e.__.strokeAlign){case"center":Id(t,1,e,i);break;case"inside":Wd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Id(t,2,e,i):Wd(t,"outside",e,i)}}function Id(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.strokeWidth*e,n),n.__isStrokes?zd(t,!0,i,s):Fd(i,s)}function Wd(e,i,s,n){const o=n.getSameCanvas(!0,!0);o.font=s.__.__font,Id(e,2,s,o),o.blendMode="outside"===i?"destination-out":"destination-in",Ad(s,o),o.blendMode="normal",s.__worldFlipped||t.fullImageShadow?n.copyWorldByReset(o,s.__nowWorld):n.copyWorldToInner(o,s.__nowWorld,s.__layout.renderBounds),o.recycle(s.__nowWorld)}function Fd(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=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(o){const{decorationHeight:t}=s;n.forEach((i=>o.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function zd(t,e,i,s){let n;for(let o=0,r=t.length;o<r;o++)n=t[o],n.image&&rh.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Fd(i,s):s.stroke(),s.restoreBlendMode()):e?Fd(i,s):s.stroke())}function Nd(e,i,s){const n=i.__;if(n.__strokeWidth)if(n.__font)Dd(e,i,s);else switch(n.strokeAlign){case"center":Yd(e,1,i,s);break;case"inside":!function(t,e,i){const s=e.__;i.save(),s.windingRule?i.clip(s.windingRule):i.clip(),Yd(t,2,e,i),i.restore()}(e,i,s);break;case"outside":!function(e,i,s){const n=i.__;if(n.__fillAfterStroke)Yd(e,2,i,s);else{const{renderBounds:o}=i.__layout,r=s.getSameCanvas(!0,!0);i.__drawRenderPath(r),Yd(e,2,i,r),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(o),i.__worldFlipped||t.fullImageShadow?s.copyWorldByReset(r,i.__nowWorld):s.copyWorldToInner(r,i.__nowWorld,o),r.recycle(i.__nowWorld)}}(e,i,s)}}function Yd(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.__strokeWidth*e,n),n.__isStrokes?zd(t,!1,i,s):s.stroke(),n.__useArrow&&oh.strokeArrow(t,i,s)}Pd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Pd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Pd.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),mt.set(s-o,n-r,2*o,2*r).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:Hd,getOuterOf:Xd,getByMove:Vd,getIntersectData:jd}=_t;let Ud;const{stintSet:Gd}=Ft,{hasTransparent:Zd}=ih;function Kd(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=rh.image(i,t,e,n,!Ud||!Ud[e.url]);break;case"linear":s=ah.linearGradient(e,n);break;case"radial":s=ah.radialGradient(e,n);break;case"angular":s=ah.conicGradient(e,n);break;case"solid":const{type:o,blendMode:r,color:a,opacity:h}=e;s={type:o,blendMode:r,style:ih.string(a,h)};break;default:void 0!==e.r&&(s={type:"solid",style:ih.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 n,o,r=i.__input[t];r instanceof Array||(r=[r]),Ud=rh.recycleImage(t,i);for(let i,n=0,o=r.length;n<o;n++)i=Kd(t,r[n],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(n=!0),o=!0),"fill"===t?(Gd(i,"__isAlphaPixelFill",n),Gd(i,"__isTransparentFill",o)):(Gd(i,"__isAlphaPixelStroke",n),Gd(i,"__isTransparentStroke",o))},fill:function(t,e,i){i.fillStyle=t,Md(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(rh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&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),Md(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),Md(e,i),i.restoreBlendMode()):Md(e,i)}},fillPathOrText:Md,fillText:Ad,stroke:Nd,strokes:function(t,e,i){Nd(t,e,i)},strokeText:Dd,drawTextStroke:Fd,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let o,r,a,h,{scaleX:l,scaleY:d}=n;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(n))h=s,o=a=n;else{const{renderShapeSpread:s}=t.__layout,c=jd(s?Hd(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,n);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(n,r),o=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:o,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let Jd={};const{get:$d,rotateOfOuter:Qd,translate:tc,scaleOfOuter:ec,scale:ic,rotate:sc}=x;function nc(t,e,i,s,n,o,r){const a=$d();tc(a,e.x+i,e.y+s),ic(a,n,o),r&&Qd(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function oc(t,e,i,s,n,o,r){const a=$d();tc(a,e.x+i,e.y+s),n&&ic(a,n,o),r&&sc(a,r),t.transform=a}function rc(t,e,i,s,n,o,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+n,Jd.y=e.y+o,tc(d,Jd.x,Jd.y),r&&ec(d,Jd,r,a),t.transform=d}const{get:ac,translate:hc}=x,lc=new yt,dc={},cc={};function uc(t,e,i,s){const{changeful:n,sync:o}=i;n&&(t.changeful=n),o&&(t.sync=o),t.data=_c(i,s,e)}function _c(t,e,i){t.padding&&(e=lc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:a,align:h,offset:l,scale:d,size:c,rotation:u,repeat:_,filters:p}=t,g=e.width===s&&e.height===n,f={mode:a},y="center"!==h&&(u||0)%180==90;let m,v;switch(_t.set(cc,0,0,y?n:s,y?s:n),a&&"cover"!==a&&"fit"!==a?((d||c)&&(r.getScaleData(d,c,i,dc),m=dc.scaleX,v=dc.scaleY),h&&(m&&_t.scale(cc,m,v,!0),q.toPoint(h,cc,e,cc,!0,!0))):g&&!u||(m=v=_t.getFitScale(e,cc,"fit"!==a),_t.put(e,i,h,m,!1,cc),_t.scale(cc,m,v,!0)),l&&A.move(cc,l),a){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(cc.x||cc.y||m||u)&&oc(f,e,cc.x,cc.y,m,v,u);break;case"repeat":(!g||m||u)&&rc(f,e,s,n,cc.x,cc.y,m,v,u,h),_||(f.repeat="repeat");break;default:m&&nc(f,e,cc.x,cc.y,m,v,u)}return f.transform||(e.x||e.y)&&(f.transform=ac(),hc(f.transform,e.x,e.y)),m&&"stretch"!==a&&(f.scaleX=m,f.scaleY=v),f.width=s,f.height=n,o&&(f.opacity=o),p&&(f.filters=p),_&&(f.repeat="string"==typeof _?"x"===_?"repeat-x":"repeat-y":"repeat"),f}let pc,gc=new yt;const{isSame:fc}=_t;function yc(t,e,i,s,n,o){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||uc(n,s,i,o),!0}function mc(t,e){xc(t,ir.LOAD,e)}function vc(t,e){xc(t,ir.LOADED,e)}function wc(t,e,i){e.error=i,t.forceUpdate("surface"),xc(t,ir.ERROR,e)}function xc(t,e,i){t.hasEvent(e)&&t.emitEvent(new ir(e,i))}function bc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:kc,scale:Ec,copy:Bc}=x,{ceil:Rc,abs:Sc}=Math;function Cc(e,i,s){let{scaleX:n,scaleY:o}=En.patternLocked?e.__world:e.__nowWorld;const r=n+"-"+o+"-"+s;if(i.patternId===r||e.destroyed)return!1;{n=Sc(n),o=Sc(o);const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g}=a;u&&(l=kc(),Bc(l,p),Ec(l,1/u,1/_),n*=u,o*=_),n*=s,o*=s,d*=n,c*=o;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&&(n/=h,o/=h,d/=h,c/=h),u&&(n/=u,o/=_),(p||1!==n||1!==o)&&(l||(l=kc(),p&&Bc(l,p)),Ec(l,1/n,1/o));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:Lc}=Math;const Oc={image:function(t,e,i,s,n){let o,r;const a=En.get(i);return pc&&i===pc.paint&&fc(s,pc.boxBounds)?o=pc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),pc=a.use>1?{leafPaint:o,paint:i,boxBounds:gc.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(yc(t,e,i,a,o,s),n&&(mc(t,r),vc(t,r))):a.error?n&&wc(t,r,a.error):(n&&(bc(t,!0),mc(t,r)),o.loadId=a.load((()=>{bc(t,!1),t.destroyed||(yc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),vc(t,r)),o.loadId=null}),(e=>{bc(t,!1),wc(t,r,e),o.loadId=null})),t.placeholderColor&&(t.placeholderDelay?setTimeout((()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))}),t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(e,i,s,n){const{scaleX:o,scaleY:r}=En.patternLocked?e.__world:e.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!dh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||lr.isResizing(e)||dh.running)){let{width:e,height:i}=h;e*=Lc(o)*a,i*=Lc(r)*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),n=e*i>t.image.maxCacheSize}return n?(function(t,e,i,s){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),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||dh.running?Cc(e,s,a):s.patternTask||(s.patternTask=En.patternTasker.add((()=>Ut(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&Cc(e,s,a),e.forceUpdate("surface")}))),300)),!1)},createPattern:Cc,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,En.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],r instanceof Array||(r=[r])),n.unload(i[h].loadId,!r.some((t=>t.url===a)))));return o}return null},createData:uc,getPatternData:_c,fillOrFitMode:nc,clipMode:oc,repeatMode:rc},{toPoint:Tc}=G,{hasTransparent:Pc}=ih,Ac={},Mc={};function Dc(t,e,i,s){if(i){let n,o,r,a;for(let t=0,h=i.length;t<h;t++)n=i[t],"string"==typeof n?(r=t/(h-1),o=ih.string(n,s)):(r=n.offset,o=ih.string(n.color,s)),e.addColorStop(r,o),!a&&Pc(o)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Ic,getDistance:Wc}=A,{get:Fc,rotateOfOuter:zc,scaleOfOuter:Nc}=x,{toPoint:Yc}=G,Hc={},Xc={};function Vc(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Ic(e,i);o=Fc(),n?(Nc(o,e,r/a*(s||1),1),zc(o,e,t+90)):(Nc(o,e,1,r/a*(s||1)),zc(o,e,t))}return o}const{getDistance:jc}=A,{toPoint:Uc}=G,Gc={},Zc={};const Kc={linearGradient:function(e,i){let{from:s,to:n,type:o,opacity:r}=e;Tc(s||"top",i,Ac),Tc(n||"bottom",i,Mc);const a=t.canvas.createLinearGradient(Ac.x,Ac.y,Mc.x,Mc.y),h={type:o,style:a};return Dc(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=e;Yc(s||"center",i,Hc),Yc(n||"bottom",i,Xc);const h=t.canvas.createRadialGradient(Hc.x,Hc.y,0,Hc.x,Hc.y,Wc(Hc,Xc)),l={type:o,style:h};Dc(l,h,e.stops,r);const d=Vc(i,Hc,Xc,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=e;Uc(s||"center",i,Gc),Uc(n||"bottom",i,Zc);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Gc.x,Gc.y):t.canvas.createRadialGradient(Gc.x,Gc.y,0,Gc.x,Gc.y,jc(Gc,Zc)),l={type:o,style:h};Dc(l,h,e.stops,r);const d=Vc(i,Gc,Zc,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Vc},{copy:qc,toOffsetOutBounds:Jc}=_t,$c={},Qc={};function tu(e,i,s,n){const{bounds:o,shapeBounds:r}=n;if(t.fullImageShadow){if(qc($c,e.bounds),$c.x+=i.x-r.x,$c.y+=i.y-r.y,s){const{matrix:t}=n;$c.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),$c.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),$c.width*=s,$c.height*=s}e.copyWorld(n.canvas,e.bounds,$c)}else s&&(qc($c,i),$c.x-=i.width/2*(s-1),$c.y-=i.height/2*(s-1),$c.width*=s,$c.height*=s),e.copyWorld(n.canvas,r,s?$c:i)}const{toOffsetOutBounds:eu}=_t,iu={};const su={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Jc(l,Qc),a.forEach(((a,g)=>{_.setWorldShadow(Qc.offsetX+a.x*c,Qc.offsetY+a.y*u,a.blur*c,ih.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,tu(_,Qc,n,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),s=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,s,o,a.blendMode):e.copyWorldToInner(_,s,r.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;eu(l,iu),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(iu.offsetX+a.x*c,iu.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,tu(_,iu,n,i),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),s=o):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,ih.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(_,s,o,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}=Io;function ou(t,e,i,s,n,o){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),au(t,e,i,1)}(t,i,s,n);break;case"opacity-path":au(t,i,s,o);break;case"path":i.restore()}}function ru(t){return t.getSameCanvas(!1,!0)}function au(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}Xh.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(r&&(ou(this,r,t,n,s,o),s=n=null),"path"===a||"clipping-path"===a?(i.opacity<1?(r="opacity-path",o=i.opacity,n||(n=ru(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=ru(t)),n||(n=ru(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||nu(i,e)||i.__render(n||t,e);ou(this,r,t,n,s,o)};const hu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",lu=hu+"_#~&*+\\=|≮≯≈≠=…",du=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 cu(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const uu=cu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),_u=cu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),pu=cu(hu),gu=cu(lu),fu=cu("- —/~|┆·");var yu;!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"}(yu||(yu={}));const{Letter:mu,Single:vu,Before:wu,After:xu,Symbol:bu,Break:ku}=yu;function Eu(t){return uu[t]?mu:fu[t]?ku:_u[t]?wu:pu[t]?xu:gu[t]?bu:du.test(t)?vu:mu}const Bu={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-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:Su}=Bu,{Letter:Cu,Single:Lu,Before:Ou,After:Tu,Symbol:Pu,Break:Au}=yu;let Mu,Du,Iu,Wu,Fu,zu,Nu,Yu,Hu,Xu,Vu,ju,Uu,Gu,Zu,Ku,qu,Ju=[];function $u(t,e){Hu&&!Yu&&(Yu=Hu),Mu.data.push({char:t,width:e}),Iu+=e}function Qu(){Wu+=Iu,Mu.width=Iu,Du.words.push(Mu),Mu={data:[]},Iu=0}function t_(){Gu&&(Zu.paraNumber++,Du.paraStart=!0,Gu=!1),Hu&&(Du.startCharSize=Yu,Du.endCharSize=Hu,Yu=0),Du.width=Wu,Ku.width?Su(Du):qu&&e_(),Ju.push(Du),Du={words:[]},Wu=0}function e_(){Wu>(Zu.maxWidth||0)&&(Zu.maxWidth=Wu)}const{top:i_,right:s_,bottom:n_,left:o_}=V;function r_(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 a_={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(o?(s=l[o_],o-=l[s_]+l[o_]):i.autoSizeAlign||(s=l[o_]),r?(n=l[i_],r-=l[i_]+l[n_]):i.autoSizeAlign||(n=l[i_]));const d={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:t.canvas.font=h};return function(e,i,s){Zu=e,Ju=e.rows,Ku=e.bounds,qu=!Ku.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=Ku;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Gu=!0,Vu=null,Yu=Nu=Hu=Iu=Wu=0,Mu={data:[]},Du={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)zu=i[s],"\n"===zu?(Iu&&Qu(),Du.paraEnd=!0,t_(),Gu=!0):(Xu=Eu(zu),Xu===Cu&&"none"!==r&&(zu=Ru(zu,r,!Iu)),Nu=a.measureText(zu).width,n&&(n<0&&(Hu=Nu),Nu+=n),ju=Xu===Lu&&(Vu===Lu||Vu===Cu)||Vu===Lu&&Xu!==Tu,Uu=!(Xu!==Ou&&Xu!==Lu||Vu!==Pu&&Vu!==Tu),Fu=Gu&&o?h-o:h,t&&h&&Wu+Iu+Nu>Fu&&(e?(Iu&&Qu(),Wu&&t_()):(Uu||(Uu=Xu===Cu&&Vu==Tu),ju||Uu||Xu===Au||Xu===Ou||Xu===Lu||Iu+Nu>Fu?(Iu&&Qu(),Wu&&t_()):Wu&&t_()))," "===zu&&!0!==Gu&&Wu+Iu===0||(Xu===Au?(" "===zu&&Iu&&Qu(),$u(zu,Nu),Qu()):ju||Uu?(Iu&&Qu(),$u(zu,Nu)):$u(zu,Nu)),Vu=Xu);Iu&&Qu(),Wu&&t_(),Ju.length>0&&(Ju[Ju.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Zu.paraNumber++,Wu=a.measureText(t).width,Ju.push({x:o||0,text:t,width:Wu,paraStart:!0}),qu&&e_()}))}(d,e,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":r_(e,"x",t[o_]);break;case"right":r_(e,"x",-t[s_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":r_(e,"y",t[i_]);break;case"bottom":r_(e,"y",-t[n_])}}(l,d,i,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__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=o*n+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,o),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,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=n;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+=o,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:n,paraIndent:o,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&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"!==n||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,o),d.overflow&&function(e,i,s,n){if(!n)return;const{rows:o,overflow:r}=e;let{textOverflow:a}=i;if(o.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+n-l;("none"===i.textWrap?o:[o[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,o),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,"object"==typeof n?(i=n.type,n.color&&(t.decorationColor=ih.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]}}(d,i),d}};const h_={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!ih.object)return t;t=ih.object(t)}let s=void 0===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 l_(t){return t?t instanceof Array?t:[t]:[]}Object.assign(eh,a_),Object.assign(ih,h_),Object.assign(oh,qd),Object.assign(rh,Oc),Object.assign(ah,Kc),Object.assign(hh,su),Object.assign(Ot,{interaction:(t,e,i,s)=>new vd(t,e,i,s),hitCanvas:(t,e)=>new Ta(t,e),hitCanvasManager:()=>new xd}),Aa();class d_ extends Qo{get list(){return l_(this.value)}get oldList(){return l_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}d_.BEFORE_SELECT="editor.before_select",d_.SELECT="editor.select",d_.BEFORE_HOVER="editor.before_hover",d_.HOVER="editor.hover";class c_ extends d_{constructor(t,e){super(t,e)}}c_.BEFORE_MOVE="editor.before_move",c_.MOVE="editor.move";class u_ extends d_{constructor(t,e){super(t,e)}}u_.BEFORE_SCALE="editor.before_scale",u_.SCALE="editor.scale";class __ extends d_{constructor(t,e){super(t,e)}}__.BEFORE_ROTATE="editor.before_rotate",__.ROTATE="editor.rotate";class p_ extends d_{constructor(t,e){super(t,e)}}function g_(t){return(e,i)=>{const s="_"+i;Ln(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==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?d_.BEFORE_SELECT:d_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new d_(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}p_.BEFORE_SKEW="editor.before_skew",p_.SKEW="editor.skew";const{abs:f_}=Math,{copy:y_,scale:m_}=x,{setListWithFn:v_}=_t,{worldBounds:w_}=Io,x_={a:1,b:0,c:0,d:1,e:0,f:0},b_={x:0,y:0,width:0,height:0};class k_ extends Hh{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?(v_(b_,t,w_),this.set(b_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:a}=n,{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=f_(d.scaleX),h=f_(d.scaleY);if(y_(x_,d),x_.half=r%2,i!==h){m_(x_,1/i,1/h),t.setWorld(x_,e.matrix),t.beginPath(),n.strokeWidth=r;const{x:o,y:a,width:l,height:d}=s.__layout.boxBounds;t.rect(o*i,a*h,l*i,d*h)}else t.setWorld(x_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/f_(d.scaleX);o&&("string"==typeof o?oh.stroke(o,this,t):oh.strokes(o,this,t)),a&&("string"==typeof a?oh.fill(a,this,t):oh.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}jt([g_((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],k_.prototype,"target",void 0);class E_ extends Xh{constructor(t){super(t),this.strokeArea=new Gh({strokeAlign:"center"}),this.fillArea=new Gh,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 B_={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return R_([t],i,e),i}};function R_(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],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&&R_(s.children,e,i)}}const{findOne:S_,findByBounds:C_}=B_;class L_ extends Xh{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 k_,this.targetStroker=new k_,this.bounds=new yt,this.selectArea=new E_,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(){if(this.running){const{mergeConfig:t,list:e}=this.editor,{stroke:i,strokeWidth:s,selectedStyle:n}=t;this.targetStroker.setTarget(e,Object.assign({stroke:i,strokeWidth:Math.max(1,s/2)},n||{})),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:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},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 Ca(C_(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)||t.shiftKey&&!S_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ca(this.editor.editBox.rect)};return S_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):S_(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_([[d_.HOVER,this.onHover,this],[d_.SELECT,this.onSelect,this]]),e.on_([[Ul.MOVE,this.onPointerMove,this],[Ul.BEFORE_DOWN,this.onBeforeDown,this],[Ul.TAP,this.onTap,this],[Kl.START,this.onDragStart,this,!0],[Kl.DRAG,this.onDrag,this],[Kl.END,this.onDragEnd,this],[$l.MOVE,this.onAutoMove,this],[[ed.ZOOM,$l.MOVE],()=>{this.editor.hoverTarget=null}]])]}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:O_,top:T_,topRight:P_,right:A_,bottomRight:M_,bottom:D_,bottomLeft:I_,left:W_}=j,{toPoint:F_}=G,{within:z_}=r,N_={getScaleData(t,e,i,s,n,o,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;o&&(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,R=(s.x+y)/y,S=(s.y+m)/m,C=(-s.x+y)/y;switch(i){case T_:c=B,h="bottom";break;case A_:d=R,h="left";break;case D_:c=S,h="top";break;case W_:d=C,h="right";break;case O_:c=B,d=C,h="bottom-right";break;case P_:c=B,d=R,h="bottom-left";break;case M_:c=S,d=R,h="top-left";break;case I_:c=S,d=C,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case T_:case D_:t=c;break;case W_:case A_: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,O=1!==c;if(L&&(d/=k),O&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(F_(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new yt(t.__localBoxBounds);if(i.scaleOf(t.getLocalPointByInner(l),d,c),!_t.includes(e,i)){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;L&&(d*=s),O&&(c*=n)}}if(L&&_){const e=u.width*t.scaleX;d=z_(e*d,_)/e}if(O&&p){const e=u.height*t.scaleY;c=z_(e*c,p)/e}return L&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),O&&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:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case O_:o="bottom-right";break;case P_:o="bottom-left";break;case M_:o="top-left";break;case I_:o="top-right";break;default:o="center"}return F_(n||o,t,r,!0),{origin:r,rotation:A.getRotation(s,r,i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case T_:case O_:o={x:.5,y:0},n="bottom",a=1;break;case D_:case M_:o={x:.5,y:1},n="top",a=1;break;case W_:case I_:o={x:0,y:.5},n="right",h=1;break;case A_:case P_:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,F_(s||n,t,r,!0);const c=A.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.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 W_:t=A_;break;case O_:t=P_;break;case I_:t=M_;break;case A_:t=W_;break;case P_:t=O_;break;case M_:t=I_}if(i)switch(t){case T_:t=D_;break;case O_:t=I_;break;case P_:t=M_;break;case D_:t=T_;break;case I_:t=O_;break;case M_:t=P_}return t}},Y_={};function H_(t,e){const{editBox:i}=t,s=i.enterPoint;if(!s||!t.editing||!i.visible)return;if("circle"===s.name)return;if("button"===s.pointType)return void(s.cursor||(s.cursor="pointer"));let{rotation:n}=i;const{resizeCursor:o,rotateCursor:a,skewCursor:h,resizeable:l,rotateable:d,skewable:c}=t.mergeConfig,{pointType:u}=s,{flippedX:_,flippedY:p}=i;let g=u.includes("resize");g&&d&&(e.metaKey||e.ctrlKey||!l)&&(g=!1);const f=c&&!g&&("resize-line"===s.name||"skew"===u)?h:g?o:a;n+=45*(N_.getFlipDirection(s.direction,_,p)+1),n=2*Math.round(r.formatRotation(n,!0)/2);const{url:y,x:m,y:v}=f,w=y+n;Y_[w]?s.cursor=Y_[w]:Y_[w]=s.cursor={url:V_(y,n),x:m,y:v}}function X_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.editBox.rect.cursor=i?e:void 0}function V_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class j_ extends tl{constructor(t){super(t),this.useFastShadow=!0}}const U_=["top","right","bottom","left"],G_=void 0;class Z_ extends Xh{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 Xh,this.rect=new tl({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new j_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Xh({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:o,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 j_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new j_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new j_({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{mergeConfig:t,element:e,single:i}=this.editor,{rect:s,circle:n,resizePoints:o}=this,{stroke:r,strokeWidth:a}=t,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;for(let t=0;t<8;t++)d=o[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);n.set(this.getPointStyle(t.circle||t.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:G_},t.rect||{})),s.hittable=!i,s.syncEventer=i&&this.editor,i&&(e.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:e}])}update(t){const{rect:e,circle:i,buttons:s,resizePoints:n,rotatePoints:o,resizeLines:r,editor:a}=this,{mergeConfig:h,element:l,multiple:d,editMask:c}=a,{middlePoint:u,resizeable:_,rotateable:p,hideOnSmall:g,editBox:f,mask:y}=h;if(this.visible=!l.locked,c.visible=!!y||0,this.view.worldOpacity){const{width:a,height:l}=t,c="number"==typeof g?g:10,y=f&&!(g&&a<c&&l<c);let m,v,w,x={};for(let e=0;e<8;e++)G.toPoint(G.directionData[e],t,x),v=n[e],m=o[e],w=r[Math.floor(e/2)],v.set(x),m.set(x),w.set(x),v.visible=w.visible=y&&!(!_&&!p),m.visible=y&&p&&_&&!h.rotatePoint,e%2&&(v.visible=m.visible=y&&!!u,(e+1)/2%2?(w.width=a,g&&2*v.width>a&&(v.visible=!1)):(w.height=l,v.rotation=90,g&&2*v.width>l&&(v.visible=!1)));i.visible=y&&p&&!(!h.circle&&!h.rotatePoint),i.visible&&this.layoutCircle(h),e.path&&(e.path=null),e.set(Object.assign(Object.assign({},t),{visible:!!d||f})),s.visible=y&&s.children.length>0||0,s.visible&&this.layoutButtons(h)}else e.set(t)}layoutCircle(t){const{circleDirection:e,circleMargin:i,buttonsMargin:s,buttonsDirection:n,middlePoint:o}=t,r=U_.indexOf(e||(this.buttons.children.length&&"bottom"===n?"top":"bottom"));this.setButtonPosition(this.circle,r,i||s,!!o)}layoutButtons(t){const{buttons:e}=this,{buttonsDirection:i,buttonsFixed:s,buttonsMargin:n,middlePoint:o}=t,{flippedX:r,flippedY:a}=this;let h=U_.indexOf(i);(h%2&&r||(h+1)%2&&a)&&s&&(h=(h+2)%4);const l=s?N_.getRotateDirection(h,this.flippedOne?this.rotation:-this.rotation,4):h;this.setButtonPosition(e,l,n,!!o),s&&(e.rotation=90*(l-h)),e.scaleX=r?-1:1,e.scaleY=a?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}unload(){this.visible=!1}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.editor.mergeConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:G_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.editor.mergeConfig;return t instanceof Array?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.editor.mergeConfig;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:n}=this,{element:o}=s;"rect"===e.name&&(this.moving=!0,s.opacity=s.mergeConfig.hideOnMove?0:1),n.x=t.x,n.y=t.y,n.point={x:o.x,y:o.y},n.bounds=Object.assign({},o.getLayoutBounds("box","local")),n.rotation=o.rotation,i&&i.includes("resize")&&(lr.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")&&(lr.resizingKeys=null)}onDrag(t){const{editor:e}=this,{pointType:i}=this.enterPoint=t.current;i.includes("rotate")||t.metaKey||t.ctrlKey||!e.mergeConfig.resizeable?(e.onRotate(t),"resize-rotate"===i&&e.onScale(t)):"resize"===i&&e.onScale(t),"skew"===i&&e.onSkew(t),H_(e,t)}onArrow(t){const{editor:e}=this;if(e.editing&&e.mergeConfig.keyEvent){let i=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":i=-n;break;case"ArrowRight":i=n}(i||s)&&e.move(i,s)}}onDoubleTap(t){"double"===this.editor.mergeConfig.openInner&&this.openInner(t)}onLongPress(t){"long"===this.editor.mergeConfig.openInner&&this.openInner(t)}openInner(t){const{editor:e}=this;if(e.single){const{element:i}=e;if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find((t=>t.editable&&t instanceof Fl))||t.find((t=>t instanceof Fl));if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){const{editor:s}=this;t.direction=i,t.pointType=e;const n=[[Kl.START,this.onDragStart,this],[Kl.DRAG,this.onDrag,this],[Kl.END,this.onDragEnd,this],[Ul.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&n.push([Ul.ENTER,e=>{this.enterPoint=t,H_(s,e)}]),this.__eventIds.push(t.on_(n))}__listenEvents(){const{rect:t,editor:e}=this;this.__eventIds.push(e.on_(d_.SELECT,this.onSelect,this),t.on_([[Kl.START,this.onDragStart,this],[Kl.DRAG,e.onMove,e],[Kl.END,this.onDragEnd,this],[Ul.ENTER,()=>X_(e)],[Ul.DOUBLE_TAP,this.onDoubleTap,this],[Ul.LONG_PRESS,this.onLongPress,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const K_={x:0,y:0,width:1e5,height:1e5};class q_ extends Hh{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,K_),Object.assign(this.__world,K_)}__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"),i.list.forEach((i=>{i.__renderShape(t,e);const{__box:s,parent:n}=i;((i=s)||(i=n)&&n.textBox)&&i.__renderShape(t,e)})),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const J_='\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"/>',$_={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${J_}\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${J_}\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${J_}\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 yt;function tp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer.zoomLayer;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 ep=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),ip=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),sp={group(t,e,i){t.sort(ip);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new Xh(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(ep);const r=new N(e.worldTransform);return r.divideParent(n.worldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach((t=>t.dropTo(o))),s.unlockLayout(),o},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(ep),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(ip),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},np=bt.get("EditToolCreator");function op(){return t=>{ap.register(t)}}const rp=op,ap={list:{},register(t){const{tag:e}=t.prototype;hp[e]&&np.repeat(e),hp[e]=t},get:(t,e)=>new hp[t](e)},{list:hp}=ap;class lp extends d_{constructor(t,e){super(t,e)}}lp.BEFORE_OPEN="innerEditor.before_open",lp.OPEN="innerEditor.open",lp.BEFORE_CLOSE="innerEditor.before_close",lp.CLOSE="innerEditor.close";class dp extends d_{constructor(t,e){super(t,e)}}dp.BEFORE_GROUP="editor.before_group",dp.GROUP="editor.group",dp.BEFORE_UNGROUP="editor.before_ungroup",dp.UNGROUP="editor.ungroup",dp.BEFORE_OPEN="editor.before_open_group",dp.OPEN="editor.open_group",dp.BEFORE_CLOSE="editor.before_close_group",dp.CLOSE="editor.close_group";const{updateMatrix:cp}=Co,up={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},_p="top-left";class pp extends Gh{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(er.CHANGE,(e=>{if(this.checkChange&&up[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,cp(this.parent),cp(this);const a=new N(this.__world);switch(r[i]=s,this.__layout.rotationChange(),cp(this),this.changedTransform=new N(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(_p,o);break;case"scaleX":t.scaleOf(_p,o,1);break;case"scaleY":t.scaleOf(_p,1,o);break;case"skewX":t.skewOf(_p,o,0);break;case"skewY":t.skewOf(_p,0,o)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class gp extends Xh{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 Ca,this.openedGroupList=new Ca,this.simulateTarget=new pp(this),this.editBox=new Z_(this),this.editToolList={},this.selector=new L_(this),this.editMask=new q_(this),this.targetEventIds=[];let i=Ft.clone($_);t&&(i=Ft.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Lt.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&&tp(this),this.update()}updateEditTool(){const t=this.editTool;if(t&&(this.editBox.unload(),t.unload(),this.editTool=null),this.editing){const t=this.single?this.list[0].editOuter:"EditTool";this.editTool=this.editToolList[t]=this.editToolList[t]||ap.get(t,this),this.editBox.load(),this.editTool.load()}}getEditSize(t){return this.mergeConfig.editSize}onMove(t){if(t instanceof $l){if("drag"!==t.moveType){const{moveable:e,resizeable:i}=this.mergeConfig,s=t.getLocalMove(this.element);"move"===e?(t.stop(),this.move(s.x,s.y)):"zoom"===i&&t.stop()}}else{const e={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(e.x)>Math.abs(e.y)?e.y=0:e.x=0),this.move(Kl.getValidMove(this.element,this.editBox.dragStartData.point,e))}}onScale(t){const{element:e}=this;let{around:i,lockRatio:s,resizeable:n,flipable:o,editSize:r}=this.mergeConfig;if(t instanceof ed)"zoom"===n&&(t.stop(),this.scaleOf(e.getBoxPoint(t),t.scale,t.scale));else{const{direction:n}=t.current;(t.shiftKey||e.lockRatio)&&(s=!0);const a=N_.getScaleData(e,this.editBox.dragStartData.bounds,n,t.getInnerTotal(e),s,N_.getAround(i,t.altKey),o,this.multiple||"scale"===r);this.editTool.onScaleWithDrag?(a.drag=t,this.scaleWithDrag(a)):this.scaleOf(a.origin,a.scaleX,a.scaleY)}}onRotate(t){const{skewable:e,rotateable:i,around:s,rotateGap:n}=this.mergeConfig,{direction:o,name:a}=t.current;if(e&&"resize-line"===a)return this.onSkew(t);const{element:h}=this,{dragStartData:l}=this.editBox;let d,c;if(t instanceof Ql){if("rotate"!==i)return;t.stop(),c=t.rotation,d=h.getBoxPoint(t),h.scaleX*h.scaleY<0&&(c=-c)}else{const e=N_.getRotateData(h.boxBounds,o,t.getBoxPoint(h),h.getBoxPoint(l),t.shiftKey?null:h.around||h.origin||s||"center");c=e.rotation,d=e.origin}h.scaleX*h.scaleY<0&&(c=-c),t instanceof Kl&&(c=l.rotation+c-h.rotation),c=r.float(r.getGapRotation(c,n,h.rotation),2),c&&this.rotateOf(d,c)}onSkew(t){const{element:e}=this,{around:i}=this.mergeConfig,{origin:s,skewX:n,skewY:o}=N_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),N_.getAround(i,t.altKey));(n||o)&&this.skewOf(s,n,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;"object"==typeof t&&(e=t.y,t=t.x);const{element:i}=this,{beforeMove:s}=this.mergeConfig;if(s){const n=s({target:i,x:t,y:e});if("object"==typeof n)t=n.x,e=n.y;else if(!1===n)return}const n=i.getWorldPointByLocal({x:t,y:e},null,!0);this.multiple&&i.safeChange((()=>i.move(t,e)));const o={target:i,editor:this,moveX:n.x,moveY:n.y};this.emitEvent(new c_(c_.BEFORE_MOVE,o));const r=new c_(c_.MOVE,o);this.editTool.onMove(r),this.emitEvent(r)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,{beforeScale:i}=this.mergeConfig;if(i){const{origin:s,scaleX:n,scaleY:o,drag:r}=t;if(!1===i({target:e,drag:r,origin:s,scaleX:n,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:this,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new u_(u_.BEFORE_SCALE,t));const s=new u_(u_.SCALE,t);this.editTool.onScaleWithDrag(s),this.emitEvent(s)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{element:n}=this,{beforeScale:o}=this.mergeConfig;if(o){const s=o({target:n,origin:t,scaleX:e,scaleY:i});if("object"==typeof s)e=s.scaleX,i=s.scaleY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>n.safeChange((()=>n.scaleOf(t,e,i))))),h={target:n,editor:this,worldOrigin:r,scaleX:e,scaleY:i,transform:a};this.emitEvent(new u_(u_.BEFORE_SCALE,h));const l=new u_(u_.SCALE,h);this.editTool.onScale(l),this.emitEvent(l)}flip(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,i=this.getWorldOrigin("center"),s=this.multiple?this.getChangedTransform((()=>e.safeChange((()=>e.flip(t))))):new N(Co.getFlipTransform(e,t)),n={target:e,editor:this,worldOrigin:i,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:s};this.emitEvent(new u_(u_.BEFORE_SCALE,n));const o=new u_(u_.SCALE,n);this.editTool.onScale(o),this.emitEvent(o)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{element:i}=this,{beforeRotate:s}=this.mergeConfig;if(s){const n=s({target:i,origin:t,rotation:e});if("number"==typeof n)e=n;else if(!1===n)return}const n=this.getWorldOrigin(t),o=this.multiple&&this.getChangedTransform((()=>i.safeChange((()=>i.rotateOf(t,e))))),r={target:i,editor:this,worldOrigin:n,rotation:e,transform:o};this.emitEvent(new __(__.BEFORE_ROTATE,r));const a=new __(__.ROTATE,r);this.editTool.onRotate(a),this.emitEvent(a)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{element:n}=this,{beforeSkew:o}=this.mergeConfig;if(o){const s=o({target:n,origin:t,skewX:e,skewY:i});if("object"==typeof s)e=s.skewX,i=s.skewY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>n.safeChange((()=>n.skewOf(t,e,i))))),h={target:n,editor:this,worldOrigin:r,skewX:e,skewY:i,transform:a};this.emitEvent(new p_(p_.BEFORE_SKEW,h));const l=new p_(p_.SKEW,h);this.editTool.onSkew(l),this.emitEvent(l)}checkTransform(t){return this.element&&!this.element.locked&&this.mergeConfig[t]}getWorldOrigin(t){return this.element.getWorldPoint(Co.getInnerOrigin(this.element,t))}getChangedTransform(t){const{element:e}=this;if(this.multiple&&!e.canChange)return e.changedTransform;const i=new N(e.worldTransform);return t(),new N(e.worldTransform).divide(i)}group(t){return this.multiple&&(this.emitGroupEvent(dp.BEFORE_GROUP),this.target=sp.group(this.list,this.element,t),this.emitGroupEvent(dp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(dp.BEFORE_UNGROUP,t))),this.target=sp.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(dp.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(dp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(dp.OPEN,t)}closeGroup(t){this.emitGroupEvent(dp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(dp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Co.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 dp(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&&ap.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||ap.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(lp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(lp.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(lp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(lp.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new lp(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&&(sp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(sp.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()}onKey(t){H_(this,t)}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editBox:i,editMask:s}=this;this.targetEventIds=[e.on_(ur.START,this.onRenderStart,this),t.on_([[ur.CHILD_START,this.onAppRenderStart,this],[$l.BEFORE_MOVE,this.onMove,this,!0],[ed.BEFORE_ZOOM,this.onScale,this,!0],[Ql.BEFORE_ROTATE,this.onRotate,this,!0],[[id.HOLD,id.UP],this.onKey,this],[id.DOWN,i.onArrow,i]])],s.visible&&s.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())}}jt([(t,e)=>{Ln(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"),Xt(s.lockRatio)&&(s.lockRatio=!0))),this.mergedConfig=s}})}],gp.prototype,"mergeConfig",void 0),jt([g_((function(t,e){t.emitEvent(new d_(d_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],gp.prototype,"hoverTarget",void 0),jt([g_((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ca?i:new Ca(i),t.multiple&&tp(t)):(t.simulateTarget.remove(),t.leafList.reset(),t.closeInnerEditor()),t.emitEvent(new d_(d_.SELECT,{editor:t,value:i,oldValue:e})),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{X_(t),t.updateEditTool(),t.update(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents())}))],gp.prototype,"target",void 0);class fp{static registerInnerEditor(){ap.register(this)}get tag(){return"InnerEditor"}get editBox(){return this.editor.editBox}constructor(t){this.editor=t,this.create()}onCreate(){}create(){this.view=new Xh,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&(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 yp=class extends fp{static registerEditTool(){ap.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach((t=>{t.moveWorld(e,i)})),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach((t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)})),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach((t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)})),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach((t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)})),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){const{editor:t,editBox:e}=this,{x:i,y:s,scaleX:n,scaleY:o,rotation:r,skewX:a,skewY:h,width:l,height:d}=t.element.getLayoutBounds("box",t,!0);e.set({x:i,y:s,scaleX:n,scaleY:o,rotation:r,skewX:a,skewY:h}),e.update({x:0,y:0,width:l,height:d}),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};yp=jt([op()],yp);const{left:mp,right:vp}=j,{move:wp,copy:xp,toNumberPoints:bp}=A;let kp=class extends yp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===mp;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.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=bp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(wp(t,o,r),s&&wp(e,-o,-r)):(s&&wp(t,-o,-r),wp(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),xp(s[7],i),xp(e[7],i),xp(s[3],a),xp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===mp||t===vp,s[t].visible=a,e[t].visible=!r&&a}};kp=jt([op()],kp);const{M:Ep,L:Bp,C:Rp,Q:Sp,Z:Cp,N:Lp,D:Op,X:Tp,G:Pp,F:Ap,O:Mp,P:Dp,U:Ip}=re,Wp={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Ep:case Bp:Fp(t,e,i,n,1),n+=3;break;case Rp:Fp(t,e,i,n,3),n+=7;break;case Sp:Fp(t,e,i,n,2),n+=5;break;case Cp:n+=1;break;case Lp:Fp(t,e,i,n,2),n+=5;break;case Op:Fp(t,e,i,n,2),n+=9;break;case Tp:Fp(t,e,i,n,2),n+=6;break;case Pp:Fp(t,e,i,n,2),n+=9;break;case Ap:Fp(t,e,i,n,2),n+=5;break;case Mp:t[n]=Pp,t.splice(n+4,0,t[n+3],0),Fp(t,e,i,n,2),n+=9,o+=2;break;case Dp:t[n]=Ap,t.splice(n+4,0,t[n+3]),Fp(t,e,i,n,2),n+=5,o+=1;break;case Ip:Fp(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:Fp}=Wp,zp=x.get(),{topLeft:Np,top:Yp,topRight:Hp,right:Xp,bottom:Vp,left:jp}=j;function Up(t,e,i){t.pathInputed?Gp(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Gp(t,e,i){Wp.scale(t.__.path,e,i),t.path=t.__.path}function Zp(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):Wp.scalePoints(s,e,i),t.points=s}function Kp(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)zp.a=e,zp.d=i,s[t].transform(zp,!0)}const qp=ya.prototype;function Jp(t,e,i){$p(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_($l.BEFORE_MOVE,(e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY))})),t.on_(ed.BEFORE_ZOOM,(e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)})))}function $p(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&Ft.assign(i,e),Ft.assign(t.config,i,t.userConfig)}qp.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))},qp.__scaleResize=function(t,e){Up(this,t,e)},qp.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},qp.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Fl.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.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||o&&"font-size"===n.mergedConfig.editSize?function(t,e,i,s){let n=e;if(void 0!==s){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case Yp:case Vp:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case jp:case Xp:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Np:case Hp:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:r}=o;r&&(t.padding=r instanceof Array?r.map((t=>t*n)):r*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}(this,t,e,o&&o.direction):Up(this,t,e)},zl.prototype.__scaleResize=function(t,e){Gp(this,t,e)},pl.prototype.__scaleResize=function(t,e){this.pathInputed?Gp(this,t,e):this.points?Zp(this,t,e):this.width*=t},kl.prototype.__scaleResize=function(t,e){this.pathInputed?Gp(this,t,e):this.points?Zp(this,t,e):Up(this,t,e)},Xh.prototype.__scaleResize=function(t,e){Kp(this,t,e)},tl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Up(this,t,e),i&&Kp(this,t,e)},Lt.add("resize"),Lt.add("editor","resize"),Ot.editor=function(t,e){const i=new gp(t);return e&&e.sky.add(e.editor=i),i},tl.addAttr("textBox",!1,Mn),Hh.addAttr("editConfig",void 0,Mn),Hh.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),Mn),Hh.addAttr("editInner","PathEditor",Mn),Xh.addAttr("editInner","",Mn),Fl.addAttr("editInner","TextEditor",Mn),Hh.setEditConfig=function(t){this.changeAttr("editConfig",t)},Hh.setEditOuter=function(t){this.changeAttr("editOuter",t)},Hh.setEditInner=function(t){this.changeAttr("editInner",t)};const Qp=bt.get("LeaferTypeCreator"),tg={list:{},register(t,e){eg[t]&&Qp.repeat(t),eg[t]=e},run(t,e){const i=eg[t];i&&i(e)}},{list:eg,register:ig}=tg;ig("viewport",Jp),ig("custom",(function(t){Jp(t,null,!0)})),ig("design",(function(t){Jp(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),ig("document",(function(t){Jp(t,{zoom:{min:1},move:{scroll:"limit"}})}));const sg={getData(t){const e=t[0],i=t[1],s=A.getCenter(e.from,i.from),n=A.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=A.getDistance(e.from,i.from);return{move:o,scale:A.getDistance(e.to,i.to)/r,rotation:A.getRotation(e.from,i.from,e.to,i.to),center:n}}},ng={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:o,zoomSpeed:a}=i;const h=e.deltaY||e.deltaX;if(o?(s="mouse"===o||!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);n=1-h/(4*(e.deltaY?i.delta.y:i.delta.x))*a,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class og{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($l.START,this.moveData)),t.path=this.moveData.path,e.emit($l.BEFORE_MOVE,t),e.emit($l.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(ed.START,this.zoomData)),t.path=this.zoomData.path,e.emit(ed.BEFORE_ZOOM,t),e.emit(ed.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(Ql.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Ql.BEFORE_ROTATE,t),e.emit(Ql.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($l.END,e),i&&t.emit(ed.END,i),s&&t.emit(Ql.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const rg=Uh.prototype,ag=new yt;function hg(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function lg(t,e){return Object.assign(Object.assign({},e),{scale:t})}rg.initType=function(t){tg.run(t,this)},rg.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:o}=ag.set(this.__world).addPoint(this.zoomLayer),r=i+n-this.width,a=s+o-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}},rg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const dg=vd.prototype;dg.createTransformer=function(){this.transformer=new og(this)},dg.move=function(t){this.transformer.move(t)},dg.zoom=function(t){this.transformer.zoom(t)},dg.rotate=function(t){this.transformer.rotate(t)},dg.transformEnd=function(){this.transformer.transformEnd()},dg.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 o=e.getScale?e.getScale(t,e):ng.getScale(t,e);if(1!==o)this.zoom(lg(o,t));else{const s=e.getMove?e.getMove(t,e):ng.getMove(t,e);i.snap&&A.round(s),this.move(hg(s,t))}},dg.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=sg.getData(e);Object.assign(t,o),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(lg(n,t)),this.move(hg(i,t))};const cg=ld.prototype,{abs:ug}=Math;function _g(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}cg.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=ug(i),o=ug(s),r=e?1:.1,a=this.interaction.m.dragAnimate&&this.canAnimate&&this.moving&&(n>r||o>r);if(a){const r="touch"===t.pointerType?3:1,a=70;n*(e=e?.95:r)>a?e=a/n:o*e>a&&(e=a/o),t=Object.assign({},t),A.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},cg.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},cg.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},cg.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=_t.maxX(r),d=_t.maxY(r),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,A.move(i,c,u),A.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)},cg.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Lt.add("viewport"),Lt.add("view"),Uh.prototype.zoom=function(t,e,i,s){this.killAnimate();const{zoomLayer:n}=this,o=this.canvas.bounds.clone().shrink(void 0!==e?e:30),r=new yt,a={x:o.x+o.width/2,y:o.y+o.height/2};let h;const{x:l,y:d,scaleX:c,scaleY:u}=n.__;if("string"==typeof t)switch(t){case"in":h=_g(c,"in");break;case"out":h=_g(c,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new yt(this.boxBounds)).height=0;break;case"fit-height":(t=new yt(this.boxBounds)).width=0}else"number"==typeof t&&(h=t/c);if(h)h=this.getValidScale(h),n.scaleOfWorld(a,h,h,!1,s);else if("object"==typeof t){const e={x:l,y:d,scaleX:c,scaleY:u},a=t instanceof Array;if(a||t.tag){const e=a?t:[t];r.setListWithFn(e,Io.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,o);r.set(n.getWorldBounds(e))}const{width:_,height:p}=r;let g=o.x-r.x,f=o.y-r.y;return i?(g+=Math.max((o.width-_)/2,0),f+=Math.max((o.height-p)/2,0)):(h=this.getValidScale(Math.min(o.width/_,o.height/p)),g+=(o.width-_*h)/2,f+=(o.height-p*h)/2,A.scaleOf(e,r,h),r.scaleOf(r,h),e.scaleX*=h,e.scaleY*=h),A.move(e,g,f),r.move(g,f),n.set(e,s),r}return n.worldBoxBounds};class pg extends Xh{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&&Ft.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 tl,this.scrollYBar=new tl),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:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new yt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),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_(Kl.DRAG,this.onDrag,this),e.on_(Kl.DRAG,this.onDrag,this),t.on_(Kl.END,this.onDragEnd,this),e.on_(Kl.END,this.onDragEnd,this),this.target.on_(ur.BEFORE,(()=>this.update(!0))),this.target.leafer.on_(lr.RESIZE,(()=>this.update()))]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Lt.add("scroll");class gg extends Bh{}function fg(t){return Tn(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,jn(this)}}})))}let yg=class extends pl{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};jt([no(gg)],yg.prototype,"__",void 0),jt([fg("angle")],yg.prototype,"endArrow",void 0),yg=jt([go()],yg);const{M:mg,L:vg,C:wg,Q:xg,O:bg}=re,{rotate:kg,copyFrom:Eg,scale:Bg}=A,Rg={},Sg={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case mg:case vg:Cg(t,l+1,e,i,s,n,o,r),l+=3;break;case wg:for(h=1;h<6;h+=2)Cg(t,l+h,e,i,s,n,o,r);l+=7;break;case xg:for(h=1;h<4;h+=2)Cg(t,l+h,e,i,s,n,o,r);l+=5;break;case bg:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){Sg.layout(t,0,0,1,1,e,i)}};function Cg(t,e,i,s,n,o,r,a){Eg(Rg,t[e],t[e+1]),r&&kg(Rg,r,a),n&&Bg(Rg,n,o),t[e]=i+Rg.x,t[e+1]=s+Rg.y}const{layout:Lg,rotate:Og}=Sg,{getAngle:Tg}=A,Pg={x:-.5},Ag={connect:Pg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Mg={connect:Pg,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Dg={connect:Pg,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]},Ig={connect:Pg,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]},Wg={offset:Pg,path:[...Dg.path],dashPath:[1,-2.5,0,2,-1,0]};Og(Wg.path,180,{x:-1.5,y:0});const Fg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},zg={connect:{x:.5},path:[...Fg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Ng={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]},Yg={path:[...Ng.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Hg=Ft.clone(Ng),Xg=Ft.clone(Yg);Og(Hg.path,45),Og(Xg.path,45);const Vg={angle:Ag,"angle-side":Mg,arrow:Ig,triangle:Dg,"triangle-flip":Wg,circle:zg,"circle-line":Fg,square:Yg,"square-line":Ng,diamond:Xg,"diamond-line":Hg,mark:{offset:Pg,path:[1,0,-2,2,0,2]}};function jg(t,e,i,s,n,o,r){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}="object"==typeof e?e:Vg[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&&Lg(g,p,0),Lg(g,s.x,s.y,n,n,Tg(i,s)),o.x=(_+p)*n,g}const{M:Ug,L:Gg,C:Zg,Q:Kg,Z:qg,N:Jg,D:$g,X:Qg,G:tf,F:ef,O:sf,P:nf,U:of}=re,{copy:rf,copyFrom:af,getDistancePoint:hf}=A,lf={},df={},cf={},uf={},_f={},pf={list:Vg,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:n,dashPattern:o,__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 Ug:case Gg:(d<2||h+6>=l)&&(af(_f,r[h+1],r[h+2]),!d&&c&&rf(df,_f)),h+=3;break;case Zg:1!==d&&h+7!==l||gf(r,uf,_f,h+3),h+=7;break;case Kg:1!==d&&h+5!==l||gf(r,uf,_f,h+1),h+=5;break;case qg:return;case Jg:h+=5;break;case $g:h+=9;break;case Qg:h+=6;break;case tf:h+=9;break;case ef:h+=5;break;case sf:h+=7;break;case nf:h+=4;break;case of:1!==d&&h+6!==l||gf(r,uf,_f,h+1),h+=6}if(d++,1===d&&a!==Ug)return;if(2===d&&c&&rf(cf,a===Gg?_f:uf),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=jg(t,i,cf,df,n,lf,!!o);o?d.push(...e):l.push(...e),lf.x&&(hf(df,cf,-lf.x,!0),l[1]=cf.x,l[2]=cf.y)}if(s&&"none"!==s){const e=jg(t,s,uf,_f,n,lf,!!o);if(o?d.push(...e):l.push(...e),lf.x){let t;switch(hf(_f,uf,-lf.x,!0),a){case Gg:t=h-3+1;break;case Zg:t=h-7+5;break;case Kg:t=h-5+3;break;case of:t=h-6+3}t&&ff(l,uf,t)}}}else rf(uf,_f)}}};function gf(t,e,i,s){af(e,t[s],t[s+1]),af(i,t[s+2],t[s+3])}function ff(t,e,i){t[i]=e.x,t[i+1]=e.y}Lt.add("arrow"),Hh.addAttr("startArrow","none",fg),Hh.addAttr("endArrow","none",fg),Object.assign(nh,pf),Object.assign(oh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:yf,NoAndSkip:mf,YesAndSkip:vf}=Yt,wf={},xf={},bf={};class kf{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"#":wf.id=t.substring(1),t=wf;break;case".":xf.className=t.substring(1),t=xf;break;default:bf.tag=t,t=bf}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,n=s instanceof Array;return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?Ft.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&&Co.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,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===yf||o===vf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<mf&&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_(tr.REMOVE,this.__onRemoveChild,this),this.target.on_(er.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 Ef=Hh.prototype;function Bf(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Ot.selector())}Ef.find=function(t,e){return Bf(this).getBy(t,this,!1,e)},Ef.findOne=function(t,e){return Bf(this).getBy(t,this,!0,e)},Lt.add("find"),Ot.finder=function(t){return new kf(t)};const{setPoint:Rf,addPoint:Sf,toBounds:Cf}=H;const Lf={syncExport(e,i,s){let n;this.running=!0;const o=fn.fileType(i),a=i.includes(".");s=fn.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=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=fn.isOpaqueImage(i)||x,k=new N;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:R,y:S,width:C,height:L}=new yt(t).scale(E.scaleX,E.scaleY);p&&(R+=p.x,S+=p.y,C=p.width,L=p.height);const O={matrix:k.scale(1/E.scaleX,1/E.scaleY).invert().translate(-R,-S).withScale(1/a*E.scaleX,1/h*E.scaleY)};let T,P=Ot.canvas({width:Math.floor(C),height:Math.floor(L),pixelRatio:B,smooth:v,contextSettings:w});if(_&&(T=e,T.__worldOpacity=0,e=c||e,O.bounds=P.bounds),P.save(),u&&void 0!==x){const t=e.get("fill");e.fill="",e.__render(P,O),e.fill=t}else e.__render(P,O);if(P.restore(),T&&T.__updateWorldOpacity(),g){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Sf(r,n,o):Rf(r={},n,o)),a++;const h=new yt;return Cf(r,h),h.scale(1/t.pixelRatio).ceil()}(P);const t=P,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};P=Ot.canvas(s),P.copyWorld(t,o,s)}if(y){const[t,e,i,s]=r.fourNumber(y),n=P,{width:o,height:a}=n;P=Ot.canvas({width:o+s+e,height:a+t+i,pixelRatio:B}),P.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:a})}b&&P.fillWorld(P.bounds,x||"#FFFFFF","destination-over"),m&&m(P);n={data:"canvas"===i?P:P.export(i,s),width:P.pixelWidth,height:P.pixelHeight,renderBounds:t,trimBounds:o}}return this.running=!1,n},export(e,i,s){return this.running=!0,function(t){Of||(Of=new wn);return new Promise((e=>{Of.add((()=>Ut(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((n=>new Promise((o=>{const r=()=>Ut(this,void 0,void 0,(function*(){if(!bn.isComplete)return t.requestRender(r);const a=Lf.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()}));e.updateLayout(),Tf(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))))}};let Of;function Tf(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>Tf(t)))}const Pf=se.prototype,Af=bt.get("@leafer-in/export");Pf.export=function(t,e){const{quality:i,blob:s}=fn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Pf.toBlob=function(e,i){return new Promise((s=>{t.origin.canvasToBolb(this.view,e,i).then((t=>{s(t)})).catch((t=>{Af.error(t),s(null)}))}))},Pf.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Pf.saveAs=function(e,i){return new Promise((s=>{t.origin.canvasSaveAs(this.view,e,i).then((()=>{s(!0)})).catch((t=>{Af.error(t),s(!1)}))}))},Lt.add("export"),Object.assign(dh,Lf),Hh.prototype.export=function(t,e){return dh.export(this,t,e)},Hh.prototype.syncExport=function(t,e){return dh.syncExport(this,t,e)};const Mf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Df={top:"flex-start",middle:"center",bottom:"flex-end"},If={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Wf(t,e,i){const{style:s}=t,{fill:n,padding:o,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=ih.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=ih.string("string"==typeof t?t:t.color);break;default:void 0!==e.r&&(i=ih.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,"object"==typeof h?(l=h.type,h.color&&(s.textDecorationColor=ih.string(h.color))):l=h,s.textDecoration=If[l],s.textTransform=Mf[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Df[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px","none"===r?s.whiteSpace="nowrap":"break"===r&&(s.wordBreak="break-all"),s.textIndent=(e.paraIndent||0)*i+"px",s.padding=o instanceof Array?o.map((t=>t*i+"px")).join(" "):(o||0)*i+"px",s.textOverflow="show"===a?"":"hide"===a?"clip":a}let Ff=class extends fp{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 Fl),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:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(Ul.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.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),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=window.getSelection().getRangeAt(0);i.deleteContents(),i.insertNode(e),i.setStartAfter(e),i.setEndAfter(e),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{x:i,y:s}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds;this.inBody||(i-=window.scrollX,s-=window.scrollY);let{width:n,height:o}=t,r=0,a=0;n*=e,o*=e;const h=t.__;if(h.__autoWidth&&h.autoSizeAlign)switch(n+=20,h.textAlign){case"center":r=-n/2;break;case"right":r=-n}if(h.__autoHeight&&h.autoSizeAlign)switch(o+=20,h.verticalAlign){case"middle":a=-o/2;break;case"bottom":a=-o}const{a:l,b:d,c:c,d:u,e:_,f:p}=new N(t.worldTransform).scale(1/e).translateInner(r,a),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${_},${p})`,g.left=i+"px",g.top=s+"px",g.width=n+"px",g.height=o+"px",this.isHTMLText||Wf(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),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};Ff=jt([rp()],Ff),Lt.add("text-editor","editor"),Fl.addAttr("textEditing",!1,Zn);class zf extends Mh{setText(t){this._text=t,this.__htmlChanged=!0}}let Nf=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:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" 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(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}};jt([no(zf)],Nf.prototype,"__",void 0),jt([zn("")],Nf.prototype,"text",void 0),jt([Mn("TextEditor")],Nf.prototype,"editInner",void 0),Nf=jt([go()],Nf),Lt.add("html");export{q as AlignHelper,Yt as Answer,Yl as App,G as AroundHelper,yg as Arrow,gg as ArrowData,vt as AutoBounds,Pe as BezierHelper,yt as Bounds,sr as BoundsEvent,_t as BoundsHelper,tl as Box,bh as BoxData,Sa as Branch,Fo as BranchHelper,Gr as BranchRender,Al as Canvas,Dh as CanvasData,Wt as CanvasManager,tr as ChildEvent,ih as ColorConvert,Ot as Creator,wd as Cursor,Ft as DataHelper,bt as Debug,V as Direction4,j as Direction9,Kl as DragEvent,ld as Dragger,Jl as DropEvent,Z_ as EditBox,N_ as EditDataHelper,j_ as EditPoint,L_ as EditSelect,B_ as EditSelectHelper,yp as EditTool,ap as EditToolCreator,gp as Editor,d_ as EditorEvent,dp as EditorGroupEvent,sp as EditorHelper,c_ as EditorMoveEvent,__ as EditorRotateEvent,u_ as EditorScaleEvent,p_ as EditorSkewEvent,hh as Effect,ol as Ellipse,Sh as EllipseData,Ye as EllipseHelper,Qo as Event,Dt as EventCreator,gr as Eventer,dh as Export,fn as FileHelper,lh as Filter,kf as Finder,el as Frame,Eh as FrameData,Xh as Group,xh as GroupData,Nf as HTMLText,zf as HTMLTextData,xd as HitCanvasManager,Tl as Image,Mh as ImageData,ir as ImageEvent,En as ImageManager,e as IncrementId,fp as InnerEditor,lp as InnerEditorEvent,vd as InteractionBase,sd as InteractionHelper,id as KeyEvent,Xl as Keyboard,cr as LayoutEvent,Ua as Layouter,ya as Leaf,Vr as LeafBounds,Io as LeafBoundsHelper,Nt as LeafData,Lr as LeafDataProxy,Rr as LeafEventer,Co as LeafHelper,$o as LeafLayout,La as LeafLevelList,Ca as LeafList,Ir as LeafMatrix,jr as LeafRender,Uh as Leafer,Ta as LeaferCanvas,se as LeaferCanvasBase,kh as LeaferData,_r as LeaferEvent,Cn as LeaferImage,tg as LeaferTypeCreator,pl as Line,Bh as LineData,kp as LineEditTool,r as MathHelper,N as Matrix,x as MatrixHelper,$l as MoveEvent,sg as MultiTouchHelper,ql as MyDragEvent,Pl as MyImage,Gl as MyPointerEvent,he as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,oh as Paint,ah as PaintGradient,rh as PaintImage,zl as Path,nh as PathArrow,pf as PathArrowModule,on as PathBounds,Zi as PathCommandDataHelper,re as PathCommandMap,Bi as PathConvert,un as PathCorner,cs as PathCreator,Oh as PathData,Rs as PathDrawer,ne as PathHelper,Sg as PathMatrixHelper,ue as PathNumberCommandLengthMap,ce as PathNumberCommandMap,Nl as Pen,Th as PenData,qa as Picker,t as Platform,Lt as Plugin,F as Point,A as PointHelper,Vl as PointerButton,Ul as PointerEvent,kl as Polygon,Ch as PolygonData,er as PropertyEvent,Gh as Rect,Rh as RectData,_e as RectHelper,Nh as RectRender,ur as RenderEvent,Za as Renderer,lr as ResizeEvent,bn as Resource,Ql as RotateEvent,Rt as Run,pg as ScrollBar,E_ as SelectArea,Ja as Selector,Ol as Star,Lh as StarData,ch as State,wt as StringNumberMap,k_ as Stroker,td as SwipeEvent,vn as TaskItem,wn as TaskProcessor,Fl as Text,eh as TextConvert,Ah as TextData,Ff as TextEditor,og as Transformer,uh as Transition,H as TwoPointBoundsHelper,Hh as UI,Ih as UIBounds,Pt as UICreator,vh as UIData,jl as UIEvent,Fh as UIRender,sh as UnitConvert,Ho as WaitHelper,dr as WatchEvent,Da as Watcher,ng as WheelEventHelper,ed as ZoomEvent,Jp as addViewport,$p as addViewportConfig,Gn as affectRenderBoundsType,Vn as affectStrokeBoundsType,fg as arrowType,Pn as attr,In as autoLayoutType,zn as boundsType,gn as canvasPatch,ie as canvasSizeAttrs,so as cursorType,no as dataProcessor,Mn as dataType,Tn as decorateLeafAttr,ro as defineDataProcessor,Ln as defineKey,An as defineLeafAttr,Yn as doBoundsType,jn as doStrokeType,$a as effectType,Ht as emptyData,eo as eraserType,u as getBoundsData,On as getDescriptor,_ as getMatrixData,c as getPointData,io as hitType,Vt as isEmptyData,Xt as isNull,oo as layoutProcessor,to as maskType,Nn as naturalBoundsType,Kn as opacityType,Hn as pathInputType,Xn as pathType,_n as pen,Dn as positionType,op as registerEditTool,rp as registerInnerEditor,go as registerUI,fo as registerUIEvent,Qa as resizeType,co as rewrite,uo as rewriteAble,Fn as rotationType,Wn as scaleType,Qn as sortType,Un as strokeType,Zn as surfaceType,mt as tempBounds,Y as tempMatrix,z as tempPoint,Aa as useCanvas,po as useModule,Oa as version,qn as visibleType,th as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=worker.module.min.js.map
|