@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.
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";const e={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(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=n;return e[t]?e[t]++:(e[t]=1,0)}},n=s,{round:o,pow:r,PI:a}=Math,h={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)),h.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?r(10,e):1e12;return-0===(t=o(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&&h.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:l,randColor:t=>`rgba(${l(255)},${l(255)},${l(255)},${t||1})`};function l(t){return Math.round(Math.random()*t)}const d=a/180,c=2*a,u=a/2;function p(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:y,acos:m,sqrt:v}=Math,{float:x}=h,w={};function b(){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 E={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),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:g,getWorld:b,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=y(e*=d),a=f(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*=d,t.a=s+o*i,t.b=n+r*i),e&&(e*=d,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*d,r=y(o),l=f(o);if(s||n){const e=s*d,i=n*d;t.a=(r+i*-l)*a,t.b=(l+i*r)*a,t.c=(e*r-l)*h,t.d=(r+e*l)*h}else t.a=r*a,t.b=l*a,t.c=-l*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:l}=t;let c,p,_,g,w,b=h,E=l;if(o||r){const t=n*a-o*r;if(r&&!s){c=v(n*n+o*o),p=t/c;const e=n/c;_=o>0?m(e):-m(e)}else{p=v(r*r+a*a),c=t/p;const e=r/p;_=u-(a>0?m(-e):-m(e))}const e=x(y(_)),i=f(_);c=x(c),p=x(p),g=e?x((r/p+i)/e/d,9):0,w=e?x((o/c-i)/e/d,9):0,_=x(_/d)}else c=n,p=a,_=g=w=0;return(e=i||e)&&(b+=e.x*n+e.y*r,E+=e.x*o+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:c,scaleY:p,rotation:_,skewX:g,skewY:w}},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=v(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){k.set(t)}},k=E,{toInnerPoint:B,toOuterPoint:T}=E,{sin:R,cos:L,abs:P,sqrt:S,atan2:C,min:O,round:M,PI:D}=Math,I={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?M(t.x-.5)+.5:M(t.x),t.y=e?M(t.y-.5)+.5:M(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=A.defaultPoint);const s=L(e*=d),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}=A;return F(i,t),B(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=A;return F(i,t),T(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=A;return F(i,t),A.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),B(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){B(e,t,i)},toOuterOf(t,e,i){T(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)=>W(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=P(i-t),o=P(s-e);return S(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>O(W(t,e,i,s),W(i,s,n,o)),getAngle:(t,e)=>z(t,e)/d,getRotation:(t,e,i,s)=>(s||(s=e),A.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/d),getRadianFrom(t,e,i,s,n,o,r,a){void 0===r&&(r=i,a=s);let h=C(e-s,t-i);const l=C(o-a,n-r)-h;return l<-D?l+c:l},getAtan2:(t,e)=>C(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=z(t,e);return(e=s?e:{}).x=t.x+L(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){A.reset(t)}},A=I,{getDistanceFrom:W,copy:F,getAtan2:z}=A;class H{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?I.copy(this,t):I.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new H(this)}move(t,e){return I.move(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleOf(t,e,i){return I.scaleOf(this,t,e,i),this}rotate(t,e){return I.rotate(this,t,e),this}rotateOf(t,e){return I.rotate(this,e,t),this}getRotation(t,e,i){return I.getRotation(this,t,e,i)}toInnerOf(t,e){return I.toInnerOf(this,t,e),this}toOuterOf(t,e){return I.toOuterOf(this,t,e),this}getCenter(t){return new H(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,i){return new H(I.getDistancePoint(this,t,e,i))}getAngle(t){return I.getAngle(this,t)}getAtan2(t){return I.getAtan2(this,t)}reset(){return I.reset(this),this}}const U=new H;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?E.copy(this,t):E.set(this,t,e,i,s,n,o),this}setWith(t){return E.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 E.translate(this,t,e),this}translateInner(t,e){return E.translateInner(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleWith(t,e){return E.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return E.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return E.scaleOfInner(this,t,e,i),this}rotate(t){return E.rotate(this,t),this}rotateOfOuter(t,e){return E.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return E.rotateOfInner(this,t,e),this}skew(t,e){return E.skew(this,t,e),this}skewOfOuter(t,e,i){return E.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return E.skewOfInner(this,t,e,i),this}multiply(t){return E.multiply(this,t),this}multiplyParent(t){return E.multiplyParent(this,t),this}divide(t){return E.divide(this,t),this}divideParent(t){return E.divideParent(this,t),this}invert(){return E.invert(this),this}invertWith(){return E.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){E.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){E.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return E.setLayout(this,t,e,i),this}getLayout(t,e,i){return E.getLayout(this,t,e,i)}withScale(t,e){return E.withScale(this,t,e)}reset(){E.reset(this)}}const Y=new N,X={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}=X,{tempPointBounds:j,setPoint:G,addPoint:Z,toBounds:K}=X,{toOuterPoint:q}=E,{float:J,fourNumber:$}=h,{floor:Q,ceil:tt}=Math;let et,it,st,nt;const ot={},rt={},at={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=$(i);s?ht.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):ht.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),ht.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),ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?dt(e,t):e=t,i?(e.offsetX=-(ht.maxX(i)-t.x),e.offsetY=-(ht.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e){I.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){I.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(ht.copy(ht.tempBounds,t),ht.toOuterOf(ht.tempBounds,e),ht.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ht.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 ot.x=t.x,ot.y=t.y,q(e,ot,rt),G(j,rt.x,rt.y),ot.x=t.x+t.width,q(e,ot,rt),Z(j,rt.x,rt.y),ot.y=t.y+t.height,q(e,ot,rt),Z(j,rt.x,rt.y),ot.x=t.x,q(e,ot,rt),Z(j,rt.x,rt.y),K(j,i)},toInnerOf(t,e,i){i||(i=t),ht.move(i,-e.e,-e.f),ht.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 N(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,i){const s={};return ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Q(t.x),t.y=Q(t.y),t.width=e>t.x?tt(t.width+e-t.x):tt(t.width),t.height=i>t.y?tt(t.height+i-t.y):tt(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=J(t.x,e),t.y=J(t.y,e),t.width=J(t.width,e),t.height=J(t.height,e)},add(t,e,i){et=t.x+t.width,it=t.y+t.height,st=e.x,nt=e.y,i||(st+=e.width,nt+=e.height),et=et>st?et:st,it=it>nt?it:nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=et-t.x,t.height=it-t.y},addList(t,e){ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){ht.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||dt(t,n)):lt(t,n));o&&ht.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?G(j,t.x,t.y):Z(j,t.x,t.y))),K(j,t)},setPoint(t,e){ht.set(t,e.x,e.y)},addPoint(t,e){lt(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=I.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=I.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=ht.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=ht.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=ht.tempToOuterOf(e,i)),!ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return et=s+o,it=n+r,st=t.x+t.width,nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,et=et<st?et:st,it=it<nt?it:nt,o=et-s,r=it-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){ht.copy(t,ht.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){ht.set(t)}},ht=at,{add:lt,copy:dt}=ht;class ct{get minX(){return at.minX(this)}get minY(){return at.minY(this)}get maxX(){return at.maxX(this)}get maxY(){return at.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?at.copy(this,t):at.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 ct(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,i){return at.scaleOf(this,t,e,i),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}getFitMatrix(t,e){return at.getFitMatrix(this,t,e)}spread(t,e){return at.spread(this,t,e),this}shrink(t,e){return at.shrink(this,t,e),this}ceil(){return at.ceil(this),this}unsign(){return at.unsign(this),this}float(t){return at.float(this,t),this}add(t){return at.add(this,t),this}addList(t){return at.setList(this,t,!0),this}setList(t){return at.setList(this,t),this}addListWithFn(t,e){return at.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return at.setListWithFn(this,t,e),this}setPoint(t){return at.setPoint(this,t),this}setPoints(t){return at.setPoints(this,t),this}addPoint(t){return at.addPoint(this,t),this}getPoints(){return at.getPoints(this)}hitPoint(t,e){return at.hitPoint(this,t,e)}hitRadiusPoint(t,e){return at.hitRadiusPoint(this,t,e)}hit(t,e){return at.hit(this,t,e)}includes(t,e){return at.includes(this,t,e)}intersect(t,e){return at.intersect(this,t,e),this}getIntersect(t,e){return new ct(at.getIntersectData(this,t,e))}isSame(t){return at.isSame(this,t)}isEmpty(){return at.isEmpty(this)}reset(){at.reset(this)}}const ut=new ct;class pt{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 ct(n,e,o||t.width-n-i,r||t.height-e-s)}}var _t,gt;t.Direction4=void 0,(_t=t.Direction4||(t.Direction4={}))[_t.top=0]="top",_t[_t.right=1]="right",_t[_t.bottom=2]="bottom",_t[_t.left=3]="left",t.Direction9=void 0,(gt=t.Direction9||(t.Direction9={}))[gt.topLeft=0]="topLeft",gt[gt.top=1]="top",gt[gt.topRight=2]="topRight",gt[gt.right=3]="right",gt[gt.bottomRight=4]="bottomRight",gt[gt.bottom=5]="bottom",gt[gt.bottomLeft=6]="bottomLeft",gt[gt.left=7]="left",gt[gt.center=8]="center",gt[gt["top-left"]=0]="top-left",gt[gt["top-right"]=2]="top-right",gt[gt["bottom-right"]=4]="bottom-right",gt[gt["bottom-left"]=6]="bottom-left";const ft=[{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}];ft.forEach((t=>t.type="percent"));const yt={directionData:ft,tempPoint:{},get:mt,toPoint(t,e,i,s,n){const o=mt(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 mt(e){return"string"==typeof e?ft[t.Direction9[e]]:e}const{toPoint:vt}=yt,xt={toPoint(t,e,i,s,n){vt(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:bt}=h;class Et{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Et(t)}static set filter(t){this.filterList=kt(t)}static set exclude(t){this.excludeList=kt(t)}static drawRepaint(t,e){const i=bt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Et.showBounds,n=t.__nowWorld,o=bt();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(Bt.enable){if(Bt.filterList.length&&Bt.filterList.every((t=>t!==this.name)))return;if(Bt.excludeList.length&&Bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Bt.enable&&this.warn(...t)}warn(...t){Bt.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}Et.filterList=[],Et.excludeList=[],Et.showWarn=!0;const Bt=Et,Tt=Et.get("RunTime"),Rt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Lt.currentId=Lt.idMap[i]=e?performance.now():Date.now(),Lt.currentName=Lt.nameMap[i]=t,Lt.nameToIdMap[t]=i,i},end(t,e){const i=Lt.idMap[t],s=Lt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Lt.idMap[t]=Lt.nameMap[t]=Lt.nameToIdMap[s]=void 0,Tt.log(s,n,"ms")},endOfName(t,e){const i=Lt.nameToIdMap[t];void 0!==i&&Lt.end(i,e)}},Lt=Rt,Pt=[],St={list:{},add(t,...e){this.list[t]=!0,Pt.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((()=>Pt.forEach((t=>St.has(t,!0)))));const Ct=Et.get("UICreator"),Ot={list:{},register(t){const{__tag:e}=t.prototype;Mt[e]&&Ct.repeat(e),Mt[e]=t},get(t,e,i,s,n,o){Mt[t]||Ct.error("not register "+t);const r=new Mt[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),n&&(r.width=n),o&&(r.height=o)),r}},{list:Mt}=Ot,Dt=Et.get("EventCreator"),It={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(At[e]&&Dt.repeat(e),At[e]=t)}))},changeName(t,e){const i=At[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,At[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new At[t](...e)},{nameList:At}=It;class Wt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,n=s.length;i<n;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const n=i.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 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}},{assign:zt}=Ft;class Ht{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 Ut;t.Answer=void 0,(Ut=t.Answer||(t.Answer={}))[Ut.No=0]="No",Ut[Ut.Yes=1]="Yes",Ut[Ut.NoAndSkip=2]="NoAndSkip",Ut[Ut.YesAndSkip=3]="YesAndSkip";const Nt={};function Yt(t){return null==t}function Xt(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 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=[];class Jt{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}}Vt([Gt("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),Vt([Gt("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),Vt([Gt("globalAlpha")],Jt.prototype,"opacity",void 0),Vt([Gt()],Jt.prototype,"fillStyle",void 0),Vt([Gt()],Jt.prototype,"strokeStyle",void 0),Vt([Gt("lineWidth")],Jt.prototype,"strokeWidth",void 0),Vt([Gt("lineCap")],Jt.prototype,"strokeCap",void 0),Vt([Gt("lineJoin")],Jt.prototype,"strokeJoin",void 0),Vt([Gt("lineDashOffset")],Jt.prototype,"dashOffset",void 0),Vt([Gt()],Jt.prototype,"miterLimit",void 0),Vt([Gt()],Jt.prototype,"shadowBlur",void 0),Vt([Gt()],Jt.prototype,"shadowColor",void 0),Vt([Gt()],Jt.prototype,"shadowOffsetX",void 0),Vt([Gt()],Jt.prototype,"shadowOffsetY",void 0),Vt([Gt()],Jt.prototype,"filter",void 0),Vt([Gt()],Jt.prototype,"font",void 0),Vt([Gt()],Jt.prototype,"fontKerning",void 0),Vt([Gt()],Jt.prototype,"fontStretch",void 0),Vt([Gt()],Jt.prototype,"fontVariantCaps",void 0),Vt([Gt()],Jt.prototype,"textAlign",void 0),Vt([Gt()],Jt.prototype,"textBaseline",void 0),Vt([Gt()],Jt.prototype,"textRendering",void 0),Vt([Gt()],Jt.prototype,"wordSpacing",void 0),Vt([Gt()],Jt.prototype,"letterSpacing",void 0),Vt([Gt()],Jt.prototype,"direction",void 0),Vt([Kt()],Jt.prototype,"setTransform",null),Vt([Kt()],Jt.prototype,"resetTransform",null),Vt([Kt()],Jt.prototype,"getTransform",null),Vt([Kt()],Jt.prototype,"save",null),Vt([Kt()],Jt.prototype,"restore",null),Vt([Kt()],Jt.prototype,"translate",null),Vt([Kt()],Jt.prototype,"scale",null),Vt([Kt()],Jt.prototype,"rotate",null),Vt([Kt()],Jt.prototype,"fill",null),Vt([Kt()],Jt.prototype,"stroke",null),Vt([Kt()],Jt.prototype,"clip",null),Vt([Kt()],Jt.prototype,"fillRect",null),Vt([Kt()],Jt.prototype,"strokeRect",null),Vt([Kt()],Jt.prototype,"clearRect",null),Vt([Kt()],Jt.prototype,"beginPath",null),Vt([Kt()],Jt.prototype,"moveTo",null),Vt([Kt()],Jt.prototype,"lineTo",null),Vt([Kt()],Jt.prototype,"bezierCurveTo",null),Vt([Kt()],Jt.prototype,"quadraticCurveTo",null),Vt([Kt()],Jt.prototype,"closePath",null),Vt([Kt()],Jt.prototype,"arc",null),Vt([Kt()],Jt.prototype,"arcTo",null),Vt([Kt()],Jt.prototype,"ellipse",null),Vt([Kt()],Jt.prototype,"rect",null),Vt([Kt()],Jt.prototype,"roundRect",null),Vt([Kt()],Jt.prototype,"createConicGradient",null),Vt([Kt()],Jt.prototype,"createLinearGradient",null),Vt([Kt()],Jt.prototype,"createPattern",null),Vt([Kt()],Jt.prototype,"createRadialGradient",null),Vt([Kt()],Jt.prototype,"fillText",null),Vt([Kt()],Jt.prototype,"measureText",null),Vt([Kt()],Jt.prototype,"strokeText",null);const{copy:$t,multiplyParent:Qt}=E,{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(t,i){super(),this.size={},this.worldTransform={},t||(t=ee),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:n,height:o,pixelRatio:r}=t;this.autoLayout=!n||!o,this.size.pixelRatio=r|e.devicePixelRatio,this.config=t,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 ct(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,at.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(ut.x,ut.y,ut.width,ut.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,ut.x,ut.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(ut.x,ut.y,ut.width,ut.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ut.x,ut.y,ut.width,ut.height),i&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ut.x,ut.y,ut.width,ut.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ut.x,ut.y,ut.width,ut.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){ut.set(t),i&&ut.intersect(this.bounds),ut.scale(this.pixelRatio),e&&ut.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:n}=this,o=this.manager?this.manager.get(s):i.canvas(Object.assign({},s));return o.save(),t&&($t(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(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 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 pe={drawRoundRect(t,e,i,s,n,o){const r=h.fourNumber(o,Math.min(s/2,n/2)),a=e+s,l=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,l,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,l,e,l,r[2]):t.lineTo(a,l),r[3]?t.arcTo(e,l,e,i,r[3]):t.lineTo(e,l),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:_e,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:xe,pow:we}=Math,{setPoint:be,addPoint:Ee}=X,{set:ke,toNumberPoints:Be}=I,{M:Te,L:Re,C:Le,Q:Pe,Z:Se}=re,Ce={},Oe={points(t,e,i,s){let n=Be(e);if(t.push(Te,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],_=xe(we(r-e,2)+we(a-o,2)),g=xe(we(h-r,2)+we(l-a,2)),f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=o,d=r-_*h,c=a-_*l,2===i?s||t.push(Pe,d,c,r,a):t.push(Le,u,p,d,c,r,a),u=r+g*h,p=a+g*l;s||t.push(Pe,u,p,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(Se)},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=[],pe.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,h,l,p){const _=s-e,g=n-i,f=o-s,y=r-n;let m=fe(g,_),v=fe(y,f),x=v-m;if(x<0&&(x+=c),x===ve||me(_+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Re,s,n),h&&(be(h,e,i),Ee(h,s,n)),p&&ke(p,e,i),void(l&&ke(l,s,n));const w=_*y-f*g<0,b=w?-1:1,E=a/ge(x/2),k=s+E*ge(m+x/2+u*b),B=n+E*_e(m+x/2+u*b);return m-=u*b,v-=u*b,Ie(t,k,B,a,a,0,m/d,v/d,w,h,l,p)},arc:(t,e,i,s,n,o,r,a,h,l)=>Ie(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,p,_){const g=o*d,f=_e(g),y=ge(g);let m=r*d,v=a*d;m>ve&&(m-=c),v<0&&(v+=c);let x=v-m;x<0?x+=c:x>c&&(x-=c),h&&(x-=c);const w=ye(me(x/u)),b=x/w,E=_e(b/4),k=8/3*E*E/_e(b/2);v=m+b;let B,T,R,L,P,S,C,O,M=ge(m),D=_e(m),I=R=y*s*M-f*n*D,A=L=f*s*M+y*n*D,W=e+R,F=i+L;t&&t.push(t.length?Re:Te,W,F),l&&be(l,W,F),_&&ke(_,W,F);for(let o=0;o<w;o++)B=ge(v),T=_e(v),R=y*s*B-f*n*T,L=f*s*B+y*n*T,P=e+I-k*(y*s*D+f*n*M),S=i+A-k*(f*s*D-y*n*M),C=e+R+k*(y*s*T+f*n*B),O=i+L+k*(f*s*T-y*n*B),t&&t.push(Le,P,S,C,O,e+R,i+L),l&&De(e+I,i+A,P,S,C,O,e+R,i+L,l,!0),I=R,A=L,M=B,D=T,m=v,v+=b;p&&ke(p,e+R,i+L)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(Le,(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){De(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,x=i,w=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=o,b=a),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,p=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?Ee(h,t,e):be(h,t,e),Ee(h,r,a);for(let l=0,c=d.length;l<c;l++)Me(d[l],t,e,i,s,n,o,r,a,Ce),Ee(h,Ce.x,Ce.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,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*o+_*a,l.y=c*i+u*n+p*r+_*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Me(t,e,i,s,n,o,r,a,h,l),l}},{getPointAndSet:Me,toTwoPointBounds:De,ellipse:Ie}=Oe,{sin:Ae,cos:We,sqrt:Fe,atan2:ze}=Math,{ellipse:He}=Oe,Ue={ellipticalArc(t,i,s,n,o,r,a,h,l,u,p){const _=(l-i)/2,g=(u-s)/2,f=r*d,y=Ae(f),m=We(f),v=-m*_-y*g,x=-m*g+y*_,w=n*n,b=o*o,E=x*x,k=v*v,B=w*b-w*E-b*k;let T=0;if(B<0){const t=Fe(1-B/(w*b));n*=t,o*=t}else T=(a===h?-1:1)*Fe(B/(w*E+b*k));const R=T*n*x/o,L=-T*o*v/n,P=ze((x-L)/o,(v-R)/n),S=ze((-x-L)/o,(-v-R)/n);let C=S-P;0===h&&C>0?C-=c:1===h&&C<0&&(C+=c);const O=i+_+m*R-y*L,M=s+g+y*R+m*L,D=C<0?1:0;p||e.ellipseToCurve?He(t,O,M,n,o,r,P/d,S/d,D):n!==o||r?t.push(re.G,O,M,n,o,r,P/d,S/d,D):t.push(re.O,O,M,n,P/d,S/d,D)}},{M:Ne,m:Ye,L:Xe,l:Ve,H:je,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:pi,P:_i,U:gi}=re,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:xi,quadraticCurveTo:wi}=Oe,{ellipticalArc:bi}=Ue,Ei=Et.get("PathConvert"),ki={},Bi={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=ue[s],a+=s===n?" ":ce[s];for(let s=1;s<i;s++)a+=h.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},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&&(Ti.dot&&(Ri(r,o),o=""),Ti.dot++),"0"===o&&"."!==s&&(Ri(r,o),o=""),o+=s):re[s]?(o&&(Ri(r,o),o=""),Ti.name=re[s],Ti.length=ae[s],Ti.index=0,Ri(r,Ti.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?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 p=[];for(;c<u;){switch(n=t[c],n){case Ye:t[c+1]+=a,t[c+2]+=h;case Ne:a=t[c+1],h=t[c+2],p.push(Ne,a,h),c+=3;break;case Ge:t[c+1]+=a;case je:a=t[c+1],p.push(Xe,a,h),c+=2;break;case Ke:t[c+1]+=h;case Ze:h=t[c+1],p.push(Xe,a,h),c+=2;break;case Ve:t[c+1]+=a,t[c+2]+=h;case Xe:a=t[c+1],h=t[c+2],p.push(Xe,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],p.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],p.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?wi(p,a,h,i,s,t[c+1],t[c+2]):p.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?wi(p,a,h,i,s,t[c+3],t[c+4]):p.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(p,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:p.push(ri),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(p,a,h,t[c+3],t[c+4]):Li(p,t,c,5),c+=5;break;case li:a=t[c+1],h=t[c+2],e?yi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Li(p,t,c,9),c+=9;break;case di:a=t[c+1],h=t[c+2],e?yi(p,a,h,t[c+3],t[c+4],t[c+5]):Li(p,t,c,6),c+=6;break;case ci:xi(e?p:Li(p,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 ui:e?xi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Li(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pi:vi(e?p:Li(p,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?vi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Li(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?p:Li(p,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 Ei.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ne,t.x,t.y);break;case"L":e.push(Xe,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){Ti.index===Ti.length&&(Ti.index=1,t.push(Ti.name)),t.push(Number(e)),Ti.index++,Ti.dot=0}},{current:Ti,pushData:Ri,copyData:Li}=Bi,{M:Pi,L:Si,C:Ci,Q:Oi,Z:Mi,N:Di,D:Ii,X:Ai,G:Wi,F:Fi,O:zi,P:Hi,U:Ui}=re,{getMinDistanceFrom:Ni,getRadianFrom:Yi}=I,{tan:Xi,min:Vi,abs:ji}=Math,Gi={},Zi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Pi,e,i)},lineTo(t,e,i){t.push(Si,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Ci,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Oi,e,i,s,n)},closePath(t){t.push(Mi)},rect(t,e,i,s,n){t.push(Di,e,i,s,n)},roundRect(t,e,i,s,n,o){if("number"==typeof o)t.push(Ai,e,i,s,n,o);else{const r=h.fourNumber(o);r?t.push(Ii,e,i,s,n,...r):t.push(Di,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(Hi,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=Ni(r,a,e,i,s,n);o=Vi(o,Vi(t/2,t/2*ji(Xi(Yi(r,a,e,i,s,n)/2))))}t.push(Ui,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,a,h){Oe.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(Pi,Gi.x,Gi.y),Ki(t,e,i,s,n,o,r,a,h)},drawArc(t,e,i,s,n,o,r){Oe.arc(null,e,i,s,void 0===n?0:n,void 0===o?360:o,r,null,null,Gi),t.push(Pi,Gi.x,Gi.y),qi(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){Oe.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:ps,C:_s,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:xs,F:ws,O:bs,P:Es,U:ks}=re,Bs=Et.get("PathDrawer"),Ts={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 ps: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 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 xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*d,e[s+6]*d,e[s+7]*d,e[s+8]),s+=9;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,c,!1),s+=5;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*d,e[s+5]*d,e[s+6]),s+=7;break;case Es:t.arc(e[s+1],e[s+2],e[s+3],0,c,!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 Bs.error(`command: ${i} [index:${s}]`,e)}}},{M:Rs,L:Ls,C:Ps,Q:Ss,Z:Cs,N:Os,D:Ms,X:Ds,G:Is,F:As,O:Ws,P:Fs,U:zs}=re,{toTwoPointBounds:Hs,toTwoPointBoundsByQuadraticCurve:Us,arcTo:Ns,arc:Ys,ellipse:Xs}=Oe,{addPointBounds:Vs,copy:js,addPoint:Gs,setPoint:Zs,addBounds:Ks,toBounds:qs}=X,Js=Et.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===Cs||r===Ps||r===Ss?Zs(e,h,l):Zs(e,t[a+1],t[a+2])),r){case Rs:case Ls:h=t[a+1],l=t[a+2],Gs(e,h,l),a+=3;break;case Ps:n=t[a+5],o=t[a+6],Hs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,en),Vs(e,en),h=n,l=o,a+=7;break;case Ss:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],Us(h,l,i,s,n,o,en),Vs(e,en),h=n,l=o,a+=5;break;case Cs:a+=1;break;case Os:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ms:case Ds:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=r===Ms?9:6;break;case Is:Xs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],en,nn),0===a?js(e,en):Vs(e,en),h=nn.x,l=nn.y,a+=9;break;case As: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:Ys(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],en,nn),0===a?js(e,en):Vs(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:Ns(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],en,nn),0===a?js(e,en):Vs(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}=I,{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,p=0;const _=t.length,g=[];for(;o<_;)switch(s=t[o],s){case rn:h=u=t[o+1],l=p=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,p);break;case hn:cn(g,r,a,h,l,e,u,p);break;default:g.push(an,r,a)}u=r,p=a;break;case hn:cn(g,h,l,d,c,e,u,p),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 pn=new cs,{drawRoundRect:_n}=pe;function gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){_n(this,t,e,i,s,n)})}(t)}const fn={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=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.opacityTypes.forEach((t=>yn.upperCaseTypeMap[t]=t.toUpperCase()));const mn=Et.get("TaskProcessor");class vn{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.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){mn.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class xn{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 wn=Et.get("Resource"),bn={tasker:new xn,map:{},get isComplete(){return En.tasker.isComplete},set(t,e){En.map[t]&&wn.repeat(t),En.map[t]=e},get:t=>En.map[t],remove(t){const e=En.map[t];e&&(e.destroy&&e.destroy(),delete En.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,s){let n;return"string"==typeof e?n={url:e}:e.url||(n={url:t,view:e}),n&&(s&&(n.format=s),e=i.image(n)),En.set(t,e),e},destroy(){En.map={}}},En=bn,kn={maxRecycled:10,recycledList:[],patternTasker:new xn,get(t){let e=bn.get(t.url);return e||bn.set(t.url,e=i.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)},hasOpacityPixel:t=>fn.opacityTypes.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=kn,{IMAGE:Tn,create:Rn}=s;class Ln{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Rn(Tn),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(t,i){return this.loading||(this.loading=!0,bn.tasker.add((()=>jt(this,void 0,void 0,(function*(){return yield e.origin.loadImage(this.url).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(t,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(t,i,s,n){if(t||(t=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=e.origin.createCanvas(t,i),r=o.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,i,s,n){const o=e.canvas.createPattern(t,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 Pn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Sn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Cn(t,e){return(i,s)=>Mn(i,s,t,e&&e(s))}function On(t){return t}function Mn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Pn(t,e,Object.assign(n,s||{})),oo(t,e,i)}function Dn(t){return Cn(t)}function In(t,e){return Cn(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function An(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Un(this))}})))}function Wn(t,e){return Cn(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Fn(t,e){return Cn(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function zn(t,e){return Cn(t,(t=>({set(i){this.__setAttr(t,i,e)&&Un(this)}})))}function Hn(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(Un(this),this.__.__removeNaturalSize())}})))}function Un(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Nn(t){return Cn(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Un(this)}})))}const Yn=zn;function Xn(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&Vn(this)}})))}function Vn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Un(t)}const jn=Xn;function Gn(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Zn(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Kn(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Jn(this)}})))}function qn(t){return Cn(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||Un(t))}function Qn(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function to(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function eo(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function io(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Et.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function so(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function no(t){return(e,i)=>{Pn(e,"__DataProcessor",{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=Xt(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=Sn(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[o]&&(r.set=s[o],delete s[o]),Pn(s,e,r)}const ro=new Et("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 po(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){Sn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function _o(){return t=>{Ot.register(t)}}function go(){return t=>{It.register(t)}}setTimeout((()=>uo(!0)));const{copy:fo,toInnerPoint:yo,toOuterPoint:mo,scaleOfOuter:vo,rotateOfOuter:xo,skewOfOuter:wo,multiplyParent:bo,divideParent:Eo,getLayout:ko}=E,Bo={},{round:To}=Math,Ro={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),So(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Po(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++)Co(e[t])}},updateAllChange(t){if(Co(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Oo(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),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=To(e),i=To(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,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)Lo.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){Lo.rotateOfLocal(t,Mo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;fo(Bo,n),xo(Bo,e,i),t.origin||t.around?Lo.setTransform(t,Bo,!1,s):t.set({x:t.x+Bo.e-n.e,y:t.y+Bo.f-n.f,rotation:h.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Lo.skewOfLocal(t,Mo(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){fo(Bo,t.__localMatrix),wo(Bo,e,i,s),Lo.setTransform(t,Bo,n,o)},transformWorld(t,e,i,s){fo(Bo,t.worldTransform),bo(Bo,e),t.parent&&Eo(Bo,t.parent.worldTransform),Lo.setTransform(t,Bo,i,s)},transform(t,e,i,s){fo(Bo,t.localTransform),bo(Bo,e),Lo.setTransform(t,Bo,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Lo.getInnerOrigin(t,n.origin),r=ko(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){at.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Lo.getInnerOrigin(t,n.origin);I.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,Lo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>I.tempToOuterOf(Lo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(fo(Bo,t.worldTransform),Eo(Bo,e.worldTransform),i?Bo:Object.assign({},Bo)),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=Ro,{updateAllMatrix:Po,updateMatrix:So,updateAllWorldOpacity:Co,updateAllChange:Oo}=Lo;function Mo(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const Do={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:Io}=Ro,Ao={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++)Io(s[t]);e&&e===i||Io(i)}}},{pushAllChildBranch:Wo,pushAllBranchStack:Fo,updateBoundsByBranchStack:zo}=Ao,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:Uo}=Ro,{toOuterOf:No,getPoints:Yo,copy:Xo}=at,Vo="_localContentBounds",jo="_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 No(this.contentBounds,this.leaf.__localMatrix,this[Vo]||(this[Vo]={})),this[Vo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return No(this.contentBounds,this.leaf.__world,this[jo]||(this[jo]={})),this[jo]}get worldBoxBounds(){return No(this.boxBounds,this.leaf.__world,this[Go]||(this[Go]={})),this[Go]}get worldStrokeBounds(){return No(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:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():t.start();else{let t=this.leaf;for(;t.parent&&!t.parent.leafer;)t=t.parent;const i=t;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.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 E.defaultMatrix;case"page":t=e.zoomLayer;default:return Uo(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 ct(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=E.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=Uo(s,e,!0)}if(r||(r=E.getLayout(o)),Xo(r,a),I.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=Yo(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&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.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&&It.has(t)&&(e=It.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:pr,emitEvent:_r,hasEvent:gr,destroy:fr}=rr.prototype,yr={on:hr,on_:lr,off:dr,off_:cr,once:ur,emit:pr,emitEvent:_r,hasEvent:gr,destroyEventer:fr},{isFinite:mr}=Number,vr=Et.get("setAttr"),xr={__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:wr,multiplyParent:br,translateInner:Er,defaultWorld:kr}=E,{toPoint:Br,tempPoint:Tr}=yt,Rr={__updateWorldMatrix(){br(this.__local||this.__layout,this.parent?this.parent.__world:kr,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)&&(wr(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,Tr),Er(e,-Tr.x,-Tr.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Lr,updateAllMatrix:Pr}=Ro,{updateBounds:Sr}=Ao,{toOuterOf:Cr,copyAndSpread:Or,copy:Mr}=at,{toBounds:Dr}=on,Ir={__updateWorldBounds(){Cr(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(),Cr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Cr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Cr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Dr(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(),Pr(this),Sr(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Pr(this),Sr(this,this))):Lr(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Or(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Or(t.renderBounds,t.boxBounds,t.renderSpread):Mr(t.renderBounds,t.strokeBounds)}},Ar={__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);Et.showBounds&&Et.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}=Do,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:Hr}=s,{toInnerPoint:Ur,toOuterPoint:Nr,multiplyParent:Yr}=E,{toOuterOf:Xr}=at,{copy:Vr,move:jr}=I,{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}=Ro;t.Leaf=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 Ht}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=Hr(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 Yr(i,t.matrix,e,void 0,i),Xr(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 Xr(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Vr(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Vr(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ur(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Nr(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 jr(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 jr(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 St.need("path")}getMotionPoint(t){return St.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=zn),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)}},t.Leaf=Vt([po(xr),po(Rr),po(Ir),po(yr),po(Ar)],t.Leaf);const{setListWithFn:ha}=at,{sort:la}=Ao,{localBoxBounds:da,localStrokeBounds:ca,localRenderBounds:ua,maskLocalBoxBounds:pa,maskLocalStrokeBounds:_a,maskLocalRenderBounds:ga}=Do,fa=new Et("Branch");t.Branch=class extends t.Leaf{__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(){ha(this.__layout.boxBounds,this.children,this.__hasMask?pa:da)}__updateStrokeBounds(){ha(this.__layout.strokeBounds,this.children,this.__hasMask?_a:ca)}__updateRenderBounds(){ha(this.__layout.renderBounds,this.children,this.__hasMask?ga:ua)}__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(la),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return fa.warn("add self or destroyed");const i=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),i||e++}));t=Ot.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(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)}},t.Branch=Vt([po(Fr)],t.Branch);class ya{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 ya;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 ma{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}}class va extends se{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.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:xa}=fn;function wa(t,s){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,n)=>{t.convertToBlob({type:xa(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:xa(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise((t=>t())),download(t,e){},loadImage:t=>new Promise(((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then((t=>{i(t)})).catch((t=>{s(t)}))},n.onerror=t=>s(t),n.send()}))},e.canvas=i.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(i,{canvas:(t,e)=>new va(t,e),image:t=>new Ln(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Pn(e,"devicePixelRatio",{get:()=>1});const{userAgent:ba}=navigator;ba.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):ba.indexOf("Safari")>-1&&-1===ba.indexOf("Chrome")&&(e.fullImageShadow=!0),ba.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):ba.indexOf("Mac")>-1?e.os="Mac":ba.indexOf("Linux")>-1&&(e.os="Linux");class Ea{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ya;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 ya,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(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 ya,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:ka,updateBounds:Ba,updateAllWorldOpacity:Ta}=Ro,{pushAllChildBranch:Ra,pushAllParent:La}=Ao;const{worldBounds:Pa}=Do;class Sa{constructor(t){this.updatedBounds=new ct,this.beforeBounds=new ct,this.afterBounds=new ct,t instanceof Array&&(t=new ya(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:Ca,updateAllChange:Oa}=Ro,Ma=Et.get("Layouter");class Da{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ma,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.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){Ma.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ma.warn("layouting"):this.times>3?Ma.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?(ka(t,!0),e.add(t),t.isBranch&&Ra(t,e),La(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),La(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||Ba(s[t])}Ba(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&Ta(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 ya(e));e.emitEvent(new ir(i,o,this.times)),Da.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){Ca(t,!0),t.isBranch?Ao.updateBounds(t):Ro.updateBounds(t),Oa(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Sa([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Sa(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 Ia=Et.get("Renderer");class Aa{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(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 ct,Ia.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,Ia.error(t)}Ia.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ia.warn("rendering");if(this.times>3)return Ia.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new ct,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 ct(s);i.save(),s.spread(Aa.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),Et.showRepaint&&Et.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 ct;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.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 ct(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 ct(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||Ia.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)}}Aa.clipSpread=10;const{hitRadiusPoint:Wa}=at;class Fa{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 ya(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 ya;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||Ro.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 ya;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 ya;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 ya,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||Wa(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 za{constructor(t,e){this.config={},e&&(this.config=Ft.default(e,this.config)),this.picker=new Fa(this.target=t,this),this.finder=i.finder&&i.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):St.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ha(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Ua(t){return Cn(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Na(){return(t,e)=>{const i="_"+e;Pn(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(i,{watcher:(t,e)=>new Ea(t,e),layouter:(t,e)=>new Da(t,e),renderer:(t,e,i)=>new Aa(t,e,i),selector:(t,e)=>new za(t,e)}),e.layout=Da.fullLayout;const Ya={},Xa={},Va={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},ja={},Ga={},Za={},Ka={},qa={},Ja={apply(){St.need("filter")}},$a={},Qa={setStyleName:()=>St.need("state"),set:()=>St.need("state")},th={list:{},register(t,e){th.list[t]=e},get:t=>th.list[t]},{parse:eh,objectToCanvasData:ih}=Bi,sh={},nh=Et.get("UIData");class oh extends Ht{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,nh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,nh.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=sh)}}else this.__isFills&&(this.__removeInput("fill"),Za.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=sh)}}else this.__isStrokes&&(this.__removeInput("stroke"),Za.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?eh(t):ih(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){rh(this,"shadow",t)}setInnerShadow(t){rh(this,"innerShadow",t)}setFilter(t){rh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ga.compute("fill",this.__leaf),e&&Ga.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function rh(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 ah extends oh{}class hh extends ah{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 lh extends ah{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class dh extends hh{}class ch extends oh{}class uh extends oh{get __boxStroke(){return!this.__pathInputed}}class ph extends oh{get __boxStroke(){return!this.__pathInputed}}class _h extends oh{}class gh extends oh{}class fh extends oh{get __pathInputed(){return 2}}class yh extends ah{}const mh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class vh extends oh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=mh[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Ot.get("Rect",0);const 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 xh extends uh{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 wh extends uh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const 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+=Ja.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}},Eh={__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){kh(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=Ga.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?Ga.fills(n,this,t):Ga.fill(n,this,t)),r&&this.__drawAfterFill(t,e),l&&qa.innerShadow(this,t,a),o&&(s.__isStrokes?Ga.strokes(o,this,t):Ga.stroke(o,this,t)),d&&Ja.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else n&&(s.__isFills?Ga.fills(n,this,t):Ga.fill(n,this,t)),r&&this.__drawAfterFill(t,e),o&&(s.__isStrokes?Ga.strokes(o,this,t):Ga.stroke(o,this,t))}else s.__pathInputed?kh(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?Ga.fills(n,this,t):Ga.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),o&&!s&&(this.__.__pixelStroke?Ga.strokes(o,this,t):Ga.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 kh(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o}=t.__;t.__drawRenderPath(e),s&&Ga.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&Ga.stroke(n,t,e)}const Bh={__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 Th,Rh;t.UI=Th=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){h.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return pn.set(this.path=t||[]),t||this.__drawPathByBox(pn),pn}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 St.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return St.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(pn.set(i=[]),this.__drawPathByBox(pn)),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||$a.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&&ja.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?Ts.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 St.need("animate")}killAnimate(t,e){}export(t,e){return St.need("export")}syncExport(t,e){return St.need("export")}clone(t){const e=Ft.clone(this.toJSON());return t&&Object.assign(e,t),Th.one(e)}static one(t,e,i,s,n){return Ot.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){_o()(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()}},Vt([no(oh)],t.UI.prototype,"__",void 0),Vt([Na()],t.UI.prototype,"zoomLayer",void 0),Vt([Dn("")],t.UI.prototype,"id",void 0),Vt([Dn("")],t.UI.prototype,"name",void 0),Vt([Dn("")],t.UI.prototype,"className",void 0),Vt([Zn("pass-through")],t.UI.prototype,"blendMode",void 0),Vt([Kn(1)],t.UI.prototype,"opacity",void 0),Vt([qn(!0)],t.UI.prototype,"visible",void 0),Vt([Zn(!1)],t.UI.prototype,"locked",void 0),Vt([Zn(!1)],t.UI.prototype,"dim",void 0),Vt([Zn(!1)],t.UI.prototype,"dimskip",void 0),Vt([Qn(0)],t.UI.prototype,"zIndex",void 0),Vt([to(!1)],t.UI.prototype,"mask",void 0),Vt([eo(!1)],t.UI.prototype,"eraser",void 0),Vt([In(0,!0)],t.UI.prototype,"x",void 0),Vt([In(0,!0)],t.UI.prototype,"y",void 0),Vt([zn(100,!0)],t.UI.prototype,"width",void 0),Vt([zn(100,!0)],t.UI.prototype,"height",void 0),Vt([Wn(1,!0)],t.UI.prototype,"scaleX",void 0),Vt([Wn(1,!0)],t.UI.prototype,"scaleY",void 0),Vt([Fn(0,!0)],t.UI.prototype,"rotation",void 0),Vt([Fn(0,!0)],t.UI.prototype,"skewX",void 0),Vt([Fn(0,!0)],t.UI.prototype,"skewY",void 0),Vt([In(0,!0)],t.UI.prototype,"offsetX",void 0),Vt([In(0,!0)],t.UI.prototype,"offsetY",void 0),Vt([In(0,!0)],t.UI.prototype,"scrollX",void 0),Vt([In(0,!0)],t.UI.prototype,"scrollY",void 0),Vt([An()],t.UI.prototype,"origin",void 0),Vt([An()],t.UI.prototype,"around",void 0),Vt([Dn(!1)],t.UI.prototype,"lazy",void 0),Vt([Hn(1)],t.UI.prototype,"pixelRatio",void 0),Vt([Nn()],t.UI.prototype,"path",void 0),Vt([Yn()],t.UI.prototype,"windingRule",void 0),Vt([Yn(!0)],t.UI.prototype,"closed",void 0),Vt([zn(0)],t.UI.prototype,"padding",void 0),Vt([zn(!1)],t.UI.prototype,"lockRatio",void 0),Vt([zn()],t.UI.prototype,"widthRange",void 0),Vt([zn()],t.UI.prototype,"heightRange",void 0),Vt([Dn(!1)],t.UI.prototype,"draggable",void 0),Vt([Dn()],t.UI.prototype,"dragBounds",void 0),Vt([Dn(!1)],t.UI.prototype,"editable",void 0),Vt([io(!0)],t.UI.prototype,"hittable",void 0),Vt([io("path")],t.UI.prototype,"hitFill",void 0),Vt([jn("path")],t.UI.prototype,"hitStroke",void 0),Vt([io(!1)],t.UI.prototype,"hitBox",void 0),Vt([io(!0)],t.UI.prototype,"hitChildren",void 0),Vt([io(!0)],t.UI.prototype,"hitSelf",void 0),Vt([io()],t.UI.prototype,"hitRadius",void 0),Vt([so("")],t.UI.prototype,"cursor",void 0),Vt([Zn()],t.UI.prototype,"fill",void 0),Vt([jn()],t.UI.prototype,"stroke",void 0),Vt([jn("inside")],t.UI.prototype,"strokeAlign",void 0),Vt([jn(1)],t.UI.prototype,"strokeWidth",void 0),Vt([jn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),Vt([jn("none")],t.UI.prototype,"strokeCap",void 0),Vt([jn("miter")],t.UI.prototype,"strokeJoin",void 0),Vt([jn()],t.UI.prototype,"dashPattern",void 0),Vt([jn(0)],t.UI.prototype,"dashOffset",void 0),Vt([jn(10)],t.UI.prototype,"miterLimit",void 0),Vt([Yn(0)],t.UI.prototype,"cornerRadius",void 0),Vt([Yn()],t.UI.prototype,"cornerSmoothing",void 0),Vt([Ha()],t.UI.prototype,"shadow",void 0),Vt([Ha()],t.UI.prototype,"innerShadow",void 0),Vt([Ha()],t.UI.prototype,"blur",void 0),Vt([Ha()],t.UI.prototype,"backgroundBlur",void 0),Vt([Ha()],t.UI.prototype,"grayscale",void 0),Vt([Ha()],t.UI.prototype,"filter",void 0),Vt([Dn({})],t.UI.prototype,"data",void 0),Vt([lo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Th=Vt([po(bh),po(Eh),co()],t.UI),t.Group=class extends t.UI{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(){}},Vt([no(ah)],t.Group.prototype,"__",void 0),Vt([zn(0)],t.Group.prototype,"width",void 0),Vt([zn(0)],t.Group.prototype,"height",void 0),t.Group=Vt([po(t.Branch),_o()],t.Group);const Lh=Et.get("Leafer");t.Leafer=Rh=class extends t.Group{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),Rh.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:n}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,Ft.assign(n,t));const o=this.canvas=i.canvas(n);this.__controllers.push(this.renderer=i.renderer(this,o,n),this.watcher=i.watcher(this,n),this.layouter=i.layouter(this,n)),this.isApp&&this.__setApp(),this.__checkAutoLayout(n,e),this.view=o.view,e||(this.selector=i.selector(this),this.interaction=i.interaction(this,o,this.selector,n),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=i.hitCanvasManager()),this.canvasManager=new Wt,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))),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(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=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 ct(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 tr(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 pt(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(nr.BEFORE_READY),this.emitLeafer(nr.READY),this.emitLeafer(nr.AFTER_READY),Ho.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(nr.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(nr.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 St.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){Rh.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){Lh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ya,Vt([no(lh)],t.Leafer.prototype,"__",void 0),Vt([zn()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Rh=Vt([_o()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},Vt([no(uh)],t.Rect.prototype,"__",void 0),t.Rect=Vt([po(Bh),co(),_o()],t.Rect);const{copy:Ph,add:Sh,includes:Ch}=at,Oh=t.Rect.prototype,Mh=t.Group.prototype,Dh={};t.Box=class extends t.Group{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(),Ph(Dh,e),this.__updateRectRenderBounds(),t=!Ch(e,Dh)||void 0,t&&"hide"!==this.__.overflow&&Sh(e,Dh)):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([no(hh)],t.Box.prototype,"__",void 0),Vt([zn(100)],t.Box.prototype,"width",void 0),Vt([zn(100)],t.Box.prototype,"height",void 0),Vt([Dn(!1)],t.Box.prototype,"resizeChildren",void 0),Vt([Gn("show")],t.Box.prototype,"overflow",void 0),Vt([lo(Oh.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),Vt([lo(Oh.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),Vt([lo(Oh.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),Vt([lo(Oh.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),Vt([lo(Oh.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),Vt([lo(Oh.__updateChange)],t.Box.prototype,"__updateRectChange",null),Vt([lo(Oh.__render)],t.Box.prototype,"__renderRect",null),Vt([lo(Mh.__render)],t.Box.prototype,"__renderGroup",null),t.Box=Vt([co(),_o()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},Vt([no(dh)],t.Frame.prototype,"__",void 0),Vt([Zn("#FFFFFF")],t.Frame.prototype,"fill",void 0),Vt([Gn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=Vt([_o()],t.Frame);const{moveTo:Ih,closePath:Ah,ellipse:Wh}=Zi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Wh(h,r,a,r*s,a*s,0,n,o,!1),Wh(h,r,a,r,a,0,o,n,!0),s<1&&Ah(h)):(s<1&&(Wh(h,r,a,r*s,a*s),Ih(h,t,a)),Wh(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Ih(h,r,a),Wh(h,r,a,r,a,0,n,o,!1),Ah(h)):Wh(h,r,a,r,a)}},Vt([no(ph)],t.Ellipse.prototype,"__",void 0),Vt([Yn(0)],t.Ellipse.prototype,"innerRadius",void 0),Vt([Yn(0)],t.Ellipse.prototype,"startAngle",void 0),Vt([Yn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=Vt([_o()],t.Ellipse);const{moveTo:Fh,lineTo:zh,drawPoints:Hh}=Zi,{rotate:Uh,getAngle:Nh,getDistance:Yh,defaultPoint:Xh}=I,{toBounds:Vh}=on;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Uh(i,e),i}set toPoint(t){this.width=Yh(Xh,t),this.rotation=Nh(Xh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Hh(e,t.points,!1,t.closed):(Fh(e,0,0),zh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Hh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&ja.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Vh(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},Vt([no(ch)],t.Line.prototype,"__",void 0),Vt([Xn("center")],t.Line.prototype,"strokeAlign",void 0),Vt([zn(0)],t.Line.prototype,"height",void 0),Vt([Yn()],t.Line.prototype,"points",void 0),Vt([Yn(0)],t.Line.prototype,"curve",void 0),Vt([Yn(!1)],t.Line.prototype,"closed",void 0),t.Line=Vt([_o()],t.Line);const{sin:jh,cos:Gh,PI:Zh}=Math,{moveTo:Kh,lineTo:qh,closePath:Jh,drawPoints:$h}=Zi,Qh=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)$h(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,o=i/2;Kh(t,n,0);for(let e=1;e<s;e++)qh(t,n+n*jh(2*e*Zh/s),o-o*Gh(2*e*Zh/s))}Jh(t)}__updateRenderPath(){}__updateBoxBounds(){}},Vt([no(_h)],t.Polygon.prototype,"__",void 0),Vt([Yn(3)],t.Polygon.prototype,"sides",void 0),Vt([Yn()],t.Polygon.prototype,"points",void 0),Vt([Yn(0)],t.Polygon.prototype,"curve",void 0),Vt([lo(Qh.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),Vt([lo(Qh.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=Vt([co(),_o()],t.Polygon);const{sin:tl,cos:el,PI:il}=Math,{moveTo:sl,lineTo:nl,closePath:ol}=Zi;t.Star=class extends t.UI{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++)nl(r,n+(t%2==0?n:n*s)*tl(t*il/i),o-(t%2==0?o:o*s)*el(t*il/i));ol(r)}},Vt([no(gh)],t.Star.prototype,"__",void 0),Vt([Yn(5)],t.Star.prototype,"corners",void 0),Vt([Yn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=Vt([_o()],t.Star),t.Image=class extends t.Rect{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([no(xh)],t.Image.prototype,"__",void 0),Vt([zn("")],t.Image.prototype,"url",void 0),t.Image=Vt([_o()],t.Image);const rl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get ready(){return!this.url}constructor(t){super(t),this.canvas=i.canvas(this.__),this.context=this.canvas.context,t&&t.url&&this.drawImage(t.url)}drawImage(t){new Ln({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 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=this.context=null),super.destroy()}},Vt([no(wh)],t.Canvas.prototype,"__",void 0),Vt([Ua(100)],t.Canvas.prototype,"width",void 0),Vt([Ua(100)],t.Canvas.prototype,"height",void 0),Vt([Ua(1)],t.Canvas.prototype,"pixelRatio",void 0),Vt([Ua(!0)],t.Canvas.prototype,"smooth",void 0),Vt([Dn(!1)],t.Canvas.prototype,"safeResize",void 0),Vt([Ua()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=Vt([_o()],t.Canvas);const{copyAndSpread:al,includes:hl,spread:ll,setList:dl}=at;t.Text=class extends t.UI{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:a,textOverflow:l,padding:d}=t;t.__lineHeight=Va.number(e,n),t.__letterSpacing=Va.number(i,n),t.__padding=d?h.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=Ya.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&&ll(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=!hl(h,a)||void 0;l?(dl(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;al(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!$a.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},Vt([no(vh)],t.Text.prototype,"__",void 0),Vt([zn(0)],t.Text.prototype,"width",void 0),Vt([zn(0)],t.Text.prototype,"height",void 0),Vt([Zn()],t.Text.prototype,"boxStyle",void 0),Vt([Dn(!1)],t.Text.prototype,"resizeFontSize",void 0),Vt([Zn("#000000")],t.Text.prototype,"fill",void 0),Vt([Xn("outside")],t.Text.prototype,"strokeAlign",void 0),Vt([io("all")],t.Text.prototype,"hitFill",void 0),Vt([zn("")],t.Text.prototype,"text",void 0),Vt([zn("caption")],t.Text.prototype,"fontFamily",void 0),Vt([zn(12)],t.Text.prototype,"fontSize",void 0),Vt([zn("normal")],t.Text.prototype,"fontWeight",void 0),Vt([zn(!1)],t.Text.prototype,"italic",void 0),Vt([zn("none")],t.Text.prototype,"textCase",void 0),Vt([zn("none")],t.Text.prototype,"textDecoration",void 0),Vt([zn(0)],t.Text.prototype,"letterSpacing",void 0),Vt([zn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),Vt([zn(0)],t.Text.prototype,"paraIndent",void 0),Vt([zn(0)],t.Text.prototype,"paraSpacing",void 0),Vt([zn("x")],t.Text.prototype,"writingMode",void 0),Vt([zn("left")],t.Text.prototype,"textAlign",void 0),Vt([zn("top")],t.Text.prototype,"verticalAlign",void 0),Vt([zn(!0)],t.Text.prototype,"autoSizeAlign",void 0),Vt([zn("normal")],t.Text.prototype,"textWrap",void 0),Vt([zn("show")],t.Text.prototype,"textOverflow",void 0),t.Text=Vt([_o()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},Vt([no(fh)],t.Path.prototype,"__",void 0),Vt([Xn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=Vt([_o()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),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([no(yh)],t.Pen.prototype,"__",void 0),Vt([(t,e)=>{Pn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=Vt([po(cs,["set","path","paint"]),_o()],t.Pen),t.App=class extends t.Leafer{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:s,sky:n,editor:o}=t;e&&(this.ground=this.addLeafer(e)),(s||o)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(n||o)&&(this.sky=this.addLeafer(n)),o&&this.sky.add(this.editor=i.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(e){const i=new t.Leafer(e);return this.add(i),i}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&&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(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))}},t.App=Vt([_o()],t.App);const cl={},ul={isHoldSpaceKey:()=>ul.isHold("Space"),isHold:t=>cl[t],setDownCode(t){cl[t]||(cl[t]=!0)},setUpCode(t){cl[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 _l extends qo{get spaceKey(){return ul.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){It.changeName(t,e)}}t.PointerEvent=class extends _l{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=Vt([go()],t.PointerEvent);const gl=t.PointerEvent,fl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ya?t:new ya(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 I.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)),at.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(fl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(fl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(fl,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 at.set(i,e.x-t.x,e.y-t.y,t.x,t.y),at.unsign(i),i}assignMove(t){fl.x=t?this.totalX:this.moveX,fl.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=Vt([go()],t.DragEvent);const yl=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=Vt([go()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=Vt([go()],t.MoveEvent),t.RotateEvent=class extends _l{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=Vt([go()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=Vt([go()],t.SwipeEvent),t.ZoomEvent=class extends _l{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=Vt([go()],t.ZoomEvent),t.KeyEvent=class extends _l{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=Vt([go()],t.KeyEvent);const ml={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:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.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:vl.getSwipeDirection(I.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 ya,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some((e=>e.draggable||e.editable||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},vl=ml,xl=new ya,{getDragEventData:wl,getDropEventData:bl,getSwipeEventData:El}=ml;class kl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=wl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||xl;return this.dragging&&(n?e?xl:new ya(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&pl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.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 ya(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=wl(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(){const{running:e}=this.interaction,i=this.realDraggableList;if(i.length&&e){const{totalX:e,totalY:s}=this.dragData;i.forEach((i=>i.draggable&&i.move(t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:e,y:s}))))}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=wl(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(I.getDistance(e,t)>n.config.pointer.swipeDistance){const t=El(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=bl(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.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 Bl=Et.get("emit");const Tl=["move","zoom","rotate","key"];function Rl(t,e,i,s,n){if(Tl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Pl(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&&Ll(o,e,i,s,n)}}function Ll(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Pl(t,n)&&(Qa.updateEventStyle&&!s&&Qa.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=It.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Pl(t,e){return e&&e.has(t)}const Sl={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:Cl,pathCanDrag:Ol,pathHasOutside:Ml}=ml;class Dl{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&&ul.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(Sl),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ya(t),this.createTransformer(),this.dragger=new kl(this),s&&(this.config=Ft.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(pl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),pl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=pl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}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(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=I.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;pl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,ul.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]=!1,ul.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ya),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach((t=>i.add(t))));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Cl(e.path,t)));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}),i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:o,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.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&&!Ml(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Ol(t.path))&&!Ml(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(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}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&&I.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}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(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)}),this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Cl(e.path,t.PointerEvent.LONG_TAP)||Cl(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new ct(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],Ll(n,t,e,!0,s))return;n.isApp&&Rl(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Rl(n,t,e,!1,s),Ll(n,t,e,!1,s))return}catch(t){Bl.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 Il{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Il.custom={};class Al extends Wt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ya,this.pixelList=new ya}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),i.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),i.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:Wl,copy:Fl,setRadius:zl}=I,Hl={},Ul=t.Leaf.prototype;Ul.__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&&(Fl(Hl,t),zl(t=Hl,e.hitRadius)),Wl(t,i,Hl),e.hitBox||n){if(at.hitRadiusPoint(s.boxBounds,Hl))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Hl)},Ul.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Ul.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Ul.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Ul.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Nl=new N,Yl=t.UI.prototype;Yl.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(t.__pixelFill||t.__isCanvas)&&"pixel"===t.hitFill,n=t.__pixelStroke&&"pixel"===t.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=e.image.hitCanvasSize,a=r.hitScale=ut.set(0,0,o,o).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ut.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),kn.patternLocked=!0,this.__renderShape(r,{matrix:Nl.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),kn.patternLocked=!1,r.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(t)},Yl.__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 Xl=t.UI.prototype,Vl=t.Rect.prototype,jl=t.Box.prototype;Vl.__updateHitCanvas=jl.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Xl.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Vl.__hitFill=jl.__hitFill=function(t){return this.__hitCanvas?Xl.__hitFill.call(this,t):at.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.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)))},t.Group.prototype.pick=function(t,s){return s||(s=Nt),this.updateLayout(),function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}(this).getByPoint(t,s.hitRadius||0,Object.assign(Object.assign({},s),{target:this}))};const Gl=se.prototype;function Zl(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 Kl(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?$l(t,!0,e,i):Jl(e,i);break;case"inside":ql("inside",t,n,e,i);break;case"outside":ql("outside",t,n,e,i)}}function ql(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?$l(e,!0,s,a):Jl(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",Zl(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 Jl(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 $l(t,e,i,s){let n;for(let o=0,r=t.length;o<r;o++)n=t[o],n.image&&Za.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Jl(i,s):s.stroke(),s.restoreBlendMode()):e?Jl(i,s):s.stroke())}function Ql(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}Gl.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Gl.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Gl.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),ut.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(ut.x,ut.y,ut.width||1,ut.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:td,getOuterOf:ed,getByMove:id,getIntersectData:sd}=at;let nd;function od(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:Xa.string(r,a)};case"image":return Za.image(i,t,e,s,!nd||!nd[e.url]);case"linear":return Ka.linearGradient(e,s);case"radial":return Ka.radialGradient(e,s);case"angular":return Ka.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:Xa.string(e)}:void 0}}const rd={compute:function(t,e){const i=e.__,s=[];let n,o=i.__input[t];o instanceof Array||(o=[o]),nd=Za.recycleImage(t,i);for(let i,n=0,r=o.length;n<r;n++)i=od(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?Zl(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&&Za.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?Zl(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),o?Zl(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):o?Zl(e,i):n?i.fill(n):i.fill())},fillText:Zl,stroke:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:o,__font:r}=s;if(n)if(r)Kl(t,e,i);else switch(o){case"center":i.setStroke(t,n,s),i.stroke(),s.__useArrow&&Ql(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)Kl(t,e,i);else switch(o){case"center":i.setStroke(void 0,n,s),$l(t,!1,e,i),s.__useArrow&&Ql(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),$l(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),$l(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:Kl,drawTextStroke:Jl,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=sd(s?td(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,n);r=e.bounds.getFitMatrix(c);let{a:u,d:p}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=p),a=ed(n,r),o=id(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,p)})}return t.__renderShape(s,i),{canvas:s,matrix:r,bounds:o,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let ad={};const{get:hd,rotateOfOuter:ld,translate:dd,scaleOfOuter:cd,scale:ud,rotate:pd}=E;function _d(t,e,i,s,n,o,r){const a=hd();dd(a,e.x+i,e.y+s),ud(a,n,o),r&&ld(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function gd(t,e,i,s,n,o,r){const a=hd();dd(a,e.x+i,e.y+s),n&&ud(a,n,o),r&&pd(a,r),t.transform=a}function fd(t,e,i,s,n,o,r,a,h,l){const d=hd();if(h)if("center"===l)ld(d,{x:i/2,y:s/2},h);else switch(pd(d,h),h){case 90:dd(d,s,0);break;case 180:dd(d,i,s);break;case 270:dd(d,0,i)}ad.x=e.x+n,ad.y=e.y+o,dd(d,ad.x,ad.y),r&&cd(d,ad,r,a),t.transform=d}const{get:yd,translate:md}=E,vd=new ct,xd={},wd={};function bd(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=Ed(i,s,e)}function Ed(t,e,i){let{width:s,height:n}=i;t.padding&&(e=vd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{opacity:o,mode:r,align:a,offset:l,scale:d,size:c,rotation:u,repeat:p,filters:_}=t,g=e.width===s&&e.height===n,f={mode:r},y="center"!==a&&(u||0)%180==90,m=y?n:s,v=y?s:n;let x,w,b=0,E=0;if(r&&"cover"!==r&&"fit"!==r)(d||c)&&(h.getScaleData(d,c,i,wd),x=wd.scaleX,w=wd.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;x=w="fit"===r?Math.min(t,i):Math.max(t,i),b+=(e.width-s*x)/2,E+=(e.height-n*w)/2}if(a){const t={x:b,y:E,width:m,height:v};x&&(t.width*=x,t.height*=w),xt.toPoint(a,t,e,xd,!0),b+=xd.x,E+=xd.y}switch(l&&(b+=l.x,E+=l.y),r){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(b||E||x||u)&&gd(f,e,b,E,x,w,u);break;case"repeat":(!g||x||u)&&fd(f,e,s,n,b,E,x,w,u,a),p||(f.repeat="repeat");break;default:x&&_d(f,e,b,E,x,w,u)}return f.transform||(e.x||e.y)&&(f.transform=yd(),md(f.transform,e.x,e.y)),x&&"stretch"!==r&&(f.scaleX=x,f.scaleY=w),f.width=s,f.height=n,o&&(f.opacity=o),_&&(f.filters=_),p&&(f.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),f}let kd,Bd=new ct;const{isSame:Td}=at;function Rd(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||bd(n,s,i,o),!0}function Ld(t,e){Cd(t,Qo.LOAD,e)}function Pd(t,e){Cd(t,Qo.LOADED,e)}function Sd(t,e,i){e.error=i,t.forceUpdate("surface"),Cd(t,Qo.ERROR,e)}function Cd(t,e,i){t.hasEvent(e)&&t.emitEvent(new Qo(e,i))}function Od(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Md,scale:Dd,copy:Id}=E,{ceil:Ad,abs:Wd}=Math;function Fd(t,i,s){let{scaleX:n,scaleY:o}=kn.patternLocked?t.__world:t.__nowWorld;const r=n+"-"+o+"-"+s;if(i.patternId===r||t.destroyed)return!1;{n=Wd(n),o=Wd(o);const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g}=a;u&&(l=Md(),Id(l,_),Dd(l,1/u,1/p),n*=u,o*=p),n*=s,o*=s,d*=n,c*=o;const f=d*c;if(!g&&f>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}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=Md(),_&&Id(l,_)),Dd(l,1/n,1/o));const m=t.getCanvas(Ad(d)||1,Ad(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=r,!0}}const{abs:zd}=Math;const Hd={image:function(t,e,i,s,n){let o,r;const a=kn.get(i);return kd&&i===kd.paint&&Td(s,kd.boxBounds)?o=kd.leafPaint:(o={type:i.type,image:a},kd=a.use>1?{leafPaint:o,paint:i,boxBounds:Bd.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Rd(t,e,i,a,o,s),n&&(Ld(t,r),Pd(t,r))):a.error?n&&Sd(t,r,a.error):(n&&(Od(t,!0),Ld(t,r)),o.loadId=a.load((()=>{Od(t,!1),t.destroyed||(Rd(t,e,i,a,o,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Pd(t,r)),o.loadId=null}),(e=>{Od(t,!1),Sd(t,r,e),o.loadId=null}))),o},checkImage:function(t,i,s,n){const{scaleX:o,scaleY:r}=kn.patternLocked?t.__world:t.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!$a.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||tr.isResizing(t)||$a.running)){let{width:t,height:i}=h;t*=zd(o)*a,i*=zd(r)*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.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()}(t,i,s,h),!0):(!s.style||s.sync||$a.running?Fd(t,s,a):s.patternTask||(s.patternTask=kn.patternTasker.add((()=>jt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Fd(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:Fd,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:bd,getPatternData:Ed,fillOrFitMode:_d,clipMode:gd,repeatMode:fd},{toPoint:Ud}=yt,Nd={},Yd={};function Xd(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),Xa.string(s,i)):t.addColorStop(s.offset,Xa.string(s.color,i))}}const{getAngle:Vd,getDistance:jd}=I,{get:Gd,rotateOfOuter:Zd,scaleOfOuter:Kd}=E,{toPoint:qd}=yt,Jd={},$d={};function Qd(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Vd(e,i);o=Gd(),n?(Kd(o,e,r/a*(s||1),1),Zd(o,e,t+90)):(Kd(o,e,1,r/a*(s||1)),Zd(o,e,t))}return o}const{getDistance:tc}=I,{toPoint:ec}=yt,ic={},sc={};const nc={linearGradient:function(t,i){let{from:s,to:n,type:o,blendMode:r,opacity:a}=t;Ud(s||"top",i,Nd),Ud(n||"bottom",i,Yd);const h=e.canvas.createLinearGradient(Nd.x,Nd.y,Yd.x,Yd.y);Xd(h,t.stops,a);const l={type:o,style:h};return r&&(l.blendMode=r),l},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,blendMode:a,stretch:h}=t;qd(s||"center",i,Jd),qd(n||"bottom",i,$d);const l=e.canvas.createRadialGradient(Jd.x,Jd.y,0,Jd.x,Jd.y,jd(Jd,$d));Xd(l,t.stops,r);const d={type:o,style:l},c=Qd(i,Jd,$d,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,blendMode:a,stretch:h}=t;ec(s||"center",i,ic),ec(n||"bottom",i,sc);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,ic.x,ic.y):e.canvas.createRadialGradient(ic.x,ic.y,0,ic.x,ic.y,tc(ic,sc));Xd(l,t.stops,r);const d={type:o,style:l},c=Qd(i,ic,sc,h||1,e.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:Qd},{copy:oc,toOffsetOutBounds:rc}=at,ac={},hc={};function lc(t,i,s,n){const{bounds:o,shapeBounds:r}=n;if(e.fullImageShadow){if(oc(ac,t.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}t.copyWorld(n.canvas,t.bounds,ac)}else s&&(oc(ac,i),ac.x-=i.width/2*(s-1),ac.y-=i.height/2*(s-1),ac.width*=s,ac.height*=s),t.copyWorld(n.canvas,r,s?ac:i)}const{toOffsetOutBounds:dc}=at,cc={};const uc={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,p=e.getSameCanvas(),_=a.length-1;rc(l,hc),a.forEach(((a,g)=>{p.setWorldShadow(hc.offsetX+a.x*c,hc.offsetY+a.y*u,a.blur*c,Xa.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,lc(p,hc,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,o,a.blendMode):e.copyWorldToInner(p,s,r.renderBounds,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.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,p=e.getSameCanvas(),_=a.length-1;dc(l,cc),a.forEach(((a,g)=>{p.save(),p.setWorldShadow(cc.offsetX+a.x*c,cc.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,lc(p,cc,n,i),p.restore(),h?(p.copyWorld(p,l,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,Xa.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,o,a.blendMode):e.copyWorldToInner(p,s,r.renderBounds,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.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:pc}=Do;function _c(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),fc(t,e,i,1)}(t,i,s,n);break;case"opacity-path":fc(t,i,s,o);break;case"path":i.restore()}}function gc(t){return t.getSameCanvas(!1,!0)}function fc(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}t.Group.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&&(_c(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=gc(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=gc(t)),n||(n=gc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||pc(i,e)||i.__render(n||t,e);_c(this,r,t,n,s,o)};const yc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",mc=yc+"_#~&*+\\=|≮≯≈≠=…",vc=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 xc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const wc=xc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),bc=xc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ec=xc(yc),kc=xc(mc),Bc=xc("- —/~|┆·");var Tc;!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"}(Tc||(Tc={}));const{Letter:Rc,Single:Lc,Before:Pc,After:Sc,Symbol:Cc,Break:Oc}=Tc;function Mc(t){return wc[t]?Rc:Bc[t]?Oc:bc[t]?Pc:Ec[t]?Sc:kc[t]?Cc:vc.test(t)?Lc:Rc}const Dc={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 Ic(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:Ac}=Dc,{Letter:Wc,Single:Fc,Before:zc,After:Hc,Symbol:Uc,Break:Nc}=Tc;let Yc,Xc,Vc,jc,Gc,Zc,Kc,qc,Jc,$c,Qc,tu,eu,iu,su,nu,ou,ru=[];function au(t,e){Jc&&!qc&&(qc=Jc),Yc.data.push({char:t,width:e}),Vc+=e}function hu(){jc+=Vc,Yc.width=Vc,Xc.words.push(Yc),Yc={data:[]},Vc=0}function lu(){iu&&(su.paraNumber++,Xc.paraStart=!0,iu=!1),Jc&&(Xc.startCharSize=qc,Xc.endCharSize=Jc,qc=0),Xc.width=jc,nu.width?Ac(Xc):ou&&du(),ru.push(Xc),Xc={words:[]},jc=0}function du(){jc>(su.maxWidth||0)&&(su.maxWidth=jc)}const{top:cu,right:uu,bottom:pu,left:_u}=t.Direction4;function gu(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 fu={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));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[_u],o-=l[uu]+l[_u]):i.autoSizeAlign||(s=l[_u]),r?(n=l[cu],r-=l[cu]+l[pu]):i.autoSizeAlign||(n=l[cu]));const d={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){su=t,ru=t.rows,nu=t.bounds,ou=!nu.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=nu;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;iu=!0,Qc=null,qc=Kc=Jc=Vc=jc=0,Yc={data:[]},Xc={words:[]};for(let s=0,l=i.length;s<l;s++)Zc=i[s],"\n"===Zc?(Vc&&hu(),Xc.paraEnd=!0,lu(),iu=!0):($c=Mc(Zc),$c===Wc&&"none"!==r&&(Zc=Ic(Zc,r,!Vc)),Kc=a.measureText(Zc).width,n&&(n<0&&(Jc=Kc),Kc+=n),tu=$c===Fc&&(Qc===Fc||Qc===Wc)||Qc===Fc&&$c!==Hc,eu=!($c!==zc&&$c!==Fc||Qc!==Uc&&Qc!==Hc),Gc=iu&&o?h-o:h,t&&h&&jc+Vc+Kc>Gc&&(e?(Vc&&hu(),jc&&lu()):(eu||(eu=$c===Wc&&Qc==Hc),tu||eu||$c===Nc||$c===zc||$c===Fc||Vc+Kc>Gc?(Vc&&hu(),jc&&lu()):jc&&lu()))," "===Zc&&!0!==iu&&jc+Vc===0||($c===Nc?(" "===Zc&&Vc&&hu(),au(Zc,Kc),hu()):tu||eu?(Vc&&hu(),au(Zc,Kc)):au(Zc,Kc)),Qc=$c);Vc&&hu(),jc&&lu(),ru.length>0&&(ru[ru.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{su.paraNumber++,jc=a.measureText(t).width,ru.push({x:o||0,text:t,width:jc,paraStart:!0}),ou&&du()}))}(d,t,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":gu(e,"x",t[_u]);break;case"right":gu(e,"x",-t[uu])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":gu(e,"y",t[cu]);break;case"bottom":gu(e,"y",-t[pu])}}(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:p,y:_,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":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,x,w,b=g||u?g:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,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),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,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(t,i,s,n){if(!n)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(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=Xa.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 yu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!Xa.object)return t;t=Xa.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 mu(t){return t?t instanceof Array?t:[t]:[]}Object.assign(Ya,fu),Object.assign(Xa,yu),Object.assign(Ga,rd),Object.assign(Za,Hd),Object.assign(Ka,nc),Object.assign(qa,uc),Object.assign(i,{interaction:(t,e,i,s)=>new Dl(t,e,i,s),hitCanvas:(t,e)=>new va(t,e),hitCanvasManager:()=>new Al}),wa();class vu extends qo{get list(){return mu(this.value)}get oldList(){return mu(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}vu.BEFORE_SELECT="editor.before_select",vu.SELECT="editor.select",vu.BEFORE_HOVER="editor.before_hover",vu.HOVER="editor.hover";class xu extends vu{constructor(t,e){super(t,e)}}xu.BEFORE_MOVE="editor.before_move",xu.MOVE="editor.move";class wu extends vu{constructor(t,e){super(t,e)}}wu.BEFORE_SCALE="editor.before_scale",wu.SCALE="editor.scale";class bu extends vu{constructor(t,e){super(t,e)}}bu.BEFORE_ROTATE="editor.before_rotate",bu.ROTATE="editor.rotate";class Eu extends vu{constructor(t,e){super(t,e)}}function ku(t){return(e,i)=>{const s="_"+i;Pn(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?vu.BEFORE_SELECT:vu.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new vu(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Eu.BEFORE_SKEW="editor.before_skew",Eu.SKEW="editor.skew";const{abs:Bu}=Math,{copy:Tu,scale:Ru}=E,{setListWithFn:Lu}=at,{worldBounds:Pu}=Do,Su={a:1,b:0,c:0,d:1,e:0,f:0},Cu={x:0,y:0,width:0,height:0};class Ou extends t.UI{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?(Lu(Cu,t,Pu),this.set(Cu),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=Bu(d.scaleX),h=Bu(d.scaleY);if(Tu(Su,d),Su.half=r%2,i!==h){Ru(Su,1/i,1/h),t.setWorld(Su,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(Su,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/Bu(d.scaleX);o&&("string"==typeof o?Ga.stroke(o,this,t):Ga.strokes(o,this,t)),a&&("string"==typeof a?Ga.fill(a,this,t):Ga.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}Vt([ku((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],Ou.prototype,"target",void 0);class Mu extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,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 Du={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return Iu([t],i,e),i}};function Iu(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&&Iu(s.children,e,i)}}const{findOne:Au,findByBounds:Wu}=Du;class Fu extends t.Group{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 Ou,this.targetStroker=new Ou,this.bounds=new ct,this.selectArea=new Mu,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 ya(Wu(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&&!Au(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new ya(this.editor.editBox.rect)};return Au(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Au(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(t.shiftKey||i)}__listenEvents(){const{editor:e}=this;e.waitLeafer((()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_(vu.HOVER,this.onHover,this),e.on_(vu.SELECT,this.onSelect,this),i.on_(t.PointerEvent.MOVE,this.onPointerMove,this),i.on_(t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this),i.on_(t.PointerEvent.TAP,this.onTap,this),i.on_(t.DragEvent.START,this.onDragStart,this,!0),i.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.MoveEvent.MOVE,this.onAutoMove,this),i.on_([t.ZoomEvent.ZOOM,t.MoveEvent.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:zu,top:Hu,topRight:Uu,right:Nu,bottomRight:Yu,bottom:Xu,bottomLeft:Vu,left:ju}=t.Direction9,{toPoint:Gu}=yt,{within:Zu}=h,Ku={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:_,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,x=t.scaleY/e.scaleY,w=v<0?-1:1,b=x<0?-1:1,E=a?v:w*u.width/y,k=a?x:b*u.height/m;s.x*=a?v:w,s.y*=a?x:b;const B=(-s.y+m)/m,T=(s.x+y)/y,R=(s.y+m)/m,L=(-s.x+y)/y;switch(i){case Hu:c=B,h="bottom";break;case Nu:d=T,h="left";break;case Xu:c=R,h="top";break;case ju:d=L,h="right";break;case zu:c=B,d=L,h="bottom-right";break;case Uu:c=B,d=T,h="bottom-left";break;case Yu:c=R,d=T,h="top-left";break;case Vu:c=R,d=L,h="top-right"}if(n){if(!("corner"===n&&i%2)){let t;switch(i){case Hu:case Xu:t=c;break;case ju:case Nu:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}}const P=1!==d,S=1!==c;if(P&&(d/=E),S&&(c/=k),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(Gu(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new ct(t.__localBoxBounds);if(i.scaleOf(t.getLocalPointByInner(l),d,c),!at.includes(e,i)){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;P&&(d*=s),S&&(c*=n)}}if(P&&p){const e=u.width*t.scaleX;d=Zu(e*d,p)/e}if(S&&_){const e=u.height*t.scaleY;c=Zu(e*c,_)/e}return P&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),S&&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 zu:o="bottom-right";break;case Uu:o="bottom-left";break;case Yu:o="top-left";break;case Vu:o="top-right";break;default:o="center"}return Gu(n||o,t,r,!0),{origin:r,rotation:I.getRotation(s,r,i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Hu:case zu:o={x:.5,y:0},n="bottom",a=1;break;case Xu:case Yu:o={x:.5,y:1},n="top",a=1;break;case ju:case Vu:o={x:0,y:.5},n="right",h=1;break;case Nu:case Uu: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,Gu(s||n,t,r,!0);const c=I.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 ju:t=Nu;break;case zu:t=Uu;break;case Vu:t=Yu;break;case Nu:t=ju;break;case Uu:t=zu;break;case Yu:t=Vu}if(i)switch(t){case Hu:t=Xu;break;case zu:t=Vu;break;case Uu:t=Yu;break;case Xu:t=Hu;break;case Vu:t=zu;break;case Yu:t=Uu}return t}},qu={};function Ju(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:a,resizeable:l,rotateable:d,skewable:c}=t.mergeConfig,{pointType:u}=s,{flippedX:p,flippedY:_}=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)?a:g?o:r;n+=45*(Ku.getFlipDirection(s.direction,p,_)+1),n=2*Math.round(h.formatRotation(n,!0)/2);const{url:y,x:m,y:v}=f,x=y+n;qu[x]?s.cursor=qu[x]:qu[x]=s.cursor={url:Qu(y,n),x:m,y:v}}function $u(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.editBox.rect.cursor=i?e:void 0}function Qu(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class tp extends t.Box{}const ep=["top","right","bottom","left"],ip=void 0;class sp extends t.Group{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(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new tp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,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 tp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new tp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new tp({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:ip},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:p,rotateable:_,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,x,w={};for(let e=0;e<8;e++)yt.toPoint(yt.directionData[e],t,w),v=n[e],m=o[e],x=r[Math.floor(e/2)],v.set(w),m.set(w),x.set(w),v.visible=x.visible=y&&!(!p&&!_),m.visible=y&&_&&p&&!h.rotatePoint,e%2&&(v.visible=m.visible=y&&!!u,(e+1)/2%2?(x.width=a,g&&2*v.width>a&&(v.visible=!1)):(x.height=l,v.rotation=90,g&&2*v.width>l&&(v.visible=!1)));i.visible=y&&_&&!(!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=ep.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=ep.indexOf(i);(h%2&&r||(h+1)%2&&a)&&s&&(h=(h+2)%4);const l=s?Ku.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:ip};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),Ju(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(e){const{editor:i}=this;if(i.single){const{element:s}=i;if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find((e=>e.editable&&e instanceof t.Text))||e.find((e=>e instanceof t.Text));if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){const{editor:n}=this;e.direction=s,e.pointType=i,e.on_(t.DragEvent.START,this.onDragStart,this),e.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),e.on_(t.PointerEvent.LEAVE,(()=>this.enterPoint=null)),"circle"!==e.name&&e.on_(t.PointerEvent.ENTER,(t=>{this.enterPoint=e,Ju(n,t)}))}__listenEvents(){const{rect:e,editor:i}=this;this.__eventIds=[i.on_(vu.SELECT,this.onSelect,this),e.on_(t.DragEvent.START,this.onDragStart,this),e.on_(t.DragEvent.DRAG,i.onMove,i),e.on_(t.DragEvent.END,this.onDragEnd,this),e.on_(t.PointerEvent.ENTER,(()=>$u(i))),e.on_(t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this),e.on_(t.PointerEvent.LONG_PRESS,this.onLongPress,this)]}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const np={x:0,y:0,width:1e5,height:1e5};class op extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,np),Object.assign(this.__world,np)}__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 rp='\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"/>',ap={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${rp}\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${rp}\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${rp}\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},hp=new ct;function lp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer.zoomLayer;e.safeChange((()=>{hp.setListWithFn(i,(t=>t.getBounds("box","page"))),0===hp.width&&(hp.width=.1),0===hp.height&&(hp.height=.1),e.reset(hp.get())})),s.add(e)}const dp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),cp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),up={group(e,i,s){e.sort(cp);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(dp);const a=new N(i.worldTransform);return a.divideParent(o.worldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach((t=>t.dropTo(r))),n.unlockLayout(),r},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach((t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)})),e.unlockLayout(),i},toTop(t){t.sort(dp),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(cp),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},pp=Et.get("EditToolCreator");function _p(){return t=>{fp.register(t)}}const gp=_p,fp={list:{},register(t){const{tag:e}=t.prototype;yp[e]&&pp.repeat(e),yp[e]=t},get:(t,e)=>new yp[t](e)},{list:yp}=fp;class mp extends vu{constructor(t,e){super(t,e)}}mp.BEFORE_OPEN="innerEditor.before_open",mp.OPEN="innerEditor.open",mp.BEFORE_CLOSE="innerEditor.before_close",mp.CLOSE="innerEditor.close";class vp extends vu{constructor(t,e){super(t,e)}}vp.BEFORE_GROUP="editor.before_group",vp.GROUP="editor.group",vp.BEFORE_UNGROUP="editor.before_ungroup",vp.UNGROUP="editor.ungroup",vp.BEFORE_OPEN="editor.before_open_group",vp.OPEN="editor.open_group",vp.BEFORE_CLOSE="editor.before_close_group",vp.CLOSE="editor.close_group";const{updateMatrix:xp}=Ro,wp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},bp="top-left";class Ep extends t.Rect{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&&wp[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,xp(this.parent),xp(this);const a=new N(this.__world);switch(r[i]=s,this.__layout.rotationChange(),xp(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(bp,o);break;case"scaleX":t.scaleOf(bp,o,1);break;case"scaleY":t.scaleOf(bp,1,o);break;case"skewX":t.skewOf(bp,o,0);break;case"skewY":t.skewOf(bp,0,o)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class kp extends t.Group{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 ya,this.openedGroupList=new ya,this.simulateTarget=new Ep(this),this.editBox=new sp(this),this.editToolList={},this.selector=new Fu(this),this.editMask=new op(this),this.targetEventIds=[];let i=Ft.clone(ap);t&&(i=Ft.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),St.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&&lp(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]||fp.get(t,this),this.editBox.load(),this.editTool.load()}}getEditSize(t){return this.mergeConfig.editSize}onMove(e){if(e instanceof t.MoveEvent){if("drag"!==e.moveType){const{moveable:t,resizeable:i}=this.mergeConfig,s=e.getLocalMove(this.element);"move"===t?(e.stop(),this.move(s.x,s.y)):"zoom"===i&&e.stop()}}else{const i={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),this.move(t.DragEvent.getValidMove(this.element,this.editBox.dragStartData.point,i))}}onScale(e){const{element:i}=this;let{around:s,lockRatio:n,resizeable:o,flipable:r,editSize:a}=this.mergeConfig;if(e instanceof t.ZoomEvent)"zoom"===o&&(e.stop(),this.scaleOf(i.getBoxPoint(e),e.scale,e.scale));else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(n=!0);const o=Ku.getScaleData(i,this.editBox.dragStartData.bounds,t,e.getInnerTotal(i),n,Ku.getAround(s,e.altKey),r,this.multiple||"scale"===a);this.editTool.onScaleWithDrag?(o.drag=e,this.scaleWithDrag(o)):this.scaleOf(o.origin,o.scaleX,o.scaleY)}}onRotate(e){const{skewable:i,rotateable:s,around:n,rotateGap:o}=this.mergeConfig,{direction:r,name:a}=e.current;if(i&&"resize-line"===a)return this.onSkew(e);const{element:l}=this,{dragStartData:d}=this.editBox;let c,u;if(e instanceof t.RotateEvent){if("rotate"!==s)return;e.stop(),u=e.rotation,c=l.getBoxPoint(e),l.scaleX*l.scaleY<0&&(u=-u)}else{const t=Ku.getRotateData(l.boxBounds,r,e.getBoxPoint(l),l.getBoxPoint(d),e.shiftKey?null:l.around||l.origin||n||"center");u=t.rotation,c=t.origin}l.scaleX*l.scaleY<0&&(u=-u),e instanceof t.DragEvent&&(u=d.rotation+u-l.rotation),u=h.float(h.getGapRotation(u,o,l.rotation),2),u&&this.rotateOf(c,u)}onSkew(t){const{element:e}=this,{around:i}=this.mergeConfig,{origin:s,skewX:n,skewY:o}=Ku.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Ku.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 xu(xu.BEFORE_MOVE,o));const r=new xu(xu.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 wu(wu.BEFORE_SCALE,t));const s=new wu(wu.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 wu(wu.BEFORE_SCALE,h));const l=new wu(wu.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(Ro.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 wu(wu.BEFORE_SCALE,n));const o=new wu(wu.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 bu(bu.BEFORE_ROTATE,r));const a=new bu(bu.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 Eu(Eu.BEFORE_SKEW,h));const l=new Eu(Eu.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(Ro.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(vp.BEFORE_GROUP),this.target=up.group(this.list,this.element,t),this.emitGroupEvent(vp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(vp.BEFORE_UNGROUP,t))),this.target=up.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(vp.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(vp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(vp.OPEN,t)}closeGroup(t){this.emitGroupEvent(vp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(vp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Ro.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 vp(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&&fp.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||fp.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(mp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(mp.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(mp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(mp.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new mp(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&&(up.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(up.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){Ju(this,t)}listenTargetEvents(){if(!this.targetEventIds.length){const{app:e,leafer:i,editBox:s,editMask:n}=this;this.targetEventIds=[i.on_(sr.START,this.onRenderStart,this),e.on_(sr.CHILD_START,this.onAppRenderStart,this),e.on_(t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0),e.on_(t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0),e.on_(t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0),e.on_([t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this),e.on_(t.KeyEvent.DOWN,s.onArrow,s)],n.visible&&n.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)=>{Pn(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"),Yt(s.lockRatio)&&(s.lockRatio=!0))),this.mergedConfig=s}})}],kp.prototype,"mergeConfig",void 0),Vt([ku((function(t,e){t.emitEvent(new vu(vu.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],kp.prototype,"hoverTarget",void 0),Vt([ku((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof ya?i:new ya(i),t.multiple&&lp(t)):(t.simulateTarget.remove(),t.leafList.reset(),t.closeInnerEditor()),t.emitEvent(new vu(vu.SELECT,{editor:t,value:i,oldValue:e})),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{$u(t),t.updateEditTool(),t.update(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents())}))],kp.prototype,"target",void 0);class Bp{static registerInnerEditor(){fp.register(this)}get tag(){return"InnerEditor"}get editBox(){return this.editor.editBox}constructor(t){this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,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)}}t.EditTool=class extends Bp{static registerEditTool(){fp.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()}},t.EditTool=Vt([_p()],t.EditTool);const{left:Tp,right:Rp}=t.Direction9,{move:Lp,copy:Pp,toNumberPoints:Sp}=I;t.LineEditTool=class extends t.EditTool{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=Sp(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?(Lp(t,o,r),s&&Lp(e,-o,-r)):(s&&Lp(t,-o,-r),Lp(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),Pp(s[7],i),Pp(e[7],i),Pp(s[3],a),Pp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Tp||t===Rp,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=Vt([_p()],t.LineEditTool);const{M:Cp,L:Op,C:Mp,Q:Dp,Z:Ip,N:Ap,D:Wp,X:Fp,G:zp,F:Hp,O:Up,P:Np,U:Yp}=re,Xp={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Cp:case Op:Vp(t,e,i,n,1),n+=3;break;case Mp:Vp(t,e,i,n,3),n+=7;break;case Dp:Vp(t,e,i,n,2),n+=5;break;case Ip:n+=1;break;case Ap:Vp(t,e,i,n,2),n+=5;break;case Wp:Vp(t,e,i,n,2),n+=9;break;case Fp:Vp(t,e,i,n,2),n+=6;break;case zp:Vp(t,e,i,n,2),n+=9;break;case Hp:Vp(t,e,i,n,2),n+=5;break;case Up:t[n]=zp,t.splice(n+4,0,t[n+3],0),Vp(t,e,i,n,2),n+=9,o+=2;break;case Np:t[n]=Hp,t.splice(n+4,0,t[n+3]),Vp(t,e,i,n,2),n+=5,o+=1;break;case Yp:Vp(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:Vp}=Xp,jp=E.get(),{topLeft:Gp,top:Zp,topRight:Kp,right:qp,bottom:Jp,left:$p}=t.Direction9;function Qp(t,e,i){t.pathInputed?t_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function t_(t,e,i){Xp.scale(t.__.path,e,i),t.path=t.__.path}function e_(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):Xp.scalePoints(s,e,i),t.points=s}function i_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)jp.a=e,jp.d=i,s[t].transform(jp,!0)}const s_=t.Leaf.prototype;function n_(e,i,s){o_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,(t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY))})),e.on_(t.ZoomEvent.BEFORE_ZOOM,(t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)})))}function o_(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)}s_.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))},s_.__scaleResize=function(t,e){Qp(this,t,e)},s_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},s_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.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 Zp:case Jp:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case $p:case qp:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Gp:case Kp: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):Qp(this,t,e)},t.Path.prototype.__scaleResize=function(t,e){t_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?t_(this,t,e):this.points?e_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?t_(this,t,e):this.points?e_(this,t,e):Qp(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){i_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Qp(this,t,e),i&&i_(this,t,e)},St.add("resize"),St.add("editor","resize"),i.editor=function(t){return new kp(t)},t.Box.addAttr("textBox",!1,Dn),t.UI.addAttr("editConfig",void 0,Dn),t.UI.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),Dn),t.UI.addAttr("editInner","PathEditor",Dn),t.Group.addAttr("editInner","",Dn),t.Text.addAttr("editInner","TextEditor",Dn),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const r_=Et.get("LeaferTypeCreator"),a_={list:{},register(t,e){h_[t]&&r_.repeat(t),h_[t]=e},run(t,e){const i=h_[t];i&&i(e)}},{list:h_,register:l_}=a_;l_("viewport",n_),l_("custom",(function(t){n_(t,null,!0)})),l_("design",(function(t){n_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),l_("document",(function(t){n_(t,{zoom:{min:1},move:{scroll:"limit"}})}));const d_={getData(t){const e=t[0],i=t[1],s=I.getCenter(e.from,i.from),n=I.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=I.getDistance(e.from,i.from);return{move:o,scale:I.getDistance(e.to,i.to)/r,rotation:I.getRotation(e.from,i.from,e.to,i.to),center:n}}},c_={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(t,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=h.within(r,0,1);n=1-a/(4*(t.deltaY?i.delta.y:i.delta.x))*r,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class u_{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),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:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const p_=t.Leafer.prototype,__=new ct;function g_(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function f_(t,e){return Object.assign(Object.assign({},e),{scale:t})}p_.initType=function(t){a_.run(t,this)},p_.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}=__.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}},p_.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 y_=Dl.prototype;y_.createTransformer=function(){this.transformer=new u_(this)},y_.move=function(t){this.transformer.move(t)},y_.zoom=function(t){this.transformer.zoom(t)},y_.rotate=function(t){this.transformer.rotate(t)},y_.transformEnd=function(){this.transformer.transformEnd()},y_.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):c_.getScale(t,e);if(1!==o)this.zoom(f_(o,t));else{const s=e.getMove?e.getMove(t,e):c_.getMove(t,e);i.snap&&I.round(s),this.move(g_(s,t))}},y_.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=d_.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(f_(n,t)),this.move(g_(i,t))};const m_=kl.prototype,{abs:v_}=Math;function x_(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}m_.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=v_(i),o=v_(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),I.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},m_.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},m_.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},m_.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=at.maxX(r),d=at.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,_=0;this.autoMoveTimer=setInterval((()=>{p+=c,_+=u,I.move(i,c,u),I.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)}),10)},m_.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},St.add("viewport"),St.add("view"),t.Leafer.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 ct,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=x_(c,"in");break;case"out":h=x_(c,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new ct(this.boxBounds)).height=0;break;case"fit-height":(t=new ct(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,Do.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:p,height:_}=r;let g=o.x-r.x,f=o.y-r.y;return i?(g+=Math.max((o.width-p)/2,0),f+=Math.max((o.height-_)/2,0)):(h=this.getValidScale(Math.min(o.width/p,o.height/_)),g+=(o.width-p*h)/2,f+=(o.height-_*h)/2,I.scaleOf(e,r,h),r.scaleOf(r,h),e.scaleX*=h,e.scaleY*=h),I.move(e,g,f),r.move(g,f),n.set(e,s),r}return n.worldBoxBounds};class w_ extends t.Group{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(e){let i;"string"==typeof e?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{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 ct(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,p=l<1,{scrollXBar:_,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,p?g.width+6:2,u?_.height+6:2,2]);_.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:p})}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:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.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())}}St.add("scroll");class b_ extends ch{}function E_(t){return Cn(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,Vn(this)}}})))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}},Vt([no(b_)],t.Arrow.prototype,"__",void 0),Vt([E_("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=Vt([_o()],t.Arrow);const{M:k_,L:B_,C:T_,Q:R_,O:L_}=re,{rotate:P_,copyFrom:S_,scale:C_}=I,O_={},M_={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 k_:case B_:D_(t,l+1,e,i,s,n,o,r),l+=3;break;case T_:for(h=1;h<6;h+=2)D_(t,l+h,e,i,s,n,o,r);l+=7;break;case R_:for(h=1;h<4;h+=2)D_(t,l+h,e,i,s,n,o,r);l+=5;break;case L_: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){M_.layout(t,0,0,1,1,e,i)}};function D_(t,e,i,s,n,o,r,a){S_(O_,t[e],t[e+1]),r&&P_(O_,r,a),n&&C_(O_,n,o),t[e]=i+O_.x,t[e+1]=s+O_.y}const{layout:I_,rotate:A_}=M_,{getAngle:W_}=I,F_={x:-.5},z_={connect:F_,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},H_={connect:F_,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},U_={connect:F_,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]},N_={connect:F_,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]},Y_={offset:F_,path:[...U_.path],dashPath:[1,-2.5,0,2,-1,0]};A_(Y_.path,180,{x:-1.5,y:0});const X_={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},V_={connect:{x:.5},path:[...X_.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},j_={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]},G_={path:[...j_.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Z_=Ft.clone(j_),K_=Ft.clone(G_);A_(Z_.path,45),A_(K_.path,45);const q_={angle:z_,"angle-side":H_,arrow:N_,triangle:U_,"triangle-flip":Y_,circle:V_,"circle-line":X_,square:G_,"square-line":j_,diamond:K_,"diamond-line":Z_,mark:{offset:F_,path:[1,0,-2,2,0,2]}};function J_(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:q_[e];let p=d?d.x:0,_=l?l.x:0;const g=[...c];return r&&u&&g.push(...u),"none"!==a&&(p-=.5),l&&("round"===h&&l.roundJoin?_+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(_+=l.bevelJoin)),_&&I_(g,_,0),I_(g,s.x,s.y,n,n,W_(i,s)),o.x=(p+_)*n,g}const{M:$_,L:Q_,C:tg,Q:eg,Z:ig,N:sg,D:ng,X:og,G:rg,F:ag,O:hg,P:lg,U:dg}=re,{copy:cg,copyFrom:ug,getDistancePoint:pg}=I,_g={},gg={},fg={},yg={},mg={},vg={list:q_,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 $_:case Q_:(d<2||h+6>=l)&&(ug(mg,r[h+1],r[h+2]),!d&&c&&cg(gg,mg)),h+=3;break;case tg:1!==d&&h+7!==l||xg(r,yg,mg,h+3),h+=7;break;case eg:1!==d&&h+5!==l||xg(r,yg,mg,h+1),h+=5;break;case ig:return;case sg:h+=5;break;case ng:h+=9;break;case og:h+=6;break;case rg:h+=9;break;case ag:h+=5;break;case hg:h+=7;break;case lg:h+=4;break;case dg:1!==d&&h+6!==l||xg(r,yg,mg,h+1),h+=6}if(d++,1===d&&a!==$_)return;if(2===d&&c&&cg(fg,a===Q_?mg:yg),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=J_(t,i,fg,gg,n,_g,!!o);o?d.push(...e):l.push(...e),_g.x&&(pg(gg,fg,-_g.x,!0),l[1]=fg.x,l[2]=fg.y)}if(s&&"none"!==s){const e=J_(t,s,yg,mg,n,_g,!!o);if(o?d.push(...e):l.push(...e),_g.x){let t;switch(pg(mg,yg,-_g.x,!0),a){case Q_:t=h-3+1;break;case tg:t=h-7+5;break;case eg:t=h-5+3;break;case dg:t=h-6+3}t&&wg(l,yg,t)}}}else cg(yg,mg)}}};function xg(t,e,i,s){ug(e,t[s],t[s+1]),ug(i,t[s+2],t[s+3])}function wg(t,e,i){t[i]=e.x,t[i+1]=e.y}St.add("arrow"),t.UI.addAttr("startArrow","none",E_),t.UI.addAttr("endArrow","none",E_),Object.assign(ja,vg);const{Yes:bg,NoAndSkip:Eg,YesAndSkip:kg}=t.Answer,Bg={},Tg={},Rg={};class Lg{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"#":Bg.id=t.substring(1),t=Bg;break;case".":Tg.className=t.substring(1),t=Tg;break;default:Rg.tag=t,t=Rg}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&&Ro.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===bg||o===kg){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Eg&&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 Pg=t.UI.prototype;function Sg(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}Pg.find=function(t,e){return Sg(this).getBy(t,this,!1,e)},Pg.findOne=function(t,e){return Sg(this).getBy(t,this,!0,e)},St.add("find"),i.finder=function(t){return new Lg(t)};const{setPoint:Cg,addPoint:Og,toBounds:Mg}=X;const Dg={syncExport(t,s,n){let o;this.running=!0;const r=fn.fileType(s),a=s.includes(".");n=fn.getExportOptions(n);const{toURL:l}=e,{download:d}=e.origin;if("json"===r)a&&d(l(JSON.stringify(t.toJSON(n.json)),"text"),s),o={data:!!a||t.toJSON(n.json)};else if("svg"===r)a&&d(l(t.toSVG(),"svg"),s),o={data:!!a||t.toSVG()};else{let e,r,a=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:p}=t,{slice:_,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),x=n.screenshot||t.isApp,w=c&&x&&void 0===n.fill?t.fill:n.fill,b=fn.isOpaqueImage(s)||w,E=new N;if(x)e=!0===x?c?u.canvas.bounds:t.worldRenderBounds:x;else{let i=n.relative||(c?"inner":"local");switch(a=d.scaleX,l=d.scaleY,i){case"inner":E.set(d);break;case"local":E.set(d).divide(t.localTransform),a/=t.scaleX,l/=t.scaleY;break;case"world":a=1,l=1;break;case"page":i=u||t;default:E.set(d).divide(t.getTransform(i));const e=i.worldTransform;a/=a/e.scaleX,l/=l/e.scaleY}e=t.getBounds("render",i)}const k={scaleX:1,scaleY:1};h.getScaleData(n.scale,n.size,e,k);let B=n.pixelRatio||1;t.isApp&&(k.scaleX*=B,k.scaleY*=B,B=t.app.pixelRatio);const{x:T,y:R,width:L,height:P}=new ct(e).scale(k.scaleX,k.scaleY),S={matrix:E.scale(1/k.scaleX,1/k.scaleY).invert().translate(-T,-R).withScale(1/a*k.scaleX,1/l*k.scaleY)};let C,O=i.canvas({width:Math.floor(L),height:Math.floor(P),pixelRatio:B,smooth:m,contextSettings:v});if(_&&(C=t,C.__worldOpacity=0,t=u||t,S.bounds=O.bounds),O.save(),p&&void 0!==w){const e=t.get("fill");t.fill="",t.__render(O,S),t.fill=e}else t.__render(O,S);if(O.restore(),C&&C.__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?Og(r,n,o):Cg(r={},n,o)),a++;const h=new ct;return Mg(r,h),h.scale(1/t.pixelRatio).ceil()}(O);const t=O,{width:e,height:s}=r,n={x:0,y:0,width:e,height:s,pixelRatio:B};O=i.canvas(n),O.copyWorld(t,r,n)}if(f){const[t,e,s,n]=h.fourNumber(f),o=O,{width:r,height:a}=o;O=i.canvas({width:r+n+e,height:a+t+s,pixelRatio:B}),O.copyWorld(o,o.bounds,{x:n,y:t,width:r,height:a})}b&&O.fillWorld(O.bounds,w||"#FFFFFF","destination-over"),y&&y(O);o={data:"canvas"===s?O:O.export(s,n),width:O.pixelWidth,height:O.pixelHeight,renderBounds:e,trimBounds:r}}return this.running=!1,o},export(t,i,s){return this.running=!0,function(t){Ig||(Ig=new xn);return new Promise((e=>{Ig.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(!bn.isComplete)return e.requestRender(r);const a=Dg.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()}));t.updateLayout(),Ag(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))))}};let Ig;function Ag(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>Ag(t)))}const Wg=se.prototype,Fg=Et.get("@leafer-in/export");Wg.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)},Wg.toBlob=function(t,i){return new Promise((s=>{e.origin.canvasToBolb(this.view,t,i).then((t=>{s(t)})).catch((t=>{Fg.error(t),s(null)}))}))},Wg.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},Wg.saveAs=function(t,i){return new Promise((s=>{e.origin.canvasSaveAs(this.view,t,i).then((()=>{s(!0)})).catch((t=>{Fg.error(t),s(!1)}))}))},St.add("export"),Object.assign($a,Dg),t.UI.prototype.export=function(t,e){return $a.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return $a.syncExport(this,t,e)};const zg={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Hg={top:"flex-start",middle:"center",bottom:"flex-end"},Ug={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Ng(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=Xa.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Xa.string("string"==typeof t?t:t.color);break;default:void 0!==e.r&&(i=Xa.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=Xa.string(h.color))):l=h,s.textDecoration=Ug[l],s.textTransform=zg[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Hg[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}t.TextEditor=class extends Bp{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,(t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.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),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}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 N(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:p}=this.editDom;p.transform=`matrix(${i},${s},${n},${o},${r},${a})`,p.left=h+"px",p.top=l+"px",p.width=d+"px",p.height=c+"px",this.isHTMLText||Ng(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)}},t.TextEditor=Vt([gp()],t.TextEditor),St.add("text-editor","editor"),t.Text.addAttr("textEditing",!1,Zn);class Yg extends xh{setText(t){this._text=t,this.__htmlChanged=!0}}return t.HTMLText=class extends t.Image{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([no(Yg)],t.HTMLText.prototype,"__",void 0),Vt([zn("")],t.HTMLText.prototype,"text",void 0),Vt([Dn("TextEditor")],t.HTMLText.prototype,"editInner",void 0),t.HTMLText=Vt([_o()],t.HTMLText),St.add("html"),t.AlignHelper=xt,t.AroundHelper=yt,t.ArrowData=b_,t.AutoBounds=pt,t.BezierHelper=Oe,t.Bounds=ct,t.BoundsHelper=at,t.BoxData=hh,t.BranchHelper=Ao,t.BranchRender=Fr,t.CanvasData=wh,t.CanvasManager=Wt,t.ChildEvent=Jo,t.ColorConvert=Xa,t.Creator=i,t.Cursor=Il,t.DataHelper=Ft,t.Debug=Et,t.Dragger=kl,t.EditBox=sp,t.EditDataHelper=Ku,t.EditPoint=tp,t.EditSelect=Fu,t.EditSelectHelper=Du,t.EditToolCreator=fp,t.Editor=kp,t.EditorEvent=vu,t.EditorGroupEvent=vp,t.EditorHelper=up,t.EditorMoveEvent=xu,t.EditorRotateEvent=bu,t.EditorScaleEvent=wu,t.EditorSkewEvent=Eu,t.Effect=qa,t.EllipseData=ph,t.EllipseHelper=Ue,t.Event=qo,t.EventCreator=It,t.Eventer=rr,t.Export=$a,t.FileHelper=fn,t.Filter=Ja,t.Finder=Lg,t.FrameData=dh,t.GroupData=ah,t.HTMLTextData=Yg,t.HitCanvasManager=Al,t.ImageData=xh,t.ImageEvent=Qo,t.ImageManager=kn,t.IncrementId=s,t.InnerEditor=Bp,t.InnerEditorEvent=mp,t.InteractionBase=Dl,t.InteractionHelper=ml,t.Keyboard=ul,t.LayoutEvent=ir,t.Layouter=Da,t.LeafBounds=Ir,t.LeafBoundsHelper=Do,t.LeafData=Ht,t.LeafDataProxy=xr,t.LeafEventer=yr,t.LeafHelper=Ro,t.LeafLayout=Ko,t.LeafLevelList=ma,t.LeafList=ya,t.LeafMatrix=Rr,t.LeafRender=Ar,t.LeaferCanvas=va,t.LeaferCanvasBase=se,t.LeaferData=lh,t.LeaferEvent=nr,t.LeaferImage=Ln,t.LeaferTypeCreator=a_,t.LineData=ch,t.MathHelper=h,t.Matrix=N,t.MatrixHelper=E,t.MultiTouchHelper=d_,t.MyDragEvent=yl,t.MyImage=rl,t.MyPointerEvent=gl,t.NeedConvertToCanvasCommandMap=he,t.OneRadian=d,t.PI2=c,t.PI_2=u,t.Paint=Ga,t.PaintGradient=Ka,t.PaintImage=Za,t.PathArrow=ja,t.PathArrowModule=vg,t.PathBounds=on,t.PathCommandDataHelper=Zi,t.PathCommandMap=re,t.PathConvert=Bi,t.PathCorner=un,t.PathCreator=cs,t.PathData=fh,t.PathDrawer=Ts,t.PathHelper=ne,t.PathMatrixHelper=M_,t.PathNumberCommandLengthMap=ue,t.PathNumberCommandMap=ce,t.PenData=yh,t.Picker=Fa,t.Platform=e,t.Plugin=St,t.Point=H,t.PointHelper=I,t.PointerButton=pl,t.PolygonData=_h,t.PropertyEvent=$o,t.RectData=uh,t.RectHelper=pe,t.RectRender=Bh,t.RenderEvent=sr,t.Renderer=Aa,t.ResizeEvent=tr,t.Resource=bn,t.Run=Rt,t.ScrollBar=w_,t.SelectArea=Mu,t.Selector=za,t.StarData=gh,t.State=Qa,t.StringNumberMap=wt,t.Stroker=Ou,t.TaskItem=vn,t.TaskProcessor=xn,t.TextConvert=Ya,t.TextData=vh,t.Transformer=u_,t.Transition=th,t.TwoPointBoundsHelper=X,t.UIBounds=bh,t.UICreator=Ot,t.UIData=oh,t.UIEvent=_l,t.UIRender=Eh,t.UnitConvert=Va,t.WaitHelper=Ho,t.WatchEvent=er,t.Watcher=Ea,t.WheelEventHelper=c_,t.addViewport=n_,t.addViewportConfig=o_,t.affectRenderBoundsType=Gn,t.affectStrokeBoundsType=Xn,t.arrowType=E_,t.attr=On,t.autoLayoutType=An,t.boundsType=zn,t.canvasPatch=gn,t.canvasSizeAttrs=ie,t.cursorType=so,t.dataProcessor=no,t.dataType=Dn,t.decorateLeafAttr=Cn,t.defineDataProcessor=oo,t.defineKey=Pn,t.defineLeafAttr=Mn,t.doBoundsType=Un,t.doStrokeType=Vn,t.effectType=Ha,t.emptyData=Nt,t.eraserType=eo,t.getBoundsData=_,t.getDescriptor=Sn,t.getMatrixData=g,t.getPointData=p,t.hitType=io,t.isEmptyData=Xt,t.isNull=Yt,t.layoutProcessor=function(t){return(e,i)=>{Pn(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=to,t.naturalBoundsType=Hn,t.opacityType=Kn,t.pathInputType=Nn,t.pathType=Yn,t.pen=pn,t.positionType=In,t.registerEditTool=_p,t.registerInnerEditor=gp,t.registerUI=_o,t.registerUIEvent=go,t.resizeType=Ua,t.rewrite=lo,t.rewriteAble=co,t.rotationType=Fn,t.scaleType=Wn,t.sortType=Qn,t.strokeType=jn,t.surfaceType=Zn,t.tempBounds=ut,t.tempMatrix=Y,t.tempPoint=U,t.useCanvas=wa,t.useModule=po,t.version="1.6.1",t.visibleType=qn,t.zoomLayerType=Na,t}({});
1
+ var LeaferUI=function(t){"use strict";const e={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(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},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 p(){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:g,cos:f,acos:y,sqrt:m}=Math,{float:v}=a,x={};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 b={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){E.toInnerPoint(t,e,x),E.scaleOfInner(t,x,i,s)},scaleOfInner(t,e,i,s=i){E.translateInner(t,e.x,e.y),E.scale(t,i,s),E.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){E.toInnerPoint(t,e,x),E.rotateOfInner(t,x,i)},rotateOfInner(t,e,i){E.translateInner(t,e.x,e.y),E.rotate(t,i),E.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){E.toInnerPoint(t,e,x),E.skewOfInner(t,x,i,s)},skewOfInner(t,e,i,s=0){E.translateInner(t,e.x,e.y),E.skew(t,i,s),E.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){E.multiply(t,E.tempInvert(e))},divideParent(t,e){E.multiplyParent(t,E.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=E;return E.copy(e,t),E.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)&&E.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,_,x,w,b=h,E=d;if(o||r){const t=n*a-o*r;if(r&&!s){u=m(n*n+o*o),p=t/u;const e=n/u;_=o>0?y(e):-y(e)}else{p=m(r*r+a*a),u=t/p;const e=r/p;_=c-(a>0?y(-e):-y(e))}const e=v(f(_)),i=g(_);u=v(u),p=v(p),x=e?v((r/p+i)/e/l,9):0,w=e?v((o/u-i)/e/l,9):0,_=v(_/l)}else u=n,p=a,_=x=w=0;return(e=i||e)&&(b+=e.x*n+e.y*r,E+=e.x*o+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:u,scaleY:p,rotation:_,skewX:x,skewY:w}},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){E.set(t)}},E=b,{toInnerPoint:k,toOuterPoint:B}=b,{sin:T,cos:L,abs:P,sqrt:R,atan2:S,min:C,round:O,PI:D}=Math,M={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=void 0===i?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?O(t.x-.5)+.5:O(t.x),t.y=e?O(t.y-.5)+.5:O(t.y)},move(t,e,i){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=I.defaultPoint);const s=L(e*=l),n=T(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}=I;return W(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=I;return W(i,t),B(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=I;return W(i,t),I.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){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)=>A(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=P(i-t),o=P(s-e);return R(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>C(A(t,e,i,s),A(i,s,n,o)),getAngle:(t,e)=>F(t,e)/l,getRotation:(t,e,i,s)=>(s||(s=e),I.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=S(e-s,t-i);const l=S(o-a,n-r)-h;return l<-D?l+d:l},getAtan2:(t,e)=>S(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+L(n)*i,e.y=t.y+T(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){I.reset(t)}},I=M,{getDistanceFrom:A,copy:W,getAtan2:F}=I;class z{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?M.copy(this,t):M.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 M.move(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleOf(t,e,i){return M.scaleOf(this,t,e,i),this}rotate(t,e){return M.rotate(this,t,e),this}rotateOf(t,e){return M.rotate(this,e,t),this}getRotation(t,e,i){return M.getRotation(this,t,e,i)}toInnerOf(t,e){return M.toInnerOf(this,t,e),this}toOuterOf(t,e){return M.toOuterOf(this,t,e),this}getCenter(t){return new z(M.getCenter(this,t))}getDistance(t){return M.getDistance(this,t)}getDistancePoint(t,e,i){return new z(M.getDistancePoint(this,t,e,i))}getAngle(t){return M.getAngle(this,t)}getAtan2(t){return M.getAtan2(this,t)}reset(){return M.reset(this),this}}const U=new z;class H{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 H(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 N=new H,Y={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,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}=Y;var V,j;t.Direction4=void 0,(V=t.Direction4||(t.Direction4={}))[V.top=0]="top",V[V.right=1]="right",V[V.bottom=2]="bottom",V[V.left=3]="left",t.Direction9=void 0,(j=t.Direction9||(t.Direction9={}))[j.topLeft=0]="topLeft",j[j.top=1]="top",j[j.topRight=2]="topRight",j[j.right=3]="right",j[j.bottomRight=4]="bottomRight",j[j.bottom=5]="bottom",j[j.bottomLeft=6]="bottomLeft",j[j.left=7]="left",j[j.center=8]="center",j[j["top-left"]=0]="top-left",j[j["top-right"]=2]="top-right",j[j["bottom-right"]=4]="bottom-right",j[j["bottom-left"]=6]="bottom-left";const G=[{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}];G.forEach((t=>t.type="percent"));const Z={directionData:G,tempPoint:{},get:K,toPoint(t,e,i,s,n,o){const r=K(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 K(e){return"string"==typeof e?G[t.Direction9[e]]:e}const{toPoint:q}=Z,J={toPoint(t,e,i,s,n,o){q(t,i,s,n,e,o)}},{tempPointBounds:$,setPoint:Q,addPoint:tt,toBounds:et}=Y,{toOuterPoint:it}=b,{float:st,fourNumber:nt}=a,{floor:ot,ceil:rt}=Math;let at,ht,lt,dt;const ct={},ut={},pt={},_t={tempBounds:pt,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=nt(i);s?gt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):gt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),gt.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),gt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?yt(e,t):e=t,i?(e.offsetX=-(gt.maxX(i)-t.x),e.offsetY=-(gt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),gt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||M.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){M.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(gt.copy(pt,t),gt.toOuterOf(pt,e),pt),getOuterOf:(t,e)=>(t=Object.assign({},t),gt.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 ct.x=t.x,ct.y=t.y,it(e,ct,ut),Q($,ut.x,ut.y),ct.x=t.x+t.width,it(e,ct,ut),tt($,ut.x,ut.y),ct.y=t.y+t.height,it(e,ct,ut),tt($,ut.x,ut.y),ct.x=t.x,it(e,ct,ut),tt($,ut.x,ut.y),et($,i)},toInnerOf(t,e,i){i||(i=t),gt.move(i,-e.e,-e.f),gt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,gt.getFitScale(t,e));return new H(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=gt.getFitScale(t,e,"cover"===s)),pt.width=n?e.width*=s:e.width*s,pt.height=n?e.height*=s:e.height*s,J.toPoint(i,pt,t,o,!0,!0)},getSpread(t,e,i){const s={};return gt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){gt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){gt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=ot(t.x),t.y=ot(t.y),t.width=e>t.x?rt(t.width+e-t.x):rt(t.width),t.height=i>t.y?rt(t.height+i-t.y):rt(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=st(t.x,e),t.y=st(t.y,e),t.width=st(t.width,e),t.height=st(t.height,e)},add(t,e,i){at=t.x+t.width,ht=t.y+t.height,lt=e.x,dt=e.y,i||(lt+=e.width,dt+=e.height),at=at>lt?at:lt,ht=ht>dt?ht:dt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=at-t.x,t.height=ht-t.y},addList(t,e){gt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){gt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){gt.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||yt(t,n)):ft(t,n));o&&gt.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?Q($,t.x,t.y):tt($,t.x,t.y))),et($,t)},setPoint(t,e){gt.set(t,e.x,e.y)},addPoint(t,e){ft(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=M.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=M.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=gt.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=gt.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=gt.tempToOuterOf(e,i)),!gt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return at=s+o,ht=n+r,lt=t.x+t.width,dt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,at=at<lt?at:lt,ht=ht<dt?ht:dt,o=at-s,r=ht-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){gt.copy(t,gt.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){gt.set(t)}},gt=_t,{add:ft,copy:yt}=gt;class mt{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 mt(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 mt(_t.getIntersectData(this,t,e))}isSame(t){return _t.isSame(this,t)}isEmpty(){return _t.isEmpty(this)}reset(){_t.reset(this)}}const vt=new mt;class xt{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 mt(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:bt}=a;class Et{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Et(t)}static set filter(t){this.filterList=kt(t)}static set exclude(t){this.excludeList=kt(t)}static drawRepaint(t,e){const i=bt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Et.showBounds,n=t.__nowWorld,o=bt();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(Bt.enable){if(Bt.filterList.length&&Bt.filterList.every((t=>t!==this.name)))return;if(Bt.excludeList.length&&Bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Bt.enable&&this.warn(...t)}warn(...t){Bt.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}Et.filterList=[],Et.excludeList=[],Et.showWarn=!0;const Bt=Et,Tt=Et.get("RunTime"),Lt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Pt.currentId=Pt.idMap[s]=e?performance.now():Date.now(),Pt.currentName=Pt.nameMap[s]=t,Pt.nameToIdMap[t]=s,s},end(t,e){const i=Pt.idMap[t],s=Pt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Pt.idMap[t]=Pt.nameMap[t]=Pt.nameToIdMap[s]=void 0,Tt.log(s,n,"ms")},endOfName(t,e){const i=Pt.nameToIdMap[t];void 0!==i&&Pt.end(i,e)}},Pt=Lt,Rt=[],St={list:{},add(t,...e){this.list[t]=!0,Rt.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Rt.forEach((t=>St.has(t,!0)))));const Ct={editor:t=>St.need("editor")},Ot=Et.get("UICreator"),Dt={list:{},register(t){const{__tag:e}=t.prototype;Mt[e]&&Ot.repeat(e),Mt[e]=t},get(t,e,i,s,n,o){Mt[t]||Ot.error("not register "+t);const r=new Mt[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),n&&(r.width=n),o&&(r.height=o)),r}},{list:Mt}=Dt,It=Et.get("EventCreator"),At={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Wt[e]&&It.repeat(e),Wt[e]=t)}))},changeName(t,e){const i=Wt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Wt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Wt[t](...e)},{nameList:Wt}=At;class Ft{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=Ct.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 zt={default:(t,e)=>(Ut(e,t),Ut(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 Ut(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&Ut(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:Ut}=zt;class Ht{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;t.Answer=void 0,(Nt=t.Answer||(t.Answer={}))[Nt.No=0]="No",Nt[Nt.Yes=1]="Yes",Nt[Nt.NoAndSkip=2]="NoAndSkip",Nt[Nt.YesAndSkip=3]="YesAndSkip";const Yt={};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 Gt(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 Zt(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 Kt=[];function qt(){return(t,e)=>{Kt.push(e)}}const Jt=[];class $t{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||Jt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Kt.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([Zt("imageSmoothingEnabled")],$t.prototype,"smooth",void 0),jt([Zt("imageSmoothingQuality")],$t.prototype,"smoothLevel",void 0),jt([Zt("globalAlpha")],$t.prototype,"opacity",void 0),jt([Zt()],$t.prototype,"fillStyle",void 0),jt([Zt()],$t.prototype,"strokeStyle",void 0),jt([Zt("lineWidth")],$t.prototype,"strokeWidth",void 0),jt([Zt("lineCap")],$t.prototype,"strokeCap",void 0),jt([Zt("lineJoin")],$t.prototype,"strokeJoin",void 0),jt([Zt("lineDashOffset")],$t.prototype,"dashOffset",void 0),jt([Zt()],$t.prototype,"miterLimit",void 0),jt([Zt()],$t.prototype,"shadowBlur",void 0),jt([Zt()],$t.prototype,"shadowColor",void 0),jt([Zt()],$t.prototype,"shadowOffsetX",void 0),jt([Zt()],$t.prototype,"shadowOffsetY",void 0),jt([Zt()],$t.prototype,"filter",void 0),jt([Zt()],$t.prototype,"font",void 0),jt([Zt()],$t.prototype,"fontKerning",void 0),jt([Zt()],$t.prototype,"fontStretch",void 0),jt([Zt()],$t.prototype,"fontVariantCaps",void 0),jt([Zt()],$t.prototype,"textAlign",void 0),jt([Zt()],$t.prototype,"textBaseline",void 0),jt([Zt()],$t.prototype,"textRendering",void 0),jt([Zt()],$t.prototype,"wordSpacing",void 0),jt([Zt()],$t.prototype,"letterSpacing",void 0),jt([Zt()],$t.prototype,"direction",void 0),jt([qt()],$t.prototype,"setTransform",null),jt([qt()],$t.prototype,"resetTransform",null),jt([qt()],$t.prototype,"getTransform",null),jt([qt()],$t.prototype,"save",null),jt([qt()],$t.prototype,"restore",null),jt([qt()],$t.prototype,"translate",null),jt([qt()],$t.prototype,"scale",null),jt([qt()],$t.prototype,"rotate",null),jt([qt()],$t.prototype,"fill",null),jt([qt()],$t.prototype,"stroke",null),jt([qt()],$t.prototype,"clip",null),jt([qt()],$t.prototype,"fillRect",null),jt([qt()],$t.prototype,"strokeRect",null),jt([qt()],$t.prototype,"clearRect",null),jt([qt()],$t.prototype,"beginPath",null),jt([qt()],$t.prototype,"moveTo",null),jt([qt()],$t.prototype,"lineTo",null),jt([qt()],$t.prototype,"bezierCurveTo",null),jt([qt()],$t.prototype,"quadraticCurveTo",null),jt([qt()],$t.prototype,"closePath",null),jt([qt()],$t.prototype,"arc",null),jt([qt()],$t.prototype,"arcTo",null),jt([qt()],$t.prototype,"ellipse",null),jt([qt()],$t.prototype,"rect",null),jt([qt()],$t.prototype,"roundRect",null),jt([qt()],$t.prototype,"createConicGradient",null),jt([qt()],$t.prototype,"createLinearGradient",null),jt([qt()],$t.prototype,"createPattern",null),jt([qt()],$t.prototype,"createRadialGradient",null),jt([qt()],$t.prototype,"fillText",null),jt([qt()],$t.prototype,"measureText",null),jt([qt()],$t.prototype,"strokeText",null);const{copy:Qt,multiplyParent:te}=b,{round:ee}=Math,ie={width:1,height:1,pixelRatio:1},se=["width","height","pixelRatio"];class ne extends $t{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(t,s){super(),this.size={},this.worldTransform={},t||(t=ie),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:o,pixelRatio:r}=t;this.autoLayout=!n||!o,this.size.pixelRatio=r|e.devicePixelRatio,this.config=t,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;zt.copyAttrs(s,t,se),se.forEach((t=>s[t]||(s[t]=1))),this.bounds=new mt(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&&te(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=ee(n.e-.5)+.5,n.f=ee(n.f-.5)+.5):(n.e=ee(n.e),n.f=ee(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(vt.x,vt.y,vt.width,vt.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,vt.x,vt.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(vt.x,vt.y,vt.width,vt.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(vt.x,vt.y,vt.width,vt.height),i&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(vt.x,vt.y,vt.width,vt.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(vt.x,vt.y,vt.width,vt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){vt.set(t),i&&vt.intersect(this.bounds),vt.scale(this.pixelRatio),e&&vt.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):Ct.canvas(Object.assign({},i));return n.save(),t&&(Qt(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 oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},re={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ae=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},re),he={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},le={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},de=Object.assign(Object.assign({},le),re),ce=ae,ue={};for(let t in ce)ue[ce[t]]=t;const pe={};for(let t in ce)pe[ce[t]]=he[t];const _e={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:ge,cos:fe,atan2:ye,ceil:me,abs:ve,PI:xe,sqrt:we,pow:be}=Math,{setPoint:Ee,addPoint:ke}=Y,{set:Be,toNumberPoints:Te}=M,{M:Le,L:Pe,C:Re,Q:Se,Z:Ce}=ae,Oe={},De={points(t,e,i,s){let n=Te(e);if(t.push(Le,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],_=we(be(r-e,2)+be(a-o,2)),g=we(be(h-r,2)+be(l-a,2)),(_||g)&&(f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=o,d=r-_*h,c=a-_*l,2===i?s||t.push(Se,d,c,r,a):t.push(Re,u,p,d,c,r,a),u=r+g*h,p=a+g*l);s||t.push(Se,u,p,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Pe,n[e],n[e+1]);s&&t.push(Ce)},rect(t,e,i,s,n){oe.creator.path=t,oe.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){oe.creator.path=[],_e.drawRoundRect(oe.creator,e,i,s,n,o),t.push(...oe.convertToCanvasData(oe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,u,p){const _=s-e,g=n-i,f=o-s,y=r-n;let m=ye(g,_),v=ye(y,f),x=v-m;if(x<0&&(x+=d),x===xe||ve(_+g)<1e-12||ve(f+y)<1e-12)return t&&t.push(Pe,s,n),h&&(Ee(h,e,i),ke(h,s,n)),p&&Be(p,e,i),void(u&&Be(u,s,n));const w=_*y-f*g<0,b=w?-1:1,E=a/fe(x/2),k=s+E*fe(m+x/2+c*b),B=n+E*ge(m+x/2+c*b);return m-=c*b,v-=c*b,Ae(t,k,B,a,a,0,m/l,v/l,w,h,u,p)},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=ge(g),y=fe(g);let m=r*l,v=a*l;m>xe&&(m-=d),v<0&&(v+=d);let x=v-m;x<0?x+=d:x>d&&(x-=d),h&&(x-=d);const w=me(ve(x/c)),b=x/w,E=ge(b/4),k=8/3*E*E/ge(b/2);v=m+b;let B,T,L,P,R,S,C,O,D=fe(m),M=ge(m),I=L=y*s*D-f*n*M,A=P=f*s*D+y*n*M,W=e+L,F=i+P;t&&t.push(t.length?Pe:Le,W,F),u&&Ee(u,W,F),_&&Be(_,W,F);for(let o=0;o<w;o++)B=fe(v),T=ge(v),L=y*s*B-f*n*T,P=f*s*B+y*n*T,R=e+I-k*(y*s*M+f*n*D),S=i+A-k*(f*s*M-y*n*D),C=e+L+k*(y*s*T+f*n*B),O=i+P+k*(f*s*T-y*n*B),t&&t.push(Re,R,S,C,O,e+L,i+P),u&&Ie(e+I,i+A,R,S,C,O,e+L,i+P,u,!0),I=L,A=P,D=B,M=T,m=v,v+=b;p&&Be(p,e+L,i+P)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(Re,(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){Ie(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,x=i,w=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=o,b=a),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,p=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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):Ee(h,t,e),ke(h,r,a);for(let l=0,c=d.length;l<c;l++)Me(d[l],t,e,i,s,n,o,r,a,Oe),ke(h,Oe.x,Oe.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,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*o+_*a,l.y=c*i+u*n+p*r+_*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Me(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:Me,toTwoPointBounds:Ie,ellipse:Ae}=De,{sin:We,cos:Fe,sqrt:ze,atan2:Ue}=Math,{ellipse:He}=De,Ne={ellipticalArc(t,i,s,n,o,r,a,h,c,u,p){const _=(c-i)/2,g=(u-s)/2,f=r*l,y=We(f),m=Fe(f),v=-m*_-y*g,x=-m*g+y*_,w=n*n,b=o*o,E=x*x,k=v*v,B=w*b-w*E-b*k;let T=0;if(B<0){const t=ze(1-B/(w*b));n*=t,o*=t}else T=(a===h?-1:1)*ze(B/(w*E+b*k));const L=T*n*x/o,P=-T*o*v/n,R=Ue((x-P)/o,(v-L)/n),S=Ue((-x-P)/o,(-v-L)/n);let C=S-R;0===h&&C>0?C-=d:1===h&&C<0&&(C+=d);const O=i+_+m*L-y*P,D=s+g+y*L+m*P,M=C<0?1:0;p||e.ellipseToCurve?He(t,O,D,n,o,r,R/l,S/l,M):n!==o||r?t.push(ae.G,O,D,n,o,r,R/l,S/l,M):t.push(ae.O,O,D,n,R/l,S/l,M)}},{M:Ye,m:Xe,L:Ve,l:je,H:Ge,h:Ze,V:Ke,v:qe,C:Je,c:$e,S:Qe,s:ti,Q:ei,q:ii,T:si,t:ni,A:oi,a:ri,Z:ai,z:hi,N:li,D:di,X:ci,G:ui,F:pi,O:_i,P:gi,U:fi}=ae,{rect:yi,roundRect:mi,arcTo:vi,arc:xi,ellipse:wi,quadraticCurveTo:bi}=De,{ellipticalArc:Ei}=Ne,ki=Et.get("PathConvert"),Bi={},Ti={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,h="";for(;o<r;){s=t[o],i=pe[s],h+=s===n?" ":ue[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?de:le;for(let e=0,h=t.length;e<h;e++)s=t[e],wt[s]?("."===s&&(Li.dot&&(Pi(r,o),o=""),Li.dot++),"0"===o&&"."!==s&&(Pi(r,o),o=""),o+=s):ae[s]?(o&&(Pi(r,o),o=""),Li.name=ae[s],Li.length=he[s],Li.index=0,Pi(r,Li.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Pi(r,o),o=s):o&&(Pi(r,o),o=""),n=s;return o&&Pi(r,o),i?Ti.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 p=[];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],p.push(Ye,a,h),c+=3;break;case Ze:t[c+1]+=a;case Ge:a=t[c+1],p.push(Ve,a,h),c+=2;break;case qe:t[c+1]+=h;case Ke:h=t[c+1],p.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],p.push(Ve,a,h),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:r=o===Je||o===Qe,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],p.push(Je,l,d,i,s,a,h),c+=5;break;case $e: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=Je;case Je:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Je,t[c+1],t[c+2],i,s,a,h),c+=7;break;case ni:t[c+1]+=a,t[c+2]+=h,n=si;case si:r=o===ei||o===si,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?bi(p,a,h,i,s,t[c+1],t[c+2]):p.push(ei,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ii:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ei;case ei:i=t[c+1],s=t[c+2],e?bi(p,a,h,i,s,t[c+3],t[c+4]):p.push(ei,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ri:t[c+6]+=a,t[c+7]+=h;case oi:Ei(p,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 hi:case ai:p.push(ai),c++;break;case li:a=t[c+1],h=t[c+2],e?yi(p,a,h,t[c+3],t[c+4]):Ri(p,t,c,5),c+=5;break;case di:a=t[c+1],h=t[c+2],e?mi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ri(p,t,c,9),c+=9;break;case ci:a=t[c+1],h=t[c+2],e?mi(p,a,h,t[c+3],t[c+4],t[c+5]):Ri(p,t,c,6),c+=6;break;case ui:wi(e?p:Ri(p,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,Bi),a=Bi.x,h=Bi.y,c+=9;break;case pi:e?wi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ri(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case _i:xi(e?p:Ri(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Bi),a=Bi.x,h=Bi.y,c+=7;break;case gi:e?xi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Ri(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case fi:vi(e?p:Ri(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Bi),a=Bi.x,h=Bi.y,c+=6;break;default:return ki.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},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(Ve,t.x,t.y);break;case"C":e.push(Je,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ei,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ai)}})),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Li.index===Li.length&&(Li.index=1,t.push(Li.name)),t.push(Number(e)),Li.index++,Li.dot=0}},{current:Li,pushData:Pi,copyData:Ri}=Ti,{M:Si,L:Ci,C:Oi,Q:Di,Z:Mi,N:Ii,D:Ai,X:Wi,G:Fi,F:zi,O:Ui,P:Hi,U:Ni}=ae,{getMinDistanceFrom:Yi,getRadianFrom:Xi}=M,{tan:Vi,min:ji,abs:Gi}=Math,Zi={},Ki={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Si,e,i)},lineTo(t,e,i){t.push(Ci,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Oi,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Di,e,i,s,n)},closePath(t){t.push(Mi)},rect(t,e,i,s,n){t.push(Ii,e,i,s,n)},roundRect(t,e,i,s,n,o){if("number"==typeof o)t.push(Wi,e,i,s,n,o);else{const r=a.fourNumber(o);r?t.push(Ai,e,i,s,n,...r):t.push(Ii,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,a,h){void 0===o?t.push(zi,e,i,s,n):(void 0===r&&(r=0),void 0===a&&(a=360),t.push(Fi,e,i,s,n,o,r,a,h?1:0))},arc(t,e,i,s,n,o,r){void 0===n?t.push(Hi,e,i,s):(void 0===o&&(o=360),t.push(Ui,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=ji(o,ji(t/2,t/2*Gi(Vi(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){De.ellipse(null,e,i,s,n,void 0===o?0:o,void 0===r?0:r,void 0===a?360:a,h,null,null,Zi),t.push(Si,Zi.x,Zi.y),qi(t,e,i,s,n,o,r,a,h)},drawArc(t,e,i,s,n,o,r){De.arc(null,e,i,s,void 0===n?0:n,void 0===o?360:o,r,null,null,Zi),t.push(Si,Zi.x,Zi.y),Ji(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){De.points(t,e,i,s)}},{ellipse:qi,arc:Ji}=Ki,{moveTo:$i,lineTo:Qi,quadraticCurveTo:ts,bezierCurveTo:es,closePath:is,beginPath:ss,rect:ns,roundRect:os,ellipse:rs,arc:as,arcTo:hs,drawEllipse:ls,drawArc:ds,drawPoints:cs}=Ki;class us{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?oe.parse(t):t:[],this}beginPath(){return ss(this.__path),this.paint(),this}moveTo(t,e){return $i(this.__path,t,e),this.paint(),this}lineTo(t,e){return Qi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return es(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return ts(this.__path,t,e,i,s),this.paint(),this}closePath(){return is(this.__path),this.paint(),this}rect(t,e,i,s){return ns(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return os(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return rs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return as(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return hs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return ls(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return ds(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return cs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:ps,L:_s,C:gs,Q:fs,Z:ys,N:ms,D:vs,X:xs,G:ws,F:bs,O:Es,P:ks,U:Bs}=ae,Ts=Et.get("PathDrawer"),Ls={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case ps: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 gs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case fs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ys:t.closePath(),s+=1;break;case ms:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case vs: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 xs: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]*l,e[s+6]*l,e[s+7]*l,e[s+8]),s+=9;break;case bs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,d,!1),s+=5;break;case Es: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 ks:t.arc(e[s+1],e[s+2],e[s+3],0,d,!1),s+=4;break;case Bs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ts.error(`command: ${i} [index:${s}]`,e)}}},{M:Ps,L:Rs,C:Ss,Q:Cs,Z:Os,N:Ds,D:Ms,X:Is,G:As,F:Ws,O:Fs,P:zs,U:Us}=ae,{toTwoPointBounds:Hs,toTwoPointBoundsByQuadraticCurve:Ns,arcTo:Ys,arc:Xs,ellipse:Vs}=De,{addPointBounds:js,copy:Gs,addPoint:Zs,setPoint:Ks,addBounds:qs,toBounds:Js}=Y,$s=Et.get("PathBounds");let Qs,tn,en;const sn={},nn={},on={},rn={toBounds(t,e){rn.toTwoPointBounds(t,nn),Js(nn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Ks(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===Os||r===Ss||r===Cs?Ks(e,h,l):Ks(e,t[a+1],t[a+2])),r){case Ps:case Rs:h=t[a+1],l=t[a+2],Zs(e,h,l),a+=3;break;case Ss:n=t[a+5],o=t[a+6],Hs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,sn),js(e,sn),h=n,l=o,a+=7;break;case Cs:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],Ns(h,l,i,s,n,o,sn),js(e,sn),h=n,l=o,a+=5;break;case Os:a+=1;break;case Ds:h=t[a+1],l=t[a+2],qs(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ms:case Is:h=t[a+1],l=t[a+2],qs(e,h,l,t[a+3],t[a+4]),a+=r===Ms?9:6;break;case As: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],sn,on),0===a?Gs(e,sn):js(e,sn),h=on.x,l=on.y,a+=9;break;case Ws:h=t[a+1],l=t[a+2],tn=t[a+3],en=t[a+4],qs(e,h-tn,l-en,2*tn,2*en),h+=tn,a+=5;break;case Fs:Xs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],sn,on),0===a?Gs(e,sn):js(e,sn),h=on.x,l=on.y,a+=7;break;case zs:h=t[a+1],l=t[a+2],Qs=t[a+3],qs(e,h-Qs,l-Qs,2*Qs,2*Qs),h+=Qs,a+=4;break;case Us:Ys(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],sn,on),0===a?Gs(e,sn):js(e,sn),h=on.x,l=on.y,a+=6;break;default:return void $s.error(`command: ${r} [index:${a}]`,t)}}},{M:an,L:hn,Z:ln}=ae,{getCenterX:dn,getCenterY:cn}=M,{arcTo:un}=Ki,pn={smooth(t,e,i){let s,n,o=0,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0;const _=t.length,g=[];for(;o<_;)switch(s=t[o],s){case an:h=u=t[o+1],l=p=t[o+2],o+=3,t[o]===hn?(d=t[o+1],c=t[o+2],g.push(an,dn(h,d),cn(l,c))):g.push(an,h,l);break;case hn:switch(r=t[o+1],a=t[o+2],o+=3,t[o]){case hn:un(g,r,a,t[o+1],t[o+2],e,u,p);break;case ln:un(g,r,a,h,l,e,u,p);break;default:g.push(hn,r,a)}u=r,p=a;break;case ln:un(g,h,l,d,c,e,u,p),g.push(ln),o+=1;break;default:n=pe[s];for(let e=0;e<n;e++)g.push(t[o+e]);o+=n}return s!==ln&&(g[1]=h,g[2]=l),g}};oe.creator=new us,oe.parse=Ti.parse,oe.convertToCanvasData=Ti.toCanvasData;const _n=new us,{drawRoundRect:gn}=_e;function fn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){gn(this,t,e,i,s,n)})}(t)}const yn={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=mn.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{}}}},mn=yn;mn.alphaPixelTypes.forEach((t=>mn.upperCaseTypeMap[t]=t.toUpperCase()));const vn=Et.get("TaskProcessor");class xn{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return Gt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){vn.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&&zt.assign(this.config,t),this.empty()}add(t,e){let i,s,n,o;const r=new xn(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 bn=Et.get("Resource"),En={tasker:new wn,map:{},get isComplete(){return kn.tasker.isComplete},set(t,e){kn.map[t]&&bn.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=Ct.image(s)),kn.set(t,e),e},destroy(){kn.map={}}},kn=En,Bn={maxRecycled:10,recycledList:[],patternTasker:new wn,get(t){let e=En.get(t.url);return e||En.set(t.url,e=Ct.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Tn.recycledList.push(t)}))},clearRecycled(){const t=Tn.recycledList;t.length>Tn.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&En.remove(t.url))),t.length=0)},hasAlphaPixel:t=>yn.alphaPixelTypes.some((e=>Tn.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+yn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+yn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Tn.recycledList=[]}},Tn=Bn,{IMAGE:Ln,create:Pn}=i;class Rn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Pn(Ln),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Bn.isFormat("svg",t)&&(this.isSVG=!0),Bn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),En.tasker.add((()=>Gt(this,void 0,void 0,(function*(){return yield t(this.url,s).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(t,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(t,i,s,n){if(t||(t=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=e.origin.createCanvas(t,i),r=o.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,i,s,n){const o=e.canvas.createPattern(t,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 Sn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Cn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function On(t,e){return(i,s)=>Mn(i,s,t,e&&e(s))}function Dn(t){return t}function Mn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Sn(t,e,Object.assign(n,s||{})),ro(t,e,i)}function In(t){return On(t)}function An(t,e){return On(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Wn(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Nn(this))}})))}function Fn(t,e){return On(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function zn(t,e){return On(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Un(t,e){return On(t,(t=>({set(i){this.__setAttr(t,i,e)&&Nn(this)}})))}function Hn(t){return On(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 On(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=Un;function Vn(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&jn(this)}})))}function jn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Nn(t)}const Gn=Vn;function Zn(t){return On(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Kn(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function qn(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&$n(this)}})))}function Jn(t){return On(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Qn(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Qn(this,t,e,i),this.mask&&$n(this)}})))}function $n(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Qn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Nn(t))}function to(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function eo(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function io(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function so(t){return On(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Et.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function no(t){return On(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function oo(t){return(e,i)=>{Sn(e,"__DataProcessor",{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?{}:zt.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=Cn(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[o]&&(r.set=s[o],delete s[o]),Sn(s,e,r)}const ao=new Et("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=>{po()}}function po(t){ho.length&&(ho.forEach((e=>{t&&ao.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ho.length=0)}function _o(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){Cn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function go(){return t=>{Dt.register(t)}}function fo(){return t=>{At.register(t)}}setTimeout((()=>po(!0)));const{copy:yo,toInnerPoint:mo,toOuterPoint:vo,scaleOfOuter:xo,rotateOfOuter:wo,skewOfOuter:bo,multiplyParent:Eo,divideParent:ko,getLayout:Bo}=b,To={},{round:Lo}=Math,Po={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Co(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)So(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++)Oo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Oo(t),t.__updateChange()},updateAllChange(t){if(Mo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Do(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),Ro.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=Lo(e),i=Lo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){Ro.zoomOfLocal(t,Io(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(To,r),xo(To,e,i,s),t.origin||t.around)Ro.setTransform(t,To,n,o);else{const e=t.x+To.e-r.e,a=t.y+To.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){Ro.rotateOfLocal(t,Io(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;yo(To,n),wo(To,e,i),t.origin||t.around?Ro.setTransform(t,To,!1,s):t.set({x:t.x+To.e-n.e,y:t.y+To.f-n.f,rotation:a.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Ro.skewOfLocal(t,Io(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){yo(To,t.__localMatrix),bo(To,e,i,s),Ro.setTransform(t,To,n,o)},transformWorld(t,e,i,s){yo(To,t.worldTransform),Eo(To,e),t.parent&&ko(To,t.parent.worldTransform),Ro.setTransform(t,To,i,s)},transform(t,e,i,s){yo(To,t.localTransform),Eo(To,e),Ro.setTransform(t,To,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Ro.getInnerOrigin(t,n.origin),r=Bo(e,o,n.around&&Ro.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=Ro.getInnerOrigin(t,n.origin);M.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 xo(i,Ro.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>M.tempToOuterOf(Ro.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Z.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(yo(To,t.worldTransform),ko(To,e.worldTransform),i?To:Object.assign({},To)),drop(t,e,i,s){t.setTransform(Ro.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}}},Ro=Po,{updateAllMatrix:So,updateMatrix:Co,updateAllWorldOpacity:Oo,updateAllChange:Do,updateChange:Mo}=Ro;function Io(t,e){return t.__layout.update(),t.parent?M.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:Wo}=Po,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++)Uo(e[t],e)},updateBounds(t,e){const i=[t];Uo(t,i),Ho(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:Uo,updateBoundsByBranchStack:Ho}=Fo,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,updateBounds:Xo}=Po,{toOuterOf:Vo,getPoints:jo,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 Vo(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 Vo(this.contentBounds,this.leaf.__world,this[Ko]||(this[Ko]={})),this[Ko]}get worldBoxBounds(){return Vo(this.boxBounds,this.leaf.__world,this[qo]||(this[qo]={})),this[qo]}get worldStrokeBounds(){return Vo(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:t}=this,{leafer:i}=t;if(t.isApp)return Xo(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.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 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 mt(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)),Go(r,a),M.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=jo(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&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.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 pr extends Qo{}pr.START="leafer.start",pr.BEFORE_READY="leafer.before_ready",pr.READY="leafer.ready",pr.AFTER_READY="leafer.after_ready",pr.VIEW_READY="leafer.view_ready",pr.VIEW_COMPLETED="leafer.view_completed",pr.STOP="leafer.stop",pr.RESTART="leafer.restart",pr.END="leafer.end";const _r={};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&&At.has(t)&&(e=At.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={}:_r)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:_r)}}const{on:yr,on_:mr,off:vr,off_:xr,once:wr,emit:br,emitEvent:Er,hasEvent:kr,destroy:Br}=gr.prototype,Tr={on:yr,on_:mr,off:vr,off_:xr,once:wr,emit:br,emitEvent:Er,hasEvent:kr,destroyEventer:Br},{isFinite:Lr}=Number,Pr=Et.get("setAttr"),Rr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!Lr(e)&&void 0!==e&&(Pr.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:Sr,multiplyParent:Cr,translateInner:Or,defaultWorld:Dr}=b,{toPoint:Mr,tempPoint:Ir}=Z,Ar={__updateWorldMatrix(){Cr(this.__local||this.__layout,this.parent?this.parent.__world:Dr,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)&&(Sr(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,Ir),Or(e,-Ir.x,-Ir.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Wr,updateAllMatrix:Fr}=Po,{updateBounds:zr}=Fo,{toOuterOf:Ur,copyAndSpread:Hr,copy:Nr}=_t,{toBounds:Yr}=rn,Xr={__updateWorldBounds(){const t=this.__layout;Ur(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(),Ur(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ur(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ur(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Yr(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;Hr(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Hr(t.renderBounds,t.boxBounds,t.renderSpread):Nr(t.renderBounds,t.strokeBounds)}},Vr={__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);Et.showBounds&&Et.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:jr}=Ao,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++)jr(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++)jr(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Zr,create:Kr}=i,{toInnerPoint:qr,toOuterPoint:Jr,multiplyParent:$r}=b,{toOuterOf:Qr}=_t,{copy:ta,move:ea}=M,{moveLocal:ia,zoomOfLocal:sa,rotateOfLocal:na,skewOfLocal:oa,moveWorld:ra,zoomOfWorld:aa,rotateOfWorld:ha,skewOfWorld:la,transform:da,transformWorld:ca,setTransform:ua,getFlipTransform:pa,getLocalOrigin:_a,getRelativeWorld:ga,drop:fa}=Po;t.Leaf=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 Ht}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,_a(this,t),e,i,s,n)}rotateOf(t,e,i){na(this,_a(this,t),e,i)}skewOf(t,e,i,s,n){oa(this,_a(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,pa(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 St.need("path")}getMotionPoint(t){return St.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=Un),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)}},t.Leaf=jt([_o(Rr),_o(Ar),_o(Xr),_o(Tr),_o(Vr)],t.Leaf);const{setListWithFn:ya}=_t,{sort:ma}=Fo,{localBoxBounds:va,localStrokeBounds:xa,localRenderBounds:wa,maskLocalBoxBounds:ba,maskLocalStrokeBounds:Ea,maskLocalRenderBounds:ka}=Ao,Ba=new Et("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ya(this.__layout.boxBounds,this.children,this.__hasMask?ba:va)}__updateStrokeBounds(){ya(this.__layout.strokeBounds,this.children,this.__hasMask?Ea:xa)}__updateRenderBounds(){ya(this.__layout.renderBounds,this.children,this.__hasMask?ka:wa)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(ma),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ba.warn("add self or destroyed");const i=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),i||e++}));t=Dt.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)}},t.Branch=jt([_o(Gr)],t.Branch);class Ta{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 Ta;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}}class Pa extends ne{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.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}}fn(OffscreenCanvasRenderingContext2D.prototype),fn(Path2D.prototype);const{mineType:Ra}=yn;function Sa(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,n)=>{t.convertToBlob({type:Ra(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:Ra(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise((t=>t())),download(t,e){},loadImage:t=>new Promise(((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then((t=>{i(t)})).catch((t=>{s(t)}))},n.onerror=t=>s(t),n.send()}))},e.canvas=Ct.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Ct,{canvas:(t,e)=>new Pa(t,e),image:t=>new Rn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Sn(e,"devicePixelRatio",{get:()=>1});const{userAgent:Ca}=navigator;Ca.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):Ca.indexOf("Safari")>-1&&-1===Ca.indexOf("Chrome")&&(e.fullImageShadow=!0),Ca.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Ca.indexOf("Mac")>-1?e.os="Mac":Ca.indexOf("Linux")>-1&&(e.os="Linux");class Oa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ta;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 Ta,this.target=t,e&&(this.config=zt.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 Ta,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:Da,updateBounds:Ma,updateChange:Ia}=Po,{pushAllChildBranch:Aa,pushAllParent:Wa}=Fo;const{worldBounds:Fa}=Ao;class za{constructor(t){this.updatedBounds=new mt,this.beforeBounds=new mt,this.afterBounds=new mt,t instanceof Array&&(t=new Ta(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Fa)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Fa),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:Ua,updateAllChange:Ha}=Po,Na=Et.get("Layouter");class Ya{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new La,this.target=t,e&&(this.config=zt.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){Na.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Na.warn("layouting"):this.times>3?Na.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=Lt.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?(Da(t,!0),e.add(t),t.isBranch&&Aa(t,e),Wa(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Wa(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||Ma(s[t])}Ma(i)}}))}(this.__levelList),function(t){t.list.forEach(Ia)}(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,Lt.end(e)}fullLayout(){const t=Lt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=cr,o=this.getBlocks(new Ta(e));e.emitEvent(new cr(i,o,this.times)),Ya.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),Lt.end(t)}static fullLayout(t){Ua(t,!0),t.isBranch?Fo.updateBounds(t):Po.updateBounds(t),Ha(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new za([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new za(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 Xa=Et.get("Renderer");class Va{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=zt.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 mt,Xa.log(e.innerName,"---\x3e");try{this.emitRender(ur.START),this.renderOnce(t),this.emitRender(ur.END,this.totalBounds),Bn.clearRecycled()}catch(t){this.rendering=!1,Xa.error(t)}Xa.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Xa.warn("rendering");if(this.times>3)return Xa.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new mt,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=Lt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new mt(s);i.save(),s.spread(Va.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Lt.end(e)}fullRender(){const t=Lt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Lt.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),Et.showRepaint&&Et.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 mt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.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 mt(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 mt(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||Xa.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)}}Va.clipSpread=10;const{hitRadiusPoint:ja}=_t;class Ga{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 Ta(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 Ta;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||Po.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 Ta;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 Ta;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 Ta,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||ja(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 Za{constructor(t,e){this.config={},e&&(this.config=zt.default(e,this.config)),this.picker=new Ga(this.target=t,this),this.finder=Ct.finder&&Ct.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):St.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ka(t){return On(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function qa(t){return On(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Ja(){return(t,e)=>{const i="_"+e;Sn(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(Ct,{watcher:(t,e)=>new Oa(t,e),layouter:(t,e)=>new Ya(t,e),renderer:(t,e,i)=>new Va(t,e,i),selector:(t,e)=>new Za(t,e)}),e.layout=Ya.fullLayout;const $a={},Qa={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}},th={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},eh={},ih={},sh={},nh={},oh={},rh={apply(){St.need("filter")}},ah={},hh={setStyleName:()=>St.need("state"),set:()=>St.need("state")},lh={list:{},register(t,e){lh.list[t]=e},get:t=>lh.list[t]},{parse:dh,objectToCanvasData:ch}=Ti,{stintSet:uh}=zt,{hasTransparent:ph}=Qa,_h={},gh=Et.get("UIData");class fh extends Ht{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,gh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,gh.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):(uh(this,"__isTransparentFill",ph(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(uh(this,"__isTransparentStroke",ph(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?dh(t):ch(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){yh(this,"shadow",t)}setInnerShadow(t){yh(this,"innerShadow",t)}setFilter(t){yh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&ih.compute("fill",this.__leaf),e&&ih.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=_h)):(this.__isStrokes=!0,this._stroke||(this._stroke=_h))}__removePaint(t,e){e&&this.__removeInput(t),sh.recycleImage(t,this),"fill"===t?(uh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(uh(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function yh(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 mh extends fh{}class vh extends mh{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 xh extends mh{__getInputData(t,e){const i=super.__getInputData(t,e);return se.forEach((t=>delete i[t])),i}}class wh extends vh{}class bh extends fh{}class Eh extends fh{get __boxStroke(){return!this.__pathInputed}}class kh extends fh{get __boxStroke(){return!this.__pathInputed}}class Bh extends fh{}class Th extends fh{}class Lh extends fh{get __pathInputed(){return 2}}class Ph extends mh{}const Rh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Sh extends fh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=Rh[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=Dt.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 Ch extends Eh{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 Oh extends Eh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const Dh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth: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+=rh.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:Mh}=zt,Ih={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Mh(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)}Mh(this.__world,"half",t.__hasHalf),Mh(t,"__fillAfterStroke",t.stroke&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill),t.__checkSingle(),Mh(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Ah(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=ih.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&oh.shadow(this,t,h),a&&(s.__isStrokes?ih.strokes(o,this,t):ih.stroke(o,this,t)),n&&(s.__isFills?ih.fills(n,this,t):ih.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&oh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?ih.strokes(o,this,t):ih.stroke(o,this,t)),c&&rh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?ih.strokes(o,this,t):ih.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,Qa.string(e.color))}n&&(s.__isFills?ih.fills(n,this,t):ih.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?ih.strokes(o,this,t):ih.stroke(o,this,t))}}else s.__pathInputed?Ah(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?ih.fills(n,this,t):ih.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),o&&!s&&(this.__.__isAlphaPixelStroke?ih.strokes(o,this,t):ih.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 Ah(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&ih.stroke(n,t,e),s&&ih.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&ih.stroke(n,t,e)}const Wh={__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 Fh,zh;t.UI=Fh=class extends t.Leaf{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 _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 St.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return St.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?Ti.toCanvasData(i,!0):i}getPathString(t,e,i){return Ti.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ah.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?pn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&eh.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?Ls.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){ih.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return St.need("animate")}killAnimate(t,e){}export(t,e){return St.need("export")}syncExport(t,e){return St.need("export")}clone(t){const e=zt.clone(this.toJSON());return t&&Object.assign(e,t),Fh.one(e)}static one(t,e,i,s,n){return Dt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){go()(this)}static registerData(t){oo(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([oo(fh)],t.UI.prototype,"__",void 0),jt([Ja()],t.UI.prototype,"zoomLayer",void 0),jt([In("")],t.UI.prototype,"id",void 0),jt([In("")],t.UI.prototype,"name",void 0),jt([In("")],t.UI.prototype,"className",void 0),jt([Kn("pass-through")],t.UI.prototype,"blendMode",void 0),jt([qn(1)],t.UI.prototype,"opacity",void 0),jt([Jn(!0)],t.UI.prototype,"visible",void 0),jt([Kn(!1)],t.UI.prototype,"locked",void 0),jt([Kn(!1)],t.UI.prototype,"dim",void 0),jt([Kn(!1)],t.UI.prototype,"dimskip",void 0),jt([to(0)],t.UI.prototype,"zIndex",void 0),jt([eo(!1)],t.UI.prototype,"mask",void 0),jt([io(!1)],t.UI.prototype,"eraser",void 0),jt([An(0,!0)],t.UI.prototype,"x",void 0),jt([An(0,!0)],t.UI.prototype,"y",void 0),jt([Un(100,!0)],t.UI.prototype,"width",void 0),jt([Un(100,!0)],t.UI.prototype,"height",void 0),jt([Fn(1,!0)],t.UI.prototype,"scaleX",void 0),jt([Fn(1,!0)],t.UI.prototype,"scaleY",void 0),jt([zn(0,!0)],t.UI.prototype,"rotation",void 0),jt([zn(0,!0)],t.UI.prototype,"skewX",void 0),jt([zn(0,!0)],t.UI.prototype,"skewY",void 0),jt([An(0,!0)],t.UI.prototype,"offsetX",void 0),jt([An(0,!0)],t.UI.prototype,"offsetY",void 0),jt([An(0,!0)],t.UI.prototype,"scrollX",void 0),jt([An(0,!0)],t.UI.prototype,"scrollY",void 0),jt([Wn()],t.UI.prototype,"origin",void 0),jt([Wn()],t.UI.prototype,"around",void 0),jt([In(!1)],t.UI.prototype,"lazy",void 0),jt([Hn(1)],t.UI.prototype,"pixelRatio",void 0),jt([Yn()],t.UI.prototype,"path",void 0),jt([Xn()],t.UI.prototype,"windingRule",void 0),jt([Xn(!0)],t.UI.prototype,"closed",void 0),jt([Un(0)],t.UI.prototype,"padding",void 0),jt([Un(!1)],t.UI.prototype,"lockRatio",void 0),jt([Un()],t.UI.prototype,"widthRange",void 0),jt([Un()],t.UI.prototype,"heightRange",void 0),jt([In(!1)],t.UI.prototype,"draggable",void 0),jt([In()],t.UI.prototype,"dragBounds",void 0),jt([In(!1)],t.UI.prototype,"editable",void 0),jt([so(!0)],t.UI.prototype,"hittable",void 0),jt([so("path")],t.UI.prototype,"hitFill",void 0),jt([Gn("path")],t.UI.prototype,"hitStroke",void 0),jt([so(!1)],t.UI.prototype,"hitBox",void 0),jt([so(!0)],t.UI.prototype,"hitChildren",void 0),jt([so(!0)],t.UI.prototype,"hitSelf",void 0),jt([so()],t.UI.prototype,"hitRadius",void 0),jt([no("")],t.UI.prototype,"cursor",void 0),jt([Kn()],t.UI.prototype,"fill",void 0),jt([Gn()],t.UI.prototype,"stroke",void 0),jt([Gn("inside")],t.UI.prototype,"strokeAlign",void 0),jt([Gn(1)],t.UI.prototype,"strokeWidth",void 0),jt([Gn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),jt([Gn("none")],t.UI.prototype,"strokeCap",void 0),jt([Gn("miter")],t.UI.prototype,"strokeJoin",void 0),jt([Gn()],t.UI.prototype,"dashPattern",void 0),jt([Gn(0)],t.UI.prototype,"dashOffset",void 0),jt([Gn(10)],t.UI.prototype,"miterLimit",void 0),jt([Xn(0)],t.UI.prototype,"cornerRadius",void 0),jt([Xn()],t.UI.prototype,"cornerSmoothing",void 0),jt([Ka()],t.UI.prototype,"shadow",void 0),jt([Ka()],t.UI.prototype,"innerShadow",void 0),jt([Ka()],t.UI.prototype,"blur",void 0),jt([Ka()],t.UI.prototype,"backgroundBlur",void 0),jt([Ka()],t.UI.prototype,"grayscale",void 0),jt([Ka()],t.UI.prototype,"filter",void 0),jt([Kn()],t.UI.prototype,"placeholderColor",void 0),jt([In(100)],t.UI.prototype,"placeholderDelay",void 0),jt([In({})],t.UI.prototype,"data",void 0),jt([co(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Fh=jt([_o(Dh),_o(Ih),uo()],t.UI),t.Group=class extends t.UI{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(){}},jt([oo(mh)],t.Group.prototype,"__",void 0),jt([Un(0)],t.Group.prototype,"width",void 0),jt([Un(0)],t.Group.prototype,"height",void 0),t.Group=jt([_o(t.Branch),go()],t.Group);const Uh=Et.get("Leafer");t.Leafer=zh=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&En.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),zh.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,zt.assign(s,t));const n=this.canvas=Ct.canvas(s);this.__controllers.push(this.renderer=Ct.renderer(this,n,s),this.watcher=Ct.watcher(this,s),this.layouter=Ct.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=n.view,e||(this.selector=Ct.selector(this),this.interaction=Ct.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Ct.hitCanvasManager()),this.canvasManager=new Ft,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))),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(pr.RESTART):this.emitLeafer(pr.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(pr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=zt.copyAttrs({},t,se);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new mt(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=zt.copyAttrs({},this.canvas,se);e.resize(t),this.updateLazyBounds(),this.__onResize(new lr(t,i))}__onResize(t){this.emitEvent(t),zt.copyAttrs(this.__,t,se),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 xt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(se.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&&se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=zt.copyAttrs({},this.canvas,se);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(pr.BEFORE_READY),this.emitLeafer(pr.READY),this.emitLeafer(pr.AFTER_READY),No.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(pr.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(pr.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 St.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 pr(t,this))}__listenEvents(){const t=Lt.start("FirstCreate "+this.innerName);this.once([[pr.START,()=>Lt.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){zh.list.remove(this);try{this.stop(),this.emitEvent(new pr(pr.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((()=>{Bn.clearRecycled()}),100)}catch(t){Uh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ta,jt([oo(xh)],t.Leafer.prototype,"__",void 0),jt([Un()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=zh=jt([go()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},jt([oo(Eh)],t.Rect.prototype,"__",void 0),t.Rect=jt([_o(Wh),uo(),go()],t.Rect);const{copy:Hh,add:Nh,includes:Yh}=_t,Xh=t.Rect.prototype,Vh=t.Group.prototype,jh={};t.Box=class extends t.Group{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(),Hh(jh,e),this.__updateRectRenderBounds(),t=!Yh(e,jh),t&&"hide"!==this.__.overflow&&Nh(e,jh)):this.__updateRectRenderBounds(),zt.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([oo(vh)],t.Box.prototype,"__",void 0),jt([Un(100)],t.Box.prototype,"width",void 0),jt([Un(100)],t.Box.prototype,"height",void 0),jt([In(!1)],t.Box.prototype,"resizeChildren",void 0),jt([Zn("show")],t.Box.prototype,"overflow",void 0),jt([co(Xh.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),jt([co(Xh.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),jt([co(Xh.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),jt([co(Xh.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),jt([co(Xh.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),jt([co(Xh.__updateChange)],t.Box.prototype,"__updateRectChange",null),jt([co(Xh.__render)],t.Box.prototype,"__renderRect",null),jt([co(Vh.__render)],t.Box.prototype,"__renderGroup",null),t.Box=jt([uo(),go()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},jt([oo(wh)],t.Frame.prototype,"__",void 0),jt([Kn("#FFFFFF")],t.Frame.prototype,"fill",void 0),jt([Zn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=jt([go()],t.Frame);const{moveTo:Gh,closePath:Zh,ellipse:Kh}=Ki;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Kh(h,r,a,r*s,a*s,0,n,o,!1),Kh(h,r,a,r,a,0,o,n,!0),s<1&&Zh(h)):(s<1&&(Kh(h,r,a,r*s,a*s),Gh(h,t,a)),Kh(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Gh(h,r,a),Kh(h,r,a,r,a,0,n,o,!1),Zh(h)):Kh(h,r,a,r,a)}},jt([oo(kh)],t.Ellipse.prototype,"__",void 0),jt([Xn(0)],t.Ellipse.prototype,"innerRadius",void 0),jt([Xn(0)],t.Ellipse.prototype,"startAngle",void 0),jt([Xn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=jt([go()],t.Ellipse);const{moveTo:qh,lineTo:Jh,drawPoints:$h}=Ki,{rotate:Qh,getAngle:tl,getDistance:el,defaultPoint:il}=M,{toBounds:sl}=rn;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Qh(i,e),i}set toPoint(t){this.width=el(il,t),this.rotation=tl(il,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?$h(e,t.points,!1,t.closed):(qh(e,0,0),Jh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?($h(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&eh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?sl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},jt([oo(bh)],t.Line.prototype,"__",void 0),jt([Vn("center")],t.Line.prototype,"strokeAlign",void 0),jt([Un(0)],t.Line.prototype,"height",void 0),jt([Xn()],t.Line.prototype,"points",void 0),jt([Xn(0)],t.Line.prototype,"curve",void 0),jt([Xn(!1)],t.Line.prototype,"closed",void 0),t.Line=jt([go()],t.Line);const{sin:nl,cos:ol,PI:rl}=Math,{moveTo:al,lineTo:hl,closePath:ll,drawPoints:dl}=Ki,cl=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)dl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,o=i/2;al(t,n,0);for(let e=1;e<s;e++)hl(t,n+n*nl(2*e*rl/s),o-o*ol(2*e*rl/s))}ll(t)}__updateRenderPath(){}__updateBoxBounds(){}},jt([oo(Bh)],t.Polygon.prototype,"__",void 0),jt([Xn(3)],t.Polygon.prototype,"sides",void 0),jt([Xn()],t.Polygon.prototype,"points",void 0),jt([Xn(0)],t.Polygon.prototype,"curve",void 0),jt([co(cl.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),jt([co(cl.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=jt([uo(),go()],t.Polygon);const{sin:ul,cos:pl,PI:_l}=Math,{moveTo:gl,lineTo:fl,closePath:yl}=Ki;t.Star=class extends t.UI{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*_l/i),o-(t%2==0?o:o*s)*pl(t*_l/i));yl(r)}},jt([oo(Th)],t.Star.prototype,"__",void 0),jt([Xn(5)],t.Star.prototype,"corners",void 0),jt([Xn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=jt([go()],t.Star),t.Image=class extends t.Rect{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([oo(Ch)],t.Image.prototype,"__",void 0),jt([Un("")],t.Image.prototype,"url",void 0),t.Image=jt([go()],t.Image);const ml=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Ct.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Rn({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 H(t.worldTransform).invert(),o=new H;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([oo(Oh)],t.Canvas.prototype,"__",void 0),jt([qa(100)],t.Canvas.prototype,"width",void 0),jt([qa(100)],t.Canvas.prototype,"height",void 0),jt([qa(1)],t.Canvas.prototype,"pixelRatio",void 0),jt([qa(!0)],t.Canvas.prototype,"smooth",void 0),jt([In(!1)],t.Canvas.prototype,"safeResize",void 0),jt([qa()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=jt([go()],t.Canvas);const{copyAndSpread:vl,includes:xl,spread:wl,setList:bl}=_t;t.Text=class extends t.UI{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=th.number(e,n),t.__letterSpacing=th.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=$a.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&&wl(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),zt.stintSet(this,"isOverflow",!xl(h,a)),this.isOverflow?(bl(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;vl(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&&!ah.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},jt([oo(Sh)],t.Text.prototype,"__",void 0),jt([Un(0)],t.Text.prototype,"width",void 0),jt([Un(0)],t.Text.prototype,"height",void 0),jt([Kn()],t.Text.prototype,"boxStyle",void 0),jt([In(!1)],t.Text.prototype,"resizeFontSize",void 0),jt([Kn("#000000")],t.Text.prototype,"fill",void 0),jt([Vn("outside")],t.Text.prototype,"strokeAlign",void 0),jt([so("all")],t.Text.prototype,"hitFill",void 0),jt([Un("")],t.Text.prototype,"text",void 0),jt([Un("")],t.Text.prototype,"placeholder",void 0),jt([Un("caption")],t.Text.prototype,"fontFamily",void 0),jt([Un(12)],t.Text.prototype,"fontSize",void 0),jt([Un("normal")],t.Text.prototype,"fontWeight",void 0),jt([Un(!1)],t.Text.prototype,"italic",void 0),jt([Un("none")],t.Text.prototype,"textCase",void 0),jt([Un("none")],t.Text.prototype,"textDecoration",void 0),jt([Un(0)],t.Text.prototype,"letterSpacing",void 0),jt([Un({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),jt([Un(0)],t.Text.prototype,"paraIndent",void 0),jt([Un(0)],t.Text.prototype,"paraSpacing",void 0),jt([Un("x")],t.Text.prototype,"writingMode",void 0),jt([Un("left")],t.Text.prototype,"textAlign",void 0),jt([Un("top")],t.Text.prototype,"verticalAlign",void 0),jt([Un(!0)],t.Text.prototype,"autoSizeAlign",void 0),jt([Un("normal")],t.Text.prototype,"textWrap",void 0),jt([Un("show")],t.Text.prototype,"textOverflow",void 0),t.Text=jt([go()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},jt([oo(Lh)],t.Path.prototype,"__",void 0),jt([Vn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=jt([go()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),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([oo(Ph)],t.Pen.prototype,"__",void 0),jt([(t,e)=>{Sn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=jt([_o(us,["set","path","paint"]),go()],t.Pen),t.App=class extends t.Leafer{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&&Ct.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(e){const i=new t.Leafer(e);return this.add(i),i}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&&zt.assign(e,t),this.autoLayout&&zt.copyAttrs(e,this,se),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))}},t.App=jt([go()],t.App);const El={},kl={isHoldSpaceKey:()=>kl.isHold("Space"),isHold:t=>El[t],setDownCode(t){El[t]||(El[t]=!0)},setUpCode(t){El[t]=!1}},Bl={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 Tl extends Qo{get spaceKey(){return kl.isHoldSpaceKey()}get left(){return Bl.left(this)}get right(){return Bl.right(this)}get middle(){return Bl.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)}}t.PointerEvent=class extends Tl{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=jt([fo()],t.PointerEvent);const Ll=t.PointerEvent,Pl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof Ta?t:new Ta(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 M.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(Pl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Pl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Pl,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){Pl.x=t?this.totalX:this.moveX,Pl.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=jt([fo()],t.DragEvent);const Rl=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=jt([fo()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=jt([fo()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=jt([fo()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=jt([fo()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=jt([fo()],t.ZoomEvent),t.KeyEvent=class extends Tl{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=jt([fo()],t.KeyEvent);const Sl={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:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.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:Cl.getSwipeDirection(M.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 Ta,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some((e=>e.draggable||e.editable||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},Cl=Sl,Ol=new Ta,{getDragEventData:Dl,getDropEventData:Ml,getSwipeEventData:Il}=Sl;class Al{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Dl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||Ol;return this.dragging&&(n?e?Ol:new Ta(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&Bl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.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 Ta(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=Dl(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(){const{running:e}=this.interaction,i=this.realDraggableList;if(i.length&&e){const{totalX:e,totalY:s}=this.dragData;i.forEach((i=>i.draggable&&i.move(t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:e,y:s}))))}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=Dl(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(M.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Il(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Ml(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.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 Wl=Et.get("emit");const Fl=["move","zoom","rotate","key"];function zl(t,e,i,s,n){if(Fl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Hl(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&&Ul(o,e,i,s,n)}}function Ul(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Hl(t,n)&&(hh.updateEventStyle&&!s&&hh.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 Hl(t,e){return e&&e.has(t)}const Nl={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:Yl,pathCanDrag:Xl,pathHasOutside:Vl}=Sl;class jl{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&&Bl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Bl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&kl.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=zt.clone(Nl),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ta(t),this.createTransformer(),this.dragger=new Al(this),s&&(this.config=zt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Bl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),Bl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Bl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Bl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=M.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;Bl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,kl.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]=!1,kl.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Ta),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach((t=>i.add(t))));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Yl(e.path,t)));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}),i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:o,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.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&&!Vl(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Xl(t.path))&&!Vl(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(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}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&&M.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}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(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)}),this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Yl(e.path,t.PointerEvent.LONG_TAP)||Yl(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new mt(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(pr.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],Ul(n,t,e,!0,s))return;n.isApp&&zl(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&zl(n,t,e,!1,s),Ul(n,t,e,!1,s))return}catch(t){Wl.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 Gl{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Gl.custom={};class Zl extends Ft{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ta,this.pixelList=new Ta}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Ct.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Ct.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:Kl,copy:ql,setRadius:Jl}=M,$l={},Ql=t.Leaf.prototype;Ql.__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&&(ql($l,t),Jl(t=$l,e.hitRadius)),Kl(t,i,$l),e.hitBox||n){if(_t.hitRadiusPoint(s.boxBounds,$l))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit($l)},Ql.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Ql.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Ql.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Ql.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const td=new H,ed=t.UI.prototype;ed.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(t.__isAlphaPixelFill||t.__isCanvas)&&"pixel"===t.hitFill,n=t.__isAlphaPixelStroke&&"pixel"===t.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=e.image.hitCanvasSize,a=r.hitScale=vt.set(0,0,o,o).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=vt.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),Bn.patternLocked=!0,this.__renderShape(r,{matrix:td.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),Bn.patternLocked=!1,r.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(t)},ed.__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 id=t.UI.prototype,sd=t.Rect.prototype,nd=t.Box.prototype;sd.__updateHitCanvas=nd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?id.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},sd.__hitFill=nd.__hitFill=function(t){return this.__hitCanvas?id.__hitFill.call(this,t):_t.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.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)))},t.Group.prototype.pick=function(t,i){return i||(i=Yt),this.updateLayout(),function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Ct.selector())}(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const od=ne.prototype;function rd(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 ad(t,e){t.__.__font?rd(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function hd(t,e,i){switch(e.__.strokeAlign){case"center":ld(t,1,e,i);break;case"inside":dd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?ld(t,2,e,i):dd(t,"outside",e,i)}}function ld(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.strokeWidth*e,n),n.__isStrokes?ud(t,!0,i,s):cd(i,s)}function dd(t,i,s,n){const o=n.getSameCanvas(!0,!0);o.font=s.__.__font,ld(t,2,s,o),o.blendMode="outside"===i?"destination-out":"destination-in",rd(s,o),o.blendMode="normal",s.__worldFlipped||e.fullImageShadow?n.copyWorldByReset(o,s.__nowWorld):n.copyWorldToInner(o,s.__nowWorld,s.__layout.renderBounds),o.recycle(s.__nowWorld)}function cd(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 ud(t,e,i,s){let n;for(let o=0,r=t.length;o<r;o++)n=t[o],n.image&&sh.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?cd(i,s):s.stroke(),s.restoreBlendMode()):e?cd(i,s):s.stroke())}function pd(t,i,s){const n=i.__;if(n.__strokeWidth)if(n.__font)hd(t,i,s);else switch(n.strokeAlign){case"center":_d(t,1,i,s);break;case"inside":!function(t,e,i){const s=e.__;i.save(),s.windingRule?i.clip(s.windingRule):i.clip(),_d(t,2,e,i),i.restore()}(t,i,s);break;case"outside":!function(t,i,s){const n=i.__;if(n.__fillAfterStroke)_d(t,2,i,s);else{const{renderBounds:o}=i.__layout,r=s.getSameCanvas(!0,!0);i.__drawRenderPath(r),_d(t,2,i,r),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(o),i.__worldFlipped||e.fullImageShadow?s.copyWorldByReset(r,i.__nowWorld):s.copyWorldToInner(r,i.__nowWorld,o),r.recycle(i.__nowWorld)}}(t,i,s)}}function _d(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.__strokeWidth*e,n),n.__isStrokes?ud(t,!1,i,s):s.stroke(),n.__useArrow&&ih.strokeArrow(t,i,s)}od.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},od.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},od.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),vt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(vt.x,vt.y,vt.width||1,vt.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:gd,getOuterOf:fd,getByMove:yd,getIntersectData:md}=_t;let vd;const{stintSet:xd}=zt,{hasTransparent:wd}=Qa;function bd(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=sh.image(i,t,e,n,!vd||!vd[e.url]);break;case"linear":s=nh.linearGradient(e,n);break;case"radial":s=nh.radialGradient(e,n);break;case"angular":s=nh.conicGradient(e,n);break;case"solid":const{type:o,blendMode:r,color:a,opacity:h}=e;s={type:o,blendMode:r,style:Qa.string(a,h)};break;default:void 0!==e.r&&(s={type:"solid",style:Qa.string(e)})}return s&&("string"==typeof s.style&&wd(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const Ed={compute:function(t,e){const i=e.__,s=[];let n,o,r=i.__input[t];r instanceof Array||(r=[r]),vd=sh.recycleImage(t,i);for(let i,n=0,o=r.length;n<o;n++)i=bd(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?(xd(i,"__isAlphaPixelFill",n),xd(i,"__isTransparentFill",o)):(xd(i,"__isAlphaPixelStroke",n),xd(i,"__isTransparentStroke",o))},fill:function(t,e,i){i.fillStyle=t,ad(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(sh.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),ad(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),ad(e,i),i.restoreBlendMode()):ad(e,i)}},fillPathOrText:ad,fillText:rd,stroke:pd,strokes:function(t,e,i){pd(t,e,i)},strokeText:hd,drawTextStroke:cd,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=md(s?gd(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,n);r=e.bounds.getFitMatrix(c);let{a:u,d:p}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=p),a=fd(n,r),o=yd(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,p)})}return t.__renderShape(s,i),{canvas:s,matrix:r,bounds:o,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let kd={};const{get:Bd,rotateOfOuter:Td,translate:Ld,scaleOfOuter:Pd,scale:Rd,rotate:Sd}=b;function Cd(t,e,i,s,n,o,r){const a=Bd();Ld(a,e.x+i,e.y+s),Rd(a,n,o),r&&Td(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Od(t,e,i,s,n,o,r){const a=Bd();Ld(a,e.x+i,e.y+s),n&&Rd(a,n,o),r&&Sd(a,r),t.transform=a}function Dd(t,e,i,s,n,o,r,a,h,l){const d=Bd();if(h)if("center"===l)Td(d,{x:i/2,y:s/2},h);else switch(Sd(d,h),h){case 90:Ld(d,s,0);break;case 180:Ld(d,i,s);break;case 270:Ld(d,0,i)}kd.x=e.x+n,kd.y=e.y+o,Ld(d,kd.x,kd.y),r&&Pd(d,kd,r,a),t.transform=d}const{get:Md,translate:Id}=b,Ad=new mt,Wd={},Fd={};function zd(t,e,i,s){const{changeful:n,sync:o}=i;n&&(t.changeful=n),o&&(t.sync=o),t.data=Ud(i,s,e)}function Ud(t,e,i){t.padding&&(e=Ad.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,repeat:p,filters:_}=t,g=e.width===s&&e.height===n,f={mode:r},y="center"!==h&&(u||0)%180==90;let m,v;switch(_t.set(Fd,0,0,y?n:s,y?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(a.getScaleData(d,c,i,Wd),m=Wd.scaleX,v=Wd.scaleY),h&&(m&&_t.scale(Fd,m,v,!0),J.toPoint(h,Fd,e,Fd,!0,!0))):g&&!u||(m=v=_t.getFitScale(e,Fd,"fit"!==r),_t.put(e,i,h,m,!1,Fd),_t.scale(Fd,m,v,!0)),l&&M.move(Fd,l),r){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(Fd.x||Fd.y||m||u)&&Od(f,e,Fd.x,Fd.y,m,v,u);break;case"repeat":(!g||m||u)&&Dd(f,e,s,n,Fd.x,Fd.y,m,v,u,h),p||(f.repeat="repeat");break;default:m&&Cd(f,e,Fd.x,Fd.y,m,v,u)}return f.transform||(e.x||e.y)&&(f.transform=Md(),Id(f.transform,e.x,e.y)),m&&"stretch"!==r&&(f.scaleX=m,f.scaleY=v),f.width=s,f.height=n,o&&(f.opacity=o),_&&(f.filters=_),p&&(f.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),f}let Hd,Nd=new mt;const{isSame:Yd}=_t;function Xd(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||zd(n,s,i,o),!0}function Vd(t,e){Zd(t,ir.LOAD,e)}function jd(t,e){Zd(t,ir.LOADED,e)}function Gd(t,e,i){e.error=i,t.forceUpdate("surface"),Zd(t,ir.ERROR,e)}function Zd(t,e,i){t.hasEvent(e)&&t.emitEvent(new ir(e,i))}function Kd(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:qd,scale:Jd,copy:$d}=b,{ceil:Qd,abs:tc}=Math;function ec(t,i,s){let{scaleX:n,scaleY:o}=Bn.patternLocked?t.__world:t.__nowWorld;const r=n+"-"+o+"-"+s;if(i.patternId===r||t.destroyed)return!1;{n=tc(n),o=tc(o);const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g}=a;u&&(l=qd(),$d(l,_),Jd(l,1/u,1/p),n*=u,o*=p),n*=s,o*=s,d*=n,c*=o;const f=d*c;if(!g&&f>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}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=qd(),_&&$d(l,_)),Jd(l,1/n,1/o));const m=t.getCanvas(Qd(d)||1,Qd(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=r,!0}}const{abs:ic}=Math;const sc={image:function(t,e,i,s,n){let o,r;const a=Bn.get(i);return Hd&&i===Hd.paint&&Yd(s,Hd.boxBounds)?o=Hd.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Hd=a.use>1?{leafPaint:o,paint:i,boxBounds:Nd.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Xd(t,e,i,a,o,s),n&&(Vd(t,r),jd(t,r))):a.error?n&&Gd(t,r,a.error):(n&&(Kd(t,!0),Vd(t,r)),o.loadId=a.load((()=>{Kd(t,!1),t.destroyed||(Xd(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),jd(t,r)),o.loadId=null}),(e=>{Kd(t,!1),Gd(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(t,i,s,n){const{scaleX:o,scaleY:r}=Bn.patternLocked?t.__world:t.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!ah.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||lr.isResizing(t)||ah.running)){let{width:t,height:i}=h;t*=ic(o)*a,i*=ic(r)*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.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()}(t,i,s,h),!0):(!s.style||s.sync||ah.running?ec(t,s,a):s.patternTask||(s.patternTask=Bn.patternTasker.add((()=>Gt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&ec(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:ec,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,Bn.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:zd,getPatternData:Ud,fillOrFitMode:Cd,clipMode:Od,repeatMode:Dd},{toPoint:nc}=Z,{hasTransparent:oc}=Qa,rc={},ac={};function hc(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=Qa.string(n,s)):(r=n.offset,o=Qa.string(n.color,s)),e.addColorStop(r,o),!a&&oc(o)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:lc,getDistance:dc}=M,{get:cc,rotateOfOuter:uc,scaleOfOuter:pc}=b,{toPoint:_c}=Z,gc={},fc={};function yc(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=lc(e,i);o=cc(),n?(pc(o,e,r/a*(s||1),1),uc(o,e,t+90)):(pc(o,e,1,r/a*(s||1)),uc(o,e,t))}return o}const{getDistance:mc}=M,{toPoint:vc}=Z,xc={},wc={};const bc={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:r}=t;nc(s||"top",i,rc),nc(n||"bottom",i,ac);const a=e.canvas.createLinearGradient(rc.x,rc.y,ac.x,ac.y),h={type:o,style:a};return hc(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;_c(s||"center",i,gc),_c(n||"bottom",i,fc);const h=e.canvas.createRadialGradient(gc.x,gc.y,0,gc.x,gc.y,dc(gc,fc)),l={type:o,style:h};hc(l,h,t.stops,r);const d=yc(i,gc,fc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;vc(s||"center",i,xc),vc(n||"bottom",i,wc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,xc.x,xc.y):e.canvas.createRadialGradient(xc.x,xc.y,0,xc.x,xc.y,mc(xc,wc)),l={type:o,style:h};hc(l,h,t.stops,r);const d=yc(i,xc,wc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:yc},{copy:Ec,toOffsetOutBounds:kc}=_t,Bc={},Tc={};function Lc(t,i,s,n){const{bounds:o,shapeBounds:r}=n;if(e.fullImageShadow){if(Ec(Bc,t.bounds),Bc.x+=i.x-r.x,Bc.y+=i.y-r.y,s){const{matrix:t}=n;Bc.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Bc.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Bc.width*=s,Bc.height*=s}t.copyWorld(n.canvas,t.bounds,Bc)}else s&&(Ec(Bc,i),Bc.x-=i.width/2*(s-1),Bc.y-=i.height/2*(s-1),Bc.width*=s,Bc.height*=s),t.copyWorld(n.canvas,r,s?Bc:i)}const{toOffsetOutBounds:Pc}=_t,Rc={};const Sc={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,p=e.getSameCanvas(),_=a.length-1;kc(l,Tc),a.forEach(((a,g)=>{p.setWorldShadow(Tc.offsetX+a.x*c,Tc.offsetY+a.y*u,a.blur*c,Qa.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Lc(p,Tc,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,o,a.blendMode):e.copyWorldToInner(p,s,r.renderBounds,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.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,p=e.getSameCanvas(),_=a.length-1;Pc(l,Rc),a.forEach(((a,g)=>{p.save(),p.setWorldShadow(Rc.offsetX+a.x*c,Rc.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Lc(p,Rc,n,i),p.restore(),h?(p.copyWorld(p,l,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,Qa.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,o,a.blendMode):e.copyWorldToInner(p,s,r.renderBounds,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.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:Cc}=Ao;function Oc(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),Mc(t,e,i,1)}(t,i,s,n);break;case"opacity-path":Mc(t,i,s,o);break;case"path":i.restore()}}function Dc(t){return t.getSameCanvas(!1,!0)}function Mc(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}t.Group.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&&(Oc(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=Dc(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Dc(t)),n||(n=Dc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||Cc(i,e)||i.__render(n||t,e);Oc(this,r,t,n,s,o)};const Ic=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ac=Ic+"_#~&*+\\=|≮≯≈≠=…",Wc=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 Fc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const zc=Fc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Uc=Fc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Hc=Fc(Ic),Nc=Fc(Ac),Yc=Fc("- —/~|┆·");var Xc;!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"}(Xc||(Xc={}));const{Letter:Vc,Single:jc,Before:Gc,After:Zc,Symbol:Kc,Break:qc}=Xc;function Jc(t){return zc[t]?Vc:Yc[t]?qc:Uc[t]?Gc:Hc[t]?Zc:Nc[t]?Kc:Wc.test(t)?jc:Vc}const $c={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 Qc(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:tu}=$c,{Letter:eu,Single:iu,Before:su,After:nu,Symbol:ou,Break:ru}=Xc;let au,hu,lu,du,cu,uu,pu,_u,gu,fu,yu,mu,vu,xu,wu,bu,Eu,ku=[];function Bu(t,e){gu&&!_u&&(_u=gu),au.data.push({char:t,width:e}),lu+=e}function Tu(){du+=lu,au.width=lu,hu.words.push(au),au={data:[]},lu=0}function Lu(){xu&&(wu.paraNumber++,hu.paraStart=!0,xu=!1),gu&&(hu.startCharSize=_u,hu.endCharSize=gu,_u=0),hu.width=du,bu.width?tu(hu):Eu&&Pu(),ku.push(hu),hu={words:[]},du=0}function Pu(){du>(wu.maxWidth||0)&&(wu.maxWidth=du)}const{top:Ru,right:Su,bottom:Cu,left:Ou}=t.Direction4;function Du(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 Mu={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));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[Ou],o-=l[Su]+l[Ou]):i.autoSizeAlign||(s=l[Ou]),r?(n=l[Ru],r-=l[Ru]+l[Cu]):i.autoSizeAlign||(n=l[Ru]));const d={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){wu=t,ku=t.rows,bu=t.bounds,Eu=!bu.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=bu;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;xu=!0,yu=null,_u=pu=gu=lu=du=0,au={data:[]},hu={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)uu=i[s],"\n"===uu?(lu&&Tu(),hu.paraEnd=!0,Lu(),xu=!0):(fu=Jc(uu),fu===eu&&"none"!==r&&(uu=Qc(uu,r,!lu)),pu=a.measureText(uu).width,n&&(n<0&&(gu=pu),pu+=n),mu=fu===iu&&(yu===iu||yu===eu)||yu===iu&&fu!==nu,vu=!(fu!==su&&fu!==iu||yu!==ou&&yu!==nu),cu=xu&&o?h-o:h,t&&h&&du+lu+pu>cu&&(e?(lu&&Tu(),du&&Lu()):(vu||(vu=fu===eu&&yu==nu),mu||vu||fu===ru||fu===su||fu===iu||lu+pu>cu?(lu&&Tu(),du&&Lu()):du&&Lu()))," "===uu&&!0!==xu&&du+lu===0||(fu===ru?(" "===uu&&lu&&Tu(),Bu(uu,pu),Tu()):mu||vu?(lu&&Tu(),Bu(uu,pu)):Bu(uu,pu)),yu=fu);lu&&Tu(),du&&Lu(),ku.length>0&&(ku[ku.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{wu.paraNumber++,du=a.measureText(t).width,ku.push({x:o||0,text:t,width:du,paraStart:!0}),Eu&&Pu()}))}(d,t,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Du(e,"x",t[Ou]);break;case"right":Du(e,"x",-t[Su])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Du(e,"y",t[Ru]);break;case"bottom":Du(e,"y",-t[Cu])}}(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:p,y:_,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":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,x,w,b=g||u?g:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,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),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,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(t,i,s,n){if(!n)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(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=Qa.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 Iu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!Qa.object)return t;t=Qa.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 Au(t){return t?t instanceof Array?t:[t]:[]}Object.assign($a,Mu),Object.assign(Qa,Iu),Object.assign(ih,Ed),Object.assign(sh,sc),Object.assign(nh,bc),Object.assign(oh,Sc),Object.assign(Ct,{interaction:(t,e,i,s)=>new jl(t,e,i,s),hitCanvas:(t,e)=>new Pa(t,e),hitCanvasManager:()=>new Zl}),Sa();class Wu extends Qo{get list(){return Au(this.value)}get oldList(){return Au(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}Wu.BEFORE_SELECT="editor.before_select",Wu.SELECT="editor.select",Wu.BEFORE_HOVER="editor.before_hover",Wu.HOVER="editor.hover";class Fu extends Wu{constructor(t,e){super(t,e)}}Fu.BEFORE_MOVE="editor.before_move",Fu.MOVE="editor.move";class zu extends Wu{constructor(t,e){super(t,e)}}zu.BEFORE_SCALE="editor.before_scale",zu.SCALE="editor.scale";class Uu extends Wu{constructor(t,e){super(t,e)}}Uu.BEFORE_ROTATE="editor.before_rotate",Uu.ROTATE="editor.rotate";class Hu extends Wu{constructor(t,e){super(t,e)}}function Nu(t){return(e,i)=>{const s="_"+i;Sn(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?Wu.BEFORE_SELECT:Wu.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Wu(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Hu.BEFORE_SKEW="editor.before_skew",Hu.SKEW="editor.skew";const{abs:Yu}=Math,{copy:Xu,scale:Vu}=b,{setListWithFn:ju}=_t,{worldBounds:Gu}=Ao,Zu={a:1,b:0,c:0,d:1,e:0,f:0},Ku={x:0,y:0,width:0,height:0};class qu extends t.UI{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?(ju(Ku,t,Gu),this.set(Ku),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=Yu(d.scaleX),h=Yu(d.scaleY);if(Xu(Zu,d),Zu.half=r%2,i!==h){Vu(Zu,1/i,1/h),t.setWorld(Zu,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(Zu,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/Yu(d.scaleX);o&&("string"==typeof o?ih.stroke(o,this,t):ih.strokes(o,this,t)),a&&("string"==typeof a?ih.fill(a,this,t):ih.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}jt([Nu((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],qu.prototype,"target",void 0);class Ju extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,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 $u={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return Qu([t],i,e),i}};function Qu(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&&Qu(s.children,e,i)}}const{findOne:tp,findByBounds:ep}=$u;class ip extends t.Group{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 qu,this.targetStroker=new qu,this.bounds=new mt,this.selectArea=new Ju,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 Ta(ep(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&&!tp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ta(this.editor.editBox.rect)};return tp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):tp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(t.shiftKey||i)}__listenEvents(){const{editor:e}=this;e.waitLeafer((()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[Wu.HOVER,this.onHover,this],[Wu.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:sp,top:np,topRight:op,right:rp,bottomRight:ap,bottom:hp,bottomLeft:lp,left:dp}=t.Direction9,{toPoint:cp}=Z,{within:up}=a,pp={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:_,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,x=t.scaleY/e.scaleY,w=v<0?-1:1,b=x<0?-1:1,E=a?v:w*u.width/y,k=a?x:b*u.height/m;s.x*=a?v:w,s.y*=a?x:b;const B=(-s.y+m)/m,T=(s.x+y)/y,L=(s.y+m)/m,P=(-s.x+y)/y;switch(i){case np:c=B,h="bottom";break;case rp:d=T,h="left";break;case hp:c=L,h="top";break;case dp:d=P,h="right";break;case sp:c=B,d=P,h="bottom-right";break;case op:c=B,d=T,h="bottom-left";break;case ap:c=L,d=T,h="top-left";break;case lp:c=L,d=P,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case np:case hp:t=c;break;case dp:case rp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const R=1!==d,S=1!==c;if(R&&(d/=E),S&&(c/=k),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(cp(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new mt(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;R&&(d*=s),S&&(c*=n)}}if(R&&p){const e=u.width*t.scaleX;d=up(e*d,p)/e}if(S&&_){const e=u.height*t.scaleY;c=up(e*c,_)/e}return R&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),S&&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 sp:o="bottom-right";break;case op:o="bottom-left";break;case ap:o="top-left";break;case lp:o="top-right";break;default:o="center"}return cp(n||o,t,r,!0),{origin:r,rotation:M.getRotation(s,r,i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case np:case sp:o={x:.5,y:0},n="bottom",a=1;break;case hp:case ap:o={x:.5,y:1},n="top",a=1;break;case dp:case lp:o={x:0,y:.5},n="right",h=1;break;case rp:case op: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,cp(s||n,t,r,!0);const c=M.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 dp:t=rp;break;case sp:t=op;break;case lp:t=ap;break;case rp:t=dp;break;case op:t=sp;break;case ap:t=lp}if(i)switch(t){case np:t=hp;break;case sp:t=lp;break;case op:t=ap;break;case hp:t=np;break;case lp:t=sp;break;case ap:t=op}return t}},_p={};function gp(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:p,flippedY:_}=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*(pp.getFlipDirection(s.direction,p,_)+1),n=2*Math.round(a.formatRotation(n,!0)/2);const{url:y,x:m,y:v}=f,x=y+n;_p[x]?s.cursor=_p[x]:_p[x]=s.cursor={url:yp(y,n),x:m,y:v}}function fp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.editBox.rect.cursor=i?e:void 0}function yp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class mp extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const vp=["top","right","bottom","left"],xp=void 0;class wp extends t.Group{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(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new mp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,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 mp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new mp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new mp({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:xp},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:p,rotateable:_,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,x,w={};for(let e=0;e<8;e++)Z.toPoint(Z.directionData[e],t,w),v=n[e],m=o[e],x=r[Math.floor(e/2)],v.set(w),m.set(w),x.set(w),v.visible=x.visible=y&&!(!p&&!_),m.visible=y&&_&&p&&!h.rotatePoint,e%2&&(v.visible=m.visible=y&&!!u,(e+1)/2%2?(x.width=a,g&&2*v.width>a&&(v.visible=!1)):(x.height=l,v.rotation=90,g&&2*v.width>l&&(v.visible=!1)));i.visible=y&&_&&!(!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=vp.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=vp.indexOf(i);(h%2&&r||(h+1)%2&&a)&&s&&(h=(h+2)%4);const l=s?pp.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:xp};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),gp(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(e){const{editor:i}=this;if(i.single){const{element:s}=i;if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find((e=>e.editable&&e instanceof t.Text))||e.find((e=>e instanceof t.Text));if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){const{editor:n}=this;e.direction=s,e.pointType=i;const o=[[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]];"circle"!==e.name&&o.push([t.PointerEvent.ENTER,t=>{this.enterPoint=e,gp(n,t)}]),this.__eventIds.push(e.on_(o))}__listenEvents(){const{rect:e,editor:i}=this;this.__eventIds.push(i.on_(Wu.SELECT,this.onSelect,this),e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,i.onMove,i],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,()=>fp(i)],[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const bp={x:0,y:0,width:1e5,height:1e5};class Ep extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,bp),Object.assign(this.__world,bp)}__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 kp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',Bp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${kp}\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${kp}\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${kp}\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},Tp=new mt;function Lp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer.zoomLayer;e.safeChange((()=>{Tp.setListWithFn(i,(t=>t.getBounds("box","page"))),0===Tp.width&&(Tp.width=.1),0===Tp.height&&(Tp.height=.1),e.reset(Tp.get())})),s.add(e)}const Pp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Rp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Sp={group(e,i,s){e.sort(Rp);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(Pp);const a=new H(i.worldTransform);return a.divideParent(o.worldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach((t=>t.dropTo(r))),n.unlockLayout(),r},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach((t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)})),e.unlockLayout(),i},toTop(t){t.sort(Pp),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(Rp),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},Cp=Et.get("EditToolCreator");function Op(){return t=>{Mp.register(t)}}const Dp=Op,Mp={list:{},register(t){const{tag:e}=t.prototype;Ip[e]&&Cp.repeat(e),Ip[e]=t},get:(t,e)=>new Ip[t](e)},{list:Ip}=Mp;class Ap extends Wu{constructor(t,e){super(t,e)}}Ap.BEFORE_OPEN="innerEditor.before_open",Ap.OPEN="innerEditor.open",Ap.BEFORE_CLOSE="innerEditor.before_close",Ap.CLOSE="innerEditor.close";class Wp extends Wu{constructor(t,e){super(t,e)}}Wp.BEFORE_GROUP="editor.before_group",Wp.GROUP="editor.group",Wp.BEFORE_UNGROUP="editor.before_ungroup",Wp.UNGROUP="editor.ungroup",Wp.BEFORE_OPEN="editor.before_open_group",Wp.OPEN="editor.open_group",Wp.BEFORE_CLOSE="editor.before_close_group",Wp.CLOSE="editor.close_group";const{updateMatrix:Fp}=Po,zp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Up="top-left";class Hp extends t.Rect{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&&zp[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,Fp(this.parent),Fp(this);const a=new H(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Fp(this),this.changedTransform=new H(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(Up,o);break;case"scaleX":t.scaleOf(Up,o,1);break;case"scaleY":t.scaleOf(Up,1,o);break;case"skewX":t.skewOf(Up,o,0);break;case"skewY":t.skewOf(Up,0,o)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Np extends t.Group{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 Ta,this.openedGroupList=new Ta,this.simulateTarget=new Hp(this),this.editBox=new wp(this),this.editToolList={},this.selector=new ip(this),this.editMask=new Ep(this),this.targetEventIds=[];let i=zt.clone(Bp);t&&(i=zt.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),St.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&&Lp(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]||Mp.get(t,this),this.editBox.load(),this.editTool.load()}}getEditSize(t){return this.mergeConfig.editSize}onMove(e){if(e instanceof t.MoveEvent){if("drag"!==e.moveType){const{moveable:t,resizeable:i}=this.mergeConfig,s=e.getLocalMove(this.element);"move"===t?(e.stop(),this.move(s.x,s.y)):"zoom"===i&&e.stop()}}else{const i={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),this.move(t.DragEvent.getValidMove(this.element,this.editBox.dragStartData.point,i))}}onScale(e){const{element:i}=this;let{around:s,lockRatio:n,resizeable:o,flipable:r,editSize:a}=this.mergeConfig;if(e instanceof t.ZoomEvent)"zoom"===o&&(e.stop(),this.scaleOf(i.getBoxPoint(e),e.scale,e.scale));else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(n=!0);const o=pp.getScaleData(i,this.editBox.dragStartData.bounds,t,e.getInnerTotal(i),n,pp.getAround(s,e.altKey),r,this.multiple||"scale"===a);this.editTool.onScaleWithDrag?(o.drag=e,this.scaleWithDrag(o)):this.scaleOf(o.origin,o.scaleX,o.scaleY)}}onRotate(e){const{skewable:i,rotateable:s,around:n,rotateGap:o}=this.mergeConfig,{direction:r,name:h}=e.current;if(i&&"resize-line"===h)return this.onSkew(e);const{element:l}=this,{dragStartData:d}=this.editBox;let c,u;if(e instanceof t.RotateEvent){if("rotate"!==s)return;e.stop(),u=e.rotation,c=l.getBoxPoint(e),l.scaleX*l.scaleY<0&&(u=-u)}else{const t=pp.getRotateData(l.boxBounds,r,e.getBoxPoint(l),l.getBoxPoint(d),e.shiftKey?null:l.around||l.origin||n||"center");u=t.rotation,c=t.origin}l.scaleX*l.scaleY<0&&(u=-u),e instanceof t.DragEvent&&(u=d.rotation+u-l.rotation),u=a.float(a.getGapRotation(u,o,l.rotation),2),u&&this.rotateOf(c,u)}onSkew(t){const{element:e}=this,{around:i}=this.mergeConfig,{origin:s,skewX:n,skewY:o}=pp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),pp.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 Fu(Fu.BEFORE_MOVE,o));const r=new Fu(Fu.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 H(Po.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 Uu(Uu.BEFORE_ROTATE,r));const a=new Uu(Uu.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 Hu(Hu.BEFORE_SKEW,h));const l=new Hu(Hu.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(Po.getInnerOrigin(this.element,t))}getChangedTransform(t){const{element:e}=this;if(this.multiple&&!e.canChange)return e.changedTransform;const i=new H(e.worldTransform);return t(),new H(e.worldTransform).divide(i)}group(t){return this.multiple&&(this.emitGroupEvent(Wp.BEFORE_GROUP),this.target=Sp.group(this.list,this.element,t),this.emitGroupEvent(Wp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(Wp.BEFORE_UNGROUP,t))),this.target=Sp.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(Wp.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(Wp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Wp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Wp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Wp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Po.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 Wp(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&&Mp.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||Mp.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(Ap.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Ap.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Ap.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Ap.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Ap(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){gp(this,t)}listenTargetEvents(){if(!this.targetEventIds.length){const{app:e,leafer:i,editBox:s,editMask:n}=this;this.targetEventIds=[i.on_(ur.START,this.onRenderStart,this),e.on_([[ur.CHILD_START,this.onAppRenderStart,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,s.onArrow,s]])],n.visible&&n.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)=>{Sn(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}})}],Np.prototype,"mergeConfig",void 0),jt([Nu((function(t,e){t.emitEvent(new Wu(Wu.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],Np.prototype,"hoverTarget",void 0),jt([Nu((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ta?i:new Ta(i),t.multiple&&Lp(t)):(t.simulateTarget.remove(),t.leafList.reset(),t.closeInnerEditor()),t.emitEvent(new Wu(Wu.SELECT,{editor:t,value:i,oldValue:e})),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{fp(t),t.updateEditTool(),t.update(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents())}))],Np.prototype,"target",void 0);class Yp{static registerInnerEditor(){Mp.register(this)}get tag(){return"InnerEditor"}get editBox(){return this.editor.editBox}constructor(t){this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,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)}}t.EditTool=class extends Yp{static registerEditTool(){Mp.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()}},t.EditTool=jt([Op()],t.EditTool);const{left:Xp,right:Vp}=t.Direction9,{move:jp,copy:Gp,toNumberPoints:Zp}=M;t.LineEditTool=class extends t.EditTool{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===Xp;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=Zp(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?(jp(t,o,r),s&&jp(e,-o,-r)):(s&&jp(t,-o,-r),jp(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),Gp(s[7],i),Gp(e[7],i),Gp(s[3],a),Gp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Xp||t===Vp,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=jt([Op()],t.LineEditTool);const{M:Kp,L:qp,C:Jp,Q:$p,Z:Qp,N:t_,D:e_,X:i_,G:s_,F:n_,O:o_,P:r_,U:a_}=ae,h_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Kp:case qp:l_(t,e,i,n,1),n+=3;break;case Jp:l_(t,e,i,n,3),n+=7;break;case $p:l_(t,e,i,n,2),n+=5;break;case Qp:n+=1;break;case t_:l_(t,e,i,n,2),n+=5;break;case e_:l_(t,e,i,n,2),n+=9;break;case i_:l_(t,e,i,n,2),n+=6;break;case s_:l_(t,e,i,n,2),n+=9;break;case n_:l_(t,e,i,n,2),n+=5;break;case o_:t[n]=s_,t.splice(n+4,0,t[n+3],0),l_(t,e,i,n,2),n+=9,o+=2;break;case r_:t[n]=n_,t.splice(n+4,0,t[n+3]),l_(t,e,i,n,2),n+=5,o+=1;break;case a_:l_(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:l_}=h_,d_=b.get(),{topLeft:c_,top:u_,topRight:p_,right:__,bottom:g_,left:f_}=t.Direction9;function y_(t,e,i){t.pathInputed?m_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function m_(t,e,i){h_.scale(t.__.path,e,i),t.path=t.__.path}function v_(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):h_.scalePoints(s,e,i),t.points=s}function x_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)d_.a=e,d_.d=i,s[t].transform(d_,!0)}const w_=t.Leaf.prototype;function b_(e,i,s){E_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,(t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY))})),e.on_(t.ZoomEvent.BEFORE_ZOOM,(t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)})))}function E_(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&zt.assign(i,e),zt.assign(t.config,i,t.userConfig)}w_.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))},w_.__scaleResize=function(t,e){y_(this,t,e)},w_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},w_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.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 u_:case g_:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case f_:case __:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case c_:case p_: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):y_(this,t,e)},t.Path.prototype.__scaleResize=function(t,e){m_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?m_(this,t,e):this.points?v_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?m_(this,t,e):this.points?v_(this,t,e):y_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){x_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||y_(this,t,e),i&&x_(this,t,e)},St.add("resize"),St.add("editor","resize"),Ct.editor=function(t,e){const i=new Np(t);return e&&e.sky.add(e.editor=i),i},t.Box.addAttr("textBox",!1,In),t.UI.addAttr("editConfig",void 0,In),t.UI.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),In),t.UI.addAttr("editInner","PathEditor",In),t.Group.addAttr("editInner","",In),t.Text.addAttr("editInner","TextEditor",In),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const k_=Et.get("LeaferTypeCreator"),B_={list:{},register(t,e){T_[t]&&k_.repeat(t),T_[t]=e},run(t,e){const i=T_[t];i&&i(e)}},{list:T_,register:L_}=B_;L_("viewport",b_),L_("custom",(function(t){b_(t,null,!0)})),L_("design",(function(t){b_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),L_("document",(function(t){b_(t,{zoom:{min:1},move:{scroll:"limit"}})}));const P_={getData(t){const e=t[0],i=t[1],s=M.getCenter(e.from,i.from),n=M.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=M.getDistance(e.from,i.from);return{move:o,scale:M.getDistance(e.to,i.to)/r,rotation:M.getRotation(e.from,i.from,e.to,i.to),center:n}}},R_={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(t,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const h=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(e.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=a.within(r,0,1);n=1-h/(4*(t.deltaY?i.delta.y:i.delta.x))*r,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class S_{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),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:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const C_=t.Leafer.prototype,O_=new mt;function D_(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function M_(t,e){return Object.assign(Object.assign({},e),{scale:t})}C_.initType=function(t){B_.run(t,this)},C_.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}=O_.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}},C_.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 I_=jl.prototype;I_.createTransformer=function(){this.transformer=new S_(this)},I_.move=function(t){this.transformer.move(t)},I_.zoom=function(t){this.transformer.zoom(t)},I_.rotate=function(t){this.transformer.rotate(t)},I_.transformEnd=function(){this.transformer.transformEnd()},I_.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):R_.getScale(t,e);if(1!==o)this.zoom(M_(o,t));else{const s=e.getMove?e.getMove(t,e):R_.getMove(t,e);i.snap&&M.round(s),this.move(D_(s,t))}},I_.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=P_.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(M_(n,t)),this.move(D_(i,t))};const A_=Al.prototype,{abs:W_}=Math;function F_(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}A_.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=W_(i),o=W_(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),M.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},A_.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},A_.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},A_.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 p=0,_=0;this.autoMoveTimer=setInterval((()=>{p+=c,_+=u,M.move(i,c,u),M.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)}),10)},A_.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},St.add("viewport"),St.add("view"),t.Leafer.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 mt,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=F_(c,"in");break;case"out":h=F_(c,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new mt(this.boxBounds)).height=0;break;case"fit-height":(t=new mt(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:p,height:_}=r;let g=o.x-r.x,f=o.y-r.y;return i?(g+=Math.max((o.width-p)/2,0),f+=Math.max((o.height-_)/2,0)):(h=this.getValidScale(Math.min(o.width/p,o.height/_)),g+=(o.width-p*h)/2,f+=(o.height-_*h)/2,M.scaleOf(e,r,h),r.scaleOf(r,h),e.scaleX*=h,e.scaleY*=h),M.move(e,g,f),r.move(g,f),n.set(e,s),r}return n.worldBoxBounds};class z_ extends t.Group{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&&zt.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;"string"==typeof e?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{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 mt(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,p=l<1,{scrollXBar:_,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,p?g.width+6:2,u?_.height+6:2,2]);_.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:p})}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:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.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())}}St.add("scroll");class U_ extends bh{}function H_(t){return On(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,jn(this)}}})))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}},jt([oo(U_)],t.Arrow.prototype,"__",void 0),jt([H_("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=jt([go()],t.Arrow);const{M:N_,L:Y_,C:X_,Q:V_,O:j_}=ae,{rotate:G_,copyFrom:Z_,scale:K_}=M,q_={},J_={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 N_:case Y_:$_(t,l+1,e,i,s,n,o,r),l+=3;break;case X_:for(h=1;h<6;h+=2)$_(t,l+h,e,i,s,n,o,r);l+=7;break;case V_:for(h=1;h<4;h+=2)$_(t,l+h,e,i,s,n,o,r);l+=5;break;case j_: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){J_.layout(t,0,0,1,1,e,i)}};function $_(t,e,i,s,n,o,r,a){Z_(q_,t[e],t[e+1]),r&&G_(q_,r,a),n&&K_(q_,n,o),t[e]=i+q_.x,t[e+1]=s+q_.y}const{layout:Q_,rotate:tg}=J_,{getAngle:eg}=M,ig={x:-.5},sg={connect:ig,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},ng={connect:ig,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},og={connect:ig,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]},rg={connect:ig,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]},ag={offset:ig,path:[...og.path],dashPath:[1,-2.5,0,2,-1,0]};tg(ag.path,180,{x:-1.5,y:0});const hg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},lg={connect:{x:.5},path:[...hg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},dg={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]},cg={path:[...dg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},ug=zt.clone(dg),pg=zt.clone(cg);tg(ug.path,45),tg(pg.path,45);const _g={angle:sg,"angle-side":ng,arrow:rg,triangle:og,"triangle-flip":ag,circle:lg,"circle-line":hg,square:cg,"square-line":dg,diamond:pg,"diamond-line":ug,mark:{offset:ig,path:[1,0,-2,2,0,2]}};function gg(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:_g[e];let p=d?d.x:0,_=l?l.x:0;const g=[...c];return r&&u&&g.push(...u),"none"!==a&&(p-=.5),l&&("round"===h&&l.roundJoin?_+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(_+=l.bevelJoin)),_&&Q_(g,_,0),Q_(g,s.x,s.y,n,n,eg(i,s)),o.x=(p+_)*n,g}const{M:fg,L:yg,C:mg,Q:vg,Z:xg,N:wg,D:bg,X:Eg,G:kg,F:Bg,O:Tg,P:Lg,U:Pg}=ae,{copy:Rg,copyFrom:Sg,getDistancePoint:Cg}=M,Og={},Dg={},Mg={},Ig={},Ag={},Wg={list:_g,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 fg:case yg:(d<2||h+6>=l)&&(Sg(Ag,r[h+1],r[h+2]),!d&&c&&Rg(Dg,Ag)),h+=3;break;case mg:1!==d&&h+7!==l||Fg(r,Ig,Ag,h+3),h+=7;break;case vg:1!==d&&h+5!==l||Fg(r,Ig,Ag,h+1),h+=5;break;case xg:return;case wg:h+=5;break;case bg:h+=9;break;case Eg:h+=6;break;case kg:h+=9;break;case Bg:h+=5;break;case Tg:h+=7;break;case Lg:h+=4;break;case Pg:1!==d&&h+6!==l||Fg(r,Ig,Ag,h+1),h+=6}if(d++,1===d&&a!==fg)return;if(2===d&&c&&Rg(Mg,a===yg?Ag:Ig),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=gg(t,i,Mg,Dg,n,Og,!!o);o?d.push(...e):l.push(...e),Og.x&&(Cg(Dg,Mg,-Og.x,!0),l[1]=Mg.x,l[2]=Mg.y)}if(s&&"none"!==s){const e=gg(t,s,Ig,Ag,n,Og,!!o);if(o?d.push(...e):l.push(...e),Og.x){let t;switch(Cg(Ag,Ig,-Og.x,!0),a){case yg:t=h-3+1;break;case mg:t=h-7+5;break;case vg:t=h-5+3;break;case Pg:t=h-6+3}t&&zg(l,Ig,t)}}}else Rg(Ig,Ag)}}};function Fg(t,e,i,s){Sg(e,t[s],t[s+1]),Sg(i,t[s+2],t[s+3])}function zg(t,e,i){t[i]=e.x,t[i+1]=e.y}St.add("arrow"),t.UI.addAttr("startArrow","none",H_),t.UI.addAttr("endArrow","none",H_),Object.assign(eh,Wg),Object.assign(ih,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:Ug,NoAndSkip:Hg,YesAndSkip:Ng}=t.Answer,Yg={},Xg={},Vg={};class jg{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"#":Yg.id=t.substring(1),t=Yg;break;case".":Xg.className=t.substring(1),t=Xg;break;default:Vg.tag=t,t=Vg}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?zt.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&&Po.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===Ug||o===Ng){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Hg&&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 Gg=t.UI.prototype;function Zg(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Ct.selector())}Gg.find=function(t,e){return Zg(this).getBy(t,this,!1,e)},Gg.findOne=function(t,e){return Zg(this).getBy(t,this,!0,e)},St.add("find"),Ct.finder=function(t){return new jg(t)};const{setPoint:Kg,addPoint:qg,toBounds:Jg}=Y;const $g={syncExport(t,i,s){let n;this.running=!0;const o=yn.fileType(i),r=i.includes(".");s=yn.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===o)r&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!r||t.toJSON(s.json)};else if("svg"===o)r&&l(h(t.toSVG(),"svg"),i),n={data:!!r||t.toSVG()};else{let e,o,r=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:_,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=void 0===s.smooth?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),w=d&&f&&void 0===s.fill?t.fill:s.fill,b=yn.isOpaqueImage(i)||w,E=new H;if(f)e=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(r=l.scaleX,h=l.scaleY,i){case"inner":E.set(l);break;case"local":E.set(l).divide(t.localTransform),r/=t.scaleX,h/=t.scaleY;break;case"world":r=1,h=1;break;case"page":i=c||t;default:E.set(l).divide(t.getTransform(i));const e=i.worldTransform;r/=r/e.scaleX,h/=h/e.scaleY}e=t.getBounds("render",i)}const k={scaleX:1,scaleY:1};a.getScaleData(s.scale,s.size,e,k);let B=s.pixelRatio||1,{x:T,y:L,width:P,height:R}=new mt(e).scale(k.scaleX,k.scaleY);_&&(T+=_.x,L+=_.y,P=_.width,R=_.height);const S={matrix:E.scale(1/k.scaleX,1/k.scaleY).invert().translate(-T,-L).withScale(1/r*k.scaleX,1/h*k.scaleY)};let C,O=Ct.canvas({width:Math.floor(P),height:Math.floor(R),pixelRatio:B,smooth:v,contextSettings:x});if(p&&(C=t,C.__worldOpacity=0,t=c||t,S.bounds=O.bounds),O.save(),u&&void 0!==w){const e=t.get("fill");t.fill="",t.__render(O,S),t.fill=e}else t.__render(O,S);if(O.restore(),C&&C.__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?qg(r,n,o):Kg(r={},n,o)),a++;const h=new mt;return Jg(r,h),h.scale(1/t.pixelRatio).ceil()}(O);const t=O,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};O=Ct.canvas(s),O.copyWorld(t,o,s)}if(y){const[t,e,i,s]=a.fourNumber(y),n=O,{width:o,height:r}=n;O=Ct.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),O.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r})}b&&O.fillWorld(O.bounds,w||"#FFFFFF","destination-over"),m&&m(O);n={data:"canvas"===i?O:O.export(i,s),width:O.pixelWidth,height:O.pixelHeight,renderBounds:e,trimBounds:o}}return this.running=!1,n},export(t,i,s){return this.running=!0,function(t){Qg||(Qg=new wn);return new Promise((e=>{Qg.add((()=>Gt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((n=>new Promise((o=>{const r=()=>Gt(this,void 0,void 0,(function*(){if(!En.isComplete)return e.requestRender(r);const a=$g.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()}));t.updateLayout(),tf(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))))}};let Qg;function tf(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>tf(t)))}const ef=ne.prototype,sf=Et.get("@leafer-in/export");ef.export=function(t,e){const{quality:i,blob:s}=yn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},ef.toBlob=function(t,i){return new Promise((s=>{e.origin.canvasToBolb(this.view,t,i).then((t=>{s(t)})).catch((t=>{sf.error(t),s(null)}))}))},ef.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},ef.saveAs=function(t,i){return new Promise((s=>{e.origin.canvasSaveAs(this.view,t,i).then((()=>{s(!0)})).catch((t=>{sf.error(t),s(!1)}))}))},St.add("export"),Object.assign(ah,$g),t.UI.prototype.export=function(t,e){return ah.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return ah.syncExport(this,t,e)};const nf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},of={top:"flex-start",middle:"center",bottom:"flex-end"},rf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function af(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=Qa.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Qa.string("string"==typeof t?t:t.color);break;default:void 0!==e.r&&(i=Qa.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=Qa.string(h.color))):l=h,s.textDecoration=rf[l],s.textTransform=nf[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=of[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}t.TextEditor=class extends Yp{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,(t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.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),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}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:p,f:_}=new H(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||af(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)}},t.TextEditor=jt([Dp()],t.TextEditor),St.add("text-editor","editor"),t.Text.addAttr("textEditing",!1,Kn);class hf extends Ch{setText(t){this._text=t,this.__htmlChanged=!0}}return t.HTMLText=class extends t.Image{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([oo(hf)],t.HTMLText.prototype,"__",void 0),jt([Un("")],t.HTMLText.prototype,"text",void 0),jt([In("TextEditor")],t.HTMLText.prototype,"editInner",void 0),t.HTMLText=jt([go()],t.HTMLText),St.add("html"),t.AlignHelper=J,t.AroundHelper=Z,t.ArrowData=U_,t.AutoBounds=xt,t.BezierHelper=De,t.Bounds=mt,t.BoundsEvent=sr,t.BoundsHelper=_t,t.BoxData=vh,t.BranchHelper=Fo,t.BranchRender=Gr,t.CanvasData=Oh,t.CanvasManager=Ft,t.ChildEvent=tr,t.ColorConvert=Qa,t.Creator=Ct,t.Cursor=Gl,t.DataHelper=zt,t.Debug=Et,t.Dragger=Al,t.EditBox=wp,t.EditDataHelper=pp,t.EditPoint=mp,t.EditSelect=ip,t.EditSelectHelper=$u,t.EditToolCreator=Mp,t.Editor=Np,t.EditorEvent=Wu,t.EditorGroupEvent=Wp,t.EditorHelper=Sp,t.EditorMoveEvent=Fu,t.EditorRotateEvent=Uu,t.EditorScaleEvent=zu,t.EditorSkewEvent=Hu,t.Effect=oh,t.EllipseData=kh,t.EllipseHelper=Ne,t.Event=Qo,t.EventCreator=At,t.Eventer=gr,t.Export=ah,t.FileHelper=yn,t.Filter=rh,t.Finder=jg,t.FrameData=wh,t.GroupData=mh,t.HTMLTextData=hf,t.HitCanvasManager=Zl,t.ImageData=Ch,t.ImageEvent=ir,t.ImageManager=Bn,t.IncrementId=i,t.InnerEditor=Yp,t.InnerEditorEvent=Ap,t.InteractionBase=jl,t.InteractionHelper=Sl,t.Keyboard=kl,t.LayoutEvent=cr,t.Layouter=Ya,t.LeafBounds=Xr,t.LeafBoundsHelper=Ao,t.LeafData=Ht,t.LeafDataProxy=Rr,t.LeafEventer=Tr,t.LeafHelper=Po,t.LeafLayout=$o,t.LeafLevelList=La,t.LeafList=Ta,t.LeafMatrix=Ar,t.LeafRender=Vr,t.LeaferCanvas=Pa,t.LeaferCanvasBase=ne,t.LeaferData=xh,t.LeaferEvent=pr,t.LeaferImage=Rn,t.LeaferTypeCreator=B_,t.LineData=bh,t.MathHelper=a,t.Matrix=H,t.MatrixHelper=b,t.MultiTouchHelper=P_,t.MyDragEvent=Rl,t.MyImage=ml,t.MyPointerEvent=Ll,t.NeedConvertToCanvasCommandMap=le,t.OneRadian=l,t.PI2=d,t.PI_2=c,t.Paint=ih,t.PaintGradient=nh,t.PaintImage=sh,t.PathArrow=eh,t.PathArrowModule=Wg,t.PathBounds=rn,t.PathCommandDataHelper=Ki,t.PathCommandMap=ae,t.PathConvert=Ti,t.PathCorner=pn,t.PathCreator=us,t.PathData=Lh,t.PathDrawer=Ls,t.PathHelper=oe,t.PathMatrixHelper=J_,t.PathNumberCommandLengthMap=pe,t.PathNumberCommandMap=ue,t.PenData=Ph,t.Picker=Ga,t.Platform=e,t.Plugin=St,t.Point=z,t.PointHelper=M,t.PointerButton=Bl,t.PolygonData=Bh,t.PropertyEvent=er,t.RectData=Eh,t.RectHelper=_e,t.RectRender=Wh,t.RenderEvent=ur,t.Renderer=Va,t.ResizeEvent=lr,t.Resource=En,t.Run=Lt,t.ScrollBar=z_,t.SelectArea=Ju,t.Selector=Za,t.StarData=Th,t.State=hh,t.StringNumberMap=wt,t.Stroker=qu,t.TaskItem=xn,t.TaskProcessor=wn,t.TextConvert=$a,t.TextData=Sh,t.Transformer=S_,t.Transition=lh,t.TwoPointBoundsHelper=Y,t.UIBounds=Dh,t.UICreator=Dt,t.UIData=fh,t.UIEvent=Tl,t.UIRender=Ih,t.UnitConvert=th,t.WaitHelper=No,t.WatchEvent=dr,t.Watcher=Oa,t.WheelEventHelper=R_,t.addViewport=b_,t.addViewportConfig=E_,t.affectRenderBoundsType=Zn,t.affectStrokeBoundsType=Vn,t.arrowType=H_,t.attr=Dn,t.autoLayoutType=Wn,t.boundsType=Un,t.canvasPatch=fn,t.canvasSizeAttrs=se,t.cursorType=no,t.dataProcessor=oo,t.dataType=In,t.decorateLeafAttr=On,t.defineDataProcessor=ro,t.defineKey=Sn,t.defineLeafAttr=Mn,t.doBoundsType=Nn,t.doStrokeType=jn,t.effectType=Ka,t.emptyData=Yt,t.eraserType=io,t.getBoundsData=p,t.getDescriptor=Cn,t.getMatrixData=_,t.getPointData=u,t.hitType=so,t.isEmptyData=Vt,t.isNull=Xt,t.layoutProcessor=function(t){return(e,i)=>{Sn(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=eo,t.naturalBoundsType=Hn,t.opacityType=qn,t.pathInputType=Yn,t.pathType=Xn,t.pen=_n,t.positionType=An,t.registerEditTool=Op,t.registerInnerEditor=Dp,t.registerUI=go,t.registerUIEvent=fo,t.resizeType=qa,t.rewrite=co,t.rewriteAble=uo,t.rotationType=zn,t.scaleType=Fn,t.sortType=to,t.strokeType=Gn,t.surfaceType=Kn,t.tempBounds=vt,t.tempMatrix=N,t.tempPoint=U,t.useCanvas=Sa,t.useModule=_o,t.version="1.6.3",t.visibleType=Jn,t.zoomLayerType=Ja,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=worker.min.js.map