@leafer-game/worker 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +0 -1
- package/dist/worker.esm.js +0 -1
- package/dist/worker.js +139 -83
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +135 -83
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +10 -10
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.esm.js.map +0 -1
- package/dist/worker.js.map +0 -1
- package/dist/worker.module.js.map +0 -1
package/dist/worker.min.js
CHANGED
|
@@ -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:r,pow:o,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?o(10,e):1e12;return-0===(t=r(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 _(){return{x:0,y:0}}function p(){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:w}=h,x={};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,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},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){B.toInnerPoint(t,e,x),B.scaleOfInner(t,x,i,s)},scaleOfInner(t,e,i,s=i){B.translateInner(t,e.x,e.y),B.scale(t,i,s),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=y(e*=d),a=f(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){B.toInnerPoint(t,e,x),B.rotateOfInner(t,x,i)},rotateOfInner(t,e,i){B.translateInner(t,e.x,e.y),B.rotate(t,i),B.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=d,t.a=s+r*i,t.b=n+o*i),e&&(e*=d,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){B.toInnerPoint(t,e,x),B.skewOfInner(t,x,i,s)},skewOfInner(t,e,i,s=0){B.translateInner(t,e.x,e.y),B.skew(t,i,s),B.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n,r){let{e:o,f:a}=t;if(r&&(o+=r.scrollX,a+=r.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:o,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,r=i*d,o=y(r),l=f(r);if(s||n){const e=s*d,i=n*d;t.a=(o+i*-l)*a,t.b=(l+i*o)*a,t.c=(e*o-l)*h,t.d=(o+e*l)*h}else t.a=o*a,t.b=l*a,t.c=-l*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=r,t.f=o,(i=i||s)&&B.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let c,_,p,g,x,b=h,E=l;if(r||o){const t=n*a-r*o;if(o&&!s){c=v(n*n+r*r),_=t/c;const e=n/c;p=r>0?m(e):-m(e)}else{_=v(o*o+a*a),c=t/_;const e=o/_;p=u-(a>0?m(-e):-m(e))}const e=w(y(p)),i=f(p);c=w(c),_=w(_),g=e?w((o/_+i)/e/d,9):0,x=e?w((r/c-i)/e/d,9):0,p=w(p/d)}else c=n,_=a,p=g=x=0;return(e=i||e)&&(b+=e.x*n+e.y*o,E+=e.x*r+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:c,scaleY:_,rotation:p,skewX:g,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=v(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){B.set(t)}},B=E,{toInnerPoint:k,toOuterPoint:P}=E,{sin:R,cos:S,abs:C,sqrt:T,atan2:L,min:A,round:D,PI:O}=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?D(t.x-.5)+.5:D(t.x),t.y=e?D(t.y-.5)+.5:D(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=F.defaultPoint);const s=S(e*=d),n=R(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=F;return W(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=F;return W(i,t),P(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=F;return W(i,t),F.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){P(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=C(i-t),r=C(s-e);return T(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>A(M(t,e,i,s),M(i,s,n,r)),getAngle:(t,e)=>U(t,e)/d,getRotation:(t,e,i,s)=>(s||(s=e),F.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/d),getRadianFrom(t,e,i,s,n,r,o,a){void 0===o&&(o=i,a=s);let h=L(e-s,t-i);const l=L(r-a,n-o)-h;return l<-O?l+c:l},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=U(t,e);return(e=s?e:{}).x=t.x+S(n)*i,e.y=t.y+R(n)*i,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){F.reset(t)}},F=I,{getDistanceFrom:M,copy:W,getAtan2:U}=F;class N{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 N(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 N(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,i){return new N(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 z=new N;class Y{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return"object"==typeof t?E.copy(this,t):E.set(this,t,e,i,s,n,r),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:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new Y(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 H=new Y,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){j(t,e,i),j(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:j}=X,{tempPointBounds:G,setPoint:V,addPoint:q,toBounds:K}=X,{toOuterPoint:Z}=E,{float:Q,fourNumber:$}=h,{floor:J,ceil:tt}=Math;let et,it,st,nt;const rt={},ot={},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:r,y:o,width:a,height:h}=e;if(i instanceof Array){const e=$(i);s?ht.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):ht.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),ht.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),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 rt.x=t.x,rt.y=t.y,Z(e,rt,ot),V(G,ot.x,ot.y),rt.x=t.x+t.width,Z(e,rt,ot),q(G,ot.x,ot.y),rt.y=t.y+t.height,Z(e,rt,ot),q(G,ot.x,ot.y),rt.x=t.x,Z(e,rt,ot),q(G,ot.x,ot.y),K(G,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 Y(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=J(t.x),t.y=J(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=Q(t.x,e),t.y=Q(t.y,e),t.width=Q(t.width,e),t.height=Q(t.height,e)},add(t,e,i){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,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o]):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||dt(t,n)):lt(t,n));r&&ht.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?V(G,t.x,t.y):q(G,t.x,t.y))),K(G,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:r,height:o}=e;return et=s+r,it=n+o,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,r=et-s,o=it-n,{x:s,y:n,width:r,height:o}},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 _t{constructor(t,e,i,s,n,r){"object"==typeof t?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new ct(n,e,r||t.width-n-i,o||t.height-e-s)}}var pt,gt;t.Direction4=void 0,(pt=t.Direction4||(t.Direction4={}))[pt.top=0]="top",pt[pt.right=1]="right",pt[pt.bottom=2]="bottom",pt[pt.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 r=mt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(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 mt(e){return"string"==typeof e?ft[t.Direction9[e]]:e}const{toPoint:vt}=yt,wt={toPoint(t,e,i,s,n){vt(t,i,s,n,e)}},xt={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=Bt(t)}static set exclude(t){this.excludeList=Bt(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,r=bt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(kt.enable){if(kt.filterList.length&&kt.filterList.every((t=>t!==this.name)))return;if(kt.excludeList.length&&kt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){kt.enable&&this.warn(...t)}warn(...t){kt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}Et.filterList=[],Et.excludeList=[],Et.showWarn=!0;const kt=Et,Pt=Et.get("RunTime"),Rt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return St.currentId=St.idMap[i]=e?performance.now():Date.now(),St.currentName=St.nameMap[i]=t,St.nameToIdMap[t]=i,i},end(t,e){const i=St.idMap[t],s=St.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;St.idMap[t]=St.nameMap[t]=St.nameToIdMap[s]=void 0,Pt.log(s,n,"ms")},endOfName(t,e){const i=St.nameToIdMap[t];void 0!==i&&St.end(i,e)}},St=Rt,Ct=[],Tt={list:{},add(t,...e){this.list[t]=!0,Ct.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Ct.forEach((t=>Tt.has(t,!0)))));const Lt=Et.get("UICreator"),At={list:{},register(t){const{__tag:e}=t.prototype;Dt[e]&&Lt.repeat(e),Dt[e]=t},get(t,e,i,s,n,r){Dt[t]||Lt.error("not register "+t);const o=new Dt[t](e);return void 0!==i&&(o.x=i,s&&(o.y=s),n&&(o.width=n),r&&(o.height=r)),o}},{list:Dt}=At,Ot=Et.get("EventCreator"),It={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Ft[e]&&Ot.repeat(e),Ft[e]=t)}))},changeName(t,e){const i=Ft[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Ft[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Ft[t](...e)},{nameList:Ft}=It;class Mt{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 Wt={default:(t,e)=>(Ut(e,t),Ut(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return Ut(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.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}},{assign:Ut}=Wt;class Nt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(t instanceof Array)for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],void 0!==t)){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}var zt;t.Answer=void 0,(zt=t.Answer||(t.Answer={}))[zt.No=0]="No",zt[zt.Yes=1]="Yes",zt[zt.NoAndSkip=2]="NoAndSkip",zt[zt.YesAndSkip=3]="YesAndSkip";const Yt={};function Ht(t){return null==t}function Xt(t){return"{}"===JSON.stringify(t)}function jt(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function Gt(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i((function(e){e(t)}))}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())}))}function Vt(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 qt=[];function Kt(){return(t,e)=>{qt.push(e)}}const Zt=[];class Qt{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||Zt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){"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,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}jt([Vt("imageSmoothingEnabled")],Qt.prototype,"smooth",void 0),jt([Vt("imageSmoothingQuality")],Qt.prototype,"smoothLevel",void 0),jt([Vt("globalAlpha")],Qt.prototype,"opacity",void 0),jt([Vt()],Qt.prototype,"fillStyle",void 0),jt([Vt()],Qt.prototype,"strokeStyle",void 0),jt([Vt("lineWidth")],Qt.prototype,"strokeWidth",void 0),jt([Vt("lineCap")],Qt.prototype,"strokeCap",void 0),jt([Vt("lineJoin")],Qt.prototype,"strokeJoin",void 0),jt([Vt("lineDashOffset")],Qt.prototype,"dashOffset",void 0),jt([Vt()],Qt.prototype,"miterLimit",void 0),jt([Vt()],Qt.prototype,"shadowBlur",void 0),jt([Vt()],Qt.prototype,"shadowColor",void 0),jt([Vt()],Qt.prototype,"shadowOffsetX",void 0),jt([Vt()],Qt.prototype,"shadowOffsetY",void 0),jt([Vt()],Qt.prototype,"filter",void 0),jt([Vt()],Qt.prototype,"font",void 0),jt([Vt()],Qt.prototype,"fontKerning",void 0),jt([Vt()],Qt.prototype,"fontStretch",void 0),jt([Vt()],Qt.prototype,"fontVariantCaps",void 0),jt([Vt()],Qt.prototype,"textAlign",void 0),jt([Vt()],Qt.prototype,"textBaseline",void 0),jt([Vt()],Qt.prototype,"textRendering",void 0),jt([Vt()],Qt.prototype,"wordSpacing",void 0),jt([Vt()],Qt.prototype,"letterSpacing",void 0),jt([Vt()],Qt.prototype,"direction",void 0),jt([Kt()],Qt.prototype,"setTransform",null),jt([Kt()],Qt.prototype,"resetTransform",null),jt([Kt()],Qt.prototype,"getTransform",null),jt([Kt()],Qt.prototype,"save",null),jt([Kt()],Qt.prototype,"restore",null),jt([Kt()],Qt.prototype,"translate",null),jt([Kt()],Qt.prototype,"scale",null),jt([Kt()],Qt.prototype,"rotate",null),jt([Kt()],Qt.prototype,"fill",null),jt([Kt()],Qt.prototype,"stroke",null),jt([Kt()],Qt.prototype,"clip",null),jt([Kt()],Qt.prototype,"fillRect",null),jt([Kt()],Qt.prototype,"strokeRect",null),jt([Kt()],Qt.prototype,"clearRect",null),jt([Kt()],Qt.prototype,"beginPath",null),jt([Kt()],Qt.prototype,"moveTo",null),jt([Kt()],Qt.prototype,"lineTo",null),jt([Kt()],Qt.prototype,"bezierCurveTo",null),jt([Kt()],Qt.prototype,"quadraticCurveTo",null),jt([Kt()],Qt.prototype,"closePath",null),jt([Kt()],Qt.prototype,"arc",null),jt([Kt()],Qt.prototype,"arcTo",null),jt([Kt()],Qt.prototype,"ellipse",null),jt([Kt()],Qt.prototype,"rect",null),jt([Kt()],Qt.prototype,"roundRect",null),jt([Kt()],Qt.prototype,"createConicGradient",null),jt([Kt()],Qt.prototype,"createLinearGradient",null),jt([Kt()],Qt.prototype,"createPattern",null),jt([Kt()],Qt.prototype,"createRadialGradient",null),jt([Kt()],Qt.prototype,"fillText",null),jt([Kt()],Qt.prototype,"measureText",null),jt([Kt()],Qt.prototype,"strokeText",null);const{copy:$t,multiplyParent:Jt}=E,{round:te}=Math,ee={width:1,height:1,pixelRatio:1},ie=["width","height","pixelRatio"];class se extends Qt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,i){super(),this.size={},this.worldTransform={},t||(t=ee),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:n,height:r,pixelRatio:o}=t;this.autoLayout=!n||!r,this.size.pixelRatio=o|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;Wt.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&&Jt(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:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,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,r=this.manager?this.manager.get(s):i.canvas(Object.assign({},s));return r.save(),t&&($t(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==n&&(r.pixelSnap=n),r}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){}},re={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},oe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},re),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),re),de=oe,ce={};for(let t in de)ce[de[t]]=t;const ue={};for(let t in de)ue[de[t]]=ae[t];const _e={drawRoundRect(t,e,i,s,n,r){const o=h.fourNumber(r,Math.min(s/2,n/2)),a=e+s,l=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,l,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,l,e,l,o[2]):t.lineTo(a,l),o[3]?t.arcTo(e,l,e,i,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:pe,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:we,pow:xe}=Math,{setPoint:be,addPoint:Ee}=X,{set:Be,toNumberPoints:ke}=I,{M:Pe,L:Re,C:Se,Q:Ce,Z:Te}=oe,Le={},Ae={points(t,e,i,s){let n=ke(e);if(t.push(Pe,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,_,p,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],p=we(xe(o-e,2)+xe(a-r,2)),g=we(xe(h-o,2)+xe(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=r,d=o-p*h,c=a-p*l,2===i?s||t.push(Ce,d,c,o,a):t.push(Se,u,_,d,c,o,a),u=o+g*h,_=a+g*l;s||t.push(Ce,u,_,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Re,n[e],n[e+1]);s&&t.push(Te)},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,r){ne.creator.path=[],_e.drawRoundRect(ne.creator,e,i,s,n,r),t.push(...ne.convertToCanvasData(ne.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,_){const p=s-e,g=n-i,f=r-s,y=o-n;let m=fe(g,p),v=fe(y,f),w=v-m;if(w<0&&(w+=c),w===ve||me(p+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Re,s,n),h&&(be(h,e,i),Ee(h,s,n)),_&&Be(_,e,i),void(l&&Be(l,s,n));const x=p*y-f*g<0,b=x?-1:1,E=a/ge(w/2),B=s+E*ge(m+w/2+u*b),k=n+E*pe(m+w/2+u*b);return m-=u*b,v-=u*b,Ie(t,B,k,a,a,0,m/d,v/d,x,h,l,_)},arc:(t,e,i,s,n,r,o,a,h,l)=>Ie(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,_,p){const g=r*d,f=pe(g),y=ge(g);let m=o*d,v=a*d;m>ve&&(m-=c),v<0&&(v+=c);let w=v-m;w<0?w+=c:w>c&&(w-=c),h&&(w-=c);const x=ye(me(w/u)),b=w/x,E=pe(b/4),B=8/3*E*E/pe(b/2);v=m+b;let k,P,R,S,C,T,L,A,D=ge(m),O=pe(m),I=R=y*s*D-f*n*O,F=S=f*s*D+y*n*O,M=e+R,W=i+S;t&&t.push(t.length?Re:Pe,M,W),l&&be(l,M,W),p&&Be(p,M,W);for(let r=0;r<x;r++)k=ge(v),P=pe(v),R=y*s*k-f*n*P,S=f*s*k+y*n*P,C=e+I-B*(y*s*O+f*n*D),T=i+F-B*(f*s*O-y*n*D),L=e+R+B*(y*s*P+f*n*k),A=i+S+B*(f*s*P-y*n*k),t&&t.push(Se,C,T,L,A,e+R,i+S),l&&Oe(e+I,i+F,C,T,L,A,e+R,i+S,l,!0),I=R,F=S,D=k,O=P,m=v,v+=b;_&&Be(_,e+R,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(Se,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){Oe(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ee(h,t,e):be(h,t,e),Ee(h,o,a);for(let l=0,c=d.length;l<c;l++)De(d[l],t,e,i,s,n,r,o,a,Le),Ee(h,Le.x,Le.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*r+p*a,l.y=c*i+u*n+_*o+p*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return De(t,e,i,s,n,r,o,a,h,l),l}},{getPointAndSet:De,toTwoPointBounds:Oe,ellipse:Ie}=Ae,{sin:Fe,cos:Me,sqrt:We,atan2:Ue}=Math,{ellipse:Ne}=Ae,ze={ellipticalArc(t,i,s,n,r,o,a,h,l,u,_){const p=(l-i)/2,g=(u-s)/2,f=o*d,y=Fe(f),m=Me(f),v=-m*p-y*g,w=-m*g+y*p,x=n*n,b=r*r,E=w*w,B=v*v,k=x*b-x*E-b*B;let P=0;if(k<0){const t=We(1-k/(x*b));n*=t,r*=t}else P=(a===h?-1:1)*We(k/(x*E+b*B));const R=P*n*w/r,S=-P*r*v/n,C=Ue((w-S)/r,(v-R)/n),T=Ue((-w-S)/r,(-v-R)/n);let L=T-C;0===h&&L>0?L-=c:1===h&&L<0&&(L+=c);const A=i+p+m*R-y*S,D=s+g+y*R+m*S,O=L<0?1:0;_||e.ellipseToCurve?Ne(t,A,D,n,r,o,C/d,T/d,O):n!==r||o?t.push(oe.G,A,D,n,r,o,C/d,T/d,O):t.push(oe.O,A,D,n,C/d,T/d,O)}},{M:Ye,m:He,L:Xe,l:je,H:Ge,h:Ve,V:qe,v:Ke,C:Ze,c:Qe,S:$e,s:Je,Q:ti,q:ei,T:ii,t:si,A:ni,a:ri,Z:oi,z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:_i,P:pi,U:gi}=oe,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:wi,quadraticCurveTo:xi}=Ae,{ellipticalArc:bi}=ze,Ei=Et.get("PathConvert"),Bi={},ki={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=ue[s],a+=s===n?" ":ce[s];for(let s=1;s<i;s++)a+=h.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?le:he;for(let e=0,h=t.length;e<h;e++)s=t[e],xt[s]?("."===s&&(Pi.dot&&(Ri(o,r),r=""),Pi.dot++),"0"===r&&"."!==s&&(Ri(o,r),r=""),r+=s):oe[s]?(r&&(Ri(o,r),r=""),Pi.name=oe[s],Pi.length=ae[s],Pi.index=0,Ri(o,Pi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&Ri(o,r),r=s):r&&(Ri(o,r),r=""),n=s;return r&&Ri(o,r),i?ki.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(n=t[c],n){case He:t[c+1]+=a,t[c+2]+=h;case Ye:a=t[c+1],h=t[c+2],_.push(Ye,a,h),c+=3;break;case Ve:t[c+1]+=a;case Ge:a=t[c+1],_.push(Xe,a,h),c+=2;break;case Ke:t[c+1]+=h;case qe:h=t[c+1],_.push(Xe,a,h),c+=2;break;case je:t[c+1]+=a,t[c+2]+=h;case Xe:a=t[c+1],h=t[c+2],_.push(Xe,a,h),c+=3;break;case Je:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=$e;case $e:o=r===Ze||r===$e,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(Ze,l,d,i,s,a,h),c+=5;break;case Qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ze;case Ze:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ze,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:o=r===ti||r===ii,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?xi(_,a,h,i,s,t[c+1],t[c+2]):_.push(ti,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ei:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ti;case ti:i=t[c+1],s=t[c+2],e?xi(_,a,h,i,s,t[c+3],t[c+4]):_.push(ti,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ri:t[c+6]+=a,t[c+7]+=h;case ni:bi(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case ai:case oi:_.push(oi),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4]):Si(_,t,c,5),c+=5;break;case li:a=t[c+1],h=t[c+2],e?yi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Si(_,t,c,9),c+=9;break;case di:a=t[c+1],h=t[c+2],e?yi(_,a,h,t[c+3],t[c+4],t[c+5]):Si(_,t,c,6),c+=6;break;case ci:wi(e?_:Si(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Bi),a=Bi.x,h=Bi.y,c+=9;break;case ui:e?wi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Si(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case _i:vi(e?_:Si(_,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 pi:e?vi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Si(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?_:Si(_,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 Ei.error(`command: ${n} [index:${c}]`,t),_}r=n}return _},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ye,t.x,t.y);break;case"L":e.push(Xe,t.x,t.y);break;case"C":e.push(Ze,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(oi)}})),e},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){Pi.index===Pi.length&&(Pi.index=1,t.push(Pi.name)),t.push(Number(e)),Pi.index++,Pi.dot=0}},{current:Pi,pushData:Ri,copyData:Si}=ki,{M:Ci,L:Ti,C:Li,Q:Ai,Z:Di,N:Oi,D:Ii,X:Fi,G:Mi,F:Wi,O:Ui,P:Ni,U:zi}=oe,{getMinDistanceFrom:Yi,getRadianFrom:Hi}=I,{tan:Xi,min:ji,abs:Gi}=Math,Vi={},qi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ci,e,i)},lineTo(t,e,i){t.push(Ti,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(Li,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(Ai,e,i,s,n)},closePath(t){t.push(Di)},rect(t,e,i,s,n){t.push(Oi,e,i,s,n)},roundRect(t,e,i,s,n,r){if("number"==typeof r)t.push(Fi,e,i,s,n,r);else{const o=h.fourNumber(r);o?t.push(Ii,e,i,s,n,...o):t.push(Oi,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,a,h){void 0===r?t.push(Wi,e,i,s,n):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Mi,e,i,s,n,r,o,a,h?1:0))},arc(t,e,i,s,n,r,o){void 0===n?t.push(Ni,e,i,s):(void 0===r&&(r=360),t.push(Ui,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,o,a){if(void 0!==o){const t=Yi(o,a,e,i,s,n);r=ji(r,ji(t/2,t/2*Gi(Xi(Hi(o,a,e,i,s,n)/2))))}t.push(zi,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,a,h){Ae.ellipse(null,e,i,s,n,void 0===r?0:r,void 0===o?0:o,void 0===a?360:a,h,null,null,Vi),t.push(Ci,Vi.x,Vi.y),Ki(t,e,i,s,n,r,o,a,h)},drawArc(t,e,i,s,n,r,o){Ae.arc(null,e,i,s,void 0===n?0:n,void 0===r?360:r,o,null,null,Vi),t.push(Ci,Vi.x,Vi.y),Zi(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){Ae.points(t,e,i,s)}},{ellipse:Ki,arc:Zi}=qi,{moveTo:Qi,lineTo:$i,quadraticCurveTo:Ji,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:ns,ellipse:rs,arc:os,arcTo:as,drawEllipse:hs,drawArc:ls,drawPoints:ds}=qi;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 Qi(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,r){return ts(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ji(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,r,o,a){return rs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return os(this.__path,t,e,i,s,n,r),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,r,o,a){return hs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return ls(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return ds(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:us,L:_s,C:ps,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:ws,F:xs,O:bs,P:Es,U:Bs}=oe,ks=Et.get("PathDrawer"),Ps={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case _s:t.lineTo(e[s+1],e[s+2]),s+=3;break;case ps:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case fs:t.closePath(),s+=1;break;case ys:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ms:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*d,e[s+6]*d,e[s+7]*d,e[s+8]),s+=9;break;case xs: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 Bs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void ks.error(`command: ${i} [index:${s}]`,e)}}},{M:Rs,L:Ss,C:Cs,Q:Ts,Z:Ls,N:As,D:Ds,X:Os,G:Is,F:Fs,O:Ms,P:Ws,U:Us}=oe,{toTwoPointBounds:Ns,toTwoPointBoundsByQuadraticCurve:zs,arcTo:Ys,arc:Hs,ellipse:Xs}=Ae,{addPointBounds:js,copy:Gs,addPoint:Vs,setPoint:qs,addBounds:Ks,toBounds:Zs}=X,Qs=Et.get("PathBounds");let $s,Js,tn;const en={},sn={},nn={},rn={toBounds(t,e){rn.toTwoPointBounds(t,sn),Zs(sn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return qs(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Ls||o===Cs||o===Ts?qs(e,h,l):qs(e,t[a+1],t[a+2])),o){case Rs:case Ss:h=t[a+1],l=t[a+2],Vs(e,h,l),a+=3;break;case Cs:n=t[a+5],r=t[a+6],Ns(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,en),js(e,en),h=n,l=r,a+=7;break;case Ts:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],zs(h,l,i,s,n,r,en),js(e,en),h=n,l=r,a+=5;break;case Ls:a+=1;break;case As:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ds:case Os:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=o===Ds?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?Gs(e,en):js(e,en),h=nn.x,l=nn.y,a+=9;break;case Fs:h=t[a+1],l=t[a+2],Js=t[a+3],tn=t[a+4],Ks(e,h-Js,l-tn,2*Js,2*tn),h+=Js,a+=5;break;case Ms:Hs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],en,nn),0===a?Gs(e,en):js(e,en),h=nn.x,l=nn.y,a+=7;break;case Ws: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 Us:Ys(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],en,nn),0===a?Gs(e,en):js(e,en),h=nn.x,l=nn.y,a+=6;break;default:return void Qs.error(`command: ${o} [index:${a}]`,t)}}},{M:on,L:an,Z:hn}=oe,{getCenterX:ln,getCenterY:dn}=I,{arcTo:cn}=qi,un={smooth(t,e,i){let s,n,r=0,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0;const p=t.length,g=[];for(;r<p;)switch(s=t[r],s){case on:h=u=t[r+1],l=_=t[r+2],r+=3,t[r]===an?(d=t[r+1],c=t[r+2],g.push(on,ln(h,d),dn(l,c))):g.push(on,h,l);break;case an:switch(o=t[r+1],a=t[r+2],r+=3,t[r]){case an:cn(g,o,a,t[r+1],t[r+2],e,u,_);break;case hn:cn(g,o,a,h,l,e,u,_);break;default:g.push(an,o,a)}u=o,_=a;break;case hn:cn(g,h,l,d,c,e,u,_),g.push(hn),r+=1;break;default:n=ue[s];for(let e=0;e<n;e++)g.push(t[r+e]);r+=n}return s!==hn&&(g[1]=h,g[2]=l),g}};ne.creator=new cs,ne.parse=ki.parse,ne.convertToCanvasData=ki.toCanvasData;const _n=new cs,{drawRoundRect:pn}=_e;function gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){pn(this,t,e,i,s,n)})}(t)}const fn={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 Gt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){mn.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Wt.assign(this.config,t),this.empty()}add(t,e){let i,s,n,r;const o=new vn(t);return o.parent=this,"number"==typeof e?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(o.time=n),!1===s&&(o.parallel=!1),void 0===r?this.push(o,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,i))}),r)),this.isComplete=!1,o}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const xn=Et.get("Resource"),bn={tasker:new wn,map:{},get isComplete(){return En.tasker.isComplete},set(t,e){En.map[t]&&xn.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,Bn={maxRecycled:10,recycledList:[],patternTasker:new wn,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||kn.recycledList.push(t)}))},clearRecycled(){const t=kn.recycledList;t.length>kn.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&bn.remove(t.url))),t.length=0)},hasOpacityPixel:t=>fn.opacityTypes.some((e=>kn.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(){kn.recycledList=[]}},kn=Bn,{IMAGE:Pn,create:Rn}=s;class Sn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Rn(Pn),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.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(t,i){return this.loading||(this.loading=!0,bn.tasker.add((()=>Gt(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 r=e.origin.createCanvas(t,i),o=r.getContext("2d");return s&&(o.globalAlpha=s),o.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:r,params:arguments}:null,r}getPattern(t,i,s,n){const r=e.canvas.createPattern(t,i);try{s&&r.setTransform&&(r.setTransform(s),s=null)}catch(t){}return n&&(n.transform=s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Cn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Tn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ln(t,e){return(i,s)=>Dn(i,s,t,e&&e(s))}function An(t){return t}function Dn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Cn(t,e,Object.assign(n,s||{})),rr(t,e,i)}function On(t){return Ln(t)}function In(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Fn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),zn(this))}})))}function Mn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Un(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&zn(this)}})))}function Nn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(zn(this),this.__.__removeNaturalSize())}})))}function zn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Yn(t){return Ln(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),zn(this)}})))}const Hn=Un;function Xn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&jn(this)}})))}function jn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&zn(t)}const Gn=Xn;function Vn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function qn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Kn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Qn(this)}})))}function Zn(t){return Ln(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&&Qn(this)}})))}function Qn(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||zn(t))}function Jn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function tr(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function er(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function ir(t){return Ln(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 sr(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function nr(t){return(e,i)=>{Cn(e,"__DataProcessor",{get:()=>t})}}function rr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[n];return void 0===t?i:t},set(t){this[n]=t}};if(void 0===i)o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Xt(i);o.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?o.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&&(o.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=Tn(l,e),l=l.__proto__;h&&h.set&&(o.set=h.set),s[r]&&(o.set=s[r],delete s[r]),Cn(s,e,o)}const or=new Et("rewrite"),ar=[],hr=["destroy","constructor"];function lr(t){return(e,i)=>{ar.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function dr(){return t=>{cr()}}function cr(t){ar.length&&(ar.forEach((e=>{t&&or.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ar.length=0)}function ur(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(hr.includes(s)||e&&e.includes(s)))if(t.prototype){Tn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function _r(){return t=>{At.register(t)}}function pr(){return t=>{It.register(t)}}setTimeout((()=>cr(!0)));const{copy:gr,toInnerPoint:fr,toOuterPoint:yr,scaleOfOuter:mr,rotateOfOuter:vr,skewOfOuter:wr,multiplyParent:xr,divideParent:br,getLayout:Er}=E,Br={},{round:kr}=Math,Pr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Cr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Sr(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++)Tr(e[t])}},updateAllChange(t){if(Tr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Lr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,n){const r="object"==typeof e?Object.assign({},e):{x:e,y:i};s?yr(t.localTransform,r,r,!0):t.parent&&fr(t.parent.worldTransform,r,r,!0),Rr.moveLocal(t,r.x,r.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=kr(e),i=kr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){Rr.zoomOfLocal(t,Ar(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if("number"!=typeof s&&(s&&(r=s),s=i),gr(Br,o),mr(Br,e,i,s),t.origin||t.around)Rr.setTransform(t,Br,n,r);else{const e=t.x+Br.e-o.e,a=t.y+Br.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Rr.rotateOfLocal(t,Ar(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;gr(Br,n),vr(Br,e,i),t.origin||t.around?Rr.setTransform(t,Br,!1,s):t.set({x:t.x+Br.e-n.e,y:t.y+Br.f-n.f,rotation:h.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){Rr.skewOfLocal(t,Ar(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){gr(Br,t.__localMatrix),wr(Br,e,i,s),Rr.setTransform(t,Br,n,r)},transformWorld(t,e,i,s){gr(Br,t.worldTransform),xr(Br,e),t.parent&&br(Br,t.parent.worldTransform),Rr.setTransform(t,Br,i,s)},transform(t,e,i,s){gr(Br,t.localTransform),xr(Br,e),Rr.setTransform(t,Br,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&Rr.getInnerOrigin(t,n.origin),o=Er(e,r,n.around&&Rr.getInnerOrigin(t,n.around));if(i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){at.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Rr.getInnerOrigin(t,n.origin);I.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return mr(i,Rr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>I.tempToOuterOf(Rr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(gr(Br,t.worldTransform),br(Br,e.worldTransform),i?Br:Object.assign({},Br)),drop(t,e,i,s){t.setTransform(Rr.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}}},Rr=Pr,{updateAllMatrix:Sr,updateMatrix:Cr,updateAllWorldOpacity:Tr,updateAllChange:Lr}=Rr;function Ar(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const Dr={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:Or}=Pr,Ir={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),Fr(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++)Mr(e[t],e)},updateBounds(t,e){const i=[t];Mr(t,i),Wr(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++)Or(s[t]);e&&e===i||Or(i)}}},{pushAllChildBranch:Fr,pushAllBranchStack:Mr,updateBoundsByBranchStack:Wr}=Ir,Ur={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:Nr}=Pr,{toOuterOf:zr,getPoints:Yr,copy:Hr}=at,Xr="_localContentBounds",jr="_worldContentBounds",Gr="_worldBoxBounds",Vr="_worldStrokeBounds";class qr{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 zr(this.contentBounds,this.leaf.__localMatrix,this[Xr]||(this[Xr]={})),this[Xr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return zr(this.contentBounds,this.leaf.__world,this[jr]||(this[jr]={})),this[jr]}get worldBoxBounds(){return zr(this.boxBounds,this.leaf.__world,this[Gr]||(this[Gr]={})),this[Gr]}get worldStrokeBounds(){return zr(this.strokeBounds,this.leaf.__world,this[Vr]||(this[Vr]={})),this[Vr]}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 Nr(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,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=E.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Nr(s,e,!0)}if(o||(o=E.getLayout(r)),Hr(o,a),I.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Yr(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 Kr{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 Zr extends Kr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Zr.ADD="child.add",Zr.REMOVE="child.remove",Zr.CREATED="created",Zr.MOUNTED="mounted",Zr.UNMOUNTED="unmounted",Zr.DESTROY="destroy";class Qr extends Kr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Qr.CHANGE="property.change",Qr.LEAFER_CHANGE="property.leafer_change";class $r extends Kr{constructor(t,e){super(t),Object.assign(this,e)}}$r.LOAD="image.load",$r.LOADED="image.loaded",$r.ERROR="image.error";class Jr extends Kr{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(Jr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}Jr.RESIZE="resize";class to extends Kr{constructor(t,e){super(t),this.data=e}}to.REQUEST="watch.request",to.DATA="watch.data";class eo extends Kr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}eo.REQUEST="layout.request",eo.START="layout.start",eo.BEFORE="layout.before",eo.LAYOUT="layout",eo.AFTER="layout.after",eo.AGAIN="layout.again",eo.END="layout.end";class io extends Kr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}io.REQUEST="render.request",io.CHILD_START="render.child_start",io.CHILD_END="render.child_end",io.START="render.start",io.BEFORE="render.before",io.RENDER="render",io.AFTER="render.after",io.AGAIN="render.again",io.END="render.end",io.NEXT="render.next";class so extends Kr{}so.START="leafer.start",so.BEFORE_READY="leafer.before_ready",so.READY="leafer.ready",so.AFTER_READY="leafer.after_ready",so.VIEW_READY="leafer.view_ready",so.VIEW_COMPLETED="leafer.view_completed",so.STOP="leafer.stop",so.RESTART="leafer.restart",so.END="leafer.end";const no={};class ro{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,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=oo(this,s,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(r=o[t],r?-1===r.findIndex((t=>t.listener===e))&&r.push(h):o[t]=[h])}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=oo(this,t);s.forEach((t=>{t&&(n=o[t],n&&(r=n.findIndex((t=>t.listener===e)),r>-1&&n.splice(r,1),n.length||delete o[t]))}))}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=oo(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(void 0===e?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function oo(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:no)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:no)}}const{on:ao,on_:ho,off:lo,off_:co,once:uo,emit:_o,emitEvent:po,hasEvent:go,destroy:fo}=ro.prototype,yo={on:ao,on_:ho,off:lo,off_:co,once:uo,emit:_o,emitEvent:po,hasEvent:go,destroyEventer:fo},{isFinite:mo}=Number,vo=Et.get("setAttr"),wo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!mo(e)&&void 0!==e&&(vo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=Qr,n=new Qr(i,this,t,s,e);return this.isLeafer?this.emitEvent(new Qr(Qr.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:xo,multiplyParent:bo,translateInner:Eo,defaultWorld:Bo}=E,{toPoint:ko,tempPoint:Po}=yt,Ro={__updateWorldMatrix(){bo(this.__local||this.__layout,this.parent?this.parent.__world:Bo,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)&&(xo(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)&&(ko(i.around||i.origin,t.boxBounds,Po),Eo(e,-Po.x,-Po.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:So,updateAllMatrix:Co}=Pr,{updateBounds:To}=Ir,{toOuterOf:Lo,copyAndSpread:Ao,copy:Do}=at,{toBounds:Oo}=rn,Io={__updateWorldBounds(){Lo(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(),Lo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Lo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Lo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Oo(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(),Co(this),To(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Co(this),To(this,this))):So(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Ao(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Ao(t.renderBounds,t.boxBounds,t.renderSpread):Do(t.renderBounds,t.strokeBounds)}},Fo={__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:Mo}=Dr,Wo={__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++)Mo(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++)Mo(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Uo,create:No}=s,{toInnerPoint:zo,toOuterPoint:Yo,multiplyParent:Ho}=E,{toOuterOf:Xo}=at,{copy:jo,move:Go}=I,{moveLocal:Vo,zoomOfLocal:qo,rotateOfLocal:Ko,skewOfLocal:Zo,moveWorld:Qo,zoomOfWorld:$o,rotateOfWorld:Jo,skewOfWorld:ta,transform:ea,transformWorld:ia,setTransform:sa,getFlipTransform:na,getLocalOrigin:ra,getRelativeWorld:oa,drop:aa}=Pr;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 Nt}get __LayoutProcessor(){return qr}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=No(Uo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Zr.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(Zr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Zr.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(Zr.MOUNTED)):this.__emitLifeEvent(Zr.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 Ho(i,t.matrix,e,void 0,i),Xo(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?oa(this,e):this.worldTransform,n=i?t:{};return Xo(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&jo(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&jo(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),zo(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Yo(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Go(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Go(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){sa(this,t,e,i)}transform(t,e,i){ea(this,t,e,i)}move(t,e,i){Vo(this,t,e,i)}moveInner(t,e,i){Qo(this,t,e,!0,i)}scaleOf(t,e,i,s,n){qo(this,ra(this,t),e,i,s,n)}rotateOf(t,e,i){Ko(this,ra(this,t),e,i)}skewOf(t,e,i,s,n){Zo(this,ra(this,t),e,i,s,n)}transformWorld(t,e,i){ia(this,t,e,i)}moveWorld(t,e,i){Qo(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){$o(this,t,e,i,s,n)}rotateOfWorld(t,e){Jo(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 Tt.need("path")}getMotionPoint(t){return Tt.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):rr(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 Zr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Zr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=jt([ur(wo),ur(Ro),ur(Io),ur(yo),ur(Fo)],t.Leaf);const{setListWithFn:ha}=at,{sort:la}=Ir,{localBoxBounds:da,localStrokeBounds:ca,localRenderBounds:ua,maskLocalBoxBounds:_a,maskLocalStrokeBounds:pa,maskLocalRenderBounds:ga}=Dr,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?_a:da)}__updateStrokeBounds(){ha(this.__layout.strokeBounds,this.children,this.__hasMask?pa: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=At.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(Zr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Zr.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(Zr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Zr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Zr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=jt([ur(Wo)],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:wa}=fn;function xa(t,s){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,n)=>{t.convertToBlob({type:wa(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:wa(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 Sn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Cn(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=Wt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(io.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Zr.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 to(to.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_(Qr.CHANGE,this.__onAttrChange,this),t.on_([Zr.ADD,Zr.REMOVE],this.__onChildEvent,this),t.on_(to.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:Ba,updateBounds:ka,updateAllWorldOpacity:Pa}=Pr,{pushAllChildBranch:Ra,pushAllParent:Sa}=Ir;const{worldBounds:Ca}=Dr;class Ta{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,Ca)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ca),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:La,updateAllChange:Aa}=Pr,Da=Et.get("Layouter");class Oa{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ma,this.target=t,e&&(this.config=Wt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(eo.START),this.layoutOnce(),t.emitEvent(new eo(eo.END,this.layoutedBlocks,this.times))}catch(t){Da.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Da.warn("layouting"):this.times>3?Da.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(to.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:r,AFTER:o}=eo,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new eo(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Ba(t,!0),e.add(t),t.isBranch&&Ra(t,e),Sa(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sa(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||ka(s[t])}ka(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&Pa(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 eo(r,a,this.times)),i.emitEvent(new eo(o,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}=eo,r=this.getBlocks(new ya(e));e.emitEvent(new eo(i,r,this.times)),Oa.fullLayout(e),r.forEach((t=>{t.setAfter()})),e.emitEvent(new eo(s,r,this.times)),e.emitEvent(new eo(n,r,this.times)),this.addBlocks(r),Rt.end(t)}static fullLayout(t){La(t,!0),t.isBranch?Ir.updateBounds(t):Pr.updateBounds(t),Aa(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ta([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ta(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_(eo.REQUEST,this.layout,this),t.on_(eo.AGAIN,this.layoutAgain,this),t.on_(to.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 Fa{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=Wt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(eo.REQUEST)}checkRender(){this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(io.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(io.START),this.renderOnce(t),this.emitRender(io.END,this.totalBounds),Bn.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(io.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(io.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(io.RENDER,this.renderBounds,this.renderOptions),this.emitRender(io.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(Fa.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,t.includes(this.target.__world),n),i.restore(),Rt.end(e)}fullRender(){const t=Rt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),Rt.end(t)}__render(t,e,i){const{canvas:s}=this,n=e?{includes:e}:{bounds:t,includes:e};this.needFill&&s.fillWorld(t,this.config.fill),Et.showRepaint&&Et.drawRepaint(s,t),this.target.__render(s,n),this.renderBounds=i=i||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}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(t.parentApp)return t.parentApp.renderer.update(!1);if(this.requestTime)return;const i=this.requestTime=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,t.isApp&&(t.emit(io.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(io.CHILD_END,t)),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 io(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(io.REQUEST,this.update,this),t.on_(eo.END,this.__onLayoutEnd,this),t.on_(io.AGAIN,this.renderAgain,this),t.on_(Jr.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Fa.clipSpread=10;const{hitRadiusPoint:Ma}=at;class Wa{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ya(i.findList),i.findList||this.hitBranch(r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new ya;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||Pr.worldHittable(e))&&(this.hitChild(e,r),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,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let r=t.length-1;r>-1;r--)i=t[r],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Ma(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 Ua{constructor(t,e){this.config={},e&&(this.config=Wt.default(e,this.config)),this.picker=new Wa(this.target=t,this),this.finder=i.finder&&i.finder()}getByPoint(t,i,s){const{target:n,picker:r}=this;return e.backgrounder&&n&&n.updateLayout(),r.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Tt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Na(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function za(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Ya(){return(t,e)=>{const i="_"+e;Cn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(i,{watcher:(t,e)=>new Ea(t,e),layouter:(t,e)=>new Oa(t,e),renderer:(t,e,i)=>new Fa(t,e,i),selector:(t,e)=>new Ua(t,e)}),e.layout=Oa.fullLayout;const Ha={},Xa={},ja={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},Ga={},Va={},qa={},Ka={},Za={},Qa={apply(){Tt.need("filter")}},$a={},Ja={setStyleName:()=>Tt.need("state"),set:()=>Tt.need("state")},th={list:{},register(t,e){th.list[t]=e},get:t=>th.list[t]},{parse:eh,objectToCanvasData:ih}=ki,sh={},nh=Et.get("UIData");class rh extends Nt{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,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"),qa.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"),qa.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){oh(this,"shadow",t)}setInnerShadow(t){oh(this,"innerShadow",t)}setFilter(t){oh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Va.compute("fill",this.__leaf),e&&Va.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function oh(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 rh{}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 rh{}class uh extends rh{get __boxStroke(){return!this.__pathInputed}}class _h extends rh{get __boxStroke(){return!this.__pathInputed}}class ph extends rh{}class gh extends rh{}class fh extends rh{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 rh{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=At.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange(),r.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class wh 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 xh 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,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),r&&(t+=Qa.getSpread(r));let o=t=Math.ceil(t);return i&&i.forEach((t=>o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),n&&(o=Math.max(o,n)),this.__layout.renderShapeSpread=o,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:r}=this.__;t.__useEffect=!!(e||i||s||n||r)}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){Bh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o}=s;if(this.__drawRenderPath(t),s.__useEffect){const a=Va.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:l,filter:d}=s;h&&Za.shadow(this,t,a),n&&(s.__isFills?Va.fills(n,this,t):Va.fill(n,this,t)),o&&this.__drawAfterFill(t,e),l&&Za.innerShadow(this,t,a),r&&(s.__isStrokes?Va.strokes(r,this,t):Va.stroke(r,this,t)),d&&Qa.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else n&&(s.__isFills?Va.fills(n,this,t):Va.fill(n,this,t)),o&&this.__drawAfterFill(t,e),r&&(s.__isStrokes?Va.strokes(r,this,t):Va.stroke(r,this,t))}else s.__pathInputed?Bh(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:r}=this.__;this.__drawRenderPath(t),n&&!i&&(this.__.__pixelFill?Va.fills(n,this,t):Va.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),r&&!s&&(this.__.__pixelStroke?Va.strokes(r,this,t):Va.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 Bh(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r}=t.__;t.__drawRenderPath(e),s&&Va.fill(s,t,e),r&&t.__drawAfterFill(e,i),n&&Va.stroke(n,t,e)}const kh={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Ph,Rh;t.UI=Ph=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 _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 Tt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Tt.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?ki.toCanvasData(i,!0):i}getPathString(t,e,i){return ki.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&&Ga.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?Ps.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,"number"==typeof r?[r]:r)}else t.rect(e,i,s,n)}animate(t,e,i,s){return Tt.need("animate")}killAnimate(t,e){}export(t,e){return Tt.need("export")}syncExport(t,e){return Tt.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Ph.one(e)}static one(t,e,i,s,n){return At.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){_r()(this)}static registerData(t){nr(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([nr(rh)],t.UI.prototype,"__",void 0),jt([Ya()],t.UI.prototype,"zoomLayer",void 0),jt([On("")],t.UI.prototype,"id",void 0),jt([On("")],t.UI.prototype,"name",void 0),jt([On("")],t.UI.prototype,"className",void 0),jt([qn("pass-through")],t.UI.prototype,"blendMode",void 0),jt([Kn(1)],t.UI.prototype,"opacity",void 0),jt([Zn(!0)],t.UI.prototype,"visible",void 0),jt([qn(!1)],t.UI.prototype,"locked",void 0),jt([qn(!1)],t.UI.prototype,"dim",void 0),jt([qn(!1)],t.UI.prototype,"dimskip",void 0),jt([Jn(0)],t.UI.prototype,"zIndex",void 0),jt([tr(!1)],t.UI.prototype,"mask",void 0),jt([er(!1)],t.UI.prototype,"eraser",void 0),jt([In(0,!0)],t.UI.prototype,"x",void 0),jt([In(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([Mn(1,!0)],t.UI.prototype,"scaleX",void 0),jt([Mn(1,!0)],t.UI.prototype,"scaleY",void 0),jt([Wn(0,!0)],t.UI.prototype,"rotation",void 0),jt([Wn(0,!0)],t.UI.prototype,"skewX",void 0),jt([Wn(0,!0)],t.UI.prototype,"skewY",void 0),jt([In(0,!0)],t.UI.prototype,"offsetX",void 0),jt([In(0,!0)],t.UI.prototype,"offsetY",void 0),jt([In(0,!0)],t.UI.prototype,"scrollX",void 0),jt([In(0,!0)],t.UI.prototype,"scrollY",void 0),jt([Fn()],t.UI.prototype,"origin",void 0),jt([Fn()],t.UI.prototype,"around",void 0),jt([On(!1)],t.UI.prototype,"lazy",void 0),jt([Nn(1)],t.UI.prototype,"pixelRatio",void 0),jt([Yn()],t.UI.prototype,"path",void 0),jt([Hn()],t.UI.prototype,"windingRule",void 0),jt([Hn(!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([On(!1)],t.UI.prototype,"draggable",void 0),jt([On()],t.UI.prototype,"dragBounds",void 0),jt([On(!1)],t.UI.prototype,"editable",void 0),jt([ir(!0)],t.UI.prototype,"hittable",void 0),jt([ir("path")],t.UI.prototype,"hitFill",void 0),jt([Gn("path")],t.UI.prototype,"hitStroke",void 0),jt([ir(!1)],t.UI.prototype,"hitBox",void 0),jt([ir(!0)],t.UI.prototype,"hitChildren",void 0),jt([ir(!0)],t.UI.prototype,"hitSelf",void 0),jt([ir()],t.UI.prototype,"hitRadius",void 0),jt([sr("")],t.UI.prototype,"cursor",void 0),jt([qn()],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([Hn(0)],t.UI.prototype,"cornerRadius",void 0),jt([Hn()],t.UI.prototype,"cornerSmoothing",void 0),jt([Na()],t.UI.prototype,"shadow",void 0),jt([Na()],t.UI.prototype,"innerShadow",void 0),jt([Na()],t.UI.prototype,"blur",void 0),jt([Na()],t.UI.prototype,"backgroundBlur",void 0),jt([Na()],t.UI.prototype,"grayscale",void 0),jt([Na()],t.UI.prototype,"filter",void 0),jt([On({})],t.UI.prototype,"data",void 0),jt([lr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Ph=jt([ur(bh),ur(Eh),dr()],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([nr(ah)],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([ur(t.Branch),_r()],t.Group);const Sh=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,Wt.assign(n,t));const r=this.canvas=i.canvas(n);this.__controllers.push(this.renderer=i.renderer(this,r,n),this.watcher=i.watcher(this,n),this.layouter=i.layouter(this,n)),this.isApp&&this.__setApp(),this.__checkAutoLayout(n,e),this.view=r.view,e||(this.selector=i.selector(this),this.interaction=i.interaction(this,r,this.selector,n),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=i.hitCanvasManager()),this.canvasManager=new Mt,s=n.start),this.hittable=n.hittable,this.fill=n.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),Ur.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(so.RESTART):this.emitLeafer(so.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(so.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=Wt.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=Wt.copyAttrs({},this.canvas,ie);e.resize(t),this.updateLazyBounds(),this.__onResize(new Jr(t,i))}__onResize(t){this.emitEvent(t),Wt.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 _t(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=Wt.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(so.BEFORE_READY),this.emitLeafer(so.READY),this.emitLeafer(so.AFTER_READY),Ur.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(so.VIEW_READY),Ur.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ur.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender((()=>{this.imageReady&&(t&&this.emitLeafer(so.VIEW_COMPLETED),Ur.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 Tt.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new so(t,this))}__listenEvents(){const t=Rt.start("FirstCreate "+this.innerName);this.once(so.START,(()=>Rt.end(t))),this.once(eo.START,(()=>this.updateLazyBounds())),this.once(io.START,(()=>this.__onCreated())),this.once(io.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(to.DATA,this.__onWatchData,this),this.on_(eo.END,this.__onLayoutEnd,this),this.on_(io.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 so(so.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){Sh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ya,jt([nr(lh)],t.Leafer.prototype,"__",void 0),jt([Un()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Rh=jt([_r()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},jt([nr(uh)],t.Rect.prototype,"__",void 0),t.Rect=jt([ur(kh),dr(),_r()],t.Rect);const{copy:Ch,add:Th,includes:Lh}=at,Ah=t.Rect.prototype,Dh=t.Group.prototype,Oh={};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(),Ch(Oh,e),this.__updateRectRenderBounds(),t=!Lh(e,Oh)||void 0,t&&"hide"!==this.__.overflow&&Th(e,Oh)):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))}},jt([nr(hh)],t.Box.prototype,"__",void 0),jt([Un(100)],t.Box.prototype,"width",void 0),jt([Un(100)],t.Box.prototype,"height",void 0),jt([On(!1)],t.Box.prototype,"resizeChildren",void 0),jt([Vn("show")],t.Box.prototype,"overflow",void 0),jt([lr(Ah.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),jt([lr(Ah.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),jt([lr(Ah.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),jt([lr(Ah.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),jt([lr(Ah.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),jt([lr(Ah.__updateChange)],t.Box.prototype,"__updateRectChange",null),jt([lr(Ah.__render)],t.Box.prototype,"__renderRect",null),jt([lr(Dh.__render)],t.Box.prototype,"__renderGroup",null),t.Box=jt([dr(),_r()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},jt([nr(dh)],t.Frame.prototype,"__",void 0),jt([qn("#FFFFFF")],t.Frame.prototype,"fill",void 0),jt([Vn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=jt([_r()],t.Frame);const{moveTo:Ih,closePath:Fh,ellipse:Mh}=qi;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:r}=this.__,o=t/2,a=i/2,h=this.__.path=[];s?(n||r?(s<1&&Mh(h,o,a,o*s,a*s,0,n,r,!1),Mh(h,o,a,o,a,0,r,n,!0),s<1&&Fh(h)):(s<1&&(Mh(h,o,a,o*s,a*s),Ih(h,t,a)),Mh(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||r?(Ih(h,o,a),Mh(h,o,a,o,a,0,n,r,!1),Fh(h)):Mh(h,o,a,o,a)}},jt([nr(_h)],t.Ellipse.prototype,"__",void 0),jt([Hn(0)],t.Ellipse.prototype,"innerRadius",void 0),jt([Hn(0)],t.Ellipse.prototype,"startAngle",void 0),jt([Hn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=jt([_r()],t.Ellipse);const{moveTo:Wh,lineTo:Uh,drawPoints:Nh}=qi,{rotate:zh,getAngle:Yh,getDistance:Hh,defaultPoint:Xh}=I,{toBounds:jh}=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&&zh(i,e),i}set toPoint(t){this.width=Hh(Xh,t),this.rotation=Yh(Xh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Nh(e,t.points,!1,t.closed):(Wh(e,0,0),Uh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Nh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&Ga.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?jh(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},jt([nr(ch)],t.Line.prototype,"__",void 0),jt([Xn("center")],t.Line.prototype,"strokeAlign",void 0),jt([Un(0)],t.Line.prototype,"height",void 0),jt([Hn()],t.Line.prototype,"points",void 0),jt([Hn(0)],t.Line.prototype,"curve",void 0),jt([Hn(!1)],t.Line.prototype,"closed",void 0),t.Line=jt([_r()],t.Line);const{sin:Gh,cos:Vh,PI:qh}=Math,{moveTo:Kh,lineTo:Zh,closePath:Qh,drawPoints:$h}=qi,Jh=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,r=i/2;Kh(t,n,0);for(let e=1;e<s;e++)Zh(t,n+n*Gh(2*e*qh/s),r-r*Vh(2*e*qh/s))}Qh(t)}__updateRenderPath(){}__updateBoxBounds(){}},jt([nr(ph)],t.Polygon.prototype,"__",void 0),jt([Hn(3)],t.Polygon.prototype,"sides",void 0),jt([Hn()],t.Polygon.prototype,"points",void 0),jt([Hn(0)],t.Polygon.prototype,"curve",void 0),jt([lr(Jh.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),jt([lr(Jh.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=jt([dr(),_r()],t.Polygon);const{sin:tl,cos:el,PI:il}=Math,{moveTo:sl,lineTo:nl,closePath:rl}=qi;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,r=e/2,o=this.__.path=[];sl(o,n,0);for(let t=1;t<2*i;t++)nl(o,n+(t%2==0?n:n*s)*tl(t*il/i),r-(t%2==0?r:r*s)*el(t*il/i));rl(o)}},jt([nr(gh)],t.Star.prototype,"__",void 0),jt([Hn(5)],t.Star.prototype,"corners",void 0),jt([Hn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=jt([_r()],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($r.LOADED,(t=>{"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}))}destroy(){this.image=null,super.destroy()}},jt([nr(wh)],t.Image.prototype,"__",void 0),jt([Un("")],t.Image.prototype,"url",void 0),t.Image=jt([_r()],t.Image);const ol=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 Sn({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new $r($r.LOADED,{image:t}))}))}draw(t,e,i,s){const n=new Y(t.worldTransform).invert(),r=new Y;e&&r.translate(e.x,e.y),i&&("number"==typeof i?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=this.context=null),super.destroy()}},jt([nr(xh)],t.Canvas.prototype,"__",void 0),jt([za(100)],t.Canvas.prototype,"width",void 0),jt([za(100)],t.Canvas.prototype,"height",void 0),jt([za(1)],t.Canvas.prototype,"pixelRatio",void 0),jt([za(!0)],t.Canvas.prototype,"smooth",void 0),jt([On(!1)],t.Canvas.prototype,"safeResize",void 0),jt([za()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=jt([_r()],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:r,italic:o,textCase:a,textOverflow:l,padding:d}=t;t.__lineHeight=ja.number(e,n),t.__letterSpacing=ja.number(i,n),t.__padding=d?h.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=Ha.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&ll(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i);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()}},jt([nr(vh)],t.Text.prototype,"__",void 0),jt([Un(0)],t.Text.prototype,"width",void 0),jt([Un(0)],t.Text.prototype,"height",void 0),jt([qn()],t.Text.prototype,"boxStyle",void 0),jt([On(!1)],t.Text.prototype,"resizeFontSize",void 0),jt([qn("#000000")],t.Text.prototype,"fill",void 0),jt([Xn("outside")],t.Text.prototype,"strokeAlign",void 0),jt([ir("all")],t.Text.prototype,"hitFill",void 0),jt([Un("")],t.Text.prototype,"text",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([_r()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},jt([nr(fh)],t.Path.prototype,"__",void 0),jt([Xn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=jt([_r()],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,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},jt([nr(yh)],t.Pen.prototype,"__",void 0),jt([(t,e)=>{Cn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=jt([ur(cs,["set","path","paint"]),_r()],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:r}=t;e&&(this.ground=this.addLeafer(e)),(s||r)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(n||r)&&(this.sky=this.addLeafer(n)),r&&this.sky.add(this.editor=i.editor(r))}}__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&&Wt.assign(e,t),this.autoLayout&&Wt.copyAttrs(e,this,ie),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(eo.END,(()=>this.__onReady())),t.once(io.START,(()=>this.__onCreated())),t.once(io.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(io.END,this.__onChildRenderEnd,this))}},t.App=jt([_r()],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}},_l={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 pl extends Kr{get spaceKey(){return ul.isHoldSpaceKey()}get left(){return _l.left(this)}get right(){return _l.right(this)}get middle(){return _l.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 pl{},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([pr()],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,r=t.getLocalPoint(i,null,!0);return I.move(r,e.x-t.x,e.y-t.y),n&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===n?t.parent.boxBounds:n,r,!0),"x"===s&&(r.y=0),"y"===s&&(r.x=0),r}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,r=t.y+i.y,o=n+t.width,a=r+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),at.includes(t,e)?(n>e.x?i.x+=e.x-n:o<h&&(i.x+=h-o),r>e.y?i.y+=e.y-r:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:o>h&&(i.x+=h-o),r<e.y?i.y+=e.y-r:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(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=jt([pr()],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=jt([pr()],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([pr()],t.MoveEvent),t.RotateEvent=class extends pl{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=jt([pr()],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([pr()],t.SwipeEvent),t.ZoomEvent=class extends pl{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=jt([pr()],t.ZoomEvent),t.KeyEvent=class extends pl{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=jt([pr()],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,wl=new ya,{getDragEventData:xl,getDropEventData:bl,getSwipeEventData:El}=ml;class Bl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=xl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||wl;return this.dragging&&(n?e?wl:new ya(i?[...s.list,...s.dragHoverExclude]:s.list):r)}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&&_l.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:r,throughPath:o}=n;this.dragData=xl(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,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:r,throughPath:o}=s,a=xl(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,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 kl=Et.get("emit");const Pl=["move","zoom","rotate","key"];function Rl(t,e,i,s,n){if(Pl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Cl(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Sl(r,e,i,s,n)}}function Sl(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Cl(t,n)&&(Ja.updateEventStyle&&!s&&Ja.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 Cl(t,e){return e&&e.has(t)}const Tl={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:Ll,pathCanDrag:Al,pathHasOutside:Dl}=ml;class Ol{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&&_l.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&_l.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=Wt.clone(Tl),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ya(t),this.createTransformer(),this.dragger=new Bl(this),s&&(this.config=Wt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(_l.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),_l.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=_l.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&&_l.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.waitTap||this.longPressTimer)&&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;_l.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,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Ll(e.path,t)));n<i.tapTime+50&&r?(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:r,target:o}=this;e.backgrounder||t.origin||o&&o.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:r,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&&!Dl(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Al(t.path))&&!Dl(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(){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),(Ll(e.path,t.PointerEvent.LONG_TAP)||Ll(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){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_(Jr.RESIZE,this.__onResize,this)],t.once(so.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Sl(n,t,e,!0,s))return;n.isApp&&Rl(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Rl(n,t,e,!1,s),Sl(n,t,e,!1,s))return}catch(t){kl.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 Fl extends Mt{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:Ml,copy:Wl,setRadius:Ul}=I,Nl={},zl=t.Leaf.prototype;zl.__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&&(Wl(Nl,t),Ul(t=Nl,e.hitRadius)),Ml(t,i,Nl),e.hitBox||n){if(at.hitRadiusPoint(s.boxBounds,Nl))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Nl)},zl.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},zl.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},zl.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},zl.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Yl=new Y,Hl=t.UI.prototype;Hl.__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,r=s||n;this.__hitCanvas||(this.__hitCanvas=r?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const o=this.__hitCanvas;if(r){const{renderBounds:i}=this.__layout,r=e.image.hitCanvasSize,a=o.hitScale=ut.set(0,0,r,r).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ut.set(i).scale(a);o.resize({width:d,height:c,pixelRatio:1}),o.clear(),Bn.patternLocked=!0,this.__renderShape(o,{matrix:Yl.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),Bn.patternLocked=!1,o.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(t)},Hl.__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:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__pixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Xl=t.UI.prototype,jl=t.Rect.prototype,Gl=t.Box.prototype;jl.__updateHitCanvas=Gl.__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)},jl.__hitFill=Gl.__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:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach((n=>t.rect(n.x,n.y-s,n.width,e<i?i:e)))},t.Group.prototype.pick=function(t,s){return s||(s=Yt),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 Vl=se.prototype;function ql(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)}));if(r){const{decorationColor:t,decorationHeight:i}=s;t&&(e.fillStyle=t),n.forEach((t=>r.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):Ql(e,i);break;case"inside":Zl("inside",t,n,e,i);break;case"outside":Zl("outside",t,n,e,i)}}function Zl(t,e,i,s,n){const{__strokeWidth:r,__font:o}=s.__,a=n.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*r,s.__),a.font=o,i?$l(e,!0,s,a):Ql(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",ql(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 Ql(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(r){const{decorationHeight:t}=s;n.forEach((i=>r.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function $l(t,e,i,s){let n;for(let r=0,o=t.length;r<o;r++)n=t[r],n.image&&qa.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Ql(i,s):s.stroke(),s.restoreBlendMode()):e?Ql(i,s):s.stroke())}function Jl(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}Vl.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Vl.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Vl.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),ut.set(s-r,n-o,2*r,2*o).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 rd(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:r,color:o,opacity:a}=e;return{type:n,blendMode:r,style:Xa.string(o,a)};case"image":return qa.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 od={compute:function(t,e){const i=e.__,s=[];let n,r=i.__input[t];r instanceof Array||(r=[r]),nd=qa.recycleImage(t,i);for(let i,n=0,o=r.length;n<o;n++)i=rd(t,r[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?ql(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,i){let s;const{windingRule:n,__font:r}=e.__;for(let o=0,a=t.length;o<a;o++)s=t[o],s.image&&qa.checkImage(e,i,s,!r)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),r?ql(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),r?ql(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):r?ql(e,i):n?i.fill(n):i.fill())},fillText:ql,stroke:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:r,__font:o}=s;if(n)if(o)Kl(t,e,i);else switch(r){case"center":i.setStroke(t,n,s),i.stroke(),s.__useArrow&&Jl(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 r=i.getSameCanvas(!0,!0);r.setStroke(t,2*n,s),e.__drawRenderPath(r),r.stroke(),s.windingRule?r.clip(s.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,e.__layout.renderBounds),r.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:r,__font:o}=s;if(n)if(o)Kl(t,e,i);else switch(r){case"center":i.setStroke(void 0,n,s),$l(t,!1,e,i),s.__useArrow&&Jl(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:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*n,s),$l(t,!1,e,o),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(r),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,r),o.recycle(e.__nowWorld)}},strokeText:Kl,drawTextStroke:Ql,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let r,o,a,h,{scaleX:l,scaleY:d}=n;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(n))h=s,r=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);o=e.bounds.getFitMatrix(c);let{a:u,d:_}=o;if(o.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=_),a=ed(n,o),r=id(a,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,_*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,_)})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:r,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let ad={};const{get:hd,rotateOfOuter:ld,translate:dd,scaleOfOuter:cd,scale:ud,rotate:_d}=E;function pd(t,e,i,s,n,r,o){const a=hd();dd(a,e.x+i,e.y+s),ud(a,n,r),o&&ld(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function gd(t,e,i,s,n,r,o){const a=hd();dd(a,e.x+i,e.y+s),n&&ud(a,n,r),o&&_d(a,o),t.transform=a}function fd(t,e,i,s,n,r,o,a,h,l){const d=hd();if(h)if("center"===l)ld(d,{x:i/2,y:s/2},h);else switch(_d(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+r,dd(d,ad.x,ad.y),o&&cd(d,ad,o,a),t.transform=d}const{get:yd,translate:md}=E,vd=new ct,wd={},xd={};function bd(t,e,i,s){const{blendMode:n,changeful:r,sync:o}=i;n&&(t.blendMode=n),r&&(t.changeful=r),o&&(t.sync=o),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:r,mode:o,align:a,offset:l,scale:d,size:c,rotation:u,repeat:_,filters:p}=t,g=e.width===s&&e.height===n,f={mode:o},y="center"!==a&&(u||0)%180==90,m=y?n:s,v=y?s:n;let w,x,b=0,E=0;if(o&&"cover"!==o&&"fit"!==o)(d||c)&&(h.getScaleData(d,c,i,xd),w=xd.scaleX,x=xd.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;w=x="fit"===o?Math.min(t,i):Math.max(t,i),b+=(e.width-s*w)/2,E+=(e.height-n*x)/2}if(a){const t={x:b,y:E,width:m,height:v};w&&(t.width*=w,t.height*=x),wt.toPoint(a,t,e,wd,!0),b+=wd.x,E+=wd.y}switch(l&&(b+=l.x,E+=l.y),o){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(b||E||w||u)&&gd(f,e,b,E,w,x,u);break;case"repeat":(!g||w||u)&&fd(f,e,s,n,b,E,w,x,u,a),_||(f.repeat="repeat");break;default:w&&pd(f,e,b,E,w,x,u)}return f.transform||(e.x||e.y)&&(f.transform=yd(),md(f.transform,e.x,e.y)),w&&"stretch"!==o&&(f.scaleX=w,f.scaleY=x),f.width=s,f.height=n,r&&(f.opacity=r),p&&(f.filters=p),_&&(f.repeat="string"==typeof _?"x"===_?"repeat-x":"repeat-y":"repeat"),f}let Bd,kd=new ct;const{isSame:Pd}=at;function Rd(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||bd(n,s,i,r),!0}function Sd(t,e){Ld(t,$r.LOAD,e)}function Cd(t,e){Ld(t,$r.LOADED,e)}function Td(t,e,i){e.error=i,t.forceUpdate("surface"),Ld(t,$r.ERROR,e)}function Ld(t,e,i){t.hasEvent(e)&&t.emitEvent(new $r(e,i))}function Ad(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Dd,scale:Od,copy:Id}=E,{ceil:Fd,abs:Md}=Math;function Wd(t,i,s){let{scaleX:n,scaleY:r}=Bn.patternLocked?t.__world:t.__nowWorld;const o=n+"-"+r+"-"+s;if(i.patternId===o||t.destroyed)return!1;{n=Md(n),r=Md(r);const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g}=a;u&&(l=Dd(),Id(l,p),Od(l,1/u,1/_),n*=u,r*=_),n*=s,r*=s,d*=n,c*=r;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,r/=h,d/=h,c/=h),u&&(n/=u,r/=_),(p||1!==n||1!==r)&&(l||(l=Dd(),p&&Id(l,p)),Od(l,1/n,1/r));const m=t.getCanvas(Fd(d)||1,Fd(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=o,!0}}const{abs:Ud}=Math;const Nd={image:function(t,e,i,s,n){let r,o;const a=Bn.get(i);return Bd&&i===Bd.paint&&Pd(s,Bd.boxBounds)?r=Bd.leafPaint:(r={type:i.type,image:a},Bd=a.use>1?{leafPaint:r,paint:i,boxBounds:kd.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Rd(t,e,i,a,r,s),n&&(Sd(t,o),Cd(t,o))):a.error?n&&Td(t,o,a.error):(n&&(Ad(t,!0),Sd(t,o)),r.loadId=a.load((()=>{Ad(t,!1),t.destroyed||(Rd(t,e,i,a,r,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Cd(t,o)),r.loadId=null}),(e=>{Ad(t,!1),Td(t,o,e),r.loadId=null}))),r},checkImage:function(t,i,s,n){const{scaleX:r,scaleY:o}=Bn.patternLocked?t.__world:t.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+a&&!$a.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||Jr.isResizing(t)||$a.running)){let{width:t,height:i}=h;t*=Ud(r)*a,i*=Ud(o)*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?Wd(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)&&Wd(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:Wd,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,Bn.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),n.unload(i[h].loadId,!o.some((t=>t.url===a)))));return r}return null},createData:bd,getPatternData:Ed,fillOrFitMode:pd,clipMode:gd,repeatMode:fd},{toPoint:zd}=yt,Yd={},Hd={};function Xd(t,e,i){if(e){let s;for(let n=0,r=e.length;n<r;n++)s=e[n],"string"==typeof s?t.addColorStop(n/(r-1),Xa.string(s,i)):t.addColorStop(s.offset,Xa.string(s.color,i))}}const{getAngle:jd,getDistance:Gd}=I,{get:Vd,rotateOfOuter:qd,scaleOfOuter:Kd}=E,{toPoint:Zd}=yt,Qd={},$d={};function Jd(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=jd(e,i);r=Vd(),n?(Kd(r,e,o/a*(s||1),1),qd(r,e,t+90)):(Kd(r,e,1,o/a*(s||1)),qd(r,e,t))}return r}const{getDistance:tc}=I,{toPoint:ec}=yt,ic={},sc={};const nc={linearGradient:function(t,i){let{from:s,to:n,type:r,blendMode:o,opacity:a}=t;zd(s||"top",i,Yd),zd(n||"bottom",i,Hd);const h=e.canvas.createLinearGradient(Yd.x,Yd.y,Hd.x,Hd.y);Xd(h,t.stops,a);const l={type:r,style:h};return o&&(l.blendMode=o),l},radialGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,blendMode:a,stretch:h}=t;Zd(s||"center",i,Qd),Zd(n||"bottom",i,$d);const l=e.canvas.createRadialGradient(Qd.x,Qd.y,0,Qd.x,Qd.y,Gd(Qd,$d));Xd(l,t.stops,o);const d={type:r,style:l},c=Jd(i,Qd,$d,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,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,o);const d={type:r,style:l},c=Jd(i,ic,sc,h||1,e.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:Jd},{copy:rc,toOffsetOutBounds:oc}=at,ac={},hc={};function lc(t,i,s,n){const{bounds:r,shapeBounds:o}=n;if(e.fullImageShadow){if(rc(ac,t.bounds),ac.x+=i.x-o.x,ac.y+=i.y-o.y,s){const{matrix:t}=n;ac.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),ac.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),ac.width*=s,ac.height*=s}t.copyWorld(n.canvas,t.bounds,ac)}else s&&(rc(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,o,s?ac:i)}const{toOffsetOutBounds:dc}=at,cc={};const uc={shadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;oc(l,hc),a.forEach(((a,g)=>{_.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/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,lc(_,hc,n,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,r,"copy"),s=r),h?_.copyWorld(h,r,r,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,s,r,a.blendMode):e.copyWorldToInner(_,s,o.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;dc(l,cc),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(cc.offsetX+a.x*c,cc.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,lc(_,cc,n,i),_.restore(),h?(_.copyWorld(_,l,r,"copy"),_.copyWorld(h,r,r,"source-out"),s=r):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Xa.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(_,s,r,a.blendMode):e.copyWorldToInner(_,s,o.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:_c}=Dr;function pc(t,e,i,s,n,r){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,r);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,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(o&&(pc(this,o,t,n,s,r),s=n=null),"path"===a||"clipping-path"===a?(i.opacity<1?(o="opacity-path",r=i.opacity,n||(n=gc(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=gc(t)),n||(n=gc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||_c(i,e)||i.__render(n||t,e);pc(this,o,t,n,s,r)};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 wc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const xc=wc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),bc=wc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ec=wc(yc),Bc=wc(mc),kc=wc("- —/~|┆·");var Pc;!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"}(Pc||(Pc={}));const{Letter:Rc,Single:Sc,Before:Cc,After:Tc,Symbol:Lc,Break:Ac}=Pc;function Dc(t){return xc[t]?Rc:kc[t]?Ac:bc[t]?Cc:Ec[t]?Tc:Bc[t]?Lc:vc.test(t)?Sc:Rc}const Oc={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function 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:Fc}=Oc,{Letter:Mc,Single:Wc,Before:Uc,After:Nc,Symbol:zc,Break:Yc}=Pc;let Hc,Xc,jc,Gc,Vc,qc,Kc,Zc,Qc,$c,Jc,tu,eu,iu,su,nu,ru,ou=[];function au(t,e){Qc&&!Zc&&(Zc=Qc),Hc.data.push({char:t,width:e}),jc+=e}function hu(){Gc+=jc,Hc.width=jc,Xc.words.push(Hc),Hc={data:[]},jc=0}function lu(){iu&&(su.paraNumber++,Xc.paraStart=!0,iu=!1),Qc&&(Xc.startCharSize=Zc,Xc.endCharSize=Qc,Zc=0),Xc.width=Gc,nu.width?Fc(Xc):ru&&du(),ou.push(Xc),Xc={words:[]},Gc=0}function du(){Gc>(su.maxWidth||0)&&(su.maxWidth=Gc)}const{top:cu,right:uu,bottom:_u,left:pu}=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,r=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(r?(s=l[pu],r-=l[uu]+l[pu]):i.autoSizeAlign||(s=l[pu]),o?(n=l[cu],o-=l[cu]+l[_u]):i.autoSizeAlign||(n=l[cu]));const d={bounds:{x:s,y:n,width:r,height:o},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){su=t,ou=t.rows,nu=t.bounds,ru=!nu.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:o}=s,{canvas:a}=e,{width:h,height:l}=nu;if(h||l||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;iu=!0,Jc=null,Zc=Kc=Qc=jc=Gc=0,Hc={data:[]},Xc={words:[]};for(let s=0,l=i.length;s<l;s++)qc=i[s],"\n"===qc?(jc&&hu(),Xc.paraEnd=!0,lu(),iu=!0):($c=Dc(qc),$c===Mc&&"none"!==o&&(qc=Ic(qc,o,!jc)),Kc=a.measureText(qc).width,n&&(n<0&&(Qc=Kc),Kc+=n),tu=$c===Wc&&(Jc===Wc||Jc===Mc)||Jc===Wc&&$c!==Nc,eu=!($c!==Uc&&$c!==Wc||Jc!==zc&&Jc!==Nc),Vc=iu&&r?h-r:h,t&&h&&Gc+jc+Kc>Vc&&(e?(jc&&hu(),Gc&&lu()):(eu||(eu=$c===Mc&&Jc==Nc),tu||eu||$c===Yc||$c===Uc||$c===Wc||jc+Kc>Vc?(jc&&hu(),Gc&&lu()):Gc&&lu()))," "===qc&&!0!==iu&&Gc+jc===0||($c===Yc?(" "===qc&&jc&&hu(),au(qc,Kc),hu()):tu||eu?(jc&&hu(),au(qc,Kc)):au(qc,Kc)),Jc=$c);jc&&hu(),Gc&&lu(),ou.length>0&&(ou[ou.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{su.paraNumber++,Gc=a.measureText(t).width,ou.push({x:r||0,text:t,width:Gc,paraStart:!0}),ru&&du()}))}(d,t,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":gu(e,"x",t[pu]);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[_u])}}(l,d,i,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(d,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,r),d.overflow&&function(t,i,s,n){if(!n)return;const{rows:r,overflow:o}=t;let{textOverflow:a}=i;if(r.splice(o),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?r:[r[o-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,r),"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+")"}};Object.assign(Ha,fu),Object.assign(Xa,yu),Object.assign(Va,od),Object.assign(qa,Nd),Object.assign(Ka,nc),Object.assign(Za,uc),Object.assign(i,{interaction:(t,e,i,s)=>new Ol(t,e,i,s),hitCanvas:(t,e)=>new va(t,e),hitCanvasManager:()=>new Fl}),xa();class mu extends rh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function vu(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i),this.waitLeafer((()=>e?Ja.setStyleName(this,e,i):Ja.set(this,i)))}})))}function wu(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function xu(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function bu(t,e){"object"!=typeof e&&(e=void 0),ku(t,e,"in")}function Eu(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),ku(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;t instanceof Array?t.forEach((t=>this.__loadRobot(t,e,e+=t.total||1))):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),void 0!==t)if("number"==typeof t)this.now=t;else if("object"==typeof t){const e=t instanceof Array,i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Bn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load((()=>this.__createFrames(s,t,e,i)))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&("number"==typeof r?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,d=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:d,width:a,height:h},l+a>=t.width?(l=0,d+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new $r($r.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),void 0!==n.loop&&(s=n.loop)),this.__timer=setTimeout((()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)}),1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},jt([nr(mu)],t.Robot.prototype,"__",void 0),jt([Un()],t.Robot.prototype,"robot",void 0),jt([On()],t.Robot.prototype,"actions",void 0),jt([On("")],t.Robot.prototype,"action",void 0),jt([qn(0)],t.Robot.prototype,"now",void 0),jt([On(12)],t.Robot.prototype,"FPS",void 0),jt([On(!0)],t.Robot.prototype,"loop",void 0),t.Robot=jt([_r()],t.Robot),Tt.add("robot");const Bu={};function ku(t,e,i){const{normalStyle:s}=t;e||(e=Bu),e.scale&&(h.assignScale(e,e.scale),delete e.scale),e!==Bu&&Ja.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&Ht(i[s])&&Ht(e[s])&&(s="transition");return Ht(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=Su(e,t),s=t.animate();s&&Su(i,t,s.fromStyle);return i}(t,e):void 0;Ja.canAnimate&&Pu(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=Pu(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=Ru(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=Ru(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Pu(t){let e;const i={},s=xu(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&Ja.isState(n,t,s)&&(e=Cu(i,r));const o=i.selectedStyle||t.selectedStyle;if(o&&Ja.isSelected(t,s)&&(e=Cu(i,o)),Ja.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Cu(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Ja.isFocus(t,s)&&(e=Cu(i,n));const r=i.hoverStyle||t.hoverStyle;r&&Ja.isHover(t,s)&&(e=Cu(i,r));const o=i.pressStyle||t.pressStyle;o&&Ja.isPress(t,s)&&(e=Cu(i,o))}return e?i:void 0}function Ru(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&Ja.animateExcludes[t]||(n[t]=e[t]);return n}function Su(t,e,i){return Ru(t,e,i,!0)}function Cu(t,e){return Object.assign(t,e),!0}function Tu(t,e){const i=t[e];i&&bu(t,i),t.button&&Au(t.children,e)}function Lu(t,e,i){i||(i=t.states[e]),bu(t,i),t.button&&Au(t.children,null,e)}function Au(t,e,i){if(!t)return;let s,n;for(let r=0,o=t.length;r<o;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":Ja.isHover(s)&&(n=!1);break;case"pressStyle":Ja.isPress(s)&&(n=!1);break;case"focusStyle":Ja.isFocus(s)&&(n=!1)}n&&Tu(s,e)}else void 0!==i&&Lu(s,i);s.isBranch&&Au(s.children,e,i)}}function Du(t,e){const i=t[e];i&&Eu(t,i),t.button&&Iu(t.children,e)}function Ou(t,e,i){Eu(t,i),t.button&&Iu(t.children,null,e)}function Iu(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?Du(s,e):void 0!==i&&Ou(s,i),s.isBranch&&Iu(s.children,e,i)}function Fu(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=xu(e,i);r&&(s=n[t](r))}return s}function Mu(t,e,i){let s=e[t];if(!s&&i){const n=xu(e,i);n&&(s=n[t])}return s}Tt.add("state"),Ja.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1},Ja.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=xu(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Ja.isSelected=function(t,e){return Mu("selected",t,e)},Ja.isDisabled=function(t,e){return Mu("disabled",t,e)},Ja.isFocus=function(t,e){return Fu("isFocus",t,e)},Ja.isHover=function(t,e){return Fu("isHover",t,e)},Ja.isPress=function(t,e){return Fu("isPress",t,e)},Ja.isDrag=function(t,e){return Fu("isDrag",t,e)},Ja.setStyleName=function(t,e,i){i?Lu(t,e,t[e]):Ou(t,e,t[e])},Ja.set=function(t,e){const i=t.states[e];i?Lu(t,e,i):Ou(t,e,i)},Ja.getStyle=Pu,Ja.updateStyle=ku,Ja.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Tu(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Du(e,"hoverStyle");break;case t.PointerEvent.DOWN:Tu(e,"pressStyle");break;case t.PointerEvent.UP:Du(e,"pressStyle")}};const Wu=t.UI.prototype;t.UI.addAttr("selected",!1,vu,"selectedStyle"),t.UI.addAttr("disabled",!1,vu,"disabledStyle"),t.UI.addAttr("states",{},wu),t.UI.addAttr("state","",vu),t.UI.addAttr("normalStyle",void 0,On),t.UI.addAttr("hoverStyle",void 0,wu),t.UI.addAttr("pressStyle",void 0,wu),t.UI.addAttr("focusStyle",void 0,wu),t.UI.addAttr("selectedStyle",void 0,wu),t.UI.addAttr("disabledStyle",void 0,wu),t.UI.addAttr("button",!1,On),Wu.focus=function(t=!0){this.waitLeafer((()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Tu(this,"focusStyle"):Du(this,"focusStyle")}))},Wu.updateState=function(){Ja.updateStyle(this,void 0,"in")};const{cos:Uu,sin:Nu,pow:zu,sqrt:Yu,abs:Hu,ceil:Xu,floor:ju,round:Gu,PI:Vu}=Math,qu=5*Vu,Ku=1.70158,Zu=2.5949095,Qu=7.5625,$u=2.75;function Ju(t){return e=>zu(e,t)}function t_(t){return e=>1-zu(1-e,t)}function e_(t){return e=>e<.5?.5*zu(2*e,t):1-.5*zu(2-2*e,t)}function i_(t){return t<1/$u?Qu*t*t:t<2/$u?Qu*(t-=1.5/$u)*t+.75:t<2.5/$u?Qu*(t-=2.25/$u)*t+.9375:Qu*(t-=2.625/$u)*t+.984375}function s_(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=n_(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Hu(l)<1e-6));e++)c-=d/l;return n[o]=n_(c,e,s)}}function n_(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const r_={get(t){const{list:e}=r_;return"string"==typeof t?e[t||"ease"]:"object"==typeof t?e[t.name].apply(e,t.value instanceof Array?t.value:[t.value]):e.ease},register(t,e){r_.list[t]=e},list:{linear:t=>t,ease:s_(.25,.1,.25,1),"ease-in":s_(.42,0,1,1),"ease-out":s_(0,0,.58,1),"ease-in-out":s_(.42,0,.58,1),"sine-in":t=>1-Uu(t*Vu*.5),"sine-out":t=>Nu(t*Vu*.5),"sine-in-out":t=>.5*(1-Uu(t*Vu)),"quad-in":Ju(2),"quad-out":t_(2),"quad-in-out":e_(2),"cubic-in":Ju(3),"cubic-out":t_(3),"cubic-in-out":e_(3),"quart-in":Ju(4),"quart-out":t_(4),"quart-in-out":e_(4),"quint-in":Ju(5),"quint-out":t_(5),"quint-in-out":e_(5),"expo-in":t=>t?zu(2,10*t-10):0,"expo-out":t=>1===t?1:1-zu(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*zu(2,2*t*10-10):.5*(2-zu(2,10-2*t*10)),"circ-in":t=>1-Yu(1-zu(t,2)),"circ-out":t=>Yu(1-zu(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Yu(1-zu(2*t,2))):.5*(Yu(1-zu(2-2*t,2))+1),"back-in":t=>((Ku+1)*t-Ku)*t*t,"back-out":t=>(t-=1)*t*((Ku+1)*t+Ku)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Zu+1)*t-Zu)*.5:.5*((t=2*t-2)*t*((Zu+1)*t+Zu)+2),"elastic-in":t=>0===t||1===t?t:-zu(2,10*(t-1))*Nu((t-1.1)*qu),"elastic-out":t=>0===t||1===t?t:zu(2,-10*t)*Nu((t-.1)*qu)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-zu(2,10*((t*=2)-1))*Nu((t-1.1)*qu)*.5:zu(2,10*(1-(t*=2)))*Nu((t-1.1)*qu)*.5+1,"bounce-in":t=>1-i_(1-t),"bounce-out":i_,"bounce-in-out":t=>t<.5?.5*(1-i_(1-2*t)):.5*(1+i_(2*t-1)),"cubic-bezier":s_,steps:function(t,e="floor"){return i=>("floor"===e?ju(i*t):"ceil"===e?Xu(i*t):Gu(i*t))/t}}};function o_(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class a_{}a_.CREATED="created",a_.PLAY="play",a_.PAUSE="pause",a_.STOP="stop",a_.SEEK="seek",a_.UPDATE="update",a_.COMPLETED="completed";t.Animate=class extends ro{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&"number"==typeof n&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=e instanceof Array?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=r_.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.reduce(((t,e)=>(t[e]=!0,t)),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout((()=>{this.timer=0,this.play()}),0))}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emit(a_.PLAY,this))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emit(a_.PAUSE,this))}stop(){this.destroyed||(this.complete(),this.emit(a_.STOP,this))}seek(t){this.destroyed||("object"==typeof t&&(t=ja.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer((()=>this.requestAnimate())),this.emit(a_.SEEK,this))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let o,a,h,l,d,c=0,u=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(a=i[s],l=a.style||a,o||(o=r?t:l),h={style:l,beforeStyle:{}},d=1,a.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=a;r&&(h.swing="number"==typeof r?r:2,d=2*h.swing-1),o&&(h.loop=d="number"==typeof o?o:2),t?(h.duration=t,c+=t*d,i&&(h.totalTime=t+i)):e&&(h.autoDuration=e,u+=e*d),i?(h.delay=i,c+=i*d):s&&(h.autoDelay=s,u+=s*d),n&&(h.easingFn=r_.get(n))}if(h.autoDuration||void 0!==h.duration||(n>1?s>0||r?u+=d:h.duration=0:h.duration=this.duration),n>1)this.setBefore(h,l,o);else{for(let e in l)h.beforeStyle[e]=t[e];this.fromStyle=h.beforeStyle,this.toStyle=h.style}o=l,e.push(h)}u?((this.duration<=c||!s||!s.duration)&&this.changeDuration(c+.2*u),this.allocateTime((this.duration-c)/u)):c&&this.changeDuration(c),this.emit(a_.CREATED,this)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let o in e)void 0===s[o]&&(s[o]=n[o]=e===i?i[o]:r[o]),t.beforeStyle[o]=void 0===i[o]?n[o]:i[o],n[o]=e[o]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],void 0===e.duration&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emit(a_.COMPLETED,this)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),th.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emit(a_.UPDATE,this)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return"number"==typeof e&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},jt([o_("ease")],t.Animate.prototype,"easing",void 0),jt([o_(0)],t.Animate.prototype,"delay",void 0),jt([o_(.2)],t.Animate.prototype,"duration",void 0),jt([o_("auto")],t.Animate.prototype,"ending",void 0),jt([o_(!1)],t.Animate.prototype,"reverse",void 0),jt([o_(!1)],t.Animate.prototype,"swing",void 0),jt([o_(!1)],t.Animate.prototype,"loop",void 0),jt([o_(0)],t.Animate.prototype,"loopDelay",void 0),jt([o_(1)],t.Animate.prototype,"speed",void 0),jt([o_(!0)],t.Animate.prototype,"autoplay",void 0),jt([o_()],t.Animate.prototype,"join",void 0),jt([o_()],t.Animate.prototype,"attrs",void 0),t.Animate=jt([ur(yo)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every((t=>t.completed))}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=e.map((e=>{const s=e.target?e:new t.Animate(this.target,e,i);return Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s}))}play(){this.each((t=>t.play()))}pause(){this.each((t=>t.pause()))}stop(){this.each((t=>t.stop()))}seek(t){this.each((e=>e.seek(t)))}kill(t,e){this.each((i=>i.kill(t,e))),this.destroy()}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each((e=>e.destroy(t))),e.length=0)}},t.AnimateList=jt([ur(yo)],t.AnimateList);const h_={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},l_=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,d_=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,c_=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,u_=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,__=parseInt,p_=parseFloat,{round:g_}=Math;let f_={},y_=0;function m_(t){let e,i,s,n=1;switch(t.length){case 9:e=__(t.slice(1,3),16),i=__(t.slice(3,5),16),s=__(t.slice(5,7),16),n=__(t.slice(7,9),16)/255;break;case 7:e=__(t.slice(1,3),16),i=__(t.slice(3,5),16),s=__(t.slice(5,7),16);break;case 5:e=__(t[1]+t[1],16),i=__(t[2]+t[2],16),s=__(t[3]+t[3],16),n=__(t[4]+t[4],16)/255;break;case 4:e=__(t[1]+t[1],16),i=__(t[2]+t[2],16),s=__(t[3]+t[3],16);break;case 3:e=i=s=__(t[1]+t[2],16);break;case 2:e=i=s=__(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const v_=1/6,w_=.5,x_=2/3,b_=1/3;function E_(t,e,i){return i<0?i++:i>1&&i--,i<v_?t+6*(e-t)*i:i<w_?e:i<x_?t+(e-t)*(x_-i)*6:t}function B_(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=E_(a,s,t+b_),r=E_(a,s,t),o=E_(a,s,t-b_)}return{r:g_(255*n),g:g_(255*r),b:g_(255*o),a:s}}Tt.add("color"),Xa.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=f_[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=m_(t);break;case"R":case"r":"("===t[4]&&d_.test(t)?i=function(t){const e=d_.exec(t);return{r:__(e[1]),g:__(e[2]),b:__(e[3]),a:p_(e[4])}}(t):"("===t[3]&&l_.test(t)&&(i=function(t){const e=l_.exec(t);return{r:__(e[1]),g:__(e[2]),b:__(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&u_.test(t)?i=function(t){const e=u_.exec(t);return B_(p_(e[1]),p_(e[2]),p_(e[3]),p_(e[4]))}(t):"("===t[3]&&c_.test(t)&&(i=function(t){const e=c_.exec(t);return B_(p_(e[1]),p_(e[2]),p_(e[3]),1)}(t))}if(!i){const e=h_[t.toLowerCase()];e&&(i=m_("#"+e))}i&&(y_++,y_>1e4&&(f_={},y_=0),f_[t]=Object.assign({},i))}}else"object"==typeof t&&(void 0===t.a&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:k_}=Math,{fourNumber:P_}=h,R_={fill:A_,stroke:A_,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?T_(t,e,i):(t=P_(t),e=P_(e),t.map(((t,s)=>T_(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,n=e.length,r=T_(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return"number"==typeof t||"number"==typeof e?h.float(T_(t,e,i),Math.max(C_(t),C_(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return th.setBetweenStyle(n,t,e,n,i,s),n},shadow:D_,innerShadow:D_},S_={value:function(t,e,i){const s="number"==typeof t,n="number"==typeof e;return s&&n?t+(e-t)*i:n||s?T_(t,e,i):t},number:T_,color:L_,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=th;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function C_(t){const e=String(t).split(".")[1];return e?e.length:0}function T_(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?k_(n):n}function L_(t,e,i){t=Xa.object(t),e=Xa.object(e);const s=T_(t.r,e.r,i,1)+","+T_(t.g,e.g,i,1)+","+T_(t.b,e.b,i,1),n=T_(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function A_(t,e,i){return"string"==typeof t&&"string"==typeof e?L_(t,e,i):e}function D_(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:T_((t=t||{}).x,e.x,i),y:T_(t.y,e.y,i),blur:T_(t.blur,e.blur,i),spread:T_(t.spread,e.spread,i),color:L_(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Tt.add("animate","color"),Ja.canAnimate=!0,Object.assign(th.list,R_),Object.assign(th,S_);const O_=t.UI.prototype;t.UI.addAttr("animation",void 0,(function(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),t.UI.addAttr("animationOut",void 0,On),t.UI.addAttr("transition",!0,On),t.UI.addAttr("transitionOut",void 0,On),O_.animate=function(e,i,s,n){if(void 0===e)return this.__animate;let r=e instanceof Array&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const o=this.__animate;return o&&(r instanceof t.AnimateList?r.list.unshift(o):r=new t.AnimateList(this,[o,r])),this.__animate=r},O_.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},O_.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(a_.COMPLETED,e)};const I_=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],F_=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:M_}=Math,W_={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<I_.length;h++)l=f*(1+I_[h]),d=f*(1-I_[h]),c=U_(l,t,i,n,o),u=U_(l,e,s,r,a),_=U_(d,t,i,n,o),p=U_(d,e,s,r,a),g+=F_[h]*(M_(c*c+u*u)+M_(_*_+p*p));return g*f},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)},getRotation(t,e,i,s,n,r,o,a,h){const l=U_(t,e,s,r,a),c=U_(t,i,n,o,h);return Math.atan2(c,l)/d},getT(t,e,i,s,n,r,o,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)N_(i,s,n,r,o,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,_=d*n+e*o,p=d*r+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*o+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(oe.C,c,u,g,f,y,m)}},{getDerivative:U_,getDistance:N_}=W_,{M:z_,L:Y_,C:H_,Z:X_}=oe,j_={},G_={},V_={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case z_:case Y_:V_.transformPoints(t,e,s,1),s+=3;break;case H_:V_.transformPoints(t,e,s,3),s+=7;break;case X_:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)j_.x=t[n],j_.y=t[n+1],E.toOuterPoint(e,j_),t[n]=j_.x,t[n+1]=j_.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case z_:case Y_:i=t[a+1],s=t[a+2],e=n===Y_&&a>0?I.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case H_:i=t[a+5],s=t[a+6],e=W_.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case X_:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=ja.number(e,t.total);let r,o,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case z_:case Y_:if(o=n[f+1],a=n[f+2],r=s[y],p+r>=e||!t.total)return f||(m=o,v=a),G_.x=m,G_.y=v,g.x=o,g.y=a,I.getDistancePoint(G_,g,e-p,!0),g.rotation=I.getAngle(G_,g),g;m=o,v=a,f+=3;break;case H_:if(o=n[f+5],a=n[f+6],r=s[y],p+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],_=W_.getT(e-p,r,m,v,l,d,c,u,o,a,i),Ae.getPointAndSet(_,m,v,l,d,c,u,o,a,g),g.rotation=W_.getRotation(_,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case X_:f+=1;default:r=0}y++,p+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=ja.number(e,t.total);let o,a,h,l,d,c,u,_,p,g=0,f={},y=0,m=0,v=0,w=0;const x=n.length;for(;y<x;){switch(l=n[y],l){case z_:case Y_:if(a=n[y+1],h=n[y+2],o=s[m],g+o>=e||!t.total)return y||(v=a,w=h),G_.x=v,G_.y=w,f.x=a,f.y=h,I.getDistancePoint(G_,f,e-g,!0),r.push(l,f.x,f.y),r;v=a,w=h,y+=3,r.push(l,v,w);break;case H_:if(d=n[y+1],c=n[y+2],u=n[y+3],_=n[y+4],a=n[y+5],h=n[y+6],o=s[m],g+o>=e)return p=W_.getT(e-g,o,v,w,d,c,u,_,a,h,i),W_.cut(r,p,v,w,d,c,u,_,a,h),r;v=a,w=h,y+=7,r.push(l,d,c,u,_,a,h);break;case X_:y+=1,r.push(l);default:o=0}m++,g+=o}return r}};function q_(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!Ht(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}Tt.add("motion-path"),th.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=ja.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=ja.number(e,s.getMotionTotal())):e=0,th.number(t,e,i)})),th.register("motionRotation",(function(t,e,i){return th.number(t,e,i)}));const K_=t.UI.prototype,{updateMatrix:Z_,updateAllMatrix:Q_}=Pr,{updateBounds:$_}=Ir;function J_(t){const{motion:e,leaferIsCreated:i}=t;if(!Ht(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=ep(t);i.total&&(t.__.__pathForRender=V_.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Q_(t),$_(t,t)):Z_(t));i&&(t.leafer.created=!0)}}function tp(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function ep(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=V_.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,q_),t.UI.addAttr("motionPrecision",1,q_),t.UI.addAttr("motion",void 0,q_),t.UI.addAttr("motionRotation",!0,q_),K_.getMotionPathData=function(){return ep(tp(this))},K_.getMotionPoint=function(t){const e=tp(this),i=ep(e);if(!i.total)return{};const s=V_.getDistancePoint(i,t,e.motionPrecision);E.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:"number"==typeof n&&(s.rotation+=n),s},K_.getMotionTotal=function(){return this.getMotionPathData().total},K_.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],Ht(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),J_(t))}else J_(this)};const{Yes:ip,NoAndSkip:sp,YesAndSkip:np}=t.Answer,rp={},op={},ap={};class hp{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"#":rp.id=t.substring(1),t=rp;break;case".":op.className=t.substring(1),t=op;break;default:ap.tag=t,t=ap}case"object":if(void 0!==t.id){const s=this.getById(t.id,e);return i?s:s?[s]:[]}if(t.tag){const{tag:s}=t,n=s instanceof Array;return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?Wt.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className);case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Pr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),r===ip||r===np){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<sp&&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_(Zr.REMOVE,this.__onRemoveChild,this),this.target.on_(Qr.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 lp=t.UI.prototype;function dp(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}return lp.find=function(t,e){return dp(this).getBy(t,this,!1,e)},lp.findOne=function(t,e){return dp(this).getBy(t,this,!0,e)},Tt.add("find"),i.finder=function(t){return new hp(t)},t.AlignHelper=wt,t.AnimateEasing=r_,t.AnimateEvent=a_,t.AroundHelper=yt,t.AutoBounds=_t,t.BezierHelper=Ae,t.Bounds=ct,t.BoundsHelper=at,t.BoxData=hh,t.BranchHelper=Ir,t.BranchRender=Wo,t.CanvasData=xh,t.CanvasManager=Mt,t.ChildEvent=Zr,t.ColorConvert=Xa,t.Creator=i,t.Cursor=Il,t.DataHelper=Wt,t.Debug=Et,t.Dragger=Bl,t.Effect=Za,t.EllipseData=_h,t.EllipseHelper=ze,t.Event=Kr,t.EventCreator=It,t.Eventer=ro,t.Export=$a,t.FileHelper=fn,t.Filter=Qa,t.Finder=hp,t.FrameData=dh,t.GroupData=ah,t.HighBezierHelper=W_,t.HighCurveHelper=V_,t.HitCanvasManager=Fl,t.ImageData=wh,t.ImageEvent=$r,t.ImageManager=Bn,t.IncrementId=s,t.InteractionBase=Ol,t.InteractionHelper=ml,t.Keyboard=ul,t.LayoutEvent=eo,t.Layouter=Oa,t.LeafBounds=Io,t.LeafBoundsHelper=Dr,t.LeafData=Nt,t.LeafDataProxy=wo,t.LeafEventer=yo,t.LeafHelper=Pr,t.LeafLayout=qr,t.LeafLevelList=ma,t.LeafList=ya,t.LeafMatrix=Ro,t.LeafRender=Fo,t.LeaferCanvas=va,t.LeaferCanvasBase=se,t.LeaferData=lh,t.LeaferEvent=so,t.LeaferImage=Sn,t.LineData=ch,t.MathHelper=h,t.Matrix=Y,t.MatrixHelper=E,t.MyDragEvent=yl,t.MyImage=ol,t.MyPointerEvent=gl,t.NeedConvertToCanvasCommandMap=he,t.OneRadian=d,t.PI2=c,t.PI_2=u,t.Paint=Va,t.PaintGradient=Ka,t.PaintImage=qa,t.PathArrow=Ga,t.PathBounds=rn,t.PathCommandDataHelper=qi,t.PathCommandMap=oe,t.PathConvert=ki,t.PathCorner=un,t.PathCreator=cs,t.PathData=fh,t.PathDrawer=Ps,t.PathHelper=ne,t.PathNumberCommandLengthMap=ue,t.PathNumberCommandMap=ce,t.PenData=yh,t.Picker=Wa,t.Platform=e,t.Plugin=Tt,t.Point=N,t.PointHelper=I,t.PointerButton=_l,t.PolygonData=ph,t.PropertyEvent=Qr,t.RectData=uh,t.RectHelper=_e,t.RectRender=kh,t.RenderEvent=io,t.Renderer=Fa,t.ResizeEvent=Jr,t.Resource=bn,t.RobotData=mu,t.Run=Rt,t.Selector=Ua,t.StarData=gh,t.State=Ja,t.StringNumberMap=xt,t.TaskItem=vn,t.TaskProcessor=wn,t.TextConvert=Ha,t.TextData=vh,t.Transition=th,t.TwoPointBoundsHelper=X,t.UIBounds=bh,t.UICreator=At,t.UIData=rh,t.UIEvent=pl,t.UIRender=Eh,t.UnitConvert=ja,t.WaitHelper=Ur,t.WatchEvent=to,t.Watcher=Ea,t.affectRenderBoundsType=Vn,t.affectStrokeBoundsType=Xn,t.attr=An,t.autoLayoutType=Fn,t.boundsType=Un,t.canvasPatch=gn,t.canvasSizeAttrs=ie,t.cursorType=sr,t.dataProcessor=nr,t.dataType=On,t.decorateLeafAttr=Ln,t.defineDataProcessor=rr,t.defineKey=Cn,t.defineLeafAttr=Dn,t.doBoundsType=zn,t.doStrokeType=jn,t.effectType=Na,t.emptyData=Yt,t.eraserType=er,t.getBoundsData=p,t.getDescriptor=Tn,t.getMatrixData=g,t.getPointData=_,t.hitType=ir,t.isEmptyData=Xt,t.isNull=Ht,t.layoutProcessor=function(t){return(e,i)=>{Cn(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=tr,t.motionPathType=q_,t.naturalBoundsType=Nn,t.opacityType=Kn,t.pathInputType=Yn,t.pathType=Hn,t.pen=_n,t.positionType=In,t.registerUI=_r,t.registerUIEvent=pr,t.resizeType=za,t.rewrite=lr,t.rewriteAble=dr,t.rotationType=Wn,t.scaleType=Mn,t.sortType=Jn,t.stateStyleType=wu,t.stateType=vu,t.strokeType=Gn,t.surfaceType=qn,t.tempBounds=ut,t.tempMatrix=H,t.tempPoint=z,t.useCanvas=xa,t.useModule=ur,t.version="1.6.0",t.visibleType=Zn,t.zoomLayerType=Ya,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={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:n,pow:o,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?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,r=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||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 _(){return{x:0,y:0}}function p(){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:w}=h,x={};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,r=1,n=0,o=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=o},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){B.toInnerPoint(t,e,x),B.scaleOfInner(t,x,i,s)},scaleOfInner(t,e,i,s=i){B.translateInner(t,e.x,e.y),B.scale(t,i,s),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,o=y(e*=d),a=f(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,i){B.toInnerPoint(t,e,x),B.rotateOfInner(t,x,i)},rotateOfInner(t,e,i){B.translateInner(t,e.x,e.y),B.rotate(t,i),B.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:o}=t;i&&(i*=d,t.a=s+n*i,t.b=r+o*i),e&&(e*=d,t.c=n+s*e,t.d=o+r*e)},skewOfOuter(t,e,i,s){B.toInnerPoint(t,e,x),B.skewOfInner(t,x,i,s)},skewOfInner(t,e,i,s=0){B.translateInner(t,e.x,e.y),B.skew(t,i,s),B.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:o,f:a}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+o,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,r,n){let{e:o,f:a}=t;if(n&&(o+=n.scrollX,a+=n.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:o,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:o}=t;if(i||s){const a=1/(e*r-i*s);t.a=r*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*r-o*s)*a,t.f=-(o*e-n*i)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,r){const{x:n,y:o,scaleX:a,scaleY:h}=e;if(void 0===r&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:r}=e,n=i*d,o=y(n),l=f(n);if(s||r){const e=s*d,i=r*d;t.a=(o+i*-l)*a,t.b=(l+i*o)*a,t.c=(e*o-l)*h,t.d=(o+e*l)*h}else t.a=o*a,t.b=l*a,t.c=-l*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=n,t.f=o,(i=i||s)&&B.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let c,_,p,g,x,b=h,E=l;if(n||o){const t=r*a-n*o;if(o&&!s){c=v(r*r+n*n),_=t/c;const e=r/c;p=n>0?m(e):-m(e)}else{_=v(o*o+a*a),c=t/_;const e=o/_;p=u-(a>0?m(-e):-m(e))}const e=w(y(p)),i=f(p);c=w(c),_=w(_),g=e?w((o/_+i)/e/d,9):0,x=e?w((n/c-i)/e/d,9):0,p=w(p/d)}else c=r,_=a,p=g=x=0;return(e=i||e)&&(b+=e.x*r+e.y*o,E+=e.x*n+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:c,scaleY:_,rotation:p,skewX:g,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:o}=t;r||n?i=(s*o-r*n)/(e=v(s*s+r*r)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){B.set(t)}},B=E,{toInnerPoint:k,toOuterPoint:P}=E,{sin:S,cos:R,abs:C,sqrt:T,atan2:L,min:A,round:D,PI:O}=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?D(t.x-.5)+.5:D(t.x),t.y=e?D(t.y-.5)+.5:D(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=F.defaultPoint);const s=R(e*=d),r=S(e),n=t.x-i.x,o=t.y-i.y;t.x=i.x+n*s-o*r,t.y=i.y+n*r+o*s},tempToInnerOf(t,e){const{tempPoint:i}=F;return W(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=F;return W(i,t),P(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=F;return W(i,t),F.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){P(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=C(i-t),n=C(s-e);return T(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>A(M(t,e,i,s),M(i,s,r,n)),getAngle:(t,e)=>U(t,e)/d,getRotation:(t,e,i,s)=>(s||(s=e),F.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/d),getRadianFrom(t,e,i,s,r,n,o,a){void 0===o&&(o=i,a=s);let h=L(e-s,t-i);const l=L(n-a,r-o)-h;return l<-O?l+c:l},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const r=U(t,e);return(e=s?e:{}).x=t.x+R(r)*i,e.y=t.y+S(r)*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){F.reset(t)}},F=I,{getDistanceFrom:M,copy:W,getAtan2:U}=F;class N{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 N(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 N(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,i){return new N(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 z=new N;class Y{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return"object"==typeof t?E.copy(this,t):E.set(this,t,e,i,s,r,n),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:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new Y(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 H=new Y,j={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,r){X(t,e,i),X(t,e+s,i+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:X}=j,{tempPointBounds:G,setPoint:V,addPoint:q,toBounds:K}=j,{toOuterPoint:Z}=E,{float:Q,fourNumber:$}=h,{floor:J,ceil:tt}=Math;let et,it,st,rt;const nt={},ot={},at={tempBounds:{},set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:o,width:a,height:h}=e;if(i instanceof Array){const e=$(i);s?ht.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):ht.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),ht.set(t,n-i,o-i,a+2*i,h+2*i);r&&("width"===r?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,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:r}=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),r>0?(i.height=t.height*r,i.y=e.f+t.y*r):(i.height=t.height*-r,i.y=e.f+t.y*r-i.height)}else nt.x=t.x,nt.y=t.y,Z(e,nt,ot),V(G,ot.x,ot.y),nt.x=t.x+t.width,Z(e,nt,ot),q(G,ot.x,ot.y),nt.y=t.y+t.height,Z(e,nt,ot),q(G,ot.x,ot.y),nt.x=t.x,Z(e,nt,ot),q(G,ot.x,ot.y),K(G,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 Y(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=J(t.x),t.y=J(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=Q(t.x,e),t.y=Q(t.y,e),t.width=Q(t.width,e),t.height=Q(t.height,e)},add(t,e,i){et=t.x+t.width,it=t.y+t.height,st=e.x,rt=e.y,i||(st+=e.width,rt+=e.height),et=et>st?et:st,it=it>rt?it:rt,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 r,n=!0;for(let o=0,a=e.length;o<a;o++)r=i?i(e[o]):e[o],r&&(r.width||r.height)&&(n?(n=!1,s||dt(t,r)):lt(t,r));n&&ht.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?V(G,t.x,t.y):q(G,t.x,t.y))),K(G,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:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},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:r,width:n,height:o}=e;return et=s+n,it=r+o,st=t.x+t.width,rt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,et=et<st?et:st,it=it<rt?it:rt,n=et-s,o=it-r,{x:s,y:r,width:n,height:o}},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 _t{constructor(t,e,i,s,r,n){"object"==typeof t?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=t;this.set(e,i,s,r,n,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:o}=this;return new ct(r,e,n||t.width-r-i,o||t.height-e-s)}}var pt,gt;t.Direction4=void 0,(pt=t.Direction4||(t.Direction4={}))[pt.top=0]="top",pt[pt.right=1]="right",pt[pt.bottom=2]="bottom",pt[pt.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,r){const n=mt(t);i.x=n.x,i.y=n.y,"percent"===n.type&&(i.x*=e.width,i.y*=e.height,r&&(i.x-=r.x,i.y-=r.y,n.x&&(i.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(i.y-=1===n.y?r.height:.5===n.y?n.y*r.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,wt={toPoint(t,e,i,s,r){vt(t,i,s,r,e)}},xt={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=Bt(t)}static set exclude(t){this.excludeList=Bt(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,r=t.__nowWorld,n=bt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(kt.enable){if(kt.filterList.length&&kt.filterList.every((t=>t!==this.name)))return;if(kt.excludeList.length&&kt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){kt.enable&&this.warn(...t)}warn(...t){kt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}Et.filterList=[],Et.excludeList=[],Et.showWarn=!0;const kt=Et,Pt=Et.get("RunTime"),St={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Rt.currentId=Rt.idMap[i]=e?performance.now():Date.now(),Rt.currentName=Rt.nameMap[i]=t,Rt.nameToIdMap[t]=i,i},end(t,e){const i=Rt.idMap[t],s=Rt.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;Rt.idMap[t]=Rt.nameMap[t]=Rt.nameToIdMap[s]=void 0,Pt.log(s,r,"ms")},endOfName(t,e){const i=Rt.nameToIdMap[t];void 0!==i&&Rt.end(i,e)}},Rt=St,Ct=[],Tt={list:{},add(t,...e){this.list[t]=!0,Ct.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Ct.forEach((t=>Tt.has(t,!0)))));const Lt=Et.get("UICreator"),At={list:{},register(t){const{__tag:e}=t.prototype;Dt[e]&&Lt.repeat(e),Dt[e]=t},get(t,e,i,s,r,n){Dt[t]||Lt.error("not register "+t);const o=new Dt[t](e);return void 0!==i&&(o.x=i,s&&(o.y=s),r&&(o.width=r),n&&(o.height=n)),o}},{list:Dt}=At,Ot=Et.get("EventCreator"),It={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Ft[e]&&Ot.repeat(e),Ft[e]=t)}))},changeName(t,e){const i=Ft[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Ft[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Ft[t](...e)},{nameList:Ft}=It;class Mt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const r=i.canvas(t);return this.add(r),r}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}const Wt={default:(t,e)=>(Ut(e,t),Ut(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((r=>{var n,o;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return Ut(t[r],e[r],i&&i[r]);i&&r in i?(null===(o=i[r])||void 0===o?void 0:o.constructor)===Object&&Ut(t[r]={},e[r],i[r]):t[r]=e[r]}))},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:Ut}=Wt;class Nt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(t instanceof Array)for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],void 0!==t)){if("path"===r&&!this.__pathInputed)continue;e=s?s[r]:void 0,i[r]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}var zt;t.Answer=void 0,(zt=t.Answer||(t.Answer={}))[zt.No=0]="No",zt[zt.Yes=1]="Yes",zt[zt.NoAndSkip=2]="NoAndSkip",zt[zt.YesAndSkip=3]="YesAndSkip";const Yt={};function Ht(t){return null==t}function jt(t){return"{}"===JSON.stringify(t)}function Xt(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}function Gt(t,e,i,s){return new(i||(i=Promise))((function(r,n){function o(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?r(t.value):function(t){return t instanceof i?t:new i((function(e){e(t)}))}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())}))}function Vt(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 qt=[];function Kt(){return(t,e)=>{qt.push(e)}}const Zt=[];class Qt{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||Zt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/r*h;r+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}Xt([Vt("imageSmoothingEnabled")],Qt.prototype,"smooth",void 0),Xt([Vt("imageSmoothingQuality")],Qt.prototype,"smoothLevel",void 0),Xt([Vt("globalAlpha")],Qt.prototype,"opacity",void 0),Xt([Vt()],Qt.prototype,"fillStyle",void 0),Xt([Vt()],Qt.prototype,"strokeStyle",void 0),Xt([Vt("lineWidth")],Qt.prototype,"strokeWidth",void 0),Xt([Vt("lineCap")],Qt.prototype,"strokeCap",void 0),Xt([Vt("lineJoin")],Qt.prototype,"strokeJoin",void 0),Xt([Vt("lineDashOffset")],Qt.prototype,"dashOffset",void 0),Xt([Vt()],Qt.prototype,"miterLimit",void 0),Xt([Vt()],Qt.prototype,"shadowBlur",void 0),Xt([Vt()],Qt.prototype,"shadowColor",void 0),Xt([Vt()],Qt.prototype,"shadowOffsetX",void 0),Xt([Vt()],Qt.prototype,"shadowOffsetY",void 0),Xt([Vt()],Qt.prototype,"filter",void 0),Xt([Vt()],Qt.prototype,"font",void 0),Xt([Vt()],Qt.prototype,"fontKerning",void 0),Xt([Vt()],Qt.prototype,"fontStretch",void 0),Xt([Vt()],Qt.prototype,"fontVariantCaps",void 0),Xt([Vt()],Qt.prototype,"textAlign",void 0),Xt([Vt()],Qt.prototype,"textBaseline",void 0),Xt([Vt()],Qt.prototype,"textRendering",void 0),Xt([Vt()],Qt.prototype,"wordSpacing",void 0),Xt([Vt()],Qt.prototype,"letterSpacing",void 0),Xt([Vt()],Qt.prototype,"direction",void 0),Xt([Kt()],Qt.prototype,"setTransform",null),Xt([Kt()],Qt.prototype,"resetTransform",null),Xt([Kt()],Qt.prototype,"getTransform",null),Xt([Kt()],Qt.prototype,"save",null),Xt([Kt()],Qt.prototype,"restore",null),Xt([Kt()],Qt.prototype,"translate",null),Xt([Kt()],Qt.prototype,"scale",null),Xt([Kt()],Qt.prototype,"rotate",null),Xt([Kt()],Qt.prototype,"fill",null),Xt([Kt()],Qt.prototype,"stroke",null),Xt([Kt()],Qt.prototype,"clip",null),Xt([Kt()],Qt.prototype,"fillRect",null),Xt([Kt()],Qt.prototype,"strokeRect",null),Xt([Kt()],Qt.prototype,"clearRect",null),Xt([Kt()],Qt.prototype,"beginPath",null),Xt([Kt()],Qt.prototype,"moveTo",null),Xt([Kt()],Qt.prototype,"lineTo",null),Xt([Kt()],Qt.prototype,"bezierCurveTo",null),Xt([Kt()],Qt.prototype,"quadraticCurveTo",null),Xt([Kt()],Qt.prototype,"closePath",null),Xt([Kt()],Qt.prototype,"arc",null),Xt([Kt()],Qt.prototype,"arcTo",null),Xt([Kt()],Qt.prototype,"ellipse",null),Xt([Kt()],Qt.prototype,"rect",null),Xt([Kt()],Qt.prototype,"roundRect",null),Xt([Kt()],Qt.prototype,"createConicGradient",null),Xt([Kt()],Qt.prototype,"createLinearGradient",null),Xt([Kt()],Qt.prototype,"createPattern",null),Xt([Kt()],Qt.prototype,"createRadialGradient",null),Xt([Kt()],Qt.prototype,"fillText",null),Xt([Kt()],Qt.prototype,"measureText",null),Xt([Kt()],Qt.prototype,"strokeText",null);const{copy:$t,multiplyParent:Jt}=E,{round:te}=Math,ee={width:1,height:1,pixelRatio:1},ie=["width","height","pixelRatio"];class se extends Qt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,i){super(),this.size={},this.worldTransform={},t||(t=ee),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:n,pixelRatio:o}=t;this.autoLayout=!r||!n,this.size.pixelRatio=o|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;Wt.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,r=this.worldTransform;e&&Jt(t,e,r),r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i,s&&(t.half&&t.half*i%2?(r.e=te(r.e-.5)+.5,r.f=te(r.f-.5)+.5):(r.e=te(r.e),r.f=te(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,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:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,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,r){this.resetTransform(),this.copyWorld(t,e,i,s),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(ut.x,ut.y,ut.width,ut.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,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:r}=this,n=this.manager?this.manager.get(s):i.canvas(Object.assign({},s));return n.save(),t&&($t(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==r&&(n.pixelSnap=r),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 re={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ne={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},oe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},ne),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),ne),de=oe,ce={};for(let t in de)ce[de[t]]=t;const ue={};for(let t in de)ue[de[t]]=ae[t];const _e={drawRoundRect(t,e,i,s,r,n){const o=h.fourNumber(n,Math.min(s/2,r/2)),a=e+s,l=i+r;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,l,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,l,e,l,o[2]):t.lineTo(a,l),o[3]?t.arcTo(e,l,e,i,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:pe,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:we,pow:xe}=Math,{setPoint:be,addPoint:Ee}=j,{set:Be,toNumberPoints:ke}=I,{M:Pe,L:Se,C:Re,Q:Ce,Z:Te}=oe,Le={},Ae={points(t,e,i,s){let r=ke(e);if(t.push(Pe,r[0],r[1]),i&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],o=r[i],a=r[i+1],h=r[i+2],l=r[i+3],p=we(xe(o-e,2)+xe(a-n,2)),g=we(xe(h-o,2)+xe(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=o-p*h,c=a-p*l,2===i?s||t.push(Ce,d,c,o,a):t.push(Re,u,_,d,c,o,a),u=o+g*h,_=a+g*l;s||t.push(Ce,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(Se,r[e],r[e+1]);s&&t.push(Te)},rect(t,e,i,s,r){re.creator.path=t,re.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){re.creator.path=[],_e.drawRoundRect(re.creator,e,i,s,r,n),t.push(...re.convertToCanvasData(re.creator.path,!0))},arcTo(t,e,i,s,r,n,o,a,h,l,_){const p=s-e,g=r-i,f=n-s,y=o-r;let m=fe(g,p),v=fe(y,f),w=v-m;if(w<0&&(w+=c),w===ve||me(p+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Se,s,r),h&&(be(h,e,i),Ee(h,s,r)),_&&Be(_,e,i),void(l&&Be(l,s,r));const x=p*y-f*g<0,b=x?-1:1,E=a/ge(w/2),B=s+E*ge(m+w/2+u*b),k=r+E*pe(m+w/2+u*b);return m-=u*b,v-=u*b,Ie(t,B,k,a,a,0,m/d,v/d,x,h,l,_)},arc:(t,e,i,s,r,n,o,a,h,l)=>Ie(t,e,i,s,s,0,r,n,o,a,h,l),ellipse(t,e,i,s,r,n,o,a,h,l,_,p){const g=n*d,f=pe(g),y=ge(g);let m=o*d,v=a*d;m>ve&&(m-=c),v<0&&(v+=c);let w=v-m;w<0?w+=c:w>c&&(w-=c),h&&(w-=c);const x=ye(me(w/u)),b=w/x,E=pe(b/4),B=8/3*E*E/pe(b/2);v=m+b;let k,P,S,R,C,T,L,A,D=ge(m),O=pe(m),I=S=y*s*D-f*r*O,F=R=f*s*D+y*r*O,M=e+S,W=i+R;t&&t.push(t.length?Se:Pe,M,W),l&&be(l,M,W),p&&Be(p,M,W);for(let n=0;n<x;n++)k=ge(v),P=pe(v),S=y*s*k-f*r*P,R=f*s*k+y*r*P,C=e+I-B*(y*s*O+f*r*D),T=i+F-B*(f*s*O-y*r*D),L=e+S+B*(y*s*P+f*r*k),A=i+R+B*(f*s*P-y*r*k),t&&t.push(Re,C,T,L,A,e+S,i+R),l&&Oe(e+I,i+F,C,T,L,A,e+S,i+R,l,!0),I=S,F=R,D=k,O=P,m=v,v+=b;_&&Be(_,e+S,i+R)},quadraticCurveTo(t,e,i,s,r,n,o){t.push(Re,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,o,a){Oe(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,o,a)},toTwoPointBounds(t,e,i,s,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ee(h,t,e):be(h,t,e),Ee(h,o,a);for(let l=0,c=d.length;l<c;l++)De(d[l],t,e,i,s,r,n,o,a,Le),Ee(h,Le.x,Le.y)},getPointAndSet(t,e,i,s,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*r+_*o+p*h},getPoint(t,e,i,s,r,n,o,a,h){const l={};return De(t,e,i,s,r,n,o,a,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:De,toTwoPointBounds:Oe,ellipse:Ie}=Ae,{sin:Fe,cos:Me,sqrt:We,atan2:Ue}=Math,{ellipse:Ne}=Ae,ze={ellipticalArc(t,i,s,r,n,o,a,h,l,u,_){const p=(l-i)/2,g=(u-s)/2,f=o*d,y=Fe(f),m=Me(f),v=-m*p-y*g,w=-m*g+y*p,x=r*r,b=n*n,E=w*w,B=v*v,k=x*b-x*E-b*B;let P=0;if(k<0){const t=We(1-k/(x*b));r*=t,n*=t}else P=(a===h?-1:1)*We(k/(x*E+b*B));const S=P*r*w/n,R=-P*n*v/r,C=Ue((w-R)/n,(v-S)/r),T=Ue((-w-R)/n,(-v-S)/r);let L=T-C;0===h&&L>0?L-=c:1===h&&L<0&&(L+=c);const A=i+p+m*S-y*R,D=s+g+y*S+m*R,O=L<0?1:0;_||e.ellipseToCurve?Ne(t,A,D,r,n,o,C/d,T/d,O):r!==n||o?t.push(oe.G,A,D,r,n,o,C/d,T/d,O):t.push(oe.O,A,D,r,C/d,T/d,O)}},{M:Ye,m:He,L:je,l:Xe,H:Ge,h:Ve,V:qe,v:Ke,C:Ze,c:Qe,S:$e,s:Je,Q:ti,q:ei,T:ii,t:si,A:ri,a:ni,Z:oi,z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:_i,P:pi,U:gi}=oe,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:wi,quadraticCurveTo:xi}=Ae,{ellipticalArc:bi}=ze,Ei=Et.get("PathConvert"),Bi={},ki={current:{dot:0},stringify(t,e){let i,s,r,n=0,o=t.length,a="";for(;n<o;){s=t[n],i=ue[s],a+=s===r?" ":ce[s];for(let s=1;s<i;s++)a+=h.float(t[n+s],e),s===i-1||(a+=" ");r=s,n+=i}return a},parse(t,e){let i,s,r,n="";const o=[],a=e?le:he;for(let e=0,h=t.length;e<h;e++)s=t[e],xt[s]?("."===s&&(Pi.dot&&(Si(o,n),n=""),Pi.dot++),"0"===n&&"."!==s&&(Si(o,n),n=""),n+=s):oe[s]?(n&&(Si(o,n),n=""),Pi.name=oe[s],Pi.length=ae[s],Pi.index=0,Si(o,Pi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&Si(o,n),n=s):n&&(Si(o,n),n=""),r=s;return n&&Si(o,n),i?ki.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case He:t[c+1]+=a,t[c+2]+=h;case Ye:a=t[c+1],h=t[c+2],_.push(Ye,a,h),c+=3;break;case Ve:t[c+1]+=a;case Ge:a=t[c+1],_.push(je,a,h),c+=2;break;case Ke:t[c+1]+=h;case qe:h=t[c+1],_.push(je,a,h),c+=2;break;case Xe:t[c+1]+=a,t[c+2]+=h;case je:a=t[c+1],h=t[c+2],_.push(je,a,h),c+=3;break;case Je:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=$e;case $e:o=n===Ze||n===$e,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(Ze,l,d,i,s,a,h),c+=5;break;case Qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=Ze;case Ze:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ze,t[c+1],t[c+2],i,s,a,h),c+=7;break;case si:t[c+1]+=a,t[c+2]+=h,r=ii;case ii:o=n===ti||n===ii,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?xi(_,a,h,i,s,t[c+1],t[c+2]):_.push(ti,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ei:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ti;case ti:i=t[c+1],s=t[c+2],e?xi(_,a,h,i,s,t[c+3],t[c+4]):_.push(ti,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ni:t[c+6]+=a,t[c+7]+=h;case ri:bi(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case ai:case oi:_.push(oi),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4]):Ri(_,t,c,5),c+=5;break;case li:a=t[c+1],h=t[c+2],e?yi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ri(_,t,c,9),c+=9;break;case di:a=t[c+1],h=t[c+2],e?yi(_,a,h,t[c+3],t[c+4],t[c+5]):Ri(_,t,c,6),c+=6;break;case ci:wi(e?_:Ri(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Bi),a=Bi.x,h=Bi.y,c+=9;break;case ui:e?wi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ri(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case _i:vi(e?_:Ri(_,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 pi:e?vi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ri(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?_:Ri(_,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 Ei.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ye,t.x,t.y);break;case"L":e.push(je,t.x,t.y);break;case"C":e.push(Ze,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(oi)}})),e},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){Pi.index===Pi.length&&(Pi.index=1,t.push(Pi.name)),t.push(Number(e)),Pi.index++,Pi.dot=0}},{current:Pi,pushData:Si,copyData:Ri}=ki,{M:Ci,L:Ti,C:Li,Q:Ai,Z:Di,N:Oi,D:Ii,X:Fi,G:Mi,F:Wi,O:Ui,P:Ni,U:zi}=oe,{getMinDistanceFrom:Yi,getRadianFrom:Hi}=I,{tan:ji,min:Xi,abs:Gi}=Math,Vi={},qi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ci,e,i)},lineTo(t,e,i){t.push(Ti,e,i)},bezierCurveTo(t,e,i,s,r,n,o){t.push(Li,e,i,s,r,n,o)},quadraticCurveTo(t,e,i,s,r){t.push(Ai,e,i,s,r)},closePath(t){t.push(Di)},rect(t,e,i,s,r){t.push(Oi,e,i,s,r)},roundRect(t,e,i,s,r,n){if("number"==typeof n)t.push(Fi,e,i,s,r,n);else{const o=h.fourNumber(n);o?t.push(Ii,e,i,s,r,...o):t.push(Oi,e,i,s,r)}},ellipse(t,e,i,s,r,n,o,a,h){void 0===n?t.push(Wi,e,i,s,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Mi,e,i,s,r,n,o,a,h?1:0))},arc(t,e,i,s,r,n,o){void 0===r?t.push(Ni,e,i,s):(void 0===n&&(n=360),t.push(Ui,e,i,s,r,n,o?1:0))},arcTo(t,e,i,s,r,n,o,a){if(void 0!==o){const t=Yi(o,a,e,i,s,r);n=Xi(n,Xi(t/2,t/2*Gi(ji(Hi(o,a,e,i,s,r)/2))))}t.push(zi,e,i,s,r,n)},drawEllipse(t,e,i,s,r,n,o,a,h){Ae.ellipse(null,e,i,s,r,void 0===n?0:n,void 0===o?0:o,void 0===a?360:a,h,null,null,Vi),t.push(Ci,Vi.x,Vi.y),Ki(t,e,i,s,r,n,o,a,h)},drawArc(t,e,i,s,r,n,o){Ae.arc(null,e,i,s,void 0===r?0:r,void 0===n?360:n,o,null,null,Vi),t.push(Ci,Vi.x,Vi.y),Zi(t,e,i,s,r,n,o)},drawPoints(t,e,i,s){Ae.points(t,e,i,s)}},{ellipse:Ki,arc:Zi}=qi,{moveTo:Qi,lineTo:$i,quadraticCurveTo:Ji,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:rs,ellipse:ns,arc:os,arcTo:as,drawEllipse:hs,drawArc:ls,drawPoints:ds}=qi;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?re.parse(t):t:[],this}beginPath(){return is(this.__path),this.paint(),this}moveTo(t,e){return Qi(this.__path,t,e),this.paint(),this}lineTo(t,e){return $i(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return ts(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ji(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,r){return rs(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,o,a){return ns(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}arc(t,e,i,s,r,n){return os(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return as(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,o,a){return hs(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}drawArc(t,e,i,s,r,n){return ls(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return ds(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:us,L:_s,C:ps,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:ws,F:xs,O:bs,P:Es,U:Bs}=oe,ks=Et.get("PathDrawer"),Ps={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case _s:t.lineTo(e[s+1],e[s+2]),s+=3;break;case ps:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case fs:t.closePath(),s+=1;break;case ys:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ms:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*d,e[s+6]*d,e[s+7]*d,e[s+8]),s+=9;break;case xs: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 Bs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void ks.error(`command: ${i} [index:${s}]`,e)}}},{M:Ss,L:Rs,C:Cs,Q:Ts,Z:Ls,N:As,D:Ds,X:Os,G:Is,F:Fs,O:Ms,P:Ws,U:Us}=oe,{toTwoPointBounds:Ns,toTwoPointBoundsByQuadraticCurve:zs,arcTo:Ys,arc:Hs,ellipse:js}=Ae,{addPointBounds:Xs,copy:Gs,addPoint:Vs,setPoint:qs,addBounds:Ks,toBounds:Zs}=j,Qs=Et.get("PathBounds");let $s,Js,tr;const er={},ir={},sr={},rr={toBounds(t,e){rr.toTwoPointBounds(t,ir),Zs(ir,e)},toTwoPointBounds(t,e){if(!t||!t.length)return qs(e,0,0);let i,s,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Ls||o===Cs||o===Ts?qs(e,h,l):qs(e,t[a+1],t[a+2])),o){case Ss:case Rs:h=t[a+1],l=t[a+2],Vs(e,h,l),a+=3;break;case Cs:r=t[a+5],n=t[a+6],Ns(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,er),Xs(e,er),h=r,l=n,a+=7;break;case Ts:i=t[a+1],s=t[a+2],r=t[a+3],n=t[a+4],zs(h,l,i,s,r,n,er),Xs(e,er),h=r,l=n,a+=5;break;case Ls:a+=1;break;case As:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ds:case Os:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=o===Ds?9:6;break;case Is:js(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],er,sr),0===a?Gs(e,er):Xs(e,er),h=sr.x,l=sr.y,a+=9;break;case Fs:h=t[a+1],l=t[a+2],Js=t[a+3],tr=t[a+4],Ks(e,h-Js,l-tr,2*Js,2*tr),h+=Js,a+=5;break;case Ms:Hs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],er,sr),0===a?Gs(e,er):Xs(e,er),h=sr.x,l=sr.y,a+=7;break;case Ws: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 Us:Ys(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],er,sr),0===a?Gs(e,er):Xs(e,er),h=sr.x,l=sr.y,a+=6;break;default:return void Qs.error(`command: ${o} [index:${a}]`,t)}}},{M:nr,L:or,Z:ar}=oe,{getCenterX:hr,getCenterY:lr}=I,{arcTo:dr}=qi,cr={smooth(t,e,i){let s,r,n=0,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0;const p=t.length,g=[];for(;n<p;)switch(s=t[n],s){case nr:h=u=t[n+1],l=_=t[n+2],n+=3,t[n]===or?(d=t[n+1],c=t[n+2],g.push(nr,hr(h,d),lr(l,c))):g.push(nr,h,l);break;case or:switch(o=t[n+1],a=t[n+2],n+=3,t[n]){case or:dr(g,o,a,t[n+1],t[n+2],e,u,_);break;case ar:dr(g,o,a,h,l,e,u,_);break;default:g.push(or,o,a)}u=o,_=a;break;case ar:dr(g,h,l,d,c,e,u,_),g.push(ar),n+=1;break;default:r=ue[s];for(let e=0;e<r;e++)g.push(t[n+e]);n+=r}return s!==ar&&(g[1]=h,g[2]=l),g}};re.creator=new cs,re.parse=ki.parse,re.convertToCanvasData=ki.toCanvasData;const ur=new cs,{drawRoundRect:_r}=_e;function pr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){_r(this,t,e,i,s,r)})}(t)}const gr={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=fr.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{}}}},fr=gr;fr.opacityTypes.forEach((t=>fr.upperCaseTypeMap[t]=t.toUpperCase()));const yr=Et.get("TaskProcessor");class mr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.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){yr.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class vr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Wt.assign(this.config,t),this.empty()}add(t,e){let i,s,r,n;const o=new mr(t);return o.parent=this,"number"==typeof e?n=e:e&&(s=e.parallel,i=e.start,r=e.time,n=e.delay),r&&(o.time=r),!1===s&&(o.parallel=!1),void 0===n?this.push(o,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,i))}),n)),this.isComplete=!1,o}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 wr=Et.get("Resource"),xr={tasker:new vr,map:{},get isComplete(){return br.tasker.isComplete},set(t,e){br.map[t]&&wr.repeat(t),br.map[t]=e},get:t=>br.map[t],remove(t){const e=br.map[t];e&&(e.destroy&&e.destroy(),delete br.map[t])},loadImage(t,e){return new Promise(((i,s)=>{const r=this.setImage(t,t,e);r.load((()=>i(r)),(t=>s(t)))}))},setImage(t,e,s){let r;return"string"==typeof e?r={url:e}:e.url||(r={url:t,view:e}),r&&(s&&(r.format=s),e=i.image(r)),br.set(t,e),e},destroy(){br.map={}}},br=xr,Er={maxRecycled:10,recycledList:[],patternTasker:new vr,get(t){let e=xr.get(t.url);return e||xr.set(t.url,e=i.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Br.recycledList.push(t)}))},clearRecycled(){const t=Br.recycledList;t.length>Br.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&xr.remove(t.url))),t.length=0)},hasOpacityPixel:t=>gr.opacityTypes.some((e=>Br.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+gr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+gr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Br.recycledList=[]}},Br=Er,{IMAGE:kr,create:Pr}=s;class Sr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Pr(kr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Er.isFormat("svg",t)&&(this.isSVG=!0),Er.hasOpacityPixel(t)&&(this.hasOpacityPixel=!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),xr.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,r){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 n=e.origin.createCanvas(t,i),o=n.getContext("2d");return s&&(o.globalAlpha=s),o.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(t,i,s,r){const n=e.canvas.createPattern(t,i);try{s&&n.setTransform&&(n.setTransform(s),s=null)}catch(t){}return r&&(r.transform=s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Rr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Cr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Tr(t,e){return(i,s)=>Ar(i,s,t,e&&e(s))}function Lr(t){return t}function Ar(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Rr(t,e,Object.assign(r,s||{})),nn(t,e,i)}function Dr(t){return Tr(t)}function Or(t,e){return Tr(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Ir(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Nr(this))}})))}function Fr(t,e){return Tr(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Mr(t,e){return Tr(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Wr(t,e){return Tr(t,(t=>({set(i){this.__setAttr(t,i,e)&&Nr(this)}})))}function Ur(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&(Nr(this),this.__.__removeNaturalSize())}})))}function Nr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function zr(t){return Tr(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Nr(this)}})))}const Yr=Wr;function Hr(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&jr(this)}})))}function jr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Nr(t)}const Xr=Hr;function Gr(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Vr(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function qr(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Zr(this)}})))}function Kr(t){return Tr(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Qr(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Qr(this,t,e,i),this.mask&&Zr(this)}})))}function Zr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Qr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Nr(t))}function $r(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function Jr(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function tn(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function en(t){return Tr(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 sn(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function rn(t){return(e,i)=>{Rr(e,"__DataProcessor",{get:()=>t})}}function nn(t,e,i){const s=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[r];return void 0===t?i:t},set(t){this[r]=t}};if(void 0===i)o.get=function(){return this[r]};else if("function"==typeof i)o.get=function(){let t=this[r];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=jt(i);o.get=function(){let e=this[r];return void 0===e?this[r]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[r];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&&(o.get=function(){const t=this[r];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=Cr(l,e),l=l.__proto__;h&&h.set&&(o.set=h.set),s[n]&&(o.set=s[n],delete s[n]),Rr(s,e,o)}const on=new Et("rewrite"),an=[],hn=["destroy","constructor"];function ln(t){return(e,i)=>{an.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function dn(){return t=>{cn()}}function cn(t){an.length&&(an.forEach((e=>{t&&on.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),an.length=0)}function un(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(hn.includes(s)||e&&e.includes(s)))if(t.prototype){Cr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function _n(){return t=>{At.register(t)}}function pn(){return t=>{It.register(t)}}setTimeout((()=>cn(!0)));const{copy:gn,toInnerPoint:fn,toOuterPoint:yn,scaleOfOuter:mn,rotateOfOuter:vn,skewOfOuter:wn,multiplyParent:xn,divideParent:bn,getLayout:En}=E,Bn={},{round:kn}=Math,Pn={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Cn(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)Rn(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++)Tn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Tn(t),t.__updateChange()},updateAllChange(t){if(An(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Ln(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,r){const n="object"==typeof e?Object.assign({},e):{x:e,y:i};s?yn(t.localTransform,n,n,!0):t.parent&&fn(t.parent.worldTransform,n,n,!0),Sn.moveLocal(t,n.x,n.y,r)},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=kn(e),i=kn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){Sn.zoomOfLocal(t,Dn(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const o=t.__localMatrix;if("number"!=typeof s&&(s&&(n=s),s=i),gn(Bn,o),mn(Bn,e,i,s),t.origin||t.around)Sn.setTransform(t,Bn,r,n);else{const e=t.x+Bn.e-o.e,a=t.y+Bn.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){Sn.rotateOfLocal(t,Dn(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;gn(Bn,r),vn(Bn,e,i),t.origin||t.around?Sn.setTransform(t,Bn,!1,s):t.set({x:t.x+Bn.e-r.e,y:t.y+Bn.f-r.f,rotation:h.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){Sn.skewOfLocal(t,Dn(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){gn(Bn,t.__localMatrix),wn(Bn,e,i,s),Sn.setTransform(t,Bn,r,n)},transformWorld(t,e,i,s){gn(Bn,t.worldTransform),xn(Bn,e),t.parent&&bn(Bn,t.parent.worldTransform),Sn.setTransform(t,Bn,i,s)},transform(t,e,i,s){gn(Bn,t.localTransform),xn(Bn,e),Sn.setTransform(t,Bn,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&Sn.getInnerOrigin(t,r.origin),o=En(e,n,r.around&&Sn.getInnerOrigin(t,r.around));if(i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){at.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Sn.getInnerOrigin(t,r.origin);I.move(o,n.x-s.x,n.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return mn(i,Sn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>I.tempToOuterOf(Sn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(gn(Bn,t.worldTransform),bn(Bn,e.worldTransform),i?Bn:Object.assign({},Bn)),drop(t,e,i,s){t.setTransform(Sn.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}}},Sn=Pn,{updateAllMatrix:Rn,updateMatrix:Cn,updateAllWorldOpacity:Tn,updateAllChange:Ln,updateChange:An}=Sn;function Dn(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const On={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:In}=Pn,Fn={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,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Mn(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++)Wn(e[t],e)},updateBounds(t,e){const i=[t];Wn(t,i),Un(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)In(s[t]);e&&e===i||In(i)}}},{pushAllChildBranch:Mn,pushAllBranchStack:Wn,updateBoundsByBranchStack:Un}=Fn,Nn={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:zn}=Pn,{toOuterOf:Yn,getPoints:Hn,copy:jn}=at,Xn="_localContentBounds",Gn="_worldContentBounds",Vn="_worldBoxBounds",qn="_worldStrokeBounds";class Kn{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 Yn(this.contentBounds,this.leaf.__localMatrix,this[Xn]||(this[Xn]={})),this[Xn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Yn(this.contentBounds,this.leaf.__world,this[Gn]||(this[Gn]={})),this[Gn]}get worldBoxBounds(){return Yn(this.boxBounds,this.leaf.__world,this[Vn]||(this[Vn]={})),this[Vn]}get worldStrokeBounds(){return Yn(this.strokeBounds,this.leaf.__world,this[qn]||(this[qn]={})),this[qn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{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 zn(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 r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(a);break;case"inner":r=a,n=E.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(a,e),n=zn(s,e,!0)}if(o||(o=E.getLayout(n)),jn(o,a),I.copy(o,r),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Hn(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return void 0!==r&&s.forEach((t=>i.innerToWorld(t,null,!1,r))),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 Zn{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 Qn extends Zn{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Qn.ADD="child.add",Qn.REMOVE="child.remove",Qn.CREATED="created",Qn.MOUNTED="mounted",Qn.UNMOUNTED="unmounted",Qn.DESTROY="destroy";class $n extends Zn{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}$n.CHANGE="property.change",$n.LEAFER_CHANGE="property.leafer_change";class Jn extends Zn{constructor(t,e){super(t),Object.assign(this,e)}}Jn.LOAD="image.load",Jn.LOADED="image.loaded",Jn.ERROR="image.error";class to extends Zn{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(to.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}to.RESIZE="resize";class eo extends Zn{constructor(t,e){super(t),this.data=e}}eo.REQUEST="watch.request",eo.DATA="watch.data";class io extends Zn{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}io.REQUEST="layout.request",io.START="layout.start",io.BEFORE="layout.before",io.LAYOUT="layout",io.AFTER="layout.after",io.AGAIN="layout.again",io.END="layout.end";class so extends Zn{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}so.REQUEST="render.request",so.CHILD_START="render.child_start",so.CHILD_END="render.child_end",so.START="render.start",so.BEFORE="render.before",so.RENDER="render",so.AFTER="render.after",so.AGAIN="render.again",so.END="render.end",so.NEXT="render.next";class ro extends Zn{}ro.START="leafer.start",ro.BEFORE_READY="leafer.before_ready",ro.READY="leafer.ready",ro.AFTER_READY="leafer.after_ready",ro.VIEW_READY="leafer.view_ready",ro.VIEW_COMPLETED="leafer.view_completed",ro.STOP="leafer.stop",ro.RESTART="leafer.restart",ro.END="leafer.end";const no={};class oo{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,r,n;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=ao(this,s,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ao(this,t);s.forEach((t=>{t&&(r=o[t],r&&(n=r.findIndex((t=>t.listener===e)),n>-1&&r.splice(n,1),r.length||delete o[t]))}))}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=ao(this,i)[t];if(s){let r;for(let n=0,o=s.length;n<o&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,r=i&&i[t],n=s&&s[t];return!!(void 0===e?r||n:e?n:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ao(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:no)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:no)}}const{on:ho,on_:lo,off:co,off_:uo,once:_o,emit:po,emitEvent:go,hasEvent:fo,destroy:yo}=oo.prototype,mo={on:ho,on_:lo,off:co,off_:uo,once:_o,emit:po,emitEvent:go,hasEvent:fo,destroyEventer:yo},{isFinite:vo}=Number,wo=Et.get("setAttr"),xo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!vo(e)&&void 0!==e&&(wo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=$n,r=new $n(i,this,t,s,e);return this.isLeafer?this.emitEvent(new $n($n.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(r),this.leafer.emitEvent(r),!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:bo,multiplyParent:Eo,translateInner:Bo,defaultWorld:ko}=E,{toPoint:Po,tempPoint:So}=yt,Ro={__updateWorldMatrix(){Eo(this.__local||this.__layout,this.parent?this.parent.__world:ko,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)&&(bo(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)&&(Po(i.around||i.origin,t.boxBounds,So),Bo(e,-So.x,-So.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Co,updateAllMatrix:To}=Pn,{updateBounds:Lo}=Fn,{toOuterOf:Ao,copyAndSpread:Do,copy:Oo}=at,{toBounds:Io}=rr,Fo={__updateWorldBounds(){Ao(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(),Ao(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ao(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ao(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Io(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(),To(this),Lo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(To(this),Lo(this,this))):Co(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Do(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Do(t.renderBounds,t.boxBounds,t.renderSpread):Oo(t.renderBounds,t.strokeBounds)}},Mo={__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:Wo}=On,Uo={__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 r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Wo(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Wo(i[s],e)||i[s].__clip(t,e)}}},{LEAF:No,create:zo}=s,{toInnerPoint:Yo,toOuterPoint:Ho,multiplyParent:jo}=E,{toOuterOf:Xo}=at,{copy:Go,move:Vo}=I,{moveLocal:qo,zoomOfLocal:Ko,rotateOfLocal:Zo,skewOfLocal:Qo,moveWorld:$o,zoomOfWorld:Jo,rotateOfWorld:ta,skewOfWorld:ea,transform:ia,transformWorld:sa,setTransform:ra,getFlipTransform:na,getLocalOrigin:oa,getRelativeWorld:aa,drop:ha}=Pn;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 Nt}get __LayoutProcessor(){return Kn}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=zo(No),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Qn.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Qn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Qn.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer((()=>this.leafer.nextRender(t,e,i)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Qn.MOUNTED)):this.__emitLifeEvent(Qn.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some((t=>t.__.mask&&t.__.visible&&t.__.opacity))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return jo(i,t.matrix,e,void 0,i),Xo(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?aa(this,e):this.worldTransform,r=i?t:{};return Xo(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Go(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Go(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Yo(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Ho(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 r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Vo(r,-n,-o),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Vo(r,n,o),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}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 r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){ra(this,t,e,i)}transform(t,e,i){ia(this,t,e,i)}move(t,e,i){qo(this,t,e,i)}moveInner(t,e,i){$o(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Ko(this,oa(this,t),e,i,s,r)}rotateOf(t,e,i){Zo(this,oa(this,t),e,i)}skewOf(t,e,i,s,r){Qo(this,oa(this,t),e,i,s,r)}transformWorld(t,e,i){sa(this,t,e,i)}moveWorld(t,e,i){$o(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Jo(this,t,e,i,s,r)}rotateOfWorld(t,e){ta(this,t,e)}skewOfWorld(t,e,i,s,r){ea(this,t,e,i,s,r)}flip(t,e){ia(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 Tt.need("path")}getMotionPoint(t){return Tt.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){ha(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):nn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Wr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Qn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Qn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=Xt([un(xo),un(Ro),un(Fo),un(mo),un(Mo)],t.Leaf);const{setListWithFn:la}=at,{sort:da}=Fn,{localBoxBounds:ca,localStrokeBounds:ua,localRenderBounds:_a,maskLocalBoxBounds:pa,maskLocalStrokeBounds:ga,maskLocalRenderBounds:fa}=On,ya=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(){la(this.__layout.boxBounds,this.children,this.__hasMask?pa:ca)}__updateStrokeBounds(){la(this.__layout.strokeBounds,this.children,this.__hasMask?ga:ua)}__updateRenderBounds(){la(this.__layout.renderBounds,this.children,this.__hasMask?fa:_a)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(da),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ya.warn("add self or destroyed");const i=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),i||e++}));t=At.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Qn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Qn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):this.__remove(t,e):this.find(t).forEach((t=>this.remove(t,e))):void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Qn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Qn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Qn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=Xt([un(Uo)],t.Branch);class ma{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,r=s.length;t<r;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,r=e.length;s<r;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 ma;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 va{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 wa 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}}pr(OffscreenCanvasRenderingContext2D.prototype),pr(Path2D.prototype);const{mineType:xa}=gr;function ba(t,s){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,r)=>{t.convertToBlob({type:xa(e),quality:i}).then((t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(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 r=new XMLHttpRequest;r.open("GET",e.image.getRealURL(t),!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then((t=>{i(t)})).catch((t=>{s(t)}))},r.onerror=t=>s(t),r.send()}))},e.canvas=i.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(i,{canvas:(t,e)=>new wa(t,e),image:t=>new Sr(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Rr(e,"devicePixelRatio",{get:()=>1});const{userAgent:Ea}=navigator;Ea.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):Ea.indexOf("Safari")>-1&&-1===Ea.indexOf("Chrome")&&(e.fullImageShadow=!0),Ea.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Ea.indexOf("Mac")>-1?e.os="Mac":Ea.indexOf("Linux")>-1&&(e.os="Linux");class Ba{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ma;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 ma,this.target=t,e&&(this.config=Wt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(so.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Qn.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new eo(eo.DATA,{updatedList:this.updatedList})),this.__updatedList=new ma,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($n.CHANGE,this.__onAttrChange,this),t.on_([Qn.ADD,Qn.REMOVE],this.__onChildEvent,this),t.on_(eo.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:Pa,updateChange:Sa}=Pn,{pushAllChildBranch:Ra,pushAllParent:Ca}=Fn;const{worldBounds:Ta}=On;class La{constructor(t){this.updatedBounds=new ct,this.beforeBounds=new ct,this.afterBounds=new ct,t instanceof Array&&(t=new ma(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ta)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ta),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Aa,updateAllChange:Da}=Pn,Oa=Et.get("Layouter");class Ia{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new va,this.target=t,e&&(this.config=Wt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(io.START),this.layoutOnce(),t.emitEvent(new io(io.END,this.layoutedBlocks,this.times))}catch(t){Oa.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Oa.warn("layouting"):this.times>3?Oa.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(eo.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=St.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=io,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new io(r,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),Ca(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ca(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;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||Pa(s[t])}Pa(i)}}))}(this.__levelList),function(t){t.list.forEach(Sa)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new io(n,a,this.times)),i.emitEvent(new io(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,St.end(e)}fullLayout(){const t=St.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=io,n=this.getBlocks(new ma(e));e.emitEvent(new io(i,n,this.times)),Ia.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new io(s,n,this.times)),e.emitEvent(new io(r,n,this.times)),this.addBlocks(n),St.end(t)}static fullLayout(t){Aa(t,!0),t.isBranch?Fn.updateBounds(t):Pn.updateBounds(t),Da(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new La([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new La(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_(io.REQUEST,this.layout,this),t.on_(io.AGAIN,this.layoutAgain,this),t.on_(eo.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fa=Et.get("Renderer");class Ma{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=Wt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(io.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(so.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(so.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(so.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new ct,Fa.log(e.innerName,"---\x3e");try{this.emitRender(so.START),this.renderOnce(t),this.emitRender(so.END,this.totalBounds),Er.clearRecycled()}catch(t){this.rendering=!1,Fa.error(t)}Fa.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Fa.warn("rendering");if(this.times>3)return Fa.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new ct,this.renderOptions={},t)this.emitRender(so.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(so.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(so.RENDER,this.renderBounds,this.renderOptions),this.emitRender(so.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=St.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new ct(s);i.save(),s.spread(Ma.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,r),i.restore(),St.end(e)}fullRender(){const t=St.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),St.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),r=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,r),this.renderBounds=e=e||t,this.renderOptions=r,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||Fa.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,i){this.target.emitEvent(new so(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(so.REQUEST,this.update,this),t.on_(io.END,this.__onLayoutEnd,this),t.on_(so.AGAIN,this.renderAgain,this),t.on_(to.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Ma.clipSpread=10;const{hitRadiusPoint:Wa}=at;class Ua{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ma(i.findList),i.findList||this.hitBranch(n);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,r),h=r?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new ma;const{x:s,y:r}=this.point,n={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||Pn.worldHittable(e))&&(this.hitChild(e,n),this.findList.length))return this.findList.list[0]}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),this.findList.length)return this.findList.list[0];return t[0]}getPath(t){const e=new ma;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 ma;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 ma,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,o=i.length;t<o;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Wa(i.__world,r),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)):s&&this.hitChild(i,r))}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 Na{constructor(t,e){this.config={},e&&(this.config=Wt.default(e,this.config)),this.picker=new Ua(this.target=t,this),this.finder=i.finder&&i.finder()}getByPoint(t,i,s){const{target:r,picker:n}=this;return e.backgrounder&&r&&r.updateLayout(),n.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Tt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function za(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Ya(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Ha(){return(t,e)=>{const i="_"+e;Rr(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 Ba(t,e),layouter:(t,e)=>new Ia(t,e),renderer:(t,e,i)=>new Ma(t,e,i),selector:(t,e)=>new Na(t,e)}),e.layout=Ia.fullLayout;const ja={},Xa={},Ga={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},Va={},qa={},Ka={},Za={},Qa={},$a={apply(){Tt.need("filter")}},Ja={},th={setStyleName:()=>Tt.need("state"),set:()=>Tt.need("state")},eh={list:{},register(t,e){eh.list[t]=e},get:t=>eh.list[t]},{parse:ih,objectToCanvasData:sh}=ki,rh={},nh=Et.get("UIData");class oh extends Nt{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,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=rh)}}else this.__isFills&&(this.__removeInput("fill"),Ka.recycleImage("fill",this),this.__isFills=!1,this.__pixelFill&&(this.__pixelFill=!1)),this._fill=t}setStroke(t){if("string"!=typeof t&&t){if("object"==typeof t){this.__setInput("stroke",t);const e=this.__leaf.__layout;e.boxChanged||e.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=rh)}}else this.__isStrokes&&(this.__removeInput("stroke"),Ka.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?ih(t):sh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ah(this,"shadow",t)}setInnerShadow(t){ah(this,"innerShadow",t)}setFilter(t){ah(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&qa.compute("fill",this.__leaf),e&&qa.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function ah(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 hh extends oh{}class lh extends hh{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 dh extends hh{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class ch extends lh{}class uh extends oh{}class _h extends oh{get __boxStroke(){return!this.__pathInputed}}class ph extends oh{get __boxStroke(){return!this.__pathInputed}}class gh extends oh{}class fh extends oh{}class yh extends oh{get __pathInputed(){return 2}}class mh extends hh{}const vh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class wh extends oh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=vh[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=At.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange(),n.renderChanged&&r.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class xh extends _h{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 bh extends _h{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 Eh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=Math.max(n.__layout.strokeSpread=n.__updateStrokeSpread(),t),e=n.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),n&&(t+=$a.getSpread(n));let o=t=Math.ceil(t);return i&&i.forEach((t=>o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),r&&(o=Math.max(o,r)),this.__layout.renderShapeSpread=o,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},Bh={__updateChange(){const t=this.__,e=this.__world;if(t.__useEffect){const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n}=this.__;t.__useEffect=!!(e||i||s||r||n)}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:r,stroke:n,__drawAfterFill:o}=s;if(this.__drawRenderPath(t),s.__useEffect){const a=qa.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:l,filter:d}=s;h&&Qa.shadow(this,t,a),r&&(s.__isFills?qa.fills(r,this,t):qa.fill(r,this,t)),o&&this.__drawAfterFill(t,e),l&&Qa.innerShadow(this,t,a),n&&(s.__isStrokes?qa.strokes(n,this,t):qa.stroke(n,this,t)),d&&$a.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else r&&(s.__isFills?qa.fills(r,this,t):qa.fill(r,this,t)),o&&this.__drawAfterFill(t,e),n&&(s.__isStrokes?qa.strokes(n,this,t):qa.stroke(n,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:r,stroke:n}=this.__;this.__drawRenderPath(t),r&&!i&&(this.__.__pixelFill?qa.fills(r,this,t):qa.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),n&&!s&&(this.__.__pixelStroke?qa.strokes(n,this,t):qa.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),this.windingRule?t.clip(this.windingRule):t.clip(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function kh(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n}=t.__;t.__drawRenderPath(e),s&&qa.fill(s,t,e),n&&t.__drawAfterFill(e,i),r&&qa.stroke(r,t,e)}const Ph={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Sh,Rh;t.UI=Sh=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 ur.set(this.path=t||[]),t||this.__drawPathByBox(ur),ur}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 Tt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Tt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(ur.set(i=[]),this.__drawPathByBox(ur)),t?ki.toCanvasData(i,!0):i}getPathString(t,e,i){return ki.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Ja.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?cr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Va.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?Ps.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,"number"==typeof n?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e){qa.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Tt.need("animate")}killAnimate(t,e){}export(t,e){return Tt.need("export")}syncExport(t,e){return Tt.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Sh.one(e)}static one(t,e,i,s,r){return At.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){_n()(this)}static registerData(t){rn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},Xt([rn(oh)],t.UI.prototype,"__",void 0),Xt([Ha()],t.UI.prototype,"zoomLayer",void 0),Xt([Dr("")],t.UI.prototype,"id",void 0),Xt([Dr("")],t.UI.prototype,"name",void 0),Xt([Dr("")],t.UI.prototype,"className",void 0),Xt([Vr("pass-through")],t.UI.prototype,"blendMode",void 0),Xt([qr(1)],t.UI.prototype,"opacity",void 0),Xt([Kr(!0)],t.UI.prototype,"visible",void 0),Xt([Vr(!1)],t.UI.prototype,"locked",void 0),Xt([Vr(!1)],t.UI.prototype,"dim",void 0),Xt([Vr(!1)],t.UI.prototype,"dimskip",void 0),Xt([$r(0)],t.UI.prototype,"zIndex",void 0),Xt([Jr(!1)],t.UI.prototype,"mask",void 0),Xt([tn(!1)],t.UI.prototype,"eraser",void 0),Xt([Or(0,!0)],t.UI.prototype,"x",void 0),Xt([Or(0,!0)],t.UI.prototype,"y",void 0),Xt([Wr(100,!0)],t.UI.prototype,"width",void 0),Xt([Wr(100,!0)],t.UI.prototype,"height",void 0),Xt([Fr(1,!0)],t.UI.prototype,"scaleX",void 0),Xt([Fr(1,!0)],t.UI.prototype,"scaleY",void 0),Xt([Mr(0,!0)],t.UI.prototype,"rotation",void 0),Xt([Mr(0,!0)],t.UI.prototype,"skewX",void 0),Xt([Mr(0,!0)],t.UI.prototype,"skewY",void 0),Xt([Or(0,!0)],t.UI.prototype,"offsetX",void 0),Xt([Or(0,!0)],t.UI.prototype,"offsetY",void 0),Xt([Or(0,!0)],t.UI.prototype,"scrollX",void 0),Xt([Or(0,!0)],t.UI.prototype,"scrollY",void 0),Xt([Ir()],t.UI.prototype,"origin",void 0),Xt([Ir()],t.UI.prototype,"around",void 0),Xt([Dr(!1)],t.UI.prototype,"lazy",void 0),Xt([Ur(1)],t.UI.prototype,"pixelRatio",void 0),Xt([zr()],t.UI.prototype,"path",void 0),Xt([Yr()],t.UI.prototype,"windingRule",void 0),Xt([Yr(!0)],t.UI.prototype,"closed",void 0),Xt([Wr(0)],t.UI.prototype,"padding",void 0),Xt([Wr(!1)],t.UI.prototype,"lockRatio",void 0),Xt([Wr()],t.UI.prototype,"widthRange",void 0),Xt([Wr()],t.UI.prototype,"heightRange",void 0),Xt([Dr(!1)],t.UI.prototype,"draggable",void 0),Xt([Dr()],t.UI.prototype,"dragBounds",void 0),Xt([Dr(!1)],t.UI.prototype,"editable",void 0),Xt([en(!0)],t.UI.prototype,"hittable",void 0),Xt([en("path")],t.UI.prototype,"hitFill",void 0),Xt([Xr("path")],t.UI.prototype,"hitStroke",void 0),Xt([en(!1)],t.UI.prototype,"hitBox",void 0),Xt([en(!0)],t.UI.prototype,"hitChildren",void 0),Xt([en(!0)],t.UI.prototype,"hitSelf",void 0),Xt([en()],t.UI.prototype,"hitRadius",void 0),Xt([sn("")],t.UI.prototype,"cursor",void 0),Xt([Vr()],t.UI.prototype,"fill",void 0),Xt([Xr()],t.UI.prototype,"stroke",void 0),Xt([Xr("inside")],t.UI.prototype,"strokeAlign",void 0),Xt([Xr(1)],t.UI.prototype,"strokeWidth",void 0),Xt([Xr(!1)],t.UI.prototype,"strokeWidthFixed",void 0),Xt([Xr("none")],t.UI.prototype,"strokeCap",void 0),Xt([Xr("miter")],t.UI.prototype,"strokeJoin",void 0),Xt([Xr()],t.UI.prototype,"dashPattern",void 0),Xt([Xr(0)],t.UI.prototype,"dashOffset",void 0),Xt([Xr(10)],t.UI.prototype,"miterLimit",void 0),Xt([Yr(0)],t.UI.prototype,"cornerRadius",void 0),Xt([Yr()],t.UI.prototype,"cornerSmoothing",void 0),Xt([za()],t.UI.prototype,"shadow",void 0),Xt([za()],t.UI.prototype,"innerShadow",void 0),Xt([za()],t.UI.prototype,"blur",void 0),Xt([za()],t.UI.prototype,"backgroundBlur",void 0),Xt([za()],t.UI.prototype,"grayscale",void 0),Xt([za()],t.UI.prototype,"filter",void 0),Xt([Vr()],t.UI.prototype,"placeholderColor",void 0),Xt([Dr({})],t.UI.prototype,"data",void 0),Xt([ln(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Sh=Xt([un(Eh),un(Bh),dn()],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(){}},Xt([rn(hh)],t.Group.prototype,"__",void 0),Xt([Wr(0)],t.Group.prototype,"width",void 0),Xt([Wr(0)],t.Group.prototype,"height",void 0),t.Group=Xt([un(t.Branch),_n()],t.Group);const Ch=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&&xr.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:r}=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,Wt.assign(r,t));const n=this.canvas=i.canvas(r);this.__controllers.push(this.renderer=i.renderer(this,n,r),this.watcher=i.watcher(this,r),this.layouter=i.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r,e),this.view=n.view,e||(this.selector=i.selector(this),this.interaction=i.interaction(this,n,this.selector,r),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=i.hitCanvasManager()),this.canvasManager=new Mt,s=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(n),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),Nn.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(ro.RESTART):this.emitLeafer(ro.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(ro.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=Wt.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=Wt.copyAttrs({},this.canvas,ie);e.resize(t),this.updateLazyBounds(),this.__onResize(new to(t,i))}__onResize(t){this.emitEvent(t),Wt.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 _t(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=Wt.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(ro.BEFORE_READY),this.emitLeafer(ro.READY),this.emitLeafer(ro.AFTER_READY),Nn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ro.VIEW_READY),Nn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(r=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Nn.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender((()=>{this.imageReady&&(t&&this.emitLeafer(ro.VIEW_COMPLETED),Nn.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,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 Tt.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 ro(t,this))}__listenEvents(){const t=St.start("FirstCreate "+this.innerName);this.once(ro.START,(()=>St.end(t))),this.once(io.START,(()=>this.updateLazyBounds())),this.once(so.START,(()=>this.__onCreated())),this.once(so.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(eo.DATA,this.__onWatchData,this),this.on_(io.END,this.__onLayoutEnd,this),this.on_(so.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 ro(ro.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((()=>{Er.clearRecycled()}),100)}catch(t){Ch.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ma,Xt([rn(dh)],t.Leafer.prototype,"__",void 0),Xt([Wr()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Rh=Xt([_n()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},Xt([rn(_h)],t.Rect.prototype,"__",void 0),t.Rect=Xt([un(Ph),dn(),_n()],t.Rect);const{copy:Th,add:Lh,includes:Ah}=at,Dh=t.Rect.prototype,Oh=t.Group.prototype,Ih={};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(),Th(Ih,e),this.__updateRectRenderBounds(),t=!Ah(e,Ih)||void 0,t&&"hide"!==this.__.overflow&&Lh(e,Ih)):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))}},Xt([rn(lh)],t.Box.prototype,"__",void 0),Xt([Wr(100)],t.Box.prototype,"width",void 0),Xt([Wr(100)],t.Box.prototype,"height",void 0),Xt([Dr(!1)],t.Box.prototype,"resizeChildren",void 0),Xt([Gr("show")],t.Box.prototype,"overflow",void 0),Xt([ln(Dh.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),Xt([ln(Dh.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),Xt([ln(Dh.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),Xt([ln(Dh.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),Xt([ln(Dh.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),Xt([ln(Dh.__updateChange)],t.Box.prototype,"__updateRectChange",null),Xt([ln(Dh.__render)],t.Box.prototype,"__renderRect",null),Xt([ln(Oh.__render)],t.Box.prototype,"__renderGroup",null),t.Box=Xt([dn(),_n()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},Xt([rn(ch)],t.Frame.prototype,"__",void 0),Xt([Vr("#FFFFFF")],t.Frame.prototype,"fill",void 0),Xt([Gr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=Xt([_n()],t.Frame);const{moveTo:Fh,closePath:Mh,ellipse:Wh}=qi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:r,endAngle:n}=this.__,o=t/2,a=i/2,h=this.__.path=[];s?(r||n?(s<1&&Wh(h,o,a,o*s,a*s,0,r,n,!1),Wh(h,o,a,o,a,0,n,r,!0),s<1&&Mh(h)):(s<1&&(Wh(h,o,a,o*s,a*s),Fh(h,t,a)),Wh(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||n?(Fh(h,o,a),Wh(h,o,a,o,a,0,r,n,!1),Mh(h)):Wh(h,o,a,o,a)}},Xt([rn(ph)],t.Ellipse.prototype,"__",void 0),Xt([Yr(0)],t.Ellipse.prototype,"innerRadius",void 0),Xt([Yr(0)],t.Ellipse.prototype,"startAngle",void 0),Xt([Yr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=Xt([_n()],t.Ellipse);const{moveTo:Uh,lineTo:Nh,drawPoints:zh}=qi,{rotate:Yh,getAngle:Hh,getDistance:jh,defaultPoint:Xh}=I,{toBounds:Gh}=rr;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&&Yh(i,e),i}set toPoint(t){this.width=jh(Xh,t),this.rotation=Hh(Xh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?zh(e,t.points,!1,t.closed):(Uh(e,0,0),Nh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(zh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&Va.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Gh(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},Xt([rn(uh)],t.Line.prototype,"__",void 0),Xt([Hr("center")],t.Line.prototype,"strokeAlign",void 0),Xt([Wr(0)],t.Line.prototype,"height",void 0),Xt([Yr()],t.Line.prototype,"points",void 0),Xt([Yr(0)],t.Line.prototype,"curve",void 0),Xt([Yr(!1)],t.Line.prototype,"closed",void 0),t.Line=Xt([_n()],t.Line);const{sin:Vh,cos:qh,PI:Kh}=Math,{moveTo:Zh,lineTo:Qh,closePath:$h,drawPoints:Jh}=qi,tl=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)Jh(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,r=e/2,n=i/2;Zh(t,r,0);for(let e=1;e<s;e++)Qh(t,r+r*Vh(2*e*Kh/s),n-n*qh(2*e*Kh/s))}$h(t)}__updateRenderPath(){}__updateBoxBounds(){}},Xt([rn(gh)],t.Polygon.prototype,"__",void 0),Xt([Yr(3)],t.Polygon.prototype,"sides",void 0),Xt([Yr()],t.Polygon.prototype,"points",void 0),Xt([Yr(0)],t.Polygon.prototype,"curve",void 0),Xt([ln(tl.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),Xt([ln(tl.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=Xt([dn(),_n()],t.Polygon);const{sin:el,cos:il,PI:sl}=Math,{moveTo:rl,lineTo:nl,closePath:ol}=qi;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.__,r=t/2,n=e/2,o=this.__.path=[];rl(o,r,0);for(let t=1;t<2*i;t++)nl(o,r+(t%2==0?r:r*s)*el(t*sl/i),n-(t%2==0?n:n*s)*il(t*sl/i));ol(o)}},Xt([rn(fh)],t.Star.prototype,"__",void 0),Xt([Yr(5)],t.Star.prototype,"corners",void 0),Xt([Yr(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=Xt([_n()],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_(Jn.LOADED,this.__onLoaded,this)}__onLoaded(t){"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}destroy(){this.image=null,super.destroy()}},Xt([rn(xh)],t.Image.prototype,"__",void 0),Xt([Wr("")],t.Image.prototype,"url",void 0),t.Image=Xt([_n()],t.Image);const al=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 Sr({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Jn(Jn.LOADED,{image:t}))}))}draw(t,e,i,s){const r=new Y(t.worldTransform).invert(),n=new Y;e&&n.translate(e.x,e.y),i&&("number"==typeof i?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.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()}},Xt([rn(bh)],t.Canvas.prototype,"__",void 0),Xt([Ya(100)],t.Canvas.prototype,"width",void 0),Xt([Ya(100)],t.Canvas.prototype,"height",void 0),Xt([Ya(1)],t.Canvas.prototype,"pixelRatio",void 0),Xt([Ya(!0)],t.Canvas.prototype,"smooth",void 0),Xt([Dr(!1)],t.Canvas.prototype,"safeResize",void 0),Xt([Ya()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=Xt([_n()],t.Canvas);const{copyAndSpread:hl,includes:ll,spread:dl,setList:cl}=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:r,fontWeight:n,italic:o,textCase:a,textOverflow:l,padding:d}=t;t.__lineHeight=Ga.number(e,r),t.__letterSpacing=Ga.number(i,r),t.__padding=d?h.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=ja.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&dl(a,i/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i);const l=!ll(h,a)||void 0;l?(cl(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;hl(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&&!Ja.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},Xt([rn(wh)],t.Text.prototype,"__",void 0),Xt([Wr(0)],t.Text.prototype,"width",void 0),Xt([Wr(0)],t.Text.prototype,"height",void 0),Xt([Vr()],t.Text.prototype,"boxStyle",void 0),Xt([Dr(!1)],t.Text.prototype,"resizeFontSize",void 0),Xt([Vr("#000000")],t.Text.prototype,"fill",void 0),Xt([Hr("outside")],t.Text.prototype,"strokeAlign",void 0),Xt([en("all")],t.Text.prototype,"hitFill",void 0),Xt([Wr("")],t.Text.prototype,"text",void 0),Xt([Wr("")],t.Text.prototype,"placeholder",void 0),Xt([Wr("caption")],t.Text.prototype,"fontFamily",void 0),Xt([Wr(12)],t.Text.prototype,"fontSize",void 0),Xt([Wr("normal")],t.Text.prototype,"fontWeight",void 0),Xt([Wr(!1)],t.Text.prototype,"italic",void 0),Xt([Wr("none")],t.Text.prototype,"textCase",void 0),Xt([Wr("none")],t.Text.prototype,"textDecoration",void 0),Xt([Wr(0)],t.Text.prototype,"letterSpacing",void 0),Xt([Wr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),Xt([Wr(0)],t.Text.prototype,"paraIndent",void 0),Xt([Wr(0)],t.Text.prototype,"paraSpacing",void 0),Xt([Wr("x")],t.Text.prototype,"writingMode",void 0),Xt([Wr("left")],t.Text.prototype,"textAlign",void 0),Xt([Wr("top")],t.Text.prototype,"verticalAlign",void 0),Xt([Wr(!0)],t.Text.prototype,"autoSizeAlign",void 0),Xt([Wr("normal")],t.Text.prototype,"textWrap",void 0),Xt([Wr("show")],t.Text.prototype,"textOverflow",void 0),t.Text=Xt([_n()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},Xt([rn(yh)],t.Path.prototype,"__",void 0),Xt([Hr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=Xt([_n()],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,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,o,a){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,o,a){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},Xt([rn(mh)],t.Pen.prototype,"__",void 0),Xt([(t,e)=>{Rr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=Xt([un(cs,["set","path","paint"]),_n()],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:r,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(s||n)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(r||n)&&(this.sky=this.addLeafer(r)),n&&this.sky.add(this.editor=i.editor(n))}}__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&&Wt.assign(e,t),this.autoLayout&&Wt.copyAttrs(e,this,ie),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(io.END,(()=>this.__onReady())),t.once(so.START,(()=>this.__onCreated())),t.once(so.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(so.END,this.__onChildRenderEnd,this))}},t.App=Xt([_n()],t.App);const ul={},_l={isHoldSpaceKey:()=>_l.isHold("Space"),isHold:t=>ul[t],setDownCode(t){ul[t]||(ul[t]=!0)},setUpCode(t){ul[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 gl extends Zn{get spaceKey(){return _l.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 gl{},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=Xt([pn()],t.PointerEvent);const fl=t.PointerEvent,yl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ma?t:new ma(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:r}=t,n=t.getLocalPoint(i,null,!0);return I.move(n,e.x-t.x,e.y-t.y),r&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===r?t.parent.boxBounds:r,n,!0),"x"===s&&(n.y=0),"y"===s&&(n.x=0),n}static getMoveInDragBounds(t,e,i,s){const r=t.x+i.x,n=t.y+i.y,o=r+t.width,a=n+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),at.includes(t,e)?(r>e.x?i.x+=e.x-r:o<h&&(i.x+=h-o),n>e.y?i.y+=e.y-n:a<l&&(i.y+=l-a)):(r<e.x?i.x+=e.x-r:o>h&&(i.x+=h-o),n<e.y?i.y+=e.y-n:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(yl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(yl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(yl,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){yl.x=t?this.totalX:this.moveX,yl.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=Xt([pn()],t.DragEvent);const ml=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=Xt([pn()],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=Xt([pn()],t.MoveEvent),t.RotateEvent=class extends gl{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=Xt([pn()],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=Xt([pn()],t.SwipeEvent),t.ZoomEvent=class extends gl{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=Xt([pn()],t.ZoomEvent),t.KeyEvent=class extends gl{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=Xt([pn()],t.KeyEvent);const vl={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:wl.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 ma,{list:s}=t;for(let t=0,r=s.length;t<r;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))},wl=vl,xl=new ma,{getDragEventData:bl,getDropEventData:El,getSwipeEventData:Bl}=vl;class kl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=bl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||xl;return this.dragging&&(r?e?xl:new ma(i?[...s.list,...s.dragHoverExclude]:s.list):n)}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 ma(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:o}=r;this.dragData=bl(r,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=n,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:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:o}=s,a=bl(s,e,e);if(o&&(a.throughPath=o),a.path=n,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const n=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,r,a),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(I.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Bl(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=El(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),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 Pl=Et.get("emit");const Sl=["move","zoom","rotate","key"];function Rl(t,e,i,s,r){if(Sl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Tl(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!i.path.has(n)&&n.__.hittable&&Cl(n,e,i,s,r)}}function Cl(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Tl(t,r)&&(th.updateEventStyle&&!s&&th.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=It.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Tl(t,e){return e&&e.has(t)}const Ll={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:Al,pathCanDrag:Dl,pathHasOutside:Ol}=vl;class Il{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&&_l.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=Wt.clone(Ll),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ma(t),this.createTransformer(),this.dragger=new kl(this),s&&(this.config=Wt.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,_l.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,_l.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 ma),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 r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Al(e.path,t)));r<i.tapTime+50&&n?(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:r}=this.p,{bottomList:n,target:o}=this;e.backgrounder||t.origin||o&&o.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:n,name:t.type},i||{through:r}));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&&!Ol(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Dl(t.path))&&!Ol(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,r=s.length;t<r&&(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),(Al(e.path,t.PointerEvent.LONG_TAP)||Al(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_(to.RESIZE,this.__onResize,this)],t.once(ro.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 r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Cl(r,t,e,!0,s))return;r.isApp&&Rl(r,t,e,!0,s)}for(let n=0,o=i.length;n<o;n++)if(r=i.list[n],r.isApp&&Rl(r,t,e,!1,s),Cl(r,t,e,!1,s))return}catch(t){Pl.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 Fl{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Fl.custom={};class Ml extends Mt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ma,this.pixelList=new ma}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:Ul,setRadius:Nl}=I,zl={},Yl=t.Leaf.prototype;Yl.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,r=i.width<10&&i.height<10;if(e.hitRadius&&(Ul(zl,t),Nl(t=zl,e.hitRadius)),Wl(t,i,zl),e.hitBox||r){if(at.hitRadiusPoint(s.boxBounds,zl))return!0;if(r)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(zl)},Yl.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Yl.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Yl.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Yl.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Hl=new Y,jl=t.UI.prototype;jl.__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,r=t.__pixelStroke&&"pixel"===t.hitStroke,n=s||r;this.__hitCanvas||(this.__hitCanvas=n?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const o=this.__hitCanvas;if(n){const{renderBounds:i}=this.__layout,n=e.image.hitCanvasSize,a=o.hitScale=ut.set(0,0,n,n).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ut.set(i).scale(a);o.resize({width:d,height:c,pixelRatio:1}),o.clear(),Er.patternLocked=!0,this.__renderShape(o,{matrix:Hl.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!r),Er.patternLocked=!1,o.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(t)},jl.__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:r,__strokeWidth:n}=e,o=e.stroke&&("path"===r||"pixel"===r&&!e.__pixelStroke)||"all"===r;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Xl=t.UI.prototype,Gl=t.Rect.prototype,Vl=t.Box.prototype;Gl.__updateHitCanvas=Vl.__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)},Gl.__hitFill=Vl.__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:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach((r=>t.rect(r.x,r.y-s,r.width,e<i?i:e)))},t.Group.prototype.pick=function(t,s){return s||(s=Yt),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 ql=se.prototype;function Kl(t,e){const i=t.__,{rows:s,decorationY:r}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)}));if(r){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>r.forEach((i=>e.fillRect(t.x,t.y+i,t.width,n)))))}}function Zl(t,e){t.__.__font?Kl(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Ql(t,e,i){const{strokeAlign:s}=e.__,r="string"!=typeof t;switch(s){case"center":i.setStroke(r?void 0:t,e.__.strokeWidth,e.__),r?td(t,!0,e,i):Jl(e,i);break;case"inside":$l("inside",t,r,e,i);break;case"outside":$l("outside",t,r,e,i)}}function $l(t,e,i,s,r){const{__strokeWidth:n,__font:o}=s.__,a=r.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*n,s.__),a.font=o,i?td(e,!0,s,a):Jl(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",Kl(s,a),a.blendMode="normal",s.__worldFlipped?r.copyWorldByReset(a,s.__nowWorld):r.copyWorldToInner(a,s.__nowWorld,s.__layout.renderBounds),a.recycle(s.__nowWorld)}function Jl(t,e){let i,s=t.__.__textDrawData;const{rows:r,decorationY:n}=s;for(let t=0,s=r.length;t<s;t++)i=r[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(n){const{decorationHeight:t}=s;r.forEach((i=>n.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function td(t,e,i,s){let r;for(let n=0,o=t.length;n<o;n++)r=t[n],r.image&&Ka.checkImage(i,s,r,!1)||r.style&&(s.strokeStyle=r.style,r.blendMode?(s.saveBlendMode(r.blendMode),e?Jl(i,s):s.stroke(),s.restoreBlendMode()):e?Jl(i,s):s.stroke())}function ed(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}ql.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},ql.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},ql.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:o}=t;e&&(s-=e.x,r-=e.y),ut.set(s-n,r-o,2*n,2*o).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:id,getOuterOf:sd,getByMove:rd,getIntersectData:nd}=at;let od;function ad(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:r,blendMode:n,color:o,opacity:a}=e;return{type:r,blendMode:n,style:Xa.string(o,a)};case"image":return Ka.image(i,t,e,s,!od||!od[e.url]);case"linear":return Za.linearGradient(e,s);case"radial":return Za.radialGradient(e,s);case"angular":return Za.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:Xa.string(e)}:void 0}}const hd={compute:function(t,e){const i=e.__,s=[];let r,n=i.__input[t];n instanceof Array||(n=[n]),od=Ka.recycleImage(t,i);for(let i,r=0,o=n.length;r<o;r++)i=ad(t,n[r],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(r=s[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=r:i.__pixelStroke=r},fill:function(t,e,i){i.fillStyle=t,Zl(e,i)},fills:function(t,e,i){let s;for(let r=0,n=t.length;r<n;r++){if(s=t[r],s.image){if(Ka.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!r&&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),Zl(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),Zl(e,i),i.restoreBlendMode()):Zl(e,i)}},fillPathOrText:Zl,fillText:Kl,stroke:function(t,e,i){const s=e.__,{__strokeWidth:r,strokeAlign:n,__font:o}=s;if(r)if(o)Ql(t,e,i);else switch(n){case"center":i.setStroke(t,r,s),i.stroke(),s.__useArrow&&ed(e,i);break;case"inside":i.save(),i.setStroke(t,2*r,s),s.windingRule?i.clip(s.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const n=i.getSameCanvas(!0,!0);n.setStroke(t,2*r,s),e.__drawRenderPath(n),n.stroke(),s.windingRule?n.clip(s.windingRule):n.clip(),n.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(n,e.__nowWorld):i.copyWorldToInner(n,e.__nowWorld,e.__layout.renderBounds),n.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:r,strokeAlign:n,__font:o}=s;if(r)if(o)Ql(t,e,i);else switch(n){case"center":i.setStroke(void 0,r,s),td(t,!1,e,i),s.__useArrow&&ed(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*r,s),s.windingRule?i.clip(s.windingRule):i.clip(),td(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*r,s),td(t,!1,e,o),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(n),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,n),o.recycle(e.__nowWorld)}},strokeText:Ql,drawTextStroke:Jl,shape:function(t,e,i){const s=e.getSameCanvas(),r=t.__nowWorld;let n,o,a,h,{scaleX:l,scaleY:d}=r;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(r))h=s,n=a=r;else{const{renderShapeSpread:s}=t.__layout,c=nd(s?id(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,r);o=e.bounds.getFitMatrix(c);let{a:u,d:_}=o;if(o.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=_),a=sd(r,o),n=rd(a,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,_*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,_)})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:n,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let ld={};const{get:dd,rotateOfOuter:cd,translate:ud,scaleOfOuter:_d,scale:pd,rotate:gd}=E;function fd(t,e,i,s,r,n,o){const a=dd();ud(a,e.x+i,e.y+s),pd(a,r,n),o&&cd(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function yd(t,e,i,s,r,n,o){const a=dd();ud(a,e.x+i,e.y+s),r&&pd(a,r,n),o&&gd(a,o),t.transform=a}function md(t,e,i,s,r,n,o,a,h,l){const d=dd();if(h)if("center"===l)cd(d,{x:i/2,y:s/2},h);else switch(gd(d,h),h){case 90:ud(d,s,0);break;case 180:ud(d,i,s);break;case 270:ud(d,0,i)}ld.x=e.x+r,ld.y=e.y+n,ud(d,ld.x,ld.y),o&&_d(d,ld,o,a),t.transform=d}const{get:vd,translate:wd}=E,xd=new ct,bd={},Ed={};function Bd(t,e,i,s){const{blendMode:r,changeful:n,sync:o}=i;r&&(t.blendMode=r),n&&(t.changeful=n),o&&(t.sync=o),t.data=kd(i,s,e)}function kd(t,e,i){let{width:s,height:r}=i;t.padding&&(e=xd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{opacity:n,mode:o,align:a,offset:l,scale:d,size:c,rotation:u,repeat:_,filters:p}=t,g=e.width===s&&e.height===r,f={mode:o},y="center"!==a&&(u||0)%180==90,m=y?r:s,v=y?s:r;let w,x,b=0,E=0;if(o&&"cover"!==o&&"fit"!==o)(d||c)&&(h.getScaleData(d,c,i,Ed),w=Ed.scaleX,x=Ed.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;w=x="fit"===o?Math.min(t,i):Math.max(t,i),b+=(e.width-s*w)/2,E+=(e.height-r*x)/2}if(a){const t={x:b,y:E,width:m,height:v};w&&(t.width*=w,t.height*=x),wt.toPoint(a,t,e,bd,!0),b+=bd.x,E+=bd.y}switch(l&&(b+=l.x,E+=l.y),o){case"stretch":g||(s=e.width,r=e.height);break;case"normal":case"clip":(b||E||w||u)&&yd(f,e,b,E,w,x,u);break;case"repeat":(!g||w||u)&&md(f,e,s,r,b,E,w,x,u,a),_||(f.repeat="repeat");break;default:w&&fd(f,e,b,E,w,x,u)}return f.transform||(e.x||e.y)&&(f.transform=vd(),wd(f.transform,e.x,e.y)),w&&"stretch"!==o&&(f.scaleX=w,f.scaleY=x),f.width=s,f.height=r,n&&(f.opacity=n),p&&(f.filters=p),_&&(f.repeat="string"==typeof _?"x"===_?"repeat-x":"repeat-y":"repeat"),f}let Pd,Sd=new ct;const{isSame:Rd}=at;function Cd(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Bd(r,s,i,n),!0}function Td(t,e){Dd(t,Jn.LOAD,e)}function Ld(t,e){Dd(t,Jn.LOADED,e)}function Ad(t,e,i){e.error=i,t.forceUpdate("surface"),Dd(t,Jn.ERROR,e)}function Dd(t,e,i){t.hasEvent(e)&&t.emitEvent(new Jn(e,i))}function Od(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Id,scale:Fd,copy:Md}=E,{ceil:Wd,abs:Ud}=Math;function Nd(t,i,s){let{scaleX:r,scaleY:n}=Er.patternLocked?t.__world:t.__nowWorld;const o=r+"-"+n+"-"+s;if(i.patternId===o||t.destroyed)return!1;{r=Ud(r),n=Ud(n);const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g}=a;u&&(l=Id(),Md(l,p),Fd(l,1/u,1/_),r*=u,n*=_),r*=s,n*=s,d*=r,c*=n;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&&(r/=h,n/=h,d/=h,c/=h),u&&(r/=u,n/=_),(p||1!==r||1!==n)&&(l||(l=Id(),p&&Md(l,p)),Fd(l,1/r,1/n));const m=t.getCanvas(Wd(d)||1,Wd(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=o,!0}}const{abs:zd}=Math;const Yd={image:function(t,e,i,s,r){let n,o;const a=Er.get(i);return Pd&&i===Pd.paint&&Rd(s,Pd.boxBounds)?n=Pd.leafPaint:(n={type:i.type,image:a},Pd=a.use>1?{leafPaint:n,paint:i,boxBounds:Sd.set(s)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Cd(t,e,i,a,n,s),r&&(Td(t,o),Ld(t,o))):a.error?r&&Ad(t,o,a.error):(r&&(Od(t,!0),Td(t,o)),n.loadId=a.load((()=>{Od(t,!1),t.destroyed||(Cd(t,e,i,a,n,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ld(t,o)),n.loadId=null}),(e=>{Od(t,!1),Ad(t,o,e),n.loadId=null})),t.placeholderColor&&setTimeout((()=>{a.ready||a.isPlacehold||(a.isPlacehold=!0,t.forceUpdate("surface"))}),100)),n},checkImage:function(t,i,s,r){const{scaleX:n,scaleY:o}=Er.patternLocked?t.__world:t.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+o+"-"+a&&!Ja.running)return!1;if(r)if(h.repeat)r=!1;else if(!(s.changeful||to.isResizing(t)||Ja.running)){let{width:t,height:i}=h;t*=zd(n)*a,i*=zd(o)*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),r=t*i>e.image.maxCacheSize}return r?(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||Ja.running?Nd(t,s,a):s.patternTask||(s.patternTask=Er.patternTasker.add((()=>Gt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Nd(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:Nd,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,r,n,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,Er.recycle(r),r.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),r.unload(i[h].loadId,!o.some((t=>t.url===a)))));return n}return null},createData:Bd,getPatternData:kd,fillOrFitMode:fd,clipMode:yd,repeatMode:md},{toPoint:Hd}=yt,jd={},Xd={};function Gd(t,e,i){if(e){let s;for(let r=0,n=e.length;r<n;r++)s=e[r],"string"==typeof s?t.addColorStop(r/(n-1),Xa.string(s,i)):t.addColorStop(s.offset,Xa.string(s.color,i))}}const{getAngle:Vd,getDistance:qd}=I,{get:Kd,rotateOfOuter:Zd,scaleOfOuter:Qd}=E,{toPoint:$d}=yt,Jd={},tc={};function ec(t,e,i,s,r){let n;const{width:o,height:a}=t;if(o!==a||s){const t=Vd(e,i);n=Kd(),r?(Qd(n,e,o/a*(s||1),1),Zd(n,e,t+90)):(Qd(n,e,1,o/a*(s||1)),Zd(n,e,t))}return n}const{getDistance:ic}=I,{toPoint:sc}=yt,rc={},nc={};const oc={linearGradient:function(t,i){let{from:s,to:r,type:n,blendMode:o,opacity:a}=t;Hd(s||"top",i,jd),Hd(r||"bottom",i,Xd);const h=e.canvas.createLinearGradient(jd.x,jd.y,Xd.x,Xd.y);Gd(h,t.stops,a);const l={type:n,style:h};return o&&(l.blendMode=o),l},radialGradient:function(t,i){let{from:s,to:r,type:n,opacity:o,blendMode:a,stretch:h}=t;$d(s||"center",i,Jd),$d(r||"bottom",i,tc);const l=e.canvas.createRadialGradient(Jd.x,Jd.y,0,Jd.x,Jd.y,qd(Jd,tc));Gd(l,t.stops,o);const d={type:n,style:l},c=ec(i,Jd,tc,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(t,i){let{from:s,to:r,type:n,opacity:o,blendMode:a,stretch:h}=t;sc(s||"center",i,rc),sc(r||"bottom",i,nc);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,rc.x,rc.y):e.canvas.createRadialGradient(rc.x,rc.y,0,rc.x,rc.y,ic(rc,nc));Gd(l,t.stops,o);const d={type:n,style:l},c=ec(i,rc,nc,h||1,e.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:ec},{copy:ac,toOffsetOutBounds:hc}=at,lc={},dc={};function cc(t,i,s,r){const{bounds:n,shapeBounds:o}=r;if(e.fullImageShadow){if(ac(lc,t.bounds),lc.x+=i.x-o.x,lc.y+=i.y-o.y,s){const{matrix:t}=r;lc.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),lc.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),lc.width*=s,lc.height*=s}t.copyWorld(r.canvas,t.bounds,lc)}else s&&(ac(lc,i),lc.x-=i.width/2*(s-1),lc.y-=i.height/2*(s-1),lc.width*=s,lc.height*=s),t.copyWorld(r.canvas,o,s?lc:i)}const{toOffsetOutBounds:uc}=at,_c={};const pc={shadow:function(t,e,i){let s,r;const{__nowWorld:n,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;hc(l,dc),a.forEach(((a,g)=>{_.setWorldShadow(dc.offsetX+a.x*c,dc.offsetY+a.y*u,a.blur*c,Xa.string(a.color)),r=a.spread?1+2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,cc(_,dc,r,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),s=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,s,n,a.blendMode):e.copyWorldToInner(_,s,o.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;uc(l,_c),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(_c.offsetX+a.x*c,_c.offsetY+a.y*u,a.blur*c),r=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,cc(_,_c,r,i),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Xa.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(_,s,n,a.blendMode):e.copyWorldToInner(_,s,o.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:gc}=On;function fc(t,e,i,s,r,n){switch(e){case"grayscale":r.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),s.recycle(r),mc(t,e,i,1)}(t,i,s,r);break;case"opacity-path":mc(t,i,s,n);break;case"path":i.restore()}}function yc(t){return t.getSameCanvas(!1,!0)}function mc(t,e,i,s){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r),i.recycle(r)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(o&&(fc(this,o,t,r,s,n),s=r=null),"path"===a||"clipping-path"===a?(i.opacity<1?(o="opacity-path",n=i.opacity,r||(r=yc(t))):(o="path",t.save()),i.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=yc(t)),r||(r=yc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||gc(i,e)||i.__render(r||t,e);fc(this,o,t,r,s,n)};const vc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",wc=vc+"_#~&*+\\=|≮≯≈≠=…",xc=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 bc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Ec=bc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Bc=bc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),kc=bc(vc),Pc=bc(wc),Sc=bc("- —/~|┆·");var Rc;!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"}(Rc||(Rc={}));const{Letter:Cc,Single:Tc,Before:Lc,After:Ac,Symbol:Dc,Break:Oc}=Rc;function Ic(t){return Ec[t]?Cc:Sc[t]?Oc:Bc[t]?Lc:kc[t]?Ac:Pc[t]?Dc:xc.test(t)?Tc:Cc}const Fc={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function Mc(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:Wc}=Fc,{Letter:Uc,Single:Nc,Before:zc,After:Yc,Symbol:Hc,Break:jc}=Rc;let Xc,Gc,Vc,qc,Kc,Zc,Qc,$c,Jc,tu,eu,iu,su,ru,nu,ou,au,hu=[];function lu(t,e){Jc&&!$c&&($c=Jc),Xc.data.push({char:t,width:e}),Vc+=e}function du(){qc+=Vc,Xc.width=Vc,Gc.words.push(Xc),Xc={data:[]},Vc=0}function cu(){ru&&(nu.paraNumber++,Gc.paraStart=!0,ru=!1),Jc&&(Gc.startCharSize=$c,Gc.endCharSize=Jc,$c=0),Gc.width=qc,ou.width?Wc(Gc):au&&uu(),hu.push(Gc),Gc={words:[]},qc=0}function uu(){qc>(nu.maxWidth||0)&&(nu.maxWidth=qc)}const{top:_u,right:pu,bottom:gu,left:fu}=t.Direction4;function yu(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const mu={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let s=0,r=0,n=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(n?(s=l[fu],n-=l[pu]+l[fu]):i.autoSizeAlign||(s=l[fu]),o?(r=l[_u],o-=l[_u]+l[gu]):i.autoSizeAlign||(r=l[_u]));const d={bounds:{x:s,y:r,width:n,height:o},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){nu=t,hu=t.rows,ou=t.bounds,au=!ou.width&&!s.autoSizeAlign;const{__letterSpacing:r,paraIndent:n,textCase:o}=s,{canvas:a}=e,{width:h,height:l}=ou;if(h||l||r||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;ru=!0,eu=null,$c=Qc=Jc=Vc=qc=0,Xc={data:[]},Gc={words:[]};for(let s=0,l=i.length;s<l;s++)Zc=i[s],"\n"===Zc?(Vc&&du(),Gc.paraEnd=!0,cu(),ru=!0):(tu=Ic(Zc),tu===Uc&&"none"!==o&&(Zc=Mc(Zc,o,!Vc)),Qc=a.measureText(Zc).width,r&&(r<0&&(Jc=Qc),Qc+=r),iu=tu===Nc&&(eu===Nc||eu===Uc)||eu===Nc&&tu!==Yc,su=!(tu!==zc&&tu!==Nc||eu!==Hc&&eu!==Yc),Kc=ru&&n?h-n:h,t&&h&&qc+Vc+Qc>Kc&&(e?(Vc&&du(),qc&&cu()):(su||(su=tu===Uc&&eu==Yc),iu||su||tu===jc||tu===zc||tu===Nc||Vc+Qc>Kc?(Vc&&du(),qc&&cu()):qc&&cu()))," "===Zc&&!0!==ru&&qc+Vc===0||(tu===jc?(" "===Zc&&Vc&&du(),lu(Zc,Qc),du()):iu||su?(Vc&&du(),lu(Zc,Qc)):lu(Zc,Qc)),eu=tu);Vc&&du(),qc&&cu(),hu.length>0&&(hu[hu.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{nu.paraNumber++,qc=a.measureText(t).width,hu.push({x:n||0,text:t,width:qc,paraStart:!0}),au&&uu()}))}(d,t,i),l&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":yu(e,"x",t[fu]);break;case"right":yu(e,"x",-t[pu])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":yu(e,"y",t[_u]);break;case"bottom":yu(e,"y",-t[gu])}}(l,d,i,n,o),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(v=i[o],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=n,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(d,i),function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===r||"both"===r)&&u>1?(i-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,n),d.overflow&&function(t,i,s,r){if(!r)return;const{rows:n,overflow:o}=t;let{textOverflow:a}=i;if(n.splice(o),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+r-l;("none"===i.textWrap?n:[n[o-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,n),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:r}=e;switch(t.decorationHeight=s/11,"object"==typeof r?(i=r.type,r.color&&(t.decorationColor=Xa.string(r.color))):i=r,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,i),d}};const vu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!Xa.object)return t;t=Xa.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};Object.assign(ja,mu),Object.assign(Xa,vu),Object.assign(qa,hd),Object.assign(Ka,Yd),Object.assign(Za,oc),Object.assign(Qa,pc),Object.assign(i,{interaction:(t,e,i,s)=>new Il(t,e,i,s),hitCanvas:(t,e)=>new wa(t,e),hitCanvasManager:()=>new Ml}),ba();class wu extends oh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function xu(t,e){return Tr(t,(t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?th.setStyleName(this,e,i):th.set(this,i):this.__layout.stateStyleChanged=!0}})))}function bu(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function Eu(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function Bu(t,e){"object"!=typeof e&&(e=void 0),Su(t,e,"in")}function ku(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),Su(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;t instanceof Array?t.forEach((t=>this.__loadRobot(t,e,e+=t.total||1))):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),void 0!==t)if("number"==typeof t)this.now=t;else if("object"==typeof t){const e=t instanceof Array,i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Er.get(t);s.ready?this.__createFrames(s,t,e,i):s.load((()=>this.__createFrames(s,t,e,i)))}__createFrames(t,e,i,s){const{offset:r,size:n,total:o}=e,{width:a,height:h}=n&&("number"==typeof n?{width:n,height:n}:n)||(o>1?this:t);let l=r?r.x:0,d=r?r.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:d,width:a,height:h},l+a>=t.width?(l=0,d+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Jn(Jn.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:r}=this;r&&(r.FPS&&(i=r.FPS),void 0!==r.loop&&(s=r.loop)),this.__timer=setTimeout((()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)}),1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:r}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,r)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},Xt([rn(wu)],t.Robot.prototype,"__",void 0),Xt([Wr()],t.Robot.prototype,"robot",void 0),Xt([Dr()],t.Robot.prototype,"actions",void 0),Xt([Dr("")],t.Robot.prototype,"action",void 0),Xt([Vr(0)],t.Robot.prototype,"now",void 0),Xt([Dr(12)],t.Robot.prototype,"FPS",void 0),Xt([Dr(!0)],t.Robot.prototype,"loop",void 0),t.Robot=Xt([_n()],t.Robot),Tt.add("robot");const Pu={};function Su(t,e,i){const{normalStyle:s}=t;e||(e=Pu),e.scale&&(h.assignScale(e,e.scale),delete e.scale),e!==Pu&&th.canAnimate||(i=null);let r=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&Ht(i[s])&&Ht(e[s])&&(s="transition");return Ht(e[s])?i[s]:e[s]}(i,e,t);const n=r?function(t,e){const i=Tu(e,t),s=t.animate();s&&Tu(i,t,s.fromStyle);return i}(t,e):void 0;th.canAnimate&&Ru(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=Ru(t);if(o){const{animation:s}=o;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(o,n.endingStyle),"in"!==i||e.animation!==s?n.kill():r=!1,delete o.animation}t.normalStyle=Cu(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(r){const e=Cu(n,t);t.set(n,"temp"),t.animate([n,e],r,"transition",!0)}t.__layout.stateStyleChanged=!1}function Ru(t){let e;const i={},s=Eu(t),r=s?t.state||s.state:t.state,n=r&&t.states[r];n&&th.isState(r,t,s)&&(e=Lu(i,n));const o=i.selectedStyle||t.selectedStyle;o&&th.isSelected(t,s)&&(e=Lu(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&th.isPlacehold(t,s)&&(e=Lu(i,a)),th.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Lu(i,s))}else{const r=i.focusStyle||t.focusStyle;r&&th.isFocus(t,s)&&(e=Lu(i,r));const n=i.hoverStyle||t.hoverStyle;n&&th.isHover(t,s)&&(e=Lu(i,n));const o=i.pressStyle||t.pressStyle;o&&th.isPress(t,s)&&(e=Lu(i,o))}return e?i:void 0}function Cu(t,e,i,s){const r=i?t:{},n=i||t;for(let t in n)s&&th.animateExcludes[t]||(r[t]=e[t]);return r}function Tu(t,e,i){return Cu(t,e,i,!0)}function Lu(t,e){return Object.assign(t,e),!0}function Au(t,e){const i=t[e];i&&Bu(t,i),t.button&&Ou(t.children,e)}function Du(t,e,i){i||(i=t.states[e]),Bu(t,i),t.button&&Ou(t.children,null,e)}function Ou(t,e,i){if(!t)return;let s,r;for(let n=0,o=t.length;n<o;n++){if(s=t[n],e){switch(r=!0,e){case"hoverStyle":th.isHover(s)&&(r=!1);break;case"pressStyle":th.isPress(s)&&(r=!1);break;case"focusStyle":th.isFocus(s)&&(r=!1)}r&&Au(s,e)}else void 0!==i&&Du(s,i);s.isBranch&&Ou(s.children,e,i)}}function Iu(t,e){const i=t[e];i&&ku(t,i),t.button&&Mu(t.children,e)}function Fu(t,e,i){ku(t,i),t.button&&Mu(t.children,null,e)}function Mu(t,e,i){if(!t)return;let s;for(let r=0,n=t.length;r<n;r++)s=t[r],e?Iu(s,e):void 0!==i&&Fu(s,i),s.isBranch&&Mu(s.children,e,i)}function Wu(t,e,i){let s;const r=e.leafer?e.leafer.interaction:null;if(r&&(s=r[t](e),!s&&i)){const n=Eu(e,i);n&&(s=r[t](n))}return s}function Uu(t,e,i){let s=e[t];if(!s&&i){const r=Eu(e,i);r&&(s=r[t])}return s}Tt.add("state"),th.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},th.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const r=Eu(e,i);r&&(s=r.states[t])}return!!s}(t,e,i)},th.isSelected=function(t,e){return Uu("selected",t,e)},th.isDisabled=function(t,e){return Uu("disabled",t,e)},th.isFocus=function(t,e){return Wu("isFocus",t,e)},th.isHover=function(t,e){return Wu("isHover",t,e)},th.isPress=function(t,e){return Wu("isPress",t,e)},th.isPlacehold=function(t,e){return t.__.__isPlacehold},th.isDrag=function(t,e){return Wu("isDrag",t,e)},th.setStyleName=function(t,e,i){i?Du(t,e,t[e]):Fu(t,e,t[e])},th.set=function(t,e){const i=t.states[e];i?Du(t,e,i):Fu(t,e,i)},th.getStyle=Ru,th.updateStyle=Su,th.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Au(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Iu(e,"hoverStyle");break;case t.PointerEvent.DOWN:Au(e,"pressStyle");break;case t.PointerEvent.UP:Iu(e,"pressStyle")}};const Nu=t.UI.prototype;t.UI.addAttr("selected",!1,xu,"selectedStyle"),t.UI.addAttr("disabled",!1,xu,"disabledStyle"),t.UI.addAttr("states",{},bu),t.UI.addAttr("state","",xu),t.UI.addAttr("normalStyle",void 0,Dr),t.UI.addAttr("hoverStyle",void 0,bu),t.UI.addAttr("pressStyle",void 0,bu),t.UI.addAttr("focusStyle",void 0,bu),t.UI.addAttr("selectedStyle",void 0,bu),t.UI.addAttr("disabledStyle",void 0,bu),t.UI.addAttr("placeholderStyle",void 0,bu),t.UI.addAttr("button",!1,Dr),Nu.focus=function(t=!0){this.waitLeafer((()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Au(this,"focusStyle"):Iu(this,"focusStyle")}))},Nu.updateState=function(){th.updateStyle(this,void 0,"in")};const zu=t.Text.prototype,Yu="text";Rr(zu,Yu,Object.assign(Object.assign({},Cr(zu,Yu)),{set(t){const e=this,i=e.text;e.__setAttr(Yu,t)&&(Nr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:Hu,sin:ju,pow:Xu,sqrt:Gu,abs:Vu,ceil:qu,floor:Ku,round:Zu,PI:Qu}=Math,$u=5*Qu,Ju=1.70158,t_=2.5949095,e_=7.5625,i_=2.75;function s_(t){return e=>Xu(e,t)}function r_(t){return e=>1-Xu(1-e,t)}function n_(t){return e=>e<.5?.5*Xu(2*e,t):1-.5*Xu(2-2*e,t)}function o_(t){return t<1/i_?e_*t*t:t<2/i_?e_*(t-=1.5/i_)*t+.75:t<2.5/i_?e_*(t-=2.25/i_)*t+.9375:e_*(t-=2.625/i_)*t+.984375}function a_(t,e,i,s){const r={};return n=>{const o=~~(1e4*n),a=r[o];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=h_(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Vu(l)<1e-6));e++)c-=d/l;return r[o]=h_(c,e,s)}}function h_(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const l_={get(t){const{list:e}=l_;return"string"==typeof t?e[t||"ease"]:"object"==typeof t?e[t.name].apply(e,t.value instanceof Array?t.value:[t.value]):e.ease},register(t,e){l_.list[t]=e},list:{linear:t=>t,ease:a_(.25,.1,.25,1),"ease-in":a_(.42,0,1,1),"ease-out":a_(0,0,.58,1),"ease-in-out":a_(.42,0,.58,1),"sine-in":t=>1-Hu(t*Qu*.5),"sine-out":t=>ju(t*Qu*.5),"sine-in-out":t=>.5*(1-Hu(t*Qu)),"quad-in":s_(2),"quad-out":r_(2),"quad-in-out":n_(2),"cubic-in":s_(3),"cubic-out":r_(3),"cubic-in-out":n_(3),"quart-in":s_(4),"quart-out":r_(4),"quart-in-out":n_(4),"quint-in":s_(5),"quint-out":r_(5),"quint-in-out":n_(5),"expo-in":t=>t?Xu(2,10*t-10):0,"expo-out":t=>1===t?1:1-Xu(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Xu(2,2*t*10-10):.5*(2-Xu(2,10-2*t*10)),"circ-in":t=>1-Gu(1-Xu(t,2)),"circ-out":t=>Gu(1-Xu(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Gu(1-Xu(2*t,2))):.5*(Gu(1-Xu(2-2*t,2))+1),"back-in":t=>((Ju+1)*t-Ju)*t*t,"back-out":t=>(t-=1)*t*((Ju+1)*t+Ju)+1,"back-in-out":t=>t<.5?(t*=2)*t*((t_+1)*t-t_)*.5:.5*((t=2*t-2)*t*((t_+1)*t+t_)+2),"elastic-in":t=>0===t||1===t?t:-Xu(2,10*(t-1))*ju((t-1.1)*$u),"elastic-out":t=>0===t||1===t?t:Xu(2,-10*t)*ju((t-.1)*$u)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Xu(2,10*((t*=2)-1))*ju((t-1.1)*$u)*.5:Xu(2,10*(1-(t*=2)))*ju((t-1.1)*$u)*.5+1,"bounce-in":t=>1-o_(1-t),"bounce-out":o_,"bounce-in-out":t=>t<.5?.5*(1-o_(1-2*t)):.5*(1+o_(2*t-1)),"cubic-bezier":a_,steps:function(t,e="floor"){return i=>("floor"===e?Ku(i*t):"ceil"===e?qu(i*t):Zu(i*t))/t}}};function d_(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class c_{}c_.CREATED="created",c_.PLAY="play",c_.PAUSE="pause",c_.STOP="stop",c_.SEEK="seek",c_.UPDATE="update",c_.COMPLETED="completed";t.Animate=class extends oo{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:r}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&r&&"number"==typeof r&&(t+=r-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=e instanceof Array?e:e?[e]:[];const{easing:r,attrs:n}=this;this.easingFn=l_.get(r),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce(((t,e)=>(t[e]=!0,t)),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout((()=>{this.timer=0,this.play()}),0))}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emit(c_.PLAY,this))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emit(c_.PAUSE,this))}stop(){this.destroyed||(this.complete(),this.emit(c_.STOP,this))}seek(t){this.destroyed||("object"==typeof t&&(t=Ga.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer((()=>this.requestAnimate())),this.emit(c_.SEEK,this))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:r}=i,n=!(r>1)||this.join;let o,a,h,l,d,c=0,u=0;r>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<r;s++){if(a=i[s],l=a.style||a,o||(o=n?t:l),h={style:l,beforeStyle:{}},d=1,a.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:r,swing:n,loop:o}=a;n&&(h.swing="number"==typeof n?n:2,d=2*h.swing-1),o&&(h.loop=d="number"==typeof o?o:2),t?(h.duration=t,c+=t*d,i&&(h.totalTime=t+i)):e&&(h.autoDuration=e,u+=e*d),i?(h.delay=i,c+=i*d):s&&(h.autoDelay=s,u+=s*d),r&&(h.easingFn=l_.get(r))}if(h.autoDuration||void 0!==h.duration||(r>1?s>0||n?u+=d:h.duration=0:h.duration=this.duration),r>1)this.setBefore(h,l,o);else{for(let e in l)h.beforeStyle[e]=t[e];this.fromStyle=h.beforeStyle,this.toStyle=h.style}o=l,e.push(h)}u?((this.duration<=c||!s||!s.duration)&&this.changeDuration(c+.2*u),this.allocateTime((this.duration-c)/u)):c&&this.changeDuration(c),this.emit(c_.CREATED,this)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:r,target:n}=this;for(let o in e)void 0===s[o]&&(s[o]=r[o]=e===i?i[o]:n[o]),t.beforeStyle[o]=void 0===i[o]?r[o]:i[o],r[o]=e[o]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let r=0;r<s;r++)e=i[r],void 0===e.duration&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emit(c_.COMPLETED,this)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,r=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(r);else{const{attrsMap:i,target:n}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),eh.setBetweenStyle(o,s,r,e,t,n,i),this.setStyle(o)}this.emit(c_.UPDATE,this)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return"number"==typeof e&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},Xt([d_("ease")],t.Animate.prototype,"easing",void 0),Xt([d_(0)],t.Animate.prototype,"delay",void 0),Xt([d_(.2)],t.Animate.prototype,"duration",void 0),Xt([d_("auto")],t.Animate.prototype,"ending",void 0),Xt([d_(!1)],t.Animate.prototype,"reverse",void 0),Xt([d_(!1)],t.Animate.prototype,"swing",void 0),Xt([d_(!1)],t.Animate.prototype,"loop",void 0),Xt([d_(0)],t.Animate.prototype,"loopDelay",void 0),Xt([d_(1)],t.Animate.prototype,"speed",void 0),Xt([d_(!0)],t.Animate.prototype,"autoplay",void 0),Xt([d_()],t.Animate.prototype,"join",void 0),Xt([d_()],t.Animate.prototype,"attrs",void 0),t.Animate=Xt([un(mo)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every((t=>t.completed))}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=e.map((e=>{const s=e.target?e:new t.Animate(this.target,e,i);return Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s}))}play(){this.each((t=>t.play()))}pause(){this.each((t=>t.pause()))}stop(){this.each((t=>t.stop()))}seek(t){this.each((e=>e.seek(t)))}kill(t,e){this.each((i=>i.kill(t,e))),this.destroy()}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each((e=>e.destroy(t))),e.length=0)}},t.AnimateList=Xt([un(mo)],t.AnimateList);const u_={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},__=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,p_=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,g_=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,f_=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,y_=parseInt,m_=parseFloat,{round:v_}=Math;let w_={},x_=0;function b_(t){let e,i,s,r=1;switch(t.length){case 9:e=y_(t.slice(1,3),16),i=y_(t.slice(3,5),16),s=y_(t.slice(5,7),16),r=y_(t.slice(7,9),16)/255;break;case 7:e=y_(t.slice(1,3),16),i=y_(t.slice(3,5),16),s=y_(t.slice(5,7),16);break;case 5:e=y_(t[1]+t[1],16),i=y_(t[2]+t[2],16),s=y_(t[3]+t[3],16),r=y_(t[4]+t[4],16)/255;break;case 4:e=y_(t[1]+t[1],16),i=y_(t[2]+t[2],16),s=y_(t[3]+t[3],16);break;case 3:e=i=s=y_(t[1]+t[2],16);break;case 2:e=i=s=y_(t[1]+t[1],16)}return{r:e,g:i,b:s,a:r}}const E_=1/6,B_=.5,k_=2/3,P_=1/3;function S_(t,e,i){return i<0?i++:i>1&&i--,i<E_?t+6*(e-t)*i:i<B_?e:i<k_?t+(e-t)*(k_-i)*6:t}function R_(t,e,i,s=1){let r,n,o;if(t/=360,i/=100,0===(e/=100))r=n=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;r=S_(a,s,t+P_),n=S_(a,s,t),o=S_(a,s,t-P_)}return{r:v_(255*r),g:v_(255*n),b:v_(255*o),a:s}}Tt.add("color"),Xa.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=w_[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=b_(t);break;case"R":case"r":"("===t[4]&&p_.test(t)?i=function(t){const e=p_.exec(t);return{r:y_(e[1]),g:y_(e[2]),b:y_(e[3]),a:m_(e[4])}}(t):"("===t[3]&&__.test(t)&&(i=function(t){const e=__.exec(t);return{r:y_(e[1]),g:y_(e[2]),b:y_(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&f_.test(t)?i=function(t){const e=f_.exec(t);return R_(m_(e[1]),m_(e[2]),m_(e[3]),m_(e[4]))}(t):"("===t[3]&&g_.test(t)&&(i=function(t){const e=g_.exec(t);return R_(m_(e[1]),m_(e[2]),m_(e[3]),1)}(t))}if(!i){const e=u_[t.toLowerCase()];e&&(i=b_("#"+e))}i&&(x_++,x_>1e4&&(w_={},x_=0),w_[t]=Object.assign({},i))}}else"object"==typeof t&&(void 0===t.a&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:C_}=Math,{fourNumber:T_}=h,L_={fill:F_,stroke:F_,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?O_(t,e,i):(t=T_(t),e=T_(e),t.map(((t,s)=>O_(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,r=e.length,n=O_(s,r,i,1);return s<r?e.substring(0,n):t.substring(0,n)}return"number"==typeof t||"number"==typeof e?h.float(O_(t,e,i),Math.max(D_(t),D_(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const r=Object.assign(Object.assign({},t),e);return eh.setBetweenStyle(r,t,e,r,i,s),r},shadow:M_,innerShadow:M_},A_={value:function(t,e,i){const s="number"==typeof t,r="number"==typeof e;return s&&r?t+(e-t)*i:r||s?O_(t,e,i):t},number:O_,color:I_,setBetweenStyle:function(t,e,i,s,r,n,o){let a,h,l;const{list:d,value:c}=eh;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,r,n)))}};function D_(t){const e=String(t).split(".")[1];return e?e.length:0}function O_(t,e,i,s){t||(t=0),e||(e=0);const r=t+(e-t)*i;return s?C_(r):r}function I_(t,e,i){t=Xa.object(t),e=Xa.object(e);const s=O_(t.r,e.r,i,1)+","+O_(t.g,e.g,i,1)+","+O_(t.b,e.b,i,1),r=O_(t.a,e.a,i);return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}function F_(t,e,i){return"string"==typeof t&&"string"==typeof e?I_(t,e,i):e}function M_(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:O_((t=t||{}).x,e.x,i),y:O_(t.y,e.y,i),blur:O_(t.blur,e.blur,i),spread:O_(t.spread,e.spread,i),color:I_(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Tt.add("animate","color"),th.canAnimate=!0,Object.assign(eh.list,L_),Object.assign(eh,A_);const W_=t.UI.prototype;t.UI.addAttr("animation",void 0,(function(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),t.UI.addAttr("animationOut",void 0,Dr),t.UI.addAttr("transition",!0,Dr),t.UI.addAttr("transitionOut",void 0,Dr),W_.animate=function(e,i,s,r){if(void 0===e)return this.__animate;let n=e instanceof Array&&!i&&s?new t.AnimateList(this,e,r):new t.Animate(this,e,i,r);this.killAnimate(s,n.toStyle);const o=this.__animate;return o&&(n instanceof t.AnimateList?n.list.unshift(o):n=new t.AnimateList(this,[o,n])),this.__animate=n},W_.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:r}=s;for(let t in i)if(t in r){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},W_.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(c_.COMPLETED,e)};const U_=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],N_=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:z_}=Math,{getDerivative:Y_}=Ae,H_={getDistance(t,e,i,s,r,n,o,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<U_.length;h++)l=f*(1+U_[h]),d=f*(1-U_[h]),c=Y_(l,t,i,r,o),u=Y_(l,e,s,n,a),_=Y_(d,t,i,r,o),p=Y_(d,e,s,n,a),g+=N_[h]*(z_(c*c+u*u)+z_(_*_+p*p));return g*f},getRotation(t,e,i,s,r,n,o,a,h){const l=Y_(t,e,s,n,a),c=Y_(t,i,r,o,h);return Math.atan2(c,l)/d},getT(t,e,i,s,r,n,o,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)j_(i,s,r,n,o,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,r,n,o,a,h,l){const d=1-e,c=d*i+e*r,u=d*s+e*n,_=d*r+e*o,p=d*n+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*o+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(oe.C,c,u,g,f,y,m)}},{getDistance:j_}=H_,{M:X_,L:G_,C:V_,Z:q_}=oe,K_={},Z_={},Q_={transform(t,e){let i,s=0;const r=t.length;for(;s<r;)switch(i=t[s],i){case X_:case G_:Q_.transformPoints(t,e,s,1),s+=3;break;case V_:Q_.transformPoints(t,e,s,3),s+=7;break;case q_:s+=1}},transformPoints(t,e,i,s){for(let r=i+1,n=r+2*s;r<n;r+=2)K_.x=t[r],K_.y=t[r+1],E.toOuterPoint(e,K_),t[r]=K_.x,t[r+1]=K_.y},getMotionPathData(t){let e,i,s,r,n=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(r=t[a],r){case X_:case G_:i=t[a+1],s=t[a+2],e=r===G_&&a>0?I.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case V_:i=t[a+5],s=t[a+6],e=H_.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case q_:a+=1;default:e=0}o.push(e),n+=e}return{total:n,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:r}=t;e=Ga.number(e,t.total);let n,o,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=r.length;for(;f<w;){switch(h=r[f],h){case X_:case G_:if(o=r[f+1],a=r[f+2],n=s[y],p+n>=e||!t.total)return f||(m=o,v=a),Z_.x=m,Z_.y=v,g.x=o,g.y=a,I.getDistancePoint(Z_,g,e-p,!0),g.rotation=I.getAngle(Z_,g),g;m=o,v=a,f+=3;break;case V_:if(o=r[f+5],a=r[f+6],n=s[y],p+n>=e)return l=r[f+1],d=r[f+2],c=r[f+3],u=r[f+4],_=H_.getT(e-p,n,m,v,l,d,c,u,o,a,i),Ae.getPointAndSet(_,m,v,l,d,c,u,o,a,g),g.rotation=H_.getRotation(_,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case q_:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:r}=t,n=[];e=Ga.number(e,t.total);let o,a,h,l,d,c,u,_,p,g=0,f={},y=0,m=0,v=0,w=0;const x=r.length;for(;y<x;){switch(l=r[y],l){case X_:case G_:if(a=r[y+1],h=r[y+2],o=s[m],g+o>=e||!t.total)return y||(v=a,w=h),Z_.x=v,Z_.y=w,f.x=a,f.y=h,I.getDistancePoint(Z_,f,e-g,!0),n.push(l,f.x,f.y),n;v=a,w=h,y+=3,n.push(l,v,w);break;case V_:if(d=r[y+1],c=r[y+2],u=r[y+3],_=r[y+4],a=r[y+5],h=r[y+6],o=s[m],g+o>=e)return p=H_.getT(e-g,o,v,w,d,c,u,_,a,h,i),H_.cut(n,p,v,w,d,c,u,_,a,h),n;v=a,w=h,y+=7,n.push(l,d,c,u,_,a,h);break;case q_:y+=1,n.push(l);default:o=0}m++,g+=o}return n}};function $_(t){return Tr(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!Ht(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}Tt.add("motion-path"),eh.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=Ga.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=Ga.number(e,s.getMotionTotal())):e=0,eh.number(t,e,i)})),eh.register("motionRotation",(function(t,e,i){return eh.number(t,e,i)}));const J_=t.UI.prototype,{updateMatrix:tp,updateAllMatrix:ep}=Pn,{updateBounds:ip}=Fn;function sp(t){const{motion:e,leaferIsCreated:i}=t;if(!Ht(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=np(t);i.total&&(t.__.__pathForRender=Q_.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(ep(t),ip(t,t)):tp(t));i&&(t.leafer.created=!0)}}function rp(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function np(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Q_.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,$_),t.UI.addAttr("motionPrecision",1,$_),t.UI.addAttr("motion",void 0,$_),t.UI.addAttr("motionRotation",!0,$_),J_.getMotionPathData=function(){return np(rp(this))},J_.getMotionPoint=function(t){const e=rp(this),i=np(e);if(!i.total)return{};const s=Q_.getDistancePoint(i,t,e.motionPrecision);E.toOuterPoint(e.localTransform,s);const{motionRotation:r}=this;return!1===r?delete s.rotation:"number"==typeof r&&(s.rotation+=r),s},J_.getMotionTotal=function(){return this.getMotionPathData().total},J_.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],Ht(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),sp(t))}else sp(this)};const{Yes:op,NoAndSkip:ap,YesAndSkip:hp}=t.Answer,lp={},dp={},cp={};class up{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 r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":lp.id=t.substring(1),t=lp;break;case".":dp.className=t.substring(1),t=dp;break;default:cp.tag=t,t=cp}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,r=s instanceof Array;return this.getByMethod(r?this.methods.tags:this.methods.tag,e,i,r?Wt.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className);case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Pn.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 r=i?null:[];return this.eachFind(this.toChildren(e),t,r,s),r||this.findLeaf}eachFind(t,e,i,s){let r,n;for(let o=0,a=t.length;o<a;o++){if(r=t[o],n=e(r,s),n===op||n===hp){if(!i)return void(this.findLeaf=r);i.push(r)}r.isBranch&&n<ap&&this.eachFind(r.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Qn.REMOVE,this.__onRemoveChild,this),this.target.on_($n.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 _p=t.UI.prototype;function pp(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}return _p.find=function(t,e){return pp(this).getBy(t,this,!1,e)},_p.findOne=function(t,e){return pp(this).getBy(t,this,!0,e)},Tt.add("find"),i.finder=function(t){return new up(t)},t.AlignHelper=wt,t.AnimateEasing=l_,t.AnimateEvent=c_,t.AroundHelper=yt,t.AutoBounds=_t,t.BezierHelper=Ae,t.Bounds=ct,t.BoundsHelper=at,t.BoxData=lh,t.BranchHelper=Fn,t.BranchRender=Uo,t.CanvasData=bh,t.CanvasManager=Mt,t.ChildEvent=Qn,t.ColorConvert=Xa,t.Creator=i,t.Cursor=Fl,t.DataHelper=Wt,t.Debug=Et,t.Dragger=kl,t.Effect=Qa,t.EllipseData=ph,t.EllipseHelper=ze,t.Event=Zn,t.EventCreator=It,t.Eventer=oo,t.Export=Ja,t.FileHelper=gr,t.Filter=$a,t.Finder=up,t.FrameData=ch,t.GroupData=hh,t.HighBezierHelper=H_,t.HighCurveHelper=Q_,t.HitCanvasManager=Ml,t.ImageData=xh,t.ImageEvent=Jn,t.ImageManager=Er,t.IncrementId=s,t.InteractionBase=Il,t.InteractionHelper=vl,t.Keyboard=_l,t.LayoutEvent=io,t.Layouter=Ia,t.LeafBounds=Fo,t.LeafBoundsHelper=On,t.LeafData=Nt,t.LeafDataProxy=xo,t.LeafEventer=mo,t.LeafHelper=Pn,t.LeafLayout=Kn,t.LeafLevelList=va,t.LeafList=ma,t.LeafMatrix=Ro,t.LeafRender=Mo,t.LeaferCanvas=wa,t.LeaferCanvasBase=se,t.LeaferData=dh,t.LeaferEvent=ro,t.LeaferImage=Sr,t.LineData=uh,t.MathHelper=h,t.Matrix=Y,t.MatrixHelper=E,t.MyDragEvent=ml,t.MyImage=al,t.MyPointerEvent=fl,t.NeedConvertToCanvasCommandMap=he,t.OneRadian=d,t.PI2=c,t.PI_2=u,t.Paint=qa,t.PaintGradient=Za,t.PaintImage=Ka,t.PathArrow=Va,t.PathBounds=rr,t.PathCommandDataHelper=qi,t.PathCommandMap=oe,t.PathConvert=ki,t.PathCorner=cr,t.PathCreator=cs,t.PathData=yh,t.PathDrawer=Ps,t.PathHelper=re,t.PathNumberCommandLengthMap=ue,t.PathNumberCommandMap=ce,t.PenData=mh,t.Picker=Ua,t.Platform=e,t.Plugin=Tt,t.Point=N,t.PointHelper=I,t.PointerButton=pl,t.PolygonData=gh,t.PropertyEvent=$n,t.RectData=_h,t.RectHelper=_e,t.RectRender=Ph,t.RenderEvent=so,t.Renderer=Ma,t.ResizeEvent=to,t.Resource=xr,t.RobotData=wu,t.Run=St,t.Selector=Na,t.StarData=fh,t.State=th,t.StringNumberMap=xt,t.TaskItem=mr,t.TaskProcessor=vr,t.TextConvert=ja,t.TextData=wh,t.Transition=eh,t.TwoPointBoundsHelper=j,t.UIBounds=Eh,t.UICreator=At,t.UIData=oh,t.UIEvent=gl,t.UIRender=Bh,t.UnitConvert=Ga,t.WaitHelper=Nn,t.WatchEvent=eo,t.Watcher=Ba,t.affectRenderBoundsType=Gr,t.affectStrokeBoundsType=Hr,t.attr=Lr,t.autoLayoutType=Ir,t.boundsType=Wr,t.canvasPatch=pr,t.canvasSizeAttrs=ie,t.cursorType=sn,t.dataProcessor=rn,t.dataType=Dr,t.decorateLeafAttr=Tr,t.defineDataProcessor=nn,t.defineKey=Rr,t.defineLeafAttr=Ar,t.doBoundsType=Nr,t.doStrokeType=jr,t.effectType=za,t.emptyData=Yt,t.eraserType=tn,t.getBoundsData=p,t.getDescriptor=Cr,t.getMatrixData=g,t.getPointData=_,t.hitType=en,t.isEmptyData=jt,t.isNull=Ht,t.layoutProcessor=function(t){return(e,i)=>{Rr(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=Jr,t.motionPathType=$_,t.naturalBoundsType=Ur,t.opacityType=qr,t.pathInputType=zr,t.pathType=Yr,t.pen=ur,t.positionType=Or,t.registerUI=_n,t.registerUIEvent=pn,t.resizeType=Ya,t.rewrite=ln,t.rewriteAble=dn,t.rotationType=Mr,t.scaleType=Fr,t.sortType=$r,t.stateStyleType=bu,t.stateType=xu,t.strokeType=Xr,t.surfaceType=Vr,t.tempBounds=ut,t.tempMatrix=H,t.tempPoint=z,t.useCanvas=ba,t.useModule=un,t.version="1.6.2",t.visibleType=Kr,t.zoomLayerType=Ha,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
|